Explicit casting of enum -- intentional restriction?
Marc Schütz via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Oct 2 03:52:59 PDT 2016
On Saturday, 1 October 2016 at 20:52:48 UTC, rcorre wrote:
> I just tried to compile an old project and the following failed:
>
> ---
> enum Paths : string {
> bitmapDir = "content/image",
> fontDir = "content/font",
> soundDir = "content/sound",
> ...
>
> if (Paths.preferences.exists)
> ...
> ---
>
> It turns out members of Paths are no longer implicitly
> converted to string, and I needed to use
>
> if ((cast(string)Paths.preferences).exists)
>
> Is this an intentional limitation or a regression? I didn't see
> it in the last few changelogs but I'll admit I didn't check
> them rigorously.
This is the PR that broke it:
https://github.com/dlang/phobos/pull/3447
More information about the Digitalmars-d-learn
mailing list