New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The example in [over.sub]p1 is incorrect #2042
Comments
That's not true if |
The example is incorrect anyway. Whatever the object |
|
To expect someone to guess that |
Nobody is expected to guess that, because it's not relevant to the example. You have twice stated the example is invalid code and I've provided evidence to the contrary in the form of suggestions for the type not shown in the example. It doesn't matter exactly what Z is, or whether the example could usefully update x. That's not the point of the example. |
Z could also be typedef for The point is you don't need to know what it is, because that's not what the example is about. The overloaded operator returns something that can be on the left hand side of an assignment. There are types that make that valid, so stop assuming it's a type that makes it invalid. |
[over.sub]p1:
X::operator[](std::initializer_list<int>)
returns a prvalue. It can't be on the LHS of an assignment as inx[{1,2,3}] = 7;
The text was updated successfully, but these errors were encountered: