- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel C++ Compiler (icpc (ICC) 19.1.0.166 20191121) seems to mishandle “injected-class-name” as described in (C++ 2014 Standard draft: 14.6.1). The compiler seems to pass type-name instead of template-name as a template template argument when instantiating method/function template from within template class itself (see code below). This seems to violate second bullet-point (see https://en.cppreference.com/w/cpp/language/injected-class-name#In_class_template), which states that the injected-class-name is treated as a template-name of the class template itself when: "it is used as a template argument that corresponds to a template template parameter".
Therefore following code fails to compile ("Foo" in "Bar<Foo>()" call seems to be handled as "Bar<Foo<int> >()" instead as template-name itself):
template<typename T> class Foo { public: template<template<typename> class VT> void Bar() {} void Bar2() { Bar<Foo>(); } }; int main(int argc, char *argv[]) { Foo<int> foo; foo.Bar2(); return 0; }
This can be fixed as
template<typename T> class Foo { public: template<template<typename> class VT> void Bar() {} void Bar2() { Bar<::Foo>(); } }; int main(int argc, char *argv[]) { Foo<int> foo; foo.Bar2(); return 0; }
or by aliasing "Foo" template as in
template<typename TA> using FooAlias = Foo<TA>; ... Bar<FooAlias>(); ...
- Tags:
- Bug
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Filip,
Thanks for reporting this bug. It is reproducible at my end. I will escalate this issue to the concerned team,
--Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This will be fixed in the upcoming release.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This has been fixed in OneAPI tool kit. We will no longer respond to this thread.
If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.
Thanks,

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