Skip to content

Commit

Permalink
merge D2 pull dlang#663
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Jul 19, 2012
1 parent a8fe551 commit 6f5ae56
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/cast.c
Expand Up @@ -173,6 +173,7 @@ MATCH IntegerExp::implicitConvTo(Type *t)

enum TY ty = type->toBasetype()->ty;
enum TY toty = t->toBasetype()->ty;
enum TY oldty = ty;

if (type->implicitConvTo(t) == MATCHnomatch && t->ty == Tenum)
{
Expand Down Expand Up @@ -238,6 +239,8 @@ MATCH IntegerExp::implicitConvTo(Type *t)
goto Lyes;

case Tchar:
if ((oldty == Twchar || oldty == Tdchar) && value > 0x7F)
goto Lno;
case Tuns8:
//printf("value = %llu %llu\n", (dinteger_t)(unsigned char)value, value);
if ((unsigned char)value != value)
Expand All @@ -249,6 +252,9 @@ MATCH IntegerExp::implicitConvTo(Type *t)
goto Lno;
goto Lyes;

case Twchar:
if (oldty == Tdchar && value > 0xD7FF && value < 0xE000)
goto Lno;
case Tuns16:
if ((unsigned short)value != value)
goto Lno;
Expand All @@ -275,11 +281,6 @@ MATCH IntegerExp::implicitConvTo(Type *t)
goto Lno;
goto Lyes;

case Twchar:
if ((unsigned short)value != value)
goto Lno;
goto Lyes;

case Tfloat32:
{
volatile float f;
Expand Down

0 comments on commit 6f5ae56

Please sign in to comment.