Open sgrekhov opened 1 week ago
Right. It could be argued that even though operator []=
is a method with two parameters, the syntax m1[key] = 1
is so different from the regular myFunction(arg1, arg2)
that it should be given special treatment.
(For example, e1 == e2
is not treated exactly the same way as an invocation of a method with two arguments.)
However, I don't think there is any particular reason why we would want to make an exception for this case, so I'd recommend that we consider the spec rule "an actual argument of type void
can be passed to a parameter of type void
" to be applicable to this case as well, and then we shouldn't have the errors.
The code below produce no issues in the analyzer but errors in CFE.
Acording to the specification key and value of type
void
in the[]=
operator are both allowed.See also #57070.