yaml-cpp icon indicating copy to clipboard operation
yaml-cpp copied to clipboard

-Wold-style-cast warning in convert.h

Open u3shit opened this issue 4 years ago • 0 comments

This commit: https://github.com/jbeder/yaml-cpp/commit/a6bbe0e50ac4074f0b9b44188c28cf00caf1a723 added a c style cast, I guess to silence a warning in MSVC. However with gcc/clang and -Wold-style-cast, it produces a warning:

yaml-cpp/node/convert.h:130:13: warning: use of old-style cast [-Wold-style-cast]                                                                                                                                      
      rhs = (T)num;                                                                                                                                                                                                                            
            ^  ~~~                                                                                                     
1 warning generated.

Since T is either signed char on unsigned char here, it should be safe to change it to static_cast<T>(num) or T(num) here.

u3shit avatar Oct 07 '21 18:10 u3shit