diff --git a/scripts/mrbind/common_compiler_parser_flags.txt b/scripts/mrbind/common_compiler_parser_flags.txt index 4d7d5c2817c9..583dc093b97b 100644 --- a/scripts/mrbind/common_compiler_parser_flags.txt +++ b/scripts/mrbind/common_compiler_parser_flags.txt @@ -1,5 +1,4 @@ -std=c++23 -Wno-nonportable-include-path --Wno-enum-constexpr-conversion -Wno-deprecated-enum-enum-conversion -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH diff --git a/scripts/mrbind/generate.mk b/scripts/mrbind/generate.mk index 269953b038d4..8ac3ee4ed76e 100644 --- a/scripts/mrbind/generate.mk +++ b/scripts/mrbind/generate.mk @@ -579,6 +579,10 @@ COMPILER_FLAGS := $(ABI_COMPAT_FLAG) $(EXTRA_CFLAGS) $(call load_file,$(makefile # Add `-frelaxed-template-template-args` if Clang is old enough to support it. Newer versions have this behavior by default. # Clang 18 and older need this flag. Clang 19 and 20 do the right thing by default, but still allow the flag with a deprecation warning. Clang 21 and newer consider this an unknown flag and error. COMPILER_FLAGS += $(shell $(CXX_FOR_BINDINGS) --help | grep -o -- -frelaxed-template-template-args) +# `-Wno-enum-constexpr-conversion` is only needed by the older Clang versions (18, 19); pass it only there. +ifneq ($(filter 18 19,$(call safe_shell,$(CXX_FOR_BINDINGS) -dumpversion | cut -d. -f1)),) +COMPILER_FLAGS += -Wno-enum-constexpr-conversion +endif ifneq ($(DEPS_INCLUDE_DIR),) # Required for vcpkg environments COMPILER_FLAGS += -I$(DEPS_INCLUDE_DIR)/eigen3