[Issue 21924] New: Internal compiler error with @live

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 15 13:54:35 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21924

          Issue ID: 21924
           Summary: Internal compiler error with @live
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Keywords: live
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: lempiji at gmail.com

this code has internal compiler error with -preview=dip1021.

```
struct Handle
{
    private void* handle;

    @disable this();
    @disable this(this);

    this(int n)
    {
        handle = malloc(10);
    }

    void close()
    {
        free(handle);
    }
}

void main()
{
    scope h = Handle(10);
    h.close();
}
```


The reason is in `isBorrowedPtr`.

```
return v.isScope() && !v.isowner && v.type.nextOf().isMutable();
//v.type.nextOf() is null
```

`isReadonlyPtr` too:


```
return v.isScope() && !v.type.nextOf().isMutable(); // v.type.nextOf() is null
```

--


More information about the Digitalmars-d-bugs mailing list