diff options
Diffstat (limited to 'gcc/d/dmd/func.d')
-rw-r--r-- | gcc/d/dmd/func.d | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/d/dmd/func.d b/gcc/d/dmd/func.d index 55abe4d52e7..aba5d62827a 100644 --- a/gcc/d/dmd/func.d +++ b/gcc/d/dmd/func.d @@ -3748,9 +3748,7 @@ extern (C++) final class FuncLiteralDeclaration : FuncDeclaration { Expression exp = s.exp; if (exp && !exp.type.equals(tret)) - { - s.exp = exp.castTo(sc, tret); - } + s.exp = exp.implicitCastTo(sc, tret); } } @@ -4150,6 +4148,7 @@ extern (C++) final class InvariantDeclaration : FuncDeclaration { extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc, Identifier id, Statement fbody) { + // Make a unique invariant for now; we'll fix it up as we add it to the aggregate invariant list. super(loc, endloc, id ? id : Identifier.generateId("__invariant"), stc, null); this.fbody = fbody; } @@ -4186,6 +4185,15 @@ extern (C++) final class InvariantDeclaration : FuncDeclaration { v.visit(this); } + + extern (D) void fixupInvariantIdent(size_t offset) + { + OutBuffer idBuf; + idBuf.writestring("__invariant"); + idBuf.print(offset); + + ident = Identifier.idPool(idBuf[]); + } } |