From 952eddef9aff85b1e92626e89baaf7a360e2ac85 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 22 Dec 2013 00:07:40 +0000 Subject: Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3): https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841 --- test/SemaCXX/addr-of-overloaded-function.cpp | 37 +++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'test/SemaCXX/addr-of-overloaded-function.cpp') 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 + void q1(int); // expected-note{{possible target for call}} + template + void q2(T t = T()); // expected-note{{possible target for call}} + template + void q3(); // expected-note{{possible target for call}} + template + void q4(); // expected-note{{possible target for call}} + template // 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; // 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; // 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; // 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; // 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 class PR16561 { + virtual bool f() { if (f) {} return false; } // expected-error {{reference to non-static member function must be called}} +}; -- cgit v1.1