2018-04-04 Jason Merrill <jason@redhat.com>
+ PR c++/85200 - ICE with constexpr if in generic lambda.
+ * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates.
+
PR c++/84221 - bogus -Wunused with attribute and template.
* decl2.c (is_late_template_attribute): Handle unused and used
normally on non-TYPE_DECL.
/* User variables should be mentioned in BIND_EXPR_VARS
and their initializers and sizes walked when walking
the containing BIND_EXPR. Compiler temporaries are
- handled here. */
+ handled here. And also normal variables in templates,
+ since do_poplevel doesn't build a BIND_EXPR then. */
if (VAR_P (TREE_OPERAND (*tp, 0))
- && DECL_ARTIFICIAL (TREE_OPERAND (*tp, 0))
- && !TREE_STATIC (TREE_OPERAND (*tp, 0)))
+ && (processing_template_decl
+ || (DECL_ARTIFICIAL (TREE_OPERAND (*tp, 0))
+ && !TREE_STATIC (TREE_OPERAND (*tp, 0)))))
{
tree decl = TREE_OPERAND (*tp, 0);
WALK_SUBTREE (DECL_INITIAL (decl));