summaryrefslogtreecommitdiff
path: root/gcc/cp/cvt.c
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-17 15:23:17 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-17 15:23:17 +0000
commit0116c9f8c82422f18446531245dac8347818ffc6 (patch)
tree184559a8970dd5712cf703d6eda33582fec25cb7 /gcc/cp/cvt.c
parenta576c57a10976eb0a56b7ea9b5a2e7f7bdb2aa3f (diff)
downloadgcc-0116c9f8c82422f18446531245dac8347818ffc6.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206716 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r--gcc/cp/cvt.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index df208cc6876..c2cdf833802 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -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 "