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