[cfe-commits] r146354 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/CXX/special/class.dtor/p10-0x.cpp

David Blaikie dblaikie at gmail.com
Sun Dec 11 20:13:55 PST 2011


Author: dblaikie
Date: Sun Dec 11 22:13:55 2011
New Revision: 146354

URL: http://llvm.org/viewvc/llvm-project?rev=146354&view=rev
Log:
Fix/test decltype dtor calls with invalid base expression.

Modified:
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/test/CXX/special/class.dtor/p10-0x.cpp

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=146354&r1=146353&r2=146354&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sun Dec 11 22:13:55 2011
@@ -266,7 +266,7 @@
 }
 
 ParsedType Sema::getDestructorType(const DeclSpec& DS, ParsedType ObjectType) {
-    if (DS.getTypeSpecType() == DeclSpec::TST_error)
+    if (DS.getTypeSpecType() == DeclSpec::TST_error || !ObjectType)
       return ParsedType();
     assert(DS.getTypeSpecType() == DeclSpec::TST_decltype 
            && "only get destructor types from declspecs");

Modified: cfe/trunk/test/CXX/special/class.dtor/p10-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.dtor/p10-0x.cpp?rev=146354&r1=146353&r2=146354&view=diff
==============================================================================
--- cfe/trunk/test/CXX/special/class.dtor/p10-0x.cpp (original)
+++ cfe/trunk/test/CXX/special/class.dtor/p10-0x.cpp Sun Dec 11 22:13:55 2011
@@ -22,4 +22,5 @@
   x->~decltype(x)(); // expected-error{{destructor type 'decltype(x)' (aka 'const A *') in object destruction expression does not match the type 'const A' of the object being destroyed}}
   // this last one could be better, mentioning that the nested-name-specifier could be removed or a type name after the ~
   x->::A::~decltype(*x)(); // expected-error{{expected a class name after '~' to name a destructor}}
+  y->~decltype(A())(); // expected-error{{use of undeclared identifier 'y'}}
 }





More information about the cfe-commits mailing list