| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 |
| 2 |
|
| 3 |
enum E2 { }; |
| 4 |
|
| 5 |
struct A { |
| 6 |
operator E2&(); // expected-note 3 {{candidate function}} |
| 7 |
}; |
| 8 |
|
| 9 |
struct B { |
| 10 |
operator E2&(); // expected-note 3 {{candidate function}} |
| 11 |
}; |
| 12 |
|
| 13 |
struct C : B, A { |
| 14 |
}; |
| 15 |
|
| 16 |
void test(C c) { |
| 17 |
const E2 &e2 = c; // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}} |
| 18 |
} |
| 19 |
|
| 20 |
void foo(const E2 &);// expected-note{{passing argument to parameter here}} |
| 21 |
|
| 22 |
const E2 & re(C c) { |
| 23 |
foo(c); // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}} |
| 24 |
|
| 25 |
return c; // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}} |
| 26 |
} |
| 27 |
|
| 28 |
namespace CWG2352 { |
| 29 |
void f(const int * const &) = delete; |
| 30 |
void f(int *); |
| 31 |
|
| 32 |
void g(int * &); |
| 33 |
void g(const int *) = delete; |
| 34 |
|
| 35 |
void h1(int *const * const &); |
| 36 |
void h1(const int *const *) = delete; |
| 37 |
void h2(const int *const * const &) = delete; |
| 38 |
void h2(int *const *); |
| 39 |
|
| 40 |
void test() { |
| 41 |
int *x; |
| 42 |
// Under CWG2352, this became ambiguous. We order by qualification |
| 43 |
// conversion even when comparing a reference binding to a |
| 44 |
// non-reference-binding. |
| 45 |
f(x); |
| 46 |
g(x); |
| 47 |
h1(&x); |
| 48 |
h2(&x); |
| 49 |
} |
| 50 |
} |