From 70aa27ed70990be6ea86d47390f200154a477c49 Mon Sep 17 00:00:00 2001 From: Sergey Khalyutn Date: Tue, 2 Jun 2026 14:09:33 +0300 Subject: [PATCH] Fix: The compiler does not consider "#define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)" as a constant - compilation error: constexpr variable 'INVALID_HANDLE' must be initialized by a constant expression ``` [build] 77 | constexpr static Handle INVALID_HANDLE = INVALID_HANDLE_VALUE; [build] /code/src/remote\../remote\../common/ThreadStart.h:77:26: error: constexpr variable 'INVALID_HANDLE' must be initialized by a constant expression [build] 77 | constexpr static Handle INVALID_HANDLE = INVALID_HANDLE_VALUE; [build] | ^ ~~~~~~~~~~~~~~~~~~~~ [build] /code/src/remote\../remote\../common/ThreadStart.h:77:43: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression [build] 77 | constexpr static Handle INVALID_HANDLE = INVALID_HANDLE_VALUE; [build] | ^ [build] C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\handleapi.h:27:31: note: expanded from macro 'INVALID_HANDLE_VALUE' [build] 27 | #define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1) [build] | ^ ``` --- src/common/ThreadStart.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/ThreadStart.h b/src/common/ThreadStart.h index 40412735e4f..e92e2939997 100644 --- a/src/common/ThreadStart.h +++ b/src/common/ThreadStart.h @@ -74,7 +74,7 @@ class Thread public: #ifdef WIN_NT typedef HANDLE Handle; - constexpr static Handle INVALID_HANDLE = INVALID_HANDLE_VALUE; + inline static const Handle INVALID_HANDLE = INVALID_HANDLE_VALUE; #endif #ifdef USE_POSIX_THREADS typedef pthread_t Handle;