+2018-04-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/85200 - ICE with constexpr if in generic lambda.
+ * pt.c (extract_locals_r): Don't record the local specs of variables
+ declared within the pattern.
+
2018-04-05 Alexandre Oliva <aoliva@redhat.com>
PR c++/84979
struct el_data
{
+ hash_set<tree> internal;
tree extra;
tsubst_flags_t complain;
+
+ el_data (tsubst_flags_t c)
+ : extra (NULL_TREE), complain (c) {}
};
static tree
extract_locals_r (tree *tp, int */*walk_subtrees*/, void *data_)
el_data &data = *reinterpret_cast<el_data*>(data_);
tree *extra = &data.extra;
tsubst_flags_t complain = data.complain;
- if (tree spec = retrieve_local_specialization (*tp))
+ if (TREE_CODE (*tp) == DECL_EXPR)
+ data.internal.add (DECL_EXPR_DECL (*tp));
+ else if (tree spec = retrieve_local_specialization (*tp))
{
+ if (data.internal.contains (*tp))
+ /* Don't mess with variables declared within the pattern. */
+ return NULL_TREE;
if (TREE_CODE (spec) == NONTYPE_ARGUMENT_PACK)
{
/* Maybe pull out the PARM_DECL for a partial instantiation. */
static tree
extract_local_specs (tree pattern, tsubst_flags_t complain)
{
- el_data data = { NULL_TREE, complain };
+ el_data data (complain);
cp_walk_tree_without_duplicates (&pattern, extract_locals_r, &data);
return data.extra;
}