Hello, it seems that it's not possible to use constexpr with some enums
(mostly present in directx headers)

For example:

constexpr DWRITE_FONT_SIMULATIONS
simulations = DWRITE_FONT_SIMULATIONS_BOLD |
              DWRITE_FONT_SIMULATIONS_OBLIQUE;

That works in MSVC with the Windows SDK, while with CLang I get:

error: constexpr variable 'simulations' must be initialized by a constant
expression
note: non-constexpr function 'operator|' cannot be used in a constant
expression
D:/msys64/clang64/include/dwrite.h:404:1: note: declared here
  404 | DEFINE_ENUM_FLAG_OPERATORS(DWRITE_FONT_SIMULATIONS);
      | ^
D:/msys64/clang64/include/winnt.h:697:17: note: expanded from macro
'DEFINE_ENUM_FLAG_OPERATORS'
  697 | inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return
ENUMTYPE(((int)a) | ((int)b)); } \
      |                 ^

Would it be possible to support constexpr in mingw-w64 headers? See also
https://walbourn.github.io/modern-c++-bitmask-types/

Thanks in advance!
Luca

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to