This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why doesn't <ctgmath> include <ccomplex>?


On 17/09/14 16:55 +0200, Marc Glisse wrote:
On Wed, 17 Sep 2014, Jonathan Wakely wrote:

Our <ctgmath> only includes <cmath>, not <ccomplex> as required by
26.8 [c.math] paragraph 1.

Is that intentional?

Probably not (I don't know), but if you change it, please include <complex> instead of the nonsensical (and equivalent) <ccomplex>. I hope we can deprecate that one at some point, I would even be in favor of adding a #warning to it asking why on earth the user decided to include it.

Done, with the attached patch. Tested x86_64-linux, committed to
trunk.

commit 0e4f9dd61315305e717fce692b63927430de8062
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Oct 2 12:22:14 2014 +0100

    	* include/c_global/ctgmath: Include <complex>.
    	* testsuite/26_numerics/headers/ctgmath/complex.cc: New.
    	* doc/xml/manual/status_cxx2011.xml: Update.
    	* doc/html/manual/status.html: Regenerate.

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
index b986cad..5b36556 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
@@ -2049,13 +2049,10 @@ particular release.
       <entry/>
     </row>
     <row>
-      <?dbhtml bgcolor="#B0B0B0" ?>
       <entry>26.8</entry>
       <entry>C Library</entry>
-      <entry>Partial</entry>
-      <entry><code>&lt;ctgmath&gt;</code> doesn't include
-        <code>&lt;ccomplex&gt;</code>
-      </entry>
+      <entry>Y</entry>
+      <entry/>
     </row>
     <row>
       <entry>
diff --git a/libstdc++-v3/include/c_global/ctgmath b/libstdc++-v3/include/c_global/ctgmath
index df36263..e05ede5 100644
--- a/libstdc++-v3/include/c_global/ctgmath
+++ b/libstdc++-v3/include/c_global/ctgmath
@@ -35,6 +35,7 @@
 #  include <bits/c++0x_warning.h>
 #else
 #  include <cmath>
+#  include <complex>
 #endif
 
 #endif 
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/complex.cc b/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/complex.cc
new file mode 100644
index 0000000..160dc1b
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/complex.cc
@@ -0,0 +1,23 @@
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-do compile }
+
+#include <ctgmath>
+
+std::complex<double> d;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]