[PATCH] D17143: When trying to get destructor name, make we have a complete type before calling LookupQualifiedName(), which will assert otherwise.

don hinton via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 13 08:41:34 PST 2016


hintonda updated this revision to Diff 47914.
hintonda added a comment.

- Simplify diff


http://reviews.llvm.org/D17143

Files:
  lib/Sema/SemaExprCXX.cpp
  test/SemaCXX/pr25156-crash-on-invalid.cpp

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}}
+}
Index: lib/Sema/SemaExprCXX.cpp
===================================================================
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -189,7 +189,7 @@
     // 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)
+    if (Step == 0 && LookupCtx && !RequireCompleteDeclContext(SS, LookupCtx))
       LookupQualifiedName(Found, LookupCtx);
     else if (Step == 1 && LookInScope && S)
       LookupName(Found, S);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17143.47914.patch
Type: text/x-patch
Size: 974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160213/b5934d36/attachment.bin>


More information about the cfe-commits mailing list