https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122259
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
Maybe just a small improvement to the original warning message is needed here
about the qualifier
That is:
<source>:12:14: error: no match for 'operator=' (operand types are 'const
std::string' {aka 'const std::__cxx11::basic_string<char>'} and 'std::string'
{aka 'std::__cxx11::basic_string<char>'})
12 | test.a = oops;
| ^~~~
Could be improved to:
```
<source>:12:14: error: no match for 'operator=' (Hint: type of lhs is
const-qualified) (operand types are 'const std::string' {aka 'const
std::__cxx11::basic_string<char>'} and 'std::string' {aka
'std::__cxx11::basic_string<char>'})
12 | test.a = oops;
| ^~~~
```
Add that hint only when the type is const qualified. (or volatile qualified in
that case too).
The clang explainations on why the candidates are not viable is really too
brief in my view especially when someone is just learning C++. The other side
of things is standard library has many many overloads compared to most other
code.