Hi! current_class_ptr could be just NULL or a PARM_DECL in the past, but now it can also be ADDR_EXPR of a PLACEHOLDER_EXPR, which obviously doesn't have DECL_CONTEXT.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, Jason acked it in the PR, committed to trunk. 2015-03-10 Jakub Jelinek <ja...@redhat.com> PR c++/65127 * parser.c (parsing_nsdmi): Don't return true if current_class_ptr is not a PARM_DECL. * g++.dg/cpp0x/pr65127.C: New test. --- gcc/cp/parser.c.jj 2015-03-10 07:37:56.000000000 +0100 +++ gcc/cp/parser.c 2015-03-10 18:12:10.652923617 +0100 @@ -18314,7 +18314,9 @@ parsing_nsdmi (void) { /* We recognize NSDMI context by the context-less 'this' pointer set up by the function above. */ - if (current_class_ptr && DECL_CONTEXT (current_class_ptr) == NULL_TREE) + if (current_class_ptr + && TREE_CODE (current_class_ptr) == PARM_DECL + && DECL_CONTEXT (current_class_ptr) == NULL_TREE) return true; return false; } --- gcc/testsuite/g++.dg/cpp0x/pr65127.C.jj 2015-03-10 18:12:46.912341409 +0100 +++ gcc/testsuite/g++.dg/cpp0x/pr65127.C 2015-03-10 18:12:59.980131583 +0100 @@ -0,0 +1,16 @@ +// PR c++/65127 +// { dg-do compile { target c++11 } } + +template <int N> +void +foo () +{ + static int i {100}; + struct { int id {i++}; } j; +} + +int +main () +{ + foo<0> (); +} Jakub