[PATCH] [libc++] Fix PR20084 - std::is_function<void() const> failed.

Eric Fiselier eric at efcs.ca
Wed Feb 11 18:18:20 PST 2015


Add an explanation of the patch to the description and address richards inline comments.


================
Comment at: include/type_traits:434-438
@@ -433,4 +433,7 @@
+struct __dummy_type {};
 template <class _Tp> char  __test(_Tp*);
+template <class _Tp> char __test(__dummy_type);
 template <class _Tp> __two __test(...);
-template <class _Tp> _Tp&  __source();
+template <class _Tp> _Tp&  __source(int);
+template <class _Tp> __dummy_type __source(long);
 }
----------------
rsmith wrote:
> Makes sense to me ;-) Though I'd use `__source(...)` as a more "canonical" way of writing a less-preferred overload, as we do in the declaration of `__test`.
> 
> We'll use the `__dummy_type` path for both cv-/ref-qualified function types and for `void`, but it looks like we're handling the `void` case in `__libcpp_is_function`, so that's OK.
Why is it that you can't form a reference to a cv/ref qualified function type? Could you point me to the standard. Thanks for the review!

http://reviews.llvm.org/D7573

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list