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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Blocks|                            |55004, 54367

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The following is the reduced testcase:
struct test_class
{
    consteval test_class( double pack_) { }
};

void test_func() 
{
    auto t = [](const auto... args) {return test_class(args...);};
    t(1.0);
}

are lambdas consteval by default? I know they are implicit constexpr but I
don't think they are consteval though.
There is still a diagnostic issue where args#0 is used as it should be args...
instead and maybe a little more clear why args... is not a constant value
expression.

Clang gives:
<source>:8:45: error: call to consteval function 'test_class::test_class' is
not a constant expression
    auto t = [](const auto... args) {return test_class(args...);};
                                            ^
<source>:9:6: note: in instantiation of function template specialization
'test_func()::(anonymous class)::operator()<double>' requested here
    t(1.0);
     ^
<source>:8:56: note: function parameter 'args' with unknown value cannot be
used in a constant expression
    auto t = [](const auto... args) {return test_class(args...);};
                                                       ^
<source>:8:31: note: declared here
    auto t = [](const auto... args) {return test_class(args...);};
                              ^


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54367
[Bug 54367] [meta-bug] lambda expressions
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
[Bug 55004] [meta-bug] constexpr issues

Reply via email to