[cfe-commits] [libcxx] r119710 - in /libcxx/trunk: include/complex include/random test/numerics/complex.number/cmplx.over/conj.pass.cpp test/numerics/complex.number/cmplx.over/proj.pass.cpp

Howard Hinnant hhinnant at apple.com
Thu Nov 18 09:34:49 PST 2010


Author: hhinnant
Date: Thu Nov 18 11:34:48 2010
New Revision: 119710

URL: http://llvm.org/viewvc/llvm-project?rev=119710&view=rev
Log:
LWG 1522

Modified:
    libcxx/trunk/include/complex
    libcxx/trunk/include/random
    libcxx/trunk/test/numerics/complex.number/cmplx.over/conj.pass.cpp
    libcxx/trunk/test/numerics/complex.number/cmplx.over/proj.pass.cpp

Modified: libcxx/trunk/include/complex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/complex?rev=119710&r1=119709&r2=119710&view=diff
==============================================================================
--- libcxx/trunk/include/complex (original)
+++ libcxx/trunk/include/complex Thu Nov 18 11:34:48 2010
@@ -191,17 +191,17 @@
 template<Integral T>      double norm(T);
                           float  norm(float);
 
-template<class T>      complex<T>  conj(const complex<T>&);
-                       long double conj(long double);
-                       double      conj(double);
-template<Integral T>   double      conj(T);
-                       float       conj(float);
-
-template<class T>    complex<T>  proj(const complex<T>&);
-                     long double proj(long double);
-                     double      proj(double);
-template<Integral T> double      proj(T);
-                     float       proj(float);
+template<class T>      complex<T>           conj(const complex<T>&);
+                       complex<long double> conj(long double);
+                       complex<double>      conj(double);
+template<Integral T>   complex<double>      conj(T);
+                       complex<float>       conj(float);
+
+template<class T>    complex<T>           proj(const complex<T>&);
+                     complex<long double> proj(long double);
+                     complex<double>      proj(double);
+template<Integral T> complex<double>      proj(T);
+                     complex<float>       proj(float);
 
 template<class T> complex<T> polar(const T&, const T& = 0);
 
@@ -980,17 +980,17 @@
 }
 
 inline _LIBCPP_INLINE_VISIBILITY
-long double
+complex<long double>
 conj(long double __re)
 {
-    return __re;
+    return complex<long double>(__re);
 }
 
 inline _LIBCPP_INLINE_VISIBILITY
-double
+complex<double>
 conj(double __re)
 {
-    return __re;
+    return complex<double>(__re);
 }
 
 template<class _Tp>
@@ -998,18 +998,18 @@
 typename enable_if
 <
     is_integral<_Tp>::value,
-    double
+    complex<double>
 >::type
 conj(_Tp __re)
 {
-    return __re;
+    return complex<double>(__re);
 }
 
 inline _LIBCPP_INLINE_VISIBILITY
-float
+complex<float>
 conj(float __re)
 {
-    return __re;
+    return complex<float>(__re);
 }
 
 // proj
@@ -1026,21 +1026,21 @@
 }
 
 inline _LIBCPP_INLINE_VISIBILITY
-long double
+complex<long double>
 proj(long double __re)
 {
     if (isinf(__re))
         __re = abs(__re);
-    return __re;
+    return complex<long double>(__re);
 }
 
 inline _LIBCPP_INLINE_VISIBILITY
-double
+complex<double>
 proj(double __re)
 {
     if (isinf(__re))
         __re = abs(__re);
-    return __re;
+    return complex<double>(__re);
 }
 
 template<class _Tp>
@@ -1048,20 +1048,20 @@
 typename enable_if
 <
     is_integral<_Tp>::value,
-    double
+    complex<double>
 >::type
 proj(_Tp __re)
 {
-    return __re;
+    return complex<double>(__re);
 }
 
 inline _LIBCPP_INLINE_VISIBILITY
-float
+complex<float>
 proj(float __re)
 {
     if (isinf(__re))
         __re = abs(__re);
-    return __re;
+    return complex<float>(__re);
 }
 
 // polar

Modified: libcxx/trunk/include/random
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/random?rev=119710&r1=119709&r2=119710&view=diff
==============================================================================
--- libcxx/trunk/include/random (original)
+++ libcxx/trunk/include/random Thu Nov 18 11:34:48 2010
@@ -1498,7 +1498,7 @@
                        UnaryOperation fw);
 
         vector<result_type> intervals() const;
-        vector<double> densities() const;
+        vector<result_type> densities() const;
 
         friend bool operator==(const param_type& x, const param_type& y);
         friend bool operator!=(const param_type& x, const param_type& y);
