digitalmars.D.bugs - [Issue 18774] New: meta used in .di files causes link errors
- d-bugmail puremagic.com (45/45) Apr 17 2018 https://issues.dlang.org/show_bug.cgi?id=18774
https://issues.dlang.org/show_bug.cgi?id=18774 Issue ID: 18774 Summary: meta used in .di files causes link errors Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: turkeyman gmail.com We produce a function prototype in a .di file using some meta test.di ------- module test; template Test() { import std.range, std.algorithm; enum Test = "void test_func(" ~ zip(["int","int"], ["a","b"]) .map!(tuple => tuple[0] ~ " " ~ tuple[1]) .reduce!((a, b) => a ~ ", " ~ b) ~ ");"; } mixin(Test!()); // <- Mixes in: void test_func(int a, int b); ------- main.d ------ import test; int main() { test_func(1, 2); return 0; } ------ I expect compiling this example to result in a single link error to the unresolved external test_func(). But we also see "error LNK2001: unresolved external symbol _D3std5range__T3ZipTAAyaTQfZQn6__initZ" Calling zip() at CTFE results in an additional unexpected link error. Using a function in CTFE this way shouldn't affect the symbol table, or add any additional link references. --
Apr 17 2018