i've read that scoped template specalization is allowed in C++17

suports it:
-clang starting with release 7
-MSVC starting with VS2017(i don't know what revision)

no support:
-gcc(trunk)

-latest Intel


https://gcc.godbolt.org/z/1GET6v

------
enum class E{ A, B };

struct Ta{ int x; };
struct Tb{ float y; };

struct Mapper
{
    template<typename Type>  struct type_to_enum{};

    template<> // <-- FAILS
    struct type_to_enum<Ta>
    {
        static constexpr auto value = E::A;
    };

    template <> // <-- Fails
    struct type_to_enum<Tb>
    {
        static constexpr auto value = E::B;
    };
};

-------

Reply via email to