Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Bug Report: Incorrect expansion of variadic lists of constants

Chris_G_8
Beginner
240 Views

Using Intel C++ Compiler v14.0 (latest as of the date on this post).

The following code:

[cpp]

template<typename uint_t, uint_t ...sig_values>
struct static_uint_array
{
    static const uint_t values[sizeof...(sig_values)];
};

template<typename uint_t, uint_t ...sig_values>
const uint_t static_uint_array<uint_t,sig_values...>::values[
    sizeof...(sig_values)
    ] = {sig_values...};

[/cpp]

...when used as...

[cpp]

uint32_t value = static_uint_array<uint32_t,0,1,2,3,4,5>::values[0];

[/cpp]

...produces this error:

*snip* expected a "}"

1> ] = {sig_values...};"

Where the caret is pointing to the ellipses.

Removing the ellipses allows the code to compile, however the element list is then expanded in reverse order (that is, "value" in the example above would be 5).

<!--break-->

0 Kudos
1 Reply
Judith_W_Intel
Employee
240 Views

 

I can reproduce this problem (using the /Qstd=c++11 switch) on Windows, it works as expected with our Linux compiler.

I have submitted a defect report for this in our bug tracking database as DPD200248043. Thank you for bringing this to our attention.

Judy

0 Kudos
Reply