From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 BD3043858D20 for ; Tue, 16 Jan 2024 15:39:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BD3043858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BD3043858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705419576; cv=none; b=qyVjiyqP0rRFmDZO/ZDiGobx9X7jiw9iJYvo6gfCU3w6yYxW4UWbLCdPoo5Xebv7/ajTCE/4EINrkc7iX6dEv5uxwSXibEoauOZssfQKjAlqTmKXskOZQ1iMN+AK2O+vrkaGVXrSZmOecbSnRf+inkB7IQEODQC9vPuAJo0Xhro= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705419576; c=relaxed/simple; bh=uhS5BAZ+SqJQUwSotm7x0vAntGpn5gZ1aVmd7nR5fTU=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=N4hU4k9VDWUDmvypZKoYjZx8aaHVjsQzZd/dYxRlQ3AyDuYfzt1iJhO1TXQqe4sErvyrQAkrdnphV8siJFiNq4RTJuAPPHtGaECtpOisSbhSuhneyQNQ+62ZUIx54bbYL0sYNjTDi3FzslipgnAj7LsSZwpmeDbXrbDOz0k/YlA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705419571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vOrKVcassx+r9UTNyQcCedNWt5RoacVbcawe6SR3xWk=; b=NLjpMw71q2qFzZ9oVWr9LAyLNe4dYjS9sp5OI2oiefWTDjGa3GOKo/xjclYnU2+4eMevMu snmZDOPwzePt3GyozqzU6Rk/dRHvLCkXAlFmdaZg8OEw6+iQIy6nPYre+CXEOM4phNpFb5 jGBDMow4rlSCaP7LLiTscABCcDcBWDs= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-427--kENF80wNqeCFZqQFgx7fg-1; Tue, 16 Jan 2024 10:39:29 -0500 X-MC-Unique: -kENF80wNqeCFZqQFgx7fg-1 Received: by mail-yb1-f198.google.com with SMTP id 3f1490d57ef6-dbe02d0c945so8595713276.3 for ; Tue, 16 Jan 2024 07:39:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705419569; x=1706024369; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vOrKVcassx+r9UTNyQcCedNWt5RoacVbcawe6SR3xWk=; b=HYyCDkmqJ/hSju0s6BvXyqxYFezFB7DuV3elCsAUi1kKo7+fF8qJ70deXiYhrQ+oJD thXAgv8WvITNhqRQ/AXG/abI+US7Cf2/lEPzE2pFfTGYHkiXXr6ccPHRi7jXYK72UBmP NCi/wqFdj4Dv140wuXMdB4xJ6gx73YJ8NXqb1iJfgh4kG1XRoST7O+b5n7YzYvbmCnd8 38AC4aSMuOtYW9RAhPz5ybnFHJcjdvkffvRWGpsPupyodqLNg7eHiBmQEZuV63ItKqa/ r5E2Tx7wgaAbY7P7HMgRTTB9SVmj/AtqMxKbdcQMTS0ReTEyZ5pE2oxQ0P8HD2mbi6iE m6YQ== X-Gm-Message-State: AOJu0Yyl+1Dp9NnUCk9JjQQE0CoMPM91IraOxCKTORxq3vIMfUoDagWQ e+mFEjsAJQtM8fXZxx+bJ28P0Tdjh7CcG8j2UGSfg0/iIjVxFmmeUXxc9ugOJ0iNi0WLKyeRZV/ kcvON0krvs+rhP2zx1mWGlJEgqKR6l+ESo8QZJ6Gczg== X-Received: by 2002:a25:698d:0:b0:dc2:325c:da9f with SMTP id e135-20020a25698d000000b00dc2325cda9fmr271746ybc.124.1705419569191; Tue, 16 Jan 2024 07:39:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1yCkIbtbpsGkWRcahh3UHK4F/ho/h64pg7mK5HlNv38OXQfUy7c4xj/9/ir3utewgLvEsK/vKJIH3poUNALc= X-Received: by 2002:a25:698d:0:b0:dc2:325c:da9f with SMTP id e135-20020a25698d000000b00dc2325cda9fmr271740ybc.124.1705419568926; Tue, 16 Jan 2024 07:39:28 -0800 (PST) MIME-Version: 1.0 References: <20240113124834.1296437-1-jwakely@redhat.com> <20240115204803.1550804-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Tue, 16 Jan 2024 15:39:12 +0000 Message-ID: Subject: Re: [PATCH v4] libstdc++: Implement C++26 std::text_encoding (P1885R12) [PR113318] To: Patrick Palka Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 16 Jan 2024 at 14:07, Jonathan Wakely wrote: > > On 15/01/24 19:09 -0500, Patrick Palka wrote: > >> + friend _Iterator > >> + operator+(_Iterator __i, difference_type __n) > > > >constexpr? > > Fixed. I've added tests that all iterator ops are usable in constant > expressions, which found a bug in operator+= (it didn't let you > increment one past the end of the range). I found another bug in operator+= which is fixed and tested like so: --- a/libstdc++-v3/include/std/text_encoding +++ b/libstdc++-v3/include/std/text_encoding @@ -584,7 +584,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION *this == _Iterator{}; } } - __glibcxx_assert(_M_rep != nullptr); + if (__n != 0) + __glibcxx_assert(_M_rep != nullptr); return *this; } --- a/libstdc++-v3/testsuite/std/text_encoding/requirements.cc +++ b/libstdc++-v3/testsuite/std/text_encoding/requirements.cc @@ -67,6 +67,11 @@ test_constexpr_iterator() VERIFY( *(iter + 1) == iter[1] ); VERIFY( (1 + iter - 1) == begin ); VERIFY( (-1 + (iter - -2) + -1) == begin ); + + std::ranges::iterator_t singular; + VERIFY( (singular + 0) == singular ); + VERIFY( (singular - 0) == singular ); + return true; } static_assert( test_constexpr_iterator() );