https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125624

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
In C++23 and earlier standards, [rand.req.genl] says:

"the effect of instantiating a template:
 that has a template type parameter named RealType is undefined unless the
corresponding template argument is cv-unqualified and is one of float, double,
or long double."

So std::uniform_real_distribution<std::float16_t> is very explicitly undefined
behaviour.

C++26 changes this to:

If a template argument corresponding to a template parameter named RealType is
neither a standard floating-point type (6.9.2) nor a member of an
implementation-defined subset of extended floating-point types, the program is
ill-formed.

However, libstdc++ does not support this yet.


What you're trying to do is undefined behaviour, concepts and requires-clauses
can't help you.

Reply via email to