aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.cc')
-rw-r--r--gcc/cp/decl.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 0234919..d28889e 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -15404,6 +15404,10 @@ grok_op_properties (tree decl, bool complain)
pedwarn (loc, OPT_Wc__23_extensions, "%qD may be a static member "
"function only with %<-std=c++23%> or %<-std=gnu++23%>",
decl);
+ if (operator_code == ARRAY_REF)
+ /* static operator[] should have exactly one argument
+ for C++20 and earlier, so that it isn't multidimensional. */
+ op_flags = OVL_OP_FLAG_UNARY;
}
else if (DECL_STATIC_FUNCTION_P (decl))
{