eclipse-iceoryx / iceoryx

Eclipse iceoryx™ - true zero-copy inter-process-communication
https://iceoryx.io
Apache License 2.0
1.68k stars 393 forks source link

Declared but undefined copy assignment operator for iox::expected #2216

Closed pbarone-latai closed 8 months ago

pbarone-latai commented 8 months ago

Required information

Operating system: Ubuntu 20.04.6 LTS

Compiler version: Clang 11

Eclipse iceoryx version: master

Observed result or behaviour:

iox::expected has a copy and a move assignment operator declared here: https://github.com/eclipse-iceoryx/iceoryx/blob/4739ffdc35c611197ab7bf2d9aa2db8e7cbd11df/iceoryx_hoofs/vocabulary/include/iox/expected.hpp#L166-L174

however, only the move assignment operator is defined https://github.com/eclipse-iceoryx/iceoryx/blob/4739ffdc35c611197ab7bf2d9aa2db8e7cbd11df/iceoryx_hoofs/vocabulary/include/iox/detail/expected.inl#L111-L121

As a result, a linker error is generated when attempting to run the following snippet ...

TEST_CASE("Test")
{
  iox::expected<void, int> a = iox::ok();
  iox::expected<void, int> b = iox::err(1);
  a = b;
}
ld.lld: error: undefined symbol: iox::expected<void, int>::operator=(iox::expected<void, int> const&)
>>> referenced by estimator_lib_test.cc
>>>               <REDACTED PATH>test.o:(C_A_T_C_H_T_E_S_T_2())
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

Expected result or behaviour: No compiler error

Conditions where it occurred / Performed steps: See above

elfenpiff commented 8 months ago

@pbarone-latai Whoopsie. How did that happen.

Thanks for the finding, I will take care of this.