www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23038] New: importC: sizeof inside struct has struct members

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 puremagic.com
          Reporter: duser neet.fi
                CC: duser 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)

--
Apr 19 2022