On Thu, Feb 12, 2026 at 12:53:40PM +0100, Jakub Jelinek wrote:
> On Thu, Feb 12, 2026 at 08:47:37PM +0900, Jason Merrill wrote:
> > > +  else if (EXPR_P (t))
> > > +    inform (loc, "but %qE is an expression", t);
> > > +  else if (VAR_P (t))
> > > +    inform (loc, "but %qE is a variable", t);
> > > +  else if (TREE_CODE (t) == PARM_DECL)
> > > +    inform (loc, "but %qE is a parameter", t);
> > > +  else if (TREE_CODE (t) == FUNCTION_DECL)
> > > +    inform (loc, "but %qE is a function", t);
> > > +  else if (TREE_CODE (t) == FIELD_DECL)
> > > +    inform (loc, "but %qE is a data member", t);
> > > +  else if (DECL_FUNCTION_TEMPLATE_P (t))
> > > +    inform (loc, "but %qE is a function template", t);
> > > +  else if (DECL_CLASS_TEMPLATE_P (t))
> > > +    inform (loc, "but %qE is a class template", t);
> > > +  else if (TREE_CODE (t) == NAMESPACE_DECL)
> > > +    inform (loc, "but %qE is a namespace", t);
> > > +  else if (TREE_CODE (t) == CONST_DECL && !DECL_TEMPLATE_PARM_P (t))
> > > +    inform (loc, "but %qE is an enumerator", t);
> > > +  else if (DECL_DECOMPOSITION_P (t) && !DECL_DECOMP_IS_BASE (t))
> > > +    inform (loc, "but %qE is a structured binding", t);
> 
> The DECL_DECOMPOSITION_P case needs to come before VAR_P, because
> #define DECL_DECOMPOSITION_P(NODE) \
>   (VAR_P (NODE) && DECL_LANG_SPECIFIC (NODE)                    \
>    ? DECL_LANG_SPECIFIC (NODE)->u.base.selector == lds_decomp           \
>    : false)
> and so the VAR_P case will otherwise make the DECL_DECOMPOSITION_P code
> dead.

Oops, I never tested for a structured binding so I missed that.
Fixed.

Marek

Reply via email to