MSVC Compiler Template Sizeof...() not working

73 Views Asked by At

The msvc v19X does not like using the sizeof...() operator in template code.

#include<cstddef>

template <typename ValueType, size_t...Indices>
void experiment (ValueType (&theArray)[sizeof...(Indices)])
{
   //code removed
}

The above code works fine in Linux, but I need it working in Windows as well.

The failure is with the "sizeof...(Indices)" code. If for example you remove the sizeof...(Indices) and replace it with a number such as 4, it compiles just fine.

I have verified this in Visual Studio and with Compiler Explorer (https://godbolt.org/).

Using Compiler Explorer, I have tried the Clang compiler and it passes as well.

No version of the X64 or X86 msvc v.19x works.

Does anyone have any suggestions. Thank you in advance. Damon

0

There are 0 best solutions below