public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105619] New: Wrong "used in its own initializer" with class prvalue
@ 2022-05-16 15:47 mpolacek at gcc dot gnu.org
  2022-05-16 16:48 ` [Bug c++/105619] " jason at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-05-16 15:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105619
           Summary: Wrong "used in its own initializer" with class prvalue
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

struct A {
  const A *p = this;
};

constexpr A
bar (A)
{
  return {};
}

constexpr A a = bar (A{});
constexpr auto *p = a.p; // #1

#1 is rejected with 'a' used in its own initializer:

$ ./cc1plus -quiet bug.C
bug.C:12:21: error: the value of ‘a’ is not usable in a constant expression
   12 | constexpr auto *p = a.p; // #1
      |                     ^
bug.C:11:13: note: ‘a’ used in its own initializer
   11 | constexpr A a = bar (A{});
      |             ^


but 'a' is not actually used in the initializer?

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

end of thread, other threads:[~2022-10-27  2:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 15:47 [Bug c++/105619] New: Wrong "used in its own initializer" with class prvalue mpolacek at gcc dot gnu.org
2022-05-16 16:48 ` [Bug c++/105619] " jason at gcc dot gnu.org
2022-07-30 22:15 ` pinskia at gcc dot gnu.org
2022-10-27  2:40 ` pinskia 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).