re PR c++/70621 (ICE on invalid code at -O1 and above on x86_64-linux-gnu in record_reference, at cgraphbuild.c:64)

/cp
2017-09-12  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70621
	* decl.c (start_decl): Early return error_mark_node if duplicate_decls
	returns it; avoid misleading error message.

/testsuite
2017-09-12  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70621
	* g++.dg/torture/pr70621.C: New.

From-SVN: r252040
This commit is contained in:
Paolo Carlini 2017-09-12 19:45:37 +00:00 committed by Paolo Carlini
parent 18a4e7e305
commit 741bbaabaf
4 changed files with 29 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70621
* decl.c (start_decl): Early return error_mark_node if duplicate_decls
returns it; avoid misleading error message.
2017-09-12 Nathan Sidwell <nathan@acm.org>
Kill CLASSTYPE_SORTED_FIELDS.

View File

@ -5022,11 +5022,12 @@ start_decl (const cp_declarator *declarator,
about this situation, and so we check here. */
if (initialized && DECL_INITIALIZED_IN_CLASS_P (field))
error ("duplicate initialization of %qD", decl);
if (duplicate_decls (decl, field, /*newdecl_is_friend=*/false))
field = duplicate_decls (decl, field,
/*newdecl_is_friend=*/false);
if (field == error_mark_node)
return error_mark_node;
else if (field)
decl = field;
if (decl_spec_seq_has_spec_p (declspecs, ds_constexpr)
&& !DECL_DECLARED_CONSTEXPR_P (field))
error ("%qD declared %<constexpr%> outside its class", field);
}
}
else

View File

@ -1,3 +1,8 @@
017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70621
* g++.dg/torture/pr70621.C: New.
2017-09-12 Paul Thomas <pault@gcc.gnu.org>
PR fortran/82173

View File

@ -0,0 +1,13 @@
float foo();
struct A
{
static float x; // { dg-message "previous declaration" }
};
double A::x = foo(); // { dg-error "conflicting declaration" }
void bar()
{
A::x = 0;
}