[Issue 19918] New: UFCS doesn't work in typeid expressions for functions with alias template parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 29 08:19:28 UTC 2019


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 at puremagic.com
          Reporter: johannes.riecken at 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!(""));
}

--


More information about the Digitalmars-d-bugs mailing list