[Clang] Explicit conversion from a class implicitly convertible to `nullptr_t` to `bool`
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Currently, only Clang accepts the following example. [Godbolt link](https://godbolt.org/z/9TfWG8ad5).
```C++
struct CwNullptr {
operator decltype(nullptr)() const { return {}; }
};
[[maybe_unused]] bool b(CwNullptr{});
```
I _guess_ this example ill-formed per the question in [CWG1781](https://cplusplus.github.io/CWG/issues/1781.html). However, Clang hasn't claim having implemented CWG1781 and there doesn't seem a test for this.
Contributor guide
Research direction
Start with the C++ example in the issue, compare its behavior with the question in CWG1781, and reproduce it using the linked Godbolt example. Inspect Clang's existing conversion diagnostics and tests to determine the expected behavior; done means the implementation matches the standard interpretation and a regression test covers this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100