[Issue 17654] return value incorrectly considered unique when casting to another pointer type

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jul 15 07:48:36 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17654

--- Comment #4 from ag0aep6g at gmail.com ---
(In reply to Steven Schveighoffer from comment #3)
> I'm not sure the UB rules for D and aliasing. In C you definitely can run
> into things like the array cast being considered unrelated. 

As far as I know, C's strict aliasing rule isn't exactly uncontroversial.
Personally, I think it's an abomination.

> The class case is definitely a bug.

Even with the strict aliasing rule, there is a type that is allowed to alias
others. In C it's char. That would be ubyte in D, I guess. The non-class
examples all involve ubyte. So even with C-like strict aliasing, they should be
rejected.

--


More information about the Digitalmars-d-bugs mailing list