Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Bug: legitimate code with variadic templates and variadic template aliases leads to an error.

$
0
0

Hi,

I've got an issue with the following code:

In test.cpp

    template <typename... Types>
    struct Variadic1 {};

    template <typename... Types>
    using MakeVariadic1 = Variadic1<Types...>;

    template <typename... Types>
    struct Variadic2 {};

    template <typename... Types>
    using MakeVariadic2 = Variadic2<MakeVariadic1<Types...>>;

    template <typename... Types>
    MakeVariadic2<Types...> test(Types...)
    {
        return MakeVariadic2<Types...>();
    }

    int main()
    {
        test(1);
    }

Command line and output:

 ~/tmp$ ~/soft/intel/system_studio_2015.2.050/bin/ia32/icpc -std=c++11 test.cpp -o test
test.cpp(21): error: template instantiation resulted in unexpected function type of "MakeVariadic2<int> (int)" (the meaning of a name may have changed since the template declaration -- the type of the template is "MakeVariadic2<Types...> (Types...)")
      test(1);
             ^
          detected during instantiation of "test" based on template argument <int> at line 21

compilation aborted for test.cpp (code 2)

~/tmp$ ~/soft/intel/system_studio_2015.2.050/bin/ia32/icpc --version
icpc (ICC) 15.0.0 20150121
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

Note that Clang (3.4.1) and GCC (4.9.1) compile this code without errors.

Mikhail.


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>