re PR c++/9559 (ICE with invalid initialization of a static const member)

PR c++/9559
	* decl2.c (grokfield): Do not build NOP_EXPRs around the
	error_mark_node.

	PR c++/9559
	* g++.dg/init/static1.C: New test.

From-SVN: r68764
This commit is contained in:
Mark Mitchell 2003-07-01 07:17:03 +00:00 committed by Mark Mitchell
parent 04df67304a
commit c9bdad3517
4 changed files with 16 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2003-07-01 Mark Mitchell <mark@codesourcery.com>
PR c++/9559
* decl2.c (grokfield): Do not build NOP_EXPRs around the
error_mark_node.
2003-06-30 Neil Booth <neil@daikokuya.co.uk>
* Make-lang.in: Update.

View File

@ -951,12 +951,7 @@ grokfield (tree declarator, tree declspecs, tree init, tree asmspec_tree,
init = decl_constant_value (init);
else if (TREE_CODE (init) == CONSTRUCTOR)
init = digest_init (TREE_TYPE (value), init, (tree *)0);
if (init == error_mark_node)
/* We must make this look different than `error_mark_node'
because `decl_const_value' would mis-interpret it
as only meaning that this VAR_DECL is defined. */
init = build1 (NOP_EXPR, TREE_TYPE (value), init);
else if (! TREE_CONSTANT (init))
if (init != error_mark_node && ! TREE_CONSTANT (init))
{
/* We can allow references to things that are effectively
static, since references are initialized with the

View File

@ -1,3 +1,8 @@
2003-07-01 Mark Mitchell <mark@codesourcery.com>
PR c++/9559
* g++.dg/init/static1.C: New test.
2003-06-30 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* Changelog: Remove ">>>>>>>" from previous change.

View File

@ -0,0 +1,4 @@
struct A {
static const int size = BOGUS; // { dg-error "" }
};
const int A::size;