From 715a572a8a19d90b8dc02601adbae32a1a78652d Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 14 Aug 2013 21:42:54 +0000 Subject: re PR c++/51912 ([C++11] G++ accepts floating point case labels) /cp 2013-08-14 Paolo Carlini PR c++/51912 * cp-tree.h (LOOKUP_NO_NON_INTEGRAL): Add. * decl.c (case_conversion): Use it. * call.c (standard_conversion): Likewise. (implicit_conversion): Adjust. /testsuite 2013-08-14 Paolo Carlini PR c++/51912 * g++.dg/cpp0x/enum28.C: New. * g++.dg/cpp0x/enum15.C: Adjust. From-SVN: r201754 --- gcc/cp/call.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/cp/call.c') diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 5634606..e493a79 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1314,7 +1314,8 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p, /* As an extension, allow conversion to complex type. */ else if (ARITHMETIC_TYPE_P (to)) { - if (! (INTEGRAL_CODE_P (fcode) || fcode == REAL_TYPE) + if (! (INTEGRAL_CODE_P (fcode) + || (fcode == REAL_TYPE && !(flags & LOOKUP_NO_NON_INTEGRAL))) || SCOPED_ENUM_P (from)) return NULL; conv = build_conv (ck_std, to, conv); @@ -1681,7 +1682,7 @@ implicit_conversion (tree to, tree from, tree expr, bool c_cast_p, resolution, or after we've chosen one. */ flags &= (LOOKUP_ONLYCONVERTING|LOOKUP_NO_CONVERSION|LOOKUP_COPY_PARM |LOOKUP_NO_TEMP_BIND|LOOKUP_NO_RVAL_BIND|LOOKUP_PREFER_RVALUE - |LOOKUP_NO_NARROWING|LOOKUP_PROTECT); + |LOOKUP_NO_NARROWING|LOOKUP_PROTECT|LOOKUP_NO_NON_INTEGRAL); /* FIXME: actually we don't want warnings either, but we can't just have 'complain &= ~(tf_warning|tf_error)' because it would cause -- cgit v1.1