Hi there. The following C++11 code fails to compile correctly:
#include <utility> template <class F> struct foo { template <class... Args> auto operator()(Args &&... args) -> decltype(std::declval<F>()(std::forward<Args>(args)...)); }; template <class F> template <class... Args> auto foo<F>::operator()(Args &&... args) -> decltype(std::declval<F>()(std::forward<Args>(args)...)) { return F()(std::forward<Args>(args)...); } struct fun { int operator()(int) { return 0; } }; int main() { return foo<fun>()(1); }
I get no compilation error with clang++ or g++...