Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

always perform forced conversion on the target type for casts

  • Loading branch information...
commit c7630721dfebfc5842c32057e32f7c4965c1e11c 1 parent 8a7ef79
@FeepingCreature authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  ast/casting.d
View
3  ast/casting.d
@@ -108,6 +108,7 @@ Object gotExplicitDefaultCastExpr(ref string text, ParseCb cont, ParseCb rest) {
if (!rest(t2, "type"[], &dest) || !t2.accept(":"[]))
return null;
if (t2.accept(":"[])) return null;
+ dest = forcedConvert(dest);
if (!rest(t2, "tree.expr _tree.expr.arith"[], &ex) || !gotImplicitCast(ex, dest, (IType it) { return test(it == dest); })) {
t2.setError("can't get "[], ex, " into "[], dest);
return null;
@@ -144,6 +145,7 @@ Object gotConversionCast(ref string text, ParseCb cont, ParseCb rest) {
if (!rest(t2, "type"[], &dest) || !t2.accept(":"[]))
return null;
if (t2.accept(":"[])) return null;
+ dest = forcedConvert(dest);
Expr ex;
if (!rest(t2, "tree.expr _tree.expr.arith"[], &ex)) {
t2.setError("Unable to parse cast source"[]);
@@ -162,6 +164,7 @@ Object gotCastExpr(ref string text, ParseCb cont, ParseCb rest) {
if (!rest(t2, "type"[], &dest) || !t2.accept(":"[]))
return null;
if (t2.accept(":"[])) return null;
+ dest = forcedConvert(dest);
IType[] types;
if (!rest(t2, "tree.expr _tree.expr.arith"[], &ex)) {
t2.failparse("Failed to get expression"[]);
Please sign in to comment.
Something went wrong with that request. Please try again.