Skip to content

Commit 0e3bd08

Browse files
authored
Merge pull request #2351 from Biotronic/Issue16206
Fix Issue 16206 - traits getOverloads fails when one of the overload is a templatized function merged-on-behalf-of: Mike Franklin <JinShil@users.noreply.github.com>
2 parents 414943f + e9dc83a commit 0e3bd08

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

spec/traits.dd

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,9 +657,11 @@ void main()
657657
$(H2 $(GNAME getOverloads))
658658

659659
$(P The first argument is an aggregate (e.g. struct/class/module).
660-
The second argument is a string that matches the name of
661-
one of the functions in that aggregate.
662-
The result is a tuple of all the overloads of that function.
660+
The second argument is a `string` that matches the name of
661+
the member(s) to return.
662+
The third argument is a `bool`, and is optional. If `true`, the
663+
result will also include template overloads.
664+
The result is a tuple of all the overloads of 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)