summaryrefslogtreecommitdiff
path: root/test/SemaCXX
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-06-21 23:54:45 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-06-21 23:54:45 +0000
commitc8fa525b5b81eeb7a62294dd3218ca2a6ccf0a6a (patch)
tree6cf514ff311b585dee44789b3baef620aecdc6b0 /test/SemaCXX
parentfb1ff863c3db99829ed81f8906b4bd3666c4e550 (diff)
downloadclang-c8fa525b5b81eeb7a62294dd3218ca2a6ccf0a6a.tar.gz
Provide suggested no-arg calls for overloaded member functions missing calls
Reviewed by Richard Smith. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX')
-rw-r--r--test/SemaCXX/addr-of-overloaded-function.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/SemaCXX/addr-of-overloaded-function.cpp b/test/SemaCXX/addr-of-overloaded-function.cpp
index 95223f0f5e..3d007a9612 100644
--- a/test/SemaCXX/addr-of-overloaded-function.cpp
+++ b/test/SemaCXX/addr-of-overloaded-function.cpp
@@ -57,7 +57,7 @@ struct B
struct C {
C &getC() {
- return makeAC; // expected-error-re{{reference to non-static member function must be called$}}
+ return makeAC; // expected-error{{reference to non-static member function must be called; did you mean to call it with no arguments?}}
}
// FIXME: filter by const so we can unambiguously suggest '()' & point to just the one candidate, probably
@@ -70,6 +70,32 @@ struct C {
void g() {
int (&fp)() = f; // expected-error{{address of overloaded function 'f' does not match required type 'int ()'}}
}
+
+ template<typename T>
+ void q1(int); // expected-note{{possible target for call}}
+ template<typename T>
+ void q2(T t = T()); // expected-note{{possible target for call}}
+ template<typename T>
+ void q3(); // expected-note{{possible target for call}}
+ template<typename T1, typename T2>
+ void q4(); // expected-note{{possible target for call}}
+ template<typename T1 = int> // expected-warning{{default template arguments for a function template are a C++11 extension}}
+ void q5(); // expected-note{{possible target for call}}
+
+ void h() {
+ // Do not suggest '()' since an int argument is required
+ q1<int>; // expected-error-re{{reference to non-static member function must be called$}}
+ // Suggest '()' since there's a default value for the only argument & the
+ // type argument is already provided
+ q2<int>; // expected-error{{reference to non-static member function must be called; did you mean to call it with no arguments?}}
+ // Suggest '()' since no arguments are required & the type argument is
+ // already provided
+ q3<int>; // expected-error{{reference to non-static member function must be called; did you mean to call it with no arguments?}}
+ // Do not suggest '()' since another type argument is required
+ q4<int>; // expected-error-re{{reference to non-static member function must be called$}}
+ // Suggest '()' since the type parameter has a default value
+ q5; // expected-error{{reference to non-static member function must be called; did you mean to call it with no arguments?}}
+ }
};
// PR6886