From d176cbeeb07c9d8fe8ae3953fab985d53e8ec483 Mon Sep 17 00:00:00 2001 From: Billy O'Neal Date: Fri, 15 Nov 2024 15:08:45 -0800 Subject: [PATCH] Disable -Wno-dangling-reference on GCC 13. (#1543) 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 99d3b4930..3a06bf6f6 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)