summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/variant/variant.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/variant/variant.h b/core/variant/variant.h
index b2f31a6d57..f694e59051 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