This question is somewhat two fold, one being more general than the other. The specific question is; does MSVC have equivalent warnings to -Wredundant-move? More generally, is there anywhere online, even if it’s someone’s blog, that has a reasonable mapping between GCC and MSVC warnings?
I’m aware that warnings don’t have any requirement to be similar accross platforms, or even exist at all – that’s why I’m interested to find out if there is any reasonable correlation?
For a small bit of background, I’m looking to enable specific -Werrors on a cross-platform project, and would prefer if each platform looked after roughly the same warnings instead of relying on the user to check on both platforms manually.
>Solution :
The specific question is; does MSVC have equivalent warnings to
-Wredundant-move?
From what I’ve found, no, MSVC doesn’t.
- The subset of the warning messages that are generated by the Microsoft C/C++ compiler (Compiler warnings C4000 – C5999) does not have any similar warning.
- The Compiler Warnings by compiler version page does not show one either.
- Compiler warnings that are off by default is void of such warnings.
This implicitly answers the more general question if there’s a good mapping between gcc and MSVC warnings.
But – the future looks promising for the particular kind of warning you asked about:
Under Review – Pessimizing Move Compiler Warning:
"LLVM supports a pessimizing-move compiler warning. In C++17 and newer, this fires when invoking std::move() on a temporary, this results in copy elision not occurring on the temporary. This seems a high value warning that is supported in Clang++ and GCC, but not MSVC."