public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97103] New: ICE on nested requires expression template template instantiation
@ 2020-09-18 9:45 mateusz.pusz at gmail dot com
2020-09-18 9:45 ` [Bug c++/97103] " mateusz.pusz at gmail dot com
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: mateusz.pusz at gmail dot com @ 2020-09-18 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97103
Bug ID: 97103
Summary: ICE on nested requires expression template template
instantiation
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mateusz.pusz at gmail dot com
Target Milestone: ---
```
template<typename R, typename Rep = double>
class quantity {};
template<template<typename, typename> typename Q>
inline constexpr bool valid_template_arguments = requires {
requires requires { typename Q<int, int>; };
};
static_assert(valid_template_arguments<quantity>);
```
Might be related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66564.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97103] ICE on nested requires expression template template instantiation
2020-09-18 9:45 [Bug c++/97103] New: ICE on nested requires expression template template instantiation mateusz.pusz at gmail dot com
@ 2020-09-18 9:45 ` mateusz.pusz at gmail dot com
2020-09-18 12:55 ` ppalka at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mateusz.pusz at gmail dot com @ 2020-09-18 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97103
--- Comment #1 from Mateusz Pusz <mateusz.pusz at gmail dot com> ---
<source>: In instantiation of 'constexpr const bool
valid_template_arguments<template<class R, class Rep> class quantity>':
<source>:8:15: required from here
<source>:6:32: internal compiler error: in tsubst, at cp/pt.c:15447
6 | requires requires { typename Q<int, int>; }; //
two representation types
| ~~~~~~~~~^~~~~~~~~~~~
0x1b755e9 internal_error(char const*, ...)
???:0
0x686d2b fancy_abort(char const*, int, char const*)
???:0
0x896a1b tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x709a42 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x709725 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x89ac2f instantiate_decl(tree_node*, bool, bool)
???:0
0x79044e maybe_instantiate_decl(tree_node*)
???:0
0x7935e8 mark_used(tree_node*, int)
???:0
0x90bab7 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*,
bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
???:0
0x862cec c_parse_file()
???:0
0x9d3702 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97103] ICE on nested requires expression template template instantiation
2020-09-18 9:45 [Bug c++/97103] New: ICE on nested requires expression template template instantiation mateusz.pusz at gmail dot com
2020-09-18 9:45 ` [Bug c++/97103] " mateusz.pusz at gmail dot com
@ 2020-09-18 12:55 ` ppalka at gcc dot gnu.org
2020-09-18 18:47 ` [Bug c++/97103] [10/11 Regression] " ppalka at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-09-18 12:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97103
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
Last reconfirmed| |2020-09-18
CC| |ppalka at gcc dot gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97103] [10/11 Regression] ICE on nested requires expression template template instantiation
2020-09-18 9:45 [Bug c++/97103] New: ICE on nested requires expression template template instantiation mateusz.pusz at gmail dot com
2020-09-18 9:45 ` [Bug c++/97103] " mateusz.pusz at gmail dot com
2020-09-18 12:55 ` ppalka at gcc dot gnu.org
@ 2020-09-18 18:47 ` ppalka at gcc dot gnu.org
2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-09-18 18:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97103
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.3
Known to fail| |10.1.0, 10.2.0, 11.0
Known to work| |9.3.0
Summary|ICE on nested requires |[10/11 Regression] ICE on
|expression template |nested requires expression
|template instantiation |template template
| |instantiation
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r10-8077.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97103] [10/11 Regression] ICE on nested requires expression template template instantiation
2020-09-18 9:45 [Bug c++/97103] New: ICE on nested requires expression template template instantiation mateusz.pusz at gmail dot com
` (2 preceding siblings ...)
2020-09-18 18:47 ` [Bug c++/97103] [10/11 Regression] " ppalka at gcc dot gnu.org
@ 2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org
2020-10-12 11:52 ` [Bug c++/97103] [10 " rguenth at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-19 15:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97103
--- 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:e5d72c840a226fdbab65912f97d42a1dbdaf6ed2
commit r11-3296-ge5d72c840a226fdbab65912f97d42a1dbdaf6ed2
Author: Patrick Palka <ppalka@redhat.com>
Date: Sat Sep 19 11:02:46 2020 -0400
c++: Fix self-mapping in map_arguments [PR96531, PR97103]
With r10-8077 we stopped passing the argified current_template_parms to
normalize_constraint_expression from finish_nested_requirement, and
instead made map_arguments perform a self-mapping of parameters when
args is NULL. But we're currently not handling parameter packs and
BOUND_TEMPLATE_TEMPLATE_PARMs properly during this self-mapping, which
leads to ICEs later during satisfaction.
To properly handle self-mapping of a parameter pack, this patch
extends template_parm_to_arg to handle TEMPLATE_PARM_P nodes, and
makes map_arguments use it. (This change revealed that the call to
template_parm_to_arg in convert_generic_types_to_packs was a no-op
because the argument 't' is never a TREE_LIST, so this patch
additionally removes this call.)
As for bound ttps, map_arguments before r10-8077 would map a
BOUND_TEMPLATE_TEMPLATE_PARM not to itself but to its underlying
TEMPLATE_TEMPLATE_PARM. We could restore this behavior in
map_arguments, but since a bound ttp is not really a template parameter
it seems better to make keep_template_parm not give us a bound ttp in
the first place. So this patch makes keep_template_parm return the
underlying ttp when it sees a bound ttp.
gcc/cp/ChangeLog:
PR c++/96531
PR c++/97103
* constraint.cc (map_arguments): Call template_parm_to_arg
in the self-mapping case.
(finish_shorthand_constraint): No need to build a TREE_LIST
before calling template_parm_to_arg.
* pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
overlying TREE_LIST node optional.
(keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
instead record its corresponding TEMPLATE_TEMPLATE_PARM.
(convert_generic_types_to_packs): Don't call
template_parm_to_arg.
gcc/testsuite/ChangeLog:
PR c++/96531
PR c++/97103
* g++.dg/cpp2a/concepts-ttp2.C: New test.
* g++.dg/cpp2a/concepts-variadic1.C: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97103] [10 Regression] ICE on nested requires expression template template instantiation
2020-09-18 9:45 [Bug c++/97103] New: ICE on nested requires expression template template instantiation mateusz.pusz at gmail dot com
` (3 preceding siblings ...)
2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org
@ 2020-10-12 11:52 ` rguenth at gcc dot gnu.org
2021-03-31 12:33 ` cvs-commit at gcc dot gnu.org
2021-03-31 12:35 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-12 11:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97103
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |11.0
Known to fail|11.0 |
Priority|P3 |P2
Summary|[10/11 Regression] ICE on |[10 Regression] ICE on
|nested requires expression |nested requires expression
|template template |template template
|instantiation |instantiation
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97103] [10 Regression] ICE on nested requires expression template template instantiation
2020-09-18 9:45 [Bug c++/97103] New: ICE on nested requires expression template template instantiation mateusz.pusz at gmail dot com
` (4 preceding siblings ...)
2020-10-12 11:52 ` [Bug c++/97103] [10 " rguenth at gcc dot gnu.org
@ 2021-03-31 12:33 ` cvs-commit at gcc dot gnu.org
2021-03-31 12:35 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-31 12:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97103
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:a834e6d59d74ccaefbcbbed5ea7ee25305057853
commit r10-9634-ga834e6d59d74ccaefbcbbed5ea7ee25305057853
Author: Patrick Palka <ppalka@redhat.com>
Date: Sat Sep 19 11:02:46 2020 -0400
c++: Fix self-mapping in map_arguments [PR96531, PR97103]
With r10-8077 we stopped passing the argified current_template_parms to
normalize_constraint_expression from finish_nested_requirement, and
instead made map_arguments perform a self-mapping of parameters when
args is NULL. But we're currently not handling parameter packs and
BOUND_TEMPLATE_TEMPLATE_PARMs properly during this self-mapping, which
leads to ICEs later during satisfaction.
To properly handle self-mapping of a parameter pack, this patch
extends template_parm_to_arg to handle TEMPLATE_PARM_P nodes, and
makes map_arguments use it. (This change revealed that the call to
template_parm_to_arg in convert_generic_types_to_packs was a no-op
because the argument 't' is never a TREE_LIST, so this patch
additionally removes this call.)
As for bound ttps, map_arguments before r10-8077 would map a
BOUND_TEMPLATE_TEMPLATE_PARM not to itself but to its underlying
TEMPLATE_TEMPLATE_PARM. We could restore this behavior in
map_arguments, but since a bound ttp is not really a template parameter
it seems better to make keep_template_parm not give us a bound ttp in
the first place. So this patch makes keep_template_parm return the
underlying ttp when it sees a bound ttp.
gcc/cp/ChangeLog:
PR c++/96531
PR c++/97103
* constraint.cc (map_arguments): Call template_parm_to_arg
in the self-mapping case.
(finish_shorthand_constraint): No need to build a TREE_LIST
before calling template_parm_to_arg.
* pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
overlying TREE_LIST node optional.
(keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
instead record its corresponding TEMPLATE_TEMPLATE_PARM.
(convert_generic_types_to_packs): Don't call
template_parm_to_arg.
gcc/testsuite/ChangeLog:
PR c++/96531
PR c++/97103
* g++.dg/cpp2a/concepts-ttp2.C: New test.
* g++.dg/cpp2a/concepts-variadic1.C: New test.
(cherry picked from commit e5d72c840a226fdbab65912f97d42a1dbdaf6ed2)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97103] [10 Regression] ICE on nested requires expression template template instantiation
2020-09-18 9:45 [Bug c++/97103] New: ICE on nested requires expression template template instantiation mateusz.pusz at gmail dot com
` (5 preceding siblings ...)
2021-03-31 12:33 ` cvs-commit at gcc dot gnu.org
@ 2021-03-31 12:35 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-03-31 12:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97103
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-03-31 12:35 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 9:45 [Bug c++/97103] New: ICE on nested requires expression template template instantiation mateusz.pusz at gmail dot com
2020-09-18 9:45 ` [Bug c++/97103] " mateusz.pusz at gmail dot com
2020-09-18 12:55 ` ppalka at gcc dot gnu.org
2020-09-18 18:47 ` [Bug c++/97103] [10/11 Regression] " ppalka at gcc dot gnu.org
2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org
2020-10-12 11:52 ` [Bug c++/97103] [10 " rguenth at gcc dot gnu.org
2021-03-31 12:33 ` cvs-commit at gcc dot gnu.org
2021-03-31 12:35 ` 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).