diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-05-02 21:23:38 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2019-05-02 21:23:38 +0000 |
commit | 0341830a4ef33088223e35e12df0217a5672e9a4 (patch) | |
tree | c67f2a13583af00c07f97f877c822185815fe380 /libstdc++-v3/include/bits/c++config | |
parent | eceebb570f6284ed20e8718c17bf57a6aa3f79a8 (diff) |
PR libstdc++/90314 fix non-equivalent declarations of std::swap
In order to use the _GLIBCXX_NOEXCEPT_IF macro for an expression
containing commas I enclosed it in parentheses, so the preprocessor
wouldn't treat it as two arguments to the function-like macro. Clang
gives an error because now the noexcept-specifier noexcept((C)) is not
equivalent to the noexcept(C) one on the declaration of swap in
<type_traits>.
Instead of requiring extra parentheses around the expression, redefine
_GLIBCXX_NOEXCEPT_IF as a variadic macro (even though supporting that in
C++98 is a GNU extension).
PR libstdc++/90314
* include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Use variadic macro.
* include/bits/move.h (swap): Remove extra parentheses.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@270827 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/c++config')
-rw-r--r-- | libstdc++-v3/include/bits/c++config | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 5016f4853de..ca1557af564 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -157,12 +157,12 @@ #ifndef _GLIBCXX_NOEXCEPT # if __cplusplus >= 201103L # define _GLIBCXX_NOEXCEPT noexcept -# define _GLIBCXX_NOEXCEPT_IF(_COND) noexcept(_COND) +# define _GLIBCXX_NOEXCEPT_IF(...) noexcept(__VA_ARGS__) # define _GLIBCXX_USE_NOEXCEPT noexcept # define _GLIBCXX_THROW(_EXC) # else # define _GLIBCXX_NOEXCEPT -# define _GLIBCXX_NOEXCEPT_IF(_COND) +# define _GLIBCXX_NOEXCEPT_IF(...) # define _GLIBCXX_USE_NOEXCEPT throw() # define _GLIBCXX_THROW(_EXC) throw(_EXC) # endif |