From a178108c0652597581beeb524a66a8082010e16e Mon Sep 17 00:00:00 2001 From: Albert Szilvasy Date: Fri, 28 May 2021 13:44:13 -0700 Subject: [PATCH] Fix for Visual Studio 2019 16.10 (#1614) --- src/Generator/Generators/CSharp/CSharpSources.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index b129f490..cb34d4f0 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -2690,6 +2690,14 @@ internal static{(@new ? " new" : string.Empty)} {printedClass} __GetInstance({Ty { GenerateVirtualFunctionCall(method); } + else if (method.IsDestructor) + { + // It is possible that HasNonTrivialDestructor property different for specialization vs. + // the template. When we generate the Internal struct we only put a dtor there if the specialization + // has a non-trivial dtor. So we must make sure do the same test here. + if (@class.HasNonTrivialDestructor) + GenerateInternalFunctionCall(method, returnType: returnType); + } else { GenerateInternalFunctionCall(method, returnType: returnType);