https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90314

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |8.3.0, 9.0
   Target Milestone|---                         |10.0
            Summary|clang gives error about     |[10 Regression] clang gives
                   |exception specification in  |error about exception
                   |declaration not matching    |specification in
                   |definition after change in  |declaration not matching
                   |move.h                      |definition after change in
                   |                            |move.h
      Known to fail|                            |10.0

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This would fix it:

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
diff --git a/libstdc++-v3/include/bits/move.h
b/libstdc++-v3/include/bits/move.h
index 996078cfbce..7271e273e8e 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -183,8 +183,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     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>)


The downside is a new warning with -Wsystem-headers -Wpedantic:

/home/jwakely/gcc/10/include/c++/10.0.0/x86_64-pc-linux-gnu/bits/c++config.h:167:32:
warning: anonymous variadic macros were introduced in C++11 [-Wvariadic-macros]
  167 | #  define _GLIBCXX_NOEXCEPT_IF(...)
      |                                ^~~

But we already have such a warning elsewhere anyway:

/home/jwakely/gcc/10/include/c++/10.0.0/bits/concept_check.h:48:37: warning:
anonymous variadic macros were introduced in C++11 [-Wvariadic-macros]
   48 | #define __glibcxx_function_requires(...)
      |                                     ^~~

So I think we can live with the warning.

Reply via email to