[Issue 23436] New: Spec falsely states mutable references in struct .init are forbidden

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 25 17:23:13 UTC 2022


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 at puremagic.com
          Reporter: snarwin+bugzilla at 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

--


More information about the Digitalmars-d-bugs mailing list