This code
#include <vector>
int main()
{
std::vector< double > x;
int k,l;
}
compiled with Apple clang version 11.0.0 as such:
> clang test.cpp -std=c++14 -Werror=unused-variable
generates only a subset of the expected errors (unused vector is not detected):
test.cpp:6:13: error: unused variable 'k' [-Werror,-Wunused-variable]
int k,l;
^
test.cpp:6:15: error: unused variable 'l' [-Werror,-Wunused-variable]
int k,l;
^
2 errors generated.
GCC 5 also does not abort here.
The GCC doc does not mention any caveats here
Warn whenever a local or static variable is unused aside from its declaration. This option implies -Wunused-const-variable=1 for C, but not for C++. This warning is enabled by -Wall. To suppress this warning use the unused attribute (see Variable Attributes).