| 3945 | 3945 | type = type->semantic(loc, sc); |
|---|
| 3946 | 3946 | } |
|---|
| 3947 | 3947 | #endif |
|---|
| 3948 | 3948 | } |
|---|
| 3949 | 3949 | |
|---|
| 3950 | 3950 | if (type && !type->deco) |
|---|
| 3951 | 3951 | type = type->semantic(loc, sc); |
|---|
| 3952 | 3952 | |
|---|
| 3953 | 3953 | /* Fix for 1161 doesn't work because it causes protection |
|---|
| 3954 | 3954 | * problems when instantiating imported templates passing private |
|---|
| 3955 | 3955 | * variables as alias template parameters. |
|---|
| 3956 | 3956 | */ |
|---|
| 3957 | 3957 | //accessCheck(loc, sc, NULL, var); |
|---|
| 3958 | 3958 | |
|---|
| 3959 | 3959 | VarDeclaration *v = var->isVarDeclaration(); |
|---|
| 3960 | 3960 | if (v) |
|---|
| 3961 | 3961 | { |
|---|
| 3962 | 3962 | if (v->isConst() && v->type && type->toBasetype()->ty != Tsarray && v->init) |
|---|
| 3963 | 3963 | { |
|---|
| 3964 | 3964 | ExpInitializer *ei = v->init->isExpInitializer(); |
|---|
| 3966 | 3966 | { |
|---|
| 3967 | 3967 | //ei->exp->implicitCastTo(sc, type)->print(); |
|---|
| 3968 | 3968 | return ei->exp->implicitCastTo(sc, type); |
|---|
| 3969 | 3969 | } |
|---|
| 3970 | 3970 | } |
|---|
| 3971 | 3971 | v->checkNestedReference(sc, loc); |
|---|
| 3972 | 3972 | #if DMDV2 |
|---|
| 3973 | 3973 | if (sc->func && sc->func->isPure() && !sc->intypeof) |
|---|
| 3974 | 3974 | { |
|---|
| 3975 | 3975 | if (v->isDataseg() && !v->isImmutable()) |
|---|
| 3976 | 3976 | error("pure function '%s' cannot access mutable static data '%s'", sc->func->toChars(), v->toChars()); |
|---|
| 3977 | 3977 | } |
|---|
| 3978 | 3978 | #endif |
|---|
| 3979 | 3979 | } |
|---|
| 3980 | 3980 | #if 0 |
|---|
| 3981 | 3981 | else if ((fd = var->isFuncLiteralDeclaration()) != NULL) |
|---|
| 3982 | 3982 | { Expression *e; |
|---|
| 3983 | 3983 | e = new FuncExp(loc, fd); |
|---|
| 3984 | 3984 | e->type = type; |
|---|
| 3985 | 3985 | return e; |
|---|