Bug 18236 – Invalid line reported on error casting enum

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-01-14T12:34:26Z
Last change time
2018-05-24T18:57:20Z
Keywords
diagnostic, industry
Assigned to
No Owner
Creator
Shachar Shemesh

Comments

Comment #0 by shachar — 2018-01-14T12:34:26Z
1 struct V { 2 int a; 3 } 4 5 struct S { 6 enum A = V(12); // Line 6 7 } 8 9 void main() { 10 int b = cast(int)S.A; // Line 10 11 } This compiles with the following error: test2.d(6): Error: cannot cast expression V(12) of type V to int The error should point to line 10, not line 6. This problem may or may not be related to the (exceedingly old) issue #3773.
Comment #1 by razvan.nitu1305 — 2018-05-24T17:10:57Z
Comment #2 by github-bugzilla — 2018-05-24T18:57:19Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/69a82a612253a47f134cac1e0dab65831fd3f715 Fix Issue 18236 - Invalid line reported on error casting enum https://github.com/dlang/dmd/commit/aa8fc584b92e736290f359596ec9e0aae857ae2c Merge pull request #8287 from RazvanN7/Issue_18236 [Trivial]Fix Issue 18236 - Invalid line reported on error casting enum merged-on-behalf-of: Jacob Carlborg <[email protected]>