[Issue 15974] Spurious error: argument to mixin must be a string, not (expression()) of type string

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 9 06:24:01 PDT 2016


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

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
I got a real minimized test case from incomplete sample code.

// test.d

string format(Args...)(string fmt, Args args)
{
    return "";
}

void loadDeviceFns()
{
    enum allFns = ["vkCreateSampler"];
    foreach (f;allFns)
    {
        mixin("%s".format(f));
    }
}

$ dmd -o- test
test.d(11): Error: variable f cannot be read at compile time
test.d(11):        called from here: format("%s", f)
test.d(11): Error: argument to mixin must be a string, not (format("%s", f)) of
type string

--


More information about the Digitalmars-d-bugs mailing list