D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15618 - [REG-master] Class member layout has been changed, ABI needs to be updated?
Summary: [REG-master] Class member layout has been changed, ABI needs to be updated?
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-28 14:24 UTC by Kenji Hara
Modified: 2016-02-04 01:34 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2016-01-28 14:24:19 UTC
To fix issue 15579, PR 5361 was merged.
https://github.com/D-Programming-Language/dmd/pull/5361.

But I noticed that it has changed extern (D) class layout, not only for extern (C++).
https://github.com/D-Programming-Language/dmd/pull/5361/files#r51126555

Test case:

extern (D) //extern (C++)
{
    class Base
    {
        ~this() {}
        size_t x = 4;
    }

    interface Interface
    {
        int Method();
    }

    class Derived : Base, Interface
    {
        size_t y = 5;
        int Method() { return 3; }
    }
}

void main()
{
    Derived d;                  // dmd 2.069             master
    pragma(msg, d.x.offsetof);  // (void*).sizeof * 2
    pragma(msg, d.y.offsetof);  // (void*).sizeof * 3 -> 4
}

I'm not sure it was expected, so I open this regression issue. If it's an intentional change, we should update http://dlang.org/spec/abi ABI page, so there's an explanation for D class object layout.
Comment 1 Walter Bright 2016-02-01 04:30:23 UTC
You're right, the D ABI shouldn't have changed.
Comment 3 github-bugzilla 2016-02-01 11:28:41 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/5bebb65a4dacef5cf33701e6d2dae61a41f460b4
fix Issue 15618 - [REG-master] Class member layout has been changed, ABI needs to be updated?

https://github.com/D-Programming-Language/dmd/commit/9c90f94b8537965b16eb7c09289fcd040664e4fe
Merge pull request #5387 from WalterBright/fix15618

fix Issue 15618 - [REG-master] Class member layout has been changed, …