27 lines · cpp
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-exception5//6//===----------------------------------------------------------------------===//7 8// UNSUPPORTED: c++03, c++11, c++14, c++179 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 19void trivially_copyable() {20 struct X {21 X() = default;22 X(X const&) {} // -> not trivially copyable23 } 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}27