PR d/90863
d/dmd: Merge upstream dmd
6e44734cc
Fixes segmentation fault in StatementSemanticVisitor::visit.
Reviewed-on: https://github.com/dlang/dmd/pull/10033
From-SVN: r272352
-7afcc60c30554e452eacdfbefc4951ebf601fccd
+6e44734ccbeb78252a52e129a67fefb313679948
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
}
};
+ if (!s)
+ return BEfallthru;
BlockExit be(func, mustNotThrow);
s->accept(&be);
return be.result;
ss->_body = semantic(ss->_body, sc);
sc->noctor--;
- if (conditionError || ss->_body->isErrorStatement())
+ if (conditionError || (ss->_body && ss->_body->isErrorStatement()))
goto Lerror;
// Resolve any goto case's with exp
{
ss->hasNoDefault = 1;
- if (!ss->isFinal && !ss->_body->isErrorStatement())
+ if (!ss->isFinal && (!ss->_body || !ss->_body->isErrorStatement()))
ss->error("switch statement without a default; use 'final switch' or add 'default: assert(0);' or add 'default: break;'");
// Generate runtime error if the default is hit
--- /dev/null
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail19955.d(8): Error: `switch` statement without a `default`; use `final switch` or add `default: assert(0);` or add `default: break;`
+---
+*/
+void f() { switch(1) static assert(1); }