Skip to content

Bug in partial class template specialization #53139

Open
@vladon

Description

@vladon
template <class A>
struct Foo {
  template <class Bar>
  constexpr auto a_method();
};

template <class A>
template <class Bar>
constexpr auto Foo<A>::a_method() {
    return 42;
}

template <>
template <class Bar>
constexpr auto Foo<void>::a_method() {
    return 42;
}

It can be compiled with GCC, but not with Clang.
If we first provide explicit specialization, Clang will compile it.
Seems like a bug in Clang.

See also:
https://stackoverflow.com/questions/70670212/is-this-partial-class-specialization-buggy-or-is-it-a-bug-in-clang-or-gcc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorc++14clang:frontendLanguage frontend issues, e.g. anything involving "Sema"rejects-valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions