The following code has a typo, where I forgot to invoke the lambda expression with ():
#include <iostream>
int main()
{
[]{ std::cout << "hello"; };
}
Fortunately clang issues a -Wunused-value warning for the lambda expression, since it's never evaluated/used.
However gcc does not issue any warning at all. Is there a way to warn about this buggy code when compiling with gcc?
There is a related post about unused lambda captures here which is similar, but this question is for unused lambda expressions themselves.