eclipse-cyclonedds/cyclonedds-cxx

Missing ostream_operators.hpp include header

Opened this issue · 1 comments

Issue

A compilation error occurs when generating IDLs from a type that contains an attribute of another type.

In the example below, it seems like #include <org/eclipse/cyclonedds/util/ostream_operators.hpp> is being included in Measurements.cpp, but not RealType.cpp.

IDLs Used

Measurements.idl

module Measurements
{
    typedef octet NumericGUID[16];
};

RealType.idl

#include "Measurements.idl"

module TestType
{
    struct RealType {
        Measurements::NumericGUID messageIDs;
    };
};

Error Message

The error message is much longer than this, but it gets the point across..

/opt/share/CycloneDDS-CXX/examples/generate-test/build/generated-idls/RealType.cpp: In function ‘std::ostream& TestType::operator<<(std::ostream&, const TestType::RealType&)’:
/opt/share/CycloneDDS-CXX/examples/generate-test/build/generated-idls/RealType.cpp:17:24: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘const std::array<unsigned char, 16>’)
   os << "messageIDs: " << rhs.messageIDs();
   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /opt/share/CycloneDDS-CXX/examples/generate-test/build/generated-idls/Measurements.hpp:13,
                 from /opt/share/CycloneDDS-CXX/examples/generate-test/build/generated-idls/RealType.hpp:12,
                 from /opt/share/CycloneDDS-CXX/examples/generate-test/build/generated-idls/RealType.cpp:9:
/usr/include/c++/8/ostream:108:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
       operator<<(__ostream_type& (*__pf)(__ostream_type&))

Attaching the IDLs used and generated cpp types:
generate-test.zip