[cfe-commits] r170056 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/SemaCXX/new-delete.cpp
Eli Friedman
eli.friedman at gmail.com
Wed Dec 12 16:37:17 PST 2012
Author: efriedma
Date: Wed Dec 12 18:37:17 2012
New Revision: 170056
URL: http://llvm.org/viewvc/llvm-project?rev=170056&view=rev
Log:
Add missing check for error return from DefaultLvalueConversion. Fixes <rdar://problem/12857416>.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/new-delete.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=170056&r1=170055&r2=170056&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed Dec 12 18:37:17 2012
@@ -2026,6 +2026,8 @@
if (!Ex.get()->isTypeDependent()) {
// Perform lvalue-to-rvalue cast, if needed.
Ex = DefaultLvalueConversion(Ex.take());
+ if (Ex.isInvalid())
+ return ExprError();
QualType Type = Ex.get()->getType();
Modified: cfe/trunk/test/SemaCXX/new-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-delete.cpp?rev=170056&r1=170055&r2=170056&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/new-delete.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-delete.cpp Wed Dec 12 18:37:17 2012
@@ -499,3 +499,14 @@
DeferredCookieTaskTest() {}
};
}
+
+class DeletingPlaceholder {
+ int* f() {
+ delete f; // expected-error {{reference to non-static member function must be called; did you mean to call it with no arguments?}}
+ return 0;
+ }
+ int* g(int, int) {
+ delete g; // expected-error {{reference to non-static member function must be called}}
+ return 0;
+ }
+};
More information about the cfe-commits
mailing list