[PATCH] [libcxx] Support UDTs convertible to arithmetic types in <cmath>

Agustín Bergé kaballo86 at hotmail.com
Fri Oct 31 10:19:32 PDT 2014


This patch reverts the incorporation of `__lazy_enable_if`, as this is a more general solution. It implements `__numeric_type` in a SFINAE-friendly fashion, which will flag ambiguously convertible UDTs (as well as other soft errors) as non-numeric types.

================
Comment at: include/type_traits:1180
@@ -1182,2 +1179,3 @@
 
-template <class _Tp>
+float __numeric_test(float);
+double __numeric_test(char);
----------------
mclow.lists wrote:
> Is there a reason that these functions are no longer static members?
> 
They are needed for the well-formed specialization of `__numeric_type`.

================
Comment at: include/type_traits:1246
@@ -1243,3 +1245,3 @@
 template <class _A1>
-class __promote_imp<_A1, void, void, true>
+struct __promote_imp<_A1, void, void, true>
 {
----------------
This change to `struct` was not intended. Will revert to `class`.

http://reviews.llvm.org/D5942






More information about the cfe-commits mailing list