[Issue 15835] New: Segfault with typeid call from lazy argument
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Mar 26 15:54:13 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15835
Issue ID: 15835
Summary: Segfault with typeid call from lazy argument
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: wrong-code
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: code at klickverbot.at
This program segfaults using both DMD 2.070 and latest Git master (2d1f4f6):
---
extern(C) int printf(const char*, ...);
class A {}
void fun2() {
auto symbol = new A;
fun3(fun4(typeid(symbol)));
}
string fun4(ClassInfo t) {
return t.name;
}
void fun3(lazy const(char)[] c) {
printf("%.*s\n", c.length, c.ptr);
}
void main() {
fun2();
}
---
The issue seems to be that `symbol` is not added to the list of closure
variables in fun2, i.e. is not part of the nested context as expected during
codegen for the implicit lazy delegate.
Reported by Timothee Cour as LDC issue #1369
(https://github.com/ldc-developers/ldc/issues/1369).
--
More information about the Digitalmars-d-bugs
mailing list