Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[libc++][test] Precondition violation in rand.dist.uni.real/param_ctor.pass.cpp #100506

Copy link
Copy link
Open
@StephanTLavavej

Description

@StephanTLavavej
Issue body actions

typedef std::uniform_real_distribution<float> D;
typedef D::param_type param_type;
param_type p(5);
assert(p.a() == 5);
assert(p.b() == 1);

This violates the Standard's preconditions, and MSVC's STL asserts about it. The Standardese is N4986 [rand.req.dist]/9:

For each of the constructors of D taking arguments corresponding to parameters of the distribution, P shall have a corresponding constructor subject to the same requirements and taking arguments identical in number, type, and default values.

And [rand.dist.uni.real]/2:

explicit uniform_real_distribution(RealType a, RealType b = 1.0);
Preconditions: a <= b and b - a <= numeric_limits<RealType>::max().

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.randomtest-suite

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.