cp-tree.h (struct lang_decl_decomp): New type.
authorJakub Jelinek <jakub@redhat.com>
Fri, 26 May 2017 09:17:54 +0000 (11:17 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 26 May 2017 09:17:54 +0000 (11:17 +0200)
commit6fc9f7aa731e895585c47d740509b5cd1591e797
treed6a31e869ca764436905f87f10676d248ddddf01
parent28e0e05badfbdf7930bbd6f3051b07dd7ec37ae2
cp-tree.h (struct lang_decl_decomp): New type.

* cp-tree.h (struct lang_decl_decomp): New type.
(struct lang_decl): Add u.decomp.
(LANG_DECL_DECOMP_CHECK): Define.
(DECL_DECOMPOSITION_P): Note it is set also on the vars
for user identifiers.
(DECL_DECOMP_BASE): Define.
(retrofit_lang_decl): Add extra int = 0 argument.
* lex.c (retrofit_lang_decl): Add SEL argument, if non-zero
use it to influence the selector choices and for selector
0 to non-zero transition copy old content.
(cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P.
* decl.c (poplevel): For DECL_DECOMPOSITION_P, check
!DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR.  Adjust warning
wording if decl is a structured binding.
(cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl.
Set DECL_DECOMP_BASE.  Ignore DECL_READ_P sets from initialization
of individual variables for tuple structured bindings.
(grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl.
Clear DECL_DECOMP_BASE.
* decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well.
* pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what
is expected.
* expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of
DECL_VALUE_EXPR.

* g++.dg/cpp1z/decomp29.C (p): New variable.
(main): Add further tests.

From-SVN: r248483
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/expr.c
gcc/cp/lex.c
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/decomp29.C