[Issue 19092] New: __delete doesn't work with immutable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 18 09:45:06 UTC 2018


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

          Issue ID: 19092
           Summary: __delete doesn't work with immutable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: radu.racariu at gmail.com

The following program
---
void main()
{
    import core.memory : __delete;

    immutable(int)[] x;

    __delete(x);
}
---
Fails to compile
---
/dlang/dmd/linux/bin64/../../src/druntime/import/core/memory.d(1022): Error:
function core.memory.GC.free(void* p) is not callable using argument types
(immutable(int)*)
/dlang/dmd/linux/bin64/../../src/druntime/import/core/memory.d(1022):       
cannot pass argument cast(immutable(int)*)x of type immutable(int)* to
parameter void* p
onlineapp.d(7): Error: template instance
`core.memory.__delete!(immutable(int)[])` error instantiating
---

If `__delete` is suppose to be an alternative to `delete` then it has to
support all use cases.

As this compiles (with the deprecation warning)
---
void main()
{
    immutable(int)[] x;

    delete x;
}
---

--


More information about the Digitalmars-d-bugs mailing list