www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20909] New: .offsetof fails on forward reference of field

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

          Issue ID: 20909
           Summary: .offsetof fails on forward reference of field
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: boris2.9 gmail.com

Test case:

struct S
{
    pragma(msg, x.sizeof);   // OK
    pragma(msg, x.offsetof); // Error
    int x;
}

Output:

4LU
test.d(4): Error: no property offsetof for type int
test.d(4):        while evaluating pragma(msg, x.offsetof)

--
Jun 08 2020