comparison dmd/TypeSArray.d @ 137:09c858522d55

merge
author Trass3r
date Mon, 13 Sep 2010 23:29:00 +0200
parents af1bebfd96a4
children 14feb7ae01a6
comparison
equal deleted inserted replaced
136:9d194c848e3a 137:09c858522d55
365 // Allow implicit conversion of static array to pointer or dynamic array 365 // Allow implicit conversion of static array to pointer or dynamic array
366 if (IMPLICIT_ARRAY_TO_PTR && to.ty == Tpointer) 366 if (IMPLICIT_ARRAY_TO_PTR && to.ty == Tpointer)
367 { 367 {
368 TypePointer tp = cast(TypePointer)to; 368 TypePointer tp = cast(TypePointer)to;
369 369
370 if (next.mod != tp.next.mod && tp.next.mod != MODconst) 370 if (!MODimplicitConv(next.mod, tp.next.mod))
371 return MATCHnomatch; 371 return MATCHnomatch;
372 372
373 if (tp.next.ty == Tvoid || next.constConv(tp.next) != MATCHnomatch) 373 if (tp.next.ty == Tvoid || next.constConv(tp.next) != MATCHnomatch)
374 { 374 {
375 return MATCHconvert; 375 return MATCHconvert;
379 if (to.ty == Tarray) 379 if (to.ty == Tarray)
380 { 380 {
381 int offset = 0; 381 int offset = 0;
382 TypeDArray ta = cast(TypeDArray)to; 382 TypeDArray ta = cast(TypeDArray)to;
383 383
384 if (next.mod != ta.next.mod && ta.next.mod != MODconst) 384 if (!MODimplicitConv(next.mod, ta.next.mod))
385 return MATCHnomatch; 385 return MATCHnomatch;
386 386
387 if (next.equals(ta.next) || 387 if (next.equals(ta.next) ||
388 next.implicitConvTo(ta.next) >= MATCHconst || 388 // next.implicitConvTo(ta.next) >= MATCHconst ||
389 next.constConv(ta.next) != MATCHnomatch ||
389 (ta.next.isBaseOf(next, &offset) && offset == 0) || 390 (ta.next.isBaseOf(next, &offset) && offset == 0) ||
390 ta.next.ty == Tvoid 391 ta.next.ty == Tvoid
391 ) 392 )
392 return MATCHconvert; 393 return MATCHconvert;
393 394