From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 1B2C33896C15; Tue, 15 Nov 2022 14:29:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B2C33896C15 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668522576; bh=8TiW4wmuhDc6q9yS4htPWn3hA9mUNtMWki3djDLpEck=; h=From:To:Subject:Date:From; b=pXsW22aLhAbXEZS/howG0aNWFtni7r+gelfMzbKPghOEiQesNENI1b9AY0mQv5yKl zFUKr3/I8YTCSLOYG9vEVm6+kkYySnXqpMoPQUL6RjgJ+AiFIPjHMt7Xd6zrDZBjb7 NQiTAi5xCKAeOrIZ4DTMXFwXE7sSTwNJIvAlqR/0= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-4061] libstdc++: Fix std::format test for strict -std=c++20 mode X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: a5d4f38fbe3bf71efd465d5260955bd6675765fd X-Git-Newrev: c68c468e0ebb6922816367a06e4ab02bad08eb08 Message-Id: <20221115142936.1B2C33896C15@sourceware.org> Date: Tue, 15 Nov 2022 14:29:36 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c68c468e0ebb6922816367a06e4ab02bad08eb08 commit r13-4061-gc68c468e0ebb6922816367a06e4ab02bad08eb08 Author: Jonathan Wakely Date: Tue Nov 15 14:24:57 2022 +0000 libstdc++: Fix std::format test for strict -std=c++20 mode 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>. Diff: --- 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 }