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
This commit is contained in:
Jason Merrill 2013-01-03 15:36:49 -05:00 committed by Jason Merrill
parent ffabb76185
commit 2064472550
3 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,10 @@
2013-01-03 Jason Merrill <jason@redhat.com> 2013-01-03 Jason Merrill <jason@redhat.com>
PR c++/55419
PR c++/55753
* pt.c (tsubst_copy_and_build) [TARGET_EXPR]: Don't touch
TREE_CONSTANT.
PR c++/55842 PR c++/55842
* semantics.c (trait_expr_value): Call maybe_instantiate_noexcept. * semantics.c (trait_expr_value): Call maybe_instantiate_noexcept.

View File

@ -14333,11 +14333,9 @@ tsubst_copy_and_build (tree t,
case TARGET_EXPR: case TARGET_EXPR:
/* We can get here for a constant initializer of non-dependent type. /* We can get here for a constant initializer of non-dependent type.
FIXME stop folding in cp_parser_initializer_clause. */ FIXME stop folding in cp_parser_initializer_clause. */
gcc_assert (TREE_CONSTANT (t));
{ {
tree r = get_target_expr_sfinae (RECUR (TARGET_EXPR_INITIAL (t)), tree r = get_target_expr_sfinae (RECUR (TARGET_EXPR_INITIAL (t)),
complain); complain);
TREE_CONSTANT (r) = true;
RETURN (r); RETURN (r);
} }

View File

@ -0,0 +1,14 @@
// PR c++/55753
// { dg-options -std=c++11 }
template <typename Tp>
struct C {
constexpr C(const Tp& r) { }
};
template <typename Tp>
struct B {
B() {
C<double> cpl = C<double>((true ? 1.0 : C<double>()));
}
};