Add missing check for error return from DefaultLvalueConversion. Fixes <rdar://problem/12857416>.

llvm-svn: 170056
This commit is contained in:
Eli Friedman 2012-12-13 00:37:17 +00:00
parent caaf4dd516
commit 89a4a2cd3d
2 changed files with 13 additions and 0 deletions

View File

@ -2026,6 +2026,8 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
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();

View File

@ -499,3 +499,14 @@ namespace PR12061 {
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;
}
};