| Daniel Dunbar | 8fbe78f | 2009-12-15 20:14:24 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x | 
| Fariborz Jahanian | e719643 | 2009-10-12 20:11:40 +0000 | [diff] [blame] | 2 |  | 
|  | 3 | struct A { | 
|  | 4 | operator int&(); | 
| Fariborz Jahanian | 3b937fa | 2009-10-15 17:14:05 +0000 | [diff] [blame] | 5 | operator long*& (); | 
| Fariborz Jahanian | e719643 | 2009-10-12 20:11:40 +0000 | [diff] [blame] | 6 | }; | 
|  | 7 |  | 
|  | 8 | struct B { | 
|  | 9 | operator long&(); | 
| Fariborz Jahanian | 3b937fa | 2009-10-15 17:14:05 +0000 | [diff] [blame] | 10 | operator int*& (); | 
| Fariborz Jahanian | e719643 | 2009-10-12 20:11:40 +0000 | [diff] [blame] | 11 | }; | 
|  | 12 |  | 
|  | 13 | struct C : B, A { }; | 
|  | 14 |  | 
|  | 15 | void test(C c) { | 
|  | 16 | ++c; // expected-error {{use of overloaded operator '++' is ambiguous}}\ | 
| Fariborz Jahanian | 956127d | 2009-10-16 23:25:02 +0000 | [diff] [blame] | 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 *&)}} | 
| Fariborz Jahanian | e719643 | 2009-10-12 20:11:40 +0000 | [diff] [blame] | 21 | } | 
|  | 22 |  | 
| Fariborz Jahanian | 3b937fa | 2009-10-15 17:14:05 +0000 | [diff] [blame] | 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}} \ | 
| Fariborz Jahanian | 956127d | 2009-10-16 23:25:02 +0000 | [diff] [blame] | 31 | // expected-note {{built-in candidate operator++(int volatile &)}} \ | 
|  | 32 | // expected-note {{built-in candidate operator++(long volatile &)}} | 
| Fariborz Jahanian | 3b937fa | 2009-10-15 17:14:05 +0000 | [diff] [blame] | 33 | } | 
| Fariborz Jahanian | e719643 | 2009-10-12 20:11:40 +0000 | [diff] [blame] | 34 |  |