www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20339] New: isPOD returns true if sizeof is accessed inside

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 puremagic.com
          Reporter: sahmi.soulaimane 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.

--
Oct 30 2019