[Issue 14894] [Reg 2.068.0-rc1] linkage error with mixin template in std.net.curl
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Aug 9 16:35:31 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14894
--- Comment #1 from Martin Nowak <code at dawg.eu> ---
Happens b/c the mangling is determined by the number of member in the parent
scope. This number can vary between compilations w/ and w/o -unittest.
cat > main.d << CODE
import bug;
void main()
{
Foo foo;
foo.onReceive();
}
CODE
cat > bug.d << CODE
mixin template Protocol()
{
void onReceive() {}
}
struct Foo
{
mixin Protocol!();
unittest
{
}
}
CODE
----
dmd -c bug
dmd -unittest main bug.o
----
The manifestation of this bug is caused by skipping unittest parsing [¹], but
the underlying problem can also be triggered by any other version/debug block
member.
The code to derive a unique mixin mangling was already added with 2.065.0 [²]
and is also used for lambdas.
[¹]: https://github.com/D-Programming-Language/dmd/pull/4704
[²]: https://github.com/D-Programming-Language/dmd/pull/3019
--
More information about the Digitalmars-d-bugs
mailing list