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

            Bug ID: 111608
           Summary: Cannot declare partial specialization after full
                    specialization
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: raplonu.jb at gmail dot com
  Target Milestone: ---

The following code fails to compile with GCC 13.2 and under.

// primary template
template<typename T>
struct X {
    void f();
};

// definition of full template specialization before partial template
specialization
template<>
void X<int*>::f() {}

// partial template specialization declaration
template<typename T>
struct X<T*> {
    void f();
};

int main() {
    X<int*>{}.f();
}

gcc give the following message:

error: partial specialization of 'struct X<T*>' after instantiation of 'struct
X<int*>

which seems incorrect since their have different levels of specialization.

Reply via email to