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