From 347f5c885f33bcd905d601faa5a93b01715eacf8 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sun, 16 Jun 2019 07:47:46 +0000 Subject: [PATCH] re PR d/90651 (ICE in FuncDeclaration::semantic3, at d/dmd/func.c:1524) PR d/90651 d/dmd: Merge upstream dmd 78dc31152 Fixes bug where the object module was not always implicitly imported. Reviewed-on: https://github.com/dlang/dmd/pull/9999 From-SVN: r272340 --- gcc/d/dmd/MERGE | 2 +- gcc/d/dmd/dmodule.c | 3 ++- gcc/testsuite/gdc.test/compilable/test19912.d | 3 +++ gcc/testsuite/gdc.test/fail_compilation/fail19912a.d | 9 +++++++++ gcc/testsuite/gdc.test/fail_compilation/fail19912b.d | 9 +++++++++ gcc/testsuite/gdc.test/fail_compilation/fail19912c.d | 9 +++++++++ gcc/testsuite/gdc.test/fail_compilation/fail19912d.d | 9 +++++++++ gcc/testsuite/gdc.test/fail_compilation/fail19912e.d | 9 +++++++++ 8 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gdc.test/compilable/test19912.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail19912a.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail19912b.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail19912c.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail19912d.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail19912e.d diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 9949925..e100264 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -bbc5ea66ab41ebd14abd9a0fbb9ca6ef6b2dcb14 +78dc311524341a76008b341ff6427e5a16e285db 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/dmodule.c b/gcc/d/dmd/dmodule.c index 1f6fd9f..bf1c0c1 100644 --- a/gcc/d/dmd/dmodule.c +++ b/gcc/d/dmd/dmodule.c @@ -679,7 +679,8 @@ void Module::importAll(Scope *) // If it isn't there, some compiler rewrites, like // classinst == classinst -> .object.opEquals(classinst, classinst) // would fail inside object.d. - if (members->dim == 0 || ((*members)[0])->ident != Id::object) + if (members->dim == 0 || ((*members)[0])->ident != Id::object || + (*members)[0]->isImport() == NULL) { Import *im = new Import(Loc(), NULL, Id::object, NULL, 0); members->shift(im); diff --git a/gcc/testsuite/gdc.test/compilable/test19912.d b/gcc/testsuite/gdc.test/compilable/test19912.d new file mode 100644 index 0000000..7a6bc9e --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test19912.d @@ -0,0 +1,3 @@ +// PERMUTE_ARGS: +import object; +void fun(string) { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19912a.d b/gcc/testsuite/gdc.test/fail_compilation/fail19912a.d new file mode 100644 index 0000000..47d3cf2 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19912a.d @@ -0,0 +1,9 @@ +// PERMUTE_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/fail19912a.d(8): Error: struct `fail19912a.object` conflicts with import `fail19912a.object` at fail_compilation/fail19912a.d +--- +*/ +struct object { } +void fun(string) { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19912b.d b/gcc/testsuite/gdc.test/fail_compilation/fail19912b.d new file mode 100644 index 0000000..b3bd56d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19912b.d @@ -0,0 +1,9 @@ +// PERMUTE_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/fail19912b.d(8): Error: class `fail19912b.object` conflicts with import `fail19912b.object` at fail_compilation/fail19912b.d +--- +*/ +class object { } +void fun(string) { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19912c.d b/gcc/testsuite/gdc.test/fail_compilation/fail19912c.d new file mode 100644 index 0000000..a4656cc --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19912c.d @@ -0,0 +1,9 @@ +// PERMUTE_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/fail19912c.d(8): Error: alias `fail19912c.object` conflicts with import `fail19912c.object` at fail_compilation/fail19912c.d +--- +*/ +alias object = int; +void fun(string) { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19912d.d b/gcc/testsuite/gdc.test/fail_compilation/fail19912d.d new file mode 100644 index 0000000..fdc8dcb --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19912d.d @@ -0,0 +1,9 @@ +// PERMUTE_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/fail19912d.d(8): Error: enum `fail19912d.object` conflicts with import `fail19912d.object` at fail_compilation/fail19912d.d +--- +*/ +enum object { } +void fun(string) { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19912e.d b/gcc/testsuite/gdc.test/fail_compilation/fail19912e.d new file mode 100644 index 0000000..19cc9a6 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19912e.d @@ -0,0 +1,9 @@ +// PERMUTE_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/fail19912e.d(8): Error: function `fail19912e.object` conflicts with import `fail19912e.object` at fail_compilation/fail19912e.d +--- +*/ +void object() { } +void fun(string) { } -- 2.7.4