aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/d/dmd/MERGE2
-rw-r--r--gcc/d/dmd/blockexit.c2
-rw-r--r--gcc/d/dmd/statementsem.c4
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail19955.d8
4 files changed, 13 insertions, 3 deletions
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index 4111fc9..0620a5b 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-7afcc60c30554e452eacdfbefc4951ebf601fccd
+6e44734ccbeb78252a52e129a67fefb313679948
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/blockexit.c b/gcc/d/dmd/blockexit.c
index e9d3f10..c3b60b8 100644
--- a/gcc/d/dmd/blockexit.c
+++ b/gcc/d/dmd/blockexit.c
@@ -496,6 +496,8 @@ int blockExit(Statement *s, FuncDeclaration *func, bool mustNotThrow)
}
};
+ if (!s)
+ return BEfallthru;
BlockExit be(func, mustNotThrow);
s->accept(&be);
return be.result;
diff --git a/gcc/d/dmd/statementsem.c b/gcc/d/dmd/statementsem.c
index 167836c..143864dc6 100644
--- a/gcc/d/dmd/statementsem.c
+++ b/gcc/d/dmd/statementsem.c
@@ -2035,7 +2035,7 @@ public:
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
@@ -2111,7 +2111,7 @@ public:
{
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
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19955.d b/gcc/testsuite/gdc.test/fail_compilation/fail19955.d
new file mode 100644
index 0000000..7cdce2c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail19955.d
@@ -0,0 +1,8 @@
+// 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); }