Skip to content
This repository has been archived by the owner on Mar 1, 2021. It is now read-only.

Compilation error (warning treated as error) #237

Open
apa420 opened this issue Oct 18, 2020 · 2 comments
Open

Compilation error (warning treated as error) #237

apa420 opened this issue Oct 18, 2020 · 2 comments

Comments

@apa420
Copy link
Contributor

apa420 commented Oct 18, 2020

I get this error when trying to compile the game with make -B.
It gives a usable something.debug but no something.release.
OS: Arch linux
GCC: 10.2.0

In file included from src/something.cpp:14:
src/aids.hpp: In function ‘void command_history(Game*, aids::String_View)’:
src/aids.hpp:574:25: error: ‘snprintf’ argument 4 may overlap destination object ‘game’ [-Werror=restrict]
  574 |         int n = snprintf(
      |                 ~~~~~~~~^
  575 |             buffer->data + buffer->size,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  576 |             buffer->capacity - buffer->size,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  577 |             "%.*s", (int) view.count, view.data);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/something.cpp:57:
src/something_commands.cpp:153:28: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here
  153 | void command_history(Game *game, String_View)
      |                      ~~~~~~^~~~
cc1plus: all warnings being treated as errors
make: *** [Makefile:21: something.release] Error 1
@rexim
Copy link
Member

rexim commented Oct 19, 2020

@apa420 this is a really weird error... Is it reproducible with clang?

@apa420
Copy link
Contributor Author

apa420 commented Oct 19, 2020

I do not get this error with clang version 10.0.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants