[Issue 9159] Variable and function name are the same in mixin template can't be compiled

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 17 00:01:05 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9159


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2012-12-17 00:01:02 PST ---
It had not generate code that the reporter had intended.

With 2.060, this code never asserts in function p(int).

struct P {
    int v;
    this(int i) { v = i; }
}
P p(int i) {
    assert(0);
    return typeof(return)(i);
}
mixin template DefineP() {
    P p = p(10);  // [A]
}
void main() {
    mixin DefineP;
    printf("p.v = %d\n", p.v);
}

At the line [A] the declaration was wrongly treated same as `P p = P(10);` by
bug 6036. So, this *regression* won't be fixed.

However, there is more serious problem: it is an semantic order inconsistency
between in DeclDefs and function body scope. To discuss that, I've filed a new
issue 9169.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list