Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / overloaded-operators-display-order-crash.cpp
blob5abd048f1d136e5924756a1188b39cc8de8402c0
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: not %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s
4 namespace ambig {
5 struct Foo {
6 operator int();
7 operator const char *();
8 };
11 void func(const char*, long);
12 void func(const char*, const char*);
13 void func(int, int);
15 bool doit(Foo x) {
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)
21 // CHECK-NEXT: ^~~~
22 // CHECK-NEXT: note: candidate function
23 // CHECK-NEXT: void func(const char*, const char*)
24 // CHECK-NEXT: ^
25 // CHECK-NEXT: note: candidate function
26 // CHECK-NEXT: void func(int, int)
30 namespace bad_conversion {
31 struct Foo {
32 operator int();
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);
41 bool doit(Foo x) {
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)
47 // CHECK-NEXT: ^~~~
48 // CHECK-NEXT: note: candidate function
49 // CHECK-NEXT: void func(double*, const char*, const char*)
50 // CHECK-NEXT: ^
51 // CHECK-NEXT: note: candidate function
52 // CHECK-NEXT: void func(double*, int, int)