www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23355] New: invalid template parameter loses error location

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

          Issue ID: 23355
           Summary: invalid template parameter loses error location in
                    some cases
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: d.bugs webfreak.org

Reproduction test case file:

void ffi(T)(T[n] s) { }

void main() { int[4] x; ffi(x); }

When trying to compile this, the following messages are output:

Error: undefined identifier `n`
a.d(3): Error: none of the overloads of template `a.ffi` are callable using
argument types `!()(int[4])`
a.d(1):        Candidate is: `ffi(T)(T[n] s)`

note how the first error is missing context (would expect `a.d(1):` here)

In this particular case it's not a hard issue, because the following errors
show that there is an issue. However in my real project I have this function in
another file in some weird configuration where there are no other errors other
than the context-less error.

So in my real project all I get is:

Error: undefined identifier `n`
Error: undefined identifier `n`
Error: undefined identifier `n`
Error: undefined identifier `n`

which is harder to debug.

--
Sep 21 2022