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).

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