https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122259

--- Comment #10 from Jonny Grant <jg at jguk dot org> ---
(In reply to Jonathan Wakely from comment #9)
> (In reply to Jonny Grant from comment #6)
> > Where it says "no match for 'operator='" given there can never be a valid
> > operator= for a const object - can the text be clear on that point? could
> > just directly state can't assign to a const object. Otherwise programmer
> > reading will be first considering if there should be an operator=
> 
> The fact it shows you half a dozen non-matching overloads of operator=
> should make it pretty obvious that the problem isn't whether there should be
> an operator=. Clearly there are several of them.
> 
> But Harald's suggestion seems worth exploring. Simply adding a note after
> the first error (and before the list of non-matching candidates) might help:
> 
> note: no overload of 'operator=' allows assignment to 'const std::string'

Even before the first error message I feel would be clearer? It's he crux of
the issue.


> > Is it possible to just say in that Hint 'const' instead of 'const-qualified'
> > I know that is just terminological, it would simplify the output. We we talk
> > with programmers we just say 'const', we don't say 'const-qualified'
> 
> But "type is const" is not correct, the type is something like "const T".
> 
> const is a qualifier, not a type, and plenty of programmers know that.
> Clarity is important, but so is correctness. Striking a balance can be hard.

yes, I was meaning if someone says to me "that is a const size_t, or that
std::string is const", I don't often her programmers say "that is a
const-qualified size_t, or that std::string is const-qualified".

Reply via email to