
Would you like to officially create a request ticket for those three member functions...
Arno Schödl wrote:
Done.
Ah, I see: https://svn.boost.org/trac/boost/ticket/2836 Thanks! BTW, if Fernando wants to do the job, I'll reassign the ticket to him, of course. Otherwise I wouldn't mind doing the job.
Thank you for educating me! Just for overview:
struct S;
void change( S& s ) {}
struct S { bool m_b; void func() { change( *this ); } };
change( S() ); // does not compile S().func(); // compiles
S().m_b=true; // does not compile (!)
Right! A data member of an rvalue is itself an rvalue, and you cannot assign to an rvalue, if it's of a built-in type.
I found this interesting:
[From here I guess you did #define T S]
struct T;
void change( T& s ) {}
struct T { // makes R-values non-const operator S&() { return *this; } };
change( S() ); // compiles
It does not compile at www.comeaucomputing.com/tryitout as it tells me: "ComeauTest.c", line 9: warning: "S::operator S &()" will not be called for implicit or explicit conversions operator S&() { ^ "ComeauTest.c", line 15: error: initial value of reference to non-const must be an lvalue change( S() ); // compiles ^ So I assume you're experiencing a compiler specific "feature". ;-) Kind regards, Niels