summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-10-18 10:26:53 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-10-18 10:53:55 -0200
commit6b57558fefd3a1e3913e8fe386a07da0d8aeedc3 (patch)
tree64ef1426a88b914f762be74e1e16ab4978ffeafb /tests
parent9078b47fcc5fec2d80a242e8a8f494b5b4c4efd1 (diff)
downloadshiboken-6b57558fefd3a1e3913e8fe386a07da0d8aeedc3.tar.gz
shiboken-6b57558fefd3a1e3913e8fe386a07da0d8aeedc3.tar.xz
shiboken-6b57558fefd3a1e3913e8fe386a07da0d8aeedc3.zip
Fix bug#411 - "Incorrect return statement generated in a function that returns a reference"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/libsample/reference.cpp3
-rw-r--r--tests/libsample/reference.h11
-rw-r--r--tests/samplebinding/CMakeLists.txt1
-rw-r--r--tests/samplebinding/global.h1
-rw-r--r--tests/samplebinding/typesystem_sample.xml30
5 files changed, 45 insertions, 1 deletions
diff --git a/tests/libsample/reference.cpp b/tests/libsample/reference.cpp
index 670395ff..1456b189 100644
--- a/tests/libsample/reference.cpp
+++ b/tests/libsample/reference.cpp
@@ -67,3 +67,6 @@ Reference::callAlterReferenceIdVirtual(Reference& r)
alterReferenceIdVirtual(r);
}
+ObjTypeReference::~ObjTypeReference()
+{
+}
diff --git a/tests/libsample/reference.h b/tests/libsample/reference.h
index 046a1518..cc9fcc91 100644
--- a/tests/libsample/reference.h
+++ b/tests/libsample/reference.h
@@ -51,9 +51,20 @@ public:
inline static int multiplier() { return 10; }
+ virtual Reference& returnMyFirstArg(Reference& ref) { return ref; }
+ virtual Reference& returnMySecondArg(int a, Reference& ref) { return ref; }
private:
int m_objId;
};
+class LIBSAMPLE_API ObjTypeReference
+{
+public:
+ virtual ~ObjTypeReference();
+ virtual ObjTypeReference& returnMyFirstArg(ObjTypeReference& ref) { return ref; }
+ virtual ObjTypeReference& returnMySecondArg(int a, ObjTypeReference& ref) { return ref; }
+ virtual ObjTypeReference& justAPureVirtualFunc(ObjTypeReference& ref) = 0;
+};
+
#endif // REFERENCE_H
diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt
index 3767a3a3..a0f68c54 100644
--- a/tests/samplebinding/CMakeLists.txt
+++ b/tests/samplebinding/CMakeLists.txt
@@ -43,6 +43,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/nondefaultctor_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/objecttype_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/objecttypelayout_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/objectview_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/sample/objtypereference_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/oddbooluser_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/overload_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/pairuser_wrapper.cpp
diff --git a/tests/samplebinding/global.h b/tests/samplebinding/global.h
index 54a9795f..8fae4ddf 100644
--- a/tests/samplebinding/global.h
+++ b/tests/samplebinding/global.h
@@ -21,6 +21,7 @@
#include "nondefaultctor.h"
#include "objecttype.h"
#include "objecttypelayout.h"
+#include "objecttypereference.h"
#include "objectview.h"
#include "oddbool.h"
#include "overload.h"
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 9d14681a..2960ec73 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -623,7 +623,35 @@
-->
</object-type>
- <value-type name="Reference"/>
+ <value-type name="Reference">
+ <modify-function signature="returnMyFirstArg(Reference&amp;)">
+ <modify-argument index="return">
+ <replace-default-expression with="%1"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="returnMySecondArg(int, Reference&amp;)">
+ <modify-argument index="return">
+ <replace-default-expression with="%2"/>
+ </modify-argument>
+ </modify-function>
+ </value-type>
+ <object-type name="ObjTypeReference">
+ <modify-function signature="returnMyFirstArg(ObjTypeReference&amp;)">
+ <modify-argument index="return">
+ <replace-default-expression with="%1"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="returnMySecondArg(int, ObjTypeReference&amp;)">
+ <modify-argument index="return">
+ <replace-default-expression with="%2"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="justAPureVirtualFunc(ObjTypeReference&amp;)">
+ <modify-argument index="return">
+ <replace-default-expression with="%1"/>
+ </modify-argument>
+ </modify-function>
+ </object-type>
<value-type name="ImplicitConv">
<enum-type name="CtorEnum"/>
<enum-type name="ICOverloadedFuncEnum"/>