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报告在这里
正如评论中所提到的,它似乎是一个MSVC问题.使用Clang和-std = c ++ 11快速编译它,没有问题.
| 归档时间: |
|
| 查看次数: |
1163 次 |
| 最近记录: |