From a913a741387214c1301cfdf1238f6354b630cf46 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Tue, 28 Nov 2017 19:05:08 +0200 Subject: [PATCH] Fixed the generated C# when using std::map. Signed-off-by: Dimitar Dobrev --- src/Generator/Passes/IgnoreSystemDeclarationsPass.cs | 3 +++ tests/CSharp/CSharpTemplates.cpp | 5 +++++ tests/CSharp/CSharpTemplates.h | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/src/Generator/Passes/IgnoreSystemDeclarationsPass.cs b/src/Generator/Passes/IgnoreSystemDeclarationsPass.cs index e23ebbed..4e0a631b 100644 --- a/src/Generator/Passes/IgnoreSystemDeclarationsPass.cs +++ b/src/Generator/Passes/IgnoreSystemDeclarationsPass.cs @@ -48,6 +48,9 @@ namespace CppSharp.Passes if (!@class.IsDependent || @class.Specializations.Count == 0) return false; + foreach (var specialization in @class.Specializations) + specialization.ExplicitlyIgnore(); + // we only need a few members for marshalling so strip the rest switch (@class.Name) { diff --git a/tests/CSharp/CSharpTemplates.cpp b/tests/CSharp/CSharpTemplates.cpp index e80abfe6..09fb2717 100644 --- a/tests/CSharp/CSharpTemplates.cpp +++ b/tests/CSharp/CSharpTemplates.cpp @@ -135,6 +135,11 @@ void hasIgnoredParam(DependentValueFields> ii) { } +std::map usesValidSpecialisationOfIgnoredTemplate() +{ + return std::map(); +} + DependentValueFields specialiseReturnOnly() { return DependentValueFields(); diff --git a/tests/CSharp/CSharpTemplates.h b/tests/CSharp/CSharpTemplates.h index 6a7eae2c..2320bc97 100644 --- a/tests/CSharp/CSharpTemplates.h +++ b/tests/CSharp/CSharpTemplates.h @@ -2,6 +2,7 @@ #include "AnotherUnit.h" #include +#include class DLL_API T1 { @@ -31,6 +32,7 @@ public: IndependentFields(const T& t); IndependentFields(int i); ~IndependentFields(); + explicit IndependentFields(const std::map &other); int getIndependent(); const T* returnTakeDependentPointer(const T* p); T getDependent(const T& t); @@ -67,6 +69,11 @@ IndependentFields::IndependentFields(int i) independent = i; } +template +IndependentFields::IndependentFields(const std::map &v) +{ +} + template IndependentFields::~IndependentFields() { @@ -513,6 +520,8 @@ void forceUseSpecializations(IndependentFields _1, IndependentFields void hasIgnoredParam(DependentValueFields> ii); +std::map usesValidSpecialisationOfIgnoredTemplate(); + DLL_API DependentValueFields specialiseReturnOnly(); // force the symbols for the template instantiations because we do not have the auto-compilation for the generated C++ source