https://issues.dlang.org/show_bug.cgi?id=15343
Issue ID: 15343
Summary: The compiler performs insufficient analysis to check
if a structure is actually nested
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
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));
}
--