From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF291385801D; Mon, 17 Jan 2022 10:52:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF291385801D From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95968] error: 'args#0' is not a constant expression Date: Mon, 17 Jan 2022 10:52:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: diagnostic, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords blocked Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jan 2022 10:52:33 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95968 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Blocks| |55004, 54367 --- Comment #2 from Andrew Pinski --- The following is the reduced testcase: struct test_class { consteval test_class( double pack_) { } }; void test_func()=20 { auto t =3D [](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: :8:45: error: call to consteval function 'test_class::test_class' is not a constant expression auto t =3D [](const auto... args) {return test_class(args...);}; ^ :9:6: note: in instantiation of function template specialization 'test_func()::(anonymous class)::operator()' requested here t(1.0); ^ :8:56: note: function parameter 'args' with unknown value cannot be used in a constant expression auto t =3D [](const auto... args) {return test_class(args...);}; ^ :8:31: note: declared here auto t =3D [](const auto... args) {return test_class(args...);}; ^ Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D54367 [Bug 54367] [meta-bug] lambda expressions https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D55004 [Bug 55004] [meta-bug] constexpr issues=