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
I just encountered the same issue.
@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
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