http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52363

--- Comment #8 from Daniel Krügler <daniel.kruegler at googlemail dot com> 
2012-04-18 14:41:38 UTC ---
(In reply to comment #7)
> Daniel, can you have a look to snippet in Comment #5? Should it compile or 
> not?

It needed a while until I recognized that the second operator= overload is a
const function: With this fact my *tentative* interpretation is that the static
assertion should fire, because we have a non-const proxy rvalue and a non-const
int rvalue. The non-const proxy argument has a better match with the non-const
object parameter of the first function, but the int rvalue has a better match
with the int&& argument of the second function. The corresponding C++03 problem
would be described by

struct proxy
{
  void operator=(int const&);
  void operator=(int &) const;
};

template<class T>
T& create();

int v = sizeof(create<proxy>() = create<int>(), 0);

and is ambiguous as well. The alternative fix (instead of removing the const
from the function) is to *add* a const to left hand type (i.e. use "const
proxy" instead).

Reply via email to