@@ -1525,7 +1525,7 @@
 
     // property functions
     vector<result_type> intervals() const;
-    vector<double> densities() const;
+    vector<result_type> densities() const;
 
     param_type param() const;
     void param(const param_type& parm);
@@ -1573,7 +1573,7 @@
                        UnaryOperation fw);
 
         vector<result_type> intervals() const;
-        vector<double> densities() const;
+        vector<result_type> densities() const;
 
         friend bool operator==(const param_type& x, const param_type& y);
         friend bool operator!=(const param_type& x, const param_type& y);
@@ -1603,7 +1603,7 @@
 
     // property functions
     vector<result_type> intervals() const;
-    vector<double> densities() const;
+    vector<result_type> densities() const;
 
     param_type param() const;
     void param(const param_type& parm);

Modified: libcxx/trunk/test/numerics/complex.number/cmplx.over/conj.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/numerics/complex.number/cmplx.over/conj.pass.cpp?rev=119710&r1=119709&r2=119710&view=diff
==============================================================================
--- libcxx/trunk/test/numerics/complex.number/cmplx.over/conj.pass.cpp (original)
+++ libcxx/trunk/test/numerics/complex.number/cmplx.over/conj.pass.cpp Thu Nov 18 11:34:48 2010
@@ -9,11 +9,11 @@
 
 // <complex>
 
-// template<class T>      complex<T>  conj(const complex<T>&);
-//                        long double conj(long double);
-//                        double      conj(double);
-// template<Integral T>   double      conj(T);
-//                        float       conj(float);
+// template<class T>      complex<T>           conj(const complex<T>&);
+//                        complex<long double> conj(long double);
+//                        complex<double>      conj(double);
+// template<Integral T>   complex<double>      conj(T);
+//                        complex<float>       conj(float);
 
 #include <complex>
 #include <type_traits>
@@ -25,7 +25,7 @@
 void
 test(T x, typename std::enable_if<std::is_integral<T>::value>::type* = 0)
 {
-    static_assert((std::is_same<decltype(std::conj(x)), double>::value), "");
+    static_assert((std::is_same<decltype(std::conj(x)), std::complex<double> >::value), "");
     assert(std::conj(x) == conj(std::complex<double>(x, 0)));
 }
 
@@ -33,7 +33,7 @@
 void
 test(T x, typename std::enable_if<std::is_floating_point<T>::value>::type* = 0)
 {
-    static_assert((std::is_same<decltype(std::conj(x)), T>::value), "");
+    static_assert((std::is_same<decltype(std::conj(x)), std::complex<T> >::value), "");
     assert(std::conj(x) == conj(std::complex<T>(x, 0)));
 }
 

Modified: libcxx/trunk/test/numerics/complex.number/cmplx.over/proj.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/numerics/complex.number/cmplx.over/proj.pass.cpp?rev=119710&r1=119709&r2=119710&view=diff
==============================================================================
--- libcxx/trunk/test/numerics/complex.number/cmplx.over/proj.pass.cpp (original)
+++ libcxx/trunk/test/numerics/complex.number/cmplx.over/proj.pass.cpp Thu Nov 18 11:34:48 2010
@@ -9,11 +9,11 @@
 
 // <complex>
 
-// template<class T>    complex<T>  proj(const complex<T>&);
-//                      long double proj(long double);
-//                      double      proj(double);
-// template<Integral T> double      proj(T);
-//                      float       proj(float);
+// template<class T>    complex<T>           proj(const complex<T>&);
+//                      complex<long double> proj(long double);
+//                      complex<double>      proj(double);
+// template<Integral T> complex<double>      proj(T);
+//                      complex<float>       proj(float);
 
 #include <complex>
 #include <type_traits>
@@ -25,7 +25,7 @@
 void
 test(T x, typename std::enable_if<std::is_integral<T>::value>::type* = 0)
 {
-    static_assert((std::is_same<decltype(std::proj(x)), double>::value), "");
+    static_assert((std::is_same<decltype(std::proj(x)), std::complex<double> >::value), "");
     assert(std::proj(x) == proj(std::complex<double>(x, 0)));
 }
 
@@ -33,7 +33,7 @@
 void
 test(T x, typename std::enable_if<std::is_floating_point<T>::value>::type* = 0)
 {
-    static_assert((std::is_same<decltype(std::proj(x)), T>::value), "");
+    static_assert((std::is_same<decltype(std::proj(x)), std::complex<T> >::value), "");
     assert(std::proj(x) == proj(std::complex<T>(x, 0)));
 }
 





More information about the cfe-commits mailing list