eric_niebler added a comment.
I just ran into this problem while trying to get range-v3 working on clang-3.6.
This `is_function` implementation //probably// instantiates fewer templates
than the version currently shipping with libc++. Disclaimer: I haven't tested
it exhaustively yet.
template<int I>
struct priority_tag
: priority_tag<I - 1>
{};
template<>
struct priority_tag<0>
{};
// Function types here:
template<typename T>
char (&is_function_impl_(priority_tag<0>))[1];
// Array types here:
template<typename T, typename = decltype((*(T*)0)[0])>
char (&is_function_impl_(priority_tag<1>))[2];
// Anything that can be returned from a function here (including
// void and reference types):
template<typename T, typename = T(*)()>
char (&is_function_impl_(priority_tag<2>))[3];
// Classes and unions (including abstract types) here:
template<typename T, typename = int T::*>
char (&is_function_impl_(priority_tag<3>))[4];
template <typename T>
struct is_function
: integral_constant<bool, sizeof(is_function_impl_<T>(priority_tag<3>{}))
== 1>
{};
https://reviews.llvm.org/D7573
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits