Compile error when using variadic template alias as a function return type

Compile error when using variadic template alias as a function return type

The following code:

template<typename ...Args> class X {};
template<typename ...Args> using Alias = X<Args...>;
 
template<typename ...Args>
Alias<Args...> func ()
{
    return Alias<Args...>();
}
 
int main ()
{
    auto x = func();
}

generates this error:

test.cpp(12): error: template instantiation resulted in unexpected function type of "Alias<> ()" (
the meaning of a name may have changed since the template declaration -- the type of the template is
 "Alias<Args...> ()")
        auto x = func();
                       ^
          detected during instantiation of "func" at line 11

when compiled with: icl /c /Qstd=c++11 test.cpp

It compiles fine in other compilers such as VS2013.

I'm using ICL version 14.0.1.139.

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.

 

Yes this does look like a bug. I have recorded this in our internal bug tracking database as DPD200250256.

Thank you for bringing it to our attention and for the nice small reproducer!

Judy

Laisser un commentaire

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