Bug 14954 – extern opaque struct instance doesn't compile

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-24T10:52:13Z
Last change time
2021-02-28T06:22:38Z
Keywords
pull
Assigned to
No Owner
Creator
John Colvin

Comments

Comment #0 by john.loughran.colvin — 2015-08-24T10:52:13Z
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 by doob — 2018-11-01T18:40:00Z
I just encountered the same issue.
Comment #2 by dlang-bot — 2021-02-28T03:29:38Z
@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 by dlang-bot — 2021-02-28T06:22:38Z
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