public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Daniel Krügler" <daniel.kruegler@gmail.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
	gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: [committed] libstdc++: Allow visiting inherited variants [PR 90943]
Date: Sat, 2 Oct 2021 14:49:25 +0200	[thread overview]
Message-ID: <CAGNvRgCuPz52iQiL=__iJ1QfyXRRAH+wD42NKCcxxLrjy5xKAw@mail.gmail.com> (raw)
In-Reply-To: <YVdko00+wrQ1d3TL@redhat.com>

Am Fr., 1. Okt. 2021 um 21:57 Uhr schrieb Jonathan Wakely via
Libstdc++ <libstdc++@gcc.gnu.org>:
>
> Implement the changes from P2162R2 (as a DR for C++17).
>
> Signed-off-by: Jonathan Wakely <jwakely@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	other threads:[~2021-10-02 12:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 19:42 Jonathan Wakely
2021-10-02 12:49 ` Daniel Krügler [this message]
2021-10-03  9:07   ` Jonathan Wakely
2021-10-04 14:26     ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGNvRgCuPz52iQiL=__iJ1QfyXRRAH+wD42NKCcxxLrjy5xKAw@mail.gmail.com' \
    --to=daniel.kruegler@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).