From: Jonathan Wakely Date: Fri, 10 May 2019 21:41:19 +0000 (+0100) Subject: PR libstdc++/90397 fix std::variant friend declarations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4b7a3ab82f1951b1ab808065cec829fecb27e206;p=gcc.git PR libstdc++/90397 fix std::variant friend declarations Clang diagnoses the inconsistent noexcept-specifier on the friend declaration of __get. Add it, and also on __get_storage. PR libstdc++/90397 * include/std/variant (_Variant_storage::_M_storage()) (_Variant_storage::_M_reset())) (_Variant_storage::_M_storage())): Add noexcept. (__get_storage): Likewise. (variant): Add noexcept to friend declarations for __get and __get_storage. From-SVN: r271079 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c37cab49396..1cc29702bd2 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,13 @@ 2019-05-10 Jonathan Wakely + PR libstdc++/90397 + * include/std/variant (_Variant_storage::_M_storage()) + (_Variant_storage::_M_reset())) + (_Variant_storage::_M_storage())): Add noexcept. + (__get_storage): Likewise. + (variant): Add noexcept to friend declarations for __get and + __get_storage. + PR libstdc++/90388 * include/bits/unique_ptr.h (default_delete, default_delete): Use _Require for constraints. diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 8c7d7f37fe2..d539df125bf 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -402,7 +402,7 @@ namespace __variant { _M_reset(); } void* - _M_storage() const + _M_storage() const noexcept { return const_cast(static_cast( std::addressof(_M_u))); @@ -432,11 +432,11 @@ namespace __variant _M_index(_Np) { } - void _M_reset() + void _M_reset() noexcept { _M_index = variant_npos; } void* - _M_storage() const + _M_storage() const noexcept { return const_cast(static_cast( std::addressof(_M_u))); @@ -760,7 +760,7 @@ namespace __variant // Returns the raw storage for __v. template - void* __get_storage(_Variant&& __v) + void* __get_storage(_Variant&& __v) noexcept { return __v._M_storage(); } template @@ -1556,10 +1556,12 @@ namespace __variant #endif template - friend constexpr decltype(auto) __detail::__variant::__get(_Vp&& __v); + friend constexpr decltype(auto) + __detail::__variant::__get(_Vp&& __v) noexcept; template - friend void* __detail::__variant::__get_storage(_Vp&& __v); + friend void* + __detail::__variant::__get_storage(_Vp&& __v) noexcept; #define _VARIANT_RELATION_FUNCTION_TEMPLATE(__OP) \ template \