diff --git a/src/Generator/Passes/TrimSpecializationsPass.cs b/src/Generator/Passes/TrimSpecializationsPass.cs index b9024654d0..e27b7a8cc4 100644 --- a/src/Generator/Passes/TrimSpecializationsPass.cs +++ b/src/Generator/Passes/TrimSpecializationsPass.cs @@ -85,9 +85,7 @@ public override bool VisitFieldDecl(Field field) return true; } - TypeMap typeMap; - if (!Context.TypeMaps.FindTypeMap(field.Type, out typeMap) && - !ASTUtils.CheckTypeForSpecialization(field.Type, + if (!ASTUtils.CheckTypeForSpecialization(field.Type, field, AddSpecialization, Context.TypeMaps)) CheckForInternalSpecialization(field, field.Type); diff --git a/tests/VTables/VTables.Tests.cs b/tests/VTables/VTables.Tests.cs index 9d321116a6..9395f8d8f6 100644 --- a/tests/VTables/VTables.Tests.cs +++ b/tests/VTables/VTables.Tests.cs @@ -78,4 +78,15 @@ public void TestVirtualFuntionRetVal() var retBase = new ManagedDerivedClassVirtualRetBase(); TestVirtualFunction(retBase, 10); } + + [Test] + public void TestStdStringInField() + { + using (var foo = new Foo()) + { + Assert.That(foo.S, Is.Empty); + foo.S = "test"; + Assert.That(foo.S, Is.EqualTo("test")); + } + } } diff --git a/tests/VTables/VTables.h b/tests/VTables/VTables.h index 06f35b5f4a..f223d427b3 100644 --- a/tests/VTables/VTables.h +++ b/tests/VTables/VTables.h @@ -1,4 +1,5 @@ #include "../Tests.h" +#include class DLL_API Foo { @@ -15,6 +16,7 @@ class DLL_API Foo virtual int append(); virtual int append(int a); int callVirtualWithParameter(int a); + std::string s; }; DLL_API int FooCallFoo(Foo* foo);