//===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // // shared_ptr // template shared_ptr make_shared(Args&&... args); #include #include #include "test_macros.h" template void test(const T &t0) { { T t1 = t0; std::shared_ptr p0 = std::make_shared(t0); std::shared_ptr p1 = std::make_shared(t1); assert(*p0 == t0); assert(*p1 == t1); } { const T t1 = t0; std::shared_ptr p0 = std::make_shared(t0); std::shared_ptr p1 = std::make_shared(t1); assert(*p0 == t0); assert(*p1 == t1); } { volatile T t1 = t0; std::shared_ptr p0 = std::make_shared(t0); std::shared_ptr p1 = std::make_shared(t1); assert(*p0 == t0); assert(*p1 == t1); } { const volatile T t1 = t0; std::shared_ptr p0 = std::make_shared(t0); std::shared_ptr p1 = std::make_shared(t1); assert(*p0 == t0); assert(*p1 == t1); } } int main(int, char**) { test(true); test(3); test(5.0); return 0; }