Skip to content

Conflicting definitions of ostream& operator<<() with Xcode 12.0.1 #170

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

Closed
jgfoster opened this issue Oct 5, 2020 · 1 comment
Closed

Comments

@jgfoster
Copy link
Member

jgfoster commented Oct 5, 2020

System

  • OS: macOS 10.15.7
  • ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
  • bundle -v: Bundler version 1.17.2
  • bundle info arduino_ci: arduino_ci (0.3.0)
  • g++ -v: Apple clang version 12.0.0 (clang-1200.0.32.2)
  • Arduino IDE version: 1.8.13
  • java -version: java version "11.0.7" 2020-04-14 LTS
  • URL of failing Travis CI job: (none)
  • URL of your Arduino project: https://github.com/jgfoster/arduino_ci

Conflicting definitions of ostream& operator<<()

The following both have definitions:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ostream:223:20
/Users/jfoster/code/Arduino/arduino_ci/cpp/unittest/OstreamHelpers.h:5:22

Here is the output:

Unit testing library.cpp with g++... 

Last command:  $ g++ -std=c++0x -o /Users/jfoster/code/Arduino/arduino_ci/SampleProjects/TestSomething/unittest_library.cpp.bin -DARDUINO=100 -g -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -D__AVR_ATmega328P__ -I/Users/jfoster/code/Arduino/arduino_ci/cpp/arduino -I/Users/jfoster/code/Arduino/arduino_ci/cpp/unittest -I/Users/jfoster/code/Arduino/arduino_ci/SampleProjects/TestSomething/test -I/Users/jfoster/code/Arduino/arduino_ci/SampleProjects/TestSomething /Users/jfoster/code/Arduino/arduino_ci/cpp/arduino/Arduino.cpp /Users/jfoster/code/Arduino/arduino_ci/cpp/arduino/Godmode.cpp /Users/jfoster/code/Arduino/arduino_ci/cpp/arduino/stdlib.cpp /Users/jfoster/code/Arduino/arduino_ci/cpp/unittest/ArduinoUnitTests.cpp /Users/jfoster/code/Arduino/arduino_ci/SampleProjects/TestSomething/test-something.cpp /Users/jfoster/code/Arduino/arduino_ci/SampleProjects/TestSomething/test/library.cpp

In file included from /Users/jfoster/code/Arduino/arduino_ci/SampleProjects/TestSomething/test/library.cpp:1:
/Users/jfoster/code/Arduino/arduino_ci/cpp/unittest/ArduinoUnitTests.h:90:54: error: use of overloaded operator '<<' is ambiguous (with operand types 'basic_ostream<char, std::__1::char_traits<char> >' and 'const nullptr_t')
            cerr << "      " << lhsRelevance << ": " << lhs << endl;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
/Users/jfoster/code/Arduino/arduino_ci/cpp/unittest/ArduinoUnitTests.h:219:20: note: in instantiation of function template specialization 'Test::ReporterTAP::onAssert<nullptr_t, int *>' requested here
        mReporter->onAssert(file, line, description, ok,
                   ^
/Users/jfoster/code/Arduino/arduino_ci/SampleProjects/TestSomething/test/library.cpp:11:3: note: in instantiation of function template specialization 'Test::assertion<nullptr_t, int *>' requested here
  assertEqual(nullptr, aNullPointer());
  ^
/Users/jfoster/code/Arduino/arduino_ci/cpp/unittest/Assertion.h:33:38: note: expanded from macro 'assertEqual'
#define assertEqual(arg1,arg2)       assertOp("assertEqual","expected",arg1,compareEqual,"==","actual",arg2)
                                     ^
/Users/jfoster/code/Arduino/arduino_ci/cpp/unittest/Assertion.h:26:3: note: expanded from macro 'assertOp'
  testBehaviorOp(false, desc, rel1, arg1, op, op_name, rel2, arg2)
  ^
/Users/jfoster/code/Arduino/arduino_ci/cpp/unittest/Assertion.h:12:10: note: expanded from macro 'testBehaviorOp'
    if (!assertion<typeof(arg1), typeof(arg2)>(__FILE__, __LINE__,     \
         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ostream:223:20: note: candidate function
    basic_ostream& operator<<(nullptr_t)
                   ^
/Users/jfoster/code/Arduino/arduino_ci/cpp/unittest/OstreamHelpers.h:5:22: note: candidate function
inline std::ostream& operator << (std::ostream& out, const std::nullptr_t &np) { return out << "nullptr"; }
                     ^
1 error generated.
...Unit testing library.cpp with g++                                           ✗
@jgfoster
Copy link
Member Author

jgfoster commented Oct 5, 2020

Fixed by #171.

@jgfoster jgfoster closed this as completed Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant