Commit 5f49d2fc by Iain Buclaw

re PR d/87824 (x86_64-linux multilib issues)

    PR d/87824
d/dmd: Merge upstream dmd fcc235e8e

Associative arrays are value types, which are not covariant with the
pointer type typeof(null).

Updates https://gcc.gnu.org/PR87824

Reviewed-on: https://github.com/dlang/dmd/pull/9435

From-SVN: r269561
parent 42a84c28
da26db81943952c7e35dab98650df589ec122485
fcc235e8e25f7758266f7874edd5abefb9943e0b
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
......@@ -5331,10 +5331,17 @@ int Type::covariant(Type *t, StorageClass *pstc, bool fix17349)
}
else if (t1n->ty == t2n->ty && t1n->implicitConvTo(t2n))
goto Lcovariant;
else if (t1n->ty == Tnull && t1n->implicitConvTo(t2n) &&
t1n->size() == t2n->size())
else if (t1n->ty == Tnull)
{
// NULL is covariant with any pointer type, but not with any
// dynamic arrays, associative arrays or delegates.
// https://issues.dlang.org/show_bug.cgi?id=8589
// https://issues.dlang.org/show_bug.cgi?id=19618
Type *t2bn = t2n->toBasetype();
if (t2bn->ty == Tnull || t2bn->ty == Tpointer || t2bn->ty == Tclass)
goto Lcovariant;
}
}
goto Lnotcovariant;
Lcovariant:
......
......@@ -127,7 +127,7 @@ void test8589()
{
void f(T function() dg) { assert(!dg()); }
static assert((T.sizeof == typeof(null).sizeof) == result);
static assert((is(typeof(null) function() : T function())) == result);
static assert(is(typeof( f(&retnull) )) == result);
static assert(is(typeof( f(()=>null) )) == result);
static if (result)
......@@ -138,7 +138,7 @@ void test8589()
}
test!(true, int*)();
test!(true, Object)();
test!(true, int[int])();
test!(false, int[int])();
test!(false, int[])();
test!(false, void delegate())();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment