D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2627 - std.traits.hasAliasing reports true for static arrays
Summary: std.traits.hasAliasing reports true for static arrays
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: Andrei Alexandrescu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-27 22:15 UTC by Bill Baxter
Modified: 2015-06-09 01:21 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Bill Baxter 2009-01-27 22:15:01 UTC
"hasAliasing" reports true even for static arrays.

struct X { float[3] vals; }
pragma(msg, hasAliasing!(X)?"true":"false"); --> true

---
One fix would be to change this (around line 342):
        else static if (is(T[0] foo : U[], U))
            enum hasRawAliasing = !is(U == invariant);

To this:
        else static if (is(T[0] foo : U[], U))
            enum hasRawAliasing = !is(U == invariant) && (!isStaticArray!(T[0]) || hasRawPointerImpl!(U).result);
Comment 1 David Simcha 2010-06-30 20:28:04 UTC
Fixed SVN.