// { dg-do run } // Origin: Volker Reichelt // PR c++/12370 // Wrong code because of the friend declaration template struct A { T x; A(T t) : x(t) {} friend A foo (const A&); }; A foo (const A& a) { A res(a.x); return res; } int main() { return foo(A(0)).x; }