From 61a5a0813516fbf9ffef30ba99e9c5821d9a2a05 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sat, 20 Dec 2008 09:13:44 +0100 Subject: [PATCH 1/2] Adjust error message for missing toConstExp to include 'is not a const exp'. --- gen/toir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen/toir.cpp b/gen/toir.cpp index d6edaade..8793ca21 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -2712,7 +2712,7 @@ STUB(TupleExp); STUB(SymbolExp); #endif -#define CONSTSTUB(x) LLConstant* x::toConstElem(IRState * p) {error("const Exp type "#x" not implemented: '%s' type: '%s'", toChars(), type->toChars()); fatal(); return NULL; } +#define CONSTSTUB(x) LLConstant* x::toConstElem(IRState * p) {error("non-const expression '%s' or const Exp type "#x" not implemented", toChars()); fatal(); return NULL; } CONSTSTUB(Expression); CONSTSTUB(GEPExp); CONSTSTUB(SliceExp); From 9d01659718bb5d24283490b80747fbfcfaf061e4 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sat, 20 Dec 2008 09:15:31 +0100 Subject: [PATCH 2/2] Add missing overrides for toConstExp to dmd2/expression.h. Fixes #156. --- dmd2/expression.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dmd2/expression.h b/dmd2/expression.h index 68fc5518..0c3d5174 100644 --- a/dmd2/expression.h +++ b/dmd2/expression.h @@ -1080,6 +1080,9 @@ struct SliceExp : UnaExp int inlineCost(InlineCostState *ics); Expression *doInline(InlineDoState *ids); Expression *inlineScan(InlineScanState *iss); + + // LDC + virtual llvm::Constant *toConstElem(IRState *irs); }; struct ArrayLengthExp : UnaExp @@ -1154,6 +1157,9 @@ struct IndexExp : BinExp void scanForNestedRef(Scope *sc); elem *toElem(IRState *irs); + + // LDC + virtual llvm::Constant *toConstElem(IRState *irs); }; /* For both i++ and i-- @@ -1565,6 +1571,7 @@ struct GEPExp : UnaExp Expression *toLvalue(Scope *sc, Expression *e); elem *toElem(IRState *irs); + llvm::Constant *toConstElem(IRState *irs); }; #endif