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:
l
is a local variable that was declared (and assigned a value as a result of a function call) ahead of time.- I have tried using disabling optimization, using
auto
, and using assignment-style initialization, none of which worked. - Code compiles fine when
e_Ty
isint
.