Issue 134193
Summary Clang behaves different with other compilers for constraint nested lambdas
Labels clang:frontend, concepts
Assignees
Reporter zyn0217
    Both were discovered in #133719, but the underlying causes are different from the original issue so I filed a separate one to track these.

1. The following code causes clang to crash, dating back to Clang 16 and up to trunk:

```cpp
template <class T>
constexpr auto f{[] (auto arg) {
 return [a{arg}] {
        [] () requires (a == 1) {}();
    };
}};

int main() {
 f<int>(0);
}
```

https://compiler-explorer.com/z/Tq9xzrPns

2. Clang accepts the following code, while others don't (discovered by @shafik)

```cpp

void f() {
    auto f{ 
      [](auto arg) {
 return [a = arg]() 
          requires (a == 1)
         { return a;};
 }
    };

 f(10);
}

```

https://godbolt.org/z/ncYx8q9f6

This has started since Clang 16.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to