Am Fr., 1. Okt. 2021 um 21:57 Uhr schrieb Jonathan Wakely via
Libstdc++ <libstd...@gcc.gnu.org>:
>
> Implement the changes from P2162R2 (as a DR for C++17).
>
> Signed-off-by: Jonathan Wakely <jwak...@redhat.com>
>
> libstdc++-v3/ChangeLog:
>
>         PR libstdc++/90943
>         * include/std/variant (__cpp_lib_variant): Update value.
>         (__detail::__variant::__as): New helpers implementing the
>         as-variant exposition-only function templates.
>         (visit, visit<R>): Use __as to upcast the variant parameters.
>         * include/std/version (__cpp_lib_variant): Update value.
>         * testsuite/20_util/variant/visit_inherited.cc: New test.
>
> Tested powerpc64le-linux. Committed to trunk.
>

I'm wondering why the first __as overload is not noexcept as well (or
asking it the other way around: Why different exception-specifications
are used for the different overloads):

+  // The __as function templates implement the exposition-only "as-variant"
+
+  template<typename... _Types>
+    constexpr std::variant<_Types...>&
+    __as(std::variant<_Types...>& __v)
+    { return __v; }

- Daniel

Reply via email to