comparison dmd/cast.c @ 1358:78038e540342

Fix overload resolution issue in dmd bug 313/314 fix.
author Christian Kamm <kamm incasoftware de>
date Sat, 16 May 2009 12:17:33 +0200
parents e961851fb8be
children 8026319762be
comparison
equal deleted inserted replaced
1357:48747003a5de 1358:78038e540342
521 t->ty == Tpointer && t->next->ty == Tfunction && 521 t->ty == Tpointer && t->next->ty == Tfunction &&
522 e1->op == TOKvar) 522 e1->op == TOKvar)
523 { 523 {
524 ve = (VarExp *)e1; 524 ve = (VarExp *)e1;
525 f = ve->var->isFuncDeclaration(); 525 f = ve->var->isFuncDeclaration();
526 if (f && f->overloadExactMatch(t->next)) 526 if (f && f->overloadExactMatch(t->next, m))
527 result = MATCHexact; 527 result = MATCHexact;
528 } 528 }
529 } 529 }
530 //printf("\tresult = %d\n", result); 530 //printf("\tresult = %d\n", result);
531 return result; 531 return result;
550 t = t->toBasetype(); 550 t = t->toBasetype();
551 if (type->ty == Tpointer && type->next->ty == Tfunction && 551 if (type->ty == Tpointer && type->next->ty == Tfunction &&
552 t->ty == Tpointer && t->next->ty == Tfunction) 552 t->ty == Tpointer && t->next->ty == Tfunction)
553 { 553 {
554 f = var->isFuncDeclaration(); 554 f = var->isFuncDeclaration();
555 if (f && f->overloadExactMatch(t->next)) 555 if (f && f->overloadExactMatch(t->next, m))
556 result = MATCHexact; 556 result = MATCHexact;
557 } 557 }
558 } 558 }
559 //printf("\tresult = %d\n", result); 559 //printf("\tresult = %d\n", result);
560 return result; 560 return result;
577 577
578 t = t->toBasetype(); 578 t = t->toBasetype();
579 if (type->ty == Tdelegate && type->nextOf()->ty == Tfunction && 579 if (type->ty == Tdelegate && type->nextOf()->ty == Tfunction &&
580 t->ty == Tdelegate && t->nextOf()->ty == Tfunction) 580 t->ty == Tdelegate && t->nextOf()->ty == Tfunction)
581 { 581 {
582 if (func && func->overloadExactMatch(t->nextOf())) 582 if (func && func->overloadExactMatch(t->nextOf(), m))
583 result = MATCHexact; 583 result = MATCHexact;
584 } 584 }
585 } 585 }
586 return result; 586 return result;
587 } 587 }
973 { 973 {
974 ve = (VarExp *)e1; 974 ve = (VarExp *)e1;
975 f = ve->var->isFuncDeclaration(); 975 f = ve->var->isFuncDeclaration();
976 if (f) 976 if (f)
977 { 977 {
978 f = f->overloadExactMatch(tb->next); 978 f = f->overloadExactMatch(tb->next, m);
979 if (f) 979 if (f)
980 { 980 {
981 e = new VarExp(loc, f); 981 e = new VarExp(loc, f);
982 e->type = f->type; 982 e->type = f->type;
983 e = new AddrExp(loc, e); 983 e = new AddrExp(loc, e);
1097 tb->ty == Tpointer && tb->next->ty == Tfunction) 1097 tb->ty == Tpointer && tb->next->ty == Tfunction)
1098 { 1098 {
1099 f = var->isFuncDeclaration(); 1099 f = var->isFuncDeclaration();
1100 if (f) 1100 if (f)
1101 { 1101 {
1102 f = f->overloadExactMatch(tb->next); 1102 f = f->overloadExactMatch(tb->next, m);
1103 if (f) 1103 if (f)
1104 { 1104 {
1105 e = new SymOffExp(loc, f, 0); 1105 e = new SymOffExp(loc, f, 0);
1106 e->type = t; 1106 e->type = t;
1107 return e; 1107 return e;
1134 if (type->ty == Tdelegate && type->next->ty == Tfunction && 1134 if (type->ty == Tdelegate && type->next->ty == Tfunction &&
1135 tb->ty == Tdelegate && tb->next->ty == Tfunction) 1135 tb->ty == Tdelegate && tb->next->ty == Tfunction)
1136 { 1136 {
1137 if (func) 1137 if (func)
1138 { 1138 {
1139 f = func->overloadExactMatch(tb->next); 1139 f = func->overloadExactMatch(tb->next, m);
1140 if (f) 1140 if (f)
1141 { int offset; 1141 { int offset;
1142 if (f->tintro && f->tintro->next->isBaseOf(f->type->next, &offset) && offset) 1142 if (f->tintro && f->tintro->next->isBaseOf(f->type->next, &offset) && offset)
1143 error("%s", msg); 1143 error("%s", msg);
1144 e = new DelegateExp(loc, e1, f); 1144 e = new DelegateExp(loc, e1, f);