]> granicus.if.org Git - clang/commitdiff
Commiting a revert from dgregor of a bit of destructor logic until we can
authorChandler Carruth <chandlerc@gmail.com>
Sun, 21 Feb 2010 10:19:54 +0000 (10:19 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 21 Feb 2010 10:19:54 +0000 (10:19 +0000)
figure out how not to break lots of code using this. See PR6358 and PR6359 for
motivating examples. FIXME's left in the code and the test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96733 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprCXX.cpp
test/SemaCXX/pseudo-destructors.cpp

index 3cbba8c9ff55ac16be7d0e0c745e77a66a9f3943..4cb58d8d19c9657b8135b2e1601782e60a63a818 100644 (file)
@@ -66,32 +66,26 @@ Action::TypeTy *Sema::getDestructorName(SourceLocation TildeLoc,
     //   If a pseudo-destructor-name (5.2.4) contains a
     //   nested-name-specifier, the type-names are looked up as types
     //   in the scope designated by the nested-name-specifier. Similarly, in 
-    //   a qualified-id of theform:
+    //   a qualified-id of the form:
     //
     //     :: [opt] nested-name-specifier[opt] class-name :: ~class-name 
     //
     //   the second class-name is looked up in the same scope as the first.
     //
-    // To implement this, we look at the prefix of the
-    // nested-name-specifier we were given, and determine the lookup
-    // context from that.
-    NestedNameSpecifier *NNS = (NestedNameSpecifier *)SS.getScopeRep();
-    if (NestedNameSpecifier *Prefix = NNS->getPrefix()) {
-      CXXScopeSpec PrefixSS;
-      PrefixSS.setScopeRep(Prefix);
-      LookupCtx = computeDeclContext(PrefixSS, EnteringContext);
-      isDependent = isDependentScopeSpecifier(PrefixSS);
-    } else if (ObjectTypePtr) {
+    // FIXME: We don't implement this, because it breaks lots of
+    // perfectly reasonable code that no other compilers diagnose. The
+    // issue is that the first class-name is looked up as a
+    // nested-name-specifier, so we ignore value declarations, but the
+    // second lookup is presumably an ordinary name lookup. Hence, we
+    // end up finding values (say, a function) and complain. See PRs
+    // 6358 and 6359 for examples of such code. DPG to investigate
+    // further.
+    if (ObjectTypePtr) {
       LookupCtx = computeDeclContext(SearchType);
       isDependent = SearchType->isDependentType();
     } else {
       LookupCtx = computeDeclContext(SS, EnteringContext);
-      if (LookupCtx && !LookupCtx->isTranslationUnit()) {
-        LookupCtx = LookupCtx->getParent();
-        isDependent = LookupCtx->isDependentContext();
-      } else {
-        isDependent = false;
-      }
+      isDependent = LookupCtx->isDependentContext();
     }
 
     LookInScope = false;
index 13ffe1b2005cb1afd31db79265553d889ef9294d..02e2c14ca117956e81cc3aaca18df5cae75a1aad 100644 (file)
@@ -28,7 +28,7 @@ void f(A* a, Foo *f, int *i) {
   g().~Bar(); // expected-error{{non-scalar}}
   
   f->::~Bar();
-  f->N::~Wibble(); // expected-error{{expected the class name after '~' to name a destructor}}
+  f->N::~Wibble(); // FIXME: Cannot use typedef name in destructor id.
   
   f->::~Bar(17, 42); // expected-error{{cannot have any arguments}}
 }