aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-04-11 18:00:31 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-04-11 18:00:31 -0400
commit55b13820b4be09c8b8bceaad41d5b5af2c73b411 (patch)
treea73345eed54b6d5e68c0a76066f4c5053c626200
parentac4b1cc036b88ed7e82c1c755b39568064e9f2e0 (diff)
downloadgcc-55b13820b4be09c8b8bceaad41d5b5af2c73b411.zip
gcc-55b13820b4be09c8b8bceaad41d5b5af2c73b411.tar.gz
gcc-55b13820b4be09c8b8bceaad41d5b5af2c73b411.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/cvt.c2
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/enum10.C9
4 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7a087c5..69aa170 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2011-04-11 Jason Merrill <jason@redhat.com>
+ 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 6551de6..de981bc 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 05beba0..6612d86 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2011-04-11 Jason Merrill <jason@redhat.com>
+ * 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 0000000..55a1ab4
--- /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<bool>(OpSE());
+}