www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6742] New: Alignments in std.variant.Algebraic

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6742

           Summary: Alignments in std.variant.Algebraic
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2011-09-29 11:07:53 PDT ---
In DMD 2.056head std.variant.Algebraic seems to ignore alignment requirements:


import std.variant: Algebraic;
static assert(double.alignof == 8);
struct Foo { double x; }
alias Algebraic!(Foo) AFoo1;
static assert(AFoo1.sizeof == 12);
struct AFoo2 {
    bool b;
    double x;
}
static assert(AFoo2.sizeof == 16);
void main() {}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 29 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6742


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com


--- Comment #1 from SomeDude <lovelydear mailmetrash.com> 2012-04-27 15:05:18
PDT ---
Compiles and runs on 2.059 Win32

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 27 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6742



--- Comment #2 from bearophile_hugs eml.cc 2012-05-22 15:22:50 PDT ---
(In reply to comment #1)
 Compiles and runs on 2.059 Win32

That's the problem. I think AFoo1.sizeof has to be 16 byte, to respect the algnment of doubles that is 8. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 22 2012