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 B50273896C1D for ; Tue, 15 Nov 2022 14:31:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B50273896C1D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668522712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Jx2f8r5RftdNseeRgxKk0s60qpeYBrrMKLWnI7Rfl14=; b=I317KMX5KthNthKek8nwCNfc05AGH+i71nczeQvHjVboG2/CBcqKD0ArS3i6qIzziGZ6ff q/CDYqb3thnP17SVRbznQwXAVuyuXI+geKhEw1s59KiJy5W10Zw1yirr6CPm6JmSosRtBR GrXqrLozZJftTpOB4W68i+pAz3NaRUE= 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) From: Jonathan Wakely 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 Content-Type: text/plain Content-Transfer-Encoding: 8bit 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=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 } -- 2.38.1