summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-12-10 16:15:59 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2019-12-10 16:15:59 +0000
commit393283b8efaba009ce57a78fa658f55fbf262551 (patch)
tree329584510b113a20333a80ddb4c8ac6ca0358b35 /libstdc++-v3
parentb65bdd27fd96afa3074308de18d6a54c67ba6aef (diff)
downloadgcc-393283b8efaba009ce57a78fa658f55fbf262551.tar.gz
libstdc++: Define __cpp_lib_constexpr_complex macro
This is LWG issue 3349. * 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. From-SVN: r279172
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/std/complex4
-rw-r--r--libstdc++-v3/include/std/version1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/1.cc27
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/2.cc27
5 files changed, 64 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 38c844117f4..017160231c7 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,10 @@
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.
+
* include/std/span: Do not include <tuple> and <utility>.
(tuple_size, tuple_element): Declare.
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 8e08dc99049..e55a092eb89 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -180,6 +180,7 @@
#if _GLIBCXX_HOSTED
#define __cpp_lib_bind_front 201907L
#define __cpp_lib_constexpr_algorithms 201806L
+#define __cpp_lib_constexpr_complex 201711L
#define __cpp_lib_constexpr_dynamic_alloc 201907L
#define __cpp_lib_constexpr_invoke 201907L
#define __cpp_lib_erase_if 201900L
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