From: Jonathan Wakely Date: Thu, 23 Apr 2020 16:14:09 +0000 (+0100) Subject: libstdc++: Define __cpp_lib_constexpr_complex macro X-Git-Tag: misc/first-auto-changelog-9~95 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ddb714f4e950c0a2621a333d139891d0648bf83;p=thirdparty%2Fgcc.git libstdc++: Define __cpp_lib_constexpr_complex macro This is LWG issue 3349. Backport from mainline 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. --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index bd472ccf9124..3dff28d4b744 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,13 @@ 2020-04-23 Jonathan Wakely + Backport from mainline + 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. + Backport from mainline 2019-11-05 Jonathan Wakely diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 45450e8ca013..d156d3249a7a 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 4f4062629fbf..3be53fd9ac57 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 000000000000..e3e6c22c5f4a --- /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 000000000000..e84e92c62ae1 --- /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