blob: 5affd19a2fdf063b64a0dddb1d65a10984950b72 [file] [log] [blame]
Fariborz Jahanian2ebe7eb2009-10-12 20:11:40 +00001// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
2
3struct A {
4 operator int&();
Fariborz Jahaniana9cca892009-10-15 17:14:05 +00005 operator long*& ();
Fariborz Jahanian2ebe7eb2009-10-12 20:11:40 +00006};
7
8struct B {
9 operator long&();
Fariborz Jahaniana9cca892009-10-15 17:14:05 +000010 operator int*& ();
Fariborz Jahanian2ebe7eb2009-10-12 20:11:40 +000011};
12
13struct C : B, A { };
14
15void test(C c) {
16 ++c; // expected-error {{use of overloaded operator '++' is ambiguous}}\
Fariborz Jahanian866b2742009-10-16 23:25:02 +000017 // expected-note {{built-in candidate operator++(int &)}} \
18 // expected-note {{built-in candidate operator++(long &)}} \
19 // expected-note {{built-in candidate operator++(long *&)}} \
20 // expected-note {{built-in candidate operator++(int *&)}}
Fariborz Jahanian2ebe7eb2009-10-12 20:11:40 +000021}
22
Fariborz Jahaniana9cca892009-10-15 17:14:05 +000023struct A1 { operator volatile int&(); };
24
25struct B1 { operator volatile long&(); };
26
27struct C1 : B1, A1 { };
28
29void test(C1 c) {
30 ++c; // expected-error {{use of overloaded operator '++' is ambiguous}} \
Fariborz Jahanian866b2742009-10-16 23:25:02 +000031 // expected-note {{built-in candidate operator++(int volatile &)}} \
32 // expected-note {{built-in candidate operator++(long volatile &)}}
Fariborz Jahaniana9cca892009-10-15 17:14:05 +000033}
Fariborz Jahanian2ebe7eb2009-10-12 20:11:40 +000034