From a825f955abf8b60f506ae3fd5e1448cbe7080331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilles=20Roudi=C3=A8re?= Date: Wed, 9 Jun 2021 21:11:06 +0200 Subject: [PATCH] Make sure Variant is not implicitely cast when using operator[] Co-authored-by: Hein-Pieter van Braam-Stewart --- core/variant/variant.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/variant/variant.h b/core/variant/variant.h index b2f31a6d57b..f694e59051b 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -346,6 +346,10 @@ public: bool is_one() const; bool is_null() const; + // Make sure Variant is not implicitly cast when accessing it with bracket notation (GH-49469). + Variant &operator[](const Variant &p_key) = delete; + const Variant &operator[](const Variant &p_key) const = delete; + operator bool() const; operator signed int() const; operator unsigned int() const; // this is the real one