D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20782 - std.conv.to can't convert string to const enum
Summary: std.conv.to can't convert string to const enum
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-04-28 10:19 UTC by Atila Neves
Modified: 2020-04-28 13:38 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Atila Neves 2020-04-28 10:19:19 UTC
-------------------------
import std.conv: to;
enum Enum { oops }
"foo".to!(const Enum);  // doesn't compile
-------------------------
Comment 1 Dlang Bot 2020-04-28 10:21:32 UTC
@atilaneves created dlang/phobos pull request #7464 "Fix issue 20782 - allow std.conv.to to convert string to const enum" fixing this issue:

- Fix issue 20782 - allow std.conv.to to convert string to const enum
  
  The commit allows the following code to compile:
  
  ------------------------
  enum Enum { oops }
  "foo".to!(const Enum);
  ------------------------

https://github.com/dlang/phobos/pull/7464
Comment 2 Dlang Bot 2020-04-28 13:38:17 UTC
dlang/phobos pull request #7464 "Fix issue 20782 - allow std.conv.to to convert string to const enum" was merged into master:

- 46933cf73ed7a127c4657f418280938e3d1bbd80 by Atila Neves:
  Fix issue 20782 - allow std.conv.to to convert string to const enum
  
  The commit allows the following code to compile:
  
  ------------------------
  enum Enum { oops }
  "foo".to!(const Enum);
  ------------------------

https://github.com/dlang/phobos/pull/7464