www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22611] New: ImportC: Need better error messages involving

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

          Issue ID: 22611
           Summary: ImportC: Need better error messages involving structs
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: lance lancebachmeier.com

C code:

typedef struct
{
   unsigned char c[4];
} stb_easy_font_color;
stb_easy_font_color c = { 255,255,255,255 }; // use structure copying to avoid
needing depending on memcpy()

DMD output:

Error: 3 extra initializer(s) for `struct __tag21`

__tag21 is generated by the compiler, so the alias stb_easy_font_color should
be reported instead.

Forum thread: https://forum.dlang.org/post/zykchnrxsfvgftfjhczu forum.dlang.org

--
Dec 19 2021