]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/59571 ([C++11] ICE when casting inside static member constexpr brace initia...
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 17 Mar 2014 14:53:05 +0000 (14:53 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 17 Mar 2014 14:53:05 +0000 (14:53 +0000)
/cp
2014-03-17  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/59571
* typeck2.c (check_narrowing): Use fold_non_dependent_expr_sfinae.

/testsuite
2014-03-17  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/59571
* g++.dg/cpp0x/constexpr-ice13.C: New.

From-SVN: r208619

gcc/cp/ChangeLog
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-ice13.C [new file with mode: 0644]

index ca2f8c1270df253def537cf592f27a4931b07fcf..5b52060720ed2271445ce936c71325a71a21d130 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-17  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/59571
+       * typeck2.c (check_narrowing): Use fold_non_dependent_expr_sfinae.
+
 2014-03-14  Jason Merrill  <jason@redhat.com>
 
        PR c++/60532
index 3a4caa0dafcf5b1849e74b84863bf62c89fc2d0f..bd21ad8c3f3fd4bccbce5ed3788b8b15b120dd89 100644 (file)
@@ -861,7 +861,7 @@ check_narrowing (tree type, tree init)
       return;
     }
 
-  init = maybe_constant_value (init);
+  init = maybe_constant_value (fold_non_dependent_expr_sfinae (init, tf_none));
 
   if (TREE_CODE (type) == INTEGER_TYPE
       && TREE_CODE (ftype) == REAL_TYPE)
index 063680ea092d8afb02828981aa4d2a10f189a878..51cdaaf738a38f5644dfc3ca9da69390e20e8aa8 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-17  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/59571
+       * g++.dg/cpp0x/constexpr-ice13.C: New.
+
 2014-03-17  Marek Polacek  <polacek@redhat.com>
 
        PR middle-end/60534
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice13.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice13.C
new file mode 100644 (file)
index 0000000..4fe3716
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/59571
+// { dg-do compile { target c++11 } }
+
+template <class>
+struct foo
+{
+  static constexpr int bar{(int)-1};
+};