diff --git a/compiler/test/compilable/fix21945.d b/compiler/test/compilable/fix21945.d new file mode 100644 index 000000000000..cbd6dcb21002 --- /dev/null +++ b/compiler/test/compilable/fix21945.d @@ -0,0 +1,6 @@ +// REQUIRED_ARGS: -preview=dip1000 + +void assertEq(scope int[][3] x) @safe +{ + bool b = x == x; +} diff --git a/druntime/src/core/internal/array/equality.d b/druntime/src/core/internal/array/equality.d index e0a811bf0722..7a7dc5ceb26b 100644 --- a/druntime/src/core/internal/array/equality.d +++ b/druntime/src/core/internal/array/equality.d @@ -27,6 +27,21 @@ bool __equals(T1, T2)(scope T1[] lhs, scope T2[] rhs) @trusted return (cast(PureType)&isEqual!(T1,T2))(lhs, rhs, lhs.length); } +pragma(inline, true) +bool __equals(T1, T2, size_t N)(scope ref T1[N] lhs, scope T2[] rhs) @trusted { + return __equals(lhs[], rhs); +} + +pragma(inline, true) +bool __equals(T1, T2, size_t N)(scope T1[] lhs, scope ref T2[N] rhs) @trusted { + return __equals(lhs, rhs[]); +} + +pragma(inline, true) +bool __equals(T1, T2, size_t N, size_t M)(scope ref T1[N] lhs, scope ref T2[M] rhs) @trusted { + return __equals(lhs[], rhs[]); +} + /****************************** * Helper function for __equals(). * Outlined to enable __equals() to be inlined, as dmd cannot inline loops.