From patchwork Tue Nov 15 14:31:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 60653 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C718B38AA25B for ; Tue, 15 Nov 2022 14:33:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C718B38AA25B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668522819; bh=Jx2f8r5RftdNseeRgxKk0s60qpeYBrrMKLWnI7Rfl14=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=RJ4pNSPKq00GgFhUqYCflowqE3Rh56ip4MR16BpVX+IrWjXsW48s2cutQNXlJqYO9 RLbjSxta0q986O9Irw0CGIOUDH1Sn9RvrXq3AD05mKWoITPdEjv0ZOSQrQGZ+45B2T FoeJwfi0TZ1Wqu5lwmU6wn/Nx8CL6K0r6/FiBV9A= 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 ACB3A3895FF7 for ; Tue, 15 Nov 2022 14:31:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ACB3A3895FF7 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-653-nDO0UjWXP5asIoubvad9XA-1; Tue, 15 Nov 2022 09:31:48 -0500 X-MC-Unique: nDO0UjWXP5asIoubvad9XA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 04045185A7AA; Tue, 15 Nov 2022 14:31:48 +0000 (UTC) Received: from localhost (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2E7B2024CC8; Tue, 15 Nov 2022 14:31:47 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix std::format test for strict -std=c++20 mode Date: Tue, 15 Nov 2022 14:31:45 +0000 Message-Id: <20221115143145.1155275-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 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_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham 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: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-linux and x86_64-w64-mingw32. Pushed to trunk. -- >8 -- Adjust a test to avoid using std::make_unsigned_t<__int128>. That's ill-formed in strict modes because std::is_integral_v<__int128> is false. libstdc++-v3/ChangeLog: * testsuite/std/format/functions/format.cc: Do not use std::make_unsigned_t<__int128>. --- libstdc++-v3/testsuite/std/format/functions/format.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/testsuite/std/format/functions/format.cc b/libstdc++-v3/testsuite/std/format/functions/format.cc index c01405eac90..8019fbdf712 100644 --- a/libstdc++-v3/testsuite/std/format/functions/format.cc +++ b/libstdc++-v3/testsuite/std/format/functions/format.cc @@ -233,7 +233,7 @@ test_wchar() void test_minmax() { - auto check = [](T) { + auto check = []>(T, U = 0) { const int digits = std::numeric_limits::digits; const std::string zeros(digits, '0'); const std::string ones(digits, '1'); @@ -241,7 +241,6 @@ test_minmax() VERIFY( s == "-1" + zeros ); s = std::format("{:b}" , std::numeric_limits::max()); VERIFY( s == ones ); - using U = std::make_unsigned_t; s = std::format("{:0{}b}" , std::numeric_limits::min(), digits + 1); VERIFY( s == '0' + zeros ); s = std::format("{:b}" , std::numeric_limits::max()); @@ -252,7 +251,9 @@ test_minmax() check(std::int32_t(0)); check(std::int64_t(0)); #ifdef __SIZEOF_INT128__ - check(__int128(0)); + // std::make_unsigned_t<__int128> is invalid for strict -std=c++20 mode, + // so pass a second argument of the unsigned type. + check(__int128(0), (unsigned __int128)(0)); #endif }