diff options
author | Jason Merrill <jason@redhat.com> | 2014-02-21 16:49:05 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-02-21 16:49:05 -0500 |
commit | b98fb3633ea72bc48ce36975aa0ac2252f279a32 (patch) | |
tree | 6f2eb0ca711791b4e619bc58b59726114cd5778e /gcc | |
parent | 3e9e24ab25fe2765881b888cc148a3a13740d4fb (diff) | |
download | gcc-b98fb3633ea72bc48ce36975aa0ac2252f279a32.zip gcc-b98fb3633ea72bc48ce36975aa0ac2252f279a32.tar.gz gcc-b98fb3633ea72bc48ce36975aa0ac2252f279a32.tar.bz2 |
re PR c++/60186 ([c++11] ICE with invalid value in constexpr array initializer)
PR c++/60186
* typeck2.c (massage_init_elt): Call fold_non_dependent_expr_sfinae.
From-SVN: r208027
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-initlist7.C | 7 |
3 files changed, 14 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 14d4995..8e4a2a0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2014-02-21 Jason Merrill <jason@redhat.com> + PR c++/60186 + * typeck2.c (massage_init_elt): Call fold_non_dependent_expr_sfinae. + PR c++/60187 * parser.c (cp_parser_enum_specifier): Call check_for_bare_parameter_packs. diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 546b83f..8877286 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1131,7 +1131,10 @@ massage_init_elt (tree type, tree init, tsubst_flags_t complain) init = TARGET_EXPR_INITIAL (init); /* When we defer constant folding within a statement, we may want to defer this folding as well. */ - init = maybe_constant_init (init); + tree t = fold_non_dependent_expr_sfinae (init, complain); + t = maybe_constant_value (t); + if (TREE_CONSTANT (t)) + init = t; return init; } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist7.C new file mode 100644 index 0000000..6fea82f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist7.C @@ -0,0 +1,7 @@ +// PR c++/60186 +// { dg-require-effective-target c++11 } + +template<typename> void foo(int i) +{ + constexpr int a[] = { i }; // { dg-error "" } +} |