September 10, 2013 [Issue 11006] New: Subtraction of pinters for `void` and non-void types compiles | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=11006 Summary: Subtraction of pinters for `void` and non-void types compiles Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid Severity: major Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: verylonglogin.reg@gmail.com --- Comment #0 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2013-09-10 12:00:57 MSD --- According to docs: "For -, the pointers are subtracted and the result is divided by the size of the type pointed to by the operands. It is an error if the pointers point to different types." Both passes (giving unexpected results) but should reject to compile: --- static assert(cast(void*) 8 - cast(int*) 0 == 2); static assert(cast(int*) 8 - cast(void*) 0 == 8); --- Looks like a high danger for generic code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 10, 2013 [Issue 11006] Subtraction of pointers for `void` and non-void types compiles | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=11006 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com Summary|Subtraction of pinters for |Subtraction of pointers for |`void` and non-void types |`void` and non-void types |compiles |compiles --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-10 13:38:29 PDT --- Fixed typo. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation