| 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 |
| 10 |
|
| 11 |
// <memory> |
| 12 |
|
| 13 |
// unique_ptr |
| 14 |
|
| 15 |
// The following constructors should not be selected by class template argument |
| 16 |
// deduction: |
| 17 |
// |
| 18 |
// constexpr explicit unique_ptr(pointer p) // constexpr since C++23 |
| 19 |
// constexpr unique_ptr(pointer p, const D& d) noexcept // constexpr since C++23 |
| 20 |
// constexpr unique_ptr(pointer p, remove_reference_t<D>&& d) noexcept // constexpr since C++23 |
| 21 |
|
| 22 |
#include <memory> |
| 23 |
|
| 24 |
#include "deduction_guides_sfinae_checks.h" |
| 25 |
|
| 26 |
struct Deleter { |
| 27 |
void operator()(int* p) const { delete p; } |
| 28 |
}; |
| 29 |
|
| 30 |
int main(int, char**) { |
| 31 |
// Cannot deduce from (ptr). |
| 32 |
static_assert(SFINAEs_away<std::unique_ptr, int*>); |
| 33 |
// Cannot deduce from (array). |
| 34 |
static_assert(SFINAEs_away<std::unique_ptr, int[]>); |
| 35 |
// Cannot deduce from (ptr, Deleter&&). |
| 36 |
static_assert(SFINAEs_away<std::unique_ptr, int*, Deleter&&>); |
| 37 |
// Cannot deduce from (array, Deleter&&). |
| 38 |
static_assert(SFINAEs_away<std::unique_ptr, int[], Deleter&&>); |
| 39 |
// Cannot deduce from (ptr, const Deleter&). |
| 40 |
static_assert(SFINAEs_away<std::unique_ptr, int*, const Deleter&>); |
| 41 |
// Cannot deduce from (array, const Deleter&). |
| 42 |
static_assert(SFINAEs_away<std::unique_ptr, int[], const Deleter&>); |
| 43 |
|
| 44 |
return 0; |
| 45 |
} |