public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
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
Date: Fri, 15 Sep 2023 23:02:46 +0000 (GMT) [thread overview]
Message-ID: <20230915230246.CBA7C3858D33@sourceware.org> (raw)
https://gcc.gnu.org/g:038c0afa893f8cb2277ff44be3e2c09cfab4bc0c
commit r14-4045-g038c0afa893f8cb2277ff44be3e2c09cfab4bc0c
Author: Jonathan Wakely <jwakely@redhat.com>
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 <bits/stdc++.h> PCH
includes <stdatomic.h> which declares ::memory_order, invalidating the
test's assumptions. Disable PCH so that the test verifies that <atomic>
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:
---
| 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--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 <bits/stdc++.h> includes <stdatomic.h> 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" }
reply other threads:[~2023-09-15 23:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230915230246.CBA7C3858D33@sourceware.org \
--to=redi@gcc.gnu.org \
--cc=gcc-cvs@gcc.gnu.org \
--cc=libstdc++-cvs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).