www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23292] New: Import in template ignored during IFTI for


          Issue ID: 23292
           Summary: Import in template ignored during IFTI for eponymous
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of DMD 2.100.0, the following example program fails to compile

--- lib.d
module lib;

struct S {}
--- app.d
module app;

template fun()
        import lib;
        void fun(S) {}

void main()
        import lib;
        S s;

The error message is:

app.d(6): Error: undefined identifier `S`
app.d(13): Error: none of the overloads of template `app.fun` are callable
using argument types `!()(S)`
app.d(3):        Candidate is: `fun()(S)`

If the call expression `fun(s)` is changed to `fun!()(s)`, the program compiles

Aug 12 2022