| 409 | 409 | return Expression::implicitConvTo(t); |
|---|
| 410 | 410 | } |
|---|
| 411 | 411 | |
|---|
| 412 | 412 | #if DMDV2 |
|---|
| 413 | 413 | MATCH StructLiteralExp::implicitConvTo(Type *t) |
|---|
| 414 | 414 | { |
|---|
| 415 | 415 | #if 0 |
|---|
| 416 | 416 | printf("StructLiteralExp::implicitConvTo(this=%s, type=%s, t=%s)\n", |
|---|
| 417 | 417 | toChars(), type->toChars(), t->toChars()); |
|---|
| 418 | 418 | #endif |
|---|
| 419 | 419 | MATCH m = Expression::implicitConvTo(t); |
|---|
| 420 | 420 | if (m != MATCHnomatch) |
|---|
| 421 | 421 | return m; |
|---|
| 422 | 422 | if (type->ty == t->ty && type->ty == Tstruct && |
|---|
| 423 | 423 | ((TypeStruct *)type)->sym == ((TypeStruct *)t)->sym) |
|---|
| 424 | 424 | { |
|---|
| 425 | 425 | m = MATCHconst; |
|---|
| 426 | 426 | for (int i = 0; i < elements->dim; i++) |
|---|
| 427 | 427 | { Expression *e = (Expression *)elements->data[i]; |
|---|
| 428 | 428 | Type *te = e->type; |
|---|
| 435 | 430 | MATCH m2 = e->implicitConvTo(te); |
|---|
| 436 | 431 | //printf("\t%s => %s, match = %d\n", e->toChars(), te->toChars(), m2); |
|---|
| 437 | 432 | if (m2 < m) |
|---|
| 438 | 433 | m = m2; |
|---|
| 439 | 434 | } |
|---|
| 440 | 435 | } |
|---|
| 441 | 436 | return m; |
|---|
| 442 | 437 | } |
|---|
| 443 | 438 | #endif |
|---|
| 444 | 439 | |
|---|
| 445 | 440 | MATCH StringExp::implicitConvTo(Type *t) |
|---|
| 446 | 441 | { MATCH m; |
|---|
| 447 | 442 | |
|---|
| 448 | 443 | #if 0 |
|---|
| 449 | 444 | printf("StringExp::implicitConvTo(this=%s, committed=%d, type=%s, t=%s)\n", |
|---|
| 450 | 445 | toChars(), committed, type->toChars(), t->toChars()); |
|---|
| 451 | 446 | #endif |
|---|
| 452 | 447 | if (!committed && t->ty == Tpointer && t->nextOf()->ty == Tvoid) |
|---|
| 453 | 448 | { |
|---|
| 454 | 449 | return MATCHnomatch; |
|---|