www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19918] New: UFCS doesn't work in typeid expressions for

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

          Issue ID: 19918
           Summary: UFCS doesn't work in typeid expressions for functions
                    with alias template parameter
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johannes.riecken gmail.com

I have a function foo with a template alias parameter.
When calling it with UFCS syntax and taking the result's typeid, I get the
error "template identifier foo is not a member of variable foo.main.s" during
compilation. 
Here are similar cases that do compile:
- typeid of applied function with regular function call syntax
- typeof with the UFCS expression
- typeid when there's no alias template parameter

struct S {
    int i;
}

int foo(alias unused, T)(T t) {
    return t.i;
}

void main () {
    S s = S(42);
    // compiles
    int x = s.foo!("");
    // fails to compile
    auto typ = typeid(s.foo!(""));
}

--
May 29 2019