[PATCH] D119136: [clang] Implement Change scope of lambda trailing-return-type
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 14 03:17:54 PDT 2022
cor3ntin added a comment.
> Presumably we should be parsing the attribute in the enclosing context rather than in the half-way-inside-the-lambda context in which we parse parameters?
That's a good question.
void f() {
int y;
(void)[=, x = 1]()
__attribute__((diagnose_if(!is_same<decltype((y)), int&>, "wrong type", "warning"))) // do we want this to work?
__attribute__((diagnose_if(x != 1, "wrong type", "warning"))) // do we want this to work?
mutable {}();
}
I think we *probably* want both of this to compile and evaluate the conditions consistently with the new rule for trailing return type/`requires`/`noexcept` specifier (in that case triggering no warning).
So the consistent approach would be to parse them in the context of the call operator, once the captures and their type is known.
Is there any reason we should not be consistent with the spirit of the c++ spec here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119136/new/
https://reviews.llvm.org/D119136
More information about the cfe-commits
mailing list