Commit ef98d365 by Paolo Carlini Committed by Paolo Carlini

re PR c++/70572 (ICE on code with decltype (auto) in digest_init_r, at…

re PR c++/70572 (ICE on code with decltype (auto) in digest_init_r, at cp/typeck2.c:1103 with -std=c++14)

/cp
2016-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70572
	* decl.c (cp_finish_decl): Check do_auto_deduction return value
	and return immediately in case of erroneous code.

/testsuite
2016-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70572
	* g++.dg/cpp1y/auto-fn31.C: New.

From-SVN: r236522
parent ce3a16ff
2016-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70572
* decl.c (cp_finish_decl): Check do_auto_deduction return value
and return immediately in case of erroneous code.
2016-05-19 Marek Polacek <polacek@redhat.com>
PR c++/71075
......
......@@ -6609,6 +6609,13 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
adc_variable_type);
if (type == error_mark_node)
return;
if (TREE_CODE (type) == FUNCTION_TYPE)
{
error ("initializer for %<decltype(auto) %D%> has function type "
"(did you forget the %<()%> ?)", decl);
TREE_TYPE (decl) = error_mark_node;
return;
}
cp_apply_type_quals_to_decl (cp_type_quals (type), decl);
}
......
2016-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70572
* g++.dg/cpp1y/auto-fn31.C: New.
2016-05-20 H.J. Lu <hongjiu.lu@intel.com>
PR target/70738
......
// PR c++/70572
// { dg-do compile { target c++14 } }
void foo ()
{
decltype (auto) a = foo; // { dg-error "initializer" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment