[libcxx-commits] [PATCH] D125283: reverts "[libc++] Explicitly reject `uniform_int_distribution<bool>` and `<char>`."
Christopher Di Bella via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed May 11 16:28:26 PDT 2022
cjdb added a comment.
In D125283#3507460 <https://reviews.llvm.org/D125283#3507460>, @ldionne wrote:
> @cjdb @CrystalSplitter I understand your frustration with something that "used to work" and doesn't anymore. My main concern is that there must be a reason why these types are disallowed in the first place -- did you try to investigate why there was such a restriction in the Standard in the first place? If you do, perhaps we can use the result of that investigation to better inform on whether we should support that extension (or just lift it and change the Standard).
These types were never disallowed. If they were disallowed, then we would have either a _Mandates_ or _Constraints_ paragraph, or wording that uses the terms "ill-formed" or "ill-formed, no diagnostic required". We instead have "undefined", which translates to "behavior for which this document imposes no requirements //[Note 1// ... Permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, **to behaving during translation or program execution in a documented manner characteristic of the environment** (with or without the issuance of a diagnostic message)..." (emphasis mine). In other words, so long as we document the behaviour, we can define it as valid in some fashion. As it stands, the implementation of `uniform_int_distribution` is inconsistent with your concern: it is also undefined to support `__int128`, yet it's documented as being supported.
Prior to making this CL we looked at N1398, N1452, a few in the lineage of N2111, and LWG2326. None of this seems to explain why neither single-byte nor extended integral types are undefined.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125283/new/
https://reviews.llvm.org/D125283
More information about the libcxx-commits
mailing list