Bug 103232

Summary: scoped template specalization is not supported (not with C+17 nor C++20)
Product: gcc Reporter: dennis luehring <dl.soluz>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: ppalka
Priority: P3    
Version: 11.2.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

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
https://gcc.godbolt.org/z/jG8f6Phjc
clang 7
https://gcc.godbolt.org/z/c4Md5Yh1x
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 ***