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: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Denis Shelomovskij <[email protected]> 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: -------

Reply via email to