www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18236] New: Invalid line reported on error casting enum

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 puremagic.com
          Reporter: shachar 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.



--
Jan 14 2018