Bug Report: Incorrect expansion of variadic lists of constants

Bug Report: Incorrect expansion of variadic lists of constants

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

The following code:

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...};

...when used as...

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

...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-->

2 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

 

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

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui