From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id CBA7C3858D33; Fri, 15 Sep 2023 23:02:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CBA7C3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694818966; bh=XvggT9kZE8z5VGOGKP8w0BvO5ZZ6sQtN+umP/GR7DZc=; h=From:To:Subject:Date:From; b=ldiB5ZBgW59fLxW7EcFu0Y3exjGBDyrlRWhbldQE8s9TZPFtFLbKUC1bn1aVxdKhN csUNekc3O3q0eYPEk+PzBIp1HF4mrI7N1wtTjV1l5YX6DKHBcnBEdo4UeU+2Ub+3nW /3MubxsljSdzUN54ynx5DaG5T0oBMod7URaWhZHA= 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 r14-4045] libstdc++: Fix 29_atomics/headers/atomic/types_std_c++2a_neg.cc for C++23 X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: d7b6020276a843e97f6135259b4ab3b53a5850e2 X-Git-Newrev: 038c0afa893f8cb2277ff44be3e2c09cfab4bc0c Message-Id: <20230915230246.CBA7C3858D33@sourceware.org> Date: Fri, 15 Sep 2023 23:02:46 +0000 (GMT) List-Id: https://gcc.gnu.org/g:038c0afa893f8cb2277ff44be3e2c09cfab4bc0c commit r14-4045-g038c0afa893f8cb2277ff44be3e2c09cfab4bc0c Author: Jonathan Wakely Date: Fri Sep 15 21:37:46 2023 +0100 libstdc++: Fix 29_atomics/headers/atomic/types_std_c++2a_neg.cc for C++23 This test fails when run as C++23 because the PCH includes which declares ::memory_order, invalidating the test's assumptions. Disable PCH so that the test verifies that doesn't declare ::memory_order, as originally intended. Also fix the using-declaration which would be invalid even if the type was declared in the global namespace, and adjust the expected error. libstdc++-v3/ChangeLog: * testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc: Fix test to work for C++23 and C++26 too. Diff: --- .../testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc index 8eba8bfd779..65199ce15e5 100644 --- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc @@ -1,5 +1,8 @@ // { dg-options "-std=gnu++2a" } -// { dg-do compile { target c++2a } } +// { dg-do compile { target c++20 } } +// Disable PCH because includes which declares +// memory_order in the global namespace. +// { dg-add-options no_pch } // Copyright (C) 2019-2023 Free Software Foundation, Inc. // @@ -23,7 +26,7 @@ void test01() { // Not global scoped, only namespace std. - using memory_order; // { dg-error "expected nested-name-specifier" } + using ::memory_order; // { dg-error "has not been declared" } constexpr auto relaxed = memory_order::relaxed; // { dg-error "has not been declared" } constexpr auto consume = memory_order::consume; // { dg-error "has not been declared" } constexpr auto acquire = memory_order::acquire; // { dg-error "has not been declared" }