Skip to content

Commit c3eb17a

Browse files
Added explicit type casts
1 parent d9b4cf0 commit c3eb17a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

include/rfl/parsing/Parser_rfl_variant.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ class Parser<R, W, rfl::Variant<AlternativeTypes...>, ProcessorsType> {
112112
using Type = std::remove_cvref_t<decltype(_v)>;
113113
auto u = ParentType::add_union(_w, _parent);
114114
using UnionType = typename ParentType::template Union<decltype(u)>;
115-
auto p = UnionType{.index_ = _variant.index(), .union_ = &u};
115+
auto p = UnionType{.index_ = static_cast<size_t>(_variant.index()),
116+
.union_ = &u};
116117
Parser<R, W, Type, ProcessorsType>::write(_w, _v, p);
117118
},
118119
_variant);

include/rfl/parsing/Parser_variant.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ class Parser<R, W, std::variant<AlternativeTypes...>, ProcessorsType> {
141141
using Type = std::remove_cvref_t<decltype(_v)>;
142142
auto u = ParentType::add_union(_w, _parent);
143143
using UnionType = typename ParentType::template Union<decltype(u)>;
144-
auto p = UnionType{.index_ = _variant.index(), .union_ = &u};
144+
auto p = UnionType{.index_ = static_cast<size_t>(_variant.index()),
145+
.union_ = &u};
145146
Parser<R, W, Type, ProcessorsType>::write(_w, _v, p);
146147
},
147148
_variant);

0 commit comments

Comments
 (0)