// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
// If a friend function is defined in several non-template classes,
// it is an error.
void ;
;
;
// If a friend function is defined in both non-template and template
// classes it is an error only if the template is instantiated.
void ;
;
;
void ;
;
;
C3b<long> c3; // expected-note{{in instantiation of template class 'C3b<long>' requested here}}
// If a friend function is defined in several template classes it is an error
// only if several templates are instantiated.
void ;
;
;
void ;
;
;
C5a<long> c5a;
void ;
;
;
C6a<long> c6a;
C6b<int*> c6b; // expected-note{{in instantiation of template class 'C6b<int *>' requested here}}
void ;
;
C7<long> c7a;
C7<int*> c7b; // expected-note{{in instantiation of template class 'C7<int *>' requested here}}
// Even if clases are not instantiated and hence friend functions defined in them are not
// available, their declarations can be checked.
void ; // expected-note{{previous declaration is here}}
;
void ; // expected-note{{previous declaration is here}}
;
void ; // expected-note{{previous declaration is here}}
;
void ; // expected-note{{previous declaration is here}}
;
void ; // expected-note{{previous declaration is here}}
;
// Friend function with uninstantiated body is still a definition.
;
C20<int> c20i;
void // expected-error{{redefinition of 'func_20'}}
;
;
C21a<int> c21ai;
C21b<int> c21bi; // expected-note{{in instantiation of template class 'C21b<int>' requested here}}
;
;
C22a<int> c22ai;
C22b<int> c22bi;
void // expected-error{{redefinition of 'func_22'}}
// Case of template friend functions.
void ;
;
;
inline void
;
;
;
;
inline void // expected-note{{previous definition is here}}
;
C34<int> v34; // expected-note{{in instantiation of template class 'C34<int>' requested here}}
inline void ;
;
;
C35a<int> v35a;
C35b<int> v35b; // expected-note{{in instantiation of template class 'C35b<int>' requested here}}
void ;
;
C36<int> v36a;
C36<long> v36b; //expected-note{{in instantiation of template class 'C36<long>' requested here}}
void ;
;
C37<int> v37;
void // expected-error{{redefinition of 'func_37'}}