www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15343] New: The compiler performs insufficient analysis to


          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 puremagic.com
          Reporter: petar.p.kirov 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));

Nov 16 2015