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

Leonid Satanovsky <leonid.satanovsky at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |leonid.satanovsky at gmail dot 
com

--- Comment #4 from Leonid Satanovsky <leonid.satanovsky at gmail dot com> ---
Greetings, the bug still exists in latest Gcc (14+):

C++20

---------------------
Works:

#include <iostream>

constexpr auto l = [](auto v) {return v;};
template<class L = decltype(l)>
constexpr auto c(L f = {}) {return f(42);}
int main () {std::cout << c() << std::endl;}

---------------------
Works:

#include <iostream>

constexpr auto c(decltype([](auto v) {return v;}) f = {}) {return f(42);}
int main () { std::cout << c() << std::endl; }

---------------------
(Gcc 14 and latest trunk) Doesn't work / (Clang) Works:
(https://godbolt.org/z/bcbP44bK3)

#include <iostream>

template <class F = decltype([](auto v) {return v;})>
constexpr auto c(F f = {}) {return f(42);}
int main () { std::cout << c() << std::endl; }

Reply via email to