Bug 6801 – access violation when passing a function literal to the mixin and calling it from function that has other declarations
Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-10-10T03:01:00Z
Last change time
2013-11-21T18:54:05Z
Keywords
wrong-code
Assigned to
nobody
Creator
luka8088
Comments
Comment #0 by luka8088 — 2011-10-10T03:01:58Z
// this happens on Windows XP, 32bit, any version between dmd2-042 and dmd2-055
// there was also a feedback that linux dmd2-055 causes segfault
// workaround for this is to use -O when compiling (both or windows and linux)
import std.stdio;
mixin template tpl1 (alias fn) {
void b () {
// calling fn causes Access Violation if there is two or more int declarations
// in order to make this work either remove one int declaration or remove fn call
int c;
int d;
fn();
}
}
class a {
mixin tpl1!(function () { writeln("test"); });
}
void main () {
a a1 = new a();
a1.b();
}
Comment #1 by lovelydear — 2012-05-01T15:17:39Z
Also fails with 2.059 Win32
Comment #2 by k.hara.pg — 2013-11-21T18:54:05Z
*** This issue has been marked as a duplicate of issue 11545 ***