在 2026-1-16 17:58, Martin Storsjö 写道:
That does fix the errors for returning this value, but it still doesn't help with the case for the switch case:

/home/martin/code/llvm-mingw/llvm-project/libunwind/src/Unwind-seh.cpp:272:8: error: case value is not a constant expression
   272 |   case EXCEPTION_DISPOSITION(4):
       |        ^~~~~~~~~~~~~~~~~~~~~~~~

/home/martin/code/llvm-mingw/llvm-project/libunwind/src/Unwind-seh.cpp:272:8: error: case value is not a constant expression
   272 |   case static_cast<EXCEPTION_DISPOSITION>(4):
       |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


I think it's because the underlying type of `EXCEPTION_DISPOSITION` is not fixed, and Clang somehow allocates `unsigned int:2` for it, which is not sufficient for the value 4.

To work around that, we can either declare a placeholder value

   typedef enum _EXCEPTION_DISPOSITION {
     ExceptionContinueExecution = 0,
     ExceptionContinueSearch = 1,
     ExceptionNestedException = 2,
     ExceptionCollidedUnwind = 3,
     __EXCEPTION_DISPOSITION_placeholder_for_libunwind = 4
   } EXCEPTION_DISPOSITION;

or declare a fixed underlying type

   typedef enum _EXCEPTION_DISPOSITION
   #if defined __cplusplus && __cplusplus >= 201103L
   : int
   #endif
   {
     ExceptionContinueExecution = 0,
     ExceptionContinueSearch = 1,
     ExceptionNestedException = 2,
     ExceptionCollidedUnwind = 3
   } EXCEPTION_DISPOSITION;

--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to