www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6479] New: spurious alias this with struct and mixin template

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6479

           Summary: spurious alias this with struct and mixin template
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: mrmocool gmx.de



struct Memory
{
    mixin Wrapper!();
}
struct Image
{
    Memory sup;
    alias sup this;
}
mixin template Wrapper()
{
}

$ dmd -c test.d 
DMD v2.054 DEBUG
test.d(8): Error: alias this there can be only one alias this

As soon as the template precedes Image, it works.
In my real code this is all spread among different modules, so it also is an
order of compilation dependent issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 12 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6479




Well, forget the last half sentence ;)
btw, I probably would never have figured this out without DustMite :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 12 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6479




This is a bug related to forward reference.

struct Memory
{
    mixin Wrapper!();
}
//mixin template Wrapper() {}  // OK
struct Image
{
    Memory sup;
    alias sup this;
}
mixin template Wrapper() {}  // NG

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 23 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6479


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch



https://github.com/D-Programming-Language/dmd/pull/471

This patch does not solve forward reference order problem, and has an issue.

struct S
{
    int value;
    alias value this;
    alias value this;  // alias this forwards to same symbol is allowed
}

But I think this is acceptable issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 23 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6479




btw, now it tells
Error: alias this test.Image.__anonymous there can be only one alias this

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 11 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6479


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



12:08:30 PST ---
https://github.com/D-Programming-Language/dmd/commit/b63f4f4d3db0cf421ea7b266e232967fb20fb1c1

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