| 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | template<typename T> |
| 4 | struct X1 { |
| 5 | friend void f6(int) { } // expected-error{{redefinition of}} \ |
| 6 | // expected-note{{previous definition}} |
| 7 | }; |
| 8 | |
| 9 | X1<int> x1a; |
| 10 | X1<float> x1b; // expected-note {{in instantiation of}} |
| 11 | |
| 12 | template<typename T> |
| 13 | struct X2 { |
| 14 | operator int(); |
| 15 | |
| 16 | friend void f(int x) { } // expected-error{{redefinition}} \ |
| 17 | // expected-note{{previous definition}} |
| 18 | }; |
| 19 | |
| 20 | int array0[sizeof(X2<int>)]; |
| 21 | int array1[sizeof(X2<float>)]; // expected-note{{instantiation of}} |
| 22 | |
| 23 | void g() { |
| 24 | X2<int> xi; |
| 25 | f(xi); |
| 26 | X2<float> xf; |
| 27 | f(xf); |
| 28 | } |
| 29 | |
| 30 | template<typename T> |
| 31 | struct X3 { |
| 32 | operator int(); |
| 33 | |
| 34 | friend void h(int x); |
| 35 | }; |
| 36 | |
| 37 | int array2[sizeof(X3<int>)]; |
| 38 | int array3[sizeof(X3<float>)]; |
| 39 | |
| 40 | void i() { |
| 41 | X3<int> xi; |
| 42 | h(xi); |
| 43 | X3<float> xf; |
| 44 | h(xf); |
| 45 | } |
| 46 | |