http://d.puremagic.com/issues/show_bug.cgi?id=5218


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #1 from Don <clugd...@yahoo.com.au> 2010-11-15 15:36:06 PST ---
PATCH: This is because "abc"w and "abc"d are committed types. If the type is
committed, implicit conversions are not performed at all. But this is wrong:
they should still allow const/immutable conversions.



Index: cast.c
===================================================================
--- cast.c    (revision 755)
+++ cast.c    (working copy)
@@ -449,8 +449,6 @@
     printf("StringExp::implicitConvTo(this=%s, committed=%d, type=%s,
t=%s)\n",
         toChars(), committed, type->toChars(), t->toChars());
 #endif
-    if (!committed)
-    {
     if (!committed && t->ty == Tpointer && t->nextOf()->ty == Tvoid)
     {
         return MATCHnomatch;
@@ -471,7 +469,8 @@
                             ((TypeSArray *)t)->dim->toInteger())
                             return MATCHnomatch;
                         TY tynto = t->nextOf()->ty;
-                        if (tynto == Tchar || tynto == Twchar || tynto ==
Tdchar)
+                        if (tynto == tyn) return MATCHexact;
+                        if (!committed && (tynto == Tchar || tynto == Twchar
|| tynto == Tdchar))
                             return MATCHexact;
                     }
                     else if (type->ty == Tarray)
@@ -480,7 +479,8 @@
                             ((TypeSArray *)t)->dim->toInteger())
                             return MATCHnomatch;
                         TY tynto = t->nextOf()->ty;
-                        if (tynto == Tchar || tynto == Twchar || tynto ==
Tdchar)
+                        if (tynto == tyn) return MATCHexact;
+                        if (!committed && (tynto == Tchar || tynto == Twchar
|| tynto == Tdchar))
                             return MATCHexact;
                     }
                 case Tarray:
@@ -497,13 +497,13 @@
                         case Tchar:
                         case Twchar:
                         case Tdchar:
-                            return m;
+                            if (!committed)
+                                return m;
                     }
                     break;
             }
         }
     }
-    }
     return Expression::implicitConvTo(t);
 #if 0
     m = (MATCH)type->implicitConvTo(t);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to