From: Paolo Carlini Date: Mon, 17 Mar 2014 14:53:05 +0000 (+0000) Subject: re PR c++/59571 ([C++11] ICE when casting inside static member constexpr brace initia... X-Git-Tag: releases/gcc-4.9.0~429 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=50e4d1ec16071cdfb0df267afb943c9117e9a66e;p=thirdparty%2Fgcc.git re PR c++/59571 ([C++11] ICE when casting inside static member constexpr brace initializer) /cp 2014-03-17 Paolo Carlini PR c++/59571 * typeck2.c (check_narrowing): Use fold_non_dependent_expr_sfinae. /testsuite 2014-03-17 Paolo Carlini PR c++/59571 * g++.dg/cpp0x/constexpr-ice13.C: New. From-SVN: r208619 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ca2f8c1270df..5b52060720ed 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-03-17 Paolo Carlini + + PR c++/59571 + * typeck2.c (check_narrowing): Use fold_non_dependent_expr_sfinae. + 2014-03-14 Jason Merrill PR c++/60532 diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 3a4caa0dafcf..bd21ad8c3f3f 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 063680ea092d..51cdaaf738a3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-17 Paolo Carlini + + PR c++/59571 + * g++.dg/cpp0x/constexpr-ice13.C: New. + 2014-03-17 Marek Polacek 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 index 000000000000..4fe371696a34 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice13.C @@ -0,0 +1,8 @@ +// PR c++/59571 +// { dg-do compile { target c++11 } } + +template +struct foo +{ + static constexpr int bar{(int)-1}; +};