www.digitalmars.com         C & C++   DMDScript  

c++ - bug?: Error: reference must refer to same type or be const

reply "Matthew" <admin.hat stlsoft.dot.org> writes:
inline ss_sint8_t &transfer_resource(ss_sint8_t &r, ss_sint8_t v)              
{ return (r = v); }
inline ss_uint8_t &transfer_resource(ss_uint8_t &r, ss_uint8_t v)              
{ return (r = v); }
inline ss_sint16_t &transfer_resource(ss_sint16_t &r, ss_sint16_t v)           
{ return (r = v); }
inline ss_uint16_t &transfer_resource(ss_uint16_t &r, ss_uint16_t v)           
{ return (r = v); }
inline ss_sint32_t &transfer_resource(ss_sint32_t &r, ss_sint32_t v)           
{ return (r = v); }

Changing it to

    { return ((r = v), r); }

fixes it, but it still seems like a bug to me.

Other compilers don't have a problem with the original form 
Feb 22 2005
parent "Matthew" <matthew hat.stlsoft.dot.org> writes:
Any movement on this?

"Matthew" <admin.hat stlsoft.dot.org> wrote in message
news:cvfag8$2vl2$1 digitaldaemon.com...
 inline ss_sint8_t &transfer_resource(ss_sint8_t &r, ss_sint8_t v)

 inline ss_uint8_t &transfer_resource(ss_uint8_t &r, ss_uint8_t v)

 inline ss_sint16_t &transfer_resource(ss_sint16_t &r, ss_sint16_t v)

 inline ss_uint16_t &transfer_resource(ss_uint16_t &r, ss_uint16_t v)

 inline ss_sint32_t &transfer_resource(ss_sint32_t &r, ss_sint32_t v)

 Changing it to

     { return ((r = v), r); }

 fixes it, but it still seems like a bug to me.

 Other compilers don't have a problem with the original form

Sep 11 2005