From 42a84c28ef2fec57faa061e0676437e354c8c521 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sun, 10 Mar 2019 17:25:18 +0000 Subject: [PATCH] re PR d/89016 (ICE in ArrayLiteralExp::toStringExp, at d/dmd/expression.c:3873) PR d/89016 d/dmd: Merge upstream dmd da26db819 Backports supplementary fix for ICE on importing deprecated modules. Updates https://gcc.gnu.org/PR89016 Reviewed-on: https://github.com/dlang/dmd/pull/9436 From-SVN: r269560 --- gcc/d/dmd/MERGE | 2 +- gcc/d/dmd/dimport.c | 8 ++------ gcc/testsuite/gdc.test/fail_compilation/fail19609.d | 13 +++++++------ .../gdc.test/fail_compilation/imports/fail19609d.d | 2 ++ 4 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gdc.test/fail_compilation/imports/fail19609d.d diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 98bf8254554..313748f70ae 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -0fc786f4908aa6bdd4220af87995333b1f24c3d7 +da26db81943952c7e35dab98650df589ec122485 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/dimport.c b/gcc/d/dmd/dimport.c index cd2c5b22a74..3d899f09b52 100644 --- a/gcc/d/dmd/dimport.c +++ b/gcc/d/dmd/dimport.c @@ -23,8 +23,6 @@ #include "attrib.h" #include "hdrgen.h" -StringExp *semanticString(Scope *sc, Expression *exp, const char *s); - /********************************* Import ****************************/ Import::Import(Loc loc, Identifiers *packages, Identifier *id, Identifier *aliasId, @@ -175,19 +173,17 @@ void Import::importAll(Scope *sc) 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) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19609.d b/gcc/testsuite/gdc.test/fail_compilation/fail19609.d index 64d080ac5d0..26ef57693b7 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail19609.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19609.d @@ -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; diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail19609d.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail19609d.d new file mode 100644 index 00000000000..0955ca4fac2 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail19609d.d @@ -0,0 +1,2 @@ +deprecated(msg) module imports.fail19609d; +enum msg = "You won't see this either"; -- 2.30.2