From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id CFDFD3858D3C; Sun, 3 Oct 2021 09:07:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CFDFD3858D3C Received: by mail-wr1-x430.google.com with SMTP id v25so13662899wra.2; Sun, 03 Oct 2021 02:07:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xG8WPyguh3UDWBJJOPAT0hBMEjflMGN4Hpsd766zxMc=; b=SEjxSXj4le26hy07vUygU0XqSWGqSIGuQjUixDRZX2lEs1NEW4pHmqmm1Eekx9aJUt qm9jXlLsx1kkwwRQWt9t+GRFVerpXvkDoj9n5X2Mn1w/Uun7c2rOSlOy6M3YiXNqA2Yg 8Pt3FFZCNwWTum5qDl3j3oIb6wzGfrFtVZqUnJn2XN4vJ9ZmRzeRbRZVbxL/y7bUqjZX g0GMsbVv2ECaeWiuE3PfXuTmSbR3r0LEZEEYMoeelexzNQp7HoJbchlNDrd+Xevo3Dlb onueQT5EiMXi1K/CopX7FPDNNs/lEc4G8jx8TP4sIljaiB+vQG2ApS80WtgEONbT/5WU PeIg== X-Gm-Message-State: AOAM533FYyvMFKWQv2Jzb0Di4+3yZG/K2zbiQ+2J/FWoq+QWhfM9g8is 0KdUdo8XFWVZj/ek85Vfl9dQLdAS3sdYXDYlYCA= X-Google-Smtp-Source: ABdhPJyRAgFIVmNT4N7ZeQBcgyEwappCbA4R5yX+K2oFsNcedbxaVxDR3aHCLEsEyx4qjHFoz/Shln4oq5Tl3I/CsMw= X-Received: by 2002:a5d:47c2:: with SMTP id o2mr7384941wrc.57.1633252044674; Sun, 03 Oct 2021 02:07:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Sun, 3 Oct 2021 10:07:13 +0100 Message-ID: Subject: Re: [committed] libstdc++: Allow visiting inherited variants [PR 90943] To: =?UTF-8?Q?Daniel_Kr=C3=BCgler?= Cc: Jonathan Wakely , "libstdc++" , gcc-patches List X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 09:07:27 -0000 On Sat, 2 Oct 2021, 13:50 Daniel Kr=C3=BCgler via Libstdc++, < libstdc++@gcc.gnu.org> wrote: > Am Fr., 1. Okt. 2021 um 21:57 Uhr schrieb Jonathan Wakely via > Libstdc++ : > > > > Implement the changes from P2162R2 (as a DR for C++17). > > > > Signed-off-by: Jonathan Wakely > > > > 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): 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 > + constexpr std::variant<_Types...>& > + __as(std::variant<_Types...>& __v) > + { return __v; } > Probably just an oversight, I'll check again and fix it. Thanks!