Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21613] Compilation error for sequences of nested typedefs in module #391

Open
mirean opened this issue Sep 5, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@mirean
Copy link

mirean commented Sep 5, 2024

Testing IDL:

module Test
{
  typedef char T_Char;
  typedef sequence<T_Char, 500> T_LongString;
  struct T_Description
  {
    T_LongString name;
  };
};

Running with

fastddsgen -example CMake -replace test.idl

Results in

[ 12%] Building CXX object CMakeFiles/test_lib.dir/testTypeObjectSupport.cxx.o
/home/dds/testTypeObjectSupport.cxx: In function 'void Test::register_T_LongString_type_identifier(eprosima::fastdds::dds::xtypes::TypeIdentifierPair&)':
/home/dds/testTypeObjectSupport.cxx:122:18: error: 'element_identifier_anonymous_sequence_Test' has not been declared
  122 |             bool element_identifier_anonymous_sequence_Test::T_Char_500_ec {false};
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dds/testTypeObjectSupport.cxx:122:76: error: qualified-id in declaration before '{' token
  122 |             bool element_identifier_anonymous_sequence_Test::T_Char_500_ec {false};
      |                                                                            ^
/home/dds/testTypeObjectSupport.cxx:123:29: error: 'element_identifier_anonymous_sequence_Test' has not been declared
  123 |             TypeIdentifier* element_identifier_anonymous_sequence_Test::T_Char_500 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_T_LongString, element_identifier_anonymous_sequence_Test::T_Char_500_ec))};
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dds/testTypeObjectSupport.cxx:123:84: error: qualified-id in declaration before '{' token
  123 |             TypeIdentifier* element_identifier_anonymous_sequence_Test::T_Char_500 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_T_LongString, element_identifier_anonymous_sequence_Test::T_Char_500_ec))};
      |                                                                                    ^
/home/dds/testTypeObjectSupport.cxx:124:18: error: 'element_identifier_anonymous_sequence_Test' has not been declared
  124 |             if (!element_identifier_anonymous_sequence_Test::T_Char_500_ec)
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dds/testTypeObjectSupport.cxx:129:29: error: 'equiv_kind_anonymous_sequence_Test' has not been declared
  129 |             EquivalenceKind equiv_kind_anonymous_sequence_Test::T_Char_500 = EK_COMPLETE;
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dds/testTypeObjectSupport.cxx:129:76: error: qualified-id in declaration before '=' token
  129 |             EquivalenceKind equiv_kind_anonymous_sequence_Test::T_Char_500 = EK_COMPLETE;
      |                                                                            ^
/home/dds/testTypeObjectSupport.cxx:132:17: error: 'equiv_kind_anonymous_sequence_Test' has not been declared
  132 |                 equiv_kind_anonymous_sequence_Test::T_Char_500 = EK_BOTH;
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dds/testTypeObjectSupport.cxx:134:35: error: 'element_flags_anonymous_sequence_Test' has not been declared
  134 |             CollectionElementFlag element_flags_anonymous_sequence_Test::T_Char_500 = 0;
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dds/testTypeObjectSupport.cxx:134:85: error: qualified-id in declaration before '=' token
  134 |             CollectionElementFlag element_flags_anonymous_sequence_Test::T_Char_500 = 0;
      |                                                                                     ^
/home/dds/testTypeObjectSupport.cxx:135:35: error: 'header_anonymous_sequence_Test' has not been declared
  135 |             PlainCollectionHeader header_anonymous_sequence_Test::T_Char_500 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_Test::T_Char_500, element_flags_anonymous_sequence_Test::T_Char_500);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dds/testTypeObjectSupport.cxx:135:78: error: qualified-id in declaration before '=' token
  135 |             PlainCollectionHeader header_anonymous_sequence_Test::T_Char_500 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_Test::T_Char_500, element_flags_anonymous_sequence_Test::T_Char_500);
      |                                                                              ^
/home/dds/testTypeObjectSupport.cxx:138:102: error: 'header_anonymous_sequence_Test' has not been declared
  138 |                 PlainSequenceLElemDefn seq_ldefn = TypeObjectUtils::build_plain_sequence_l_elem_defn(header_anonymous_sequence_Test::T_Char_500, bound,
      |                                                                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dds/testTypeObjectSupport.cxx:139:73: error: 'element_identifier_anonymous_sequence_Test' was not declared in this scope
  139 |                             eprosima::fastcdr::external<TypeIdentifier>(element_identifier_anonymous_sequence_Test::T_Char_500));
      |                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/test_lib.dir/build.make:76: CMakeFiles/test_lib.dir/testTypeObjectSupport.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/test_lib.dir/all] Error 2

The issue also appears if using array instead of sequence.
It seems to be linked to the inclusion of the namespace in the name. If I manually remove the "Test::" from the above lines, compilation is successful.
The issue disappears if any of the following conditions is met:

  • No module is used
  • There is only one layer of typedefs (i.e. there is no T_Char, and the sequence uses char)

Unfortunately this layering appears in IDLs we have to use and we cannot modify them to get rid of the extra layer.

Versions (all built from source):
fastddsgen 4.0.0
Fast-DDS 3.0.0

@JesusPoderoso
Copy link
Contributor

Hi @mirean, thanks for your report.
The eProsima team will review it in the following days and come back with some feedback.

@JesusPoderoso JesusPoderoso added the bug Something isn't working label Sep 9, 2024
@JesusPoderoso JesusPoderoso changed the title Compilation error for sequences of nested typedefs in module [21613] Compilation error for sequences of nested typedefs in module Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants