re PR c++/79657 (ICE on invalid c++ code in finish_underlying_type cp/semantics.c:3849)

PR c++/79657
	* semantics.c (finish_underlying_type): Bail out for incomplete enums.

	* g++.dg/ext/underlying_type12.C: New test.

From-SVN: r245658
This commit is contained in:
Marek Polacek 2017-02-22 19:33:13 +00:00 committed by Marek Polacek
parent 78af14ae0e
commit 8fdddd3d83
4 changed files with 14 additions and 1 deletions

View File

@ -6,6 +6,9 @@
* pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
error_mark_node.
PR c++/79657
* semantics.c (finish_underlying_type): Bail out for incomplete enums.
2017-02-21 Jason Merrill <jason@redhat.com>
PR c++/50308 - wrong deprecated warning with ADL

View File

@ -3838,7 +3838,8 @@ finish_underlying_type (tree type)
return underlying_type;
}
complete_type (type);
if (!complete_type_or_else (type, NULL_TREE))
return error_mark_node;
if (TREE_CODE (type) != ENUMERAL_TYPE)
{

View File

@ -4,6 +4,9 @@
* g++.dg/cpp0x/alignas10.C: New test.
* g++.dg/cpp0x/alignas9.C: New test.
PR c++/79657
* g++.dg/ext/underlying_type12.C: New test.
2017-02-22 Jakub Jelinek <jakub@redhat.com>
PR target/70465

View File

@ -0,0 +1,6 @@
// PR c++/79657
// { dg-do compile { target c++11 } }
enum A { x };
enum B { a = (__underlying_type (A)) 1 };
enum C { b = (__underlying_type (C)) 1 }; // { dg-error "incomplete" }