D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16188 - [REG2.069] ICE on invalid code
Summary: [REG2.069] ICE on invalid code
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 regression
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code
: 16276 (view as issue list)
Depends on:
Blocks:
 
Reported: 2016-06-21 02:44 UTC by changlon
Modified: 2016-08-01 19:54 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description changlon 2016-06-21 02:44:58 UTC
ICE for DMD 2.071:

//==============================================================================

class DB
{
}

//==============================================================================

Query where(alias pred, Query)(Query )
{
    auto p = Where!();
    pred(p); // record predicate
}

struct Where()
{
    auto opDispatch(string name)()
    {
        alias FieldType = typeof(getMember);
WhereField!FieldType;
    }
}

struct WhereField(FieldType)
{
}void main()
{
    auto db = DB;
db.where!(p => p.name );
}

=============================
..\test.d(30): Error: type DB has no value
..\test.d(11): Error: type Where!() has no value

object.Error@(0): Access Violation
----------------
0x004EC058
Comment 1 ag0aep6g 2016-06-21 18:27:38 UTC
Reduced further:

----
void where() { Where().name; }

struct Where
{
    void opDispatch(string name)()
    {
        alias FieldType = typeof(getMember);
        WhereField!FieldType;
    }
}

struct WhereField(FieldType) {}
----

Doesn't segfault with 2.068.2 and earlier.
Comment 2 Walter Bright 2016-07-09 10:07:17 UTC
https://github.com/dlang/dmd/pull/5925
Comment 3 github-bugzilla 2016-07-09 21:39:32 UTC
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/8fbedf504bed737241f734f7c8883693ba069472
fix Issue 16188 - [REG2.069] ICE on invalid code

https://github.com/dlang/dmd/commit/920e870e848e7668a15219cb004e422e25448d3e
removed change in declaration.d unrelated to Issue 16188

- I assume it was an attempt at showing the correct error
  message during opDispatch semantics (by rerunning semantic).
  But as we still get the wrong error message and this change
  isn't necessary to fix 16188, we better not merge it into stable.

https://github.com/dlang/dmd/commit/b3c0283c4b2acbc24919c9dfdb0f68a7ba1f2bfb
Merge pull request #5927 from MartinNowak/fix16188

fix Issue 16188 - [REG2.069] ICE on invalid code
Comment 4 ag0aep6g 2016-07-13 20:30:07 UTC
*** Issue 16276 has been marked as a duplicate of this issue. ***
Comment 5 github-bugzilla 2016-08-01 19:54:33 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/8fbedf504bed737241f734f7c8883693ba069472
fix Issue 16188 - [REG2.069] ICE on invalid code

https://github.com/dlang/dmd/commit/920e870e848e7668a15219cb004e422e25448d3e
removed change in declaration.d unrelated to Issue 16188

https://github.com/dlang/dmd/commit/b3c0283c4b2acbc24919c9dfdb0f68a7ba1f2bfb
Merge pull request #5927 from MartinNowak/fix16188