Skip to content

Commit ee9cb9b

Browse files
committed
Fix Issue 16206 - traits getOverloads fails when one of the overload is a templatized function
1 parent 901dcd5 commit ee9cb9b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

spec/traits.dd

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,10 @@ $(H2 $(GNAME getOverloads))
658658

659659
$(P The first argument is an aggregate (e.g. struct/class/module).
660660
The second argument is a string that matches the name of
661-
one of the functions in that aggregate.
661+
one of the members in that aggregate.
662+
The third argument is a bool, and is optional.
662663
The result is a tuple of all the overloads of that function.
664+
If the third member evaluates to true, the result will include all members that matches the supplied name.
663665
)
664666

665667
---
@@ -671,6 +673,8 @@ class D
671673
~this() { }
672674
void foo() { }
673675
int foo(int) { return 2; }
676+
void bar(T)() { return T.init; }
677+
class bar(int n) {}
674678
}
675679

676680
void main()
@@ -686,6 +690,9 @@ void main()
686690

687691
auto i = __traits(getOverloads, d, "foo")[1](1);
688692
writeln(i);
693+
694+
foreach (t; __traits(getOverloads, D, "bar", true))
695+
writeln(t.stringof);
689696
}
690697
---
691698

@@ -697,6 +704,8 @@ int()
697704
void()
698705
int()
699706
2
707+
bar(T)()
708+
bar(int n)
700709
)
701710

702711
$(H2 $(GNAME getParameterStorageClasses))

0 commit comments

Comments
 (0)