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

Walter Bright <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #3 from Walter Bright <[email protected]> ---
A simpler demonstration:

import core.stdc.stdio;

struct S {
    this(int i) {
        c = 's';
        p = &c;
    }

    ~this() {
        printf("S.dtor\n");
        c = 'd';
    }

    char *p;
    char c = 's';
}

int main() {
    char t = 't';
    char *q = &t;
    int x = 1;
    char *p = x ? S(1).p : q;
    printf("*p = %c\n", *p);
    assert(*p == 's');
    return 0;
}

--

Reply via email to