[cfe-commits] r133219 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaCXX/overloaded-name.cpp
Douglas Gregor
dgregor at apple.com
Thu Jun 16 17:15:10 PDT 2011
Author: dgregor
Date: Thu Jun 16 19:15:10 2011
New Revision: 133219
URL: http://llvm.org/viewvc/llvm-project?rev=133219&view=rev
Log:
Check for placeholder expressions before promoting an argument passed
through an ellipsis. Fixes <rdar://problem/9623945>.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/overloaded-name.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=133219&r1=133218&r2=133219&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jun 16 19:15:10 2011
@@ -439,7 +439,11 @@
/// interfaces passed by value.
ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT,
FunctionDecl *FDecl) {
- ExprResult ExprRes = DefaultArgumentPromotion(E);
+ ExprResult ExprRes = CheckPlaceholderExpr(E);
+ if (ExprRes.isInvalid())
+ return ExprError();
+
+ ExprRes = DefaultArgumentPromotion(E);
if (ExprRes.isInvalid())
return ExprError();
E = ExprRes.take();
Modified: cfe/trunk/test/SemaCXX/overloaded-name.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overloaded-name.cpp?rev=133219&r1=133218&r2=133219&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overloaded-name.cpp (original)
+++ cfe/trunk/test/SemaCXX/overloaded-name.cpp Thu Jun 16 19:15:10 2011
@@ -12,3 +12,19 @@
(void)(b? ovl<float> : &ovl); // expected-error{{cannot resolve overloaded function 'ovl' from context}}
(void)(b? ovl<float> : ovl<float>);
}
+
+namespace rdar9623945 {
+ void f(...) {
+ }
+
+ class X {
+ public:
+ const char* text(void);
+ void g(void) {
+ f(text());
+ f(text); // expected-error{{a bound member function may only be called}}
+ f(text());
+ f(text); // expected-error{{a bound member function may only be called}}
+ }
+ };
+}
More information about the cfe-commits
mailing list