Skip to content

Commit

Permalink
Merge upstream stable (307684dd70)
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed Jul 29, 2019
1 parent 542c93f commit 59c2431
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 34 deletions.
13 changes: 0 additions & 13 deletions dmd/expression.d
Original file line number Diff line number Diff line change
Expand Up @@ -5221,19 +5221,6 @@ extern (C++) final class CastExp : UnaExp
return to ? new CastExp(loc, e1.syntaxCopy(), to.syntaxCopy()) : new CastExp(loc, e1.syntaxCopy(), mod);
}

override bool isLvalue()
{
//printf("e1.type = %s, to.type = %s\n", e1.type.toChars(), to.toChars());
return e1.isLvalue() && e1.type.mutableOf().unSharedOf().equals(to.mutableOf().unSharedOf());
}

override Expression toLvalue(Scope* sc, Expression e)
{
if (isLvalue())
return this;
return Expression.toLvalue(sc, e);
}

override Expression addDtorHook(Scope* sc)
{
if (to.toBasetype().ty == Tvoid) // look past the cast(void)
Expand Down
8 changes: 3 additions & 5 deletions dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -8757,17 +8757,15 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
// Try to do a decent error message with the expression
// before it got constant folded

// https://issues.dlang.org/show_bug.cgi?id=19754
// first see if the unoptimized expression is modifiable
if (e1x.op != TOK.variable)
e1x = e1x.optimize(WANTvalue);

if (exp.op == TOK.assign)
e1x = e1x.modifiableLvalue(sc, e1old);

if (checkIfIsStructLiteralDotExpr(e1x))
return setError();

if (e1x.op != TOK.variable)
e1x = e1x.optimize(WANTvalue);

if (e1x.op == TOK.error)
{
result = e1x;
Expand Down
8 changes: 1 addition & 7 deletions dmd/semantic3.d
Original file line number Diff line number Diff line change
Expand Up @@ -871,13 +871,7 @@ version (IN_LLVM)
const hasCopyCtor = exp.type.ty == Tstruct && (cast(TypeStruct)exp.type).sym.hasCopyCtor;
// if a copy constructor is present, the return type conversion will be handled by it
if (!hasCopyCtor)
{
if (f.isref && !MODimplicitConv(exp.type.mod, tret.mod) && !tret.isTypeSArray())
error(exp.loc, "expression `%s` of type `%s` is not implicitly convertible to return type `ref %s`",
exp.toChars(), exp.type.toChars(), tret.toChars());
else
exp = exp.implicitCastTo(sc2, tret);
}
exp = exp.implicitCastTo(sc2, tret);

if (f.isref)
{
Expand Down
7 changes: 0 additions & 7 deletions dmd/typesem.d
Original file line number Diff line number Diff line change
Expand Up @@ -1377,13 +1377,6 @@ extern(C++) Type typeSemantic(Type t, Loc loc, Scope* sc)
e = new AddrExp(e.loc, e);
e = e.expressionSemantic(argsc);
}
if (isRefOrOut && (!isAuto || e.isLvalue())
&& !MODimplicitConv(e.type.mod, fparam.type.mod))
{
const(char)* errTxt = fparam.storageClass & STC.ref_ ? "ref" : "out";
.error(e.loc, "expression `%s` of type `%s` is not implicitly convertible to type `%s %s` of parameter `%s`",
e.toChars(), e.type.toChars(), errTxt, fparam.type.toChars(), fparam.toChars());
}
e = e.implicitCastTo(argsc, fparam.type);

// default arg must be an lvalue
Expand Down
2 changes: 1 addition & 1 deletion runtime/phobos
Submodule phobos updated 1 files
+9 −1 std/range/package.d

0 comments on commit 59c2431

Please sign in to comment.