From patchwork Tue Dec 5 23:34:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 174238 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3771059vqy; Tue, 5 Dec 2023 15:35:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEW0EksV+gX13DLnXSrBmx+ckUwnA0kSUDz58hC78tdp//mCH+jU2T1v5HoEF6lN9zgisMk X-Received: by 2002:ac8:7e8e:0:b0:425:4043:762d with SMTP id w14-20020ac87e8e000000b004254043762dmr2286118qtj.85.1701819320912; Tue, 05 Dec 2023 15:35:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701819320; cv=pass; d=google.com; s=arc-20160816; b=LRmFZCVSBg1vfGrhF/od6WMYcihhN025lwe4kBR1/IasorLRjap1shfgpd4GICh/01 RIpHNl3utajGU1yHs2MbvXQWCCmGfMovdvpDblNBiZFYmWEuzHmdsJQRKOeddVBtlQNX 2oEL9R8wxr8RMt4idaOpTfyjqzbZ7nrHXJV4O18mnA/WTANCrgeXEwC61BzjNmzWOJYI moI6gwZ9W90yebSDqQjfhJclKnhlUaQpUUcelT4EXzOsktBN8fO8vvFCtMiSqe8Olvp4 Xus5nesrpGj1y6IMBdU8RqtrqnTqi9BkmKU4kGYB5CWwl6c/RHGxGaeT40hZbZW+8hzO QwIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=bEh53wcj0eRmh5zKBMKI4LtrwpilTEA4aShbaiPQGXg=; fh=sJ+2/4g29YdyXkoRrFZSpsL2zxijepB7X/1rB0LDDh8=; b=PHJhuAzdki7NGpUp3WqEzawvJ3XM+/Pp+uRd/gAIyzuidkvfiAXNZKwTmIoTUx6MCL ji9R3oMoQcXqybsMoj6mpcjTWBgk0RDmympOzGpUYEfQMWsrfq5PxzLZUGsZtLn7i2nf TWoiRcU2LLgU1Fq1AjByyMPK2DgQMwPgkMnFZZ4HVJ3+07nGL7phCAEDI4azvG0JlYPL NaS52qcmWPc7t3yXSySoz3VgppWy56t8uQxqRYj7vYuwG2vk3Qd7OMCn8Tlxzolp2xYk QMxTOlhODObKGMkrxJtOJMWwiuyj+vmuYc6uE2VfqTP7n5M6FVpDIdNwBEQOrx8dxoHg Swuw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Yn8+iOd6; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d4-20020ac86684000000b004069466b1c0si11618751qtp.562.2023.12.05.15.35.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 15:35:20 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Yn8+iOd6; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ABA4D385B537 for ; Tue, 5 Dec 2023 23:35:20 +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.129.124]) by sourceware.org (Postfix) with ESMTPS id E333E3858D37 for ; Tue, 5 Dec 2023 23:34:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E333E3858D37 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 E333E3858D37 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=1701819296; cv=none; b=bRd2mfUIc/hBy75Cys/nsyTSTJixXGIiqsKV8SI/I1tZgAQU+UqEjdCToL/raC47E1+fGyZ8jQTo4QoQwTqY0kVEBAwhGcivfiYBbESjND0DyhWlL6eG8qjjq0i8B7lQVMaZVVvGYn/uWpDRG7vuvOwjZNqMbW2U5fsNIyuzzWo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701819296; c=relaxed/simple; bh=RQfV2uc/gs0gBJ7PUynSJlNuemAXA84dLH2APMj3e38=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ipW4xKvu7CDvmtfhjbj4XUOza+NSC9iGCN04JUo5lRofuIiTU2fP6jYyvzJ9rlg7d/pIQ0zGr3LlhSPFr8v05h0L/6i7FLV0Q8SbRsQiQP/bUdhMkULJ3fuLv6Lmr+j5Y03FuRxWEAp1AzXxpqOPIEK+6tvaXxTgoqzlxTOjrWk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701819293; 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=bEh53wcj0eRmh5zKBMKI4LtrwpilTEA4aShbaiPQGXg=; b=Yn8+iOd6albTkv9q8tPNgwZTe0SunOWg837bIbl73BdOQ2QZeXwxBQ3Wb6Aa9zIQcP/TuI VVIQPXNKNNlnqQcurs9G2XH8HW9oOp6vn1vPHHFnQVLxQOKnN8LVjW7blnvY/ikPn0Y7xp 32zGBO0c1K8NgTISJyupME5HOMQmX+E= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-2gfoTTC6Oe-J6_up6_jGpw-1; Tue, 05 Dec 2023 18:34:51 -0500 X-MC-Unique: 2gfoTTC6Oe-J6_up6_jGpw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 A30DB85A58B; Tue, 5 Dec 2023 23:34:51 +0000 (UTC) Received: from localhost (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53B92492BE6; Tue, 5 Dec 2023 23:34:51 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Redefine __glibcxx_assert to work in C++23 constexpr Date: Tue, 5 Dec 2023 23:34:27 +0000 Message-ID: <20231205233450.614809-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 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_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, URI_HEX 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784486896331425768 X-GMAIL-MSGID: 1784486896331425768 Tested x86_64-linux. Pushed to trunk. Might be worth backporting too, but it can wait. -- >8 -- The changes in r14-5979 to support unknown references in constant expressions caused some test regressions. The way that __glibcxx_assert is defined for constant evaluation no longer works when _GLIBCXX_ASSERTIONS is defined. This change simplifies __glibcxx_assert so that there is only one check, rather than a constexpr one and a conditionally-enabled runtime one. The constexpr one does not need to use __builtin_unreachable to cause a compilation failure, because __glibcxx_assert_fail is not usable in constant expressions, so that will cause a failure too. As well as fixing the regressions, this makes the code for the assertions shorter and simpler, so should be quicker to compile, and might inline better too. libstdc++-v3/ChangeLog: * include/bits/c++config (__glibcxx_assert_fail): Declare even when assertions are not enabled. (__glibcxx_constexpr_assert): Remove macro. (__glibcxx_assert_impl): Remove macro. (_GLIBCXX_ASSERT_FAIL): New macro. (_GLIBCXX_DO_ASSERT): New macro. (__glibcxx_assert): Simplify to a single definition that works at runtime and during constant evaluation. * testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc: Adjust expected errors. * testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/debug.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/debug.cc: Likewise. * testsuite/23_containers/span/back_neg.cc: Likewise. * testsuite/23_containers/span/front_neg.cc: Likewise. * testsuite/23_containers/span/index_op_neg.cc: Likewise. * testsuite/26_numerics/lcm/105844.cc: Likewise. --- libstdc++-v3/include/bits/c++config | 47 +++++++++---------- .../element_access/char/back_constexpr_neg.cc | 3 +- .../element_access/char/constexpr_neg.cc | 3 +- .../char/front_constexpr_neg.cc | 3 +- .../wchar_t/back_constexpr_neg.cc | 3 +- .../element_access/wchar_t/constexpr_neg.cc | 3 +- .../wchar_t/front_constexpr_neg.cc | 3 +- .../modifiers/remove_prefix/debug.cc | 2 +- .../modifiers/remove_suffix/debug.cc | 2 +- .../testsuite/23_containers/span/back_neg.cc | 4 +- .../testsuite/23_containers/span/front_neg.cc | 4 +- .../23_containers/span/index_op_neg.cc | 4 +- .../testsuite/26_numerics/lcm/105844.cc | 2 +- 13 files changed, 36 insertions(+), 47 deletions(-) diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 410c136e1b1..284d24d933f 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -577,46 +577,41 @@ namespace std #undef _GLIBCXX_VERBOSE_ASSERT // Assert. -#if defined(_GLIBCXX_ASSERTIONS) \ - || defined(_GLIBCXX_PARALLEL) || defined(_GLIBCXX_PARALLEL_ASSERTIONS) -# ifdef _GLIBCXX_VERBOSE_ASSERT +#ifdef _GLIBCXX_VERBOSE_ASSERT namespace std { #pragma GCC visibility push(default) - // Avoid the use of assert, because we're trying to keep the - // include out of the mix. + // Don't use because this should be unaffected by NDEBUG. extern "C++" _GLIBCXX_NORETURN void - __glibcxx_assert_fail(const char* __file, int __line, - const char* __function, const char* __condition) + __glibcxx_assert_fail /* Called when a precondition violation is detected. */ + (const char* __file, int __line, const char* __function, + const char* __condition) _GLIBCXX_NOEXCEPT; #pragma GCC visibility pop } -#define __glibcxx_assert_impl(_Condition) \ - if (__builtin_expect(!bool(_Condition), false)) \ - { \ - __glibcxx_constexpr_assert(false); \ - std::__glibcxx_assert_fail(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ - #_Condition); \ - } -# else // ! VERBOSE_ASSERT -# define __glibcxx_assert_impl(_Condition) \ - if (__builtin_expect(!bool(_Condition), false)) \ - { \ - __glibcxx_constexpr_assert(false); \ - __builtin_abort(); \ - } -# endif +# define _GLIBCXX_ASSERT_FAIL(_Condition) \ + std::__glibcxx_assert_fail(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ + #_Condition) +#else // ! VERBOSE_ASSERT +# define _GLIBCXX_ASSERT_FAIL(_Condition) __builtin_abort() #endif #if defined(_GLIBCXX_ASSERTIONS) -# define __glibcxx_assert(cond) \ - do { __glibcxx_assert_impl(cond); } while (false) +# define _GLIBCXX_DO_ASSERT true +#elif _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED +# define _GLIBCXX_DO_ASSERT std::__is_constant_evaluated() #else -# define __glibcxx_assert(cond) \ - do { __glibcxx_constexpr_assert(cond); } while (false) +# define _GLIBCXX_DO_ASSERT false #endif +# define __glibcxx_assert(cond) \ + do { \ + if _GLIBCXX17_CONSTEXPR (_GLIBCXX_DO_ASSERT) \ + if (__builtin_expect(!bool(cond), false)) \ + _GLIBCXX_ASSERT_FAIL(cond); \ + } while (false) + // Macro indicating that TSAN is in use. #if __SANITIZE_THREAD__ # define _GLIBCXX_TSAN 1 diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc index ffbc3069b1c..39410dde260 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc @@ -31,5 +31,4 @@ back() static_assert(back() != 'a'); // { dg-error "non-constant condition" } -// { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "unreachable" } +// { dg-error "assert_fail" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc index 3e718bfc98d..59c465b7452 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc @@ -30,5 +30,4 @@ test() static_assert(test() == 0); // { dg-error "non-constant condition" } -// { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "unreachable" } +// { dg-error "assert_fail" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc index f46fe40f929..257b043c969 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc @@ -31,5 +31,4 @@ front() static_assert(front() != 'a'); // { dg-error "non-constant condition" } -// { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "unreachable" } +// { dg-error "assert_fail" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc index c40b2f1cba6..3ad9cea2600 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc @@ -31,5 +31,4 @@ back() static_assert(back() != L'a'); // { dg-error "non-constant condition" } -// { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "unreachable" } +// { dg-error "assert_fail" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc index 46c56e7a956..ec676d7d1f9 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc @@ -30,5 +30,4 @@ test() static_assert(test() == 0); // { dg-error "non-constant condition" } -// { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "unreachable" } +// { dg-error "assert_fail" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc index 89367e8144b..c3ee7ffbf40 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc @@ -31,5 +31,4 @@ front() static_assert(front() != L'a'); // { dg-error "non-constant condition" } -// { dg-prune-output "in 'constexpr' expansion" } -// { dg-prune-output "unreachable" } +// { dg-error "assert_fail" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/debug.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/debug.cc index 37204583b71..87a96600723 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/debug.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/debug.cc @@ -7,7 +7,7 @@ check_remove_prefix() { std::string_view sv("123"); sv.remove_prefix(4); - // { dg-error "not a constant expression" "" { target *-*-* } 0 } + // { dg-error "assert_fail" "" { target *-*-* } 0 } return true; } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/debug.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/debug.cc index a549e4c2471..513aa8ce28a 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/debug.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/debug.cc @@ -7,7 +7,7 @@ check_remove_suffix() { std::string_view sv("123"); sv.remove_suffix(4); - // { dg-error "not a constant expression" "" { target *-*-* } 0 } + // { dg-error "assert_fail" "" { target *-*-* } 0 } return true; } diff --git a/libstdc++-v3/testsuite/23_containers/span/back_neg.cc b/libstdc++-v3/testsuite/23_containers/span/back_neg.cc index dce512aa1c8..494964be130 100644 --- a/libstdc++-v3/testsuite/23_containers/span/back_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/back_neg.cc @@ -30,5 +30,5 @@ test01(bool b) static_assert(test01(false)); static_assert(test01(true)); // { dg-error "non-constant" } -// { dg-error "unreachable" "" { target *-*-* } 0 } -// { dg-prune-output "in 'constexpr' expansion" } +// { dg-error "assert_fail" "" { target *-*-* } 0 } +// { dg-prune-output "called in a constant expression" } diff --git a/libstdc++-v3/testsuite/23_containers/span/front_neg.cc b/libstdc++-v3/testsuite/23_containers/span/front_neg.cc index b2c5e9cae32..29fe3f03c9a 100644 --- a/libstdc++-v3/testsuite/23_containers/span/front_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/front_neg.cc @@ -30,5 +30,5 @@ test01(bool b) static_assert(test01(false)); static_assert(test01(true)); // { dg-error "non-constant" } -// { dg-error "unreachable" "" { target *-*-* } 0 } -// { dg-prune-output "in 'constexpr' expansion" } +// { dg-error "assert_fail" "" { target *-*-* } 0 } +// { dg-prune-output "called in a constant expression" } diff --git a/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc b/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc index a2cdb8a44c7..8a3e3e9b70d 100644 --- a/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc @@ -30,5 +30,5 @@ test01(bool b) static_assert(test01(false)); static_assert(test01(true)); // { dg-error "non-constant" } -// { dg-error "unreachable" "" { target *-*-* } 0 } -// { dg-prune-output "in 'constexpr' expansion" } +// { dg-error "assert_fail" "" { target *-*-* } 0 } +// { dg-prune-output "called in a constant expression" } diff --git a/libstdc++-v3/testsuite/26_numerics/lcm/105844.cc b/libstdc++-v3/testsuite/26_numerics/lcm/105844.cc index d853974f77e..65a999c3e05 100644 --- a/libstdc++-v3/testsuite/26_numerics/lcm/105844.cc +++ b/libstdc++-v3/testsuite/26_numerics/lcm/105844.cc @@ -21,4 +21,4 @@ constexpr int e = std::lcm(500000u, 499999); // { dg-error "in .constexpr." } constexpr int f = std::lcm(499999u, 500000); // { dg-error "in .constexpr." } // { dg-error "overflow" "" { target *-*-* } 0 } -// { dg-error "unreachable" "" { target *-*-* } 0 } +// { dg-error "assert_fail" "" { target *-*-* } 0 }