Date: Tue, 24 Mar 2026 01:06:37 +0000
On Tue, 24 Mar 2026, 00:34 Halalaluyafail3 via Std-Proposals, <
std-proposals_at_[hidden]> wrote:
> N5032 Section 16.3.2.4 "Detailed specifications" [structure.specifications]
> Paragraph 3:
> > Mandates: the conditions that, if not met, render the program ill-formed.
>
> Consider the following program:
>
> #include<bit>
> decltype(std::bit_cast<void*>(^^::))x;
>
> Assume sizeof(void*)==sizeof(^^::) is true. Is this program ill-formed? It
> would
> seem that is the case, but existing implementations do not reject this.
You haven't instantiated the function template. The return type is clearly
void* so checking it without odr-using the function might works, but is
kinda dumb.
In an uninstantiated template the condition is not necessarily checked.
The
> example that follows the quoted text suggests that two possible
> implementations
> of mandates are static_asserts and deleted overloads. For uses of mandates
> outside of templates it seems like deleting the function is the only way to
> implement the mandate.
Why?
For uses of mandates inside of templates both options
> would be valid, and create differences in the validity of programs such the
> program above. Was it intended for both possibilities to be valid, or was
> it
> intended for this program to assuredly be ill-formed or well-formed?
>
I don't think it matters. If it mattered and the condition was supposed to
be SFINAE testable, it would use Constraints not Mandates.
Why would you ever need the code above to be portable?
> It seems like the uses of Mandates for the purposes of specifying deletion
> could
> be split up into a new "Deleted When" element, if the intent was to
> require one
> form be used. For example text_encoding uses mandates to require
> CHAR_BIT==8,
> that could realistically only be implemented as a deleted overload. Would
> it
> make sense to open a LWG issue for this?
>
I don't see a defect here.
std-proposals_at_[hidden]> wrote:
> N5032 Section 16.3.2.4 "Detailed specifications" [structure.specifications]
> Paragraph 3:
> > Mandates: the conditions that, if not met, render the program ill-formed.
>
> Consider the following program:
>
> #include<bit>
> decltype(std::bit_cast<void*>(^^::))x;
>
> Assume sizeof(void*)==sizeof(^^::) is true. Is this program ill-formed? It
> would
> seem that is the case, but existing implementations do not reject this.
You haven't instantiated the function template. The return type is clearly
void* so checking it without odr-using the function might works, but is
kinda dumb.
In an uninstantiated template the condition is not necessarily checked.
The
> example that follows the quoted text suggests that two possible
> implementations
> of mandates are static_asserts and deleted overloads. For uses of mandates
> outside of templates it seems like deleting the function is the only way to
> implement the mandate.
Why?
For uses of mandates inside of templates both options
> would be valid, and create differences in the validity of programs such the
> program above. Was it intended for both possibilities to be valid, or was
> it
> intended for this program to assuredly be ill-formed or well-formed?
>
I don't think it matters. If it mattered and the condition was supposed to
be SFINAE testable, it would use Constraints not Mandates.
Why would you ever need the code above to be portable?
> It seems like the uses of Mandates for the purposes of specifying deletion
> could
> be split up into a new "Deleted When" element, if the intent was to
> require one
> form be used. For example text_encoding uses mandates to require
> CHAR_BIT==8,
> that could realistically only be implemented as a deleted overload. Would
> it
> make sense to open a LWG issue for this?
>
I don't see a defect here.
Received on 2026-03-24 01:06:54
