www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12619] New: Invalid warning for unused return value of debug


          Issue ID: 12619
           Summary: Invalid warning for unused return value of debug
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

Technically this is a regression, but it's a minor one. Issue found by

void main() pure {
    import core.stdc.string: memcpy;
    ubyte[10] a, b;
    debug memcpy(a.ptr, b.ptr, 5);

DMD 2.066alpha gives:

test2.d(4,17): Warning: Call to function core.stdc.string.memcpy without side
effects discards return value of type void*, prepend a cast(void) if

memcpy is weakly pure, so I think you should not get that warning, that I think
should be only for strongly pure functions.

Apr 22 2014