aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-02-23 16:52:41 +0100
committerAapo Keskimolo <aapo.keskimolo@qt.io>2018-02-26 13:22:14 +0000
commitacc9315288db07cf73d1f7f44d3b9879044b664a (patch)
tree9dc4bd34515e4f9e193b44bd52f3dbaffe8db03f /sources/shiboken2/generator
parent96af0990d0d4f4b210c227c0776493d04a5da531 (diff)
shiboken: Fix generated initialization code for enum classes
Wrap value in int(), which is required for enum classes. Add a compile test to libsample. Task-number: PYSIDE-487 Change-Id: I78f07ae66da64caad1f75722308256e40e91eded Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/generator')
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 838770e89..3176bcbab 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -1070,7 +1070,8 @@ void CppGenerator::writeEnumConverterFunctions(QTextStream& s, const TypeEntry*
code.clear();
- c << INDENT << "int castCppIn = *((" << cppTypeName << "*)cppIn);" << endl;
+ c << INDENT << "const int castCppIn = int(*reinterpret_cast<const "
+ << cppTypeName << " *>(cppIn));" << endl;
c << INDENT;
c << "return ";
if (enumType->isFlags())