template <typename Foo, Foo Part>
struct TSelect {};
enum What {
The
};
template <typename Foo>
struct AnotherOneSelector {
static constexpr Foo Id = Foo::The;
};
template <typename Foo, typename SelectPartType>
struct THelper;
template <typename Foo>
struct THelper<Foo, TSelect<Foo, AnotherOneSelector<Foo>::Id>> {};
template <typename Foo, Foo PartId>
struct THelper<Foo, TSelect<Foo, PartId>> {};
int main() {
THelper<What, TSelect<What, What::The>> t;
}
This code compiles with gcc8.1 with each of the standard option (c++11, c++14, c++17), but clang trunk does not with c++17 (although with c++14 everything is fine).
Message error is:
test.cpp:23:49: error: ambiguous partial specializations of 'THelper<What, TSelect<What, The> >'
THelper<What, TSelect<What, What::The>> t;
^
test.cpp:17:12: note: partial specialization matches [with Foo = What]
struct THelper<Foo, TSelect<Foo, AnotherOneSelector<Foo>::Id>> {};
^
test.cpp:20:12: note: partial specialization matches [with Foo = What, PartId = The]
struct THelper<Foo, TSelect<Foo, PartId>> {};
^
1 error generated.
Which compiler is correct? I haven't seen any changes in template specialization in C++17.