===================================================================
@@ -6111,7 +6111,8 @@ cp_finish_decl (tree decl, tree init, bool init_co
tree d_init;
if (init == NULL_TREE)
{
- if (DECL_TEMPLATE_INSTANTIATION (decl)
+ if (DECL_LANG_SPECIFIC (decl)
+ && DECL_TEMPLATE_INSTANTIATION (decl)
&& !DECL_TEMPLATE_INSTANTIATED (decl))
{
/* init is null because we're deferring instantiating the
===================================================================
@@ -0,0 +1,8 @@
+// PR c++/56722
+// { dg-do compile { target c++11 } }
+
+int main()
+{
+ for (const auto& i, 21) // { dg-error "has no initializer|expected" }
+ i;
+}