Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Intel 16.0.4 compiler error for std::enable_if

Tarun_A_
Beginner
462 Views

Hi,

   template <typename T, decltype(T::a)* = nullptr>
   bool DoCheck1(T t) { return false; }

   template <typename T, decltype(T::b)* = nullptr>
   bool DoCheck1(T t) { return false; }

   template <typename T, typename std::enable_if<true, decltype(T::a)>* = nullptr>
   bool DoCheck2(T t) { return false; }

   template <typename T, typename std::enable_if<true, decltype(T::b)>* = nullptr>
   bool DoCheck2(T t) { return false; }

Both above versions should have same behaviour, but icc 16.0.4 on Linux gives the following compilation error for DoCheck2 -

error: redefinition of default argument
     template <typename T, typename std::enable_if<true, decltype(T::b)>* = nullptr>

Is this expected behaviour or a bug?

Regards,

Tarun

0 Kudos
4 Replies
Judith_W_Intel
Employee
462 Views

 

This is fixed in 17.0 and 18.0.

 

0 Kudos
Tarun_A_
Beginner
462 Views

Hi Judith, thanks for the reply.

I don't have >= 16.0.4 at the moment, but i tried it in Compiler Explorer (https://godbolt.org/) with icc 17.0, gives me the same error.

 

 

0 Kudos
Judith_W_Intel
Employee
462 Views

 

The 17.0 compiler that is being used by this tool  is the initial release of 17.0 (date of 20160721).

This bug was fixed in Feb 2017 so it should be fixed in the most recent 17.0 update.

Judy

0 Kudos
Tarun_A_
Beginner
462 Views

Thanks Judy.
 

0 Kudos
Reply