std::make_signed is not coherent with gcc and clang

  • Thread starter Thread starter Julian LALU
  • Start date Start date
J

Julian LALU

Guest
Hi,

On Visual Studio 2019 v142 ( The latest version, I don't no tried oldest but I think the problem is the same )

The following code do not give the same result as GCC or Clang:

enum class B : char;
std::make_signed_t<B> // This gives int on visual studio but signed char on GCC and Clang.

So who is right? char is the smallest integral type that represent the enumeration. I think Visual Studio is wrong and this make code dangerous if you expect ‘signed char’ and not ‘signed int’.



Thank you,

Continue reading...
 
Back
Top