JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
1.98k stars 607 forks source link

Included gsl-lite fails to compile with g++-13 13.2.0 #1159

Closed smcv closed 9 months ago

smcv commented 10 months ago

Operating system and version: Debian testing/unstable, with g++ 13.2.0 as default C++ compiler.

Is this for single player or multiplayer? yes :-)

Description of the bug (and if possible, steps to reproduce the bug): To reproduce: build from source, with JK2 enabled (and I'm using CMAKE_BUILD_TYPE=Debug UseInternalZlib=0 BuildTests=ON, if that matters).

I get lots of C++ errors from gsl-lite.h, here are the first few:

In file included from /home/smcv/src/openjk/shared/qcommon/safe/gsl.h:4,
                 from /home/smcv/src/openjk/shared/qcommon/safe/files.h:7,
                 from /home/smcv/src/openjk/shared/qcommon/safe/files.cpp:1:
/home/smcv/src/openjk/lib/gsl-lite/include/gsl/gsl-lite.h:479:18: error: ‘reverse_iterator’ in namespace ‘gsl::std’ does not name a template type
  479 |     typedef std::reverse_iterator< iterator >                reverse_iterator;
      |                  ^~~~~~~~~~~~~~~~
/home/smcv/src/openjk/lib/gsl-lite/include/gsl/gsl-lite.h:480:18: error: ‘reverse_iterator’ in namespace ‘gsl::std’ does not name a template type
  480 |     typedef std::reverse_iterator< const_iterator >          const_reverse_iterator;
      |                  ^~~~~~~~~~~~~~~~
/home/smcv/src/openjk/lib/gsl-lite/include/gsl/gsl-lite.h:483:27: error: ‘iterator_traits’ in namespace ‘gsl::std’ does not name a template type
  483 |     typedef typename std::iterator_traits< iterator >::difference_type difference_type;
      |                           ^~~~~~~~~~~~~~~
/home/smcv/src/openjk/lib/gsl-lite/include/gsl/gsl-lite.h:483:42: error: expected unqualified-id before ‘<’ token
  483 |     typedef typename std::iterator_traits< iterator >::difference_type difference_type;
      |                                          ^
/home/smcv/src/openjk/lib/gsl-lite/include/gsl/gsl-lite.h:493:47: error: expected ‘)’ before ‘,’ token
  493 |     gsl_constexpr14 array_view( std::nullptr_t, size_type size )
      |                               ~               ^
      |                                               )
/home/smcv/src/openjk/lib/gsl-lite/include/gsl/gsl-lite.h:531:43: error: expected ‘)’ before ‘<’ token
  531 |     gsl_constexpr14 array_view( std::array< U, N > & arr )
      |                               ~           ^
      |                                           )

What did you expect to happen instead? Successful compile. Building with g++-12 version 12.3.0 (which was Debian's default before we upgraded to 13) still builds successfully.

smcv commented 10 months ago

Changing all the std:: things to be like ::std::reverse_iterator seems to avoid this. I'll open a PR.

smcv commented 9 months ago

This should be fixed now that #1154 was merged, but I haven't verified that yet.

smcv commented 9 months ago

Confirmed fixed by #1154.