1 // PR c++/4286: We were crashing when trying to set up the class bindings in
2 // g(), because xref wanted the mangled name, which breaks inside a template.
3 
4 // Of course, the offending code is actually ill-formed anyway, so check
5 // for the error.  Also check that it's formatted properly.
6 
7 struct A
8 {
9   template<class T> void f();
10 };
11 
f()12 template<class T> void A::f()
13 {
14   struct B
15   {
16     void g() {}
17     static int x;	// { dg-error "static.*int A::f\\(\\)::B::x" }
18   };
19 }
20 
main()21 int main ()
22 {
23   A a;
24   a.f<int> ();
25 }
26