1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: no-threads
10 
11 // This test ensures that we don't hijack the <stdatomic.h> header even when compiling
12 // before C++23, since Clang used to provide that header before libc++ provided one.
13 
14 // On GCC, the compiler-provided <stdatomic.h> is not C++ friendly, so including <stdatomic.h>
15 // doesn't work at all if we don't use the <stdatomic.h> provided by libc++ in C++23 and above.
16 // XFAIL: (c++11 || c++14 || c++17 || c++20) && gcc
17 
18 #include <stdatomic.h>
19 
f()20 void f() {
21   atomic_int i; // just make sure the header isn't empty
22   (void)i;
23 }
24