diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0a943a13537..1209a8b6261 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-03-25 Paolo Carlini + + PR c++/56722 + * decl.c (cp_finish_decl): Check DECL_LANG_SPECIFIC before + DECL_TEMPLATE_INSTANTIATION. + 2013-03-22 Jason Merrill PR c++/56684 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ea1a08d2674..2e5910cf68e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6111,7 +6111,8 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, 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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aa2274fc701..46ad1ece5a8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-03-25 Paolo Carlini + + PR c++/56722 + * g++.dg/cpp0x/range-for23.C: New. + 2013-03-25 Tilo Schwarz PR libfortran/52512 diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for23.C b/gcc/testsuite/g++.dg/cpp0x/range-for23.C new file mode 100644 index 00000000000..849682c023a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/range-for23.C @@ -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; +}