google / google/googletest

PrintTo fails for std::unique_ptr<T, D> when D::pointer is not a pointer type

Open
#3,524 1 comment 0 reactions 1 assignee Claimed by @asoffer View on GitHub
bug
Dominant language
C++
Stars
39.6k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

**Describe the bug**

See the title

**Steps to reproduce the bug**

```
template
struct nullable_handle
{
constexpr nullable_handle() noexcept = default;

explicit(false) constexpr nullable_handle(std::nullptr_t) noexcept
{
}

template U>
explicit(false) constexpr nullable_handle(U const value) noexcept
: value(value)
{
}

constexpr explicit operator bool() const noexcept
{
return !!value;
}

[[nodiscard]] constexpr bool operator==(nullable_handle const&) const noexcept = default;

T value {};
};

struct deleter
{
using pointer = nullable_handle;
void operator()(pointer) const noexcept
{
// custom deleter code
}
};

std::unique_ptr p {};

```

**Does the bug persist in the most recent commit?**

Yes

**What operating system and version are you using?**

Win10 latest

**What compiler and version are you using?**

MSVC 16.11.4

**What build system are you using?**

MSBUILD

**Additional context**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.