re PR c++/59838 (ICE with an enum using an incomplete type)

PR c++/59838
cp/
	* cvt.c (ocp_convert): Don't segfault on non-existing
	ENUM_UNDERLYING_TYPE.
testsuite/
	* g++.dg/diagnostic/pr59838.C: New test.

From-SVN: r206716
This commit is contained in:
Marek Polacek 2014-01-17 15:23:17 +00:00 committed by Marek Polacek
parent 30078c0a65
commit 0ffc468317
4 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2014-01-17 Marek Polacek <polacek@redhat.com>
PR c++/59838
* cvt.c (ocp_convert): Don't segfault on non-existing
ENUM_UNDERLYING_TYPE.
2014-01-16 Jason Merrill <jason@redhat.com>
PR c++/59821

View File

@ -753,6 +753,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
unspecified. */
if ((complain & tf_warning)
&& TREE_CODE (e) == INTEGER_CST
&& ENUM_UNDERLYING_TYPE (type)
&& !int_fits_type_p (e, ENUM_UNDERLYING_TYPE (type)))
warning_at (loc, OPT_Wconversion,
"the result of the conversion is unspecified because "

View File

@ -1,3 +1,8 @@
2014-01-17 Marek Polacek <polacek@redhat.com>
PR c++/59838
* g++.dg/diagnostic/pr59838.C: New test.
2014-01-17 Marek Polacek <polacek@redhat.com>
PR c/58346

View File

@ -0,0 +1,4 @@
// PR c++/59838
// { dg-do compile }
enum E { a, b = (E) a }; // { dg-error "conversion to incomplete type" }