Indiana Unversity logo[ConceptGCC]

ConceptGCC :

[SPAM:### 82%] Re: [SPAM:### 82%] Re: Shouldn't Assignable concepts stop supporting assignment-to-rvalue?

From: Sebastian Gesemann (s.gesemann_at_[hidden])
Date: 2009-01-07 18:47:01


On Wed, Jan 7, 2009 at 9:10 PM, Niels Dekker wrote:
> Sebastian Gesemann wrote:
>> [...] But an associated member function requirement
>> without any ref qualifier only means that the member function can be
>> invoked on lvalues. So, in case I got that right the following should
>> be true:
>>
>> concept Test1<typename T> {
>> void T::foo(); // requirement for lvalues only
>> }
>>
>> concept Test2<typename T> {
>> void T::foo(); // requirement for lvalues only
>> void T::foo() &&; // requirement for rvalues only
>> }
>
> I'm not sure if Test2 is okay. Because there's this rule that if one
> overload has a ref-qualifier, all overload should have them: "Member
> function declarations with the same name and the same parameter-type-list as
> well as member function template declarations with the same name, the same
> parameter-type-list, the same template parameter lists, and the same
> template requirements cannot be overloaded if any of them, but not all, have
> a ref-qualifier (8.3.5)." [over.load]/2. Don't you think this applies to
> concepts as well?

Yes. That's an oversight. Although, there really is little difference between
   void T::foo();
and
   void T::foo() &;
except that you can "overload" the 2nd one with
   void T::foo() &&;
which would be the only way (under current rules) to make foo()
callable on both lvalues and rvalues.

[...]

> Thanks! I just saw your comp.std.c++ posting, "C++0x concepts and ref
> qualifiers inconsistency",
> http://groups.google.com/group/comp.std.c++/browse_frm/thread/6f3b093d7083ac18
> I hope there will be some feedback, clarifying the issue...

Me, too.

Cheers!
SG