brintos

brintos / llvm-project-archived public Read only

0
0
Text · 720 B · 0283dba Raw
24 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2template<typename T>3void f(T);4 5template<typename T>6struct A { }; // expected-note{{template is declared here}}7 8struct X {9  template<> friend void f<int>(int); // expected-error{{in a friend}}10  template<> friend class A<int>; // expected-error{{cannot be a friend}}11  12  friend void f<float>(float); // okay13  friend class A<float>; // okay14};15 16struct PR41792 {17  // expected-error@+1{{cannot declare an explicit specialization in a friend}}18  template <> friend void f<>(int);19 20  // expected-error@+2{{template specialization declaration cannot be a friend}}21  // expected-error@+1{{too few template arguments for class template 'A'}}22  template <> friend class A<>;23};24