C++ 这是c++;17模板类型演绎MSVC中的一个bug?

C++ 这是c++;17模板类型演绎MSVC中的一个bug?,c++,c++17,C++,C++17,请参阅此代码-我将其简化为实际代码中的最小值: #include <type_traits> template<auto First, auto Last> class EnumIterator { static_assert(std::is_same<decltype(First), decltype(Last)>::value == true, "First and Last must be of the same enum cl

请参阅此代码-我将其简化为实际代码中的最小值:

#include <type_traits>

template<auto First, auto Last>
class EnumIterator
{
    static_assert(std::is_same<decltype(First), decltype(Last)>::value == true,
        "First and Last must be of the same enum class type");

public:
    using EnumType = decltype(First);
};

enum class E1 { e1_a, e1_b };
using E1_It = EnumIterator<E1::e1_a, E1::e1_b>;

enum class E2 { e2_a, e2_b };
using E2_It = EnumIterator<E2::e2_a, E2::e2_b>;

E2_It::EnumType e = E2::e2_a;
#包括
模板
类枚举迭代器
{
静态断言(std::is_same::value==true,
“第一个和最后一个必须是相同的枚举类类型”);
公众:
使用EnumType=decltype(第一个);
};
枚举类E1{E1_a,E1_b};
使用E1_It=枚举迭代器;
枚举类E2{E2_a,E2_b};
使用E2_It=枚举迭代器;
E2_It::EnumType=E2::E2_a;
在Visual Studio 2017上,lang设置为c++17编译失败,原因是:

error C2440: 'initializing': cannot convert from 'E2' to 'EnumIterator<E1::e1_a,E1::e1_b>::EnumType'
note: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
错误C2440:“正在初始化”:无法从“E2”转换为“EnumIterator::EnumType”
注意:转换为枚举类型需要显式转换(静态转换、C样式转换或函数样式转换)
我在wandbox.com上验证了同样的代码编译,它编译正常。 注意,使用E1_It用
注释掉该行,现在它用MSVC编译


我是否发现了一个编译器错误,或者我做了一些明显错误的事情?

我想是的。它似乎是用版本
19.20
及更高版本编译的。这种行为显然是错误的,请注意错误消息中的类型名称,我不知道为什么值得一提。