Mercurial > projects > ldc
diff dmd/interpret.c @ 1367:8026319762be
Merged DMD 1.045 !!!
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Sat, 16 May 2009 22:21:31 +0200 |
parents | 7c6dcb98ac35 |
children | def7a1d494fd |
line wrap: on
line diff
--- a/dmd/interpret.c Sat May 16 18:37:16 2009 +0200 +++ b/dmd/interpret.c Sat May 16 22:21:31 2009 +0200 @@ -69,7 +69,7 @@ else if (ident == Id::aaValues) return interpret_aaValues(istate, arguments); - if (cantInterpret || semanticRun == 1) + if (cantInterpret || semanticRun == 3) return NULL; if (needThis() || isNested() || !fbody) @@ -77,13 +77,13 @@ return NULL; } - if (semanticRun == 0 && scope) + if (semanticRun < 3 && scope) { semantic3(scope); if (global.errors) // if errors compiling this function return NULL; } - if (semanticRun < 2) + if (semanticRun < 4) return NULL; Type *tb = type->toBasetype(); @@ -1525,6 +1525,15 @@ { error("variable %s is used before initialization", v->toChars()); return e; } + if (v->value == NULL && v->init->isVoidInitializer()) + { /* Since a void initializer initializes to undefined + * values, it is valid here to use the default initializer. + * No attempt is made to determine if someone actually relies + * on the void value - to do that we'd need a VoidExp. + * That's probably a good enhancement idea. + */ + v->value = v->type->defaultInit(); + } Expression *vie = v->value; if (vie->op == TOKvar) {