public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96555] New: "template argument involves template parameter(s)" with dot or arrow operator in partial specialization
@ 2020-08-10 15:22 arthur.j.odwyer at gmail dot com
2020-08-25 8:15 ` [Bug c++/96555] " rguenth at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2020-08-10 15:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96555
Bug ID: 96555
Summary: "template argument involves template parameter(s)"
with dot or arrow operator in partial specialization
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: arthur.j.odwyer at gmail dot com
Target Milestone: ---
// https://godbolt.org/z/Kc98ea
struct A { int x; };
extern A a;
template<int...> struct B {};
template<int y>
struct B<y, sizeof(a.x)> {};
<source>:5:8: error: template argument '(int)sizeof (a.x)' involves template
parameter(s)
5 | struct B<y, sizeof(a.x)> {};
| ^~~~~~~~~~~~~~~~~
GCC seems to have a problem only with expressions involving the dot operator
(e.g. `sizeof(a.x)`) and the arrow operator (e.g. `sizeof(p->x)`), but not any
other operators, which leads me to believe that the root cause here is related
to the root cause of bug 96215.
Grepbait: template argument involves template parameters
Same error message in different situations, all involving partial
specializations but none involving dot or arrow specifically: bug 67593, bug
83426, bug 90099
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/96555] "template argument involves template parameter(s)" with dot or arrow operator in partial specialization
2020-08-10 15:22 [Bug c++/96555] New: "template argument involves template parameter(s)" with dot or arrow operator in partial specialization arthur.j.odwyer at gmail dot com
@ 2020-08-25 8:15 ` rguenth at gcc dot gnu.org
2020-11-25 15:55 ` gcc-bugzilla at contacts dot eelis.net
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-25 8:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96555
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
is it supposed to be accepted?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/96555] "template argument involves template parameter(s)" with dot or arrow operator in partial specialization
2020-08-10 15:22 [Bug c++/96555] New: "template argument involves template parameter(s)" with dot or arrow operator in partial specialization arthur.j.odwyer at gmail dot com
2020-08-25 8:15 ` [Bug c++/96555] " rguenth at gcc dot gnu.org
@ 2020-11-25 15:55 ` gcc-bugzilla at contacts dot eelis.net
2021-05-25 19:43 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: gcc-bugzilla at contacts dot eelis.net @ 2020-11-25 15:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96555
Eelis <gcc-bugzilla at contacts dot eelis.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc-bugzilla at contacts dot eelis
| |.net
--- Comment #2 from Eelis <gcc-bugzilla at contacts dot eelis.net> ---
The following slightly simpler testcase is also accepted by clang and rejected
by gcc with the same "involves template parameter" error:
template<typename T, int i>
struct X;
template<typename T>
struct X<T, sizeof(T)> {};
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/96555] "template argument involves template parameter(s)" with dot or arrow operator in partial specialization
2020-08-10 15:22 [Bug c++/96555] New: "template argument involves template parameter(s)" with dot or arrow operator in partial specialization arthur.j.odwyer at gmail dot com
2020-08-25 8:15 ` [Bug c++/96555] " rguenth at gcc dot gnu.org
2020-11-25 15:55 ` gcc-bugzilla at contacts dot eelis.net
@ 2021-05-25 19:43 ` ppalka at gcc dot gnu.org
2021-05-27 16:37 ` cvs-commit at gcc dot gnu.org
2021-05-29 13:01 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-25 19:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96555
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
CC| |ppalka at gcc dot gnu.org
Last reconfirmed| |2021-05-25
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/96555] "template argument involves template parameter(s)" with dot or arrow operator in partial specialization
2020-08-10 15:22 [Bug c++/96555] New: "template argument involves template parameter(s)" with dot or arrow operator in partial specialization arthur.j.odwyer at gmail dot com
` (2 preceding siblings ...)
2021-05-25 19:43 ` ppalka at gcc dot gnu.org
@ 2021-05-27 16:37 ` cvs-commit at gcc dot gnu.org
2021-05-29 13:01 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-27 16:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96555
--- Comment #3 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:9b94785dedb08b006419bec1a402614d9241317a
commit r12-1093-g9b94785dedb08b006419bec1a402614d9241317a
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu May 27 12:36:39 2021 -0400
c++: Relax rule for non-type arguments in partial specs [CWG1315]
This implements the wording changes of CWG 1315, which permits non-type
template arguments in a partial specialization to use template
parameters more freely. Delightfully, it seems the only change needed
is to remove a single check from process_partial_specialization (amidst
a bunch of whitespace changes).
But that change alone revealed a latent problem with
for_each_template_parm:
it ends up looking into some non-deduced contexts even when
include_nondeduced_p is false. This causes us to silently accept some
partial specializations within the testsuite that contain non-deducible
non-type template parameters (and that were previously rejected due to
the rule that CWG 1315 relaxed). For now this patch makes a minimal
amount of changes to for_each_template_parm_r so that we continue to
reject existing ill-formed partial specializations within the testsuite.
I opened PR c++/100779 to track this issue.
DR 1315
PR c++/67593
PR c++/96555
gcc/cp/ChangeLog:
* pt.c (process_partial_specialization): Don't error on a
non-simple non-type template argument that involves template
parameters.
(for_each_template_parm_r): Don't walk TRAIT_EXPR, PLUS_EXPR,
MULT_EXPR, or SCOPE_REF when include_nondeduced_p is false.
gcc/testsuite/ChangeLog:
* g++.dg/template/partial16.C: New test.
* g++.dg/template/partial17.C: New test.
* g++.dg/template/partial18.C: New test.
* g++.dg/template/partial19.C: New test.
* g++.dg/cpp0x/pr68724.C: Adjust expected diagnostic for
ill-formed partial specialization.
* g++.dg/cpp0x/variadic38.C: Likewise.
* g++.dg/cpp1z/pr81016.C: Likewise.
* g++.dg/template/partial5.C: Likewise.
* g++.old-deja/g++.pt/spec21.C: Likewise.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/96555] "template argument involves template parameter(s)" with dot or arrow operator in partial specialization
2020-08-10 15:22 [Bug c++/96555] New: "template argument involves template parameter(s)" with dot or arrow operator in partial specialization arthur.j.odwyer at gmail dot com
` (3 preceding siblings ...)
2021-05-27 16:37 ` cvs-commit at gcc dot gnu.org
@ 2021-05-29 13:01 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-29 13:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96555
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |12.0
Status|ASSIGNED |RESOLVED
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-05-29 13:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 15:22 [Bug c++/96555] New: "template argument involves template parameter(s)" with dot or arrow operator in partial specialization arthur.j.odwyer at gmail dot com
2020-08-25 8:15 ` [Bug c++/96555] " rguenth at gcc dot gnu.org
2020-11-25 15:55 ` gcc-bugzilla at contacts dot eelis.net
2021-05-25 19:43 ` ppalka at gcc dot gnu.org
2021-05-27 16:37 ` cvs-commit at gcc dot gnu.org
2021-05-29 13:01 ` 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).