From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5AA4B3857812; Wed, 9 Sep 2020 11:27:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5AA4B3857812 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1599650871; bh=ynN++jXm2k6NpzJvrkIdJDLVUWw7Oe/MaOOGhCIcdqk=; h=From:To:Subject:Date:From; b=eQPm2pXtWVMPEnbVmqPR9FNc3dhjAvfn013GYTB6jlHU7QmbfatY6yXH0OECsDeKA A9ucA3o1CLMFcCcgWDkscvi/RrtVA5AGCq5a+exs+ZZJo03fqhUiVoTg/UJG3tKgV4 HVV3EjYp+zUnbsuNgl+UNZZCAaswaFLZx/k+sG9E= From: "sbergman at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96994] New: Missing code from consteval constructor initializing const variable Date: Wed, 09 Sep 2020 11:27:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sbergman at redhat dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Wed, 09 Sep 2020 11:27:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96994 Bug ID: 96994 Summary: Missing code from consteval constructor initializing const variable Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sbergman at redhat dot com Target Milestone: --- At least with a local build of recent GCC 11 trunk and with gcc-c++-10.2.1-1.fc32.x86_64: > $ cat test.cc > #include > struct S1 { > consteval S1() { i =3D 1; } > int i =3D 0; > }; > struct S2 { > constexpr S2() { i =3D 1; } > int i =3D 0; > }; > S1 const s1a; > constexpr S1 s1b; > S2 const s2; > int main() { std::cout << s1a.i << ' ' << s1b.i << ' ' << s2.i << '\n'; } > $ g++ -std=3Dc++20 test.cc > $ ./a.out > 0 1 1 The first "0" is not as expected, the following two "1" demonstrate how sli= ght modifications of the code would lead to the expected outcome.=