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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |c++-lambda, rejects-valid
   Last reconfirmed|2021-08-07 00:00:00         |2024-4-13

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Now we are rejecting this valid C++17 code:
```
    template<int =  []()constexpr{ return 0; }()>
    void f() { }
```

With:
```
<source>:3:21: error: lambda-expression in template-argument only available
with '-std=c++2a' or '-std=gnu++2a'
    3 |     template<int =  []()constexpr{ return 0; }()>
      |                     ^
```

Because I would have assumed calling a constexpr lambda would be a valid C++17
code.

We even reject this and cause an ICE:
```
    template<int = [](auto)constexpr{ return 0; }.operator()(1)>
    void f() { }
```

But those examples are all valid C++17 due to constexpr'ness.

Reply via email to