Nick Mertin
Nick Mertin

Reputation: 1209

Error C1001: An internal error has occurred in the compiler

I have a virtual function inside a C++ templated task, and when it is compiled in Visual Studio 2015 (I have tried all combinations of Debug/Release and x86/x64), it consistently fails with compiler error C1001 on the following line of code:

e_Ty *d(new e_Ty[l]);

Where e_Ty is the template parameter of the class. This error only occurs when I use the template class with e_Ty set to std::pair<const int &, int &>. Is there a legitimate reason why this should not work, or is this a bug in MSVC?


EDIT

Notes:

Upvotes: 0

Views: 1867

Answers (2)

user2827968
user2827968

Reputation:

It's worth seeing if it's related to: C++11 constexpr causes compiler's internal error (C1001)

If there is a constexpr involved, VS2015 and VS2017 compilers have been reported to crash when used with template code.

Upvotes: 0

Cheers and hth. - Alf
Cheers and hth. - Alf

Reputation: 145239

An internal compiler error, an ICE, is always a bug.

Please report it via Microsoft Connect.


The code in question,

e_Ty *d(new e_Ty[l]);

may or may not be correct depending on l, whether appropriate headers have been included, and so on. There's too little context to say. is invalid for e_Ty as a std::pair of references, because references need to be initialized, as noted by T.C.. But that doesn't matter for an ICE.

Upvotes: 4

Related Questions