Thread overview
[Issue 10793] New: Forward reference errors casting from void* to opaque struct pointer
Aug 11, 2013
Mike Parker
Aug 11, 2013
Andrej Mitrovic
Aug 11, 2013
Henning Pohl
Aug 11, 2013
Andrej Mitrovic
Aug 11, 2013
Henning Pohl
Aug 12, 2013
Andrej Mitrovic
Aug 12, 2013
Mike Parker
Aug 12, 2013
Henning Pohl
Aug 18, 2013
Henning Pohl
August 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10793

           Summary: Forward reference errors casting from void* to opaque
                    struct pointer
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: aldacron@gmail.com


--- Comment #0 from Mike Parker <aldacron@gmail.com> 2013-08-11 07:31:53 PDT ---
module forrref;

struct RealFoo {
    int i;
}

struct foo;

void main() {
    auto rf = RealFoo( 10 );
    void* prf = cast( void* )rf;
    foo* f = cast( foo* )prf;
}

forref.d(7): Error: struct forrref.foo unknown size
forref.d(7): Error: struct forrref.foo no size yet for forward reference
forref.d(7): Error: struct forrref.foo unknown size
forref.d(7): Error: struct forrref.foo no size yet for forward reference

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10793


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-08-11 08:27:30 PDT ---
Similar or dupe of Issue 10497.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10793


Henning Pohl <henning@still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |henning@still-hidden.de


--- Comment #2 from Henning Pohl <henning@still-hidden.de> 2013-08-11 11:21:17 PDT ---
I cannot reproduce either this or 10497 using git head.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10793



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-08-11 11:35:34 PDT ---
(In reply to comment #2)
> I cannot reproduce either this or 10497 using git head.

I can reproduce this test-case in git-head (b55f805133f9d249890ddf6b98270ca826b3e26b) but with only one error now:

test.d(11): Error: e2ir: cannot cast rf of type RealFoo to type void*

I can fully reproduce both issues with 2.063.

However I can no longer reproduce Issue 10497 in git-head. I suggest we add a test-case for 10497 before that bug is reintroduced. As for this Issue 10793, could you test it with git-head again?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10793



--- Comment #4 from Henning Pohl <henning@still-hidden.de> 2013-08-11 15:45:56 PDT ---
He just missed a 'new' before RealFoo, I guess.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10793



--- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-08-11 22:57:49 PDT ---
(In reply to comment #4)
> He just missed a 'new' before RealFoo, I guess.

Ah my bad, yes. Do you want to add these test-cases or should I? Let's not let them creep in again. :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10793



--- Comment #6 from Mike Parker <aldacron@gmail.com> 2013-08-12 00:42:08 PDT ---
(In reply to comment #4)
> He just missed a 'new' before RealFoo, I guess.

Actually, I missed an '&'!

void* prf = cast( void* )rf;

But new works, too!

Given that this works with git head, I wonder about bug 10451.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10793


Henning Pohl <henning@still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #7 from Henning Pohl <henning@still-hidden.de> 2013-08-12 04:21:57 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2466

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10793



--- Comment #8 from github-bugzilla@puremagic.com 2013-08-17 23:06:48 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e4ba50055c42f4b0dc67369dfcffd8a1526c7821 add test cases for issues 10497 and 10793

https://github.com/D-Programming-Language/dmd/commit/7a3dd014165c3710ffc4ed9f375d962be7516152 Merge pull request #2466 from hpohl/10793

add test cases for issues 10497 and 10793

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10793


Henning Pohl <henning@still-hidden.de> changed:

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


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