www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - isPOD is broken?

reply Oleg B <code.viator gmail.com> writes:
Hi all!

class Foo
{
     private int val;

     this(int v) { val = v; }
     int vv() { return val*2; }
     ~this() { }
}

class Bar : Foo
{
     this(int v) { super(v); }
     override int vv() { return val*3; }
}

pragma(msg, __traits(isPOD, Foo));
pragma(msg, __traits(isPOD, Bar));

prints

true
true


example1
https://run.dlang.io/is/Fvru18

example2
https://run.dlang.io/is/GrXdGy

May be POD is not what I mean? Bad docs? 
https://dlang.org/glossary.html#pod
Mar 26 2021
parent reply kinke <noone nowhere.com> writes:
A class *reference* is always a POD. Only structs can be non-PODs.
Mar 26 2021
parent Oleg B <code.viator gmail.com> writes:
On Friday, 26 March 2021 at 12:13:29 UTC, kinke wrote:
 A class *reference* is always a POD. Only structs can be 
 non-PODs.
In this case what means "does not have virtual functions, does not inherit"? Structs doesn't have virtual methods and they can't inherits.
Mar 27 2021