xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/overloaded-name.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc int ovl(int); // expected-note 3{{possible target for call}}
4*f4a2713aSLionel Sambuc float ovl(float); // expected-note 3{{possible target for call}}
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc template<typename T> T ovl(T); // expected-note 3{{possible target for call}}
7*f4a2713aSLionel Sambuc 
test(bool b)8*f4a2713aSLionel Sambuc void test(bool b) {
9*f4a2713aSLionel Sambuc   (void)((void)0, ovl); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}}
10*f4a2713aSLionel Sambuc   // PR7863
11*f4a2713aSLionel Sambuc   (void)(b? ovl : &ovl); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}}
12*f4a2713aSLionel Sambuc   (void)(b? ovl<float> : &ovl); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}}
13*f4a2713aSLionel Sambuc   (void)(b? ovl<float> : ovl<float>);
14*f4a2713aSLionel Sambuc }
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc namespace rdar9623945 {
f(...)17*f4a2713aSLionel Sambuc   void f(...) {
18*f4a2713aSLionel Sambuc   }
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc   class X {
21*f4a2713aSLionel Sambuc   public:
22*f4a2713aSLionel Sambuc     const char* text(void);
g(void)23*f4a2713aSLionel Sambuc     void g(void) {
24*f4a2713aSLionel Sambuc       f(text());
25*f4a2713aSLionel Sambuc       f(text); // expected-error {{reference to non-static member function must be called; did you mean to call it with no arguments?}}
26*f4a2713aSLionel Sambuc       f(text());
27*f4a2713aSLionel Sambuc       f(text); // expected-error {{reference to non-static member function must be called; did you mean to call it with no arguments?}}
28*f4a2713aSLionel Sambuc     }
29*f4a2713aSLionel Sambuc   };
30*f4a2713aSLionel Sambuc }
31