public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103337] New: rejects-valid brace elision inside designated initializer
@ 2021-11-19 19:19 ppalka at gcc dot gnu.org
2021-11-19 19:27 ` [Bug c++/103337] " mpolacek at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-11-19 19:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103337
Bug ID: 103337
Summary: rejects-valid brace elision inside designated
initializer
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppalka at gcc dot gnu.org
Target Milestone: ---
struct op_t {
struct put_t {
int x;
} put;
};
op_t x{0}; // OK
op_t y{.put=0}; // error: 'op_t::put_t' has no non-static data member named
'put'
GCC rejects the second initializer, but Clang and MSVC accept.
Doesn't appear to be a regression.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/103337] rejects-valid brace elision inside designated initializer
2021-11-19 19:19 [Bug c++/103337] New: rejects-valid brace elision inside designated initializer ppalka at gcc dot gnu.org
@ 2021-11-19 19:27 ` mpolacek at gcc dot gnu.org
2022-03-21 20:47 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-11-19 19:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103337
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Last reconfirmed| |2021-11-19
Status|UNCONFIRMED |NEW
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
And
op_t z{.put={0}};
works, so confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/103337] rejects-valid brace elision inside designated initializer
2021-11-19 19:19 [Bug c++/103337] New: rejects-valid brace elision inside designated initializer ppalka at gcc dot gnu.org
2021-11-19 19:27 ` [Bug c++/103337] " mpolacek at gcc dot gnu.org
@ 2022-03-21 20:47 ` cvs-commit at gcc dot gnu.org
2022-03-21 20:55 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-21 20:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103337
--- 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:24d51e749570dcb85bd43d3b528f58ad6141de26
commit r12-7741-g24d51e749570dcb85bd43d3b528f58ad6141de26
Author: Jason Merrill <jason@redhat.com>
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/103337] rejects-valid brace elision inside designated initializer
2021-11-19 19:19 [Bug c++/103337] New: rejects-valid brace elision inside designated initializer ppalka at gcc dot gnu.org
2021-11-19 19:27 ` [Bug c++/103337] " mpolacek at gcc dot gnu.org
2022-03-21 20:47 ` cvs-commit at gcc dot gnu.org
@ 2022-03-21 20:55 ` jason at gcc dot gnu.org
2022-03-22 5:18 ` cvs-commit at gcc dot gnu.org
2022-03-23 19:37 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2022-03-21 20:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103337
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |12.0
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/103337] rejects-valid brace elision inside designated initializer
2021-11-19 19:19 [Bug c++/103337] New: rejects-valid brace elision inside designated initializer ppalka at gcc dot gnu.org
` (2 preceding siblings ...)
2022-03-21 20:55 ` jason at gcc dot gnu.org
@ 2022-03-22 5:18 ` cvs-commit at gcc dot gnu.org
2022-03-23 19:37 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-22 5:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103337
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:2b2f575e6f27acc0c7ba6a3affc760bf2b96a84b
commit r11-9678-g2b2f575e6f27acc0c7ba6a3affc760bf2b96a84b
Author: Jason Merrill <jason@redhat.com>
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.c (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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/103337] rejects-valid brace elision inside designated initializer
2021-11-19 19:19 [Bug c++/103337] New: rejects-valid brace elision inside designated initializer ppalka at gcc dot gnu.org
` (3 preceding siblings ...)
2022-03-22 5:18 ` cvs-commit at gcc dot gnu.org
@ 2022-03-23 19:37 ` cvs-commit at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-23 19:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103337
--- Comment #5 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:2cd0c9a5310420e1039be5e514a818b6d381d89f
commit r12-7789-g2cd0c9a5310420e1039be5e514a818b6d381d89f
Author: Jason Merrill <jason@redhat.com>
Date: Wed Mar 23 13:22:25 2022 -0400
c++: tweak PR103337 fix
Patrick suggested a way to implement the designated-init handling without
(temporarily) modifying the CONSTRUCTOR being reshaped.
PR c++/103337
gcc/cp/ChangeLog:
* decl.cc (reshape_single_init): New.
(reshape_init_class): Use it.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-23 19:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 19:19 [Bug c++/103337] New: rejects-valid brace elision inside designated initializer ppalka at gcc dot gnu.org
2021-11-19 19:27 ` [Bug c++/103337] " mpolacek at gcc dot gnu.org
2022-03-21 20:47 ` cvs-commit at gcc dot gnu.org
2022-03-21 20:55 ` jason at gcc dot gnu.org
2022-03-22 5:18 ` cvs-commit at gcc dot gnu.org
2022-03-23 19:37 ` cvs-commit 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).