C++11 ref-qualifier support added

Fixes #1059

Methods with rvalue ref-qualifiers are ignored by default as it is not
possible to have an rvalue temporary from the target language (which is
needed to call the rvalue ref-qualified method).
A warning 405 is shown mentioning the ignored rvalue ref-qualifier method
which can be seen with the -Wextra option.

  cpp_refqualifier.i:15: Warning 405: Method with rvalue ref-qualifier ignored h() const &&.

Usually rvalue and lvalue ref-qualifier overloaded methods are written - the
lvalue method will then be wrapped.
This commit is contained in:
William S Fulton 2017-08-19 01:02:34 +01:00
commit 9e19fe7868
10 changed files with 145 additions and 18 deletions

View file

@ -1681,6 +1681,7 @@ String *Swig_name_str(Node *n) {
* "MyNameSpace::MyTemplate<MyNameSpace::ABC >::~MyTemplate()"
* "MyNameSpace::ABC::ABC(int,double)"
* "MyNameSpace::ABC::constmethod(int) const"
* "MyNameSpace::ABC::refqualifiermethod(int) const &"
* "MyNameSpace::ABC::variablename"
*
* ----------------------------------------------------------------------------- */
@ -1688,6 +1689,7 @@ String *Swig_name_str(Node *n) {
String *Swig_name_decl(Node *n) {
String *qname;
String *decl;
String *refqualifier = Getattr(n, "refqualifier");
qname = Swig_name_str(n);
@ -1695,6 +1697,8 @@ String *Swig_name_decl(Node *n) {
decl = NewStringf("%s", qname);
else
decl = NewStringf("%s(%s)%s", qname, ParmList_errorstr(Getattr(n, "parms")), SwigType_isconst(Getattr(n, "decl")) ? " const" : "");
if (refqualifier)
Printv(decl, " ", refqualifier, NIL);
Delete(qname);