D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14954 - extern opaque struct instance doesn't compile
Summary: extern opaque struct instance doesn't compile
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2015-08-24 10:52 UTC by John Colvin
Modified: 2021-02-28 06:22 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 John Colvin 2015-08-24 10:52:13 UTC
Let's say I have some C headers that have code like this in:

extern struct UndeclaredStruct blah;
UndeclaredStruct *p = &blah;

which would naïvely translate to D as:

struct UndeclaredStruct;
extern(C) __gshared extern UndeclaredStruct blah;
__gshared auto p = &blah;

which doesn't compile:
Error: variable opaque.blah no definition of struct UndeclaredStruct
Comment 1 Jacob Carlborg 2018-11-01 18:40:00 UTC
I just encountered the same issue.
Comment 2 Dlang Bot 2021-02-28 03:29:38 UTC
@MoonlightSentinel created dlang/dmd pull request #12240 "Fix 14954 - extern opaque struct instance doesn't compile" fixing this issue:

- Fix 14954 - extern opaque struct instance doesn't compile
  
  Don't raise an error if the `VarDeclaration` is marked as `extern`.

https://github.com/dlang/dmd/pull/12240
Comment 3 Dlang Bot 2021-02-28 06:22:38 UTC
dlang/dmd pull request #12240 "Fix 14954 - extern opaque struct instance doesn't compile" was merged into master:

- 35cfc07be66911ffedd46fe8d9a1caca9881144d by MoonlightSentinel:
  Fix 14954 - extern opaque struct instance doesn't compile
  
  Don't raise an error if the `VarDeclaration` is marked as `extern`.

https://github.com/dlang/dmd/pull/12240