- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes this definitely looks like a bug and I can reproduce it with our latest development compiler. I have entered this in our internal bug tracking database as DPD200368349.
Thanks for reporting it and for the concise example!
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We are still working on this one.
In the meantime the workaround is to not use the template alias in the return type for test(), i.e. change it the code inside #ifdef OK:
template <typename... Types>
#ifdef OK
Variadic2<Variadic1<Types...>>
#else
MakeVariadic2<Types...>
#endif
test(Types...)
instead of:
MakeVariadic2<Types...> test(Types...)
Judy

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page