Skip to content

Commit

Permalink
Fix issue 19228 - hasAliasing fails on static arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Biotronic committed Sep 6, 2018
1 parent f03cce2 commit bcc9d57
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions std/traits.d
Expand Up @@ -2886,6 +2886,8 @@ private template hasRawAliasing(T...)
{
static if (is(T[0] foo : U*, U) && !isFunctionPointer!(T[0]))
enum has = !is(U == immutable);
else static if (is(T[0] foo : U[N], U, size_t N))
enum has = hasRawAliasing!U;
else static if (is(T[0] foo : U[], U) && !isStaticArray!(T[0]))
enum has = !is(U == immutable);
else static if (isAssociativeArray!(T[0]))
Expand Down Expand Up @@ -2918,6 +2920,16 @@ private template hasRawAliasing(T...)
static assert(!hasRawAliasing!S2);
}

// Issue 19228
@safe unittest
{
static struct C
{
int*[1] a;
}
static assert(hasRawAliasing!C);
}

@safe unittest
{
// struct with a pointer member
Expand Down

0 comments on commit bcc9d57

Please sign in to comment.