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.
From-SVN: r270827
2019-05-02 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/90314
+ * include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Use variadic macro.
+ * include/bits/move.h (swap): Remove extra parentheses.
+
* include/experimental/bits/lfts_config.h: Improve doc markup.
* include/experimental/optional: Improve docs.
(_Has_addressof_mem, _Has_addressof_free, _Has_addressof)
#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
void
#endif
swap(_Tp& __a, _Tp& __b)
- _GLIBCXX_NOEXCEPT_IF((__and_<is_nothrow_move_constructible<_Tp>,
- is_nothrow_move_assignable<_Tp>>::value))
+ _GLIBCXX_NOEXCEPT_IF(__and_<is_nothrow_move_constructible<_Tp>,
+ is_nothrow_move_assignable<_Tp>>::value)
{
// concept requirements
__glibcxx_function_requires(_SGIAssignableConcept<_Tp>)