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// XFAIL: FROZEN-CXX03-HEADERS-FIXME
10
11// <atomic>
12
13// template <class T>
14// struct atomic;
15
16#include <atomic>
17
18struct NotTriviallyCopyable {
19 explicit NotTriviallyCopyable(int i) : i_(i) {}
20 NotTriviallyCopyable(const NotTriviallyCopyable& rhs) : i_(rhs.i_) {}
21 int i_;
22};
23
24void f() {
25 NotTriviallyCopyable x(42);
26 std::atomic<NotTriviallyCopyable> a(
27 x); // expected-error@*:* {{std::atomic<T> requires that 'T' be a trivially copyable type}}
28}
29

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of libcxx/test/std/atomics/atomics.types.generic/trivially_copyable.verify.cpp