Skip to content

[clang] Wrong class specialization is selected when alias template is used for template template parameter #167320

@carljohnsonnewhampshire-hue

Description

The second static assert in the following trivial example code fails due to incorrect class specialization being selected:

template <template <typename...> class, class>
struct match_class_specialization
{
    enum { matches = 0 };
};

template <template <typename...> class Type, typename... Ts>
struct match_class_specialization<Type, Type<Ts...>>
{
    enum { matches = 1 };
};



template <typename...> struct my_type {};

static_assert(match_class_specialization<my_type, my_type<int, int>>{}.matches);



template <typename... Ts> using my_type_alias  = my_type<Ts...>;

static_assert(match_class_specialization<my_type_alias, my_type<int, int>>{}.matches);


int main() {}

This compiles fine in GCC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions