[Bug report] Compiler error for nested template parameter deduction

[Bug report] Compiler error for nested template parameter deduction

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

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

Regards,

Viet Hoang

Hi Daniel,

I filed a bug report: #CMPLRS-46357

Regards,

Viet Hoang

This is fixed in the ICC19 beta.

Best,
Daniel

Leave a Comment

Please sign in to add a comment. Not a member? Join today