summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-13 12:57:04 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-13 12:57:04 +0100
commitedc2686687f352a065425319d535dd37e85f8122 (patch)
treebf21b58b46c0ba3a810c75d0da17bce9f295f6bc /core
parent98d5e0b72f697805143a4c989405f2b11404c09d (diff)
parenta825f955abf8b60f506ae3fd5e1448cbe7080331 (diff)
Merge pull request #49469 from groud/remove_variant_operator
Make sure Variant is not implicitely cast when using operator[]
Diffstat (limited to 'core')
-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