From bbf86e3b76c8d2593e91e722a1e37f9c00c40ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez?= Date: Fri, 25 Oct 2024 08:20:42 +0200 Subject: [PATCH] Fix generated code compilation when a union uses an alias with scope (#411) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Refs #21823. Regression test Signed-off-by: Ricardo González Moreno * Refs #21823. Fix Signed-off-by: Ricardo González Moreno * Refs #21823. Apply suggestion Signed-off-by: Ricardo González Moreno * Refs #21823. Update submodule Signed-off-by: Ricardo González Moreno * Refs #21823. Fix render blank lines Signed-off-by: Ricardo González Moreno --------- Signed-off-by: Ricardo González Moreno --- .../com/eprosima/fastcdr/idl/templates/TypesHeader.stg | 10 +++++++++- .../eprosima/fastdds/idl/templates/DDSPubSubMain.stg | 1 + thirdparty/dds-types-test | 2 +- thirdparty/idl-parser | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg index 634c7e87..7901e493 100644 --- a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg +++ b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg @@ -836,7 +836,15 @@ $if(member.typecode.primitive)$ member_destructor_ = nullptr; m_$member.name$ = $member_default_init(member)$; $else$ -member_destructor_ = [&]() {$union_member_destroy_call(member)$\}; +member_destructor_ = [&]() +{ + $if(member.typecode.isAliasType)$ + $if(member.typecode.hasScope)$ + using namespace $member.typecode.scope$; + $endif$ + $endif$ + $union_member_destroy_call(member)$ +}; new(&m_$member.name$) $member_type_declaration(member)$(); $endif$ >> diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/DDSPubSubMain.stg b/src/main/java/com/eprosima/fastdds/idl/templates/DDSPubSubMain.stg index dd3dd356..fc81c9e2 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/DDSPubSubMain.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/DDSPubSubMain.stg @@ -20,6 +20,7 @@ main(ctx, definitions) ::= << $fileHeader(ctx=ctx, file=[ctx.filename, "main.cxx"], description=["This file acts as a main entry point to the application."])$ #include +#include #include #include #include diff --git a/thirdparty/dds-types-test b/thirdparty/dds-types-test index 923dc598..eff49726 160000 --- a/thirdparty/dds-types-test +++ b/thirdparty/dds-types-test @@ -1 +1 @@ -Subproject commit 923dc5986cc64bf34ceee2b20fdcb4c045907672 +Subproject commit eff497269eebe9dba3559f921b4e749804bf975c diff --git a/thirdparty/idl-parser b/thirdparty/idl-parser index 396ac154..513f4c21 160000 --- a/thirdparty/idl-parser +++ b/thirdparty/idl-parser @@ -1 +1 @@ -Subproject commit 396ac154bcb4c203d0945392aec9abc296eb046e +Subproject commit 513f4c21a91ee98c2a863cbbbd45ce7a260d8e6d