[Issue 8192] inconsistent behavior of initialized immutable instance fields

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 3 12:08:01 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8192


art.08.09 at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |art.08.09 at gmail.com


--- Comment #2 from art.08.09 at gmail.com 2012-06-03 12:09:51 PDT ---
Worse, the struct layout changes when an immutable field has an initializer.

   struct S  { immutable int x = 1; int y; }
   struct S2 { int x;               int y; }

   void main(){
      S s;
      S2 s2;
      static assert(s.y.offsetof==s2.y.offsetof); // fails
   }

Trying to take the address of s.x fails with 'not an lvalue', etc.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list