Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

failure to compile variadic template function

$
0
0

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.


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>