Skip to content

constexpr-unknown allows illegal pointer arithmetic #131654

Open
@efriedma-quic

Description

@efriedma-quic
constexpr int f() { int &a = a; return &a+1-&a; }
constexpr int z = f();

Currently accepted with -std=c++23. Should be rejected: the pointer arithmetic is nonsense.

CC @shafik @frederick-vs-ja

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions