Skip to content
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

[bug] Build fails on min() and max() when Matter library used #99

Open
rei-vilo opened this issue Nov 14, 2024 · 2 comments
Open

[bug] Build fails on min() and max() when Matter library used #99

rei-vilo opened this issue Nov 14, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rei-vilo
Copy link

rei-vilo commented Nov 14, 2024

Hardware

Arduino Nano Matter

Core version

2.1.0

Arduino IDE version

2.3.3

Operating system

Debian

Radio stack variant

Matter

OpenThread Border Router device (if using Matter)

No response

Issue description

Build fails on min() and max() when the Matter library is used.

Compilation error: call of overloaded 'min(uint16_t&, uint16_t&)' is ambiguous

See minimal code and cnsole output attached.

Serial output

/home/user/.arduino15/packages/SiliconLabs/tools/gcc-arm-none-eabi/12.2.rel1/bin/arm-none-eabi-g++ -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -c -g -w -std=c++11 -std=gnu++17 -Wall -Wextra -fno-exceptions -fdata-sections -ffunction-sections -fomit-frame-pointer -imacros sl_gcc_preinclude.h -mcmse -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type -Wno-psabi -fno-strict-aliasing -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-common -Wno-sign-compare --specs=nano.specs -g -Os -DF_CPU=39000000 -DARDUINO=10607 "-DARDUINO_SILABS=\"2.1.0\"" -DARDUINO_NANO_MATTER -DARDUINO_ARCH_SILABS -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/cores/silabs/api/deprecated -DNUM_LEDS=3 -DNUM_BTN=1 -DNUM_HW_SERIAL=2 -DNUM_HW_SPI=2 -DNUM_HW_I2C=2 -DNUM_DAC_HW=2 -DARDUINO_MAIN_TASK_STACK_SIZE=2048 -DARDUINO_MATTER -DCHIP_CRYPTO_PLATFORM=1 -DIS_DEMO_LIGHT=1 -DNVM3_DEFAULT_MAX_OBJECT_SIZE=4092 -DNVM3_DEFAULT_NVM_SIZE=40960 -DSL_STATUS_LED=0 -D_WANT_REENT_SMALL=1 -DconfigNUM_THREAD_LOCAL_STORAGE_POINTERS=2 -DconfigNUM_USER_THREAD_LOCAL_STORAGE_POINTERS=0 -DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h> -DCHIP_HAVE_CONFIG_H=1 -DCURRENT_TIME_NOT_IMPLEMENTED=1 -DMBEDTLS_USER_CONFIG_FILE=<sli_psa_builtin_config.h> -DOPENTHREAD_CONFIG_DETERMINISTIC_ECDSA_ENABLE=0 -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0 -DSILABS_OTA_ENABLED=1 -DRTT_USE_ASM=0 -DENABLE_WSTK_LEDS=1 -DMGM240SD22VNA=1 -DSL_APP_PROPERTIES=1 -DHARDWARE_BOARD_DEFAULT_RF_BAND_2400=1 -DHARDWARE_BOARD_SUPPORTS_1_RF_BAND=1 -DHARDWARE_BOARD_SUPPORTS_RF_BAND_2400=1 "-DSL_BOARD_NAME=\"BRD2707A\"" "-DSL_BOARD_REV=\"A00\"" -DconfigNUM_SDK_THREAD_LOCAL_STORAGE_POINTERS=2 -DSL_COMPONENT_CATALOG_PRESENT=1 -DMBEDTLS_CONFIG_FILE=<sl_mbedtls_config.h> -DRADIO_CONFIG_DMP_SUPPORT=1 "-DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-efr32-config-check.h\"" "-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-core-efr32-config.h\"" "-DOPENTHREAD_CONFIG_FILE=\"sl_openthread_generic_config.h\"" -DOPENTHREAD_FTD=1 "-DSL_OPENTHREAD_STACK_FEATURES_CONFIG_FILE=\"sl_openthread_features_config.h\"" -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=<psa_crypto_config.h> -DSL_RAIL_LIB_MULTIPROTOCOL_SUPPORT=1 -DSL_RAIL_UTIL_PA_CONFIG_HEADER=<sl_rail_util_pa_config.h> -DSLI_RADIOAES_REQUIRES_MASKING=1 -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/autogen/zap-generated -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/autogen/zap-generated/app -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/config -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/config/btconf -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/config/common -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/autogen -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/examples/platform/silabs -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/lib -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/third_party/nlassert/repo/include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/third_party/nlio/repo/include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/zzz_generated/app-common -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/slc/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/examples/platform/silabs/efr32 -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/platform/silabs/efr32 -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/examples/providers -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/basic-information -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/color-control-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/diagnostic-logs-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/door-lock-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/general-commissioning-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/general-diagnostics-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/groups-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/identify-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/level-control -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/network-commissioning -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/occupancy-sensor-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/on-off-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/ota-requestor -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/third_party/silabs/gecko_sdk/util/third_party/segger/systemview/SEGGER -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/software-diagnostics-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/switch-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/clusters/window-covering-server -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/Device/SiliconLabs/MGM24/Include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/app/common/util/app_assert -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/app/common/util/app_log -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/common/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/protocol/bluetooth/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/protocol/bluetooth/bgstack/ll/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/hardware/board/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/bootloader -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/bootloader/api -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/CMSIS/Core/Include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/CMSIS/RTOS2/Include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/hardware/driver/configuration_over_swo/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/driver/debug/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/service/device_init/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/emdrv/dmadrv/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/emdrv/common/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/emlib/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/plugin/fem_util -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/freertos/cmsis/Include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/freertos/kernel/include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/emdrv/gpiointerrupt/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/service/hfxo_manager/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/driver/i2cspm/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/service/iostream/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/driver/leddrv/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/security/sl_component/sl_mbedtls_support/config -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/security/sl_component/sl_mbedtls_support/config/preset -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/security/sl_component/sl_mbedtls_support/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/mbedtls/include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/mbedtls/library -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/service/mpu/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/emdrv/nvm3/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/openthread/include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/openthread/include/openthread -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/openthread/src/core -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/openthread/third_party/tcplp -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/openthread/examples/platforms -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/third_party/openthread/examples/platforms/utils -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/protocol/openthread/platform-abstraction/efr32 -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/protocol/openthread/platform-abstraction/include -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/peripheral/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/service/power_manager/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/security/sl_component/sl_psa_driver/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/driver/pwm/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/common -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/protocol/ble -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/protocol/ieee802154 -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/protocol/wmbus -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/protocol/zwave -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/chip/efr32/efr32xg2x -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/protocol/sidewalk -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/plugin/pa-conversions -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24 -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/plugin/rail_util_power_manager_init -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/plugin/rail_util_pti -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/radio/rail_lib/plugin/rail_util_rssi -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/security/sl_component/se_manager/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/security/sl_component/se_manager/src -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/plugin/security_manager -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/util/silicon_labs/silabs_core/memory_manager -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/common/toolchain/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/service/system/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/service/sleeptimer/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/security/sl_component/sl_protocol_crypto/src -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/emdrv/spidrv/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/gecko_sdk_4.4.0/platform/service/udelay/inc -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/cores/silabs -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter -I/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/libraries/Matter/src /tmp/arduino/sketches/EBC636DF3341B68039112CFE6CE370FB/sketch/sketch_nov14a.ino.cpp -o /tmp/arduino/sketches/EBC636DF3341B68039112CFE6CE370FB/sketch/sketch_nov14a.ino.cpp.o
/tmp/.arduinoIDE-unsaved20241014-50286-fss96r.j24vr/sketch_nov14a/sketch_nov14a.ino: In function 'void setup()':
/tmp/.arduinoIDE-unsaved20241014-50286-fss96r.j24vr/sketch_nov14a/sketch_nov14a.ino:12:19: error: call of overloaded 'min(uint16_t&, uint16_t&)' is ambiguous
   12 |   uint16_t c = min(a, b);
      |                ~~~^~~~~~
In file included from /home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/cores/silabs/api/Interrupts.h:8,
                 from /home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/cores/silabs/api/ArduinoAPI.h:29,
                 from /home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/cores/silabs/Arduino.h:30,
                 from /tmp/arduino/sketches/EBC636DF3341B68039112CFE6CE370FB/sketch/sketch_nov14a.ino.cpp:1:
/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/cores/silabs/api/Common.h:129:6: note: candidate: 'decltype (((b < a) ? b :  a)) min(const T&, const L&) [with T = short unsigned int; L = short unsigned int; decltype (((b < a) ? b :  a)) = const short unsigned int&]'
  129 | auto min(const T & a, const L & b) -> decltype((b < a) ? b : a)
      |      ^~~
In file included from /home/user/.arduino15/packages/SiliconLabs/tools/gcc-arm-none-eabi/12.2.rel1/arm-none-eabi/include/c++/12.2.1/bits/specfun.h:45,
                 from /home/user/.arduino15/packages/SiliconLabs/tools/gcc-arm-none-eabi/12.2.rel1/arm-none-eabi/include/c++/12.2.1/cmath:1935,
                 from /home/user/.arduino15/packages/SiliconLabs/tools/gcc-arm-none-eabi/12.2.rel1/arm-none-eabi/include/c++/12.2.1/math.h:36,
                 from /home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/cores/silabs/api/ArduinoAPI.h:47:
/home/user/.arduino15/packages/SiliconLabs/tools/gcc-arm-none-eabi/12.2.rel1/arm-none-eabi/include/c++/12.2.1/bits/stl_algobase.h:232:5: note: candidate: 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = short unsigned int]'
  232 |     min(const _Tp & __a, const _Tp & __b)
      |     ^~~
In file included from /home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/lib/core/CASEAuthTag.h:25,
                 from /home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/access/SubjectDescriptor.h:23,
                 from /home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/AttributeAccessInterface.h:21,
                 from /home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/app/util/attribute-storage.h:21,
                 from /home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/libraries/Matter/src/MatterEndpointHandler.h:30,
                 from /home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/libraries/Matter/src/Matter.h:35,
                 from /tmp/.arduinoIDE-unsaved20241014-50286-fss96r.j24vr/sketch_nov14a/sketch_nov14a.ino:1:
/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/lib/support/CodeUtils.h:138:33: note: candidate: 'constexpr const _T& chip::min(const _T&, const _T&) [with _T = short unsigned int]'
  138 |     constexpr inline const _T & min(const _T & a, const _T & b)
      |                                 ^~~
/tmp/.arduinoIDE-unsaved20241014-50286-fss96r.j24vr/sketch_nov14a/sketch_nov14a.ino:13:19: error: call of overloaded 'max(uint16_t&, uint16_t&)' is ambiguous
   13 |   uint16_t d = max(a, b);
      |                ~~~^~~~~~
/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/cores/silabs/api/Common.h:135:6: note: candidate: 'decltype (((b < a) ? b :  a)) max(const T&, const L&) [with T = short unsigned int; L = short unsigned int; decltype (((b < a) ? b :  a)) = const short unsigned int&]'
  135 | auto max(const T & a, const L & b) -> decltype((b < a) ? b : a)
      |      ^~~
/home/user/.arduino15/packages/SiliconLabs/tools/gcc-arm-none-eabi/12.2.rel1/arm-none-eabi/include/c++/12.2.1/bits/stl_algobase.h:258:5: note: candidate: 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = short unsigned int]'
  258 |     max(const _Tp & __a, const _Tp & __b)
      |     ^~~
/home/user/.arduino15/packages/SiliconLabs/hardware/silabs/2.1.0/variants/nano_matter/matter/matter_2.2.0/src/lib/support/CodeUtils.h:149:33: note: candidate: 'constexpr const _T& chip::max(const _T&, const _T&) [with _T = short unsigned int]'
  149 |     constexpr inline const _T & max(const _T & a, const _T & b)
      |                                 ^~~
Compilation error: call of overloaded 'min(uint16_t&, uint16_t&)' is ambiguous

RTT output (if using Matter)

No response

Minimal reproducer code

#include <Matter.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  uint16_t a = 2;
  uint16_t b = 3;
  uint16_t c = min(a, b);
  uint16_t d = max(a, b);

  Serial.println(c);
  Serial.println(d);
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(1000);
}
@rei-vilo rei-vilo added the bug Something isn't working label Nov 14, 2024
@leonardocavagnis
Copy link
Contributor

leonardocavagnis commented Nov 15, 2024

Hi @rei-vilo,
Thanks for the bug report!
Unfortunately, min and max functions are declared in both the ArduinoCore-API and Matter libraries.

If you want to use the functions alongside the Matter.h library, you can use namespace chip:: like this:

#include <Matter.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  uint16_t a = 2;
  uint16_t b = 3;
  uint16_t c = chip::min(a, b);
  uint16_t d = chip::max(a, b);

  Serial.println(c);
  Serial.println(d);
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(1000);
}

@rei-vilo
Copy link
Author

rei-vilo commented Nov 15, 2024

Thank you for the confirmation of the conflict on min() and max().

However, using chip::min() or chip::max() limits the code portability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants