public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105550] New: Missing copy elision with conditional operator in NSDMI
@ 2022-05-10 15:21 mpolacek at gcc dot gnu.org
  2022-05-10 15:22 ` [Bug c++/105550] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-05-10 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105550
           Summary: Missing copy elision with conditional operator in
                    NSDMI
           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: ---

Consider:

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

struct E {
  A a = true ? A{} : A{};
};

constexpr E e{};

$ ./cc1plus -quiet q.C
q.C:9:15: error: ‘E{A{((const A*)(&<anonymous>))}}’ is not a constant
expression
    9 | constexpr E e{};
      |               ^

The ?: shouldn't preclude copy elision.  'e' must be static for this to work.

Bug 96004 with a similar title doesn't seem to be a duplicate of this one.

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

end of thread, other threads:[~2022-10-31 18:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 15:21 [Bug c++/105550] New: Missing copy elision with conditional operator in NSDMI mpolacek at gcc dot gnu.org
2022-05-10 15:22 ` [Bug c++/105550] " mpolacek at gcc dot gnu.org
2022-05-10 15:41 ` [Bug c++/105550] Missing copy elision with conditional operator mpolacek at gcc dot gnu.org
2022-05-13 23:50 ` mpolacek at gcc dot gnu.org
2022-07-01 16:11 ` cvs-commit at gcc dot gnu.org
2022-07-01 16:12 ` mpolacek at gcc dot gnu.org
2022-10-31 18:08 ` 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).