Bug 16685 – template instantiation rejected when passing member of enum struct in value parameter

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-11-14T12:48:23Z
Last change time
2018-02-08T15:54:05Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Eyal Lotem

Comments

Comment #0 by eyal.lotem — 2016-11-14T12:48:23Z
Failing to instantiate a template from a correctly-typed compile-time value: struct Id { ushort value; } enum Id x = Id(5); struct S(ushort A) {} // This works, as expected: enum ushort someShortVal = 5; alias CanCreateFromShort = S!(someShortVal); // This works, as expected: alias CanCreateFromTypedValue = S!(ushort(x.value)); static assert(is(typeof(x.value) == ushort)); // This surprisingly fails alias CannotCreateFromValue = S!(x.value);
Comment #1 by bitter.taste — 2016-12-21T08:25:45Z
Comment #2 by github-bugzilla — 2017-11-18T20:57:35Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9b380e7b249eeac8d3b6a79ec102564de85de10d Issue 16685 - template instantiation rejected when passing member of enum struct in value parameter https://github.com/dlang/dmd/commit/2e71fdb22c6d1320e08de4e0cd7a1042d0d0abea Merge pull request #7335 from JinShil/fix_16685 Issue 16685 - template instantiation rejected when passing member of enum struct in value parameter
Comment #3 by github-bugzilla — 2017-12-18T22:57:20Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9b380e7b249eeac8d3b6a79ec102564de85de10d Issue 16685 - template instantiation rejected when passing member of enum struct in value parameter https://github.com/dlang/dmd/commit/2e71fdb22c6d1320e08de4e0cd7a1042d0d0abea Merge pull request #7335 from JinShil/fix_16685