Fix generated code for rvalue references by converting functions returning an rvalue reference into something that can be taken the address of - via a const ref cast. Now the rvalue_reference tests compile under g++-4.7 (C# only atm)

This commit is contained in:
William S Fulton 2013-01-24 08:02:34 +00:00
commit 07c35d61e3
3 changed files with 76 additions and 1 deletions

View file

@ -317,7 +317,16 @@ String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or
case T_RVALUE_REFERENCE:
{
String *lstr = SwigType_lstr(t, 0);
Printf(fcall, "%s = (%s) &", name, lstr);
SwigType *tt = Copy(t);
SwigType_del_rvalue_reference(tt);
SwigType_add_qualifier(tt, "const");
SwigType_add_reference(tt);
String *const_lvalue_str = SwigType_rcaststr(tt, 0);
Printf(fcall, "%s = (%s) &%s", name, lstr, const_lvalue_str);
Delete(const_lvalue_str);
Delete(tt);
Delete(lstr);
}
break;