diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt index 1585e5d650..cc77f6546d 100644 --- a/libmamba/CMakeLists.txt +++ b/libmamba/CMakeLists.txt @@ -273,14 +273,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "App ) endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # GCC reports dangling reference when using std::invoke with data members - set_source_files_properties( - ${LIBMAMBA_SOURCE_DIR}/solver/problems_graph.cpp - PROPERTIES COMPILE_FLAGS -Wno-error=dangling-reference - ) -endif() - foreach(script ${SHELL_SCRIPTS}) list(APPEND LIBMAMBA_SOURCES shell_scripts/${script}.cpp) endforeach() diff --git a/libmamba/src/solver/problems_graph.cpp b/libmamba/src/solver/problems_graph.cpp index 25cf5ca7f2..36b9e650e2 100644 --- a/libmamba/src/solver/problems_graph.cpp +++ b/libmamba/src/solver/problems_graph.cpp @@ -264,6 +264,10 @@ namespace mamba::solver return CompressedProblemsGraph::NamedList(tmp.begin(), tmp.end()); } +// GCC reports dangling reference when using std::invoke with data members +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" + template auto invoke_version(T&& e) -> decltype(auto) { @@ -328,6 +332,8 @@ namespace mamba::solver } } +#pragma GCC diagnostic pop + /** * Detect if a type has a ``name`` member (function). */