https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90850

            Bug ID: 90850
           Summary: template parameters do not match
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

My gcc is 10.0.0, and the code is:

template<class T1>
class C
{
 template<class T2>
 class C2 { };
};

template<> template<class X, class Y>
class C<int>::C2 { };
template<> template<int>
class C<float>::C2 { };

gcc accepts the code. icc:

<source>(8): error: too many template parameters -- does not match previous
declaration (declared at line 4)

  template<> template<class X, class Y>

                                     ^

<source>(10): error: declaration is incompatible with template parameter "T2"
(declared at line 4)

  template<> template<int>

                         ^

compilation aborted for <source> (code 2)

Compiler returned: 2

clang rejects it:

source>:8:12: error: too many template parameters in template redeclaration

template<> template<class X, class Y>

           ^~~~~~~~~~~~~~~~~~~~~~~~~~

<source>:4:2: note: previous template declaration is here

 template<class T2>

 ^~~~~~~~~~~~~~~~~~

<source>:10:24: error: template parameter has a different kind in template
redeclaration

template<> template<int>

                       ^

<source>:4:17: note: previous template declaration is here

 template<class T2>

                ^

2 errors generated.

Compiler returned: 1


clang rejects it:

Reply via email to