Index: clang/lib/Sema/SemaExprCXX.cpp =================================================================== --- clang/lib/Sema/SemaExprCXX.cpp +++ clang/lib/Sema/SemaExprCXX.cpp @@ -6854,8 +6854,9 @@ QualType DestructedType) { // If this is a record type, check if its destructor is callable. if (auto *RD = DestructedType->getAsCXXRecordDecl()) { - if (CXXDestructorDecl *D = SemaRef.LookupDestructor(RD)) - return SemaRef.CanUseDecl(D, /*TreatUnavailableAsInvalid=*/false); + if (RD->hasDefinition()) + if (CXXDestructorDecl *D = SemaRef.LookupDestructor(RD)) + return SemaRef.CanUseDecl(D, /*TreatUnavailableAsInvalid=*/false); return false; } Index: clang/test/SemaCXX/incomplete-call.cpp =================================================================== --- clang/test/SemaCXX/incomplete-call.cpp +++ clang/test/SemaCXX/incomplete-call.cpp @@ -48,6 +48,10 @@ c(); // expected-error{{incomplete type in call to object of type}} } +void test_incomplete_object_dtor(C *p) { + p.~C(); // expected-error{{member reference type 'C *' is a pointer; did you mean to use '->'?}} +} + namespace pr18542 { struct X { int count;