[Issue 20339] New: isPOD returns true if sizeof is accessed inside struct declaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 30 20:17:52 UTC 2019


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

          Issue ID: 20339
           Summary: isPOD returns true if sizeof is accessed inside struct
                    declaration
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: sahmi.soulaimane at gmail.com

```
struct S
{
    pragma(msg, S.sizeof);

    this(this){}
    ~this(){}

    int f;
}

pragma(msg, __traits(isPOD, S));
```
output:
---
4LU
true
---

expected
---
4LU
false
---

This happening in production code which does more sophisticated things than
print sizeof at compile time. I discovered it with `std.uni.Grapheme` from
phobos see: https://run.dlang.io/is/Yy8mLt it prints true while the
`std.uni.Grapheme` defines the postblit.

--


More information about the Digitalmars-d-bugs mailing list