https://bugs.llvm.org/show_bug.cgi?id=41211
Bug ID: 41211
Summary: -Wunused-lambda-capture too strict with variadic usage
Product: clang
Version: 8.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: jva...@gmail.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
Reproduction on compiler explorer: https://godbolt.org/z/hJHQui
error: lambda capture 'i' is not used [-Werror,-Wunused-lambda-capture]
In the example below, we get a compiler warning on 'unused' lambda capture 'i'.
when changing the call to f from 'f<>' to 'f<int>', the warning goes away.
When removing the capture, as suggested, we get: error: variable 'i' cannot be
implicitly captured in a lambda with no capture-default specified
t.cpp
-----
template <typename ...T>
int h(T &&...t);
template <typename T>
int g(int i);
template<typename ...T>
auto f(int i)
{
return [i](){ return h(g<T>(i)...); };
}
int main()
{
return f<>(42)();
}
run.sh
------
clang++ -std=c++17 -O3 -Wunused-lambda-capture -Werror t.cpp
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs