[Bug c++/51501] [DR 1433] decltype over-agressive SFINAE

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 9 10:01:00 GMT 2014


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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #4)
> Reduced:
> 
> template <class T> T list(T x);
> 
> template <class H, class ...T>
> auto list(H h, T ...args) -> decltype(list(args...));
> 
> auto list3 = list(1, 2, 3);

Interestingly it works for (static or non-static) member functions:

struct X {
  template <class T> T list(T x);

  template <class H, class ...T>
  auto list(H h, T ...args) -> decltype(list(args...));
};

auto list3 = X{}.list(1, 2, 3);



More information about the Gcc-bugs mailing list