Xen*_*ate 7 c++ visual-c++ visual-studio-2013
我想我可能在VS2013附带的MSVC++编译器中发现了编译器错误,但这是一个我无法确定的简单情况.再加上我还在学习C++的事实,我想在提交任何内容之前先问这里; 因为老实说,我很确定这只是我做错了导致一个不寻常的错误信息.
无论如何,我把问题减少到一个小的测试文件:
#include <string>
#include <iostream>
std::wstring cstr_to_wstring(const char* cString) {
std::string temp = cString;
return { temp.begin(), temp.end() };
}
int main() {
std::cout << cstr_to_wstring("Hi").c_str();
}
Run Code Online (Sandbox Code Playgroud)
当我尝试编译时,我收到以下错误:
1>d:\documents\projects\compilerbugtest\compilerbugtest\compilerbugtest.cpp(6): fatal error C1001: An internal error has occurred in the compiler.
1> (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 227)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
Run Code Online (Sandbox Code Playgroud)
要解决这个问题,我可以在第六行指定类型,这样:
return { temp.begin(), temp.end() };
变
return std::wstring { temp.begin(), temp.end() };
.
这真的是一个编译器错误吗?谢谢.
是的,这是编译器中的一个错误.无论代码是否格式良好,所有编译器崩溃都是编译器错误.11月在Microsoft Connect上报告了此特定错误:
在这个bug中,Xiang报告说我们已经为下一个主要版本的编译器解决了这个问题(我已经验证了你的代码使用最新的内部版本编译).与此同时,建议的解决方法是执行您已完成的操作并在return语句中命名类型.
归档时间: |
|
查看次数: |
2371 次 |
最近记录: |