www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17343] New: class.init.<symbol> does not working

https://issues.dlang.org/show_bug.cgi?id=17343

          Issue ID: 17343
           Summary: class.init.<symbol> does not working
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andrey kabylin.ru

Can't get default value for symbol in class, if I write this working well:
 struct A {
     int a = 10;
 }

 assert(A.init.a == 10);
But if change struct to class, application will crush
 class B {
     int b = 10;
 }

 assert(B.init.b == 10); // exited abnormally with code 2
--
Apr 23