1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: not %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s
7 operator const char *();
11 void func(const char*, long);
12 void func(const char*, const char*);
16 func(x
, x
); // expected-error {{call to 'func' is ambiguous}}
17 // expected-note@* 3{{candidate}}
18 // Check that two functions with best conversions are at the top.
19 // CHECK: error: call to 'func' is ambiguous
20 // CHECK-NEXT: func(x, x)
22 // CHECK-NEXT: note: candidate function
23 // CHECK-NEXT: void func(const char*, const char*)
25 // CHECK-NEXT: note: candidate function
26 // CHECK-NEXT: void func(int, int)
30 namespace bad_conversion
{
33 operator const char *();
37 void func(double*, const char*, long);
38 void func(double*, const char*, const char*);
39 void func(double*, int, int);
42 func((int*)0, x
, x
); // expected-error {{no matching function for call to 'func'}}
43 // expected-note@* 3{{candidate}}
44 // Check that two functions with best conversions are at the top.
45 // CHECK: error: no matching function for call to 'func'
46 // CHECK-NEXT: func((int*)0, x, x)
48 // CHECK-NEXT: note: candidate function
49 // CHECK-NEXT: void func(double*, const char*, const char*)
51 // CHECK-NEXT: note: candidate function
52 // CHECK-NEXT: void func(double*, int, int)
56 namespace bad_deduction
{
57 template <class> struct templ
{};
58 template <class T
> void func(templ
<T
>);
59 template <class T
> void func(T
*);
60 template <class T
> auto func(T
&) -> decltype(T().begin());
61 template <class T
> auto func(const T
&) -> decltype(T().begin());
65 func(r
); // expected-error {{no matching function for call to 'func'}}
66 // expected-note@* 4{{candidate}}