re PR c++/78931 (ICE on C++17 structured bindings from struct with reference member)
PR c++/78931 * decl.c (cp_finish_decomp): Remove probe variable, if tt is REFERENCE_REF_P, set tt to its operand. * g++.dg/cpp1z/decomp19.C: New test. From-SVN: r244113
This commit is contained in:
parent
962c5679b3
commit
26f203712b
|
@ -1,5 +1,9 @@
|
|||
2017-01-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/78931
|
||||
* decl.c (cp_finish_decomp): Remove probe variable, if tt is
|
||||
REFERENCE_REF_P, set tt to its operand.
|
||||
|
||||
PR c++/78890
|
||||
* class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
|
||||
unions even for C++11 and later.
|
||||
|
|
|
@ -7593,10 +7593,9 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
|
|||
else
|
||||
{
|
||||
tree tt = finish_non_static_data_member (field, t, NULL_TREE);
|
||||
tree probe = tt;
|
||||
if (REFERENCE_REF_P (probe))
|
||||
probe = TREE_OPERAND (probe, 0);
|
||||
TREE_TYPE (v[i]) = TREE_TYPE (probe);
|
||||
if (REFERENCE_REF_P (tt))
|
||||
tt = TREE_OPERAND (tt, 0);
|
||||
TREE_TYPE (v[i]) = TREE_TYPE (tt);
|
||||
layout_decl (v[i], 0);
|
||||
SET_DECL_VALUE_EXPR (v[i], tt);
|
||||
DECL_HAS_VALUE_EXPR_P (v[i]) = 1;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2017-01-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/78931
|
||||
* g++.dg/cpp1z/decomp19.C: New test.
|
||||
|
||||
PR c++/78890
|
||||
* g++.dg/init/ref14.C: Expect error even in C++11 and later.
|
||||
* g++.dg/init/union1.C: Likewise.
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue