Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
1366:81121ac19f61 | 1367:8026319762be |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | 2 // Compiler implementation of the D programming language |
3 // Copyright (c) 1999-2008 by Digital Mars | 3 // Copyright (c) 1999-2009 by Digital Mars |
4 // All Rights Reserved | 4 // All Rights Reserved |
5 // written by Walter Bright | 5 // written by Walter Bright |
6 // http://www.digitalmars.com | 6 // http://www.digitalmars.com |
7 // License for redistribution is by either the Artistic License | 7 // License for redistribution is by either the Artistic License |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | 8 // in artistic.txt, or the GNU General Public License in gnu.txt. |
566 Type *ExpInitializer::inferType(Scope *sc) | 566 Type *ExpInitializer::inferType(Scope *sc) |
567 { | 567 { |
568 //printf("ExpInitializer::inferType() %s\n", toChars()); | 568 //printf("ExpInitializer::inferType() %s\n", toChars()); |
569 exp = exp->semantic(sc); | 569 exp = exp->semantic(sc); |
570 exp = resolveProperties(sc, exp); | 570 exp = resolveProperties(sc, exp); |
571 return exp->type; | 571 |
572 #if DMDV2 | |
573 // Give error for overloaded function addresses | |
574 if (exp->op == TOKsymoff) | |
575 { SymOffExp *se = (SymOffExp *)exp; | |
576 if (se->hasOverloads && !se->var->isFuncDeclaration()->isUnique()) | |
577 exp->error("cannot infer type from overloaded function symbol %s", exp->toChars()); | |
578 } | |
579 #endif | |
580 | |
581 Type *t = exp->type; | |
582 if (!t) | |
583 t = Initializer::inferType(sc); | |
584 return t; | |
572 } | 585 } |
573 | 586 |
574 Expression *ExpInitializer::toExpression() | 587 Expression *ExpInitializer::toExpression() |
575 { | 588 { |
576 return exp; | 589 return exp; |