Bug 15329 – __traits(isPOD, S) incorrectly returns true for structs with disabled S.init
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-13T18:14:48Z
Last change time
2022-10-13T08:19:10Z
Assigned to
No Owner
Creator
ZombineDev
Comments
Comment #0 by petar.p.kirov — 2015-11-13T18:14:48Z
struct S
{
@disable
enum init = 0;
}
static assert (!__traits(compiles, { S7 s = S7.init; }));
static assert (!is(typeof(S.init)));
static assert (__traits(isPOD, S7)); // Compiles - this is wrong
Comment #1 by razvan.nitu1305 — 2018-06-13T10:14:35Z
I assume that instead of S7 you were referring to S.
Why should it not compile? From the glossary [1] :
"POD (Plain Old Data)
Refers to a struct that contains no hidden members, does not have virtual functions, does not inherit, has no destructor, and can be initialized and copied via simple bit copies."
If I'm not missing anything, S complies with all of the above.
[1] https://dlang.org/glossary.html#pod
Comment #2 by razvan.nitu1305 — 2022-10-13T08:19:10Z