Skip to content

Commit

Permalink
fix Issue 19609 - [ICE] dmd/expression.d(2790): Segmentation fault (p…
Browse files Browse the repository at this point in the history
…art 2)
  • Loading branch information
ibuclaw committed Jan 28, 2019
1 parent f2eb605 commit 8ed4674
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
5 changes: 1 addition & 4 deletions src/dmd/dimport.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import dmd.dsymbol;
import dmd.dsymbolsem;
import dmd.errors;
import dmd.expression;
import dmd.expressionsem;
import dmd.globals;
import dmd.identifier;
import dmd.mtype;
Expand Down Expand Up @@ -211,17 +210,15 @@ extern (C++) final class Import : Dsymbol
load(sc);
if (mod) // if successfully loaded module
{
mod.importAll(null);
if (mod.md && mod.md.isdeprecated)
{
Expression msg = mod.md.msg;
if (msg)
msg = semanticString(sc, msg, "deprecation message");
if (StringExp se = msg ? msg.toStringExp() : null)
mod.deprecation(loc, "is deprecated - %s", se.string);
else
mod.deprecation(loc, "is deprecated");
}
mod.importAll(null);
if (sc.explicitProtection)
protection = sc.protection;
if (!isstatic && !aliasId && !names.dim)
Expand Down
13 changes: 7 additions & 6 deletions test/fail_compilation/fail19609.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
TEST_OUTPUT
---
fail_compilation/imports/fail19609a.d(1): Error: `string` expected for deprecation message, not `([""])` of type `string[]`
fail_compilation/fail19609.d(16): Deprecation: module `imports.fail19609a` is deprecated
fail_compilation/imports/fail19609a.d(1): Error: `string` expected for deprecation message, not `([""])` of type `string[]`
fail_compilation/imports/fail19609b.d(1): Error: `string` expected for deprecation message, not `([1])` of type `int[]`
fail_compilation/fail19609.d(17): Deprecation: module `imports.fail19609b` is deprecated
fail_compilation/fail19609.d(15): Deprecation: module `imports.fail19609a` is deprecated
fail_compilation/imports/fail19609b.d(1): Error: `string` expected for deprecation message, not `([1])` of type `int[]`
fail_compilation/fail19609.d(16): Deprecation: module `imports.fail19609b` is deprecated
fail_compilation/imports/fail19609c.d(1): Error: `string` expected for deprecation message, not `(123.4F)` of type `float`
fail_compilation/fail19609.d(18): Deprecation: module `imports.fail19609c` is deprecated
fail_compilation/imports/fail19609c.d(1): Error: `string` expected for deprecation message, not `(123.4F)` of type `float`
fail_compilation/fail19609.d(17): Deprecation: module `imports.fail19609c` is deprecated
fail_compilation/imports/fail19609d.d(1): Error: undefined identifier `msg`
fail_compilation/fail19609.d(19): Deprecation: module `imports.fail19609d` is deprecated
---
*/
import imports.fail19609a;
import imports.fail19609b;
import imports.fail19609c;
enum msg = "You should not be able to see me";
import imports.fail19609d;
2 changes: 2 additions & 0 deletions test/fail_compilation/imports/fail19609d.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecated(msg) module imports.fail19609d;
enum msg = "You won't see this either";

0 comments on commit 8ed4674

Please sign in to comment.