[Bug c++/103901] New: A lambda with a new type in its body cannot be defined inside template parameter list

fchelnokov at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 4 08:35:54 GMT 2022


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

            Bug ID: 103901
           Summary: A lambda with a new type in its body cannot be defined
                    inside template parameter list
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

The following valid struct template definition:
```
template <auto = []{ struct A{}; }>
struct B {};
```
is accepted by Clang and MSVC, but not by GCC that complains `error: definition
of 'struct<lambda()>::A' inside template parameter list`. Demo:
https://gcc.godbolt.org/z/f1dxGbPvs

Related discussion: https://stackoverflow.com/q/70571380/7325599


More information about the Gcc-bugs mailing list