public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/98994] New: Empty type with [[no_unique_address]] in union with constructor is not a constant expression @ 2021-02-08 0:10 david at doublewise dot net 2021-02-08 9:35 ` [Bug c++/98994] [11 Regression] " rguenth at gcc dot gnu.org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: david at doublewise dot net @ 2021-02-08 0:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98994 Bug ID: 98994 Summary: Empty type with [[no_unique_address]] in union with constructor is not a constant expression Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: david at doublewise dot net Target Milestone: --- The following valid translation unit: ``` struct empty {}; union U { constexpr U(): a() { } [[no_unique_address]] empty a; }; constexpr U u; ``` is incorrectly rejected by gcc 11 with the error: ``` <source>:12:13: error: 'U()' is not a constant expression 12 | constexpr U u; | ^ <source>:12:13: error: 'U()' is not a constant expression because it refers to an incompletely initialized variable Compiler returned: 1 ``` See it live: https://godbolt.org/z/PWcco3 This code was accepted in gcc 10.2. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/98994] [11 Regression] Empty type with [[no_unique_address]] in union with constructor is not a constant expression 2021-02-08 0:10 [Bug c++/98994] New: Empty type with [[no_unique_address]] in union with constructor is not a constant expression david at doublewise dot net @ 2021-02-08 9:35 ` rguenth at gcc dot gnu.org 2021-02-08 9:40 ` [Bug c++/98994] [11 Regression] Empty type with [[no_unique_address]] in union with constructor is not a constant expression since r11-6918 jakub at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu.org @ 2021-02-08 9:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98994 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Empty type with |[11 Regression] Empty type |[[no_unique_address]] in |with [[no_unique_address]] |union with constructor is |in union with constructor |not a constant expression |is not a constant | |expression Target Milestone|--- |11.0 Keywords| |rejects-valid ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/98994] [11 Regression] Empty type with [[no_unique_address]] in union with constructor is not a constant expression since r11-6918 2021-02-08 0:10 [Bug c++/98994] New: Empty type with [[no_unique_address]] in union with constructor is not a constant expression david at doublewise dot net 2021-02-08 9:35 ` [Bug c++/98994] [11 Regression] " rguenth at gcc dot gnu.org @ 2021-02-08 9:40 ` jakub at gcc dot gnu.org 2021-02-08 20:41 ` jason at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2021-02-08 9:40 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98994 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Priority|P3 |P1 Summary|[11 Regression] Empty type |[11 Regression] Empty type |with [[no_unique_address]] |with [[no_unique_address]] |in union with constructor |in union with constructor |is not a constant |is not a constant |expression |expression since r11-6918 Last reconfirmed| |2021-02-08 Ever confirmed|0 |1 CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Started with r11-6918-ga4dfd0f089af33f2af57bf422f9859405b9b4a16 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/98994] [11 Regression] Empty type with [[no_unique_address]] in union with constructor is not a constant expression since r11-6918 2021-02-08 0:10 [Bug c++/98994] New: Empty type with [[no_unique_address]] in union with constructor is not a constant expression david at doublewise dot net 2021-02-08 9:35 ` [Bug c++/98994] [11 Regression] " rguenth at gcc dot gnu.org 2021-02-08 9:40 ` [Bug c++/98994] [11 Regression] Empty type with [[no_unique_address]] in union with constructor is not a constant expression since r11-6918 jakub at gcc dot gnu.org @ 2021-02-08 20:41 ` jason at gcc dot gnu.org 2021-02-09 1:52 ` cvs-commit at gcc dot gnu.org 2021-02-09 14:35 ` jason at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jason at gcc dot gnu.org @ 2021-02-08 20:41 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98994 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org Status|NEW |ASSIGNED ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/98994] [11 Regression] Empty type with [[no_unique_address]] in union with constructor is not a constant expression since r11-6918 2021-02-08 0:10 [Bug c++/98994] New: Empty type with [[no_unique_address]] in union with constructor is not a constant expression david at doublewise dot net ` (2 preceding siblings ...) 2021-02-08 20:41 ` jason at gcc dot gnu.org @ 2021-02-09 1:52 ` cvs-commit at gcc dot gnu.org 2021-02-09 14:35 ` jason at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2021-02-09 1:52 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98994 --- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:a8dd2b3e96590ceccead63d28fc91c956a5f1a73 commit r11-7141-ga8dd2b3e96590ceccead63d28fc91c956a5f1a73 Author: Jason Merrill <jason@redhat.com> Date: Mon Feb 8 15:56:11 2021 -0500 c++: constexpr, union, and no_unique_address [PR98994] My second patch for 97566 omits nested CONSTRUCTORs for empty fields, but we do want them for empty union members. gcc/cp/ChangeLog: PR c++/98994 PR c++/97566 * constexpr.c (cxx_eval_store_expression): Only skip empty fields in RECORD_TYPE. gcc/testsuite/ChangeLog: PR c++/98994 * g++.dg/cpp2a/no_unique_address12.C: New test. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/98994] [11 Regression] Empty type with [[no_unique_address]] in union with constructor is not a constant expression since r11-6918 2021-02-08 0:10 [Bug c++/98994] New: Empty type with [[no_unique_address]] in union with constructor is not a constant expression david at doublewise dot net ` (3 preceding siblings ...) 2021-02-09 1:52 ` cvs-commit at gcc dot gnu.org @ 2021-02-09 14:35 ` jason at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jason at gcc dot gnu.org @ 2021-02-09 14:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98994 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|ASSIGNED |RESOLVED --- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> --- Fixed. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-02-09 14:35 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-02-08 0:10 [Bug c++/98994] New: Empty type with [[no_unique_address]] in union with constructor is not a constant expression david at doublewise dot net 2021-02-08 9:35 ` [Bug c++/98994] [11 Regression] " rguenth at gcc dot gnu.org 2021-02-08 9:40 ` [Bug c++/98994] [11 Regression] Empty type with [[no_unique_address]] in union with constructor is not a constant expression since r11-6918 jakub at gcc dot gnu.org 2021-02-08 20:41 ` jason at gcc dot gnu.org 2021-02-09 1:52 ` cvs-commit at gcc dot gnu.org 2021-02-09 14:35 ` jason 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).