[Clang][Regression:21] Rejects valid lambda invocation in constexpr if (original) (raw)

The following C++17 code should be valid:

template auto f{[] (auto...) { if constexpr ([] (auto) { return true; }(0)) return 0; }};

int main() { f(); }

Error since Clang 21:

:3:19: error: no matching function for call to object of type '(lambda at :3:19)' 3 | if constexpr ([] (auto) { return true; }(0)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ :2:21: note: while substituting into a lambda expression here 2 | auto f{[] (auto...) { | ^ :8:5: note: in instantiation of variable template specialization 'f' requested here 8 | f(); | ^ :3:19: note: candidate template ignored: couldn't infer template argument 'auto:1' 3 | if constexpr ([] (auto) { return true; }(0)) |

See https://compiler-explorer.com/z/Kx5qWPev7.