Skip to content

[Clang] Invalid VLA is not rejected in constant evaluation #116430

Open
@Sirraide

Description

@Sirraide

With -std=c++23, this compiles, even though it really shouldn’t (https://godbolt.org/z/xKjPEP34s):

consteval int foo(int n) {
    int x[n];
    return 12;
}

static_assert(foo(-1));

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepts-invalidc++23clang: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