google / libnop

libnop: C++ Native Object Protocols
Other
575 stars 59 forks source link

test/serializer_tests.cpp build failure on 32bit #19

Closed AdrianBunk closed 4 years ago

AdrianBunk commented 4 years ago

https://buildd.debian.org/status/logs.php?pkg=libnop&ver=0.0~git20200728.45dfe0f-2

test/serializer_tests.cpp: In member function ‘virtual void Serializer_size_t_Test::TestBody()’:
test/serializer_tests.cpp:2970:19: error: conversion from ‘long long unsigned int’ to ‘std::size_t’ {aka ‘unsigned int’} changes value from ‘4294967296’ to ‘0’ [-Werror=overflow]
 2970 |     value = (1LLU << 32);
      |             ~~~~~~^~~~~~
test/serializer_tests.cpp:2978:13: error: conversion from ‘long long unsigned int’ to ‘std::size_t’ {aka ‘unsigned int’} changes value from ‘18446744073709551615’ to ‘4294967295’ [-Werror=overflow]
 2978 |     value = 0xffffffffffffffffLLU;
      |             ^~~~~~~~~~~~~~~~~~~~~

https://github.com/google/libnop/blob/master/test/serializer_tests.cpp#L2968 does the right thing at runtime, and the compiler might not emit any code for the if(). But the contents is checked at build time, and you are treating these warnings as errors.

eieio commented 4 years ago

Thanks for reporting this issue. It should be addressed at 910b558.

Please reopen if this does not address the problem for you.