[Issue 22607] New: ImportC misses some float values ending with f

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 18 22:22:40 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22607

          Issue ID: 22607
           Summary: ImportC misses some float values ending with f
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: lance at lancebachmeier.com

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.

--


More information about the Digitalmars-d-bugs mailing list