www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19022] New: CTorFlow: Show the line of the duplicated

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

          Issue ID: 19022
           Summary: CTorFlow: Show the line of the duplicated
                    initialization for const/immutable fields
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

Currently this yields:

---
struct Foo
{
    immutable int b;
    this(int a)
    {
        b = 2;
        b = 2;
    }
}
---

foo.d(8): Error: immutable field b initialized multiple times

While in this case, it's easy to see where the error is, it can pretty
complicated for complex constructor chains with mixins. Hence, it would be
great to show the line of the previous declaration.

--
Jun 24 2018