diff --git a/src/Generator/Passes/MatchParamNamesWithInstantiatedFromPass.cs b/src/Generator/Passes/MatchParamNamesWithInstantiatedFromPass.cs index f053d101..9a52e49a 100644 --- a/src/Generator/Passes/MatchParamNamesWithInstantiatedFromPass.cs +++ b/src/Generator/Passes/MatchParamNamesWithInstantiatedFromPass.cs @@ -1,4 +1,5 @@ using CppSharp.AST; +using System; namespace CppSharp.Passes { @@ -18,8 +19,8 @@ namespace CppSharp.Passes (function.Namespace is ClassTemplateSpecialization specialization && specialization.SpecializationKind == TemplateSpecializationKind.ExplicitSpecialization)) return false; - - for (int i = 0; i < function.Parameters.Count; i++) + int parameters = Math.Min(function.Parameters.Count, function.InstantiatedFrom.Parameters.Count); + for (int i = 0; i < parameters; i++) function.InstantiatedFrom.Parameters[i].Name = function.Parameters[i].Name; return true; diff --git a/tests/CSharp/CSharpTemplates.h b/tests/CSharp/CSharpTemplates.h index c12e21fb..d2eb778b 100644 --- a/tests/CSharp/CSharpTemplates.h +++ b/tests/CSharp/CSharpTemplates.h @@ -842,3 +842,12 @@ private: class SpecializationOfClassWithNonTypeTemplateArgument : public ClassWithNonTypeTemplateArgument<0> { }; +template +class DLL_API FloatArrayF +{ +public: + template> + FloatArrayF(V... x) { } + +}; +const FloatArrayF<6> I6{ 1., 1., 1., 0., 0., 0. };