Closed Stevenlawrencehoriba closed 10 months ago
I don't see this build error when I build with C++20. In any case, I made the operator==()
function const (I noticed it wasn't const, then noticed the suggestion in your compiler output :) ).
Does making the function const fix the compile error for you?
It's also interesting that neither slots_
nor service
is const, but there's still no ambiguity since there's a definite order to slots_[i] == service
.
I'm also curious, what does your platformio.ini file look like? (Assuming you're using PlatformIO.)
Also, which version of Teensyduino are you using? I suspect you're not using the latest toolchain.
[env:teensy41_dbgx_exram]
platform = https://github.com/tsandmann/platform-teensy.git
board = teensy41
framework = arduino
lib_deps =
https://github.com/tsandmann/freertos-teensy.git
https://github.com/PaulStoffregen/SPI
https://github.com/greiman/SdFat
https://github.com/nickgammon/Regexp
ssilverman/QNEthernet@^0.25.0
build_Unflags = -std=gnu++17
build_flags = -std=gnu++20 -Wformat=1 -fno-strict-aliasing -Wno-deprecated -Wno-unused-variable -Wno-unused-parameter
-D DEFAULT_TIME -D WAIT_SERIAL -D DEBUG_IFC -D DIAG_TASKS -D QSPI_RAM -DTEENSYDMX_USE_INTERVAL_TIMER
-DTEENSY41_RTOS -DARDUINO_TEENSY41 -DUSB_SERIAL -DTEENSY_OPT_FASTER_LTO -DLWIP_MDNS_RESPONDER=0
monitor_speed = 115200
monitor_rts = 0
Does making the function const fix the compile error for you?
Did you try this? (I haven’t yet looked at the tsandmann platform stuff you’re using…)
I just noticed this, with the capital ‘U’: “build_Unflags” Try with “build_unflags” instead.
.pio\libdeps\teensy41_dbgx_exram\QNEthernet\src\QNMDNS.cpp: In member function 'int qindesign::network::MDNSClass::findService(const char, const char, const char*, uint16_t)': .pio\libdeps\teensy41_dbgxexram\QNEthernet\src\QNMDNS.cpp:151:22: warning: C++20 says that these are ambiguous, even though the second is reversed: 151 | if (slots[i] == service) { | ^
~~ In file included from .pio\libdeps\teensy41_dbgx_exram\QNEthernet\src\QNMDNS.cpp:7: .pio\libdeps\teensy41_dbgx_exram\QNEthernet\src\QNMDNS.h:120:10: note: candidate 1: 'bool qindesign::network::MDNSClass::Service::operator==(const qindesign::network::MDNSClass::Service&)' 120 | bool operator==(const Service &other) { | ^~~~ .pio\libdeps\teensy41_dbgx_exram\QNEthernet\src\QNMDNS.h:120:10: note: candidate 2: 'bool qindesign::network::MDNSClass::Service::operator==(const qindesign::network::MDNSClass::Service&)' (reversed) .pio\libdeps\teensy41_dbgx_exram\QNEthernet\src\QNMDNS.h:120:10: note: try making the operator a 'const' member function