Skip to content

"Assertion `!isa<ConstantExpr>(E)' failed." with compound literal #139160

Open
@efriedma-quic

Description

@efriedma-quic

Testcase:

struct A {int x[1]; };
A f();
typedef int *t[];
consteval int* f(int* x) { return x; }
int ** x = (t){f(f().x)};

Crashes with:

clang: clang/lib/AST/Expr.cpp:339: static clang::ConstantExpr *clang::ConstantExpr::Create(const clang::ASTContext &, clang::Expr *, clang::ConstantResultStorageKind, bool): Assertion `!isa<ConstantExpr>(E)' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang -x c++ - -o - -S -std=c++20
1.      <stdin>:5:25: current parser token ';'

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"crashPrefer [crash-on-valid] or [crash-on-invalid]good first issuehttps://github.com/llvm/llvm-project/contribute

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions