public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/96731] uniform_int_distribution requirement that its type is_integral is too strict
Date: Wed, 26 Aug 2020 19:15:10 +0000 [thread overview]
Message-ID: <bug-96731-4-vDbohUlY2J@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96731-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96731
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 49135
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49135&action=edit
Patch to relax std::uniform_int_distribution requirements
This patch allows a custom integer-like type to be used with
std::uniform_int_distribution, but it's harder than it seems.
We need to use std::make_unsigned, which is undefined for non-integral types.
The patch will use _IntType is numeric_limits<_IntType>::is_signed is false,
otherwise it will use make_unsigned_t<_IntType> if possible, and unsigned long
long otherwise.
But the example still fails, because std::sample also requires an integral
type, and also wants to use make_unsigned. And the standard is clear that it's
not just undefined, but ill-formed and requires a diagnostic:
> Mandates: For the overload in namespace std, Distance is an integer type
I don't plan to work on this any further for now.
next prev parent reply other threads:[~2020-08-26 19:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 6:19 [Bug libstdc++/96731] New: " TonyELewis at hotmail dot com
2020-08-21 8:52 ` [Bug libstdc++/96731] " redi at gcc dot gnu.org
2020-08-21 8:55 ` redi at gcc dot gnu.org
2020-08-24 6:44 ` TonyELewis at hotmail dot com
2020-08-26 19:15 ` redi at gcc dot gnu.org [this message]
2020-09-04 10:39 ` TonyELewis at hotmail dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-96731-4-vDbohUlY2J@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).