From c08920539581644017d8e66eb36f730f59b025df Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Fri, 17 Dec 2010 12:55:28 +0300 Subject: [PATCH] Removed a hack for bug #218. That fixes many regressions in CTFE --- dmd2/expression.c | 3 --- dmd2/expression.h | 4 +--- dmd2/mtype.c | 4 ---- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/dmd2/expression.c b/dmd2/expression.c index 86f7f5d5..08b76a66 100644 --- a/dmd2/expression.c +++ b/dmd2/expression.c @@ -3487,13 +3487,10 @@ int StructLiteralExp::isLvalue() } #endif -/* -Removed in LDC. See declaration. Expression *StructLiteralExp::toLvalue(Scope *sc, Expression *e) { return this; } -*/ int StructLiteralExp::checkSideEffect(int flag) diff --git a/dmd2/expression.h b/dmd2/expression.h index 2bbbc38e..e175b13a 100644 --- a/dmd2/expression.h +++ b/dmd2/expression.h @@ -551,9 +551,7 @@ struct StructLiteralExp : Expression Expression *optimize(int result); Expression *interpret(InterState *istate); int isLvalue(); - // LDC: struct literals aren't lvalues! Taking their address can lead to - // incorrect behavior, see LDC#218, DMD#2682 - // Expression *toLvalue(Scope *sc, Expression *e); + Expression *toLvalue(Scope *sc, Expression *e); int canThrow(); MATCH implicitConvTo(Type *t); diff --git a/dmd2/mtype.c b/dmd2/mtype.c index 0e2d4afe..4e0bfe4b 100644 --- a/dmd2/mtype.c +++ b/dmd2/mtype.c @@ -7229,9 +7229,6 @@ Expression *TypeStruct::defaultInitLiteral(Loc loc) #if LOGDEFAULTINIT printf("TypeStruct::defaultInitLiteral() '%s'\n", toChars()); #endif -#if IN_LLVM - return defaultInit(loc); -#else if (sym->isNested()) return defaultInit(loc); Expressions *structelems = new Expressions(); @@ -7251,7 +7248,6 @@ Expression *TypeStruct::defaultInitLiteral(Loc loc) // sym->type != NULL ? structinit->type = sym->type; return structinit; -#endif }