http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57346
Bug ID: 57346 Summary: g++ prematurely rejects references to local variables that are not odr-uses from local classes inside templates Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: richard-gccbugzilla at metafoo dot co.uk g++ has a rejects-valid on this: template<typename T> int f() { T n = 0; struct X { int get() { return n; } } x; return x.get(); } This template definition is valid: instantiation should succeed with T=const int, for instance.