From patchwork Mon Apr 8 16:45:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1920947 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fzXUeVsN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VCw2w711mz1yY8 for ; Tue, 9 Apr 2024 02:46:16 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2EDF33858408 for ; Mon, 8 Apr 2024 16:46:15 +0000 (GMT) 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 BADE6385840D for ; Mon, 8 Apr 2024 16:45:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BADE6385840D 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 BADE6385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712594740; cv=none; b=hwKAoCHlzsm5g3n9nCOhQNmr8vQxdd3/4w+rmtCaSn9hh47A/qE4y3ms+7ViVNtf6qAT9dC/lxz3sehmIZMjFqM5IZyo53RzTYR+WkHAyAAmIURvW74RX4esK/DTNuoVjJhXNIVa9Tm/BWy/SHYmjxPZ+MOcl5OXHTAZUEA1efg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712594740; c=relaxed/simple; bh=Kz417XKSnZFHDfnmi2AomIWWleNlE1Yp5NS/dS5GHJs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gMd2xw2o+H51z6k/wGXtVABjj+NqR6Qybyxq1YS3iN+9yekXwLbeV63uyfIh0c1gzy/jTbSL8rfbigFQz8BUMlqv0chjf2/80Sj6R5VAItmNFo7yo/6fgWcYMzx+G8DsHp2axxNwRnXrqymZxV8tHCXwDpHrTXIWa/vTpvajvbY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712594738; 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=D9crS7KjAxEiEMG/oIMtqBn2ZWexFYPYn1YuR5iqdB0=; b=fzXUeVsNuDwY6hinyaMSwL4s94S2DDEecFHBlEpyV3o5rB+8NBXwIN044FvD3ccQMJz7rj 3ZI73zrjqaEEqzglCbvllmULQzXfcFVnY1ws+TosS+JoOVXN2zCVgH6/9ga1Y0n+vJgONM 6CVpblVvdi2dBwvKhKFBYdbg+9l7XFs= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-GDxLn0tlOsmEaAjr8JLcJg-1; Mon, 08 Apr 2024 12:45:35 -0400 X-MC-Unique: GDxLn0tlOsmEaAjr8JLcJg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1C49438143B1; Mon, 8 Apr 2024 16:45:35 +0000 (UTC) Received: from localhost (unknown [10.42.28.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id DACB61074E; Mon, 8 Apr 2024 16:45:34 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Combine two std::from_chars tests into one Date: Mon, 8 Apr 2024 17:45:13 +0100 Message-ID: <20240408164530.196498-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Tested x86_64-linux and aarch64-linux. Pushed to trunk. -- >8 -- We don't need separate tests for the C++17 and C++20 cases, we can just have one test that uses __cpp_char8_t to adjust whether it tests char8_t or not. This means the C++20 one doesn't fail if -fno-char8_t is used. libstdc++-v3/ChangeLog: * testsuite/20_util/from_chars/1_neg.cc: Add char8_t cases, using a struct of that name if -fno-char8_t is active. * testsuite/20_util/from_chars/1_c++20_neg.cc: Removed. --- .../20_util/from_chars/1_c++20_neg.cc | 43 ------------------- .../testsuite/20_util/from_chars/1_neg.cc | 7 +++ 2 files changed, 7 insertions(+), 43 deletions(-) delete mode 100644 libstdc++-v3/testsuite/20_util/from_chars/1_c++20_neg.cc diff --git a/libstdc++-v3/testsuite/20_util/from_chars/1_c++20_neg.cc b/libstdc++-v3/testsuite/20_util/from_chars/1_c++20_neg.cc deleted file mode 100644 index d246eefb469..00000000000 --- a/libstdc++-v3/testsuite/20_util/from_chars/1_c++20_neg.cc +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2017-2024 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -// { dg-do compile { target c++20 } } - -#include - -void -test01(const char* first, const char* last) -{ - wchar_t wc; - std::from_chars(first, last, wc); // { dg-error "no matching" } - std::from_chars(first, last, wc, 10); // { dg-error "no matching" } - char8_t c8; - std::from_chars(first, last, c8); // { dg-error "no matching" } - std::from_chars(first, last, c8, 10); // { dg-error "no matching" } - char16_t c16; - std::from_chars(first, last, c16); // { dg-error "no matching" } - std::from_chars(first, last, c16, 10); // { dg-error "no matching" } - char32_t c32; - std::from_chars(first, last, c32); // { dg-error "no matching" } - std::from_chars(first, last, c32, 10); // { dg-error "no matching" } - enum E { } e; - std::from_chars(first, last, e); // { dg-error "no matching" } - std::from_chars(first, last, e, 10); // { dg-error "no matching" } -} - -// { dg-prune-output "enable_if" } -// { dg-prune-output "cannot bind non-const lvalue reference" } diff --git a/libstdc++-v3/testsuite/20_util/from_chars/1_neg.cc b/libstdc++-v3/testsuite/20_util/from_chars/1_neg.cc index 7538d9448ac..3f4cd59f6fc 100644 --- a/libstdc++-v3/testsuite/20_util/from_chars/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/from_chars/1_neg.cc @@ -36,6 +36,13 @@ test01(const char* first, const char* last) enum E { } e; std::from_chars(first, last, e); // { dg-error "no matching" } std::from_chars(first, last, e, 10); // { dg-error "no matching" } + +#ifndef __cpp_char8_t + struct char8_t { }; +#endif + char8_t c8; + std::from_chars(first, last, c8); // { dg-error "no matching" } + std::from_chars(first, last, c8, 10); // { dg-error "no matching" } } // { dg-prune-output "enable_if" }