mirror of https://github.com/swig/swig
parent
aee380ce82
commit
27a3d16ac6
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.1.0 (in progress)
|
||||
===========================
|
||||
|
||||
2022-02-01: olly
|
||||
#231 Handle returning an object by reference in a C++ trailing
|
||||
return type.
|
||||
|
||||
2022-02-01: davidcl
|
||||
[Scilab] #745 use SWIG_<module>_Init() as a C module init function.
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
%module cpp11_alternate_function_syntax
|
||||
|
||||
%inline %{
|
||||
struct Hello {};
|
||||
|
||||
struct SomeStruct {
|
||||
int addNormal(int x, int y);
|
||||
auto addAlternate(int x, int y) -> int;
|
||||
|
@ -12,6 +14,9 @@ struct SomeStruct {
|
|||
auto addAlternateMemberPtrParm(int x, int (SomeStruct::*mp)(int, int)) -> int;
|
||||
auto addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int;
|
||||
|
||||
// Returning a reference didn't parse in SWIG < 4.1.0 (#231)
|
||||
auto output() -> Hello&;
|
||||
|
||||
virtual auto addFinal(int x, int y) const noexcept -> int final { return x + y; }
|
||||
virtual ~SomeStruct() = default;
|
||||
};
|
||||
|
@ -27,5 +32,6 @@ auto SomeStruct::addAlternateMemberPtrParm(int x, int (SomeStruct::*mp)(int, int
|
|||
auto SomeStruct::addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int {
|
||||
return 1000*x + (this->*mp)(x, x);
|
||||
}
|
||||
auto SomeStruct::output() -> Hello& { static Hello h; return h; }
|
||||
|
||||
%}
|
||||
|
|
|
@ -3383,6 +3383,10 @@ cpp_alternate_rettype : primitive_type { $$ = $1; }
|
|||
*/
|
||||
| TYPE_RAW { $$ = $1; }
|
||||
| idcolon { $$ = $1; }
|
||||
| idcolon AND {
|
||||
$$ = $1;
|
||||
SwigType_add_reference($$);
|
||||
}
|
||||
| decltype { $$ = $1; }
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in New Issue