[Issue 17343] New: class.init.<symbol> does not working

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Apr 23 02:36:45 PDT 2017


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 at puremagic.com
          Reporter: andrey at 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

--


More information about the Digitalmars-d-bugs mailing list