Browse Source

Fixed the generated C# when a template is specialized with T and const T.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1166/head
Dimitar Dobrev 8 years ago
parent
commit
c51b3cba71
  1. 2
      src/Generator/Driver.cs
  2. 1
      src/Generator/Passes/CheckDuplicatedNamesPass.cs
  3. 4
      tests/CSharp/CSharpTemplates.h

2
src/Generator/Driver.cs

@ -250,7 +250,6 @@ namespace CppSharp @@ -250,7 +250,6 @@ namespace CppSharp
TranslationUnitPasses.AddPass(new CleanInvalidDeclNamesPass());
TranslationUnitPasses.AddPass(new CheckIgnoredDeclsPass());
TranslationUnitPasses.AddPass(new CheckFlagEnumsPass());
TranslationUnitPasses.AddPass(new CheckDuplicatedNamesPass());
if (Options.IsCSharpGenerator)
{
@ -272,6 +271,7 @@ namespace CppSharp @@ -272,6 +271,7 @@ namespace CppSharp
TranslationUnitPasses.AddPass(new SpecializationMethodsWithDependentPointersPass());
TranslationUnitPasses.AddPass(new ParamTypeToInterfacePass());
}
TranslationUnitPasses.AddPass(new CheckDuplicatedNamesPass());
TranslationUnitPasses.AddPass(new MarkUsedClassInternalsPass());

1
src/Generator/Passes/CheckDuplicatedNamesPass.cs

@ -48,6 +48,7 @@ namespace CppSharp.Passes @@ -48,6 +48,7 @@ namespace CppSharp.Passes
Count++;
var duplicate = functions.Keys.FirstOrDefault(f =>
function.SynthKind != FunctionSynthKind.DefaultValueOverload &&
f.Parameters.SequenceEqual(function.Parameters, ParameterTypeComparer.Instance));
if (duplicate == null)

4
tests/CSharp/CSharpTemplates.h

@ -697,7 +697,8 @@ void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool> @@ -697,7 +697,8 @@ void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool>
TemplateWithIndexer<T2*> _12, TemplateWithIndexer<UsedInTemplatedIndexer> _13,
TemplateDerivedFromRegularDynamic<RegularDynamic> _14,
IndependentFields<OnlySpecialisedInTypeArg<double>> _15,
DependentPointerFields<float> _16, std::string s);
DependentPointerFields<float> _16, IndependentFields<const T1&> _17,
std::string s);
void hasIgnoredParam(DependentValueFields<IndependentFields<Ignored>> ii);
@ -715,6 +716,7 @@ template<> inline void* qbswap<1>(const void *source, size_t count, void *dest) @@ -715,6 +716,7 @@ template<> inline void* qbswap<1>(const void *source, size_t count, void *dest)
template class DLL_API IndependentFields<int>;
template class DLL_API IndependentFields<bool>;
template class DLL_API IndependentFields<T1>;
template class DLL_API IndependentFields<const T1>;
template class DLL_API IndependentFields<std::string>;
template class DLL_API Base<int>;
template class DLL_API DependentValueFields<int>;

Loading…
Cancel
Save