Bug 103232 - scoped template specalization is not supported (not with C+17 nor C++20)
Summary: scoped template specalization is not supported (not with C+17 nor C++20)
Status: RESOLVED DUPLICATE of bug 85282
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 11.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2021-11-14 14:06 UTC by dennis luehring
Modified: 2021-11-14 15:14 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description dennis luehring 2021-11-14 14:06:33 UTC
C++17 allows scoped template specalization - clang 7+ and VStudio 2017/2019 allow it - gcc 11.2 and trunk are not able to compile the sample

enum class Type{ Int, Float };

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

    template<> struct type_to_enum<int>{
         static constexpr auto value = Type::Int;
    template <> struct type_to_enum<float> {
        static constexpr auto value = Type::Float;
Comment 1 dennis luehring 2021-11-14 14:08:18 UTC
gcc 11.2
clang 7
Comment 2 Patrick Palka 2021-11-14 15:14:15 UTC
dup of PR85282, the plan is to implement this in GCC 12.

*** This bug has been marked as a duplicate of bug 85282 ***