ssilverman / QNEthernet

An lwIP-based Ethernet library for Teensy 4.1 and possibly some other platforms
GNU Affero General Public License v3.0
81 stars 24 forks source link

New Warning appear after updating to 0.25.0 Version, from 0.21.0 #56

Closed Stevenlawrencehoriba closed 10 months ago

Stevenlawrencehoriba commented 10 months ago

.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

ssilverman commented 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.

ssilverman commented 10 months ago

I'm also curious, what does your platformio.ini file look like? (Assuming you're using PlatformIO.)

ssilverman commented 10 months ago

Also, which version of Teensyduino are you using? I suspect you're not using the latest toolchain.

Stevenlawrencehoriba commented 10 months ago

[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

ssilverman commented 10 months ago

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…)

ssilverman commented 8 months ago

I just noticed this, with the capital ‘U’: “build_Unflags” Try with “build_unflags” instead.