www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15835] New: Segfault with typeid call from lazy argument


          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 puremagic.com
          Reporter: code 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;

string fun4(ClassInfo t) {
  return t.name;

void fun3(lazy const(char)[] c) {
  printf("%.*s\n", c.length, c.ptr);

void main() {

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

Mar 26 2016