The reason that I ask this question is this link below: Why can this function return a C++ int reference?
It seems that the compiler is bad at reporting mistake
I suggest you could try to use the following method to enable warnings that are off by default:
1,#pragma warning(default : warning_number ) The specified warning (warning_number) is enabled at its default level. Documentation for the warning contains the default level of the warning.
2,#pragma warning( warning_level : warning_number ) The specified warning (warning_number) is enabled at the specified level (warning_level).
3,/Wall /Wall enables all warnings that are off by default. If you use this option, you can turn off individual warnings by using the /wd option.
4,/wLnnnn This option enables warning nnnn at level L.
For more details anbout warning level, I suggest you could refer to the link:https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=vs-2019