The following C++ code compiles fine with GCC (demo):
#include <iostream> int main() { int i = 1; auto j = std::move(-1); }
The problem is that std::move is provided by the utility standard header, not iostream. This actually makes the code non-portable according to the C++ standard.
I there any way (e.g., some code analysis tool) that would be able to report such problems, ideally for all std::… entities used in some particular source/header file? (My motivation stems from checking student homeworks. I would like to automate as much tests as possible, since manually searching for all std::… names and checking corresponding headers inclusion is tedious.)