something icon indicating copy to clipboard operation
something copied to clipboard

Compilation error (warning treated as error)

Open apa420 opened this issue 5 years ago • 2 comments

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

apa420 avatar Oct 18 '20 15:10 apa420

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

rexim avatar Oct 19 '20 12:10 rexim

I do not get this error with clang version 10.0.1

apa420 avatar Oct 19 '20 13:10 apa420