www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23281] New: [REG2.099] Cannot pass alias template overload to

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

          Issue ID: 23281
           Summary: [REG2.099] Cannot pass alias template overload to
                    template ("is not a template, it is a function")
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

Testcase:
```
struct S {
    void foo(int a) {}
    void foo_old(long a) {}
    alias foo(I: int) = foo_old;
}

void templ(alias IMPL)() {
    pragma(msg, typeof(IMPL));
}

void foo() {
    S s;
    templ!(mixin("S.foo"));
    templ!(S.foo); // no new pragma output because same
                   // template instantation as previous line

    templ!(mixin("S.foo!int"));
    //templ!(S.foo!int); // Error: example.S.foo is not a template, it is a
function
}
```

Compilation with dlang 2.098 or older outputs:
```
void(int a)
void(long a)
```

Compilation with dlang 2.099 outputs:
```
void(int a)
<source>(17): Error: `example.S.foo` is not a template, it is a function
```

The actual case in our case was more complicated and magically was fixed with
dlang 2.099 after replacing `S` by `s` in `templ!(mixin("S.foo!int"));` (change
of type --> variable)...

--
Aug 03 2022