From d007337d97189facc8ad1b661ceabf06bfe7e5bc Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 14 Oct 2022 14:05:46 -0400 Subject: [PATCH] AK: Explictly disallow lvalue reference types within Variant This prevents an ICE with GCC trying to declare e.g. Variant. Using a concept is a bit overkill here, but clang otherwise trips over the friendship declaration to other Variant types: template friend struct Variant; Without using a concept, clang believes this is re-declaring the Variant type with differing requirements ("error: requires clause differs in template redeclaration"). --- AK/Variant.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/AK/Variant.h b/AK/Variant.h index 30856ca9a9..8962b7ee0a 100644 --- a/AK/Variant.h +++ b/AK/Variant.h @@ -215,7 +215,10 @@ namespace AK { struct Empty { }; -template +template +concept NotLvalueReference = !IsLvalueReference; + +template struct Variant : public Detail::MergeAndDeduplicatePacks>...> { private: @@ -244,7 +247,7 @@ public: { } - template + template friend struct Variant; Variant() requires(!can_contain()) = delete;