- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I ran into a problem with the following code, which compiles fine with gcc and clang, but fails with icc 18.0.1:
struct S { template< typename... Ts > auto access( ) -> int { return 1; } template< typename... Ts > auto operator()( Ts&&... ) -> decltype( access< Ts... >() ) { return access< Ts... >(); } }; struct A {}; struct B {}; int main() { S s; s( A(), B() ); }
Based on the types A and B the operator() of s shall call the access method of s. In my real world example the return value of access depends on the given template arguments, so I am using decltype to figure it out. However this does not work although it should or does the standard state something different and gcc and clang are just more friendly?
The error from the Intel compiler is:
test.cpp(24): error: no instance of function template "S::operator()" matches the argument list argument types are: (A, B) object type is: S s( A(), B() ); ^ test.cpp(11): note: this candidate was rejected because at least one template argument could not be deduced auto operator()( Ts&&... ) ^ compilation aborted for test.cpp (code 2)
Best regards,
Alexander Matthes
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Alexander,
Thanks for reporting this issue. I'll submit a bug and have it fixed in the next update.
Regards,
Viet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Alexander,
I've filed CMPLRS-49623 to track this bug.
Thanks,
Viet
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page