bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bool and C23


From: Bruno Haible
Subject: Re: bool and C23
Date: Sun, 11 Sep 2022 00:49:37 +0200

I did:
> 2022-09-10  Bruno Haible  <bruno@clisp.org>
> 
>       Reorganize C++ tests for stdbool and stdbool-c99.
>       * tests/test-stdbool-c++.cc: Don't include <stdbool.h> if TEST_STDBOOL_H
>       is not defined. Add a couple of simple tests, from test-stdbool.c.

Oops. This produces a compilation error with MSVC14:

source='../../gltests/test-stdbool-c++.cc' object='test-stdbool-c++.obj' 
libtool=no \
DEPDIR=.deps depmode=msvc7 /bin/sh ../../build-aux/depcomp \
/home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -I. 
-I../../gltests -I..  -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. 
-I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib 
-D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc32/include  -MD -c -o 
test-stdbool-c++.obj `cygpath -w '../../gltests/test-stdbool-c++.cc'`
test-stdbool-c++.cc
C:\cygwin64\home\bruno\testdir-all\gltests\test-stdbool-c++.cc(36): error 
C2380: type(s) preceding 's' (constructor with return type, or illegal 
redefinition of current class-name?)
C:\cygwin64\home\bruno\testdir-all\gltests\test-stdbool-c++.cc(36): error 
C2460: 's::<alignment member>': uses 's', which is being defined
C:\cygwin64\home\bruno\testdir-all\gltests\test-stdbool-c++.cc(36): note: see 
declaration of 's'
make[4]: *** [Makefile:23346: test-stdbool-c++.obj] Error 2

This patch fixes it:


2022-09-10  Bruno Haible  <bruno@clisp.org>

        stdbool C++ tests: Fix compilation error with MSVC14 (regr. from today).
        * tests/test-stdbool-c++.cc (s): Choose field names that are not type
        names.

diff --git a/tests/test-stdbool-c++.cc b/tests/test-stdbool-c++.cc
index 8e208dfe23..98358f1ef8 100644
--- a/tests/test-stdbool-c++.cc
+++ b/tests/test-stdbool-c++.cc
@@ -33,7 +33,7 @@
  "error: true is not 1"
 #endif
 
-struct s { bool s: 1; bool t; } s;
+struct s { bool u: 1; bool v; } s;
 
 char a[true == 1 ? 1 : -1];
 char b[false == 0 ? 1 : -1];






reply via email to

[Prev in Thread] Current Thread [Next in Thread]