mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-07-22 15:15:22 +02:00
Fixed CastExp::checkEscape()
This commit is contained in:
@@ -8014,6 +8014,21 @@ int CastExp::checkSideEffect(int flag)
|
|||||||
|
|
||||||
void CastExp::checkEscape()
|
void CastExp::checkEscape()
|
||||||
{ Type *tb = type->toBasetype();
|
{ Type *tb = type->toBasetype();
|
||||||
|
|
||||||
|
#if IN_LLVM
|
||||||
|
if (e1->op == TOKvar &&
|
||||||
|
tb->ty == Tpointer &&
|
||||||
|
e1->type->toBasetype()->ty == Tsarray)
|
||||||
|
{
|
||||||
|
VarDeclaration *v = ((VarExp*)e1)->var->isVarDeclaration();
|
||||||
|
if (v)
|
||||||
|
{
|
||||||
|
if (!v->isDataseg() && !(v->storage_class & (STCref | STCout)))
|
||||||
|
error("escaping reference to local variable %s", v->toChars());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (tb->ty == Tarray && e1->op == TOKvar &&
|
if (tb->ty == Tarray && e1->op == TOKvar &&
|
||||||
e1->type->toBasetype()->ty == Tsarray)
|
e1->type->toBasetype()->ty == Tsarray)
|
||||||
{ VarExp *ve = (VarExp *)e1;
|
{ VarExp *ve = (VarExp *)e1;
|
||||||
|
|||||||
Reference in New Issue
Block a user