From 1f5b7d6759b51b967b52b1d2bdbfa013ff4f9ac0 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Thu, 30 Dec 2010 14:04:40 +0300 Subject: [PATCH] Fixed casting of a static array to a pointer type. --- dmd2/cast.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dmd2/cast.c b/dmd2/cast.c index c8ab56a6..f973f003 100644 --- a/dmd2/cast.c +++ b/dmd2/cast.c @@ -784,6 +784,7 @@ Expression *Expression::castTo(Scope *sc, Type *t) Type *typeb = type->toBasetype(); if (tb != typeb) { +#if !IN_LLVM // Do (type *) cast of (type [dim]) if (tb->ty == Tpointer && typeb->ty == Tsarray @@ -796,15 +797,17 @@ Expression *Expression::castTo(Scope *sc, Type *t) else e = new AddrExp(loc, e); } + else +#endif #if 0 - else if (tb->ty == Tdelegate && type->ty != Tdelegate) + if (tb->ty == Tdelegate && type->ty != Tdelegate) { TypeDelegate *td = (TypeDelegate *)tb; TypeFunction *tf = (TypeFunction *)td->nextOf(); return toDelegate(sc, tf->nextOf()); } -#endif else +#endif { if (typeb->ty == Tstruct) { TypeStruct *ts = (TypeStruct *)typeb;