re PR c++/58965 ([c++11] ICE with member initializer in static union)

PR c++/58965
	* mangle.c (write_guarded_var_name): Handle null DECL_NAME.

From-SVN: r206405
This commit is contained in:
Jason Merrill 2014-01-07 16:24:37 -05:00 committed by Jason Merrill
parent 62dd455c2e
commit 5a5e7deb5f
3 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2014-01-07 Jason Merrill <jason@redhat.com>
PR c++/58965
* mangle.c (write_guarded_var_name): Handle null DECL_NAME.
2014-01-07 Paolo Carlini <paolo.carlini@oracle.com>
* semantics.c (trait_expr_value, [CPTK_IS_BASE_OF]): Implement

View File

@ -3775,7 +3775,8 @@ mangle_conv_op_name_for_type (const tree type)
static void
write_guarded_var_name (const tree variable)
{
if (strncmp (IDENTIFIER_POINTER (DECL_NAME (variable)), "_ZGR", 4) == 0)
if (DECL_NAME (variable)
&& strncmp (IDENTIFIER_POINTER (DECL_NAME (variable)), "_ZGR", 4) == 0)
/* The name of a guard variable for a reference temporary should refer
to the reference, not the temporary. */
write_string (IDENTIFIER_POINTER (DECL_NAME (variable)) + 4);

View File

@ -0,0 +1,10 @@
// PR c++/58965
// { dg-require-effective-target c++11 }
void foo()
{
static union
{
int i = i;
};
}