diff --git a/src/statement.c b/src/statement.c index d4bbda619b1a..cc3c41642c3d 100644 --- a/src/statement.c +++ b/src/statement.c @@ -5124,8 +5124,11 @@ bool GotoStatement::checkLabel() return true; } - VarDeclaration *last = lastVar; VarDeclaration *vd = label->statement->lastVar; + if (!vd || vd->isDataseg() || (vd->storage_class & STCmanifest)) + return false; + + VarDeclaration *last = lastVar; while (last && last != vd) last = last->lastVar; if (last == vd) diff --git a/test/compilable/test602.d b/test/compilable/test602.d index 5b9cf0f0d6db..90c0978fcfe4 100644 --- a/test/compilable/test602.d +++ b/test/compilable/test602.d @@ -381,3 +381,13 @@ static assert(!__traits(compiles, (bool b) if (b) goto label; })); + +/***************************************************/ + +int test11659() +{ + goto LABEL; + enum expr = "0"; + LABEL: + return mixin(expr); +}