Commit efaa76b3 by Paolo Carlini Committed by Paolo Carlini

re PR c++/42056 (ICE with invalid use of auto in template)

/cp
2011-05-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/42056
	* typeck2.c (build_functional_cast): Complain early for invalid uses
	of 'auto' and set type to error_mark_node.

/testsuite
2011-05-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/42056
	* testsuite/g++.dg/cpp0x/auto25.C: New.

From-SVN: r174337
parent b0bd15f7
2011-05-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/42056
* typeck2.c (build_functional_cast): Complain early for invalid uses
of 'auto' and set type to error_mark_node.
2011-05-26 Jason Merrill <jason@redhat.com> 2011-05-26 Jason Merrill <jason@redhat.com>
PR c++/47721 PR c++/47721
......
...@@ -1599,6 +1599,13 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain) ...@@ -1599,6 +1599,13 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain)
return error_mark_node; return error_mark_node;
} }
if (type_uses_auto (type))
{
if (complain & tf_error)
error ("invalid use of %<auto%>");
type = error_mark_node;
}
if (processing_template_decl) if (processing_template_decl)
{ {
tree t; tree t;
......
2011-05-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/42056
* testsuite/g++.dg/cpp0x/auto25.C: New.
2011-05-27 Richard Guenther <rguenther@suse.de> 2011-05-27 Richard Guenther <rguenther@suse.de>
* gcc.c-torture/execute/920711-1.x: Add -fwrapv. * gcc.c-torture/execute/920711-1.x: Add -fwrapv.
......
// PR c++/42056
// { dg-options -std=c++0x }
template<int> struct A
{
int a[auto(1)]; // { dg-error "invalid use of" }
};
template<int> void foo()
{
int a[auto(1)]; // { dg-error "invalid use of" }
}
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