[Issue 18945] immutable variable is used as if it's an enum

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 5 13:48:59 UTC 2018


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

anonymous4 <dfj1esp02 at sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86                         |All
                 OS|Windows                     |All

--- Comment #5 from anonymous4 <dfj1esp02 at sneakemail.com> ---
---
int f(in int a) pure
{
    return a;
}

void g()
{
    immutable int a=0;
    static assert(f(a)==0);
}
---
This works.


---
int f(in ref int a) pure
{
    return a;
}

void g()
{
    immutable int a=0;
    static assert(f(a)==0);
}
---
This doesn't.

--


More information about the Digitalmars-d-bugs mailing list