From patchwork Fri Sep 9 17:24:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1121 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp816690wrt; Fri, 9 Sep 2022 10:26:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR6VRg6fH/zMcEI2RUm6DEFktJ4xUYqM09ZOqvNaPwUcHUbaT7u1VaJDhzmRYbGLLJuoIx3Y X-Received: by 2002:a17:907:80d:b0:73d:a576:dfbd with SMTP id wv13-20020a170907080d00b0073da576dfbdmr10677320ejb.402.1662744406919; Fri, 09 Sep 2022 10:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662744406; cv=none; d=google.com; s=arc-20160816; b=Wyarq2HTGBrtiyZHYjtosek5+Kn14yTJqtaxEP/ze8DWKAZ6GGph/TawgVK9OukyVc sN67FfKMEsyng9mFRusZF3+X9nmDoMN9+ShDnRtJc32bzK9kSgra7TYPz2Hpdht/DicW +eiPmkHPBI3fVcLUDVPCThQhrpfdU9TmRPWJzQgARmM3UPfR89AcxIgj5yD4lmG8jEdV 9xTANWn/TQwWsuRnwKz13VDM2rgTHbpZuI8lt67I9pFy/N7vycWNDzVgyEbMgQAUNPLQ qrgiSgS4W7Ihcrh9quo9agUAikEDTnCuuHNuC1YqbJzgo5Om8OJez/7mI64bRDdK2pPa Y4mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=urz4iCWtcS1MvyORO2fnTc+0ZDGthQbhL/ZSGU3w3uk=; b=R/VzPMf8WiU7k8ELHngJ+/5YCzKGTMoPROh6R425RWB/Lk+OiwdHYgMjmwiUsz5Fn0 QTrAxpOER96vQyj9f9WpxpSUx3VpWciyKCJ8FwiXc0ZxBiKLDh5oAI6C9YCmH4hBnO5X seRGt7zmUz/mhPIwJqhWBhOGCjq8sqFdh+h72Ptir2G1Pze7xSJvjz5fz7470qdMHSbJ Z+/M96SKwacG13H3VThCI7yv8XDvKUJtG5rltNw7mDnBOkl9SGjTqIOR3IZf3XG/uogA RlnmYm871n7HFpEoQewO8cldvSxaVizUWG57cy7wNMiBieViWHyprcGpgoRifBXGL14Y UYIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ycIsXnx5; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hf15-20020a1709072c4f00b00738346168dcsi924294ejc.811.2022.09.09.10.26.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 10:26:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ycIsXnx5; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7D0A838515DF for ; Fri, 9 Sep 2022 17:26:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D0A838515DF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662744375; bh=urz4iCWtcS1MvyORO2fnTc+0ZDGthQbhL/ZSGU3w3uk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ycIsXnx589fO1GktwXk9gWsRt/zxmUl9ZgYLetaHL/VNMR0v0xkgYtACcc2MwVBFn jv+jk9G34LGfwdKg3irQSnK2L2YbEQESsjd3x8XSF80T7jyfCQLo8iul0VmRhBdk7u n4DIrEmGcvGVWTQQPZPImrGZ+LCI1VEwW5rHbtvQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id C2FEF3858435 for ; Fri, 9 Sep 2022 17:24:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C2FEF3858435 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-641-rl6SGOFxNyeqO74A388Tww-1; Fri, 09 Sep 2022 13:24:49 -0400 X-MC-Unique: rl6SGOFxNyeqO74A388Tww-1 Received: by mail-qv1-f70.google.com with SMTP id n15-20020ad444af000000b004a2a341ad71so1668453qvt.15 for ; Fri, 09 Sep 2022 10:24:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=urz4iCWtcS1MvyORO2fnTc+0ZDGthQbhL/ZSGU3w3uk=; b=qgdl5zgXyZNaCCDA8SgLDNvr9z8lO6/Jxy7SUDVjexpVg5lj1xhRXEXKqb5THLtgHa K0itSl34+IfMY/o0MPM0VfmhEtf9zu9sfy2nYsMPFOWllRCLeA5DlEyoWg2BtLKm8xGX 42oT2rQ18zYvk1jBIWMJEnVFijgB3xGzKnWYRh9WbNaTGhQqaGDkot6C/eR3VSL5NJx6 hN8jX3LYkBgWae6n1l1OTUVAkjfa3KUCpb36jgQ8zvyjcazCVzURfp7nOcU6cfHlC88e SykP+rbivbyxfx6Osw+qlB0gD14DVq8xrjTHkMJH7KQQ2uaEoG6J9MxeYAfcMK+rsg8q HfEA== X-Gm-Message-State: ACgBeo1NMBOeUGG/GzzB0Ac8x307bX7rvwv4Bq6kJZ/QlCBTOaMIwNC8 tEqu3cHe6w0Aw0+00N0cEkY6LdPXO1stsMHpfTrPY+kTT4x5C5gN76KmIbJP5T5WidrCB1LvUq2 nBC1yoNgCkZAJXqBQ8cH4KORNw6B2vb4JEyU4igcVUms6hcGUsq2NYB0EGsw6Ld9YltQ= X-Received: by 2002:ac8:7fc4:0:b0:344:5b83:de4c with SMTP id b4-20020ac87fc4000000b003445b83de4cmr13361591qtk.671.1662744289048; Fri, 09 Sep 2022 10:24:49 -0700 (PDT) X-Received: by 2002:ac8:7fc4:0:b0:344:5b83:de4c with SMTP id b4-20020ac87fc4000000b003445b83de4cmr13361566qtk.671.1662744288703; Fri, 09 Sep 2022 10:24:48 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id f5-20020a05622a1a0500b003445bb107basm820250qtb.75.2022.09.09.10.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 10:24:48 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/3] libstdc++: Fix zip_view's operator- for integer-class difference type [PR106766] Date: Fri, 9 Sep 2022 13:24:44 -0400 Message-Id: <20220909172446.1546805-1-ppalka@redhat.com> X-Mailer: git-send-email 2.37.3.518.g79f2338b37 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Cc: libstdc++@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743513878972966971?= X-GMAIL-MSGID: =?utf-8?q?1743513878972966971?= make_unsigned_t can't give us the unsigned version of an integer-class difference type, so use __make_unsigned_like_t / __to_unsigned_like instead. PR libstdc++/106766 libstdc++-v3/ChangeLog: * include/std/ranges (zip_view::_Iterator::operator-): Use __to_unsigned_like instead of make_unsigned_t. (zip_view::_Sentinel::operator-): Likewise. * testsuite/std/ranges/zip/1.cc (test04): New test. --- libstdc++-v3/include/std/ranges | 8 ++++---- libstdc++-v3/testsuite/std/ranges/zip/1.cc | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 2b5cb0531f0..2b8fec3c386 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -4657,8 +4657,8 @@ namespace views::__adaptor return ranges::min({difference_type(std::get<_Is>(__x._M_current) - std::get<_Is>(__y._M_current))...}, ranges::less{}, - [](difference_type __i) -> make_unsigned_t { - return __i < 0 ? -__i : __i; + [](difference_type __i) { + return __detail::__to_unsigned_like(__i < 0 ? -__i : __i); }); }(make_index_sequence{}); } @@ -4726,8 +4726,8 @@ namespace views::__adaptor return [&](index_sequence<_Is...>) { return ranges::min({_Ret(std::get<_Is>(__x._M_current) - std::get<_Is>(__y._M_end))...}, ranges::less{}, - [](_Ret __i) -> make_unsigned_t<_Ret> { - return __i < 0 ? -__i : __i; + [](_Ret __i) { + return __detail::__to_unsigned_like(__i < 0 ? -__i : __i); }); }(make_index_sequence{}); } diff --git a/libstdc++-v3/testsuite/std/ranges/zip/1.cc b/libstdc++-v3/testsuite/std/ranges/zip/1.cc index 0113efdb537..f868c97cb69 100644 --- a/libstdc++-v3/testsuite/std/ranges/zip/1.cc +++ b/libstdc++-v3/testsuite/std/ranges/zip/1.cc @@ -102,10 +102,24 @@ test03() return true; } +constexpr bool +test04() +{ + // PR libstdc++/106766 + auto r = views::zip(views::iota(__int128(0), __int128(1))); + auto i = r.begin(); + auto s = r.end(); + VERIFY( s - i == 1 ); + VERIFY( i + 1 - i == 1 ); + + return true; +} + int main() { static_assert(test01()); static_assert(test02()); static_assert(test03()); + static_assert(test04()); } From patchwork Fri Sep 9 17:24:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1123 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp817100wrt; Fri, 9 Sep 2022 10:27:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR4LTFPOi1FJ6rXY66JZInSgDFJ1tudRMxeCyGWuIME+xhBsOQ+htRkv3bCD9u8mqSEHB2M6 X-Received: by 2002:a17:907:94d0:b0:730:7a68:3093 with SMTP id dn16-20020a17090794d000b007307a683093mr10791593ejc.760.1662744473527; Fri, 09 Sep 2022 10:27:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662744473; cv=none; d=google.com; s=arc-20160816; b=HB68Pq2ceBcxPPcvSriY8pY9pEedf2J2M6tnXXTkG0aGq1gC/auAKLCeibI0eOle3u 1guAKERHI46h9q0C1QCG05LDekxRnEYD3roujqAL6QSTE1sZzN/kv1k4MEnAFZMOAICi cjc1ap+JAf/Fjz71OEaa/em5qsu6Y+wCjydxMBrHlulh3396k4Y+oGW96B5fZBfZmNEL TaQA0jZIk1pivc1L95/w5vavqDnlVMl4/+OLlL+cPc6BS7b93EFJDXe7Ske0v3PMUHdS LdJa3SI1zac/1FCXKGMwqkznpRgXf40w/JEWWN1BBlI2QvX9qjqhDANRzCCKmZ3A8Ms9 6oUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=LacF4wdjEbYMqFdNQMkcThSU/UCJy0jw326JIjtpV0Q=; b=XulC/IXp7fL9FNtl024wzpxFYowK2IhcrLKaGGWLB88wUWn9Of5SzaY5VEhRbEPrKq /+CxthOT5Tp1fg/dJuxzcK9X02mWV/6MIzBCCu+QYK3XHlyULclv4qrL+ZEIf1/tV74F O0eCjM8XGufjqj/b+HPiZvwKesAEzsHQ7dgwmKnvvVVPA5qE6GDmV5tRvoXM4LQBpuSv g+ntJNyBkxbK0n+M0SDfwg3JG/bUYwqqjUZrvqxN0l1TvIGk4iN27i0ed86ZRJnWVU3y nyyNpL2ek+fnvvp5tQqcb79s2RY2C5CC/PFyp9Cbm/ddHOLlDtPC7U7RudOqvyl3mP8o pX0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=OB8jRHFz; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q14-20020a056402518e00b0044df6d4f36dsi1015018edd.325.2022.09.09.10.27.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 10:27:53 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=OB8jRHFz; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9A6D38515D1 for ; Fri, 9 Sep 2022 17:27:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9A6D38515D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662744433; bh=LacF4wdjEbYMqFdNQMkcThSU/UCJy0jw326JIjtpV0Q=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=OB8jRHFzvHGuXRBkRWNMXCnaHY6EJZDjOaQ/ecRT64L4/+3tibhuWjY37n48oyb1W OpXAfJs9PpJhZr9auHosDc0uvxf73/GYUsqTOk7+f9GkqQCvDFr9XldE90iwCszb/l MTSqslv68HcOynW+pCMlldrqQgRIxddZxLMSO02Q= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id E4685385829A for ; Fri, 9 Sep 2022 17:24:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E4685385829A Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-537-P7HCshaHMNm47omPogL70w-1; Fri, 09 Sep 2022 13:24:50 -0400 X-MC-Unique: P7HCshaHMNm47omPogL70w-1 Received: by mail-qv1-f70.google.com with SMTP id g4-20020ad45424000000b004a9bb302c85so1668453qvt.22 for ; Fri, 09 Sep 2022 10:24:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=LacF4wdjEbYMqFdNQMkcThSU/UCJy0jw326JIjtpV0Q=; b=SkT7OV5QQJizKE9BHJ3UXRnQHSFVA3vZL7gP21LUP8LyC4r6/0pMWhrI5ybGnWA4R4 +nGOcZ+m5q4qj+wnMWSoFpU3M+hH9r18pq0ZioIKioxxBg8MtmJL9XpHMk7+Dk/uGxez agFumb073LtYVxKfZXJb1f6IqHn/evIrdGJj9PZuY0CFwDA+H5I5DsEohLymTkOm0hyc 8G4QzsfCd3EBwbZZTJNOUZpb3yAiPZtqvqZh3Iw+0tc/1/QhorKJvHRoy58ng62Vqo+n 49H5V+r86oG3lgcZ/BQwg0+zlag0xjjoT6n7z2MYVbWAdd2utERJjEnPFUYb22b6HeT/ 1BZQ== X-Gm-Message-State: ACgBeo1BOyy1lvhH+ICX750g+fgJBEMVn6AQM+2OX4W/VnN8D1vz7cNt OlA1ptPtxV09YiDl+G+zi3iPLpKib6xcP/GBaND1j6GqXxZd2Q/kzGXn1KSGfMybuNX8QBhirrP cxRQTR3tjQyhfw/YyuxIerifI7VIKnXkp3bCxdL575ktdrtUlPzQUNXNyM/iCowbtjXg= X-Received: by 2002:a05:620a:2239:b0:6be:91e8:c9dc with SMTP id n25-20020a05620a223900b006be91e8c9dcmr10810458qkh.305.1662744290015; Fri, 09 Sep 2022 10:24:50 -0700 (PDT) X-Received: by 2002:a05:620a:2239:b0:6be:91e8:c9dc with SMTP id n25-20020a05620a223900b006be91e8c9dcmr10810444qkh.305.1662744289713; Fri, 09 Sep 2022 10:24:49 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id f5-20020a05622a1a0500b003445bb107basm820250qtb.75.2022.09.09.10.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 10:24:49 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/3] libstdc++: Fix typo in adjacent_view::_Iterator [PR106798] Date: Fri, 9 Sep 2022 13:24:45 -0400 Message-Id: <20220909172446.1546805-2-ppalka@redhat.com> X-Mailer: git-send-email 2.37.3.518.g79f2338b37 In-Reply-To: <20220909172446.1546805-1-ppalka@redhat.com> References: <20220909172446.1546805-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Cc: libstdc++@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743513948752432889?= X-GMAIL-MSGID: =?utf-8?q?1743513948752432889?= PR libstdc++/106798 libstdc++-v3/ChangeLog: * include/std/ranges (adjacent_view::_Iterator::_Iterator): Fix typo. * testsuite/std/ranges/adaptors/adjacent/1.cc (test04): New test. --- libstdc++-v3/include/std/ranges | 2 +- .../testsuite/std/ranges/adaptors/adjacent/1.cc | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 2b8fec3c386..37ad80ad3de 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -5239,7 +5239,7 @@ namespace views::__adaptor requires _Const && convertible_to, iterator_t<_Base>> { for (size_t __j = 0; __j < _Nm; ++__j) - _M_current[__j] = std::move(__i[__j]); + _M_current[__j] = std::move(__i._M_current[__j]); } constexpr auto diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/adjacent/1.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/adjacent/1.cc index 9829f79364f..443c1fbf450 100644 --- a/libstdc++-v3/testsuite/std/ranges/adaptors/adjacent/1.cc +++ b/libstdc++-v3/testsuite/std/ranges/adaptors/adjacent/1.cc @@ -101,10 +101,22 @@ test03() return true; } +constexpr bool +test04() +{ + // PR libstdc++/106798 + auto r = views::single(0) | views::lazy_split(0) | views::pairwise; + decltype(ranges::cend(r)) s = r.end(); + VERIFY( r.begin() == s ); + + return true; +} + int main() { static_assert(test01()); static_assert(test02()); static_assert(test03()); + static_assert(test04()); } From patchwork Fri Sep 9 17:24:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1122 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp816697wrt; Fri, 9 Sep 2022 10:26:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR6YoThUwPneusrEHIVZi9kYpCbJiLWLzupXQu95ktu437y9euz2EvE+UuTACLByqac8GjLM X-Received: by 2002:a17:906:eecb:b0:73c:5bcb:8eb3 with SMTP id wu11-20020a170906eecb00b0073c5bcb8eb3mr10506187ejb.284.1662744407564; Fri, 09 Sep 2022 10:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662744407; cv=none; d=google.com; s=arc-20160816; b=zthOTKa34VjB3K3RwUv5yvba7zhf9Vl0tRr7m0RV8M3D2pp7PfLhPOGCc1IoSLlHv7 /SyUoudPxOLe4AuCR1wmnV3FrzHzrwDk6L3nn9bTcPQeY83AxG9Vahr3/Noii2w+Ta2O uo4FqWarYY5zIykxe9Q52kR/qi7oW9JraPETO7tTNTUBDIuTE57w36N2RzMWL+Qes+Cv 0LOAnsatfl5Vmh4WxYLZbw1Yo91ARiQIER4vxi+enZ43IRZ3ITzekg7lf9JQFRQpxEdb j3ejwhLA/z9F0B4Suwdbc+XFi1/xAd9qjOisj63WsEvPGQcNkFVd+ME3nMPL0zKoL710 4Z4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=XtqysvV+0feIrrp2qkv2T8g/2vSEkm70iZThsfB+EhM=; b=BwqpFPHyJ0Gs0RG3ltH4GE8rr2vzLirIPgsNqG71pENTPeV6r2ES2k0Xh0vJ+x1T/q +z9J+OkwUOhqiFsMBkAPXzDMbclcd4Z4GTwDFUHOIilZbWRGCQ5cuC5FticNl2FeOZA0 0uIlhxooxxWk8Xk2VnCcetRmzFBCbkj3EZtt04aPiMH1KptfoVSEYNQGm8ZcDyAy4ySq /YoHxB4iJnm+fYBtewCv6ZaoG6JjVr4TncKC+dZCnkps/CPtVyta/1oaHy2QsGk/Tqft GfmCk1E/8Jn3cAsYVPS5ZCFSmxKH4aK9PeGWUC1oCp1mgUazHLCCX2ctyqQOYLdlRioP qZ/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=E+CQrTyv; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f11-20020a170906494b00b00730a539ac16si660754ejt.982.2022.09.09.10.26.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 10:26:47 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=E+CQrTyv; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 619623850417 for ; Fri, 9 Sep 2022 17:26:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 619623850417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662744376; bh=XtqysvV+0feIrrp2qkv2T8g/2vSEkm70iZThsfB+EhM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=E+CQrTyv0eCA1YLAwGI5SyiVERAq13CJsciZkqIbYXYP22HZfMP11slq0VZQtdw27 Wyh0w75HWVfLpQAqQFNi0ITR5qKKUpBQCc3wrrnlT16oCzvZZrFFGZIAJlL5jWHgy2 Y+MXj3T7rah18y7bkE2eA6+pehAjpuUJDPRlew9U= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id EA8E33857C4B for ; Fri, 9 Sep 2022 17:24:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA8E33857C4B Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-606-VpFrLlRsNAa6YhUTlUazHA-1; Fri, 09 Sep 2022 13:24:52 -0400 X-MC-Unique: VpFrLlRsNAa6YhUTlUazHA-1 Received: by mail-qv1-f71.google.com with SMTP id g4-20020ad45424000000b004a9bb302c85so1668519qvt.22 for ; Fri, 09 Sep 2022 10:24:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=XtqysvV+0feIrrp2qkv2T8g/2vSEkm70iZThsfB+EhM=; b=JTu7bnfNL7TTrRTuyWUUX8/LtpFzpotzsWshC+mcys8sln1XfFThljpZp010oabiij ntsYB4+UyG53qW4BA6jOy7xgL289FTxpul/1aBBnKfxC5UOSgQa8JCIZs96L5nqsuSAh 8dFpKNHYHMu6Nr8hrzIzPW9xmbuPunQCkPZ/uFB4Il5k+9EgCt0h+yTXUM/VMeTsxzCP 26TJoVk92eaT1EqEE4WkZz4RVDfloZvXuizHKCqarCz/jUr6tnCAH5IQyI7rV397efJA a+pFlmvy8m/iLbfn5VmKMhYszJjRZaMHPePLJ9bRqOeZa4Itv4bGnQUOu2yS7VKeJq5m bgag== X-Gm-Message-State: ACgBeo3Mso1eqSb42+hEyUAfQHkd4HhM2+8ga7z1cL9XsA5ejx7AHEI7 0ZVhcY+JYnLH/exgQQBFBXUtYSCYApxvRzFyb0eCY2T0fsDI8bQBYI3XF+vQBr61eKDWx+TydrT jH7yOnEqTCSEaNwIfmTCZ23wMgUxnyCmjLoSWGiagW0i0OjKmgeVlCTvAUVlZy2H2wac= X-Received: by 2002:a05:622a:40e:b0:343:7769:5895 with SMTP id n14-20020a05622a040e00b0034377695895mr13861176qtx.467.1662744291611; Fri, 09 Sep 2022 10:24:51 -0700 (PDT) X-Received: by 2002:a05:622a:40e:b0:343:7769:5895 with SMTP id n14-20020a05622a040e00b0034377695895mr13861149qtx.467.1662744291251; Fri, 09 Sep 2022 10:24:51 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id f5-20020a05622a1a0500b003445bb107basm820250qtb.75.2022.09.09.10.24.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 10:24:50 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/3] libstdc++: Fix return type of empty zip/adjacent_transform [PR106803] Date: Fri, 9 Sep 2022 13:24:46 -0400 Message-Id: <20220909172446.1546805-3-ppalka@redhat.com> X-Mailer: git-send-email 2.37.3.518.g79f2338b37 In-Reply-To: <20220909172446.1546805-1-ppalka@redhat.com> References: <20220909172446.1546805-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Cc: libstdc++@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743513880201915872?= X-GMAIL-MSGID: =?utf-8?q?1743513880201915872?= Tested on x86_64-pc-linux-gnu, does this series look OK for trunk? PR libstdc++/106803 libstdc++-v3/ChangeLog: * include/std/ranges (views::_ZipTransform::operator()): Fix return type in the empty case. (views::_AdjacentTransform::operator()): Likewise. --- libstdc++-v3/include/std/ranges | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 37ad80ad3de..20eb4e82ac8 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -5071,7 +5071,7 @@ namespace views::__adaptor operator() [[nodiscard]] (_Fp&& __f, _Ts&&... __ts) const { if constexpr (sizeof...(_Ts) == 0) - return views::empty>>; + return views::empty&>>>; else return zip_transform_view(std::forward<_Fp>(__f), std::forward<_Ts>(__ts)...); } @@ -5762,7 +5762,7 @@ namespace views::__adaptor operator() [[nodiscard]] (_Range&& __r, _Fp&& __f) const { if constexpr (_Nm == 0) - return views::empty>; + return zip_transform(std::forward<_Fp>(__f)); else return adjacent_transform_view, decay_t<_Fp>, _Nm> (std::forward<_Range>(__r), std::forward<_Fp>(__f));