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

[bugreport] Bug when defining method out of class

$
0
0

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++...


Viewing all articles
Browse latest Browse all 1616

Trending Articles



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