summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Roudière <gilles.roudiere@gmail.com>2021-06-09 21:11:06 +0200
committerGilles Roudière <gilles.roudiere@gmail.com>2023-02-13 10:50:22 +0100
commita825f955abf8b60f506ae3fd5e1448cbe7080331 (patch)
tree4782aae36433cdd7912a1aa12ce342ce62ad6cc5
parentc4fb119f03477ad9a494ba6cdad211b35a8efcce (diff)
Make sure Variant is not implicitely cast when using operator[]
Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
-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