From 7f52db1d997fecac9b4a9abe13c19e121b58fa8d 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 | 4 ++-- lib/stdbit.in.h | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74c5da2870..de4904e0cc 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 7ace0cddf0..d5e5456667 100644 --- a/lib/intprops-internal.h +++ b/lib/intprops-internal.h @@ -1,6 +1,6 @@ /* intprops-internal.h -- properties of integer types not visible to users - Copyright (C) 2001-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -81,7 +81,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 9a14daa45f..06d761d725 100644 --- a/lib/stdbit.in.h +++ b/lib/stdbit.in.h @@ -90,7 +90,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))