Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Issue 15243 - rejects-valid on variadic
- Loading branch information
Showing
3 changed files
with
80 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Variadic template arguments no longer require `alias` workaround | ||
|
||
Prior to this release, the following code would not compile. | ||
|
||
---- | ||
class C(Types...) | ||
{ | ||
void apply(U)(U delegate(Types[0]) f0) { } // Error: cannot deduce function from argument types | ||
} | ||
|
||
void test() | ||
{ | ||
C!int c; | ||
|
||
int f(int) { return 0; } | ||
|
||
c.apply(&f); | ||
} | ||
---- | ||
|
||
It could be worked around by `alias`ing the individual template arguments. | ||
|
||
---- | ||
class C(Types...) | ||
{ | ||
alias Types[0] T0; | ||
void apply(U)(U delegate(T0) f0) { } // OK | ||
} | ||
---- | ||
|
||
Starting with this release, the workaround is no longer required. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters