public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95932] New: ICE in redeclare_class_template, at cp/pt.c:6231
@ 2020-06-27 4:36 haoxintu at gmail dot com
2020-07-03 4:29 ` [Bug c++/95932] " haoxintu at gmail dot com
2020-07-08 22:40 ` mpolacek at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-27 4:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95932
Bug ID: 95932
Summary: ICE in redeclare_class_template, at cp/pt.c:6231
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
This code, bug.cc, reduced by C-Reduce, makes GCC-trunk ICE.
$cat bug.cc
template <template>> struct a < class b{}, struct b {
$g++ bug.cc
bug.cc:1:19: error: expected ‘<’ before ‘>>’ token
1 | template <template>> struct a < class b{}, struct b {
| ^~
bug.cc:1:19: error: expected identifier before ‘>>’ token
bug.cc:1:19: error: expected ‘>’ before ‘>>’ token
bug.cc:1:19: error: expected ‘class’ or ‘typename’ before ‘>>’ token
bug.cc:1:19: error: expected identifier before ‘>>’ token
bug.cc:1:19: error: expected ‘>’ before ‘>>’ token
bug.cc:1:29: error: ‘a’ is not a class template
1 | template <template>> struct a < class b{}, struct b {
| ^
bug.cc:1:40: error: types may not be defined in template arguments
1 | template <template>> struct a < class b{}, struct b {
| ^
bug.cc:1:51: internal compiler error: in redeclare_class_template, at
cp/pt.c:6231
1 | template <template>> struct a < class b{}, struct b {
| ^
0x652319 redeclare_class_template(tree_node*, tree_node*, tree_node*)
../../gcc/cp/pt.c:6231
0x8fb2e7 xref_tag_1
../../gcc/cp/decl.c:15043
0x8fb440 xref_tag(tag_types, tree_node*, tag_scope, bool)
../../gcc/cp/decl.c:15085
0x9a1584 cp_parser_class_head
../../gcc/cp/parser.c:24658
0x9a1584 cp_parser_class_specifier_1
../../gcc/cp/parser.c:23880
0x9a1aa3 cp_parser_class_specifier
../../gcc/cp/parser.c:24254
0x9a1aa3 cp_parser_type_specifier
../../gcc/cp/parser.c:17762
0x9b6b53 cp_parser_type_specifier_seq
../../gcc/cp/parser.c:22439
0x9afa94 cp_parser_type_id_1
../../gcc/cp/parser.c:22256
0x9b2603 cp_parser_template_type_arg
../../gcc/cp/parser.c:22347
0x9b6ccf cp_parser_template_argument
../../gcc/cp/parser.c:17235
0x9b6ccf cp_parser_template_argument_list
../../gcc/cp/parser.c:17146
0x9b6ccf cp_parser_enclosed_template_argument_list
../../gcc/cp/parser.c:29832
0x9b8cd0 cp_parser_check_for_invalid_template_id
../../gcc/cp/parser.c:3202
0x99ff18 cp_parser_check_for_invalid_template_id
../../gcc/cp/parser.c:3181
0x99ff18 cp_parser_class_head
../../gcc/cp/parser.c:24437
0x99ff18 cp_parser_class_specifier_1
../../gcc/cp/parser.c:23880
0x9a1aa3 cp_parser_class_specifier
../../gcc/cp/parser.c:24254
0x9a1aa3 cp_parser_type_specifier
../../gcc/cp/parser.c:17762
0x9a2a02 cp_parser_decl_specifier_seq
../../gcc/cp/parser.c:14410
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.
$g++ --version
g++ (GCC) 11.0.0 20200626 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/95932] ICE in redeclare_class_template, at cp/pt.c:6231
2020-06-27 4:36 [Bug c++/95932] New: ICE in redeclare_class_template, at cp/pt.c:6231 haoxintu at gmail dot com
@ 2020-07-03 4:29 ` haoxintu at gmail dot com
2020-07-08 22:40 ` mpolacek at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: haoxintu at gmail dot com @ 2020-07-03 4:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95932
--- Comment #1 from Haoxin Tu <haoxintu at gmail dot com> ---
Add a more meaningful case.
$cat p.cc
template <class> class a {};
template <template <class> >
struct a < class b{}, struct b {}>;
$g++ p.cc
p.cc:2:28: error: expected ‘class’ or ‘typename’ before ‘>’ token
2 | template <template <class> >
| ^
p.cc:3:19: error: types may not be defined in template arguments
3 | struct a < class b{}, struct b {}>;
| ^
p.cc:3:30: internal compiler error: in redeclare_class_template, at
cp/pt.c:6231
3 | struct a < class b{}, struct b {}>;
| ^
0x6be12f redeclare_class_template(tree_node*, tree_node*, tree_node*)
../../gcc/cp/pt.c:6231
...
While in Clang
$clang++ p.cc
p.cc:2:28: error: template template parameter requires 'class' after the
parameter list
template <template <class> >
^
class
p.cc:3:18: error: 'b' cannot be defined in a type specifier
struct a < class b{}, struct b {}>;
^
2 errors generated.
I guess this is also a possible issue that users may encounter in programming,
but it makes GCC crashed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/95932] ICE in redeclare_class_template, at cp/pt.c:6231
2020-06-27 4:36 [Bug c++/95932] New: ICE in redeclare_class_template, at cp/pt.c:6231 haoxintu at gmail dot com
2020-07-03 4:29 ` [Bug c++/95932] " haoxintu at gmail dot com
@ 2020-07-08 22:40 ` mpolacek at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-08 22:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95932
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2020-07-08
Priority|P3 |P5
CC| |mpolacek at gcc dot gnu.org
Status|UNCONFIRMED |NEW
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-08 22:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27 4:36 [Bug c++/95932] New: ICE in redeclare_class_template, at cp/pt.c:6231 haoxintu at gmail dot com
2020-07-03 4:29 ` [Bug c++/95932] " haoxintu at gmail dot com
2020-07-08 22:40 ` mpolacek 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).