Fixed casting of a static array to a pointer type.

This commit is contained in:
Alexey Prokhin
2010-12-30 14:04:40 +03:00
parent 9aad1ca6d1
commit 1f5b7d6759

View File

@@ -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;