Skip to content

core: fix test in Apple clang 15.0.0 (Xcode 15.3)

Tommaso Pecorella requested to merge tommypec/ns-3-dev:FixXcode into master

Apple's latest clang raises an error:

/Users/pecos/Development/workspace/ns-3-dev/src/core/test/attribute-container-test-suite.cc:310:13: error: use of overloaded operator '==' is ambiguous (with operand types 'const value_type' (aka 'const pair<const std::string, long long>') and 'result_type' (aka 'pair<std::string, long long>'))
            NS_TEST_ASSERT_MSG_EQ(v, (*aciter)->Get(), "Incorrect value");
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pecos/Development/workspace/ns-3-dev/src/core/model/test.h:147:24: note: expanded from macro 'NS_TEST_ASSERT_MSG_EQ'
        if (!((actual) == (limit)))                                                                \
              ~~~~~~~~ ^  ~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__utility/pair.h:611:1: note: candidate function [with _T1 = const std::string, _T2 = long long, _U1 = std::string, _U2 = long long]
operator==(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y)
^
/Users/pecos/Development/workspace/ns-3-dev/src/core/test/attribute-container-test-suite.cc:207:1: note: candidate function [with A = const std::string, B = long long, C = std::string, D = long long]
operator==(const std::pair<A, B>& x, const std::pair<C, D>& y)
^

It turns out that we have an unnecessary operator.

Merge request reports