Bug 19775 – multiple argument string mixin doesn't expand tuples

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-03-30T08:11:34Z
Last change time
2019-04-27T00:14:52Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Basile-z

Comments

Comment #0 by b2.temp — 2019-03-30T08:11:34Z
Splitted from 19442 passing a template parameter list does not expand the arguments: enum x1 = 1; enum makeIdent(args...) = mixin(args); pragma(msg, makeIdent!("x", 1)); // Error: undefined identifier `tuple` // Using this works but only for two arguments enum makeIdent(args...) = mixin(args[0], args[1]); pragma(msg, makeIdent!("x", 1)); // Output: 1 Here's the real code I was working on (like compile-time std.conv.text but probably more efficient): enum ctText(args...) = mixin("`", args, "`"); pragma(msg, ctText!(5, " bottles")); // Output: tuple(5, " bottles") Above, args is not implicitly expanded. // This works but only for two arguments enum ctText(args...) = mixin("`", args[0], args[1], "`"); static assert(ctText!(5, " bottles") == "5 bottles");
Comment #1 by nick — 2019-03-30T13:24:01Z
Started working on this, but I'm having trouble building dmd on Windows (even with Digger): https://github.com/ntrel/dmd/commits/mixin-tuple
Comment #2 by b2.temp — 2019-03-30T16:43:37Z
It looks good for a PR, you'll see if it works with the CI anyway.
Comment #3 by dlang-bot — 2019-03-30T17:44:06Z
@ntrel created dlang/dmd pull request #9521 "Fix Issue 19775 - multiple argument string mixin doesn't expand tuples" fixing this issue: - Fix Issue 19775 - multiple argument string mixin doesn't expand tuples https://github.com/dlang/dmd/pull/9521
Comment #4 by dlang-bot — 2019-04-05T19:27:35Z
dlang/dmd pull request #9521 "Fix Issue 19775 - multiple argument string mixin doesn't expand tuples" was merged into master: - a4949543bf8ea08a4a5533df1e90e277e5f237a4 by Nick Treleaven: Fix Issue 19775 - multiple argument string mixin doesn't expand tuples https://github.com/dlang/dmd/pull/9521
Comment #5 by b2.temp — 2019-04-27T00:14:52Z
*** Issue 19832 has been marked as a duplicate of this issue. ***