[Issue 15974] New: Spurious error: argument to mixin must be a string, not (expression()) of type string
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Apr 29 17:59:31 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15974
Issue ID: 15974
Summary: Spurious error: argument to mixin must be a string,
not (expression()) of type string
Product: D
Version: D2
Hardware: x86
OS: Mac OS X
Status: NEW
Severity: trivial
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: iamthewilsonator at hotmail.com
DMD64 D Compiler v2.070-devel-5123284
alias allDeviceFns = AliasSeq!("vkCreateSampler");
void loadDeviceFns(VkDevice d)
{
enum allFns = [allDeviceFns];
foreach(f;allFns)
{
mixin("%s =
cast(typeof(%s)vkGetDeviceProcAddr(d,toStringz(\"%s\"))".format(f,f,f));
}
}
Gives two errors:
vk.d(1576): Error: variable f cannot be read at compile time
vk.d(1576): called from here: format("%s =
cast(typeof(%s)vkGetDeviceProcAddr(d,toStringz(\"%s\"))", f, f, f)
vk.d(1576): Error: argument to mixin must be a string, not (format("%s =
cast(typeof(%s)vkGetDeviceProcAddr(d,toStringz(\"%s\"))", f, f, f)) of type
string
--
More information about the Digitalmars-d-bugs
mailing list