Fix detection of special reference variables

D2.072 apparently doesn't set the STCforeach storage class for each
special reference anymore. So let's consider all references which aren't
parameters, i.e., all locals with STCref, as special references.

By-ref parameters are different as we simply use the LL pointer parameter as
lvalue for the variable, no extra alloca required. Special references are
automatically dereferenced pointers and as such occupy a dedicated alloca for
the address.
This commit is contained in:
Martin 2017-02-01 22:52:43 +01:00
parent de0708e99b
commit 9d4961ae27

View file

@ -1392,7 +1392,7 @@ void callPostblit(Loc &loc, Expression *exp, LLValue *val) {
////////////////////////////////////////////////////////////////////////////////
bool isSpecialRefVar(VarDeclaration *vd) {
return (vd->storage_class & STCref) && (vd->storage_class & STCforeach);
return (vd->storage_class & (STCref | STCparameter)) == STCref;
}
////////////////////////////////////////////////////////////////////////////////