Commit 0ffc4683 by Marek Polacek Committed by Marek Polacek

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
parent 30078c0a
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> 2014-01-16 Jason Merrill <jason@redhat.com>
PR c++/59821 PR c++/59821
......
...@@ -753,6 +753,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags, ...@@ -753,6 +753,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
unspecified. */ unspecified. */
if ((complain & tf_warning) if ((complain & tf_warning)
&& TREE_CODE (e) == INTEGER_CST && TREE_CODE (e) == INTEGER_CST
&& ENUM_UNDERLYING_TYPE (type)
&& !int_fits_type_p (e, ENUM_UNDERLYING_TYPE (type))) && !int_fits_type_p (e, ENUM_UNDERLYING_TYPE (type)))
warning_at (loc, OPT_Wconversion, warning_at (loc, OPT_Wconversion,
"the result of the conversion is unspecified because " "the result of the conversion is unspecified because "
......
2014-01-17 Marek Polacek <polacek@redhat.com> 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 PR c/58346
* gcc.dg/pr58346.c: New test. * gcc.dg/pr58346.c: New test.
......
// PR c++/59838
// { dg-do compile }
enum E { a, b = (E) a }; // { dg-error "conversion to incomplete type" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment