diff options
author | Jason Merrill <jason@redhat.com> | 2020-02-10 14:12:07 +0100 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-02-13 00:43:22 +0100 |
commit | c2368db567a853b0765833b3bd4e7934f3c6be61 (patch) | |
tree | cafcb81e34026f059e57589f94c12142ae353a80 /gcc/cp | |
parent | 68bb7e3b9dc3be6c9ceecc2c87b9c678e1a045dc (diff) | |
download | gcc-c2368db567a853b0765833b3bd4e7934f3c6be61.zip gcc-c2368db567a853b0765833b3bd4e7934f3c6be61.tar.gz gcc-c2368db567a853b0765833b3bd4e7934f3c6be61.tar.bz2 |
c++: Fix constexpr if and braced functional cast.
While partially instantiating a generic lambda, we can encounter pack
expansions or constexpr if where we can't actually do the substitution
immediately, and instead remember a partial instantiation context
in *_EXTRA_ARGS. This includes any local_specializations used in the
pattern or condition. In this testcase our tree walk wasn't finding the use
of i because we weren't walking into the type of a CONSTRUCTOR. Fixed by
moving the code for doing that from find_parameter_packs_r into
cp_walk_subtrees.
2020-02-11 Jason Merrill <jason@redhat.com>
PR c++/92583
PR c++/92654
* tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
* pt.c (find_parameter_packs_r): Not here.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/pt.c | 3 | ||||
-rw-r--r-- | gcc/cp/tree.c | 5 |
3 files changed, 12 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6d1eaa4..e0dd038 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2020-02-12 Jason Merrill <jason@redhat.com> + + PR c++/92583 + PR c++/92654 + * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here. + * pt.c (find_parameter_packs_r): Not here. + 2020-02-12 Iain Sandoe <iain@sandoe.co.uk> * coroutines.cc (build_actor_fn): Implement deallocation function diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c2d3a98..6e7f455 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3924,9 +3924,6 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) case TEMPLATE_DECL: if (!DECL_TEMPLATE_TEMPLATE_PARM_P (t)) return NULL_TREE; - gcc_fallthrough(); - - case CONSTRUCTOR: cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd, ppd->visited); return NULL_TREE; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index eb540f8..736ef6f 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -5024,6 +5024,11 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func, *walk_subtrees_p = 0; break; + case CONSTRUCTOR: + if (COMPOUND_LITERAL_P (*tp)) + WALK_SUBTREE (TREE_TYPE (*tp)); + break; + case TRAIT_EXPR: WALK_SUBTREE (TRAIT_EXPR_TYPE1 (*tp)); WALK_SUBTREE (TRAIT_EXPR_TYPE2 (*tp)); |