From: Jonathan Wakely <jwakely@redhat.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: "Daniel Krügler" <daniel.kruegler@gmail.com>,
libstdc++ <libstdc++@gcc.gnu.org>,
"gcc-patches List" <gcc-patches@gcc.gnu.org>
Subject: Re: [committed] libstdc++: Allow visiting inherited variants [PR 90943]
Date: Mon, 4 Oct 2021 15:26:00 +0100 [thread overview]
Message-ID: <CACb0b4mLEHC2DK=acbfHvFjayPizqJJ=4iA82TEUdgLCMbzQhQ@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdQHHXCr9xb9bgC4EwOpz47+2HG6z2+LyT-DH1Yw-DU=zg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1558 bytes --]
On Sun, 3 Oct 2021 at 10:07, Jonathan Wakely wrote:
>
>
>
> On Sat, 2 Oct 2021, 13:50 Daniel Krügler via Libstdc++, <libstdc++@gcc.gnu.org> wrote:
>>
>> 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; }
>
>
> Probably just an oversight, I'll check again and fix it. Thanks!
Fixed by the attached patch, thanks again.
Tested powerpc64le-linux, pushed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 794 bytes --]
commit 728e639d82099035fdfe69b716a54717ae7050e0
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Oct 4 10:21:58 2021
libstdc++: Add missing noexcept to std::variant helper
libstdc++-v3/ChangeLog:
* include/std/variant (__detail::__variant::__as): Add missing
noexcept to first overload.
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index d50c6b7de1d..6377b6731ea 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -206,7 +206,7 @@ namespace __variant
template<typename... _Types>
constexpr std::variant<_Types...>&
- __as(std::variant<_Types...>& __v)
+ __as(std::variant<_Types...>& __v) noexcept
{ return __v; }
template<typename... _Types>
prev parent reply other threads:[~2021-10-04 14:26 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
2021-10-03 9:07 ` Jonathan Wakely
2021-10-04 14:26 ` Jonathan Wakely [this message]
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='CACb0b4mLEHC2DK=acbfHvFjayPizqJJ=4iA82TEUdgLCMbzQhQ@mail.gmail.com' \
--to=jwakely@redhat.com \
--cc=daniel.kruegler@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jwakely.gcc@gmail.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).