From: Jason Merrill Date: Mon, 11 Apr 2011 22:00:31 +0000 (-0400) Subject: re PR c++/48534 ([C++0x][SFINAE] Compiler break down on explicit scoped enum => bool... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=55b13820b4be09c8b8bceaad41d5b5af2c73b411;p=gcc.git re PR c++/48534 ([C++0x][SFINAE] Compiler break down on explicit scoped enum => bool conversion) PR c++/48534 * cvt.c (ocp_convert): Use build_nop to convert to underlying type of scoped enum. From-SVN: r172284 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7a087c52ddc..69aa17081ee 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-04-11 Jason Merrill + PR c++/48534 + * cvt.c (ocp_convert): Use build_nop to convert to underlying type + of scoped enum. + PR c++/48523 * tree.c (maybe_dummy_object): Use build_x_indirect_ref rather than cp_build_indirect_ref. diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 6551de62ac3..de981bc0113 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -731,7 +731,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags) /* We can't implicitly convert a scoped enum to bool, so convert to the underlying type first. */ if (SCOPED_ENUM_P (intype) && (convtype & CONV_STATIC)) - e = convert (ENUM_UNDERLYING_TYPE (intype), e); + e = build_nop (ENUM_UNDERLYING_TYPE (intype), e); return cp_truthvalue_conversion (e); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 05beba02a41..6612d864613 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-04-11 Jason Merrill + * g++.dg/cpp0x/enum10.C: New. + * g++.dg/cpp0x/lambda/lambda-this4.C: New. * g++.dg/cpp0x/rv-func.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/enum10.C b/gcc/testsuite/g++.dg/cpp0x/enum10.C new file mode 100644 index 00000000000..55a1ab46be1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum10.C @@ -0,0 +1,9 @@ +// PR c++/48534 +// { dg-options -std=c++0x } + +enum class OpSE : bool; + +int main() +{ + return static_cast(OpSE()); +}