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;
}
Run Code Online (Sandbox Code Playgroud)
这段代码用gcc8.1编译每个标准选项(c ++ 11,c ++ 14,c ++ 17),但clang trunk不用c ++ 17(虽然用c ++ 14一切都很好) ).
消息错误是:
test.cpp:23:49: error: ambiguous …Run Code Online (Sandbox Code Playgroud)