使用继承构造函数时VS2015内部编译器错误

ima*_*ett 9 c++ visual-c++ c++11 internal-compiler-error visual-studio-2015

这是一个10行的C++ 11程序,从我正在编写的程序中大大简化:

template <typename T> class Base { public:
    template <typename S> Base(S x) {}
};
template <typename T> class Child : public Base<T> { public:
    using Base<T>::Base;
};
template <> class Child<int> : public Base<int> { public:
    using Base<int>::Base;
};

int main()
{
    Child<int> child(8.0f);
}
Run Code Online (Sandbox Code Playgroud)

MSVC 2015产出:

1>------ Build started: Project: MyProject, Configuration: Debug Win32 ------
1>  filename.cpp
1>path\to\filename(10): fatal error C1001: An internal error has occurred in the compiler.
1>  (compiler file 'msc1.cpp', line 1393)
1>   To work around this problem, try simplifying or changing the program near the locations listed above.
1>  Please choose the Technical Support command on the Visual C++
1>   Help menu, or open the Technical Support help file for more information
Run Code Online (Sandbox Code Playgroud)

NB MSVC 2015对继承构造函数的支持是该版本的新增功能.

我已经提交了一个关于此的错误报告,因为至少编译器不应该崩溃.但是,我可以确认这是正确的C++用法/解决方法吗?

Bug报告在这里

Nib*_*bor 6

正如评论中所提到的,它似乎是一个MSVC问题.使用Clang和-std = c ++ 11快速编译它,没有问题.

  • 这是一件可怕的事情.在其他编译器中检查它不是任何证据.只有标准报价可以真正备份它是正确的.此外,MSVC ICE意味着这里有一些*MSVC问题,但这并不能使代码正确或不正确. (5认同)
  • @Creris:你错过了这一点.它可能在C++中形成错误_and_在编译器中触发ICE.OP正在询问是否是这种情况(事实并非如此). (4认同)
  • ICE始终是编译器错误.如果C++格式不正确,它应该触发编译错误或警告,而不是ICE.提交连接上的错误.从命令-ilne,一定要运行``cl -Bv``来捕获确切的版本号 (3认同)
  • @Creris:是的,我们都知道.这不是这个问题的意思.OP只是询问该程序是否格式错误.而已. (2认同)