Skip to content

Clang rejects valid program involving evaluation of this in constexpr context #90052

@ranaanoop

Description

@ranaanoop

The following valid program is rejected by clang: Demo

struct X
{
  const void *p_;

  consteval X()
    : p_{this}
  {
  }
};

static constexpr X x{};

The bug was first reported here: https://stackoverflow.com/questions/78381492/is-the-address-of-a-consteval-constructed-object-a-constant-expression

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions