Bug 14836 – [REG2.068a] Multiple variadic template argument trick broken

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-07-26T22:33:00Z
Last change time
2015-07-30T12:05:48Z
Keywords
industry, pull, rejects-valid
Assigned to
nobody
Creator
briancschott

Comments

Comment #0 by briancschott — 2015-07-26T22:33:07Z
There is a trick that allows multiple variadic template arguments in a function if the second variadic template argument list is derived only from the function arguments. This trick worked in versions prior to the 2.068.0 betas, but it does not work with them. Exmaple code: --- import std.stdio : writeln; template alpha(alias Beta, Charlie...) { void alpha(Delta...)() if (Delta.length == 0) { writeln("First"); } void alpha(Delta...)(Delta delta) if (Delta.length > 0) { writeln("Second"); } } void main(string[] args) { int a; alpha!(a)(); } /* digger: Commit 396da76e77d8dce16895291d0d39a05009d7c0bb (2/2) is untestable. digger: There are only untestable commits left to bisect. digger: The first bad commit could be any of: digger: 396da76e77d8dce16895291d0d39a05009d7c0bb digger: e5dcde500b44b5c19c6af76d6c4f67fe4102d7b5 digger: b6ffe33aa07c46953f1f14c290c47863608 */ ---
Comment #1 by briancschott — 2015-07-26T22:47:31Z
Changing the first function to this --- void alpha()() { writeln("First"); } --- is a workaround.
Comment #2 by k.hara.pg — 2015-07-27T03:58:05Z
Comment #3 by ag0aep6g — 2015-07-27T09:27:43Z
Another workaround: ---- template alpha(alias Beta, Charlie...) { void impl(Delta...)() if (Delta.length == 0) {/*...*/} void impl(Delta...)(Delta delta) if (Delta.length > 0) {/*...*/} alias alpha = impl; } ----
Comment #4 by k.hara.pg — 2015-07-27T11:58:57Z
Comment #5 by github-bugzilla — 2015-07-28T02:34:29Z
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/11e4a08146a9751cb3d6b965be5867835ea756d1 fix Issue 14836 - Multiple variadic template argument trick broken https://github.com/D-Programming-Language/dmd/commit/c5c9233257d9629493a651bdd8e9cc3ed62927aa Merge pull request #4840 from 9rnsr/fix14836 [REG2.068a] Issue 14836 - Multiple variadic template argument trick broken
Comment #6 by github-bugzilla — 2015-07-30T12:05:48Z