[Bug c++/124647] New: [CWG 3119] for-range-declaration of an expansion-statement as a templated entity

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 26 14:28:32 GMT 2026


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

            Bug ID: 124647
           Summary: [CWG 3119] for-range-declaration of an
                    expansion-statement as a templated entity
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

```
  struct B
  {
    int i;
    long l;
  };

  struct A
  {
    B b;
  };

  void f(int i, long l);

  int main()
  {
    template for (auto [ ... e] : A()) {
      f(e...);   // OK
    }
  }
```

should work but fails with:

3119.C:16:26: error: structured binding pack outside of template


More information about the Gcc-bugs mailing list