]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 29_atomics / headers / atomic / types_std_c++2a_neg.cc
1 // { dg-do compile { target c++20 } }
2 // Disable PCH because <bits/stdc++.h> includes <stdatomic.h> which declares
3 // memory_order in the global namespace.
4 // { dg-add-options no_pch }
5
6 // Copyright (C) 2019-2024 Free Software Foundation, Inc.
7 //
8 // This file is part of the GNU ISO C++ Library. This library is free
9 // software; you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 3, or (at your option)
12 // any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License along
20 // with this library; see the file COPYING3. If not see
21 // <http://www.gnu.org/licenses/>.
22
23 #include <atomic>
24
25 void test01()
26 {
27 // Not global scoped, only namespace std.
28 using ::memory_order; // { dg-error "has not been declared" }
29 constexpr auto relaxed = memory_order::relaxed; // { dg-error "has not been declared" }
30 constexpr auto consume = memory_order::consume; // { dg-error "has not been declared" }
31 constexpr auto acquire = memory_order::acquire; // { dg-error "has not been declared" }
32 constexpr auto release = memory_order::release; // { dg-error "has not been declared" }
33 constexpr auto acq_rel = memory_order::acq_rel; // { dg-error "has not been declared" }
34 constexpr auto seq_cst = memory_order::seq_cst; // { dg-error "has not been declared" }
35 }