-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Closed
Copy link
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviortranslate-cC to Zig source translation feature (@cImport)C to Zig source translation feature (@cImport)
Milestone
Description
Zig Version
0.14.0-dev.577+3344ed8b8
Steps to Reproduce and Observed Behavior
static inline CFNT_s* fontGetSystemFont(void)
{
extern CFNT_s* g_sharedFont;
if (!g_sharedFont)
fontEnsureMapped();
return g_sharedFont;
}
gets translated as
pub fn fontGetSystemFont() callconv(.C) [*c]CFNT_s {
const ExternLocal_g_sharedFont = struct {
extern var g_sharedFont: [*c]CFNT_s;
};
_ = &ExternLocal_g_sharedFont;
if (!(g_sharedFont != null)) {
_ = fontEnsureMapped();
}
return ExternLocal_g_sharedFont.g_sharedFont;
}
which doesn't build:
error: use of undeclared identifier 'g_sharedFont'
if (!(g_sharedFont != null)) {
^~~~~~~~~~~~
Expected Behavior
extern var g_sharedFont: [*c]CFNT_s;
};
_ = &ExternLocal_g_sharedFont;
- if (!(g_sharedFont != null)) {
+ if (!(ExternLocal_g_sharedFont.g_sharedFont != null)) {
_ = fontEnsureMapped();
}
return ExternLocal_g_sharedFont.g_sharedFont;
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviortranslate-cC to Zig source translation feature (@cImport)C to Zig source translation feature (@cImport)