SafeInt icon indicating copy to clipboard operation
SafeInt copied to clipboard

safeint fails to build with gcc-13

Open daissi opened this issue 2 years ago • 4 comments

Hi,

I maintain the debian package of safeint, but since Debian/unstable switched its default compiler to gcc-13, safeint fails to build (at least CompileTest) as reported in #1042152. I thought at first it was because of some compilation flags injected by the debian build system, but it also fails with a simple cmake . && make although the errors seem different:

[  1%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/AddVerify.cpp.o
[  2%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/AddTestCase.cpp.o
[  4%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/CastVerify.cpp.o
[  5%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/DivVerify.cpp.o
[  6%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/DivTestCase.cpp.o
[  8%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/IncDecVerify.cpp.o
[  9%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/ModVerify.cpp.o
[ 11%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/MultVerify.cpp.o
[ 12%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/MultTestCase.cpp.o
[ 13%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/SubVerify.cpp.o
[ 15%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/SubTestCase.cpp.o
[ 16%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc.dir/__/TestMain.cpp.o
[ 18%] Linking CXX executable SafeIntTest_gcc
[ 18%] Built target SafeIntTest_gcc
[ 19%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/AddVerify.cpp.o
[ 20%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/AddTestCase.cpp.o
[ 22%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/CastVerify.cpp.o
[ 23%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/DivVerify.cpp.o
[ 25%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/DivTestCase.cpp.o
[ 26%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/IncDecVerify.cpp.o
[ 27%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/ModVerify.cpp.o
[ 29%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/MultVerify.cpp.o
[ 30%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/MultTestCase.cpp.o
[ 31%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/SubVerify.cpp.o
[ 33%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/SubTestCase.cpp.o
[ 34%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoIntrinsic.dir/__/TestMain.cpp.o
[ 36%] Linking CXX executable SafeIntTest_gcc_NoIntrinsic
[ 36%] Built target SafeIntTest_gcc_NoIntrinsic
[ 37%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/AddVerify.cpp.o
[ 38%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/AddTestCase.cpp.o
[ 40%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/CastVerify.cpp.o
[ 41%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/DivVerify.cpp.o
[ 43%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/DivTestCase.cpp.o
[ 44%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/IncDecVerify.cpp.o
[ 45%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/ModVerify.cpp.o
[ 47%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/MultVerify.cpp.o
[ 48%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/MultTestCase.cpp.o
[ 50%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/SubVerify.cpp.o
[ 51%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/SubTestCase.cpp.o
[ 52%] Building CXX object Test/GccTest/CMakeFiles/SafeIntTest_gcc_NoInt128.dir/__/TestMain.cpp.o
[ 54%] Linking CXX executable SafeIntTest_gcc_NoInt128
[ 54%] Built target SafeIntTest_gcc_NoInt128
[ 55%] Building CXX object Test/GccTest/CMakeFiles/CompileTest_gcc.dir/__/CompileTest.cpp.o
[ 56%] Building CXX object Test/GccTest/CMakeFiles/CompileTest_gcc.dir/__/ConstExpr.cpp.o
[ 58%] Building CXX object Test/GccTest/CMakeFiles/CompileTest_gcc.dir/__/CleanCompile.cpp.o
[ 59%] Linking CXX executable CompileTest_gcc
[ 59%] Built target CompileTest_gcc
[ 61%] Building CXX object Test/GccTest/CMakeFiles/CompileTest_gcc17.dir/__/CompileTest.cpp.o
In file included from /usr/include/c++/13/cstdint:38,
                 from /home/foo/Downloads/safeint-3.0.28a+dfsg/Test/../SafeInt.hpp:209,
                 from /home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:13:
/usr/include/c++/13/initializer_list: In function ‘void MoveRegression()’:
/usr/include/c++/13/initializer_list:41:15: error: expected ‘=’ before ‘__attribute__’
   41 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/initializer_list:41:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/variant:36,
                 from /home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:263:
/usr/include/c++/13/initializer_list:41:14: error: expected ‘;’ before ‘__attribute__’
   41 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/initializer_list:42:1: error: expected primary-expression before ‘{’ token
   42 | {
      | ^
/usr/include/c++/13/bits/enable_special_members.h:37:15: error: expected ‘=’ before ‘__attribute__’
   37 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/enable_special_members.h:37:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/variant:38:
/usr/include/c++/13/bits/enable_special_members.h:37:14: error: expected ‘;’ before ‘__attribute__’
   37 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/enable_special_members.h:38:1: error: expected primary-expression before ‘{’ token
   38 | {
      | ^
In file included from /usr/include/c++/13/bits/functional_hash.h:36,
                 from /usr/include/c++/13/variant:40:
/usr/include/c++/13/bits/hash_bytes.h:37:1: error: ‘namespace’ definition is not allowed here
   37 | namespace std
      | ^~~~~~~~~
/usr/include/c++/13/bits/functional_hash.h:38:15: error: expected ‘=’ before ‘__attribute__’
   38 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/functional_hash.h:38:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/functional_hash.h:38:14: error: expected ‘;’ before ‘__attribute__’
   38 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/functional_hash.h:39:1: error: expected primary-expression before ‘{’ token
   39 | {
      | ^
/usr/include/c++/13/bits/invoke.h:42:15: error: expected ‘=’ before ‘__attribute__’
   42 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/invoke.h:42:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/variant:41:
/usr/include/c++/13/bits/invoke.h:42:14: error: expected ‘;’ before ‘__attribute__’
   42 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/invoke.h:43:1: error: expected primary-expression before ‘{’ token
   43 | {
      | ^
/usr/include/c++/13/bits/parse_numbers.h:42:15: error: expected ‘=’ before ‘__attribute__’
   42 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/parse_numbers.h:42:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/variant:42:
/usr/include/c++/13/bits/parse_numbers.h:42:14: error: expected ‘;’ before ‘__attribute__’
   42 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/parse_numbers.h:43:1: error: expected primary-expression before ‘{’ token
   43 | {
      | ^
In file included from /usr/include/c++/13/new:41,
                 from /usr/include/c++/13/bits/stl_construct.h:59,
                 from /usr/include/c++/13/variant:44:
/usr/include/c++/13/bits/exception.h:38:8: error: expected unqualified-id before string constant
   38 | extern "C++" {
      |        ^~~~~
/usr/include/c++/13/new:45:8: error: expected unqualified-id before string constant
   45 | extern "C++" {
      |        ^~~~~
/usr/include/c++/13/new:186:1: error: ‘namespace’ definition is not allowed here
  186 | namespace std
      | ^~~~~~~~~
/usr/include/c++/13/bits/stl_construct.h:73:15: error: expected ‘=’ before ‘__attribute__’
   73 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_construct.h:73:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/stl_construct.h:73:14: error: expected ‘;’ before ‘__attribute__’
   73 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/stl_construct.h:74:1: error: expected primary-expression before ‘{’ token
   74 | {
      | ^
In file included from /usr/include/c++/13/variant:54:
/usr/include/c++/13/ext/aligned_buffer.h:40:1: error: ‘namespace’ definition is not allowed here
   40 | namespace __gnu_cxx
      | ^~~~~~~~~
/usr/include/c++/13/variant:58:15: error: expected ‘=’ before ‘__attribute__’
   58 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/variant:58:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/variant:58:14: error: expected ‘;’ before ‘__attribute__’
   58 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/variant:59:1: error: expected primary-expression before ‘{’ token
   59 | {
      | ^
/usr/include/c++/13/bits/memoryfwd.h:50:15: error: expected ‘=’ before ‘__attribute__’
   50 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/memoryfwd.h:50:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/bits/stringfwd.h:40,
                 from /usr/include/c++/13/string:41,
                 from /home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:264:
/usr/include/c++/13/bits/memoryfwd.h:50:14: error: expected ‘;’ before ‘__attribute__’
   50 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/memoryfwd.h:51:1: error: expected primary-expression before ‘{’ token
   51 | {
      | ^
/usr/include/c++/13/bits/stringfwd.h:42:15: error: expected ‘=’ before ‘__attribute__’
   42 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stringfwd.h:42:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/stringfwd.h:42:14: error: expected ‘;’ before ‘__attribute__’
   42 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/stringfwd.h:43:1: error: expected primary-expression before ‘{’ token
   43 | {
      | ^
In file included from /usr/include/features.h:490,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679:
/usr/include/wchar.h:79:1: error: expected unqualified-id before string constant
   79 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
In file included from /usr/include/c++/13/bits/postypes.h:40,
                 from /usr/include/c++/13/bits/char_traits.h:42,
                 from /usr/include/c++/13/string:42:
/usr/include/c++/13/cwchar:62:1: error: ‘namespace’ definition is not allowed here
   62 | namespace std
      | ^~~~~~~~~
/usr/include/c++/13/cwchar:135:8: error: expected unqualified-id before string constant
  135 | extern "C++"
      |        ^~~~~
/usr/include/c++/13/cwchar:244:1: error: ‘namespace’ definition is not allowed here
  244 | namespace __gnu_cxx
      | ^~~~~~~~~
/usr/include/c++/13/cwchar:265:1: error: ‘namespace’ definition is not allowed here
  265 | namespace std
      | ^~~~~~~~~
/usr/include/c++/13/cwchar:280:1: error: ‘namespace’ definition is not allowed here
  280 | namespace std
      | ^~~~~~~~~
/usr/include/c++/13/bits/postypes.h:42:15: error: expected ‘=’ before ‘__attribute__’
   42 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/postypes.h:42:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/postypes.h:42:14: error: expected ‘;’ before ‘__attribute__’
   42 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/postypes.h:43:1: error: expected primary-expression before ‘{’ token
   43 | {
      | ^
/usr/include/c++/13/bits/char_traits.h:64:21: error: expected ‘=’ before ‘__attribute__’
   64 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/char_traits.h:64:21: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/char_traits.h:64:20: error: expected ‘;’ before ‘__attribute__’
   64 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                    ^
      |                    ;
/usr/include/c++/13/bits/char_traits.h:65:1: error: expected primary-expression before ‘{’ token
   65 | {
      | ^
/usr/include/c++/13/bits/char_traits.h:315:15: error: expected ‘=’ before ‘__attribute__’
  315 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/char_traits.h:315:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/char_traits.h:315:14: error: expected ‘;’ before ‘__attribute__’
  315 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/char_traits.h:316:1: error: expected primary-expression before ‘{’ token
  316 | {
      | ^
/usr/include/c++/13/bits/char_traits.h:755:15: error: expected ‘=’ before ‘__attribute__’
  755 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/char_traits.h:755:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/char_traits.h:755:14: error: expected ‘;’ before ‘__attribute__’
  755 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/char_traits.h:756:1: error: expected primary-expression before ‘{’ token
  756 | {
      | ^
/usr/include/c++/13/bits/new_allocator.h:41:15: error: expected ‘=’ before ‘__attribute__’
   41 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/new_allocator.h:41:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/c++allocator.h:33,
                 from /usr/include/c++/13/bits/allocator.h:46,
                 from /usr/include/c++/13/string:43:
/usr/include/c++/13/bits/new_allocator.h:41:14: error: expected ‘;’ before ‘__attribute__’
   41 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/new_allocator.h:42:1: error: expected primary-expression before ‘{’ token
   42 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/13/bits/c++allocator.h:36:1: error: ‘namespace’ definition is not allowed here
   36 | namespace std
      | ^~~~~~~~~
/usr/include/c++/13/bits/allocator.h:54:15: error: expected ‘=’ before ‘__attribute__’
   54 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/allocator.h:54:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/allocator.h:54:14: error: expected ‘;’ before ‘__attribute__’
   54 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/allocator.h:55:1: error: expected primary-expression before ‘{’ token
   55 | {
      | ^
/usr/include/locale.h:31:1: error: expected unqualified-id before string constant
   31 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/c++locale.h:41,
                 from /usr/include/c++/13/bits/localefwd.h:40,
                 from /usr/include/c++/13/string:45:
/usr/include/c++/13/clocale:51:1: error: ‘namespace’ definition is not allowed here
   51 | namespace std
      | ^~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/13/bits/c++locale.h:48:21: error: expected ‘=’ before ‘__attribute__’
   48 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                     ^~~~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/13/bits/c++locale.h:48:21: error: expected identifier before ‘__attribute__’
/usr/include/x86_64-linux-gnu/c++/13/bits/c++locale.h:48:20: error: expected ‘;’ before ‘__attribute__’
   48 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                    ^
      |                    ;
/usr/include/x86_64-linux-gnu/c++/13/bits/c++locale.h:49:1: error: expected primary-expression before ‘{’ token
   49 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/13/bits/c++locale.h:58:15: error: expected ‘=’ before ‘__attribute__’
   58 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/13/bits/c++locale.h:58:15: error: expected identifier before ‘__attribute__’
/usr/include/x86_64-linux-gnu/c++/13/bits/c++locale.h:58:14: error: expected ‘;’ before ‘__attribute__’
   58 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/x86_64-linux-gnu/c++/13/bits/c++locale.h:59:1: error: expected primary-expression before ‘{’ token
   59 | {
      | ^
/usr/include/c++/13/iosfwd:44:15: error: expected ‘=’ before ‘__attribute__’
   44 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/iosfwd:44:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/bits/localefwd.h:41:
/usr/include/c++/13/iosfwd:44:14: error: expected ‘;’ before ‘__attribute__’
   44 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/iosfwd:45:1: error: expected primary-expression before ‘{’ token
   45 | {
      | ^
/usr/include/ctype.h:28:1: error: expected unqualified-id before string constant
   28 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
In file included from /usr/include/c++/13/bits/localefwd.h:42:
/usr/include/c++/13/cctype:62:1: error: ‘namespace’ definition is not allowed here
   62 | namespace std
      | ^~~~~~~~~
/usr/include/c++/13/cctype:85:1: error: ‘namespace’ definition is not allowed here
   85 | namespace std
      | ^~~~~~~~~
/usr/include/c++/13/bits/localefwd.h:44:15: error: expected ‘=’ before ‘__attribute__’
   44 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/localefwd.h:44:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/localefwd.h:44:14: error: expected ‘;’ before ‘__attribute__’
   44 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/localefwd.h:45:1: error: expected primary-expression before ‘{’ token
   45 | {
      | ^
In file included from /usr/include/c++/13/bits/ostream_insert.h:36,
                 from /usr/include/c++/13/string:46:
/usr/include/c++/13/bits/cxxabi_forced.h:39:1: error: ‘namespace’ definition is not allowed here
   39 | namespace __cxxabiv1
      | ^~~~~~~~~
/usr/include/c++/13/bits/ostream_insert.h:39:15: error: expected ‘=’ before ‘__attribute__’
   39 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/ostream_insert.h:39:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/ostream_insert.h:39:14: error: expected ‘;’ before ‘__attribute__’
   39 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/ostream_insert.h:40:1: error: expected primary-expression before ‘{’ token
   40 | {
      | ^
/usr/include/c++/13/bits/stl_function.h:63:15: error: expected ‘=’ before ‘__attribute__’
   63 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_function.h:63:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/string:49:
/usr/include/c++/13/bits/stl_function.h:63:14: error: expected ‘;’ before ‘__attribute__’
   63 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/stl_function.h:64:1: error: expected primary-expression before ‘{’ token
   64 | {
      | ^
/usr/include/c++/13/backward/binders.h:63:15: error: expected ‘=’ before ‘__attribute__’
   63 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/backward/binders.h:63:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/bits/stl_function.h:1438:
/usr/include/c++/13/backward/binders.h:63:14: error: expected ‘;’ before ‘__attribute__’
   63 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/backward/binders.h:64:1: error: expected primary-expression before ‘{’ token
   64 | {
      | ^
/usr/include/c++/13/bits/refwrap.h:41:15: error: expected ‘=’ before ‘__attribute__’
   41 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/refwrap.h:41:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/string:52:
/usr/include/c++/13/bits/refwrap.h:41:14: error: expected ‘;’ before ‘__attribute__’
   41 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/refwrap.h:42:1: error: expected primary-expression before ‘{’ token
   42 | {
      | ^
/usr/include/c++/13/bits/range_access.h:40:15: error: expected ‘=’ before ‘__attribute__’
   40 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/range_access.h:40:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/string:53:
/usr/include/c++/13/bits/range_access.h:40:14: error: expected ‘;’ before ‘__attribute__’
   40 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/range_access.h:41:1: error: expected primary-expression before ‘{’ token
   41 | {
      | ^
/usr/include/c++/13/bits/alloc_traits.h:43:15: error: expected ‘=’ before ‘__attribute__’
   43 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/alloc_traits.h:43:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/ext/alloc_traits.h:34,
                 from /usr/include/c++/13/bits/basic_string.h:39,
                 from /usr/include/c++/13/string:54:
/usr/include/c++/13/bits/alloc_traits.h:43:14: error: expected ‘;’ before ‘__attribute__’
   43 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/alloc_traits.h:44:1: error: expected primary-expression before ‘{’ token
   44 | {
      | ^
/usr/include/c++/13/ext/alloc_traits.h:36:21: error: expected ‘=’ before ‘__attribute__’
   36 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/ext/alloc_traits.h:36:21: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/ext/alloc_traits.h:36:20: error: expected ‘;’ before ‘__attribute__’
   36 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                    ^
      |                    ;
/usr/include/c++/13/ext/alloc_traits.h:37:1: error: expected primary-expression before ‘{’ token
   37 | {
      | ^
/usr/include/c++/13/string_view:56:15: error: expected ‘=’ before ‘__attribute__’
   56 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/string_view:56:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/bits/basic_string.h:47:
/usr/include/c++/13/string_view:56:14: error: expected ‘;’ before ‘__attribute__’
   56 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/string_view:57:1: error: expected primary-expression before ‘{’ token
   57 | {
      | ^
/usr/include/c++/13/bits/string_view.tcc:41:15: error: expected ‘=’ before ‘__attribute__’
   41 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/string_view.tcc:41:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/string_view:904:
/usr/include/c++/13/bits/string_view.tcc:41:14: error: expected ‘;’ before ‘__attribute__’
   41 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/string_view.tcc:42:1: error: expected primary-expression before ‘{’ token
   42 | {
      | ^
/usr/include/c++/13/bits/basic_string.h:53:15: error: expected ‘=’ before ‘__attribute__’
   53 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:53:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/basic_string.h:53:14: error: expected ‘;’ before ‘__attribute__’
   53 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/basic_string.h:54:1: error: expected primary-expression before ‘{’ token
   54 | {
      | ^
/usr/include/c++/13/bits/basic_string.h:3480:15: error: expected ‘=’ before ‘__attribute__’
 3480 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:3480:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/basic_string.h:3480:14: error: expected ‘;’ before ‘__attribute__’
 3480 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/basic_string.h:3481:1: error: expected primary-expression before ‘{’ token
 3481 | {
      | ^
In file included from /usr/include/c++/13/ext/string_conversions.h:43,
                 from /usr/include/c++/13/bits/basic_string.h:4097:
/usr/include/c++/13/cstdlib:125:8: error: expected unqualified-id before string constant
  125 | extern "C++"
      |        ^~~~~
/usr/include/stdio.h:29:1: error: expected unqualified-id before string constant
   29 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
In file included from /usr/include/c++/13/ext/string_conversions.h:45:
/usr/include/c++/13/cstdio:96:1: error: ‘namespace’ definition is not allowed here
   96 | namespace std
      | ^~~~~~~~~
/usr/include/c++/13/cstdio:157:1: error: ‘namespace’ definition is not allowed here
  157 | namespace __gnu_cxx
      | ^~~~~~~~~
/usr/include/c++/13/cstdio:183:1: error: ‘namespace’ definition is not allowed here
  183 | namespace std
      | ^~~~~~~~~
/usr/include/errno.h:34:1: error: expected unqualified-id before string constant
   34 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
/usr/include/c++/13/ext/string_conversions.h:48:21: error: expected ‘=’ before ‘__attribute__’
   48 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/ext/string_conversions.h:48:21: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/ext/string_conversions.h:48:20: error: expected ‘;’ before ‘__attribute__’
   48 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                    ^
      |                    ;
/usr/include/c++/13/ext/string_conversions.h:49:1: error: expected primary-expression before ‘{’ token
   49 | {
      | ^
/usr/include/c++/13/bits/charconv.h:40:15: error: expected ‘=’ before ‘__attribute__’
   40 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/charconv.h:40:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/bits/basic_string.h:4098:
/usr/include/c++/13/bits/charconv.h:40:14: error: expected ‘;’ before ‘__attribute__’
   40 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/charconv.h:41:1: error: expected primary-expression before ‘{’ token
   41 | {
      | ^
/usr/include/c++/13/bits/basic_string.h:4100:15: error: expected ‘=’ before ‘__attribute__’
 4100 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:4100:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/basic_string.h:4100:14: error: expected ‘;’ before ‘__attribute__’
 4100 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/basic_string.h:4101:1: error: expected primary-expression before ‘{’ token
 4101 | {
      | ^
/usr/include/c++/13/bits/basic_string.h:4381:15: error: expected ‘=’ before ‘__attribute__’
 4381 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:4381:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/basic_string.h:4381:14: error: expected ‘;’ before ‘__attribute__’
 4381 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/basic_string.h:4382:1: error: expected primary-expression before ‘{’ token
 4382 | {
      | ^
/usr/include/c++/13/bits/basic_string.tcc:46:15: error: expected ‘=’ before ‘__attribute__’
   46 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/basic_string.tcc:46:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/string:55:
/usr/include/c++/13/bits/basic_string.tcc:46:14: error: expected ‘;’ before ‘__attribute__’
   46 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/basic_string.tcc:47:1: error: expected primary-expression before ‘{’ token
   47 | {
      | ^
/usr/include/c++/13/bits/uses_allocator.h:40:15: error: expected ‘=’ before ‘__attribute__’
   40 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/uses_allocator.h:40:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/bits/memory_resource.h:40,
                 from /usr/include/c++/13/string:58:
/usr/include/c++/13/bits/uses_allocator.h:40:14: error: expected ‘;’ before ‘__attribute__’
   40 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/uses_allocator.h:41:1: error: expected primary-expression before ‘{’ token
   41 | {
      | ^
/usr/include/c++/13/tuple:48:15: error: expected ‘=’ before ‘__attribute__’
   48 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:48:15: error: expected identifier before ‘__attribute__’
In file included from /usr/include/c++/13/bits/memory_resource.h:47:
/usr/include/c++/13/tuple:48:14: error: expected ‘;’ before ‘__attribute__’
   48 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/tuple:49:1: error: expected primary-expression before ‘{’ token
   49 | {
      | ^
/usr/include/c++/13/bits/memory_resource.h:50:15: error: expected ‘=’ before ‘__attribute__’
   50 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/memory_resource.h:50:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/bits/memory_resource.h:50:14: error: expected ‘;’ before ‘__attribute__’
   50 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/bits/memory_resource.h:51:1: error: expected primary-expression before ‘{’ token
   51 | {
      | ^
/usr/include/c++/13/string:59:15: error: expected ‘=’ before ‘__attribute__’
   59 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/string:59:15: error: expected identifier before ‘__attribute__’
/usr/include/c++/13/string:59:14: error: expected ‘;’ before ‘__attribute__’
   59 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/13/string:60:1: error: expected primary-expression before ‘{’ token
   60 | {
      | ^
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:266:9: error: a template declaration cannot appear at block scope
  266 |         template<typename... T>
      |         ^~~~~~~~
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:281:9: error: ‘Union’ was not declared in this scope; did you mean ‘union’?
  281 |         Union<std::string, SafeInt<int64_t>> x;
      |         ^~~~~
      |         union
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:281:20: error: ‘string’ is not a member of ‘std’
  281 |         Union<std::string, SafeInt<int64_t>> x;
      |                    ^~~~~~
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:265:1: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
  264 |         #include <string>
  +++ |+#include <string>
  265 | 
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:281:43: error: expected primary-expression before ‘>’ token
  281 |         Union<std::string, SafeInt<int64_t>> x;
      |                                           ^~
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:281:46: error: ‘x’ was not declared in this scope
  281 |         Union<std::string, SafeInt<int64_t>> x;
      |                                              ^
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:282:20: error: ‘string’ is not a member of ‘std’
  282 |         Union<std::string, SafeInt<int64_t>> y;
      |                    ^~~~~~
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:282:20: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:282:43: error: expected primary-expression before ‘>’ token
  282 |         Union<std::string, SafeInt<int64_t>> y;
      |                                           ^~
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:282:46: error: ‘y’ was not declared in this scope; did you mean ‘yn’?
  282 |         Union<std::string, SafeInt<int64_t>> y;
      |                                              ^
      |                                              yn
make[2]: *** [Test/GccTest/CMakeFiles/CompileTest_gcc17.dir/build.make:76: Test/GccTest/CMakeFiles/CompileTest_gcc17.dir/__/CompileTest.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:238: Test/GccTest/CMakeFiles/CompileTest_gcc17.dir/all] Error 2
make: *** [Makefile:101: all] Error 2

Any idea how to fix that?

Best regards, Dylan

daissi avatar Aug 30 '23 10:08 daissi

Hi Dylan, Apologies for the delay. This is related to https://github.com/dcleblanc/SafeInt/pull/50. I thought there was an issue covering this regression but can't find it. I think that if you simply comment out MoveRegression(), it should make the problem go away. I will go sort out a repro on my own system and see what I can do about a more complete fix. Given that clang does work correctly, this is probably a gcc bug, but there might be a way to make both work.

dcleblanc avatar Aug 31 '23 22:08 dcleblanc

Thanks David! After removing references to MoveRegression() compilation continues until the same error reported on the initial debian bug report which is:

...
[ 70%] Built target CompileTest_gcc14
[ 72%] Building CXX object Test/GccTest/CMakeFiles/CompileTest_gcc14_NoEH.dir/__/CompileTest.cpp.o
[ 73%] Building CXX object Test/GccTest/CMakeFiles/CompileTest_gcc14_NoEH.dir/__/ConstExpr.cpp.o
[ 75%] Building CXX object Test/GccTest/CMakeFiles/CompileTest_gcc14_NoEH.dir/__/CleanCompile.cpp.o
[ 76%] Linking CXX executable CompileTest_gcc14_NoEH
[ 76%] Built target CompileTest_gcc14_NoEH
[ 77%] Building CXX object Test/GccTest/CMakeFiles/CompileTest_gcc98.dir/__/CompileTest.cpp.o
In file included from /usr/include/c++/13/cstdint:35,
                 from /home/foo/Downloads/safeint-3.0.28a+dfsg/Test/../SafeInt.hpp:209,
                 from /home/foo/Downloads/safeint-3.0.28a+dfsg/Test/CompileTest.cpp:13:
/usr/include/c++/13/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
   32 | #error This file requires compiler and library support \
      |  ^~~~~
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/../SafeInt.hpp:277:1: warning: identifier ‘static_assert’ is a keyword in C++11 [-Wc++11-compat]
  277 | static_assert( -1 == static_cast<int>(0xffffffff), "Two's complement signed numbers are required" );
      | ^~~~~~~~~~~~~
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/../SafeInt.hpp:6283:22: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++11-compat]
 6283 |         if( input == nullptr || input[0] == 0 )
      |                      ^~~~~~~
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/../SafeInt.hpp:277:14: error: expected constructor, destructor, or type conversion before ‘(’ token
  277 | static_assert( -1 == static_cast<int>(0xffffffff), "Two's complement signed numbers are required" );
      |              ^
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/../SafeInt.hpp:593:26: error: ‘is_integral’ is not a member of ‘std’
  593 |             isInt = std::is_integral<T>::value || std::is_enum<T>::value,
      |                          ^~~~~~~~~~~
/home/foo/Downloads/safeint-3.0.28a+dfsg/Test/../SafeInt.hpp:593:39: error: expected primary-expression before ‘>’ token
  593 |             isInt = std::is_integral<T>::value || std::is_enum<T>::value,
      |                 
...

The full log is available at http://qa-logs.debian.net/2023/07/26/safeint_3.0.28a+dfsg-2_unstable.log.

I guess we are facing two different issues.

daissi avatar Sep 01 '23 14:09 daissi

Looks like gcc 13 doesn't support anything below C++11. I'm working on getting gcc 13 on my test system so that I can correctly check for gcc version and enable/disable the C++98 check as needed.

I suspect the other problem is something different, as that piece of code requires C++17 to run.

dcleblanc avatar Sep 01 '23 18:09 dcleblanc

Please try the change in

In particular, try changing the compiler version test from GREATER_EQUAL "13" to "13.2" - I haven't so far managed to install 13.2, and I don't get a repro on this problem with 13.1, It's really clear what's happening, seen this before - the headers have a change to require C++11, now C++98 is broken. Fix is to simply not build this one test.

As to the other problem, not sure yet, but let's see if this fixes part of it.

dcleblanc avatar Sep 02 '23 23:09 dcleblanc