[Issue 15993] using mixin to specify 2 arguments for writefln results in unrecognized behavior

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu May 5 05:45:54 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15993

Mathias Lang <mathias.lang at sociomantic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |mathias.lang at sociomantic.co
                   |                            |m
           Hardware|x86                         |All
         Resolution|---                         |INVALID
                 OS|Windows                     |All

--- Comment #1 from Mathias Lang <mathias.lang at sociomantic.com> ---
That's because it doesn't behaves as you expect it to.

What's mixed in is an expression, not a tuple. The first value is then
discarded thanks to the coma operator.

Corrected code:
```
import std.typetuple;
import std.stdio;

string foo() {
    return `AliasSeq!(123,"foo")`;
}
void main() {
    writefln("%d %s", mixin(foo()));
}
```

Closing as invalid, as it behaves as expected.

--


More information about the Digitalmars-d-bugs mailing list