From 070154b5a5f5ba2583e28a9b27a64bf057a38948 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 21 Dec 2024 19:42:45 +0100 Subject: [PATCH] Added more explicit type casts --- include/rfl/parsing/Parser_optional.hpp | 3 ++- include/rfl/parsing/Parser_shared_ptr.hpp | 3 ++- include/rfl/parsing/Parser_unique_ptr.hpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/rfl/parsing/Parser_optional.hpp b/include/rfl/parsing/Parser_optional.hpp index d4726939..029a897b 100644 --- a/include/rfl/parsing/Parser_optional.hpp +++ b/include/rfl/parsing/Parser_optional.hpp @@ -51,7 +51,8 @@ struct Parser, ProcessorsType> { if constexpr (schemaful::IsSchemafulWriter) { auto u = ParentType::add_union(_w, _parent); using UnionType = typename ParentType::template Union; - auto p = UnionType{.index_ = _o ? 0 : 1, .union_ = &u}; + auto p = + UnionType{.index_ = static_cast(_o ? 0 : 1), .union_ = &u}; if (_o) { Parser, ProcessorsType>::write(_w, *_o, p); } else { diff --git a/include/rfl/parsing/Parser_shared_ptr.hpp b/include/rfl/parsing/Parser_shared_ptr.hpp index 7c45e225..e7dcba02 100644 --- a/include/rfl/parsing/Parser_shared_ptr.hpp +++ b/include/rfl/parsing/Parser_shared_ptr.hpp @@ -49,7 +49,8 @@ struct Parser, ProcessorsType> { if constexpr (schemaful::IsSchemafulWriter) { auto u = ParentType::add_union(_w, _parent); using UnionType = typename ParentType::template Union; - auto p = UnionType{.index_ = _s ? 0 : 1, .union_ = &u}; + auto p = + UnionType{.index_ = static_cast(_s ? 0 : 1), .union_ = &u}; if (_s) { Parser, ProcessorsType>::write(_w, *_s, p); } else { diff --git a/include/rfl/parsing/Parser_unique_ptr.hpp b/include/rfl/parsing/Parser_unique_ptr.hpp index 04869ce0..b9d60587 100644 --- a/include/rfl/parsing/Parser_unique_ptr.hpp +++ b/include/rfl/parsing/Parser_unique_ptr.hpp @@ -50,7 +50,8 @@ struct Parser, ProcessorsType> { if constexpr (schemaful::IsSchemafulWriter) { auto u = ParentType::add_union(_w, _parent); using UnionType = typename ParentType::template Union; - auto p = UnionType{.index_ = _s ? 0 : 1, .union_ = &u}; + auto p = + UnionType{.index_ = static_cast(_s ? 0 : 1), .union_ = &u}; if (_s) { Parser, ProcessorsType>::write(_w, *_s, p); } else {