[Issue 18236] New: Invalid line reported on error casting enum

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 14 12:34:26 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18236

          Issue ID: 18236
           Summary: Invalid line reported on error casting enum
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: shachar at weka.io

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.

--


More information about the Digitalmars-d-bugs mailing list