Douglas Gregor | d8ac436 | 2009-05-18 22:38:38 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | template<typename T> |
| 4 | struct ImaginaryLiteral0 { |
| 5 | void f(T &x) { |
| 6 | x = 3.0I; // expected-error{{incompatible type}} |
| 7 | } |
| 8 | }; |
| 9 | |
| 10 | template struct ImaginaryLiteral0<_Complex float>; |
| 11 | template struct ImaginaryLiteral0<int*>; // expected-note{{instantiation}} |
Douglas Gregor | 6731c31 | 2009-05-19 20:02:01 +0000 | [diff] [blame^] | 12 | |
| 13 | namespace N1 { |
| 14 | struct X { }; |
| 15 | |
| 16 | int& operator+=(X&, int); // expected-note{{candidate}} |
| 17 | } |
| 18 | |
| 19 | namespace N2 { |
| 20 | long& operator+=(N1::X&, long); // expected-note{{candidate}} |
| 21 | |
| 22 | template<typename T, typename U, typename Result> |
| 23 | struct PlusEquals0 { |
| 24 | void f(T t, U u) { |
| 25 | Result r = t += u; // expected-error{{ambiguous}} |
| 26 | } |
| 27 | }; |
| 28 | } |
| 29 | |
| 30 | namespace N3 { |
| 31 | struct Y : public N1::X { |
| 32 | short& operator+=(long); // expected-note{{candidate}} |
| 33 | }; |
| 34 | } |
| 35 | |
| 36 | template struct N2::PlusEquals0<N1::X, int, int&>; |
| 37 | template struct N2::PlusEquals0<N1::X, long, long&>; |
| 38 | template struct N2::PlusEquals0<N3::Y, long, short&>; |
| 39 | template struct N2::PlusEquals0<int, int, int&>; |
| 40 | template struct N2::PlusEquals0<N3::Y, int, short&>; // expected-note{{instantiation}} |