【发布时间】:2017-10-25 12:56:15
【问题描述】:
看看这个简单的sn-p:
enum class Enum1 { Value };
enum class Enum2 { Value };
template <auto> struct Foo;
template <> struct Foo<Enum1::Value> { };
template <> struct Foo<Enum2::Value> { };
Clang 编译这个,但 gcc-7.2 失败:
x.cpp:5:20: 错误:重新定义‘struct Foo’模板 结构 Foo { };
此错误消息似乎无效,因为在第 5 行写入了Enum2::Value。
哪个编译器是正确的?这是符合标准的代码吗?
【问题讨论】:
标签: c++ language-lawyer c++17