blob: 6e96e03f72454728bb812ee711ad115324649c86 [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
Fariborz Jahanian2ebe7eb2009-10-12 20:11:40 +00002
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}} \
Chris Lattner58f9e132010-09-05 00:04:01 +000031 // expected-note {{built-in candidate operator++(volatile int &)}} \
32 // expected-note {{built-in candidate operator++(volatile long &)}}
Fariborz Jahaniana9cca892009-10-15 17:14:05 +000033}
Fariborz Jahanian2ebe7eb2009-10-12 20:11:40 +000034