Skip to content

clang accepts partial template specialization without base #131835

@abellgithub

Description

@abellgithub

This fails on gcc but works on clang. Note types of SYMS template arguments. I think clang is wrong here, but it could be me who's wrong ;)

#include <cstdint>
#include <type_traits>

template <int SYMS, typename T=void>
struct arithmetic_c;

template<uint32_t SYMS>
struct arithmetic_c<SYMS, typename std::enable_if<(SYMS > 16 && SYMS < 2048)>::type>
{
    arithmetic_c()
    {}
};

template<int SYMS>
struct arithmetic_c<SYMS, typename std::enable_if<(SYMS > 1 && SYMS <= 16)>::type >
{
    arithmetic_c()
    {}
};

int main()
{
    arithmetic_c<32> corrector;
    return 0;
}

Compiler Explorer

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"cwg-issueAn issue that was filed to the Core Working Groupdiverges-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