Date: Mon, 3 Feb 2025 21:33:03 +0100
Hello,
On 03/02/2025 20:41, Marc Edouard Gauthier via Std-Proposals wrote:
> The simplest fix appears to change this line of the standard:
>
> https://github.com/cplusplus/draft/blob/5bfd514aa5d9a19d1dd0f4e874412c210a1893ce/source/utilities.tex#L3538 <https://github.com/cplusplus/draft/blob/5bfd514aa5d9a19d1dd0f4e874412c210a1893ce/source/utilities.tex#L3538>
>
> from:
>
> !is_convertible_v<U, T>
>
> to :
>
> !is_convertible_v<U, T> || is_convertible_v<U, optional<T>>
>
> Doing the associated edit on clang/llvm and glibc implementations of
> std::optional appears to fix the issue.
>
> As a quick way to run a test suite, a similar edit of the TartanLLama
> implementation of optional https://github.com/TartanLlama/optional
> <https://github.com/TartanLlama/optional>
>
> also works, and passes its test suite.
>
I'm not sure that this actually works, and it's not IFNDR template magic
instead. In particular I'm uncomfortable with reading the value of
`is_convertible_v<U, optional<T>>`, since that depends from the very
constructor / explicit(bool) specifier in which you ask if that trait is
true...
Maybe you could ask if U has a converting operator towards optional<T>
instead. See for instance https://eel.is/c++draft/string.view#cons-12.5
for a precedent.
> Is submitting a defect report appropriate? How might we proceed?
This sounds borderline evolutionary. Maybe submit a paper to LEWG and
they can forward it straight to LWG if they think it's a defect? (It
would help if you add strong motivation on why you think it's a defect
and not a new feature.)
My 2 c,
--
Giuseppe D'Angelo
On 03/02/2025 20:41, Marc Edouard Gauthier via Std-Proposals wrote:
> The simplest fix appears to change this line of the standard:
>
> https://github.com/cplusplus/draft/blob/5bfd514aa5d9a19d1dd0f4e874412c210a1893ce/source/utilities.tex#L3538 <https://github.com/cplusplus/draft/blob/5bfd514aa5d9a19d1dd0f4e874412c210a1893ce/source/utilities.tex#L3538>
>
> from:
>
> !is_convertible_v<U, T>
>
> to :
>
> !is_convertible_v<U, T> || is_convertible_v<U, optional<T>>
>
> Doing the associated edit on clang/llvm and glibc implementations of
> std::optional appears to fix the issue.
>
> As a quick way to run a test suite, a similar edit of the TartanLLama
> implementation of optional https://github.com/TartanLlama/optional
> <https://github.com/TartanLlama/optional>
>
> also works, and passes its test suite.
>
I'm not sure that this actually works, and it's not IFNDR template magic
instead. In particular I'm uncomfortable with reading the value of
`is_convertible_v<U, optional<T>>`, since that depends from the very
constructor / explicit(bool) specifier in which you ask if that trait is
true...
Maybe you could ask if U has a converting operator towards optional<T>
instead. See for instance https://eel.is/c++draft/string.view#cons-12.5
for a precedent.
> Is submitting a defect report appropriate? How might we proceed?
This sounds borderline evolutionary. Maybe submit a paper to LEWG and
they can forward it straight to LWG if they think it's a defect? (It
would help if you add strong motivation on why you think it's a defect
and not a new feature.)
My 2 c,
--
Giuseppe D'Angelo
Received on 2025-02-03 20:33:06