Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
7568 Discussions

Bug report: icpc fe can't handle fold expressions with `using` clause used in SFINAE context

gnaggnoyil
Beginner
466 Views

The following code is accepted under gcc 8, gcc 10, clang 10 with `-std=c++17`, and msvc 19.27 with `/std:c++17`:

 

#include <type_traits>

template <typename ...Ts>
using all_of = std::bool_constant<(Ts::value && ...)>;

template <typename T>
struct bar : std::true_type{};

template <typename ...Ts,
        typename = std::enable_if_t<all_of<bar<Ts>...>::value>>
void foo(Ts &&...){}

int main(){
        foo(0, 0, 0, 0);
        return 0;
}

 

And possibly any other release of those compilers would accept it too.

Linux64 icc 19.0.1, 21.1.8 and 21.1.9 with flags `-std=c++17` on the other hand rejects this code:

test1.cpp(14): error: no instance of function template "foo" matches the argument list
            argument types are: (int, int, int, int)
        foo(0, 0, 0, 0);
        ^
test1.cpp(11): note: this candidate was rejected because at least one template argument could not be deduced
  void foo(Ts &&...){}
       ^

compilation aborted for test1.cpp (code 2)

 

(And I think other versions of icc would probably have the same bug too)

Labels (2)
0 Kudos
3 Replies
AbhishekD_Intel
Moderator
434 Views

Hi,

 

Thanks for reaching out to us.

We tried your code and we are able to reproduce this issue. So we are forwarding this issue to the concerned team as it seems like a bug with the ICPC compiler.

 

 

Warm Regards,

Abhishek

 

Viet_H_Intel
Moderator
423 Views

I've reported this issue to our FE team.

Thanks,


Viet_H_Intel
Moderator
214 Views

This issue is fixed in oneAPI2021.2.

$ icpc -V

Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.2.0 Build 20210228_000000


I am going to close this thread.


Reply