From 37c4ee9f5a740b8f7a58e905b432e08e6f62dea9 Mon Sep 17 00:00:00 2001 From: Miki Rozloznik Date: Fri, 13 Dec 2024 10:25:59 +0100 Subject: [PATCH] Fix gcc conversion warnings in constants and initializers --- extension/freemarker/Constant.h.ftl | 2 +- extension/freemarker/Structure.cpp.ftl | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extension/freemarker/Constant.h.ftl b/extension/freemarker/Constant.h.ftl index 299f664..0905801 100644 --- a/extension/freemarker/Constant.h.ftl +++ b/extension/freemarker/Constant.h.ftl @@ -14,7 +14,7 @@ <@doc_comments docComments/> constexpr ${typeInfo.typeFullName} ${name} = <#rt> - <#lt><#if typeInfo.isNumeric>static_cast<${typeInfo.typeFullName}>(${value}<#rt> + <#lt><#if typeInfo.isNumeric>static_cast<${typeInfo.typeFullName}::ValueType>(${value}<#rt> <#lt><#if typeInfo.isNumeric>); <@namespace_end package.path/> diff --git a/extension/freemarker/Structure.cpp.ftl b/extension/freemarker/Structure.cpp.ftl index 641c6f1..4b5e198 100644 --- a/extension/freemarker/Structure.cpp.ftl +++ b/extension/freemarker/Structure.cpp.ftl @@ -21,7 +21,9 @@ ${name}::${name}(const AllocatorType&<#if fields_need_allocator(fieldList)> allo <#lt> : <#items as field> <#if field.initializer??> - ${field.name}(${field.initializer}<#if field_needs_allocator(field)>, allocator)<#sep>, + ${field.name}(<#if field.typeInfo.isNumeric>static_cast<${field.typeInfo.typeFullName}::ValueType>(<#rt> + <#lt>${field.initializer}<#if field.typeInfo.isNumeric>)<#rt> + <#lt><#if field_needs_allocator(field)>, allocator)<#sep>, <#else> ${field.name}(<#if field_needs_allocator(field)>allocator)<#sep>,