From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 295E1385840E; Sat, 2 Oct 2021 12:49:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 295E1385840E Received: by mail-ed1-x52a.google.com with SMTP id v18so44047116edc.11; Sat, 02 Oct 2021 05:49:36 -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=Kus087JyCHYuUoSzG50/dt8tG5kaG5ISLcylaZvVIOM=; b=GKYo39Wj7oYYMXqa2b16RHH1ZbAz3GqWXmSYvsaji41Zn9mxFbzCxelGsZS1Bau2jU LQ6UoWr4lKUvEQNtSQRAHpme7i05gYAZc9Taj93wySDjzxp/lMUnV7w92eANghhKeQ+4 erGzO7f5b5zjQQi74wP1OJzimQCG741IsVVuuSpM90e/yuGyqhriJ0H3YqntWKIQVW0T ld+8niTQqEhqnmho0HeSvyCh6GS7+oLrsR9SdVnC0IWefRLauVlTJ6PgP5YBVJCdKr0/ p4NzV1qYOCwUiGYKCrc90RnbZ7CBbqOfGo9BcrLCAXiqVQvEHZ3ZvJI1VaKomBSIo88D klIA== X-Gm-Message-State: AOAM5302TZb2po37HhOvp9KbVsQg2pKIHBtYQTAobEEhlqfC6FtRvy6H t5EIerW8zWqysfM+dOt3H2N6VjMWCpiSdlzx+a4= X-Google-Smtp-Source: ABdhPJwm0aeJE+977bKrvlH41UbKA9uedBs9sjwUfBo/mAL4AS8bGSnDm4cZOss9YEuZcg7WuAhN/dC7WtPxYXg+h/8= X-Received: by 2002:a05:6402:16d9:: with SMTP id r25mr3752505edx.80.1633178975207; Sat, 02 Oct 2021 05:49:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Daniel_Kr=C3=BCgler?= Date: Sat, 2 Oct 2021 14:49:25 +0200 Message-ID: Subject: Re: [committed] libstdc++: Allow visiting inherited variants [PR 90943] To: Jonathan Wakely Cc: "libstdc++" , gcc-patches List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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 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: Sat, 02 Oct 2021 12:49:37 -0000 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; } - Daniel