Silence warning about unnecessary lambda captures with clang
The `unused-lambda-capture` will be triggered by the following code:
```cpp
void foo(int);
int main() {
const int i = 0;
auto l = [i](){foo(i);};
}
```
The issue here is that reading from the constant variable `i` does not
constitute an ODR-use, and consequently the variable does not have to be
captured. See
https://github.com/llvm/llvm-project/issues/34213#issuecomment-980987311
for a related discussion.
However, MSVC sees it differently.
In order to make both compilers happy, mark this variable with
`AZ_UNUSED`, since lambda captures can't be marked with attributes like
`[[maybe_unused]]`.
Signed-off-by: Chris Burel <burelc@amazon.com>
monroegm-disable-blank-issue-2
parent
be785dbae8
commit
41be03f193
Loading…
Reference in New Issue