From 631453d41b0e9e39dc432f2be0fa9c0e4f974fd5 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Fri, 22 Apr 2011 18:32:37 +0200 Subject: [PATCH] Merged DMD commit 0fbeb2af9206600453af6e6a14bafc639b35b95c: bugzilla 5159 Segfault(interpret.c): calling a static function pointer variable in CTFE --- dmd/interpret.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dmd/interpret.c b/dmd/interpret.c index bf823855..d0cb6cd7 100644 --- a/dmd/interpret.c +++ b/dmd/interpret.c @@ -2711,11 +2711,15 @@ Expression *CallExp::interpret(InterState *istate) VarDeclaration *vd = ((VarExp *)((PtrExp*)ecall)->e1)->var->isVarDeclaration(); if (vd && vd->value && vd->value->op == TOKsymoff) fd = ((SymOffExp *)vd->value)->var->isFuncDeclaration(); - else { - ecall = vd->value->interpret(istate); + else + { + ecall = getVarExp(loc, istate, vd); + if (ecall == EXP_CANT_INTERPRET) + return ecall; + if (ecall->op == TOKsymoff) - fd = ((SymOffExp *)ecall)->var->isFuncDeclaration(); - } + fd = ((SymOffExp *)ecall)->var->isFuncDeclaration(); + } } else ecall = ((PtrExp*)ecall)->e1->interpret(istate);