D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19209 - [ICE] Overriding a field in a baseclass issues an ICE
Summary: [ICE] Overriding a field in a baseclass issues an ICE
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-30 20:55 UTC by Paolo Invernizzi
Modified: 2018-09-07 05:35 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Paolo Invernizzi 2018-08-30 20:55:01 UTC
DMD 2.081.2 on macOS
====

foo/bag.d

import foo.baz;
class Spam {
    void method;
}

--
foo/bar.d

import foo.bag;
--
foo/baz.d

import foo.bag;
class Spammed : Spam { override method() {} }

===
dmd -c -o-  -I.  foo/bar.d
foo/bag.d(5): Error: variable `bag.Spam.method` variables cannot be of type void
Segmentation fault: 11
Comment 1 RazvanN 2018-09-05 13:46:05 UTC
Reduced example:

class Spam {
    int method;                                                                                                                      
}

class Spammer : Spam
{
    override method() {}
}

The problem is that `method` is trying to override a field.
Comment 2 RazvanN 2018-09-05 13:54:16 UTC
PR : https://github.com/dlang/dmd/pull/8665
Comment 3 github-bugzilla 2018-09-07 05:35:11 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/bfd48f4a56bacfb8f01e6be27833e675b62eab7e
Fix Issue 19209 - [ICE] Overriding a field in a baseclass issues an ICE

https://github.com/dlang/dmd/commit/35558bd524e519d6ef58253e56f47cdc663a6593
Merge pull request #8665 from RazvanN7/Issue_19209

Fix Issue 19209 - [ICE] Overriding a field in a baseclass issues an ICE
merged-on-behalf-of: Walter Bright <WalterBright@users.noreply.github.com>