aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-05-26 11:17:54 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-05-26 11:17:54 +0200
commit6fc9f7aa731e895585c47d740509b5cd1591e797 (patch)
treed6a31e869ca764436905f87f10676d248ddddf01 /gcc/cp/expr.c
parent28e0e05badfbdf7930bbd6f3051b07dd7ec37ae2 (diff)
downloadgcc-6fc9f7aa731e895585c47d740509b5cd1591e797.zip
gcc-6fc9f7aa731e895585c47d740509b5cd1591e797.tar.gz
gcc-6fc9f7aa731e895585c47d740509b5cd1591e797.tar.bz2
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
Diffstat (limited to 'gcc/cp/expr.c')
-rw-r--r--gcc/cp/expr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c
index 75e99e5..8bd341b 100644
--- a/gcc/cp/expr.c
+++ b/gcc/cp/expr.c
@@ -133,8 +133,8 @@ mark_exp_read (tree exp)
switch (TREE_CODE (exp))
{
case VAR_DECL:
- if (DECL_VALUE_EXPR (exp))
- mark_exp_read (DECL_VALUE_EXPR (exp));
+ if (DECL_DECOMPOSITION_P (exp))
+ mark_exp_read (DECL_DECOMP_BASE (exp));
gcc_fallthrough ();
case PARM_DECL:
DECL_READ_P (exp) = 1;