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// <memory>
10
11// unique_ptr
12
13// unique_ptr<T, const D&>(pointer, D()) should not compile
14
15#include <memory>
16
17struct Deleter {
18 void operator()(int* p) const { delete p; }
19};
20
21int main(int, char**) {
22 // expected-error@+1 {{call to deleted constructor of 'std::unique_ptr<int, const Deleter &>}}
23 std::unique_ptr<int, const Deleter&> s((int*)nullptr, Deleter());
24
25 return 0;
26}
27

source code of libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.verify.cpp