Skip to content

[clang] Regression in lambda return type inference #153884

@ojhunt

Description

@ojhunt

I've found a regression in the return type inference in lambda expressions that seems fairly severe

int v;
bool foo() {
  auto init = [](auto) { return true; };
  if constexpr (0)
    return init(v);
  return false;
}

This compiles in clang20 and gcc, but not in main.

I believe it to be broken in clang21 as well, but I'm not sure if I was building the correct branch so will need to re-test.

Pre-emptively tagging as a 21 regression as I am reasonably certain that it does repro and want people to see this in case they have any immediate ideas of what might be the cause before I start looking at this myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partylambdaC++11 lambda expressionsregression:21Regression in 21 releaserejects-valid

    Type

    Projects

    Status

    Done

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions