diff --git a/dmd2/expression.c b/dmd2/expression.c index de9d1169..240e1261 100644 --- a/dmd2/expression.c +++ b/dmd2/expression.c @@ -11995,10 +11995,26 @@ Ltupleassign: warning("explicit element-wise assignment %s = (%s)[] is better than %s = %s", e1str, e2str, e1str, e2str); } - if (op == TOKconstruct) + + Type *t2n = t2->nextOf(); + Type *t1n = t1->nextOf(); + int offset; + if (t2n->immutableOf()->equals(t1n->immutableOf()) || + t1n->isBaseOf(t2n, &offset) && offset == 0) + { + /* Allow copy of distinct qualifier elements. + * eg. + * char[] dst; const(char)[] src; + * dst[] = src; + * + * class C {} class D : C {} + * C[2] ca; D[] da; + * ca[] = da; + */ e2 = e2->castTo(sc, e1->type->constOf()); + } else - e2 = e2->implicitCastTo(sc, e1->type->constOf()); + e2 = e2->implicitCastTo(sc, e1->type); } else { diff --git a/dmd2/parse.c b/dmd2/parse.c index 05b125e4..0b080472 100644 --- a/dmd2/parse.c +++ b/dmd2/parse.c @@ -3081,6 +3081,7 @@ Dsymbols *Parser::parseDeclarations(StorageClass storage_class, utf8_t *comment) break; } case TOKtypedef: + deprecation("use of typedef is deprecated; use alias instead"); tok = token.value; nextToken(); break; @@ -3285,7 +3286,8 @@ L2: error("no identifier for declarator %s", t->toChars()); if (tok == TOKtypedef || tok == TOKalias) - { Declaration *v; + { + Declaration *v; Initializer *init = NULL; /* Aliases can no longer have multiple declarators, storage classes, @@ -3303,7 +3305,6 @@ L2: } if (tok == TOKtypedef) { - deprecation("use of typedef is deprecated; use alias instead"); v = new TypedefDeclaration(loc, ident, t, init); } else diff --git a/runtime/phobos b/runtime/phobos index eb7ed998..c50b93e5 160000 --- a/runtime/phobos +++ b/runtime/phobos @@ -1 +1 @@ -Subproject commit eb7ed99822fe5abc92ec58aa8c6ef190461526b4 +Subproject commit c50b93e5a3ae98a04657d18c2c68da5a15b4c59c