// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s namespace std { class type_info {}; } void one() { } void two() { } // expected-note 4{{possible target for call}} void two(int) { } // expected-note 4{{possible target for call}} template void twoT() { } // expected-note 5{{possible target for call}} template void twoT(int) { } // expected-note 5{{possible target for call}} template void oneT() { } template void oneT(U) { } /* The target can be an object or reference being initialized (8.5, 8.5.3), the left side of an assignment (5.17), a parameter of a function (5.2.2), a parameter of a user-defined operator (13.5), the return value of a function, operator function, or conversion (6.6.3), an explicit type conversion (5.2.3, 5.2.9, 5.4), or a non-type template-parameter (14.3.2) */ //#include template struct test { }; int main() { one; // expected-warning {{expression result unused}} two; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} oneT; // expected-warning {{expression result unused}} twoT; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} typeid(oneT); // expected-warning{{expression result unused}} sizeof(oneT); // expected-error {{invalid application of 'sizeof' to a function type}} sizeof(twoT); //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} decltype(oneT)* fun = 0; *one; // expected-warning {{expression result unused}} *oneT; // expected-warning {{expression result unused}} *two; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} expected-error {{indirection requires pointer operand}} *twoT; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} !oneT; // expected-warning {{expression result unused}} expected-warning {{address of function 'oneT' will always evaluate to 'true'}} expected-note {{prefix with the address-of operator to silence this warning}} +oneT; // expected-warning {{expression result unused}} -oneT; //expected-error {{invalid argument type}} oneT == 0; // expected-warning {{equality comparison result unused}} \ // expected-note {{use '=' to turn this equality comparison into an assignment}} \ // expected-warning {{comparison of function 'oneT' equal to a null pointer is always false}} \ // expected-note {{prefix with the address-of operator to silence this warning}} 0 == oneT; // expected-warning {{equality comparison result unused}} \ // expected-warning {{comparison of function 'oneT' equal to a null pointer is always false}} \ // expected-note {{prefix with the address-of operator to silence this warning}} 0 != oneT; // expected-warning {{inequality comparison result unused}} \ // expected-warning {{comparison of function 'oneT' not equal to a null pointer is always true}} \ // expected-note {{prefix with the address-of operator to silence this warning}} (false ? one : oneT); // expected-warning {{expression result unused}} void (*p1)(int); p1 = oneT; int i = (int) (false ? (void (*)(int))twoT : oneT); //expected-error {{incompatible operand}} (twoT) == oneT; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} {{cannot resolve overloaded function 'twoT' from context}} bool b = oneT; // expected-warning {{address of function 'oneT' will always evaluate to 'true'}} expected-note {{prefix with the address-of operator to silence this warning}} void (*p)() = oneT; test > ti; void (*u)(int) = oneT; b = (void (*)()) twoT; one < one; // expected-warning {{self-comparison always evaluates to false}} \ // expected-warning {{relational comparison result unused}} \ // expected-warning {{ordered comparison of function pointers}} oneT < oneT; // expected-warning {{self-comparison always evaluates to false}} \ // expected-warning {{relational comparison result unused}} \ // expected-warning {{ordered comparison of function pointers}} two < two; //expected-error 2 {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} expected-error {{invalid operands to binary expression ('void' and 'void')}} twoT < twoT; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} {{cannot resolve overloaded function 'twoT' from context}} oneT == 0; // expected-warning {{equality comparison result unused}} \ // expected-note {{use '=' to turn this equality comparison into an assignment}} \ // expected-warning {{comparison of function 'oneT' equal to a null pointer is always false}} \ // expected-note {{prefix with the address-of operator to silence this warning}} } struct rdar9108698 { template void f(); // expected-note{{possible target for call}} }; void test_rdar9108698(rdar9108698 x) { x.f; // expected-error{{reference to non-static member function must be called}} } namespace GCC_PR67898 { void f(int); void f(float); template struct X { static_assert(b, ""); }; template void test1() { X(); } template void test2() { X(); } template void test1(); template void test2(); }