[PATCH] [libc++] Fix PR20084 - std::is_function<void() const> failed.
Richard Smith
richard at metafoo.co.uk
Wed Feb 11 18:32:52 PST 2015
================
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);
}
----------------
EricWF wrote:
> 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!
There are no values of those types; they exist only so that member functions can be declared and pointer-to-member types can be written. The relevant rule is in [dcl.fct](8.3.5)/6 in the current draft.
http://reviews.llvm.org/D7573
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list