[Issue 23038] New: importC: sizeof inside struct has struct members in scope

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 19 13:35:29 UTC 2022


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

          Issue ID: 23038
           Summary: importC: sizeof inside struct has struct members in
                    scope
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at neet.fi
                CC: duser at neet.fi

char a;
struct
{
        long long a;
        char b[sizeof(a)];
        //typeof(a) c;
} s;
_Static_assert(sizeof(s.b) == sizeof(char), "1"); // fails
//_Static_assert(sizeof(s.c) == sizeof(char), "2"); // fails

dmd uses the struct field named "a", other compilers use the global

found when testing the typeof() PR (it is affected too)

--


More information about the Digitalmars-d-bugs mailing list