From e6f79e7590086d0a187283da046b52ca149e92d8 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Thu, 14 Nov 2024 23:56:53 +0000 Subject: [PATCH] Disable -Wno-dangling-reference on GCC 13. Our Optional and Expected trip over the false positive described in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532 , where there are temporary Optional or Expecteds that return references to things outside of their own lifetime that trip the warning. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99d3b49308..3a06bf6f67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,6 +144,11 @@ else() string(APPEND CMAKE_C_FLAGS " -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -Wno-missing-field-initializers ${DECL_WARNING}") string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-redundant-move ${DECL_WARNING}") + + if(VCPKG_COMPILER STREQUAL "gcc" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) + # -Wno-dangling-reference results from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532 :( + string(APPEND CMAKE_CXX_FLAGS " -Wno-dangling-reference") + endif() endif() if(VCPKG_WARNINGS_AS_ERRORS)