Skip to content

const_buffer/mutable_buffer constructors aren't usable in constant expressions (pre-C++26) #353

Description

@ashtum

The const_buffer and mutable_buffer constructors are marked constexpr, but they cannot actually be evaluated in a constant expression before C++26.

The classes store the pointer as unsigned char const*, so the constructor must do:

p_(static_cast<unsigned char const*>(data))

Casting a void const* to unsigned char const* is not allowed in a constant expression before C++26 (P2738R1).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions