[cfe-commits] r105823 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/SemaCXX/pseudo-destructors.cpp
John McCall
rjmccall at apple.com
Fri Jun 11 10:36:40 PDT 2010
Author: rjmccall
Date: Fri Jun 11 12:36:40 2010
New Revision: 105823
URL: http://llvm.org/viewvc/llvm-project?rev=105823&view=rev
Log:
Allow pseudo-destructors to be called on qualified pointers. Patch by
Troy Straszheim!
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/pseudo-destructors.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=105823&r1=105822&r2=105823&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Jun 11 12:36:40 2010
@@ -2841,7 +2841,7 @@
if (ScopeTypeInfo) {
QualType ScopeType = ScopeTypeInfo->getType();
if (!ScopeType->isDependentType() && !ObjectType->isDependentType() &&
- !Context.hasSameType(ScopeType, ObjectType)) {
+ !Context.hasSameUnqualifiedType(ScopeType, ObjectType)) {
Diag(ScopeTypeInfo->getTypeLoc().getLocalSourceRange().getBegin(),
diag::err_pseudo_dtor_type_mismatch)
Modified: cfe/trunk/test/SemaCXX/pseudo-destructors.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/pseudo-destructors.cpp?rev=105823&r1=105822&r2=105823&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/pseudo-destructors.cpp (original)
+++ cfe/trunk/test/SemaCXX/pseudo-destructors.cpp Fri Jun 11 12:36:40 2010
@@ -14,6 +14,11 @@
typedef int OtherInteger;
}
+template <typename T>
+void cv_test(const volatile T* cvt) {
+ cvt->T::~T(); // no-warning
+}
+
void f(A* a, Foo *f, int *i, double *d) {
a->~A();
a->A::~A();
@@ -41,8 +46,14 @@
i->N::OtherInteger::~Integer(); // expected-error{{'Integer' does not refer to a type name in pseudo-destructor expression; expected the name of type 'int'}}
i->N::~Integer(); // expected-error{{'Integer' does not refer to a type name in pseudo-destructor expression; expected the name of type 'int'}}
i->Integer::~Double(); // expected-error{{the type of object expression ('int') does not match the type being destroyed ('Double' (aka 'double')) in pseudo-destructor expression}}
+
+ cv_test(a);
+ cv_test(f);
+ cv_test(i);
+ cv_test(d);
}
+
typedef int Integer;
void destroy_without_call(int *ip) {
@@ -57,3 +68,4 @@
void test_X0(N1::X0 &x0) {
x0.~X0();
}
+
More information about the cfe-commits
mailing list