Implement Sema::isExprCallable.
We can use this to produce nice diagnostics (and try to fixit-and-recover) in
various cases where we might see "MyFunction" instead of "MyFunction()". The
changes in SemaExpr are an example of how to use isExprCallable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130878 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/member-expr.cpp b/test/SemaCXX/member-expr.cpp
index 68af415..981bae7 100644
--- a/test/SemaCXX/member-expr.cpp
+++ b/test/SemaCXX/member-expr.cpp
@@ -124,10 +124,10 @@
return fun.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it with no arguments?}}
}
- S fun2(); // expected-note{{possibly valid overload here}}
- S fun2(int i); // expected-note{{possibly valid overload here}}
+ S fun2();
+ S fun2(int i);
int g2() {
- return fun2.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it?}}
+ return fun2.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it with no arguments?}}
}
S fun3(int i=0);
@@ -140,4 +140,10 @@
int g4() {
return fun4.x; // expected-error{{base of member reference is a function; perhaps you meant to call it?}}
}
+
+ S fun5(int i); // expected-note{{possibly valid overload here}}
+ S fun5(float f); // expected-note{{possibly valid overload here}}
+ int g5() {
+ return fun5.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it?}}
+ }
}