From 50fa32c2c78858048e0f331745c1511fb55b2382 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 7 Jun 2026 12:27:28 +0200 Subject: [PATCH] intprops, stdbit-h: Fix error on MSVC in C++ mode (regr. 2024-12-19). * lib/intprops-internal.h (_GL_HAVE___TYPEOF__): Set to 0 on MSVC in C++ mode. * lib/stdbit.in.h (_GL_STDBIT_TYPEOF_CAST): Don't use __typeof__ on MSVC in C++ mode. --- ChangeLog | 8 ++++++++ lib/intprops-internal.h | 2 +- lib/stdbit.in.h | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e194208c19..db7a138110 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2026-06-07 Bruno Haible + + intprops, stdbit-h: Fix error on MSVC in C++ mode (regr. 2024-12-19). + * lib/intprops-internal.h (_GL_HAVE___TYPEOF__): Set to 0 on MSVC in + C++ mode. + * lib/stdbit.in.h (_GL_STDBIT_TYPEOF_CAST): Don't use __typeof__ on MSVC + in C++ mode. + 2026-06-06 Bruno Haible mbrtowc: Fix handling of s==NULL on all possible platforms. diff --git a/lib/intprops-internal.h b/lib/intprops-internal.h index 1fb3b79901..4055173dc8 100644 --- a/lib/intprops-internal.h +++ b/lib/intprops-internal.h @@ -106,7 +106,7 @@ || (defined __clang_major__ && 4 <= __clang_major__) \ || (defined __IBMC__ && 1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ || (defined __SUNPRO_C && 0x5110 <= __SUNPRO_C && !__STDC__) \ - || (defined _MSC_VER && 1939 <= _MSC_VER)) + || (defined _MSC_VER && 1939 <= _MSC_VER && !defined __cplusplus)) # define _GL_HAVE___TYPEOF__ 1 #else # define _GL_HAVE___TYPEOF__ 0 diff --git a/lib/stdbit.in.h b/lib/stdbit.in.h index 92749487fa..c7047e3297 100644 --- a/lib/stdbit.in.h +++ b/lib/stdbit.in.h @@ -175,7 +175,7 @@ _GL_INLINE_HEADER_BEGIN || (defined __clang_major__ && 4 <= __clang_major__) \ || (defined __IBMC__ && 1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ || (defined __SUNPRO_C && 0x5110 <= __SUNPRO_C && !__STDC__) \ - || (defined _MSC_VER && 1939 <= _MSC_VER)) + || (defined _MSC_VER && 1939 <= _MSC_VER && !defined __cplusplus)) # define _GL_STDBIT_TYPEOF_CAST(a, b) ((__typeof__ (a)) (b)) #elif 202311 <= __STDC_VERSION__ # define _GL_STDBIT_TYPEOF_CAST(a, b) ((typeof (a)) (b)) -- 2.47.3