re PR c++/84605 (internal compiler error: in xref_basetypes, at cp/decl.c:13818)

/cp
2019-03-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84605
	* parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.

/testsuite
2019-03-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84605
	* g++.dg/parse/crash69.C: New.

From-SVN: r269378
This commit is contained in:
Paolo Carlini 2019-03-04 23:49:23 +00:00 committed by Paolo Carlini
parent 94014ee95b
commit b65e6a9977
4 changed files with 26 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84605
* parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
2019-03-04 Jakub Jelinek <jakub@redhat.com>
PR c++/71446

View File

@ -24021,8 +24021,11 @@ cp_parser_class_head (cp_parser* parser,
cp_parser_check_class_key (class_key, type);
/* If this type was already complete, and we see another definition,
that's an error. */
if (type != error_mark_node && COMPLETE_TYPE_P (type))
that's an error. Likewise if the type is already being defined:
this can happen, eg, when it's defined from within an expression
(c++/84605). */
if (type != error_mark_node
&& (COMPLETE_TYPE_P (type) || TYPE_BEING_DEFINED (type)))
{
error_at (type_start_token->location, "redefinition of %q#T",
type);

View File

@ -1,3 +1,8 @@
2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84605
* g++.dg/parse/crash69.C: New.
2019-03-04 Jakub Jelinek <jakub@redhat.com>
PR c++/71446

View File

@ -0,0 +1,11 @@
// PR c++/84605
struct b {
int x(((struct b {}))); // { dg-error "expected|redefinition" }
};
struct c {
struct d {
int x(((struct c {}))); // { dg-error "expected|redefinition" }
};
};