Patch from Brian Brooks!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167604
91177308-0d34-0410-b5e6-
96231b3b80d8
// that calls this method, using Object for the implicit object
// parameter and passing along the remaining arguments.
CXXMethodDecl *Method = cast<CXXMethodDecl>(Best->Function);
+
+ // An error diagnostic has already been printed when parsing the declaration.
+ if (Method->isStatic())
+ return ExprError();
+
const FunctionProtoType *Proto =
Method->getType()->getAs<FunctionProtoType>();
operator int; // expected-error{{'operator int' cannot be the name of a variable or data member}}
int operator+; // expected-error{{'operator+' cannot be the name of a variable or data member}}
};
+
+namespace PR14120 {
+ struct A {
+ static void operator()(int& i) { ++i; } // expected-error{{overloaded 'operator()' cannot be a static member function}}
+ };
+ void f() {
+ int i = 0;
+ A()(i);
+ }
+}