https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70810

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Here is a simplified version of your code which gives an error using GCC, Clang
and Intel icc:

template<typename T>
  T declval();

template<typename... T>
  struct function {
    template<typename F, typename = decltype(declval<F>()(declval<T>()...))>
      function(F) { }

    void operator()(T...) const { }
  };


template<typename ... Ts>
struct Invoker {
  void invoke(function<Ts ...> f, Ts ... args) {
    f(args ...);
  }
};

template<typename ... Ts>
void invoke(function<Ts ...> f, Ts ... args) {
  f(args ...);
}

struct string {
  string(const char*) { }
};

void foo(string, int) {
}

int main() {
  Invoker<string, int> invoker;
  invoker.invoke(foo, "a", 1); // ok
  invoke<string, int>(foo, "a", 1); // fail
}

Reply via email to