]> Savannah Git Hosting - gnulib.git/commitdiff
stdbool: Fix compilation error in C++ mode with MSVC 14.
authorBruno Haible <bruno@clisp.org>
Sun, 4 Sep 2022 14:24:56 +0000 (16:24 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 5 Sep 2022 01:59:46 +0000 (03:59 +0200)
* lib/stdbool.in.h (_Bool, bool, false, true): In C++ mode with MSVC 14,
don't define these as macros.

ChangeLog
lib/stdbool.in.h

index 7727e3acc1803f7c9059fc4886e68f604ca027fc..bfefa6f2bd1ae6c89fdebe0bf4114d3269db4171 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-09-04  Bruno Haible  <bruno@clisp.org>
+
+       stdbool: Fix compilation error in C++ mode with MSVC 14.
+       * lib/stdbool.in.h (_Bool, bool, false, true): In C++ mode with MSVC 14,
+       don't define these as macros.
+
 2022-09-04  Bruno Haible  <bruno@clisp.org>
 
        fts: Fix compilation error with MSVC 14.
index 03840f10fc95c80ade6d322c45fedf0950d3692e..b1613d4f025f341efc9e7f9cd13d8452f44d981f 100644 (file)
 #endif
 
 #ifdef __cplusplus
-# define _Bool bool
-# define bool bool
+# if !defined _MSC_VER
+#  define _Bool bool
+#  define bool bool
+# endif
 #else
 # if defined __BEOS__ && !defined __HAIKU__
   /* A compiler known to have 'bool'.  */
@@ -120,8 +122,10 @@ typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
 
 /* The other macros must be usable in preprocessor directives.  */
 #ifdef __cplusplus
-# define false false
-# define true true
+# if !defined _MSC_VER
+#  define false false
+#  define true true
+# endif
 #else
 # define false 0
 # define true 1