Skip to content

[Clang] Requires expression incorrectly use non-static methods from generic lambda inside static method #110785

Closed
@ksh4699

Description

@ksh4699

Compiler Explorer: https://godbolt.org/z/66397fTff

struct Foo {
    static void f(auto) requires(false) {}
    void f(int) {}

    static void g() {
        static constexpr auto b = [](auto v) {
            return requires { f(v); };
        } (0);
        static_assert(b == false);
    }
};

Clang versions <= 18 and other compilers accept this program. The requires expression should be false, since f(0) is ill-formed in the context inside the lambda.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsconfirmedVerified by a second partydiverges-from:edgDoes the clang frontend diverge from edg compilerdiverges-from:gccDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueregression:19Regression in 19 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions