Thread overview
[Issue 6479] New: spurious alias this with struct and mixin template
Aug 12, 2011
Trass3r
Aug 12, 2011
Trass3r
Oct 23, 2011
Kenji Hara
Oct 23, 2011
Kenji Hara
Nov 11, 2011
Trass3r
Nov 15, 2011
Walter Bright
August 12, 2011
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


--- Comment #0 from Trass3r <mrmocool@gmx.de> 2011-08-12 12:22:30 PDT ---
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: -------
August 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6479



--- Comment #1 from Trass3r <mrmocool@gmx.de> 2011-08-12 12:26:12 PDT ---
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: -------
October 23, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6479



--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2011-10-23 04:58:07 PDT ---
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: -------
October 23, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6479


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

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


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-10-23 07:01:08 PDT ---
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: -------
November 11, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6479



--- Comment #5 from Trass3r <mrmocool@gmx.de> 2011-11-11 09:12:29 PST ---
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: -------
November 15, 2011
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


--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2011-11-15 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: -------