Shih-wei Liao | f8fd82b | 2010-02-10 11:10:31 -0800 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x |
| 2 | |
| 3 | struct A { |
| 4 | operator int&(); |
| 5 | operator long*& (); |
| 6 | }; |
| 7 | |
| 8 | struct B { |
| 9 | operator long&(); |
| 10 | operator int*& (); |
| 11 | }; |
| 12 | |
| 13 | struct C : B, A { }; |
| 14 | |
| 15 | void test(C c) { |
| 16 | ++c; // expected-error {{use of overloaded operator '++' is ambiguous}}\ |
| 17 | // 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 *&)}} |
| 21 | } |
| 22 | |
| 23 | struct A1 { operator volatile int&(); }; |
| 24 | |
| 25 | struct B1 { operator volatile long&(); }; |
| 26 | |
| 27 | struct C1 : B1, A1 { }; |
| 28 | |
| 29 | void test(C1 c) { |
| 30 | ++c; // expected-error {{use of overloaded operator '++' is ambiguous}} \ |
| 31 | // expected-note {{built-in candidate operator++(int volatile &)}} \ |
| 32 | // expected-note {{built-in candidate operator++(long volatile &)}} |
| 33 | } |
| 34 | |