* [Bug c++/101803] CTAD fails for nested designated initializers
2021-08-06 13:46 [Bug c++/101803] New: CTAD fails for nested designated initializers h2+bugs at fsfe dot org
@ 2021-08-18 12:53 ` ppalka at gcc dot gnu.org
2021-08-19 13:10 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-08-18 12:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101803
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2021-08-18
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on trunk so far by r12-2991 (which incorrectly refers to PR101820 instead
of this PR)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/101803] CTAD fails for nested designated initializers
2021-08-06 13:46 [Bug c++/101803] New: CTAD fails for nested designated initializers h2+bugs at fsfe dot org
2021-08-18 12:53 ` [Bug c++/101803] " ppalka at gcc dot gnu.org
@ 2021-08-19 13:10 ` cvs-commit at gcc dot gnu.org
2021-10-06 14:15 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-19 13:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101803
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:4285ca3e1c4a6c9540dcdf1c4a71b99aba9bbfe8
commit r12-3024-g4285ca3e1c4a6c9540dcdf1c4a71b99aba9bbfe8
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Aug 19 09:07:02 2021 -0400
c++: Fix PR number in testcase [PR101803]
Also clarify the description of CONSTRUCTOR_BRACES_ELIDED_P.
PR c++/101803
gcc/cp/ChangeLog:
* cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT): Clarify comment.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/class-deduction-aggr12.C: Fix PR number.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/101803] CTAD fails for nested designated initializers
2021-08-06 13:46 [Bug c++/101803] New: CTAD fails for nested designated initializers h2+bugs at fsfe dot org
2021-08-18 12:53 ` [Bug c++/101803] " ppalka at gcc dot gnu.org
2021-08-19 13:10 ` cvs-commit at gcc dot gnu.org
@ 2021-10-06 14:15 ` cvs-commit at gcc dot gnu.org
2021-10-06 14:17 ` ppalka at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-06 14:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101803
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:dc867191914eff2993312fc25c48db4b7c6289e9
commit r11-9079-gdc867191914eff2993312fc25c48db4b7c6289e9
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Aug 18 08:37:45 2021 -0400
c++: aggregate CTAD and brace elision [PR101344]
Here the problem is ultimately that collect_ctor_idx_types always
recurses into an eligible sub-CONSTRUCTOR regardless of whether the
corresponding pair of braces was elided in the original initializer.
This causes us to reject some completely-braced forms of aggregate
CTAD as in the first testcase below, because collect_ctor_idx_types
effectively assumes that the original initializer is always minimally
braced (and so the aggregate deduction candidate is given a function
type that's incompatible with the original completely-braced initializer).
In order to fix this, collect_ctor_idx_types needs to somehow know the
shape of the original initializer when iterating over the reshaped
initializer. To that end this patch makes reshape_init flag sub-ctors
that were built to undo brace elision in the original ctor, so that
collect_ctor_idx_types that determine whether to recurse into a sub-ctor
by simply inspecting this flag.
This happens to also fix PR101820, which is about aggregate CTAD using
designated initializers, for much the same reasons.
A curious case is the "intermediately-braced" initialization of 'e3'
(which we reject) in the first testcase below. It seems to me we're
behaving as specified here (according to [over.match.class.deduct]/1)
because the initializer element x_1={1, 2, 3, 4} corresponds to the
subobject e_1=E::t, hence the type T_1 of the first function parameter
of the aggregate deduction candidate is T(&&)[2][2], but T can't be
deduced from x_1 using this parameter type (as opposed to say T(&&)[4]).
PR c++/101344
PR c++/101803
gcc/cp/ChangeLog:
* cp-tree.h (CONSTRUCTOR_BRACES_ELIDED_P): Define.
* decl.c (reshape_init_r): Set it.
* pt.c (collect_ctor_idx_types): Recurse into a sub-CONSTRUCTOR
iff CONSTRUCTOR_BRACES_ELIDED_P.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/class-deduction-aggr11.C: New test.
* g++.dg/cpp2a/class-deduction-aggr12.C: New test.
(cherry picked from commit be4a4fb516688d7cfe28a80a4aa333f4ecf0b518)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/101803] CTAD fails for nested designated initializers
2021-08-06 13:46 [Bug c++/101803] New: CTAD fails for nested designated initializers h2+bugs at fsfe dot org
` (2 preceding siblings ...)
2021-10-06 14:15 ` cvs-commit at gcc dot gnu.org
@ 2021-10-06 14:17 ` ppalka at gcc dot gnu.org
2021-11-26 11:40 ` h2+bugs at fsfe dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-10-06 14:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101803
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Target Milestone|--- |11.3
Resolution|--- |FIXED
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.3 and 12.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/101803] CTAD fails for nested designated initializers
2021-08-06 13:46 [Bug c++/101803] New: CTAD fails for nested designated initializers h2+bugs at fsfe dot org
` (3 preceding siblings ...)
2021-10-06 14:17 ` ppalka at gcc dot gnu.org
@ 2021-11-26 11:40 ` h2+bugs at fsfe dot org
2022-05-31 19:58 ` h2+bugs at fsfe dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: h2+bugs at fsfe dot org @ 2021-11-26 11:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101803
--- Comment #5 from Hannes Hauswedell <h2+bugs at fsfe dot org> ---
Thanks a lot for the fix! Any chance this will make into the 10.x branch?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/101803] CTAD fails for nested designated initializers
2021-08-06 13:46 [Bug c++/101803] New: CTAD fails for nested designated initializers h2+bugs at fsfe dot org
` (4 preceding siblings ...)
2021-11-26 11:40 ` h2+bugs at fsfe dot org
@ 2022-05-31 19:58 ` h2+bugs at fsfe dot org
2022-06-02 13:21 ` ppalka at gcc dot gnu.org
2022-06-02 14:10 ` h2+bugs at fsfe dot org
7 siblings, 0 replies; 9+ messages in thread
From: h2+bugs at fsfe dot org @ 2022-05-31 19:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101803
--- Comment #6 from Hannes Hauswedell <h2+bugs at fsfe dot org> ---
Since it seems like 10.4 is around the corner... any chance this will make it?
Thanks a lot!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/101803] CTAD fails for nested designated initializers
2021-08-06 13:46 [Bug c++/101803] New: CTAD fails for nested designated initializers h2+bugs at fsfe dot org
` (5 preceding siblings ...)
2022-05-31 19:58 ` h2+bugs at fsfe dot org
@ 2022-06-02 13:21 ` ppalka at gcc dot gnu.org
2022-06-02 14:10 ` h2+bugs at fsfe dot org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-06-02 13:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101803
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Hannes Hauswedell from comment #6)
> Since it seems like 10.4 is around the corner... any chance this will make
> it?
>
> Thanks a lot!
Unfortunately I don't think so :/ the patch doesn't apply cleanly to the 10
branch because it depends on PR93976 / P2082R1. And we tend to backport
non-regression C++20 bugfixes only to the latest release, which in this case
was GCC 11.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/101803] CTAD fails for nested designated initializers
2021-08-06 13:46 [Bug c++/101803] New: CTAD fails for nested designated initializers h2+bugs at fsfe dot org
` (6 preceding siblings ...)
2022-06-02 13:21 ` ppalka at gcc dot gnu.org
@ 2022-06-02 14:10 ` h2+bugs at fsfe dot org
7 siblings, 0 replies; 9+ messages in thread
From: h2+bugs at fsfe dot org @ 2022-06-02 14:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101803
--- Comment #8 from Hannes Hauswedell <h2+bugs at fsfe dot org> ---
OK, thank you anyway!
^ permalink raw reply [flat|nested] 9+ messages in thread