* pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.

From-SVN: r246953
This commit is contained in:
Jason Merrill 2017-04-17 15:24:31 -04:00 committed by Jason Merrill
parent 4e64ba0091
commit 6864d84921
3 changed files with 26 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2017-04-17 Jason Merrill <jason@redhat.com>
* pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
2017-04-15 Alexandre Oliva <aoliva@redhat.com>
* decl.c (name_unnamed_type): Split out of...

View file

@ -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;

View file

@ -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 <class ...Args> void test(Args... args) {
StoresMoveOnly s(args...);
}
int main() { test(); }