D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19185 - [ICE] Nested struct segfaults when using variable from outer scope
Summary: [ICE] Nested struct segfaults when using variable from outer scope
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 normal
Assignee: No Owner
URL:
Keywords: ice, pull
Depends on:
Blocks:
 
Reported: 2018-08-22 14:06 UTC by RazvanN
Modified: 2018-09-06 15:43 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description RazvanN 2018-08-22 14:06:26 UTC
void fun()
{
    int x = 2;
    struct A
    {   
        int a;
        this(int a)
        {   
            this.a = a + x;      // segault here
        }
    }

    A a = 5;
    // A a = A(5); initializing `a` like this works as expected                                                                                                                              
}

void main()
{
    fun();
}
Comment 1 RazvanN 2018-08-22 14:33:23 UTC
PR : https://github.com/dlang/dmd/pull/8597
Comment 2 github-bugzilla 2018-09-06 15:43:33 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/9b5a295e8707a17bee8e45e0337935ed568bcff9
Fix Issue 19185 - [ICE] Nested struct segfaults when using variable from outer scope

https://github.com/dlang/dmd/commit/88de313bb92b3fb181cc0198b490422b1ab57407
Merge pull request #8597 from RazvanN7/Issue_19185

Fix Issue 19185 - [ICE] Nested struct segfaults when using variable from outer scope
merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>