public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96994] New: Missing code from consteval constructor initializing const variable
@ 2020-09-09 11:27 sbergman at redhat dot com
  2020-09-09 22:06 ` [Bug c++/96994] " mpolacek at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: sbergman at redhat dot com @ 2020-09-09 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

            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 <iostream>
> struct S1 {
>     consteval S1() { i = 1; }
>     int i = 0;
> };
> struct S2 {
>     constexpr S2() { i = 1; }
>     int i = 0;
> };
> S1 const s1a;
> constexpr S1 s1b;
> S2 const s2;
> int main() { std::cout << s1a.i << ' ' << s1b.i << ' ' << s2.i << '\n'; }

> $ g++ -std=c++20 test.cc
> $ ./a.out
> 0 1 1

The first "0" is not as expected, the following two "1" demonstrate how slight
modifications of the code would lead to the expected outcome.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-04-20 15:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 11:27 [Bug c++/96994] New: Missing code from consteval constructor initializing const variable sbergman at redhat dot com
2020-09-09 22:06 ` [Bug c++/96994] " mpolacek at gcc dot gnu.org
2020-09-10 17:52 ` jakub at gcc dot gnu.org
2020-09-10 17:55 ` jakub at gcc dot gnu.org
2020-09-10 18:00 ` mpolacek at gcc dot gnu.org
2020-09-10 18:10 ` jakub at gcc dot gnu.org
2020-09-10 18:11 ` jakub at gcc dot gnu.org
2020-09-14 13:11 ` jakub at gcc dot gnu.org
2020-09-21 20:08 ` mpolacek at gcc dot gnu.org
2020-10-01  9:19 ` cvs-commit at gcc dot gnu.org
2020-10-05  8:25 ` cvs-commit at gcc dot gnu.org
2021-04-20 15:12 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).