Question

The following code compiles well with MinGW-gcc-4.8.2 g++ test.cpp -std=c++11:

// test.cpp
#include <iostream>

class Test
{
public:
    int a[10] = {};
};

int main()
{
    Test c;
    std::cout << c.a[0];

    return 0;
}

However, when I use msvc2013 with cl test.cpp /EHsc, it gives me (sorry I don't have an English version, but you can tell from the error no.):

test.cpp
test.cpp(6) : fatal error C1001: 编译器中发生内部错误。
(编译器文件“f:\dd\vctools\compiler\cxxfe\sl\p1\c\convert.cpp”,第 9608 行)
 要解决此问题,请尝试简化或更改上面所列位置附近的程序。
请选择 Visual C++
“帮助”菜单上的“技术支持”命令,或打开技术支持帮助文件来获得详细信息。

No correct solution

OTHER TIPS

As it is said on Microsoft Developers Network, this message come out because of compiling/building optimizations, so you can try to remove this optimizations.

The compiler cannot generate correct code for a construct, probably due to the combination of an expression and an optimization option. Try removing one or more optimization options and recompiling the function containing the line indicated in the error message.

You can probably fix the problem by removing one or more optimization options. To determine which option is at fault, remove options one at a time and recompile until the error message goes away. The options most commonly responsible are /Og, /Oi, and /Oa. Once you determine which option is responsible, you can disable it using the optimize pragma around the function where the error occurs and continue to use the option for the rest of the module.

As they say here, you can use the /P switch to obtain more information about the compiler itnernal errors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top