[libcxx] r219998 - [libcxx] Fix SFINAE in <cmath>. Patch from K-Ballo.

Eric Fiselier eric at efcs.ca
Thu Oct 16 17:31:48 PDT 2014


Author: ericwf
Date: Thu Oct 16 19:31:47 2014
New Revision: 219998

URL: http://llvm.org/viewvc/llvm-project?rev=219998&view=rev
Log:
[libcxx] Fix SFINAE in <cmath>. Patch from K-Ballo.

Delay instantiation of `__numeric_type` within <cmath>, 
don't instantiate it when the `is_arithmetic` conditions do not hold as it causes
errors with user-defined types with ambiguous conversions. Fixes PR21083.

Modified:
    libcxx/trunk/include/cmath
    libcxx/trunk/include/type_traits
    libcxx/trunk/test/numerics/c.math/cmath.pass.cpp

Modified: libcxx/trunk/include/cmath
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cmath?rev=219998&r1=219997&r2=219998&view=diff
==============================================================================
--- libcxx/trunk/include/cmath (original)
+++ libcxx/trunk/include/cmath Thu Oct 16 19:31:47 2014
@@ -727,11 +727,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
 {
@@ -849,11 +849,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
@@ -952,11 +952,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
@@ -1114,11 +1114,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
@@ -1192,11 +1192,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
@@ -1216,12 +1216,12 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2, class _A3>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value &&
     is_arithmetic<_A3>::value,
-    typename __promote<_A1, _A2, _A3>::type
+    __promote<_A1, _A2, _A3>
 >::type
 fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
 {
@@ -1242,11 +1242,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
@@ -1266,11 +1266,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
@@ -1290,11 +1290,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
@@ -1459,11 +1459,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
@@ -1496,11 +1496,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
@@ -1520,11 +1520,11 @@ inline _LIBCPP_INLINE_VISIBILITY long do
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
 remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
 {

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=219998&r1=219997&r2=219998&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Thu Oct 16 19:31:47 2014
@@ -218,6 +218,9 @@ template <class _If, class _Then>
 template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
 #endif
 
+template <bool, class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;};
+
 template <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {};
 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef _Tp type;};
 
@@ -1208,43 +1211,46 @@ template <class _A1, class _A2 = void, c
           bool = __numeric_type<_A1>::value &&
                  __numeric_type<_A2>::value &&
                  __numeric_type<_A3>::value>
-class __promote
+class __promote_imp
 {
+public:
     static const bool value = false;
 };
 
 template <class _A1, class _A2, class _A3>
-class __promote<_A1, _A2, _A3, true>
+class __promote_imp<_A1, _A2, _A3, true>
 {
 private:
-    typedef typename __promote<_A1>::type __type1;
-    typedef typename __promote<_A2>::type __type2;
-    typedef typename __promote<_A3>::type __type3;
+    typedef typename __promote_imp<_A1>::type __type1;
+    typedef typename __promote_imp<_A2>::type __type2;
+    typedef typename __promote_imp<_A3>::type __type3;
 public:
     typedef decltype(__type1() + __type2() + __type3()) type;
     static const bool value = true;
 };
 
 template <class _A1, class _A2>
-class __promote<_A1, _A2, void, true>
+class __promote_imp<_A1, _A2, void, true>
 {
 private:
-    typedef typename __promote<_A1>::type __type1;
-    typedef typename __promote<_A2>::type __type2;
+    typedef typename __promote_imp<_A1>::type __type1;
+    typedef typename __promote_imp<_A2>::type __type2;
 public:
     typedef decltype(__type1() + __type2()) type;
     static const bool value = true;
 };
 
 template <class _A1>
-class __promote<_A1, void, void, true>
+class __promote_imp<_A1, void, void, true>
 {
 public:
     typedef typename __numeric_type<_A1>::type type;
     static const bool value = true;
-    static const bool __does_not_throw = _NOEXCEPT_OR_FALSE(static_cast<type>(declval<_A1>()));
 };
 
+template <class _A1, class _A2 = void, class _A3 = void>
+class __promote : public __promote_imp<_A1, _A2, _A3> {};
+
 #ifdef _LIBCPP_STORE_AS_OPTIMIZATION
 
 // __transform

Modified: libcxx/trunk/test/numerics/c.math/cmath.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/numerics/c.math/cmath.pass.cpp?rev=219998&r1=219997&r2=219998&view=diff
==============================================================================
--- libcxx/trunk/test/numerics/c.math/cmath.pass.cpp (original)
+++ libcxx/trunk/test/numerics/c.math/cmath.pass.cpp Thu Oct 16 19:31:47 2014
@@ -24,11 +24,88 @@ struct Value {
     operator T () { return T(N); }
 };
 
+// See PR21083
+// Ambiguous is a user-defined type that defines its own overloads of cmath
+// functions. When the std overloads are candidates too (by using or adl),
+// they should not interfere.
+struct Ambiguous : std::true_type { // ADL
+    operator float () { return 0.f; }
+    operator double () { return 0.; }
+};
+Ambiguous abs(Ambiguous){ return Ambiguous(); }
+Ambiguous acos(Ambiguous){ return Ambiguous(); }
+Ambiguous asin(Ambiguous){ return Ambiguous(); }
+Ambiguous atan(Ambiguous){ return Ambiguous(); }
+Ambiguous atan2(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous ceil(Ambiguous){ return Ambiguous(); }
+Ambiguous cos(Ambiguous){ return Ambiguous(); }
+Ambiguous cosh(Ambiguous){ return Ambiguous(); }
+Ambiguous exp(Ambiguous){ return Ambiguous(); }
+Ambiguous fabs(Ambiguous){ return Ambiguous(); }
+Ambiguous floor(Ambiguous){ return Ambiguous(); }
+Ambiguous fmod(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous frexp(Ambiguous, int*){ return Ambiguous(); }
+Ambiguous ldexp(Ambiguous, int){ return Ambiguous(); }
+Ambiguous log(Ambiguous){ return Ambiguous(); }
+Ambiguous log10(Ambiguous){ return Ambiguous(); }
+Ambiguous modf(Ambiguous, Ambiguous*){ return Ambiguous(); }
+Ambiguous pow(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous sin(Ambiguous){ return Ambiguous(); }
+Ambiguous sinh(Ambiguous){ return Ambiguous(); }
+Ambiguous sqrt(Ambiguous){ return Ambiguous(); }
+Ambiguous tan(Ambiguous){ return Ambiguous(); }
+Ambiguous tanh(Ambiguous){ return Ambiguous(); }
+Ambiguous signbit(Ambiguous){ return Ambiguous(); }
+Ambiguous fpclassify(Ambiguous){ return Ambiguous(); }
+Ambiguous isfinite(Ambiguous){ return Ambiguous(); }
+Ambiguous isnormal(Ambiguous){ return Ambiguous(); }
+Ambiguous isgreater(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isgreaterequal(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isless(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous islessequal(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous islessgreater(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isunordered(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous acosh(Ambiguous){ return Ambiguous(); }
+Ambiguous asinh(Ambiguous){ return Ambiguous(); }
+Ambiguous atanh(Ambiguous){ return Ambiguous(); }
+Ambiguous cbrt(Ambiguous){ return Ambiguous(); }
+Ambiguous copysign(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous erf(Ambiguous){ return Ambiguous(); }
+Ambiguous erfc(Ambiguous){ return Ambiguous(); }
+Ambiguous exp2(Ambiguous){ return Ambiguous(); }
+Ambiguous expm1(Ambiguous){ return Ambiguous(); }
+Ambiguous fdim(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fma(Ambiguous, Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fmax(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fmin(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous hypot(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous ilogb(Ambiguous){ return Ambiguous(); }
+Ambiguous lgamma(Ambiguous){ return Ambiguous(); }
+Ambiguous llrint(Ambiguous){ return Ambiguous(); }
+Ambiguous llround(Ambiguous){ return Ambiguous(); }
+Ambiguous log1p(Ambiguous){ return Ambiguous(); }
+Ambiguous log2(Ambiguous){ return Ambiguous(); }
+Ambiguous logb(Ambiguous){ return Ambiguous(); }
+Ambiguous lrint(Ambiguous){ return Ambiguous(); }
+Ambiguous lround(Ambiguous){ return Ambiguous(); }
+Ambiguous nearbyint(Ambiguous){ return Ambiguous(); }
+Ambiguous nextafter(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous nexttoward(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous remainder(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous remquo(Ambiguous, Ambiguous, int*){ return Ambiguous(); }
+Ambiguous rint(Ambiguous){ return Ambiguous(); }
+Ambiguous round(Ambiguous){ return Ambiguous(); }
+Ambiguous scalbln(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous scalbn(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous tgamma(Ambiguous){ return Ambiguous(); }
+Ambiguous trunc(Ambiguous){ return Ambiguous(); }
+
 void test_abs()
 {
     static_assert((std::is_same<decltype(std::abs((float)0)), float>::value), "");
     static_assert((std::is_same<decltype(std::abs((double)0)), double>::value), "");
     static_assert((std::is_same<decltype(std::abs((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(abs(Ambiguous())), Ambiguous>::value), "");
     assert(std::abs(-1.) == 1);
 }
 
@@ -47,6 +124,7 @@ void test_acos()
     static_assert((std::is_same<decltype(std::acos((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::acosf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::acosl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(acos(Ambiguous())), Ambiguous>::value), "");
     assert(std::acos(1) == 0);
 }
 
@@ -65,6 +143,7 @@ void test_asin()
     static_assert((std::is_same<decltype(std::asin((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::asinf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::asinl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(asin(Ambiguous())), Ambiguous>::value), "");
     assert(std::asin(0) == 0);
 }
 
@@ -83,6 +162,7 @@ void test_atan()
     static_assert((std::is_same<decltype(std::atan((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::atanf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::atanl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(atan(Ambiguous())), Ambiguous>::value), "");
     assert(std::atan(0) == 0);
 }
 
@@ -105,6 +185,7 @@ void test_atan2()
     static_assert((std::is_same<decltype(std::atan2f(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::atan2l(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::atan2((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(atan2(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::atan2(0,1) == 0);
 }
 
@@ -123,6 +204,7 @@ void test_ceil()
     static_assert((std::is_same<decltype(std::ceil((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::ceilf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::ceill(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(ceil(Ambiguous())), Ambiguous>::value), "");
     assert(std::ceil(0) == 0);
 }
 
@@ -141,6 +223,7 @@ void test_cos()
     static_assert((std::is_same<decltype(std::cos((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::cosf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::cosl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(cos(Ambiguous())), Ambiguous>::value), "");
     assert(std::cos(0) == 1);
 }
 
@@ -159,6 +242,7 @@ void test_cosh()
     static_assert((std::is_same<decltype(std::cosh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::coshf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::coshl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(cosh(Ambiguous())), Ambiguous>::value), "");
     assert(std::cosh(0) == 1);
 }
 
@@ -177,6 +261,7 @@ void test_exp()
     static_assert((std::is_same<decltype(std::exp((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::expf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::expl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(exp(Ambiguous())), Ambiguous>::value), "");
     assert(std::exp(0) == 1);
 }
 
@@ -195,6 +280,7 @@ void test_fabs()
     static_assert((std::is_same<decltype(std::fabs((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::fabsf(0.0f)), float>::value), "");
     static_assert((std::is_same<decltype(std::fabsl(0.0L)), long double>::value), "");
+    static_assert((std::is_same<decltype(fabs(Ambiguous())), Ambiguous>::value), "");
     assert(std::fabs(-1) == 1);
 }
 
@@ -213,6 +299,7 @@ void test_floor()
     static_assert((std::is_same<decltype(std::floor((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::floorf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::floorl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(floor(Ambiguous())), Ambiguous>::value), "");
     assert(std::floor(1) == 1);
 }
 
@@ -235,6 +322,7 @@ void test_fmod()
     static_assert((std::is_same<decltype(std::fmodf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::fmodl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::fmod((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fmod(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::fmod(1.5,1) == .5);
 }
 
@@ -254,6 +342,7 @@ void test_frexp()
     static_assert((std::is_same<decltype(std::frexp((long double)0, &ip)), long double>::value), "");
     static_assert((std::is_same<decltype(std::frexpf(0, &ip)), float>::value), "");
     static_assert((std::is_same<decltype(std::frexpl(0, &ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(frexp(Ambiguous(), &ip)), Ambiguous>::value), "");
     assert(std::frexp(0, &ip) == 0);
 }
 
@@ -273,6 +362,7 @@ void test_ldexp()
     static_assert((std::is_same<decltype(std::ldexp((long double)0, ip)), long double>::value), "");
     static_assert((std::is_same<decltype(std::ldexpf(0, ip)), float>::value), "");
     static_assert((std::is_same<decltype(std::ldexpl(0, ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(ldexp(Ambiguous(), ip)), Ambiguous>::value), "");
     assert(std::ldexp(1, ip) == 2);
 }
 
@@ -291,6 +381,7 @@ void test_log()
     static_assert((std::is_same<decltype(std::log((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::logf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::logl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log(Ambiguous())), Ambiguous>::value), "");
     assert(std::log(1) == 0);
 }
 
@@ -309,6 +400,7 @@ void test_log10()
     static_assert((std::is_same<decltype(std::log10((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::log10f(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::log10l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log10(Ambiguous())), Ambiguous>::value), "");
     assert(std::log10(1) == 0);
 }
 
@@ -319,6 +411,7 @@ void test_modf()
     static_assert((std::is_same<decltype(std::modf((long double)0, (long double*)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::modff(0, (float*)0)), float>::value), "");
     static_assert((std::is_same<decltype(std::modfl(0, (long double*)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(modf(Ambiguous(), (Ambiguous*)0)), Ambiguous>::value), "");
     double i;
     assert(std::modf(1., &i) == 0);
 }
@@ -345,6 +438,7 @@ void test_pow()
 //     static_assert((std::is_same<decltype(std::pow(Value<int>(), (int)0)), double>::value), "");
 //     static_assert((std::is_same<decltype(std::pow(Value<long double>(), (float)0)), long double>::value), "");
 //     static_assert((std::is_same<decltype(std::pow((float) 0, Value<float>())), float>::value), "");
+    static_assert((std::is_same<decltype(pow(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::pow(1,1) == 1);
 //     assert(std::pow(Value<int,1>(), Value<float,1>())  == 1);
 //     assert(std::pow(1.0f, Value<double,1>()) == 1);
@@ -367,6 +461,7 @@ void test_sin()
     static_assert((std::is_same<decltype(std::sin((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::sinf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::sinl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(sin(Ambiguous())), Ambiguous>::value), "");
     assert(std::sin(0) == 0);
 }
 
@@ -385,6 +480,7 @@ void test_sinh()
     static_assert((std::is_same<decltype(std::sinh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::sinhf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::sinhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(sinh(Ambiguous())), Ambiguous>::value), "");
     assert(std::sinh(0) == 0);
 }
 
@@ -403,6 +499,7 @@ void test_sqrt()
     static_assert((std::is_same<decltype(std::sqrt((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::sqrtf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::sqrtl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(sqrt(Ambiguous())), Ambiguous>::value), "");
     assert(std::sqrt(4) == 2);
 }
 
@@ -421,6 +518,7 @@ void test_tan()
     static_assert((std::is_same<decltype(std::tan((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::tanf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::tanl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(tan(Ambiguous())), Ambiguous>::value), "");
     assert(std::tan(0) == 0);
 }
 
@@ -439,6 +537,7 @@ void test_tanh()
     static_assert((std::is_same<decltype(std::tanh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::tanhf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::tanhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(tanh(Ambiguous())), Ambiguous>::value), "");
     assert(std::tanh(0) == 0);
 }
 
@@ -451,6 +550,7 @@ void test_signbit()
     static_assert((std::is_same<decltype(std::signbit((double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::signbit(0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::signbit((long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(signbit(Ambiguous())), Ambiguous>::value), "");
     assert(std::signbit(-1.0) == true);
 }
 
@@ -463,6 +563,7 @@ void test_fpclassify()
     static_assert((std::is_same<decltype(std::fpclassify((double)0)), int>::value), "");
     static_assert((std::is_same<decltype(std::fpclassify(0)), int>::value), "");
     static_assert((std::is_same<decltype(std::fpclassify((long double)0)), int>::value), "");
+    static_assert((std::is_same<decltype(fpclassify(Ambiguous())), Ambiguous>::value), "");
     assert(std::fpclassify(-1.0) == FP_NORMAL);
 }
 
@@ -475,6 +576,7 @@ void test_isfinite()
     static_assert((std::is_same<decltype(std::isfinite((double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isfinite(0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isfinite((long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isfinite(Ambiguous())), Ambiguous>::value), "");
     assert(std::isfinite(-1.0) == true);
 }
 
@@ -487,6 +589,7 @@ void test_isnormal()
     static_assert((std::is_same<decltype(std::isnormal((double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isnormal(0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isnormal((long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isnormal(Ambiguous())), Ambiguous>::value), "");
     assert(std::isnormal(-1.0) == true);
 }
 
@@ -505,6 +608,7 @@ void test_isgreater()
     static_assert((std::is_same<decltype(std::isgreater((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isgreater((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isgreater((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isgreater(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::isgreater(-1.0, 0.F) == false);
 }
 
@@ -523,6 +627,7 @@ void test_isgreaterequal()
     static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isgreaterequal(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::isgreaterequal(-1.0, 0.F) == false);
 }
 
@@ -541,6 +646,7 @@ void test_isless()
     static_assert((std::is_same<decltype(std::isless((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isless((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isless((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isless(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::isless(-1.0, 0.F) == true);
 }
 
@@ -559,6 +665,7 @@ void test_islessequal()
     static_assert((std::is_same<decltype(std::islessequal((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::islessequal((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::islessequal((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(islessequal(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::islessequal(-1.0, 0.F) == true);
 }
 
@@ -577,6 +684,7 @@ void test_islessgreater()
     static_assert((std::is_same<decltype(std::islessgreater((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::islessgreater((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::islessgreater((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(islessgreater(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::islessgreater(-1.0, 0.F) == true);
 }
 
@@ -595,6 +703,7 @@ void test_isunordered()
     static_assert((std::is_same<decltype(std::isunordered((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isunordered((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isunordered((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isunordered(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::isunordered(-1.0, 0.F) == false);
 }
 
@@ -613,6 +722,7 @@ void test_acosh()
     static_assert((std::is_same<decltype(std::acosh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::acoshf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::acoshl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(acosh(Ambiguous())), Ambiguous>::value), "");
     assert(std::acosh(1) == 0);
 }
 
@@ -631,6 +741,7 @@ void test_asinh()
     static_assert((std::is_same<decltype(std::asinh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::asinhf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::asinhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(asinh(Ambiguous())), Ambiguous>::value), "");
     assert(std::asinh(0) == 0);
 }
 
@@ -649,6 +760,7 @@ void test_atanh()
     static_assert((std::is_same<decltype(std::atanh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::atanhf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::atanhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(atanh(Ambiguous())), Ambiguous>::value), "");
     assert(std::atanh(0) == 0);
 }
 
@@ -667,6 +779,7 @@ void test_cbrt()
     static_assert((std::is_same<decltype(std::cbrt((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::cbrtf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::cbrtl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(cbrt(Ambiguous())), Ambiguous>::value), "");
     assert(std::cbrt(1) == 1);
 }
 
@@ -689,6 +802,7 @@ void test_copysign()
     static_assert((std::is_same<decltype(std::copysignf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::copysignl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::copysign((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(copysign(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::copysign(1,1) == 1);
 }
 
@@ -707,6 +821,7 @@ void test_erf()
     static_assert((std::is_same<decltype(std::erf((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::erff(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::erfl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(erf(Ambiguous())), Ambiguous>::value), "");
     assert(std::erf(0) == 0);
 }
 
@@ -725,6 +840,7 @@ void test_erfc()
     static_assert((std::is_same<decltype(std::erfc((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::erfcf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::erfcl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(erfc(Ambiguous())), Ambiguous>::value), "");
     assert(std::erfc(0) == 1);
 }
 
@@ -743,6 +859,7 @@ void test_exp2()
     static_assert((std::is_same<decltype(std::exp2((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::exp2f(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::exp2l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(exp2(Ambiguous())), Ambiguous>::value), "");
     assert(std::exp2(1) == 2);
 }
 
@@ -761,6 +878,7 @@ void test_expm1()
     static_assert((std::is_same<decltype(std::expm1((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::expm1f(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::expm1l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(expm1(Ambiguous())), Ambiguous>::value), "");
     assert(std::expm1(0) == 0);
 }
 
@@ -783,6 +901,7 @@ void test_fdim()
     static_assert((std::is_same<decltype(std::fdimf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::fdiml(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::fdim((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fdim(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::fdim(1,0) == 1);
 }
 
@@ -820,6 +939,7 @@ void test_fma()
 
     static_assert((std::is_same<decltype(std::fmaf(0,0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::fmal(0,0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(fma(Ambiguous(), Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::fma(1,1,1) == 2);
 }
 
@@ -842,6 +962,7 @@ void test_fmax()
     static_assert((std::is_same<decltype(std::fmaxf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::fmaxl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::fmax((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fmax(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::fmax(1,0) == 1);
 }
 
@@ -864,6 +985,7 @@ void test_fmin()
     static_assert((std::is_same<decltype(std::fminf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::fminl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::fmin((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fmin(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::fmin(1,0) == 0);
 }
 
@@ -886,6 +1008,7 @@ void test_hypot()
     static_assert((std::is_same<decltype(std::hypotf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::hypotl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::hypot((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(hypot(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::hypot(3,4) == 5);
 }
 
@@ -904,6 +1027,7 @@ void test_ilogb()
     static_assert((std::is_same<decltype(std::ilogb((long double)0)), int>::value), "");
     static_assert((std::is_same<decltype(std::ilogbf(0)), int>::value), "");
     static_assert((std::is_same<decltype(std::ilogbl(0)), int>::value), "");
+    static_assert((std::is_same<decltype(ilogb(Ambiguous())), Ambiguous>::value), "");
     assert(std::ilogb(1) == 0);
 }
 
@@ -922,6 +1046,7 @@ void test_lgamma()
     static_assert((std::is_same<decltype(std::lgamma((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::lgammaf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::lgammal(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(lgamma(Ambiguous())), Ambiguous>::value), "");
     assert(std::lgamma(1) == 0);
 }
 
@@ -940,6 +1065,7 @@ void test_llrint()
     static_assert((std::is_same<decltype(std::llrint((long double)0)), long long>::value), "");
     static_assert((std::is_same<decltype(std::llrintf(0)), long long>::value), "");
     static_assert((std::is_same<decltype(std::llrintl(0)), long long>::value), "");
+    static_assert((std::is_same<decltype(llrint(Ambiguous())), Ambiguous>::value), "");
     assert(std::llrint(1) == 1LL);
 }
 
@@ -958,6 +1084,7 @@ void test_llround()
     static_assert((std::is_same<decltype(std::llround((long double)0)), long long>::value), "");
     static_assert((std::is_same<decltype(std::llroundf(0)), long long>::value), "");
     static_assert((std::is_same<decltype(std::llroundl(0)), long long>::value), "");
+    static_assert((std::is_same<decltype(llround(Ambiguous())), Ambiguous>::value), "");
     assert(std::llround(1) == 1LL);
 }
 
@@ -976,6 +1103,7 @@ void test_log1p()
     static_assert((std::is_same<decltype(std::log1p((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::log1pf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::log1pl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log1p(Ambiguous())), Ambiguous>::value), "");
     assert(std::log1p(0) == 0);
 }
 
@@ -994,6 +1122,7 @@ void test_log2()
     static_assert((std::is_same<decltype(std::log2((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::log2f(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::log2l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log2(Ambiguous())), Ambiguous>::value), "");
     assert(std::log2(1) == 0);
 }
 
@@ -1012,6 +1141,7 @@ void test_logb()
     static_assert((std::is_same<decltype(std::logb((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::logbf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::logbl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(logb(Ambiguous())), Ambiguous>::value), "");
     assert(std::logb(1) == 0);
 }
 
@@ -1030,6 +1160,7 @@ void test_lrint()
     static_assert((std::is_same<decltype(std::lrint((long double)0)), long>::value), "");
     static_assert((std::is_same<decltype(std::lrintf(0)), long>::value), "");
     static_assert((std::is_same<decltype(std::lrintl(0)), long>::value), "");
+    static_assert((std::is_same<decltype(lrint(Ambiguous())), Ambiguous>::value), "");
     assert(std::lrint(1) == 1L);
 }
 
@@ -1048,6 +1179,7 @@ void test_lround()
     static_assert((std::is_same<decltype(std::lround((long double)0)), long>::value), "");
     static_assert((std::is_same<decltype(std::lroundf(0)), long>::value), "");
     static_assert((std::is_same<decltype(std::lroundl(0)), long>::value), "");
+    static_assert((std::is_same<decltype(lround(Ambiguous())), Ambiguous>::value), "");
     assert(std::lround(1) == 1L);
 }
 
@@ -1073,6 +1205,7 @@ void test_nearbyint()
     static_assert((std::is_same<decltype(std::nearbyint((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::nearbyintf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::nearbyintl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(nearbyint(Ambiguous())), Ambiguous>::value), "");
     assert(std::nearbyint(1) == 1);
 }
 
@@ -1095,6 +1228,7 @@ void test_nextafter()
     static_assert((std::is_same<decltype(std::nextafterf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::nextafterl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::nextafter((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(nextafter(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
 }
 
@@ -1113,6 +1247,7 @@ void test_nexttoward()
     static_assert((std::is_same<decltype(std::nexttoward((long double)0, (long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::nexttowardf(0, (long double)0)), float>::value), "");
     static_assert((std::is_same<decltype(std::nexttowardl(0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(nexttoward(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
 }
 
@@ -1135,6 +1270,7 @@ void test_remainder()
     static_assert((std::is_same<decltype(std::remainderf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::remainderl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::remainder((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(remainder(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::remainder(0.5,1) == 0.5);
 }
 
@@ -1158,6 +1294,7 @@ void test_remquo()
     static_assert((std::is_same<decltype(std::remquof(0,0, &ip)), float>::value), "");
     static_assert((std::is_same<decltype(std::remquol(0,0, &ip)), long double>::value), "");
     static_assert((std::is_same<decltype(std::remquo((int)0, (int)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(remquo(Ambiguous(), Ambiguous(), &ip)), Ambiguous>::value), "");
     assert(std::remquo(0.5,1, &ip) == 0.5);
 }
 
@@ -1176,6 +1313,7 @@ void test_rint()
     static_assert((std::is_same<decltype(std::rint((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::rintf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::rintl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(rint(Ambiguous())), Ambiguous>::value), "");
     assert(std::rint(1) == 1);
 }
 
@@ -1194,6 +1332,7 @@ void test_round()
     static_assert((std::is_same<decltype(std::round((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::roundf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::roundl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(round(Ambiguous())), Ambiguous>::value), "");
     assert(std::round(1) == 1);
 }
 
@@ -1212,6 +1351,7 @@ void test_scalbln()
     static_assert((std::is_same<decltype(std::scalbln((long double)0, (long)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::scalblnf(0, (long)0)), float>::value), "");
     static_assert((std::is_same<decltype(std::scalblnl(0, (long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(scalbln(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::scalbln(1, 1) == 2);
 }
 
@@ -1230,6 +1370,7 @@ void test_scalbn()
     static_assert((std::is_same<decltype(std::scalbn((long double)0, (int)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::scalbnf(0, (int)0)), float>::value), "");
     static_assert((std::is_same<decltype(std::scalbnl(0, (int)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(scalbn(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::scalbn(1, 1) == 2);
 }
 
@@ -1248,6 +1389,7 @@ void test_tgamma()
     static_assert((std::is_same<decltype(std::tgamma((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::tgammaf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::tgammal(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(tgamma(Ambiguous())), Ambiguous>::value), "");
     assert(std::tgamma(1) == 1);
 }
 
@@ -1266,6 +1408,7 @@ void test_trunc()
     static_assert((std::is_same<decltype(std::trunc((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::truncf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::truncl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(trunc(Ambiguous())), Ambiguous>::value), "");
     assert(std::trunc(1) == 1);
 }
 





More information about the cfe-commits mailing list