]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Define __cpp_lib_constexpr_complex macro
authorJonathan Wakely <jwakely@redhat.com>
Thu, 23 Apr 2020 16:14:09 +0000 (17:14 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 23 Apr 2020 17:54:44 +0000 (18:54 +0100)
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.

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/complex
libstdc++-v3/include/std/version
libstdc++-v3/testsuite/26_numerics/complex/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/complex/2.cc [new file with mode: 0644]

index bd472ccf9124401033899c02c7272555ec21a4ee..3dff28d4b744e20758aec87c36b616666288d6c1 100644 (file)
@@ -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>
 
index 45450e8ca013930cdda5c08371566addf23be0db..d156d3249a7a73a88f4473e6ed3f2ff4fdb328a4 100644 (file)
 // 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
index 4f4062629fbfc5a74885df4811c7ec0f266ec329..3be53fd9ac5766a9107dcd7b9d595db9e7802eb4 100644 (file)
 
 #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 (file)
index 0000000..e3e6c22
--- /dev/null
@@ -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 (file)
index 0000000..e84e92c
--- /dev/null
@@ -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