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

Compile error when using -typeobject in fastddsgen #158

Open
1 task done
NeilTruter opened this issue Feb 20, 2023 · 5 comments
Open
1 task done

Compile error when using -typeobject in fastddsgen #158

NeilTruter opened this issue Feb 20, 2023 · 5 comments
Labels

Comments

@NeilTruter
Copy link

Is there an already existing issue for this?

  • I have searched the existing issues

Expected behavior

Successful compile of code when specifying -typeobject when using fastddsgen

Current behavior

When specifying '-typeobject' for fastddsgen, and then compiling my project I receive the error below.
Omitting '-typeobject' from fastddsgen my project compiles without error.

/usr/local/include/fastcdr/Cdr.h:1381: error: ambiguous overload for ‘operator==’ (operand types are ‘uint8_t’ {aka ‘unsigned char’} and ‘eprosima::fastcdr::Cdr::Endianness’)
In file included from /home/user/Projects/Generic/Libs/Omnibus/generated/Alarm.cxx:31:
/usr/local/include/fastcdr/Cdr.h: In member function ‘eprosima::fastcdr::Cdr& eprosima::fastcdr::Cdr::serialize(const std::vector&, eprosima::fastcdr::Cdr::Endianness)’:
/usr/local/include/fastcdr/Cdr.h:1381:53: error: ambiguous overload for ‘operator==’ (operand types are ‘uint8_t’ {aka ‘unsigned char’} and ‘eprosima::fastcdr::Cdr::Endianness’)
1381 | m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness));
| ~~~~~~~~~~~~ ^~ ~~~~~~~~~~
| | |
| | eprosima::fastcdr::Cdr::Endianness
| uint8_t {aka unsigned char}

/usr/local/include/fastrtps/types/TypeObject.h:18: In file included from /usr/local/include/fastrtps/types/TypeObject.h:18,
In file included from /usr/local/include/fastrtps/types/TypeObject.h:18,
from /home/user/Projects/Generic/Libs/Omnibus/generated/AlarmTypeObject.h:26,
from /home/user/Projects/Generic/Libs/Omnibus/generated/Alarm.cxx:30:
/usr/local/include/fastrtps/types/TypesBase.h:251:1: note: candidate: ‘typename std::enable_if<(std::is_arithmetic<_Tp>::value || std::is_enum<_Tp>::value), bool>::type eprosima::fastrtps::types::operator==(T, const eprosima::fastrtps::types::ReturnCode_t&) [with T = eprosima::fastcdr::Cdr::Endianness; typename std::enable_if<(std::is_arithmetic<_Tp>::value || std::is_enum<_Tp>::value), bool>::type = bool]’ (reversed)
251 | operator ==(
| ^~~~~~~~

/home/user/Projects/Generic/Libs/Omnibus/generated/Alarm.cxx:31: In file included from /home/user/Projects/Generic/Libs/Omnibus/generated/Alarm.cxx:31:
In file included from /home/user/Projects/Generic/Libs/Omnibus/generated/Alarm.cxx:31:
/usr/local/include/fastcdr/Cdr.h:1381:53: note: candidate: ‘operator==(int, int)’ (built-in)
1381 | m_swapBytes = (m_swapBytes && (m_endianness == endianness)) || (!m_swapBytes && (m_endianness != endianness));
| ~~~~~~~~~~~~~^~~~~~~~~~~~~

Steps to reproduce

Use -typeobject with fastddsgen and compile the generated source into your own project.

Fast DDS version/commit

Latest, 2.9.1

Platform/Architecture

Windows 10 Visual Studio 2019, Other. Please specify in Additional context section.

Transport layer

Default configuration, UDPv4 & SHM

Additional context

Problem exists on both Windows 10 and Ubuntu 22.04.1 LTS.
Using QtCreator to compile code.

XML configuration file

No response

Relevant log output

No response

Network traffic capture

No response

@JesusPoderoso JesusPoderoso transferred this issue from eProsima/Fast-DDS Mar 9, 2023
@JesusPoderoso
Copy link
Contributor

JesusPoderoso commented Mar 9, 2023

Hello @NeilTruter

Thanks for the report.

Following the contributing guidelines, this issue has been moved to the Fast DD-Gen repository.

Please, try this and let us know if it does not allow you to compile either.

@JesusPoderoso JesusPoderoso added need more info More information is required to reproduce and removed triage labels Mar 9, 2023
@tmayoff
Copy link

tmayoff commented Mar 13, 2023

I ran into this issue as well, it seems to be an issue when compiling with C++20, I setup a small demo here: https://github.com/tmayoff/eprosima-test/tree/endianness, added the FASTRTPS_DYN_LINK didn't seem to do anything

@tmayoff
Copy link

tmayoff commented Mar 13, 2023

Another note this seems to just be a problem when compiling with clang++, where as g++ looks fine

@NeilTruter
Copy link
Author

Another note this seems to just be a problem when compiling with clang++, where as g++ looks fine

I have this problem on both Windows and Ubuntu using Qt and compiling with MSVC on Windows and gcc on Ubuntu

@NeilTruter
Copy link
Author

I ran into this issue as well, it seems to be an issue when compiling with C++20, I setup a small demo here: https://github.com/tmayoff/eprosima-test/tree/endianness, added the FASTRTPS_DYN_LINK didn't seem to do anything

I did some testing now and experiencing the same.
Switching from C++20 to C++17 my project compiles successfully, using C++20 I get the errors mentioned above. Adding FASTRTPS_DYN_LINK makes no difference.
Our top-level project settings set C++ to 20 due to some components requiring it thus I can't move away from it.

@JLBuenoLopez JLBuenoLopez added triage and removed need more info More information is required to reproduce labels Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants