Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 06, 2012 Purity and enum | ||||
---|---|---|---|---|
| ||||
Not sure if this is a bug, or just some missing functionality of pure. void f() pure { enum a = to!string("a"); // some legal compile-time to!() } Gives "to is not pure" The following works: template S(alias v) { enum S = to!string(v); } void g() pure { enum a = S!"a"; } Should purity be checked at all if used with an enum? Tested on dmd 2.057 / linux x64 |
February 06, 2012 Re: Purity and enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | "simendsjo" <simendsjo@gmail.com> wrote in message news:jgo9if$1mg9$1@digitalmars.com... > Should purity be checked at all if used with an enum? I don't think so. http://d.puremagic.com/issues/show_bug.cgi?id=6169 https://github.com/D-Programming-Language/dmd/pull/652 |
February 06, 2012 Re: Purity and enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On 02/06/2012 11:46 AM, Daniel Murphy wrote:
> "simendsjo"<simendsjo@gmail.com> wrote in message
> news:jgo9if$1mg9$1@digitalmars.com...
>> Should purity be checked at all if used with an enum?
>
> I don't think so.
>
> http://d.puremagic.com/issues/show_bug.cgi?id=6169
> https://github.com/D-Programming-Language/dmd/pull/652
>
>
Thanks. Fixed in 2.059 perhaps? A long wait :)
|
February 06, 2012 Re: Purity and enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | I wouldn't hold my breath. "simendsjo" <simendsjo@gmail.com> wrote in message news:jgoejk$23j1$1@digitalmars.com... > On 02/06/2012 11:46 AM, Daniel Murphy wrote: >> "simendsjo"<simendsjo@gmail.com> wrote in message news:jgo9if$1mg9$1@digitalmars.com... >>> Should purity be checked at all if used with an enum? >> >> I don't think so. >> >> http://d.puremagic.com/issues/show_bug.cgi?id=6169 https://github.com/D-Programming-Language/dmd/pull/652 >> >> > > Thanks. Fixed in 2.059 perhaps? A long wait :) |
Copyright © 1999-2021 by the D Language Foundation