D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10497 - Opaque structs cannot be dereferenced in pointer to pointer types
Summary: Opaque structs cannot be dereferenced in pointer to pointer types
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2013-06-28 11:06 UTC by Andrej Mitrovic
Modified: 2015-06-09 05:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2013-06-28 11:06:51 UTC
-----
module test;

// opaque type
struct S;

void main()
{
    S** s;
    void* ptr;
    *s = cast(S*)ptr;  // pointer assignment, not value assignment
}
-----

$ dmd test.d
> test.d(4): Error: struct test.S unknown size
> test.d(4): Error: struct test.S no size yet for forward reference
> test.d(4): Error: struct test.S unknown size
> test.d(4): Error: struct test.S no size yet for forward reference

The size of the structure does not need to be known since what is being assigned is a memory address. It is not a value assign of the struct.
Comment 1 github-bugzilla 2013-08-17 23:06:44 UTC
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