[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
Mon May 9 17:54:49 PDT 2022


cjdb created this revision.
cjdb added reviewers: EricWF, ldionne.
Herald added a project: All.
cjdb requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

[rand.req.genl/p1.5][1] states that template type parameters with the
name `IntType` are undefined if the type isn't an integer of at least
two bytes. It does not state that a program is ill-formed. This means
that it's a conforming extension for libc++ to support single-byte
integer types.

libc++ has supported this extension at least as far back as Clang 5,
regardless of developer intentions. As such, we're subject to Hyrum's
Law, and D114920 <https://reviews.llvm.org/D114920> has unnecessarily and unforgivingly broken a fair
amount of user code. If libc++ has a genuine reason not to support
this extension, it should deprecate the extension and provide users with
both an explanation and a deadline, instead of abruptly flipping a
switch.

This reverts commit a3255f219a861fd91423def693e1b3ab3e012bec <https://reviews.llvm.org/rGa3255f219a861fd91423def693e1b3ab3e012bec>.

[1]: http://eel.is/c++draft/rand#req.genl-1.5


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125283

Files:
  libcxx/docs/ReleaseNotes.rst
  libcxx/include/__random/binomial_distribution.h
  libcxx/include/__random/discrete_distribution.h
  libcxx/include/__random/geometric_distribution.h
  libcxx/include/__random/is_valid.h
  libcxx/include/__random/negative_binomial_distribution.h
  libcxx/include/__random/poisson_distribution.h
  libcxx/include/__random/uniform_int_distribution.h
  libcxx/include/module.modulemap
  libcxx/test/libcxx/numerics/rand/rand.req.urng/valid_int_type.verify.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125283.428249.patch
Type: text/x-patch
Size: 9151 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220510/92d3c03d/attachment-0001.bin>


More information about the libcxx-commits mailing list