From bfaf31628798b1150b6cd02c56d4e247c20f0d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E6=B5=A9=E4=BC=9F?= <444347292@qq.com> Date: Wed, 7 Dec 2022 13:19:54 +0800 Subject: [PATCH] fix: byte_width_ = 1U << static_cast(packed_type & 3) implicit conversion loses integer precision: 'unsigned int' to 'uint8_t' (aka 'unsigned char') [-Werror,-Wimplicit-int-conversion] (#7697) Co-authored-by: Derek Bailey --- include/flatbuffers/flexbuffers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h index 79cdd9c5d62..838f94be539 100644 --- a/include/flatbuffers/flexbuffers.h +++ b/include/flatbuffers/flexbuffers.h @@ -384,7 +384,7 @@ class Reference { Reference(const uint8_t *data, uint8_t parent_width, uint8_t packed_type) : data_(data), parent_width_(parent_width) { - byte_width_ = 1U << static_cast(packed_type & 3); + byte_width_ = static_cast(1U << (packed_type & 3)); type_ = static_cast(packed_type >> 2); }