[clang] [clang][Sema] Skip the RequiresExprBodyDecls for lambda dependencies (PR #83997)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 19:06:44 PDT 2024


zyn0217 wrote:

> I have a reduced test case, which is accepted by clang 18, but fails with this patch: https://gcc.godbolt.org/z/zMbKvsf7K
> A bit more compact one: https://gcc.godbolt.org/z/4rzYPKaze

Your case is rejected by all mainstream compilers as of now: https://gcc.godbolt.org/z/nrMf3zvfY
Again, it was an accept-invalid before because of the constant evaluation on dependent expressions, which **is** an assertion failure if you compile it with debug mode. https://gcc.godbolt.org/z/eascd7j1G

To clarify why the requirement should be evaluated to false:

> The enclosing _requires-expression_ will evaluate to false if substitution of template arguments into the expression fails.

https://eel.is/c++draft/expr.prim.req#simple-1.sentence-2


https://github.com/llvm/llvm-project/pull/83997


More information about the cfe-commits mailing list