public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/91911] Strange interaction between CTAD and decltype
[not found] <bug-91911-4@http.gcc.gnu.org/bugzilla/>
@ 2021-06-24 19:23 ` ppalka at gcc dot gnu.org
2021-06-24 19:25 ` ppalka at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-06-24 19:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91911
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
CC| |ppalka at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2021-06-24
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, this never worked. More reduced:
template<typename T>
struct span {
using value_type = T;
span(T);
};
template<typename X>
using SpanType = decltype(span(X()));
template<typename X>
using ConstSpanType = span<const typename SpanType<X>::value_type>;
using type = ConstSpanType<int>;
using type = span<const int>;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/91911] Strange interaction between CTAD and decltype
[not found] <bug-91911-4@http.gcc.gnu.org/bugzilla/>
2021-06-24 19:23 ` [Bug c++/91911] Strange interaction between CTAD and decltype ppalka at gcc dot gnu.org
@ 2021-06-24 19:25 ` ppalka at gcc dot gnu.org
2021-06-24 19:27 ` ppalka at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-06-24 19:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91911
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |juergen.reiss at gmx dot de
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 98077 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/91911] Strange interaction between CTAD and decltype
[not found] <bug-91911-4@http.gcc.gnu.org/bugzilla/>
2021-06-24 19:23 ` [Bug c++/91911] Strange interaction between CTAD and decltype ppalka at gcc dot gnu.org
2021-06-24 19:25 ` ppalka at gcc dot gnu.org
@ 2021-06-24 19:27 ` ppalka at gcc dot gnu.org
2022-01-20 14:26 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-06-24 19:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91911
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cadet.gabriel at gmail dot com
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 100723 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/91911] Strange interaction between CTAD and decltype
[not found] <bug-91911-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2021-06-24 19:27 ` ppalka at gcc dot gnu.org
@ 2022-01-20 14:26 ` cvs-commit at gcc dot gnu.org
2022-01-20 14:29 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-20 14:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91911
--- Comment #4 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:09845ad7569bac27c3a1dc7b410d9df764d2ca06
commit r12-6773-g09845ad7569bac27c3a1dc7b410d9df764d2ca06
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Jan 20 09:25:49 2022 -0500
c++: CTAD inside alias template [PR91911, PR103672]
In the first testcase below, when processing the alias template
ConstSpanType, transparency of alias template specializations means we
replace SpanType<T> with its instantiated definition. But this
instantiation lowers the level of the CTAD placeholder for span{T()} from
2 to 1, and so the later instantiation of ConstSpanType<int> erroneously
substitutes this CTAD placeholder with the template argument at level 1
index 0, i.e. with int, before we get a chance to perform the CTAD.
Although we represent CTAD placeholders as template parameters, we never
actually want to replace them via tsubst. So this patch adjusts tsubst
to handle CTAD placeholders by simply substituting the template and
returning a new CTAD placeholder. Moreover, this means that the level
of a CTAD placeholder doesn't matter, so we may as well give them all
the same level. This patch gives them the special level 0.
The change in tsubst_decl removes a likely dead !CHECKING_P safeguard
added in 2017, which would otherwise now get triggered for variables
with CTAD placeholder types (since their level is 0).
PR c++/91911
PR c++/103672
gcc/cp/ChangeLog:
* pt.cc (keep_template_parm): Punt on a level 0 template parm.
(tsubst_decl) <case VAR_DECL>: Remove !CHECKING_P safeguard.
(tsubst) <case TEMPLATE_TYPE_PARM>: Handle CTAD placeholders
specially.
(make_auto_1): Add defaulted 'level' parameter.
(make_template_placeholder): Pass 0 as 'level' to make_auto_1.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/class-deduction101.C: New test.
* g++.dg/cpp1z/class-deduction101a.C: New test.
* g++.dg/cpp1z/class-deduction101b.C: New test.
* g++.dg/cpp1z/class-deduction102.C: New test.
* g++.dg/cpp1z/class-deduction102a.C: New test.
* g++.dg/cpp1z/class-deduction102b.C: New test.
* g++.dg/cpp1z/class-deduction103.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/91911] Strange interaction between CTAD and decltype
[not found] <bug-91911-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2022-01-20 14:26 ` cvs-commit at gcc dot gnu.org
@ 2022-01-20 14:29 ` ppalka at gcc dot gnu.org
2022-03-29 17:54 ` ppalka at gcc dot gnu.org
2024-02-19 15:15 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-20 14:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91911
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |12.0
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/91911] Strange interaction between CTAD and decltype
[not found] <bug-91911-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2022-01-20 14:29 ` ppalka at gcc dot gnu.org
@ 2022-03-29 17:54 ` ppalka at gcc dot gnu.org
2024-02-19 15:15 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-03-29 17:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91911
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |accounts at prantare dot xyz
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 101914 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/91911] Strange interaction between CTAD and decltype
[not found] <bug-91911-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2022-03-29 17:54 ` ppalka at gcc dot gnu.org
@ 2024-02-19 15:15 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-02-19 15:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91911
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |omer.rosler at gmail dot com
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 99387 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-02-19 15:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-91911-4@http.gcc.gnu.org/bugzilla/>
2021-06-24 19:23 ` [Bug c++/91911] Strange interaction between CTAD and decltype ppalka at gcc dot gnu.org
2021-06-24 19:25 ` ppalka at gcc dot gnu.org
2021-06-24 19:27 ` ppalka at gcc dot gnu.org
2022-01-20 14:26 ` cvs-commit at gcc dot gnu.org
2022-01-20 14:29 ` ppalka at gcc dot gnu.org
2022-03-29 17:54 ` ppalka at gcc dot gnu.org
2024-02-19 15:15 ` ppalka 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).