| 1 |
// |
| 2 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 3 |
// See https://llvm.org/LICENSE.txt for license information. |
| 4 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 5 |
// |
| 6 |
//===----------------------------------------------------------------------===// |
| 7 |
|
| 8 |
// UNSUPPORTED: c++03, c++11, c++14, c++17 |
| 9 |
|
| 10 |
// <atomic_ref> |
| 11 |
|
| 12 |
// template<class T> |
| 13 |
// class atomic_ref; |
| 14 |
|
| 15 |
// The program is ill-formed if is_trivially_copyable_v<T> is false. |
| 16 |
|
| 17 |
#include <atomic> |
| 18 |
|
| 19 |
void trivially_copyable() { |
| 20 |
struct X { |
| 21 |
X() = default; |
| 22 |
X(X const&) {} // -> not trivially copyable |
| 23 |
} x; |
| 24 |
// expected-error-re@*:* {{static assertion failed {{.*}}atomic_ref<T> requires that 'T' be a trivially copyable type}} |
| 25 |
std::atomic_ref<X> r(x); |
| 26 |
} |