From 2064472550481657ac28b3e2188cdeef0dccd9af Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 3 Jan 2013 15:36:49 -0500 Subject: [PATCH] re PR c++/55419 (ICE in gimplify_init_ctor_preeval, at gimplify.c:3587) PR c++/55419 PR c++/55753 * pt.c (tsubst_copy_and_build) [TARGET_EXPR]: Don't touch TREE_CONSTANT. From-SVN: r194870 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 2 -- gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 56fcfa6..4b7968a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2013-01-03 Jason Merrill + PR c++/55419 + PR c++/55753 + * pt.c (tsubst_copy_and_build) [TARGET_EXPR]: Don't touch + TREE_CONSTANT. + PR c++/55842 * semantics.c (trait_expr_value): Call maybe_instantiate_noexcept. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1b3f039..09a0aa5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14333,11 +14333,9 @@ tsubst_copy_and_build (tree t, case TARGET_EXPR: /* We can get here for a constant initializer of non-dependent type. FIXME stop folding in cp_parser_initializer_clause. */ - gcc_assert (TREE_CONSTANT (t)); { tree r = get_target_expr_sfinae (RECUR (TARGET_EXPR_INITIAL (t)), complain); - TREE_CONSTANT (r) = true; RETURN (r); } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C new file mode 100644 index 0000000..a5a4b4d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor12.C @@ -0,0 +1,14 @@ +// PR c++/55753 +// { dg-options -std=c++11 } + +template +struct C { + constexpr C(const Tp& r) { } +}; + +template +struct B { + B() { + C cpl = C((true ? 1.0 : C())); + } +}; -- 2.7.4