Mercurial > projects > ldc
diff dmd/init.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 | eeb8b95ea92e |
children | def7a1d494fd |
line wrap: on
line diff
--- a/dmd/init.c Sat May 16 18:37:16 2009 +0200 +++ b/dmd/init.c Sat May 16 22:21:31 2009 +0200 @@ -1,6 +1,6 @@ // Compiler implementation of the D programming language -// Copyright (c) 1999-2008 by Digital Mars +// Copyright (c) 1999-2009 by Digital Mars // All Rights Reserved // written by Walter Bright // http://www.digitalmars.com @@ -568,7 +568,20 @@ //printf("ExpInitializer::inferType() %s\n", toChars()); exp = exp->semantic(sc); exp = resolveProperties(sc, exp); - return exp->type; + +#if DMDV2 + // Give error for overloaded function addresses + if (exp->op == TOKsymoff) + { SymOffExp *se = (SymOffExp *)exp; + if (se->hasOverloads && !se->var->isFuncDeclaration()->isUnique()) + exp->error("cannot infer type from overloaded function symbol %s", exp->toChars()); + } +#endif + + Type *t = exp->type; + if (!t) + t = Initializer::inferType(sc); + return t; } Expression *ExpInitializer::toExpression()