| 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 |
|
| 17 |
struct Deleter { |
| 18 |
void operator()(int* p) const { delete p; } |
| 19 |
}; |
| 20 |
|
| 21 |
int 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 |
} |