www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21852] New: diagnostic: One-liner errors with formatted Loc

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

          Issue ID: 21852
           Summary: diagnostic: One-liner errors with formatted Loc should
                    print context when -verrors=context
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

For example:
---
char skip()
{
    goto Lskip;
    char ch = '!';
Lskip:
    return ch;
}
---

Reports:
---
mod.d(3): Error: goto skips declaration of variable mod.skip.ch at mod.d(4)
    goto Lskip;
    ^
---

Whereas a better error that takes advantage of `-verrors=context' would be:
---
mod.d(3): Error: `goto` skips declaration of variable `mod.skip.ch`
    goto Lskip;
    ^
mod.d(4):        declared here
    char ch = '!';
         ^
---

--
Apr 23