[Issue 23649] New: Incorrect alignof for struct member field

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 22 21:52:22 UTC 2023


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

          Issue ID: 23649
           Summary: Incorrect alignof for struct member field
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: johanengelen at weka.io

Testcase:
```
struct S {
    byte i;
    align(1) long member_field;
}

void foo( S* d) {
    pragma(msg, d.member_field.alignof); // prints 8UL instead of 1UL
}
```

The align(1) on `member_field` is ignored when querying .alignof.

--


More information about the Digitalmars-d-bugs mailing list