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

failure to compile variadic template function

Walter_D_
Beginner
161 Views

icc 15.0.0 fails to compile the following

#include <utility>

struct S {
  enum E {A,B};
  // convert run-time variable e to a compile-time variable
  template<template<E> class F, typename... Args>
  static auto Switch(E e, Args&&... args)
    -> decltype(F<A>::act(std::forward<Args>(args)...))
  {
    switch(e) {
    case A: return F<A>::act(std::forward<Args>(args)...);
    case B: return F<B>::act(std::forward<Args>(args)...);
    }
  }
};

template<S::E>
struct foo { static double act(double); };

double work(S::E e, double x)
{ return S::Switch<foo>(e,x); }

but fails with the error message "no instance of the function template "S::Switch" matches the argument list". This is obviously wrong.

0 Kudos
3 Replies
Amanda_S_Intel
Employee
161 Views

Thanks for the test case. I can reproduce this error message with 15.0.2. This GNU compiler has no problem compiling this code. I'll update this thread with an internal tracking ID.

Amanda_S_Intel
Employee
161 Views

The internal tracking ID for this issue is DPD200366869.

Amanda_S_Intel
Employee
161 Views

I verified that this issue is fixed in the 16.0 Update 1 release, which will be available for download soon.

Reply