2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / other / friend2.C
blobce5d2b741f5e683b44b7bbeee5756c0011529707
1 // { dg-do run }
2 // Origin: Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
4 // PR c++/12370
5 // Wrong code because of the friend declaration
7 template <typename T> struct A
9     T x;
10     A(T t) : x(t) {}
11     friend A<int> foo (const A<unsigned>&);
14 A<int> foo (const A<unsigned>& a)
16     A<int> res(a.x);
17     return res;
20 int main()
22     return foo(A<unsigned>(0)).x;