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

[Bug report] Compiler error for nested template parameter deduction

Daniel_A_1
Beginner
461 Views

Dear all,

a minimal example of the code I was trying to compile is

 #include <type_traits>
 
 template <bool... Values> struct BoolStorage;
 
 template <bool... Values>
 struct all_true
 {
   static constexpr bool value = std::is_same<BoolStorage<Values..., true>,
                                              BoolStorage<true, Values...>>::value;
 };
 
 template <bool... Values>
 struct enable_if_all : std::enable_if<all_true<Values...>::value> {};
 
 template <int dim>
 class FiniteElement
 {};
 
 template <int dim>
 class FESystem
 {
   public:
   template <class... FEPairs,
                      typename = typename enable_if_all<(std::is_same<typename std::decay<FEPairs>::type,
                                                                                           FiniteElement<dim>*>::value)...
                                                                                       >::type>
   FESystem(FEPairs &&... fe_pairs)
   {}
 };
 
 int main()
 {
   FiniteElement<2> fe;
   FESystem<2> fe_system(&fe, &fe);
 }

This should be C++11 compliant but I get the following errors with ICC18:

test_fe_system_constructor.cc(34): error: no instance of constructor "FESystem<dim>::FESystem [with dim=2]" matches the argument list
            argument types are: (FiniteElement<2> *, FiniteElement<2> *)
    FESystem<2> fe_system(&fe, &fe);
                          ^
test_fe_system_constructor.cc(20): note: this candidate was rejected because mismatch in count of arguments
  class FESystem
        ^
test_fe_system_constructor.cc(20): note: this candidate was rejected because mismatch in count of arguments
  class FESystem
        ^
test_fe_system_constructor.cc(27): note: this candidate was rejected because at least one template argument could not be deduced
    FESystem(FEPairs &&... fe_pairs)
    ^

compilation aborted for test_fe_system_constructor.cc (code 2)

Best,

Daniel

0 Kudos
3 Replies
Viet_H_Intel
Moderator
461 Views

Thanks for reporting a problem and provided a test case. I will report it to our developer.

Regards,

Viet Hoang

0 Kudos
Viet_H_Intel
Moderator
461 Views

Hi Daniel,

I filed a bug report: #CMPLRS-46357

Regards,

Viet Hoang

0 Kudos
Daniel_A_1
Beginner
461 Views
This is fixed in the ICC19 beta. Best, Daniel
0 Kudos
Reply