[cfe-commits] r152375 - in /cfe/trunk: a.out lib/Sema/SemaExprCXX.cpp test/SemaObjCXX/properties.mm
John McCall
rjmccall at apple.com
Thu Mar 8 20:08:29 PST 2012
Author: rjmccall
Date: Thu Mar 8 22:08:29 2012
New Revision: 152375
URL: http://llvm.org/viewvc/llvm-project?rev=152375&view=rev
Log:
Perform l2r conversions on delete operands before doing
type-analysis; otherwise, we just completely do the
wrong thing for placeholders.
Added:
cfe/trunk/a.out (with props)
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaObjCXX/properties.mm
Added: cfe/trunk/a.out
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/a.out?rev=152375&view=auto
==============================================================================
Binary files cfe/trunk/a.out (added) and cfe/trunk/a.out Thu Mar 8 22:08:29 2012 differ
Propchange: cfe/trunk/a.out
------------------------------------------------------------------------------
svn:executable = *
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=152375&r1=152374&r2=152375&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Mar 8 22:08:29 2012
@@ -1972,6 +1972,9 @@
bool UsualArrayDeleteWantsSize = false;
if (!Ex.get()->isTypeDependent()) {
+ // Perform lvalue-to-rvalue cast, if needed.
+ Ex = DefaultLvalueConversion(Ex.take());
+
QualType Type = Ex.get()->getType();
if (const RecordType *Record = Type->getAs<RecordType>()) {
@@ -2053,9 +2056,6 @@
}
}
- // Perform lvalue-to-rvalue cast, if needed.
- Ex = DefaultLvalueConversion(Ex.take());
-
// C++ [expr.delete]p2:
// [Note: a pointer to a const type can be the operand of a
// delete-expression; it is not necessary to cast away the constness
Modified: cfe/trunk/test/SemaObjCXX/properties.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/properties.mm?rev=152375&r1=152374&r2=152375&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/properties.mm (original)
+++ cfe/trunk/test/SemaObjCXX/properties.mm Thu Mar 8 22:08:29 2012
@@ -85,3 +85,24 @@
}
template void test6_template(Test6*);
+
+// rdar://problem/10965735
+struct Test7PointerMaker {
+ operator char *() const;
+};
+ at interface Test7
+- (char*) implicit_property;
+- (char) bad_implicit_property;
+- (Test7PointerMaker) implicit_struct_property;
+ at property int *explicit_property;
+ at property int bad_explicit_property;
+ at property Test7PointerMaker explicit_struct_property;
+ at end
+void test7(Test7 *ptr) {
+ delete ptr.implicit_property;
+ delete ptr.bad_implicit_property; // expected-error {{cannot delete expression of type 'char'}}
+ delete ptr.explicit_property;
+ delete ptr.bad_explicit_property; // expected-error {{cannot delete expression of type 'int'}}
+ delete ptr.implicit_struct_property;
+ delete ptr.explicit_struct_property;
+}
More information about the cfe-commits
mailing list