Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -189,9 +189,10 @@ // have one) and, if that fails to find a match, in the scope (if // we're allowed to look there). Found.clear(); - if (Step == 0 && LookupCtx) - LookupQualifiedName(Found, LookupCtx); - else if (Step == 1 && LookInScope && S) + if (Step == 0 && LookupCtx) { + if (!RequireCompleteDeclContext(SS, LookupCtx)) + LookupQualifiedName(Found, LookupCtx); + } else if (Step == 1 && LookInScope && S) LookupName(Found, S); else continue; Index: test/SemaCXX/pr25156-crash-on-invalid.cpp =================================================================== --- /dev/null +++ test/SemaCXX/pr25156-crash-on-invalid.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// Don't crash (PR25156). + +class foo; // expected-note {{forward declaration of 'foo'}} +void f() { + foo::~foo(); // expected-error {{incomplete type 'foo' named in nested name specifier}} +}