[Issue 18100] New: crt_constructor not allow to init immutable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 18 04:15:37 UTC 2017


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

          Issue ID: 18100
           Summary: crt_constructor  not allow to init immutable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: changlon at gmail.com

=========== code ============
static immutable int my_i ;
int test(){
        return 3;
}

shared static this(){
        my_i = test();  // work 
}
pragma(crt_constructor) extern(C) void init1(){
        my_i = test(); //   Error: cannot modify immutable expression my_i
}
==========================

--


More information about the Digitalmars-d-bugs mailing list