D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16618 - [REG2.055] Segmentation fault in DMD with cyclic alias this and unknown identifier
Summary: [REG2.055] Segmentation fault in DMD with cyclic alias this and unknown ident...
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: ice
Depends on:
Blocks:
 
Reported: 2016-10-16 13:56 UTC by changlon
Modified: 2018-10-25 14:06 UTC (History)
3 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-10-16 13:56:05 UTC
```d
struct embed(T) {

        alias payload this;
    @property payload() inout {
embed_instance ;
        }
}
class Bufferz {
}

struct Buffer {
                embed!Bufferz _range ;
        pragma(inline)
{
        }

}

```
Comment 1 changlon 2016-10-16 14:07:46 UTC
for v2.072.0-b2

```sh
struct embed(T) {
                T embed_instance ;
    @property payload() {
                return embed_instance ;
        }
}
class Bufferz {
        alias owner this ;
                Buffer* _owner ;
auto owner() {
                return _owner ;
        }

}

struct Buffer {
                alias range this ;
                embed!Bufferz _range ;
                auto range() {
                        return _range.payload ;
                }
                ref slice() {
Slice;
                }
        pragma(inline)
{
        }

}
```
Comment 2 ag0aep6g 2016-10-16 16:30:15 UTC
(In reply to changlon from comment #1)

Reduced/simplified further:

----
class Bufferz
{
    alias owner this;
    Buffer owner() { return Buffer.init; }
}

struct Buffer
{
    alias range this;
    Bufferz range() { return Bufferz.init; }
    void slice() { error; }
}
----

You marked this as a regression, but you didn't specify which previous version of dmd doesn't have the problem. For a bug to be a regression, the code must have worked at some point. Downgrading to "normal".
Comment 3 RazvanN 2018-10-25 14:06:08 UTC
Compiling this with dmd 2.081 issues:

Error: undefined identifier embed_instance

and no seg fault. Closing as fixed