Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
smcv opened this issue Sep 12, 2023 · 3 comments
Closed

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

smcv opened this issue Sep 12, 2023 · 3 comments

Comments

@smcv
Copy link
Contributor

smcv commented Sep 12, 2023

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
Copy link
Contributor Author

smcv commented Sep 12, 2023

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

smcv added a commit to smcv/OpenJK that referenced this issue Sep 12, 2023
With g++ 13, if we don't do this for names appearing inside
`namespace gsl {}`, then they're interpreted as being
`gsl::std::unique_ptr` and so on.

Resolves: JACoders#1159
Signed-off-by: Simon McVittie <smcv@debian.org>
@smcv
Copy link
Contributor Author

smcv commented Sep 29, 2023

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

@smcv
Copy link
Contributor Author

smcv commented Oct 2, 2023

Confirmed fixed by #1154.

@smcv smcv closed this as completed Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant