| 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, c++20 |
| 10 | |
| 11 | // <memory> |
| 12 | |
| 13 | // [out.ptr], function template out_ptr |
| 14 | // template<class Pointer = void, class Smart, class... Args> |
| 15 | // auto out_ptr(Smart& s, Args&&... args); // since c++23 |
| 16 | |
| 17 | #include <memory> |
| 18 | #include <tuple> |
| 19 | |
| 20 | #include "../types.h" |
| 21 | |
| 22 | int main(int, char**) { |
| 23 | // `std::out_ptr<>` requires `std::shared_ptr<>` with a deleter. |
| 24 | { |
| 25 | std::shared_ptr<int> sPtr; |
| 26 | |
| 27 | // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Using std::shared_ptr<> without a deleter in std::out_ptr is not supported.}} |
| 28 | std::ignore = std::out_ptr(sPtr); |
| 29 | // expected-error-re@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::out_ptr_t<{{(std::)?}}shared_ptr<int>, _Ptr>'{{( \(aka 'out_ptr_t<std::shared_ptr<int>, int *>'\))?}}}} |
| 30 | std::ignore = std::out_ptr<int*>(sPtr); |
| 31 | } |
| 32 | |
| 33 | return 0; |
| 34 | } |
| 35 | |