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: c++03, c++11, c++14, c++17 10 11 // <atomic> 12 13 // explicit atomic_ref(T&); 14 15 #include <atomic> 16 #include <type_traits> 17 18 #include "atomic_helpers.h" 19 #include "test_macros.h" 20 21 template <typename T> 22 struct TestCtor { operator ()TestCtor23 void operator()() const { 24 // check that the constructor is explicit 25 static_assert(!std::is_convertible_v<T, std::atomic_ref<T>>); 26 static_assert(std::is_constructible_v<std::atomic_ref<T>, T&>); 27 28 T x(T(0)); 29 std::atomic_ref<T> a(x); 30 (void)a; 31 } 32 }; 33 main(int,char **)34int main(int, char**) { 35 TestEachAtomicType<TestCtor>()(); 36 return 0; 37 } 38