Skip to content

forming reference to nullptr is not rejected in constexpr #48665

@ldalessa

Description

@ldalessa
Bugzilla Link 49321
Version trunk
OS All
CC @randomnetcat,@zygoloid

Extended Description

I think this UB should be rejected.

constexpr bool foo(int* i) {
    int& j = *i;
    return true;
}

static_assert(foo(nullptr));

https://godbolt.org/z/cKo3jf

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepts-invalidbugzillaIssues migrated from bugzillac++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyconstexprAnything related to constant evaluation

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions