@@ -3183,19 +3183,19 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
3183
3183
else
3184
3184
{
3185
3185
Type texp = ws.exp.type;
3186
- Type t = texp.toBasetype();
3186
+ if (! texp)
3187
+ {
3188
+ error(ws.loc, " Expression has no type." );
3189
+ return setError ();
3190
+ }
3187
3191
3188
- Expression olde = ws.exp ;
3189
- if (t.ty == Tpointer )
3192
+ Type t = texp.toBasetype() ;
3193
+ if (! t )
3190
3194
{
3191
- ws.exp = new PtrExp(ws.loc, ws.exp);
3192
- ws.exp = ws.exp.expressionSemantic(sc);
3193
- texp = ws.exp.type;
3194
- t = texp.toBasetype();
3195
+ error(ws.loc, " Unable to resolve base type." );
3196
+ return setError ();
3195
3197
}
3196
3198
3197
- assert (t);
3198
- t = t.toBasetype();
3199
3199
if (t.isClassHandle())
3200
3200
{
3201
3201
_init = new ExpInitializer(ws.loc, ws.exp);
@@ -3234,8 +3234,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
3234
3234
ws.wthis.storage_class |= STC .temp;
3235
3235
ws.wthis.dsymbolSemantic(sc);
3236
3236
sym = new WithScopeSymbol(ws);
3237
- // Need to set the scope to make use of resolveAliasThis
3238
- sym.setScope(sc);
3237
+ sym.setScope(sc); // Enable resolveAliasThis
3239
3238
sym.parent = sc.scopesym;
3240
3239
sym.endlinnum = ws.endloc.linnum;
3241
3240
}
@@ -3248,7 +3247,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
3248
3247
}
3249
3248
else
3250
3249
{
3251
- error(ws.loc, " `with` expression types must be enums or aggregates or pointers to them , not `%s`" , olde.type .toChars());
3250
+ error(ws.loc, " `with` expression types must be enums, structs, or classes , not `%s`" , t .toChars());
3252
3251
return setError ();
3253
3252
}
3254
3253
}
0 commit comments