Bug 22607 – ImportC misses some float values ending with f

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-12-18T22:22:40Z
Last change time
2022-02-03T20:26:33Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
Lance Bachmeier

Comments

Comment #0 by lance — 2021-12-18T22:22:40Z
This code (taken from stb_easy_font.h) fails to compile: for (j=0; j < 4; ++j) { * (float *) (vbuf+offset+0) = x + (j==1 || j==2 ? (vertical ? 1 : len) : 0); * (float *) (vbuf+offset+4) = y0 + ( j >= 2 ? (vertical ? len : 1) : 0); * (float *) (vbuf+offset+8) = 0.f; * (stb_easy_font_color *) (vbuf+offset+12) = c; offset += 16; } Error: `f` is not a member of `int` 0.f wouldn't work in D, but 0.f apparently compiles with C. Even if there's some reason this shouldn't compile, the error message doesn't make sense for C code.
Comment #1 by bugzilla — 2022-02-02T09:59:43Z
Minimal test case: float x = 0.f;
Comment #2 by dlang-bot — 2022-02-03T05:19:26Z
@WalterBright created dlang/dmd pull request #13605 "fix Issue 22607 - ImportC misses some float values ending with f" fixing this issue: - fix Issue 22607 - ImportC misses some float values ending with f https://github.com/dlang/dmd/pull/13605