[Issue 14272] DMD segfault in in Dsymbol::checkDeprecated(Loc, Scope*) on possibly invalid code

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Mar 11 04:24:16 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14272

--- Comment #3 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
yes, such code should trigger forward reference error. the following patch
seems to fix it:

diff --git a/src/expression.c b/src/expression.c
index a69c9b8..270a37b 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -3295,6 +3295,11 @@ Lagain:
         {
             if (v->scope)
             {
+                if (v->inuse)
+                {
+                    error("forward reference of %s %s", s->kind(),
s->toChars());
+                    return new ErrorExp();
+                }
                 v->inuse++;
                 v->init = v->init->semantic(v->scope, v->type, INITinterpret);
                 v->scope = NULL;

--


More information about the Digitalmars-d-bugs mailing list