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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
G++ allowed it because the mismatch was in a system header. If you use
-Wsystem-headers then GCC 9.1 gives a warning about it:

/xhome/jwakely/gcc/9.1.0/include/c++/9.1.0/variant: In instantiation of 'class
std::variant<A, B>':
var.cc:14:44:   required from here
/xhome/jwakely/gcc/9.1.0/include/c++/9.1.0/variant:1559:34: warning:
declaration of 'template<long unsigned int _Np, class _Vp> constexpr
decltype(auto) std::__detail::__variant::__get(_Vp&&)' has a different
exception specifier [-Wsystem-headers]
 1559 |  friend constexpr decltype(auto) __detail::__variant::__get(_Vp&& __v);
      |                                  ^~~~~~~~
/xhome/jwakely/gcc/9.1.0/include/c++/9.1.0/variant:263:5: note: from previous
declaration 'template<long unsigned int _Np, class _Variant> constexpr
decltype(auto) std::__detail::__variant::__get(_Variant&&) noexcept'
  263 |     __get(_Variant&& __v) noexcept
      |     ^~~~~


If you use -pedantic-errors then you get an error.

Reply via email to