Closed ddobrev closed 9 years ago
This bug is only exposed when ignored fields are generated. Since the generation of ignored fields is going to be removed, I created a branch called "incorrect_trunit_test" with a test exposing the issue. Whenever ready to work on it, one should check that branch out and run NamespaceDerived.Gen.
The problem is that forward declarations of templates:
template
is considered the templated class of template specialisations, that is, the forward declaration is not resolved. This in turn causes the templated declaration to be considered located in an incorrect translation unit which in turn causes incorrect or incomplete printing of the qualified name of the type.
My personal guess about the root of this issue is that GetDeclUSR, used in WalkClassTemplate, generated the same USR for the forward declaration and for the type itself.
Fixed by f754263ab50d84f03eda81ee82272eebcfb29896.
To reproduce, run Qt# and try compiling the resulting QtGui.cs. You'll see that, for example, the internal field "m_values" of QInputMethodQueryEvent does not have its QVector type fully qualified. Similar to https://github.com/mono/CppSharp/issues/489, parsing just "qevent.h" works properly unlike the whole QtGui. The problem is that QVector itself - that is, the templated declaration of QVector - is parsed as being part of "qregion.h" (QtGui) while the correct header is "qvector.h" (QtCore). My guess is that some forward declaration is not resolved but taken directly instead thus ending up as the translation unit of QVector.