[cfe-commits] r163829 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/CXX/expr/expr.const/p3-0x.cpp test/CodeGenCXX/mangle.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Thu Sep 13 12:55:13 PDT 2012
Author: rsmith
Date: Thu Sep 13 14:55:13 2012
New Revision: 163829
URL: http://llvm.org/viewvc/llvm-project?rev=163829&view=rev
Log:
Remove speculative fix for C++ core issue 1407, since it was resolved as NAD.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/CXX/expr/expr.const/p3-0x.cpp
cfe/trunk/test/CodeGenCXX/mangle.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=163829&r1=163828&r2=163829&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Sep 13 14:55:13 2012
@@ -4798,12 +4798,6 @@
return true;
case ICK_Boolean_Conversion:
- // Conversion from an integral or unscoped enumeration type to bool is
- // classified as ICK_Boolean_Conversion, but it's also an integral
- // conversion, so it's permitted in a converted constant expression.
- return SCS.getFromType()->isIntegralOrUnscopedEnumerationType() &&
- SCS.getToType(2)->isBooleanType();
-
case ICK_Floating_Integral:
case ICK_Complex_Real:
return false;
Modified: cfe/trunk/test/CXX/expr/expr.const/p3-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.const/p3-0x.cpp?rev=163829&r1=163828&r2=163829&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.const/p3-0x.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.const/p3-0x.cpp Thu Sep 13 14:55:13 2012
@@ -73,12 +73,13 @@
using Int = A<-3>; // expected-error {{template argument evaluates to -3, which cannot be narrowed to type 'unsigned char'}}
// Note, conversions from integral or unscoped enumeration types to bool are
-// integral conversions as well as boolean conversions.
+// boolean conversions, not integral conversions, so are not permitted. See
+// core issue 1407.
template<typename T, T v> struct Val { static constexpr T value = v; };
-static_assert(Val<bool, E1>::value == 1, ""); // ok
-static_assert(Val<bool, '\0'>::value == 0, ""); // ok
-static_assert(Val<bool, U'\1'>::value == 1, ""); // ok
-static_assert(Val<bool, E5>::value == 1, ""); // expected-error {{5, which cannot be narrowed to type 'bool'}}
+static_assert(Val<bool, E1>::value == 1, ""); // expected-error {{conversion from 'E' to 'bool' is not allowed in a converted constant expression}}
+static_assert(Val<bool, '\0'>::value == 0, ""); // expected-error {{conversion from 'char' to 'bool' is not allowed in a converted constant expression}}
+static_assert(Val<bool, U'\1'>::value == 1, ""); // expected-error {{conversion from 'char32_t' to 'bool' is not allowed in a converted constant expression}}
+static_assert(Val<bool, E5>::value == 1, ""); // expected-error {{conversion from 'E' to 'bool' is not allowed in a converted constant expression}}
// (no other conversions are permitted)
using Int = A<1.0>; // expected-error {{conversion from 'double' to 'unsigned char' is not allowed in a converted constant expression}}
Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=163829&r1=163828&r2=163829&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Thu Sep 13 14:55:13 2012
@@ -181,7 +181,7 @@
template int ft6<S>(const S&);
template<typename> struct __is_scalar_type {
- enum { __value = 1 };
+ static const bool __value = true;
};
template<bool, typename> struct __enable_if { };
@@ -231,7 +231,7 @@
// PR5796
namespace PR5796 {
template<typename> struct __is_scalar_type {
- enum { __value = 0 };
+ static const bool __value = false;
};
template<bool, typename> struct __enable_if {};
More information about the cfe-commits
mailing list