D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15992 - [REG2.072a] ICE with field variable of instantiated struct
Summary: [REG2.072a] ICE with field variable of instantiated struct
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: ice, pull
Depends on:
Blocks: 15995
  Show dependency treegraph
 
Reported: 2016-05-04 19:16 UTC by ag0aep6g
Modified: 2016-10-01 11:47 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 ag0aep6g 2016-05-04 19:16:31 UTC
----
struct Appender()
{
    bool canExtend = false;
}

struct CustomFloat()
{
    union ToBinary
    {
        CustomFloat!() get;
    }

    void opAssign(F)(F input)
        if (__traits(compiles, cast(real)input))
    {
    }

    real get()()
    {
        Appender!() app;
        assert(false);
    }

    T opCast(T)() { return get!(); }

    alias g = get!();
}

void f()
{
    alias FPTypes = CustomFloat!();
}
----

Encountered here: https://github.com/dlang/phobos/pull/4280

Works with 2.071.0.

Git master (7c3ccd8) fails with:
----
dmd: todt.c:787: void membersToDt(AggregateDeclaration*, DtBuilder&, Expressions*, size_t, ClassDeclaration*, BaseClass***): Assertion `vd->semanticRun >= PASSsemantic2done' failed.
Aborted (core dumped)
----
Comment 1 Kenji Hara 2016-05-15 15:28:54 UTC
https://github.com/dlang/dmd/pull/5780
Comment 2 github-bugzilla 2016-07-10 05:52:36 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/201b124e6c1784c19bdd012bdec7577452d82338
fix Issue 15992 - ICE with field variable of instantiated struct

When a template is instantiated in function body, it usually gets no chance to run `semantic2`, because inserted module's `semanticRun` would be greater than `PASSsemantic2done` (function bodies are analyzed in global `semantic3` stage).

Therefore we should append template instances to global deferred `semantic2` list as same as for `semantic3`.

https://github.com/dlang/dmd/commit/298d0102d27a50ef048c3bceb6761b470b4bc18c
Merge pull request #5780 from 9rnsr/fix15992

[REG2.072a] Issue 15992 - ICE with field variable of instantiated struct
Comment 3 github-bugzilla 2016-10-01 11:47:18 UTC
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/201b124e6c1784c19bdd012bdec7577452d82338
fix Issue 15992 - ICE with field variable of instantiated struct

https://github.com/dlang/dmd/commit/298d0102d27a50ef048c3bceb6761b470b4bc18c
Merge pull request #5780 from 9rnsr/fix15992