public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98637] New: Changing active union member via assignment expression should require trivial default constructor in constexpr context
@ 2021-01-12 11:22 m.cencora at gmail dot com
2021-08-28 0:15 ` [Bug c++/98637] " pinskia at gcc dot gnu.org
2023-12-12 18:45 ` ppalka at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: m.cencora at gmail dot com @ 2021-01-12 11:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98637
Bug ID: 98637
Summary: Changing active union member via assignment expression
should require trivial default constructor in
constexpr context
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: m.cencora at gmail dot com
Target Milestone: ---
According to http://eel.is/c++draft/class.union#general-6 following code should
be rejected
because changing of active union member via assignment expression should be
allowed only for classes with non-deleted trivial default constructor.
This is per Richard Smith's comment in
https://bugs.llvm.org/show_bug.cgi?id=48453
g++ -std=c++20
#include <memory>
struct NonTrivial
{
constexpr NonTrivial() : b(true) {}
bool b;
};
union Un
{
bool f1;
NonTrivial f2;
};
constexpr bool test()
{
Un un{ .f1 = false };
un.f2 = {}; // should be an error here, and require
std::construct_at(&un.f2);
return un.f2.b;
}
static_assert(test());
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/98637] Changing active union member via assignment expression should require trivial default constructor in constexpr context
2021-01-12 11:22 [Bug c++/98637] New: Changing active union member via assignment expression should require trivial default constructor in constexpr context m.cencora at gmail dot com
@ 2021-08-28 0:15 ` pinskia at gcc dot gnu.org
2023-12-12 18:45 ` ppalka at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-28 0:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98637
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-08-28
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/98637] Changing active union member via assignment expression should require trivial default constructor in constexpr context
2021-01-12 11:22 [Bug c++/98637] New: Changing active union member via assignment expression should require trivial default constructor in constexpr context m.cencora at gmail dot com
2021-08-28 0:15 ` [Bug c++/98637] " pinskia at gcc dot gnu.org
@ 2023-12-12 18:45 ` ppalka at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-12-12 18:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98637
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This is fixed on trunk by r14-4771-g1d260ab0e39ea6, so I guess we can mark this
a dup of PR101631.
*** This bug has been marked as a duplicate of bug 101631 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-12 18:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 11:22 [Bug c++/98637] New: Changing active union member via assignment expression should require trivial default constructor in constexpr context m.cencora at gmail dot com
2021-08-28 0:15 ` [Bug c++/98637] " pinskia at gcc dot gnu.org
2023-12-12 18:45 ` ppalka 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).