OSDN Git Service

PR target/26445
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / other / friend2.C
1 // { dg-do run }
2 // Origin: Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
3
4 // PR c++/12370
5 // Wrong code because of the friend declaration
6
7 template <typename T> struct A
8 {
9     T x;
10     A(T t) : x(t) {}
11     friend A<int> foo (const A<unsigned>&);
12 };
13
14 A<int> foo (const A<unsigned>& a)
15 {
16     A<int> res(a.x);
17     return res;
18 }
19
20 int main()
21 {
22     return foo(A<unsigned>(0)).x;
23 }