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.

Reply via email to