https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120776

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 61786
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61786&action=edit
gcc16-pr120776-wip.patch

Very early WIP, this can just parse stuff, on say
struct S { int a, b, c; };
struct T { long long a, b, c; };
constexpr S d = { 1, 2, 3 }, e = { 4, 5, 6 }, f = { 7, 8, 9 };
constexpr T j = { 10LL, 11LL, 12LL };

void
foo ()
{
  template for (auto &[g, h, i] : { d, e, f, j })
//    __builtin_printf ("%d %d %d\n", g, h, i);
    ;
}
it can parse it (and throws it away right now).  With the printf uncommented
(where the right behavior is then to warn about %d vs. %lld 3 times for the 4th
iteration) it errors because decl_dependent_p doesn't have special case for
expansion-statement for-range-declaration vars/structured bindings.  Guess even
before parsing the body I'll need to figure out which of the cases it is and
depending on that whether the vars/sbs are dependent or not.

Reply via email to