[Issue 6400] opDispatch with WithStatement

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jul 17 23:30:19 PDT 2015


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

Philpax <me at philpax.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |me at philpax.me

--- Comment #3 from Philpax <me at philpax.me> ---
Just ran into this issue. From a cursory look at DMD's source code, I noticed
that WithStatement::semantic was adding the symbol's scope before calling
body->semantic, which means WithStatement has the same scoping rules as a
method.

This means that the problem is that opDispatch doesn't work in symbol scope:
----------------
struct A
{
    void opDispatch(string Value)()
    {
        pragma(msg, Value);
    }

    void test()
    {
        // works
        this.hello;
        // NG
        hello;
    }
}
----------------
I'm unsure as to whether this is intended behaviour or not, but resolving the
opDispatch scope issue would also resolve this issue.

--


More information about the Digitalmars-d-bugs mailing list