Message ID | 20161229151130.GN21933@tucnak |
---|---|
State | New |
Headers | show |
On Thu, Dec 29, 2016 at 10:11 AM, Jakub Jelinek <jakub@redhat.com> wrote: > probe = TREE_OPERAND (probe, 0); > TREE_TYPE (v[i]) = TREE_TYPE (probe); > layout_decl (v[i], 0); > - SET_DECL_VALUE_EXPR (v[i], tt); > + SET_DECL_VALUE_EXPR (v[i], probe); I guess we can do away with the probe variable and change tt instead. Jason
--- gcc/cp/decl.c.jj 2016-12-21 22:57:08.000000000 +0100 +++ gcc/cp/decl.c 2016-12-28 13:16:45.294616666 +0100 @@ -7598,7 +7598,7 @@ cp_finish_decomp (tree decl, tree first, probe = TREE_OPERAND (probe, 0); TREE_TYPE (v[i]) = TREE_TYPE (probe); layout_decl (v[i], 0); - SET_DECL_VALUE_EXPR (v[i], tt); + SET_DECL_VALUE_EXPR (v[i], probe); DECL_HAS_VALUE_EXPR_P (v[i]) = 1; i++; } --- gcc/testsuite/g++.dg/cpp1z/decomp19.C.jj 2016-12-28 13:18:27.093305954 +0100 +++ gcc/testsuite/g++.dg/cpp1z/decomp19.C 2016-12-28 13:18:19.000000000 +0100 @@ -0,0 +1,13 @@ +// PR c++/78931 +// { dg-do run { target c++11 } } +// { dg-options "" } + +int +main () +{ + int x = 99; + struct S { int &x; }; + S s{x}; + auto [p] = s; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + return p - 99; +}