[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 --- Comment #7 from CVS Commits --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:24d51e749570dcb85bd43d3b528f58ad6141de26 commit r12-7741-g24d51e749570dcb85bd43d3b528f58ad6141de26 Author: Jason Merrill Date: Mon Mar 21 09:57:28 2022 -0400 c++: designated init and aggregate members [PR103337] Our C++20 designated initializer handling was broken with members of class type; we would find the relevant member and then try to find a member of the member with the same name. Or we would sometimes ignore the designator entirely. The former problem is fixed by the change to reshape_init_class, the latter by the change to reshape_init_r. PR c++/103337 PR c++/102740 PR c++/103299 PR c++/102538 gcc/cp/ChangeLog: * decl.cc (reshape_init_class): Avoid looking for designator after we found it. (reshape_init_r): Keep looking for designator. gcc/testsuite/ChangeLog: * g++.dg/ext/flexary3.C: Remove one error. * g++.dg/parse/pr43765.C: Likewise. * g++.dg/cpp2a/desig22.C: New test. * g++.dg/cpp2a/desig23.C: New test. * g++.dg/cpp2a/desig24.C: New test. * g++.dg/cpp2a/desig25.C: New test.
[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 Jason Merrill changed: What|Removed |Added CC||jason at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org Status|NEW |ASSIGNED
[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 Patrick Palka changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=103337 --- Comment #6 from Patrick Palka --- PR103337 contains a related testcase which we reject with a similar error, and interestingly that one isn't a regression.
[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 Patrick Palka changed: What|Removed |Added Assignee|ppalka at gcc dot gnu.org |unassigned at gcc dot gnu.org Status|ASSIGNED|NEW
[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 Patrick Palka changed: What|Removed |Added CC||ppalka at gcc dot gnu.org Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 Marek Polacek changed: What|Removed |Added CC||mpolacek at gcc dot gnu.org --- Comment #5 from Marek Polacek --- Started with r12-954. (Bug 101405 also started with that rev.)
[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 Andrew Pinski changed: What|Removed |Added CC||roland at gnu dot org --- Comment #4 from Andrew Pinski --- *** Bug 103290 has been marked as a duplicate of this bug. ***
[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 --- Comment #3 from Curdeius Curdeius --- For other users with this problem, a workaround is to use a named struct. So here, it would look like: ``` typedef struct { const void* content; } put_t; typedef struct { union { put_t put; // named struct }; } op_t; op_t f(const char* alias) { return op_t{ .put = put_t{ // named explicitly .content = alias, }, }; } ```
[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 Richard Biener changed: What|Removed |Added Priority|P3 |P2
[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 Andrew Pinski changed: What|Removed |Added Target Milestone|--- |10.4 Ever confirmed|0 |1 Known to fail||11.2.0 Last reconfirmed||2021-10-14 Known to work||10.3.0, 11.1.0 See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=100489 Status|UNCONFIRMED |NEW --- Comment #2 from Andrew Pinski --- Just like PR 101767, so this is most likely caused by the patch which fixes PR 100489 so this is a regression in 10.4.0 also.
[Bug c++/102740] [10/11/12 Regression] Data member not found in struct inside an unnamed union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102740 --- Comment #1 from Curdeius Curdeius --- Also, the bug doesn't appear (or TBH, it's a different bug), when the unnamed union contains a `content` data member. But it seems to be a bug then as well, because it's not what is intended to be initialized. Also, the bug doesn't appear without union.