In the following example, variable x is not detected as not used

#include <vector>

int main()
	std::vector< double > x;
	int k,l;
g++ -Wall test.cpp
test.cpp: In function 'int main()':
test.cpp:6:6: warning: unused variable 'k'
test.cpp:6:8: warning: unused variable 'l'

Actually, warnings are only declared for built in types (bool, int, float, double, etc …). Compiler can’t determine if removing declaration of x would change the behaviour of semantics program.