www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23436] New: Spec falsely states mutable references in struct

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

          Issue ID: 23436
           Summary: Spec falsely states mutable references in struct .init
                    are forbidden
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

The section of the language spec on default struct initialization [1] contains
the following statement:

 The default initializers may not contain references to mutable data.
However, this statement is false. References to mutable data are allowed in default initializers of struct fields, and have been since at least DMD 2.060 (the oldest compiler available on run.dlang.io). [1] https://dlang.org/spec/struct.html#default_struct_init --
Oct 25 2022