diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/template/local1.C')
-rw-r--r-- | gcc/testsuite/g++.dg/template/local1.C | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/local1.C b/gcc/testsuite/g++.dg/template/local1.C new file mode 100644 index 000000000..4293aca24 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/local1.C @@ -0,0 +1,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> (); +} |