Skip to content

Parts of std::numeric_limits<_BitInt(N)> broken #130584

Open
@QrczakMK

Description

@QrczakMK

std::numeric_limits<_BitInt(N)>::digits and std::numeric_limits<unsigned _BitInt(N)>::digits use sizeof to infer the range, and thus yield incorrect results if there are padding bits.

This causes std::numeric_limits<_BitInt(N)>::min() and max() to fail the build if there are padding bits, because they try to constexpr-compute a value which does not fit in the type.

Demo: https://godbolt.org/z/4bbb6YaPa

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++extension:clanglibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions