Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion libcxx/include/stdatomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ using std::atomic_signal_fence // see below
# undef _Atomic
# endif

# define _Atomic(_Tp) ::std::atomic<_Tp>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
using __libcpp_atomic_alias _LIBCPP_NODEBUG = atomic<_Tp>;
_LIBCPP_END_NAMESPACE_STD

# define _Atomic(_Tp) ::std::__libcpp_atomic_alias<_Tp>

using std::memory_order _LIBCPP_USING_IF_EXISTS;
using std::memory_order_relaxed _LIBCPP_USING_IF_EXISTS;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// REQUIRES: std-at-least-c++23
// UNSUPPORTED: no-threads

// <stdatomic.h>

// template<class T>
// using std-atomic = std::atomic<T>; // exposition only
//
// #define _Atomic(T) std-atomic<T>

// Verify that _Atomic(T) directly uses an alias template but not the std::atomic class template.
// See also https://llvm.org/PR168579.

#include <stdatomic.h>

struct _Atomic(int) x;
// expected-error-re@-1{{alias template '{{.*}}' cannot be referenced with the 'struct' specifier}}
Loading