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 | // [inout.ptr], function template inout_ptr |
14 | // template<class Pointer = void, class Smart, class... Args> |
15 | // auto inout_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::inout_ptr<>` does not support `std::shared_ptr<>`. |
24 | { |
25 | std::shared_ptr<int> sPtr; |
26 | |
27 | // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}std::shared_ptr<> is not supported}} |
28 | std::ignore = std::inout_ptr(sPtr); |
29 | // expected-error-re@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::inout_ptr_t<{{(std::)?}}shared_ptr<int>, _Ptr>'{{( \(aka 'inout_ptr_t<std::shared_ptr<int>, int *>')?}}}} |
30 | std::ignore = std::inout_ptr<int*>(sPtr); |
31 | } |
32 | |
33 | return 0; |
34 | } |
35 | |