[Issue 15343] New: The compiler performs insufficient analysis to check if a structure is actually nested

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Nov 16 06:47:56 PST 2015


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: nobody at puremagic.com
          Reporter: petar.p.kirov at gmail.com

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));
}

--


More information about the Digitalmars-d-bugs mailing list