Thread overview
[Issue 4514] New: Regression: Cannot cast from X* to X
Jul 27, 2010
Leandro Lucarella
Jul 27, 2010
Stewart Gordon
Jul 27, 2010
Trass3r
Jul 27, 2010
Leandro Lucarella
Jul 27, 2010
Stewart Gordon
Jul 30, 2010
Walter Bright
Jul 30, 2010
Walter Bright
Jul 30, 2010
Leandro Lucarella
July 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4514

           Summary: Regression: Cannot cast from X* to X
           Product: D
           Version: D1
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: llucax@gmail.com


--- Comment #0 from Leandro Lucarella <llucax@gmail.com> 2010-07-26 20:23:23 PDT ---
This worked in svn r584 (add -m32 switch):

---

void g(void delegate(void*, void*) d);

struct X {
    void f(void*, void*) {}
    void n()
    {
        g(&f); // line 8
    }
}

---

But it breaks on posterior revisions. Well, r585 to r587 don't compile/link (I mean the compiler, not the test program); r588 and r589 compiles (the compiler), but the test doesn't compile anymore, with this error:

t.d(8): Error: cannot cast from X* to X

Maybe some bits of D2 (struct this being a reference?) has been accidentally
"ported" to D1.

I didn't tested with D2, though.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4514


Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |smjg@iname.com


--- Comment #1 from Stewart Gordon <smjg@iname.com> 2010-07-27 09:36:25 PDT ---
Since "this" doesn't appear in the code, I'd doubt that that's the cause.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4514


Trass3r <mrmocool@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrmocool@gmx.de


--- Comment #2 from Trass3r <mrmocool@gmx.de> 2010-07-27 10:33:32 PDT ---
Compiles fine with r589 D2.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4514



--- Comment #3 from Leandro Lucarella <llucax@gmail.com> 2010-07-27 11:04:29 PDT ---
(In reply to comment #1)
> Since "this" doesn't appear in the code, I'd doubt that that's the cause.

I don't know how the compiler internals deals with this, but the error appears in a method, taking the address/delegate of other method, so "this" exists, even if implicit. And D2 works, which is consisten with this theory.

But again, I'm just talking out of ignorance because I don't know the compiler internals, it was just a hint.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4514



--- Comment #4 from Stewart Gordon <smjg@iname.com> 2010-07-27 11:30:20 PDT ---
I was going on the assumption that the _internal concept_ of "this" is the same in D1 and D2, and the difference is merely what the _keyword_ "this" means between the two versions.

But you could well ask what obscure thought process the compiler is going through....

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 30, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4514


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2010-07-29 17:01:46 PDT ---
The fix for 3706 caused this regression.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 30, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4514


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2010-07-29 22:17:14 PDT ---
http://www.dsource.org/projects/dmd/changeset/590

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 30, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4514



--- Comment #7 from Leandro Lucarella <llucax@gmail.com> 2010-07-30 07:40:46 PDT ---
(In reply to comment #6)
> http://www.dsource.org/projects/dmd/changeset/590

Thanks, r590 works fine for me.

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