Skip to content

Commit c51b3cb

Browse files
committed
Fixed the generated C# when a template is specialized with T and const T.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 12642f9 commit c51b3cb

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

src/Generator/Driver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ public void SetupPasses(ILibrary library)
250250
TranslationUnitPasses.AddPass(new CleanInvalidDeclNamesPass());
251251
TranslationUnitPasses.AddPass(new CheckIgnoredDeclsPass());
252252
TranslationUnitPasses.AddPass(new CheckFlagEnumsPass());
253-
TranslationUnitPasses.AddPass(new CheckDuplicatedNamesPass());
254253

255254
if (Options.IsCSharpGenerator)
256255
{
@@ -272,6 +271,7 @@ public void SetupPasses(ILibrary library)
272271
TranslationUnitPasses.AddPass(new SpecializationMethodsWithDependentPointersPass());
273272
TranslationUnitPasses.AddPass(new ParamTypeToInterfacePass());
274273
}
274+
TranslationUnitPasses.AddPass(new CheckDuplicatedNamesPass());
275275

276276
TranslationUnitPasses.AddPass(new MarkUsedClassInternalsPass());
277277

src/Generator/Passes/CheckDuplicatedNamesPass.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ private bool UpdateName(Function function)
4848
Count++;
4949

5050
var duplicate = functions.Keys.FirstOrDefault(f =>
51+
function.SynthKind != FunctionSynthKind.DefaultValueOverload &&
5152
f.Parameters.SequenceEqual(function.Parameters, ParameterTypeComparer.Instance));
5253

5354
if (duplicate == null)

tests/CSharp/CSharpTemplates.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,8 @@ void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool>
697697
TemplateWithIndexer<T2*> _12, TemplateWithIndexer<UsedInTemplatedIndexer> _13,
698698
TemplateDerivedFromRegularDynamic<RegularDynamic> _14,
699699
IndependentFields<OnlySpecialisedInTypeArg<double>> _15,
700-
DependentPointerFields<float> _16, std::string s);
700+
DependentPointerFields<float> _16, IndependentFields<const T1&> _17,
701+
std::string s);
701702

702703
void hasIgnoredParam(DependentValueFields<IndependentFields<Ignored>> ii);
703704

@@ -715,6 +716,7 @@ template<> inline void* qbswap<1>(const void *source, size_t count, void *dest)
715716
template class DLL_API IndependentFields<int>;
716717
template class DLL_API IndependentFields<bool>;
717718
template class DLL_API IndependentFields<T1>;
719+
template class DLL_API IndependentFields<const T1>;
718720
template class DLL_API IndependentFields<std::string>;
719721
template class DLL_API Base<int>;
720722
template class DLL_API DependentValueFields<int>;

0 commit comments

Comments
 (0)