complex (complex<float>::real, [...]): Declare as const member functions.
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 22 Apr 2013 14:37:34 +0000 (14:37 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 22 Apr 2013 14:37:34 +0000 (14:37 +0000)
2013-04-22  Paolo Carlini  <paolo.carlini@oracle.com>

N3669
* include/std/complex (complex<float>::real, complex<float>::imag,
complex<double>::real, complex<double>::imag,
complex<long double>::real, complex<long double>::imag): Declare
as const member functions.
* include/std/type_traits (integral_constant<>::operator value_type):
Likewise.

From-SVN: r198141

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/complex
libstdc++-v3/include/std/type_traits

index fdf739f7ff7239a1cfa9cf2941105ce2afccedae..ff956355d2e4127aa741478a3cd4a9b622859ae0 100644 (file)
@@ -1,3 +1,13 @@
+2013-04-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       N3669
+       * include/std/complex (complex<float>::real, complex<float>::imag,
+       complex<double>::real, complex<double>::imag,
+       complex<long double>::real, complex<long double>::imag): Declare
+       as const member functions.
+       * include/std/type_traits (integral_constant<>::operator value_type):
+       Likewise.
+
 2013-04-22  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR libstdc++/57010
index e426673993773a037e14d96e99c698980e88da6f..b31e8b18d71b21e7c75187c1f4820d28e2a25393 100644 (file)
@@ -1066,11 +1066,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       // DR 387. std::complex over-encapsulated.
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr float 
-      real() { return __real__ _M_value; }
+      real() const { return __real__ _M_value; }
 
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr float 
-      imag() { return __imag__ _M_value; }
+      imag() const { return __imag__ _M_value; }
 #else
       float& 
       real() { return __real__ _M_value; }
@@ -1217,11 +1217,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       // DR 387. std::complex over-encapsulated.
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr double 
-      real() { return __real__ _M_value; }
+      real() const { return __real__ _M_value; }
 
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr double 
-      imag() { return __imag__ _M_value; }
+      imag() const { return __imag__ _M_value; }
 #else
       double& 
       real() { return __real__ _M_value; }
@@ -1369,11 +1369,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       // DR 387. std::complex over-encapsulated.
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr long double 
-      real() { return __real__ _M_value; }
+      real() const { return __real__ _M_value; }
 
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr long double 
-      imag() { return __imag__ _M_value; }
+      imag() const { return __imag__ _M_value; }
 #else
       long double& 
       real() { return __real__ _M_value; }
index 488ffd9c180563460bbd6bd4195b9b1ff1ce7f9e..5bff0ab59591b7607974764959f1c665849ece51 100644 (file)
@@ -59,7 +59,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       static constexpr _Tp                  value = __v;
       typedef _Tp                           value_type;
       typedef integral_constant<_Tp, __v>   type;
-      constexpr operator value_type() { return value; }
+      constexpr operator value_type() const { return value; }
     };
   
   template<typename _Tp, _Tp __v>