On Tue, May 28, 2019 at 10:07:12AM -0400, Jason Merrill wrote: > > "or captures a structured binding (explicitly or implicitly), the program is > > ill-formed." > > Is P0588R1 a DR that would be applied to older standards? > > P0588 was certainly intended to apply to C++17, but I'd treat this as > overriding it, and not complain.
Ok. > > --- gcc/cp/decl.c.jj 2019-05-20 14:52:26.871375569 +0200 > > +++ gcc/cp/decl.c 2019-05-20 15:48:33.563599150 +0200 > > + && (DECL_NAMESPACE_SCOPE_P (decl) || TREE_STATIC (decl))) > > + if (TREE_STATIC (v[i])) > > When can a structured binding not be TREE_STATIC? All the block scope structured bindings that aren't explicitly static nor thread_local are not TREE_STATIC, and we really can't mangle them (and cp_maybe_mangle_decomp is called on them). And newly we need to mangle even block scope structured bindings that are static or thread_local. As extern isn't allowed (yet), perhaps all DECL_NAMESPACE_SCOPE_P (decl) structured bindings are TREE_STATIC and I could replace the DECL_NAMESPACE_SCOPE_P (decl) test in cp_maybe_mangle_decomp with TREE_STATIC (decl) instead. Jakub