clang/test/SemaTemplate/template-friend-definition-in-template.cpp
raw| 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | template <class F1> int foo1(F1 X1); |
| 5 | |
| 6 | template <int A1> struct A { |
| 7 | template <class F2> friend int foo1(F2 X2) { |
| 8 | return A1; |
| 9 | } |
| 10 | }; |
| 11 | |
| 12 | template struct A<1>; |
| 13 | int main() { |
| 14 | foo1(1.0); |
| 15 | } |
| 16 | |
| 17 | template <class F1> int foo2(F1 X1); |
| 18 | |
| 19 | template <int A1> struct B { |
| 20 | template <class F2> friend int foo2(F2 X2) { |
| 21 | return A1; |
| 22 | } |
| 23 | }; |
| 24 | |
| 25 | template struct B<1>; |
| 26 | template int foo2<float>(float X1); |