Bug 15343 – The compiler performs insufficient analysis to check if a structure is actually nested
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-16T14:47:56Z
Last change time
2019-05-20T06:23:52Z
Assigned to
No Owner
Creator
ZombineDev
Comments
Comment #0 by petar.p.kirov — 2015-11-16T14:47:56Z
A structure should be considered nested and non-POD only if it actually needs a context pointer. Currently this not the case:
import std.traits : isNested;
void main()
{
struct S1
{
int x;
}
struct S2
{
int x;
void methodThatDoesntRequireContextPointer() { }
}
static assert (!isNested!S1);
static assert (__traits(isPOD, S1));
static assert (isNested!S2);
static assert (!__traits(isPOD, S2));
}
Comment #1 by simen.kjaras — 2019-05-20T06:23:52Z
*** This issue has been marked as a duplicate of issue 10276 ***