From: Jonathan Wakely Date: Tue, 10 Dec 2019 16:15:59 +0000 (+0000) Subject: libstdc++: Define __cpp_lib_constexpr_complex macro X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=393283b8efaba009ce57a78fa658f55fbf262551;p=gcc.git 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 --- 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 + * 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 and . (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 #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 +// . + +// { dg-options "-std=gnu++2a" } +// { dg-do preprocess { target c++2a } } + +#include + +#ifndef __cpp_lib_constexpr_complex +# error "Feature test macro for constexpr complex is missing in " +#elif __cpp_lib_constexpr_complex < 201711L +# error "Feature test macro for constexpr complex has wrong value in " +#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 +// . + +// { dg-options "-std=gnu++2a" } +// { dg-do preprocess { target c++2a } } + +#include + +#ifndef __cpp_lib_constexpr_complex +# error "Feature test macro for constexpr complex is missing in " +#elif __cpp_lib_constexpr_complex < 201711L +# error "Feature test macro for constexpr complex has wrong value in " +#endif