summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/local1.C
blob: 4293aca2403694210591ccfd7b008e20532bd519 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// PR c++/4286: We were crashing when trying to set up the class bindings in
// g(), because xref wanted the mangled name, which breaks inside a template.

// Of course, the offending code is actually ill-formed anyway, so check
// for the error.  Also check that it's formatted properly.

struct A
{
  template<class T> void f();
};

template<class T> void A::f()
{
  struct B
  {
    void g() {}
    static int x;	// { dg-error "static.*int A::f\\(\\)::B::x" "" }
  };
}

int main ()
{
  A a;
  a.f<int> ();
}