From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id AAD443851C29; Tue, 15 Jun 2021 20:32:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AAD443851C29 Received: by mail-ej1-x636.google.com with SMTP id ho18so24628560ejc.8; Tue, 15 Jun 2021 13:32:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JILyE+zDhzRuYZ3UwB8nxiTT0QaAXhvBa6vPE3wQFFU=; b=i/mDadTzVp5r/atBEPkKwwxt3PDB/sOk2SihyOZhJ5n736mRoJMrcflVOla71jre93 p1fw7kFPBzNSMlEI3f6nDafGJNTtfTZVH+NEGWUXUStFTdDqq8r5rYAJc/Qk+omDrisH e9Ax+tQPpXC/WEfUZHBYzzGYT/Mrmc6hBPPnN+4HKqUSy55tKvbZp+hJyMr1pG67b2vj 1M/2r8Fi9Da5UfrGhcwqw2lnBmBmexqXN9REEUy4qfhLKAzDd/QPHM8KAgZ35n//vsAz teWZOcINbKIdXykKhpGjFKxxdhX3rlQqC/TsiXnxhBRAJj/yl+lYVRTN1Ti5eBkmH4Sh HMGQ== X-Gm-Message-State: AOAM531TyI+u0JQ8fwiNL2cuR7qY7RWX3/hRatQf3vA3IcZbyTBjNYYo sEQsthUYx/1dF/7fLYiiZxML7WFAYDgcDnRzCZE= X-Google-Smtp-Source: ABdhPJwxGIoZD1f+kBTDempgdGuM1vxWkqpgSa1niniT+vgp8GiCFLdnu1fgbeTbxVS5WJg4PyrtT/PvIVtcLeHJeb0= X-Received: by 2002:a17:906:b6c5:: with SMTP id ec5mr1481024ejb.290.1623789167646; Tue, 15 Jun 2021 13:32:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Tim Song Date: Tue, 15 Jun 2021 15:32:12 -0500 Message-ID: Subject: Re: [committed] libstdc++: Make ranges CPOs final and not addressable To: Jonathan Wakely Cc: "libstdc++" , gcc-patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.3 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Tue, 15 Jun 2021 20:32:50 -0000 CPOs are specified as actual semiregular function objects that can be copied and constructed freely, so it seems a bit hostile to make them final/non-addressable? (It's debatable whether the type of a CPO is a type "specified in the C++ standard library" for which [derivation]/4 would apply.) On Tue, Jun 15, 2021 at 1:34 PM Jonathan Wakely via Gcc-patches wrote: > > This restricts the API of the CPOs and other function objects so they > cannot be misused by deriving from them or taking their addresses. > > Signed-off-by: Jonathan Wakely > > libstdc++-v3/ChangeLog: > > * include/bits/ranges_base.h (ranges::begin, ranges::end) > (ranges::cbegin, ranges::cend, ranges::rbeing, ranges::rend) > (ranges::crbegin, ranges::crend, ranges::size, ranges::ssize) > (ranges::empty, ranges::data, ranges::cdata): Make types final. > Add deleted operator& overloads. > (ranges::advance, ranges::distance, ranges::next, ranges::prev): > Likewise. > * testsuite/std/ranges/headers/ranges/synopsis.cc: Replace > ill-formed & expressions with using-declarations. Add checks for > other function objects. > > Tested powerpc64le-linux. Committed to trunk. >