diff --git a/src/cast.c b/src/cast.c index 788f7a366974..b4b581fa5880 100644 --- a/src/cast.c +++ b/src/cast.c @@ -2934,6 +2934,12 @@ int typeMerge(Scope *sc, Expression *e, Type **pt, Expression **pe1, Expression e1 = e1->castTo(sc, t); e2 = e2->castTo(sc, t); } + else if (t1->ty == Tvector && t2->ty == Tvector) + { + // Bugzilla 13841, all vector types should have no common types between + // different vectors, even though their sizes are same. + goto Lincompatible; + } else if (t1->ty == Tvector && t2->ty != Tvector && e2->implicitConvTo(t1)) { diff --git a/test/runnable/testxmm.d b/test/runnable/testxmm.d index 68688bac350a..96cd9aa8aff2 100644 --- a/test/runnable/testxmm.d +++ b/test/runnable/testxmm.d @@ -7,6 +7,8 @@ import core.simd; import core.stdc.string; import std.stdio; +alias TypeTuple(T...) = T; + /*****************************************/ void test1() @@ -1208,6 +1210,32 @@ void test9449_2() assert(m[1][3] == 8); } +/*****************************************/ +// 13841 + +void test13841() +{ + alias Vector16s = TypeTuple!( + void16, byte16, short8, int4, long2, + ubyte16, ushort8, uint4, ulong2, float4, double2); + foreach (V1; Vector16s) + { + foreach (V2; Vector16s) + { + V1 v1 = void; + V2 v2 = void; + static if (is(V1 == V2)) + { + static assert( is(typeof(true ? v1 : v2) == V1)); + } + else + { + static assert(!is(typeof(true ? v1 : v2))); + } + } + } +} + /*****************************************/ int main()