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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jan 20 03:55:45 PST 2015


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

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Denis Shelomovskij from comment #0)
> 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

You meant:
          return s.p != null; // false
?

>     } ());
> }
> ---

--


More information about the Digitalmars-d-bugs mailing list