This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/59296 (rvalue object and lvalue ref-qualifier)


On Thu, 19 Jun 2014, Jason Merrill wrote:

We were treating a const & member function like a normal const reference, and binding an rvalue object argument to it. But it doesn't work that way.

That looks weird to me. The const&& version is a better match than the const&, so we should pick that one in overload resolution, but if we remove the const&& version, the other one seems valid to me, we shouldn't reject this program:

struct Type
{
  void get() const& { }
};

int main()
{
  Type{}.get();
}

At least both clang and intel accept it, and I hope the standard didn't make it behave differently from regular function calls.

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]