Bug 12619 – Invalid warning for unused return value of debug memcpy
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-22T22:24:00Z
Last change time
2014-05-02T22:22:36Z
Keywords
diagnostic, pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2014-04-22T22:24:46Z
Technically this is a regression, but it's a minor one. Issue found by CyberShadow:
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 intentional
memcpy is weakly pure, so I think you should not get that warning, that I think should be only for strongly pure functions.