[Issue 13297] New: [CTFE] Modifications of user type pointer member passed by ref in function disappear

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Aug 15 06:12:20 PDT 2014


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

          Issue ID: 13297
           Summary: [CTFE] Modifications of user type pointer member
                    passed by ref in function disappear
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: CTFE, wrong-code
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: verylonglogin.reg at gmail.com

This code should compile fine:
---
struct S
{
    int* p;
}

void f(ref int* p)
{
    p = cast(int*) 1;
    assert(p); // passes
}

void main()
{
    static assert(
    {
        S s;
        f(s.p);
        return s.p == null; // false
    } ());
}
---

--


More information about the Digitalmars-d-bugs mailing list