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