[gcc(refs/vendors/ibm/heads/gcc-9-branch)] libstdc++: Define __cpp_lib_constexpr_complex macro

Peter Bergner bergner@gcc.gnu.org
Fri Sep 4 19:05:36 GMT 2020


https://gcc.gnu.org/g:7ddb714f4e950c0a2621a333d139891d0648bf83

commit 7ddb714f4e950c0a2621a333d139891d0648bf83
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Apr 23 17:14:09 2020 +0100

    libstdc++: Define __cpp_lib_constexpr_complex macro
    
    This is LWG issue 3349.
    
    Backport from mainline
    2019-12-10  Jonathan Wakely  <jwakely@redhat.com>
    
            * include/std/complex (__cpp_lib_constexpr_complex): Define.
            * include/std/version (__cpp_lib_constexpr_complex): Likewise.
            * testsuite/26_numerics/complex/1.cc: New test.
            * testsuite/26_numerics/complex/2.cc: New test.

Diff:
---
 libstdc++-v3/ChangeLog                          |  8 ++++++++
 libstdc++-v3/include/std/complex                |  4 ++++
 libstdc++-v3/include/std/version                |  1 +
 libstdc++-v3/testsuite/26_numerics/complex/1.cc | 27 +++++++++++++++++++++++++
 libstdc++-v3/testsuite/26_numerics/complex/2.cc | 27 +++++++++++++++++++++++++
 5 files changed, 67 insertions(+)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index bd472ccf912..3dff28d4b74 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,13 @@
 2020-04-23  Jonathan Wakely  <jwakely@redhat.com>
 
+	Backport from mainline
+	2019-12-10  Jonathan Wakely  <jwakely@redhat.com>
+
+	* include/std/complex (__cpp_lib_constexpr_complex): Define.
+	* include/std/version (__cpp_lib_constexpr_complex): Likewise.
+	* testsuite/26_numerics/complex/1.cc: New test.
+	* testsuite/26_numerics/complex/2.cc: New test.
+
 	Backport from mainline
 	2019-11-05  Jonathan Wakely  <jwakely@redhat.com>
 
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index 45450e8ca01..d156d3249a7 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -47,6 +47,10 @@
 // Get rid of a macro possibly defined in <complex.h>
 #undef complex
 
+#if __cplusplus > 201703L
+# define __cpp_lib_constexpr_complex 201711L
+#endif
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index 4f4062629fb..3be53fd9ac5 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -176,6 +176,7 @@
 
 #if _GLIBCXX_HOSTED
 #define __cpp_lib_bind_front 201907L
+#define __cpp_lib_constexpr_complex 201711L
 #define __cpp_lib_erase_if 202002L
 #define __cpp_lib_interpolate 201902L
 #define __cpp_lib_list_remove_return_type 201806L
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/1.cc b/libstdc++-v3/testsuite/26_numerics/complex/1.cc
new file mode 100644
index 00000000000..e3e6c22c5f4
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex/1.cc
@@ -0,0 +1,27 @@
+// Copyright (C) 2019 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++2a" }
+// { dg-do preprocess { target c++2a } }
+
+#include <complex>
+
+#ifndef __cpp_lib_constexpr_complex
+# error "Feature test macro for constexpr complex is missing in <complex>"
+#elif __cpp_lib_constexpr_complex < 201711L
+# error "Feature test macro for constexpr complex has wrong value in <complex>"
+#endif
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/2.cc b/libstdc++-v3/testsuite/26_numerics/complex/2.cc
new file mode 100644
index 00000000000..e84e92c62ae
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex/2.cc
@@ -0,0 +1,27 @@
+// Copyright (C) 2019 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++2a" }
+// { dg-do preprocess { target c++2a } }
+
+#include <version>
+
+#ifndef __cpp_lib_constexpr_complex
+# error "Feature test macro for constexpr complex is missing in <version>"
+#elif __cpp_lib_constexpr_complex < 201711L
+# error "Feature test macro for constexpr complex has wrong value in <version>"
+#endif


More information about the Libstdc++-cvs mailing list