jorgen/json_struct

build.sh script fails on Ubuntu 22.04

Closed this issue · 1 comments

Hi - I'm getting compiler errors running the build.sh script on Linux Ubuntu 22.04. Are these expected?

Thanks.

  • git commit hash
$ git log -n 1
commit 9b719771470536763430703b7f04acc558dafe56 (HEAD -> master, origin/master, origin/HEAD)
Author: Jørgen Lind <jorgen.lind@gmail.com>
Date:   Thu Jan 19 12:12:19 2023 +0100

    Fix some warnings
$
  • OS
$ uname -a
Linux demo 5.15.0-70-generic #77-Ubuntu SMP Tue Mar 21 14:02:37 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy
$
  • compiler
$ g++ --version
g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Command sequence:

git clone git@github.com:jorgen/json_struct.git
cd json_struct/
./build.sh

Shell output:

.
.
.
[ 73%] Building CXX object tests/CMakeFiles/unit-tests-cxx17.dir/json-tokenizer-fail-test.cpp.o
[ 73%] Building CXX object tests/CMakeFiles/unit-tests-cxx17.dir/json-tokenizer-partial-test.cpp.o
[ 74%] Building CXX object tests/CMakeFiles/unit-tests-cxx17.dir/json-tokenizer-test.cpp.o
[ 75%] Building CXX object tests/CMakeFiles/unit-tests-cxx17.dir/json-function-test.cpp.o
In file included from /home/sscott/json_struct/tests/json-function-test.cpp:23:
/home/sscott/json_struct/include/json_struct/json_struct.h: In function ‘void {anonymous}::____C_A_T_C_H____T_E_S_T____10()’:
/home/sscott/json_struct/include/json_struct/json_struct.h:4113:39: error: array subscript ‘int (**)(...)[0]’ is partly outside array bounds of ‘{anonymous}::CallErrorCheck [1]’ [-Werror=array-bounds]
 4113 |     (container.*functionInfo.function)();
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/sscott/json_struct/tests/json-function-test.cpp:372:18: note: while referencing ‘errorCheck’
  372 |   CallErrorCheck errorCheck;
      |                  ^~~~~~~~~~
In file included from /home/sscott/json_struct/tests/json-function-test.cpp:23:
/home/sscott/json_struct/include/json_struct/json_struct.h:4014:39: error: array subscript ‘int (**)(...)[0]’ is partly outside array bounds of ‘{anonymous}::CallErrorCheck [1]’ [-Werror=array-bounds]
 4014 |     (container.*functionInfo.function)(arg, context.error_context);
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sscott/json_struct/tests/json-function-test.cpp:372:18: note: while referencing ‘errorCheck’
  372 |   CallErrorCheck errorCheck;
      |                  ^~~~~~~~~~
In file included from /home/sscott/json_struct/tests/json-function-test.cpp:23:
/home/sscott/json_struct/include/json_struct/json_struct.h: In function ‘void {anonymous}::____C_A_T_C_H____T_E_S_T____2()’:
/home/sscott/json_struct/include/json_struct/json_struct.h:3935:62: error: array subscript ‘int (**)(...)[0]’ is partly outside array bounds of ‘{anonymous}::CallFunctionSub [1]’ [-Werror=array-bounds]
 3935 |     TypeHandler<Ret>::from((container.*functionInfo.function)(arg), token, context.return_serializer);
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/home/sscott/json_struct/tests/json-function-test.cpp:143:19: note: while referencing ‘cont’
  143 |   CallFunctionSub cont;
      |                   ^~~~
In file included from /home/sscott/json_struct/tests/json-function-test.cpp:23:
/home/sscott/json_struct/include/json_struct/json_struct.h: In function ‘void {anonymous}::____C_A_T_C_H____T_E_S_T____6()’:
/home/sscott/json_struct/include/json_struct/json_struct.h:3996:39: error: array subscript ‘int (**)(...)[0]’ is partly outside array bounds of ‘{anonymous}::SuperParamCallable [1]’ [-Werror=array-bounds]
 3996 |     (container.*functionInfo.function)(arg);
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/home/sscott/json_struct/tests/json-function-test.cpp:232:22: note: while referencing ‘cont’
  232 |   SuperParamCallable cont;
      |                      ^~~~
cc1plus: all warnings being treated as errors
gmake[2]: *** [tests/CMakeFiles/unit-tests-cxx17.dir/build.make:328: tests/CMakeFiles/unit-tests-cxx17.dir/json-function-test.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:696: tests/CMakeFiles/unit-tests-cxx17.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
$

This seems to be a compiler bug, I have disabled the warning in the last master build godbolt