[clang] [Clang] SemaFunctionEffects: Fix bug where lambdas produced by template expansion weren't verified. (PR #116505)
Doug Wyatt via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 16 14:58:05 PST 2024
dougsonos wrote:
Thanks for the quick look.
> Ah yeah, I should have noticed that in review: `ActOnX` is generally only called during parsing, whereas `BuildX` is also called during template instantiation.
I actually do think it might have come up early in one of the giant reviews, but gotten lost amongst the bigger issues.
> Also, we _do_ have tests for function templates and generic lambdas, right? If not, we should definitely add some.
Something like:
```c++
template <typename T>
void TemplatedFunc(T x) [[clang::nonblocking]] {
auto* ptr = new T; // expected-warning {{function with 'nonblocking' attribute must not allocate or deallocate memory}}
}
template <typename T>
auto TemplatedLambda = [](T x) [[clang::nonblocking]] {
auto* ptr = new T; // expected-warning {{lambda with 'nonblocking' attribute must not allocate or deallocate memory}}
};
void nb9b() [[clang::nonblocking]] {
TemplatedFunc(42); // expected-note {{in template expansion here}}
TemplatedLambda<int>(42);
}
```
?
https://github.com/llvm/llvm-project/pull/116505
More information about the cfe-commits
mailing list