diff options
author | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | 952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /test/SemaCXX/addr-of-overloaded-function.cpp | |
parent | ea266cad53e3d49771fa38103913d3ec7a166694 (diff) | |
download | FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz |
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/SemaCXX/addr-of-overloaded-function.cpp')
-rw-r--r-- | test/SemaCXX/addr-of-overloaded-function.cpp | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/test/SemaCXX/addr-of-overloaded-function.cpp b/test/SemaCXX/addr-of-overloaded-function.cpp index 096f748..230a1eb 100644 --- a/test/SemaCXX/addr-of-overloaded-function.cpp +++ b/test/SemaCXX/addr-of-overloaded-function.cpp @@ -57,11 +57,12 @@ struct B struct C { C &getC() { - return makeAC; // expected-error{{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?}} } - C &makeAC(); - const C &makeAC() const; + // FIXME: filter by const so we can unambiguously suggest '()' & point to just the one candidate, probably + C &makeAC(); // expected-note{{possible target for call}} + const C &makeAC() const; // expected-note{{possible target for call}} static void f(); // expected-note{{candidate function}} static void f(int); // expected-note{{candidate function}} @@ -69,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 @@ -208,3 +235,7 @@ namespace test1 { void (Qualifiers::*X)() = &Dummy::N; // expected-error{{cannot initialize a variable of type 'void (test1::Qualifiers::*)()' with an rvalue of type 'void (test1::Dummy::*)()': different classes ('test1::Qualifiers' vs 'test1::Dummy')}} } + +template <typename T> class PR16561 { + virtual bool f() { if (f) {} return false; } // expected-error {{reference to non-static member function must be called}} +}; |