diff --git a/src/Generator/AST/Utils.cs b/src/Generator/AST/Utils.cs index fc5f3e7605..7ead35cd6b 100644 --- a/src/Generator/AST/Utils.cs +++ b/src/Generator/AST/Utils.cs @@ -151,7 +151,8 @@ private static bool UnsupportedTemplateArgument( ClassTemplateSpecialization specialization, TemplateArgument a, ITypeMapDatabase typeMaps) { if (a.Type.Type == null || - IsTypeExternal(specialization.TranslationUnit.Module, a.Type.Type)) + IsTypeExternal( + specialization.TemplatedDecl.TemplatedDecl.TranslationUnit.Module, a.Type.Type)) return true; var typeIgnoreChecker = new TypeIgnoreChecker(typeMaps); @@ -178,7 +179,7 @@ private static ClassTemplateSpecialization GetParentSpecialization(Type type) { if (type.TryGetDeclaration(out Declaration declaration)) { - ClassTemplateSpecialization specialization = null; + ClassTemplateSpecialization specialization; do { specialization = declaration as ClassTemplateSpecialization; diff --git a/tests/NamespacesBase/NamespacesBase.h b/tests/NamespacesBase/NamespacesBase.h index d6e0544b33..f421cf1d9b 100644 --- a/tests/NamespacesBase/NamespacesBase.h +++ b/tests/NamespacesBase/NamespacesBase.h @@ -80,8 +80,22 @@ class DLL_API TemplateWithIndependentFields { public: void useDependentPointer(const T* t); + const T& constField() const; +private: + T* t = new T; }; +template +const T& TemplateWithIndependentFields::constField() const +{ + return *t; +} + +template +void TemplateWithIndependentFields::useDependentPointer(const T* t) +{ +} + class DLL_API HasVirtualInCore { public: diff --git a/tests/NamespacesDerived/Independent.h b/tests/NamespacesDerived/Independent.h new file mode 100644 index 0000000000..2afe45bfbe --- /dev/null +++ b/tests/NamespacesDerived/Independent.h @@ -0,0 +1,3 @@ +class Derived; +template class TemplateWithIndependentFields; +typedef TemplateWithIndependentFields ForwardedInIndependentHeader; \ No newline at end of file diff --git a/tests/NamespacesDerived/NamespacesDerived.cpp b/tests/NamespacesDerived/NamespacesDerived.cpp index e463a7c39d..8bd6c77501 100644 --- a/tests/NamespacesDerived/NamespacesDerived.cpp +++ b/tests/NamespacesDerived/NamespacesDerived.cpp @@ -110,3 +110,7 @@ bool operator<<(const Base& b, const char* str) { return false; } + +void forceUseSpecializations(ForwardedInIndependentHeader value) +{ +} diff --git a/tests/NamespacesDerived/NamespacesDerived.h b/tests/NamespacesDerived/NamespacesDerived.h index 0ddf676a55..a30af2f662 100644 --- a/tests/NamespacesDerived/NamespacesDerived.h +++ b/tests/NamespacesDerived/NamespacesDerived.h @@ -1,5 +1,6 @@ #include "../Tests.h" #include "../NamespacesBase/NamespacesBase.h" +#include "Independent.h" // Namespace clashes with NamespacesBase.OverlappingNamespace // Test whether qualified names turn out right. @@ -168,3 +169,5 @@ class TestComments */ class LinphoneAddress {}; }; + +DLL_API void forceUseSpecializations(ForwardedInIndependentHeader value);