@@ -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;
}
@@ -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> ();
+}