deprecated enum and to!string warnings
Steven Schveighoffer
schveiguy at gmail.com
Mon Nov 19 21:04:02 UTC 2018
On 11/19/18 2:47 PM, Vladimirs Nordholm wrote:
> The following code produces 28 deprecation warnings at build time:
>
> import std.conv : to;
>
> enum Foo {
> bar,
> deprecated baz
> }
>
> void main() {
> to!string(Foo.bar);
> }
>
> Why is that?
>
> https://run.dlang.io/is/AdUscN
Ouch!
I don't know if there's a way to fix this, what I think is happening is
there are multiple instantiations of the same template from different
places, and each time it's used, it's going to cause a warning.
The reason you see it, even though "baz" isn't used, is likely because
of the way to!string works for enums (it probably uses a switch with all
the enum values as cases).
-Steve
More information about the Digitalmars-d
mailing list