You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zserio version and language
Zserio: 2.16.0
Language: C++
Describe the bug
Generated C++ code includes <cstdint> but uses types like uint64_t, int64_t (etc.) without the std:: namespace prefix. This is incorrect and not portable. It causes compilation errors when building with gcc15 such as:
/home/dope/.conan/data/zserio/2.16.0/_/_/build/2a1643475ff774383687d1e8922f3bc3015406f5/src/compiler/extensions/cpp/runtime/src/zserio/JsonEncoder.h: In static member function ‘static void zserio::JsonEncoder::encodeIntegral(std::ostream&, T)’:
/home/dope/.conan/data/zserio/2.16.0/_/_/build/2a1643475ff774383687d1e8922f3bc3015406f5/src/compiler/extensions/cpp/runtime/src/zserio/JsonEncoder.h:67:76: error: ‘uint64_t’ was not declared in this scope [-Wtemplate-body]
67 | using U = typename std::conditional<std::is_signed<T>::value, int64_t, uint64_t>::type;
| ^~~~~~~~
To fix it, either:
use #include <cstdint> and std::uint64_t in zserio code (preferred and more modern solution, but you have to replace many int64_t into std::int64_t, same for other types like int8_t, etc.)
or use #include <stdint.h> and int64_t in zserio code. This is the less preferred and is the old pre-c++11 way. Since it does not use namespace, it is more prone to name collisions.
How to reproduce
N/A
Expected behavior
Generated C++ code should compile on any compiler
The text was updated successfully, but these errors were encountered:
Thanks for the report. Currently, we directly support only g++7 and g++11. We should investigate this to understand clearly the differencies between gcc versions.
I will put this issue to the current milestone. However, we are working on C++17 generator now, so it will take some time. If this issue is urgent, please write us a note here. Thanks.
Well, the issue is clear enough even if you do not use gcc-15 anyway:
if you include (which is the case in zserio source code), then you have to use std::int64_t (not int64_t)
if you include <stdint.h>, then you have to use int64_t (not std::int64_t)
Same for other types obviously (std::int8_t, std::uint8_t, etc.)
So it's quite trivial to fix, i.e. replace types such as int64_t with std::int64_t.
If this issue is urgent, please write us a note here
The issue is not urgent for me. Our current toolchain builds successfully, but I noticed the issue when trying to build with gcc-15 (which is not officially used yet in my company).
Zserio version and language
Zserio: 2.16.0
Language: C++
Describe the bug
Generated C++ code includes
<cstdint>
but uses types likeuint64_t
,int64_t
(etc.) without thestd::
namespace prefix. This is incorrect and not portable. It causes compilation errors when building with gcc15 such as:To fix it, either:
#include <cstdint>
andstd::uint64_t
in zserio code (preferred and more modern solution, but you have to replace manyint64_t
intostd::int64_t
, same for other types likeint8_t
, etc.)#include <stdint.h>
andint64_t
in zserio code. This is the less preferred and is the old pre-c++11 way. Since it does not use namespace, it is more prone to name collisions.How to reproduce
N/A
Expected behavior
Generated C++ code should compile on any compiler
The text was updated successfully, but these errors were encountered: