diff --git a/AK/Variant.h b/AK/Variant.h index 46ed67c48b..372854f361 100644 --- a/AK/Variant.h +++ b/AK/Variant.h @@ -130,15 +130,16 @@ struct VariantConstructTag { template struct VariantConstructors { + // The pointless `typename Base` constraints are a workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109683 ALWAYS_INLINE VariantConstructors(T&& t) - requires(requires { T(move(t)); }) + requires(requires { T(move(t)); typename Base; }) { internal_cast().clear_without_destruction(); internal_cast().set(move(t), VariantNoClearTag {}); } ALWAYS_INLINE VariantConstructors(T const& t) - requires(requires { T(t); }) + requires(requires { T(t); typename Base; }) { internal_cast().clear_without_destruction(); internal_cast().set(t, VariantNoClearTag {}); diff --git a/Meta/CMake/common_compile_options.cmake b/Meta/CMake/common_compile_options.cmake index 4791f2433b..410273bc95 100644 --- a/Meta/CMake/common_compile_options.cmake +++ b/Meta/CMake/common_compile_options.cmake @@ -28,4 +28,7 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Only ignore expansion-to-defined for g++, clang's implementation doesn't complain about function-like macros add_compile_options(-Wno-expansion-to-defined) add_compile_options(-Wno-literal-suffix) + + # FIXME: This warning seems useful but has too many false positives with GCC 13. + add_compile_options(-Wno-dangling-reference) endif() diff --git a/Tests/AK/TestRefPtr.cpp b/Tests/AK/TestRefPtr.cpp index ceac8e06ff..20c3e10bec 100644 --- a/Tests/AK/TestRefPtr.cpp +++ b/Tests/AK/TestRefPtr.cpp @@ -97,14 +97,11 @@ TEST_CASE(assign_moved_self) { RefPtr object = adopt_ref(*new Object); EXPECT_EQ(object->ref_count(), 1u); -#if defined(AK_COMPILER_CLANG) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wself-move" -#endif +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wself-move" object = move(object); -#if defined(AK_COMPILER_CLANG) -# pragma clang diagnostic pop -#endif +#pragma GCC diagnostic pop EXPECT_EQ(object->ref_count(), 1u); }