Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.variant doesn't do postblit/dtor correctly for large structs #9783

Open
dlangBugzillaToGithub opened this issue Nov 6, 2019 · 2 comments

Comments

@dlangBugzillaToGithub
Copy link

john.loughran.colvin (@John-Colvin) reported this on 2019-11-06T12:00:44Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=20360

CC List

Description

unittest
{
    import std.variant;
    static struct S
    {
        int* p;
        ubyte[100] u;

        this(int a)
        {
            p = new int(a);
        }
    
        this(this)
        {
            p = new int(*p);
        }

        ~this()
        {
            p = null;
        }
    }
    Variant v = S(4);
    assert(v.peek!S.p !is null); // fails
}
@dlangBugzillaToGithub
Copy link
Author

john.loughran.colvin commented on 2019-11-06T12:02:42Z

related to https://issues.dlang.org/show_bug.cgi?id=12944

@dlangBugzillaToGithub
Copy link
Author

bugzilla (@WalterBright) commented on 2020-01-05T19:06:57Z

On my computer the static array u can contain up to 24 element to work. Together with the 8 bytes of the pointer this looks like 32 bytes is the magic border.

@LightBender LightBender removed the P2 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants