Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
1.2.x
-
64-bit Linux with gcc 4.6.2
Description
Declaring a variable to be "extern" inside a namespace causes Shiboken to generate invalid code. I have attached a patch file to recreate the problem using the libsample test case from the Shiboken source code. To summarize:
// In header file namespace SampleNamespace { //... extern int ExternInt; } // In implementation file namespace SampleNamespace { //... int ExternInt = 0; }
This causes shiboken to produce invalid code like the following:
static PyObject* Sbk_SampleNamespace_get_ExternInt(PyObject* self, void*) { ::SampleNamespace* cppSelf = 0; //...
which causes gcc 4.6.2 to complain like so
In function ‘PyObject* Sbk_SampleNamespace_get_ExternInt(PyObject*, void*)’:
error: expected primary-expression before ‘*’ token
error: ‘cppSelf’ was not declared in this scope
error: expected primary-expression before ‘;’ token
A workaround is to add a rejection tag to the typesystem
<namespace-type name="SampleNamespace"> <!-- ... --> <rejection class="*" field-name="ExternInt" /> </namespace-type>
Attachments
Issue Links
- relates to
-
PYSIDE-323 Build Pyside2 against Qt 5.7 and higher
- Closed