www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19181] New: Semantic errors in opDispatch argument lead to

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

          Issue ID: 19181
           Summary: Semantic errors in opDispatch argument lead to "no
                    property X"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

$ dmd test.d
test.d(9): Error: no property foo for type S
---
module test;

struct S {
    void opDispatch(string name, T)(T arg) { }
}

void main() {
    S s;
    s.foo(LanguageError);
}
---


Note that as compared to Issue 14145, the problem here is that the *call* to
opDispatch doesn't even compile, which should surely error on its own. There is
no way that opDispatch can be written that makes this code valid.

--
Aug 19 2018