From: Jason Merrill Date: Mon, 17 Apr 2017 19:24:31 +0000 (-0400) Subject: * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6864d849216e1a8ccc9d5e58b2b652ad28029a56;p=gcc.git * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P. From-SVN: r246953 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0aa6351c06b..aa35f834782 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2017-04-17 Jason Merrill + + * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P. + 2017-04-15 Alexandre Oliva * decl.c (name_unnamed_type): Split out of... diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 862c2c2c08c..f8436b30b37 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14413,6 +14413,8 @@ tsubst_init (tree init, tree decl, tree args, complain); if (TREE_CODE (init) == AGGR_INIT_EXPR) init = get_target_expr_sfinae (init, complain); + if (TREE_CODE (init) == TARGET_EXPR) + TARGET_EXPR_DIRECT_INIT_P (init) = true; } return init; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-init2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-init2.C new file mode 100644 index 00000000000..8d5228c93cd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-init2.C @@ -0,0 +1,20 @@ +// { dg-do compile { target c++11 } } + +struct MoveOnly { + MoveOnly() = default; + MoveOnly(MoveOnly const&) = delete; + MoveOnly(MoveOnly&&) = default; +}; + +struct StoresMoveOnly { + StoresMoveOnly() {} + ~StoresMoveOnly() = default; + + MoveOnly value; +}; + +template void test(Args... args) { + StoresMoveOnly s(args...); +} + +int main() { test(); }