Debian Codegraph @

gcc/testsuite/g++.dg/template/friend86.C

raw
1 // PR c++/119807
2 // { dg-do run }
3
4 template<int N>
5 struct A {
6 template<class T> friend int f(A<N>, T);
7 };
8
9 template struct A<0>;
10 template struct A<1>;
11
12 int main() {
13 A<0> x;
14 A<1> y;
15 if (f(x, true) != 0) __builtin_abort();
16 if (f(y, true) != 1) __builtin_abort();
17 }
18
19 template<int N>
20 struct B {
21 template<class T> friend int f(A<N>, T) { return N; }
22 };
23
24 template struct B<0>;
25 template struct B<1>;