public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112439] New: Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected
@ 2023-11-08 11:33 de34 at live dot cn
2023-11-08 12:01 ` [Bug c++/112439] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation redi at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: de34 at live dot cn @ 2023-11-08 11:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112439
Bug ID: 112439
Summary: Modification of a member overlapping with a
[[no_unique_address]] member in the constructor is
incorrectly rejected
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: de34 at live dot cn
Target Milestone: ---
GCC starts (incorrectly) rejecting the following code snipped since GCC13
(https://godbolt.org/z/faqMahz34). It's wrong to emit an error for this because
c is not const in the constructor body.
```
struct Empty {};
class Foo {
public:
constexpr Foo(int x, Empty y, int z) : a(x), b(y)
{
c = z;
}
private:
int a{};
[[no_unique_address]] Empty b{};
[[no_unique_address]] int c{};
};
constexpr Foo r{1, {}, 3};
```
It seems that the code is correctly accepted if b and c are made not to
overlap.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/112439] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation
2023-11-08 11:33 [Bug c++/112439] New: Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected de34 at live dot cn
@ 2023-11-08 12:01 ` redi at gcc dot gnu.org
2023-11-08 13:55 ` [Bug c++/112439] [13/14 Regression] " ppalka at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-08 12:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112439
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-11-08
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/112439] [13/14 Regression] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation
2023-11-08 11:33 [Bug c++/112439] New: Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected de34 at live dot cn
2023-11-08 12:01 ` [Bug c++/112439] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation redi at gcc dot gnu.org
@ 2023-11-08 13:55 ` ppalka at gcc dot gnu.org
2024-02-01 22:07 ` [Bug c++/112439] [13/14 Regression] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation since r13-160-g967cdbe6629653 jason at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-11-08 13:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112439
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
Known to work| |12.3.0
Known to fail| |13.2.0, 14.0
Target Milestone|--- |13.3
Summary|Modification of a member |[13/14 Regression]
|overlapping with a |Modification of a member
|[[no_unique_address]] |overlapping with a
|member in the constructor |[[no_unique_address]]
|is incorrectly rejected in |member in the constructor
|constant evaluation |is incorrectly rejected in
| |constant evaluation
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r13-160-g967cdbe6629653
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/112439] [13/14 Regression] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation since r13-160-g967cdbe6629653
2023-11-08 11:33 [Bug c++/112439] New: Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected de34 at live dot cn
2023-11-08 12:01 ` [Bug c++/112439] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation redi at gcc dot gnu.org
2023-11-08 13:55 ` [Bug c++/112439] [13/14 Regression] " ppalka at gcc dot gnu.org
@ 2024-02-01 22:07 ` jason at gcc dot gnu.org
2024-02-02 3:22 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2024-02-01 22:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112439
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/112439] [13/14 Regression] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation since r13-160-g967cdbe6629653
2023-11-08 11:33 [Bug c++/112439] New: Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected de34 at live dot cn
` (2 preceding siblings ...)
2024-02-01 22:07 ` [Bug c++/112439] [13/14 Regression] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation since r13-160-g967cdbe6629653 jason at gcc dot gnu.org
@ 2024-02-02 3:22 ` cvs-commit at gcc dot gnu.org
2024-02-02 15:57 ` cvs-commit at gcc dot gnu.org
2024-02-02 16:12 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-02 3:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112439
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:f4998609908e4926fc095ce97cb84b187294fd1d
commit r14-8727-gf4998609908e4926fc095ce97cb84b187294fd1d
Author: Jason Merrill <jason@redhat.com>
Date: Thu Feb 1 17:23:53 2024 -0500
c++: no_unique_address and constexpr [PR112439]
Here, because we don't build a CONSTRUCTOR for an empty base, we were
wrongly marking the Foo CONSTRUCTOR as complete after initializing the
Empty
member. Fixed by checking empty_base here as well.
PR c++/112439
gcc/cp/ChangeLog:
* constexpr.cc (cxx_eval_store_expression): Check empty_base
before marking a CONSTRUCTOR readonly.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/no_unique_address15.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/112439] [13/14 Regression] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation since r13-160-g967cdbe6629653
2023-11-08 11:33 [Bug c++/112439] New: Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected de34 at live dot cn
` (3 preceding siblings ...)
2024-02-02 3:22 ` cvs-commit at gcc dot gnu.org
@ 2024-02-02 15:57 ` cvs-commit at gcc dot gnu.org
2024-02-02 16:12 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-02 15:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112439
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:8bae2c531d2ea8f7872ed41f273b6fabaa6a9965
commit r13-8271-g8bae2c531d2ea8f7872ed41f273b6fabaa6a9965
Author: Jason Merrill <jason@redhat.com>
Date: Thu Feb 1 17:23:53 2024 -0500
c++: no_unique_address and constexpr [PR112439]
Here, because we don't build a CONSTRUCTOR for an empty base, we were
wrongly marking the Foo CONSTRUCTOR as complete after initializing the
Empty
member. Fixed by checking empty_base here as well.
PR c++/112439
gcc/cp/ChangeLog:
* constexpr.cc (cxx_eval_store_expression): Check empty_base
before marking a CONSTRUCTOR readonly.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/no_unique_address15.C: New test.
(cherry picked from commit f4998609908e4926fc095ce97cb84b187294fd1d)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/112439] [13/14 Regression] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation since r13-160-g967cdbe6629653
2023-11-08 11:33 [Bug c++/112439] New: Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected de34 at live dot cn
` (4 preceding siblings ...)
2024-02-02 15:57 ` cvs-commit at gcc dot gnu.org
@ 2024-02-02 16:12 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2024-02-02 16:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112439
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 13.3/14.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-02-02 16:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-08 11:33 [Bug c++/112439] New: Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected de34 at live dot cn
2023-11-08 12:01 ` [Bug c++/112439] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation redi at gcc dot gnu.org
2023-11-08 13:55 ` [Bug c++/112439] [13/14 Regression] " ppalka at gcc dot gnu.org
2024-02-01 22:07 ` [Bug c++/112439] [13/14 Regression] Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected in constant evaluation since r13-160-g967cdbe6629653 jason at gcc dot gnu.org
2024-02-02 3:22 ` cvs-commit at gcc dot gnu.org
2024-02-02 15:57 ` cvs-commit at gcc dot gnu.org
2024-02-02 16:12 ` 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).