From: Iain Buclaw Date: Sun, 16 Jun 2019 07:47:46 +0000 (+0000) Subject: re PR d/90651 (ICE in FuncDeclaration::semantic3, at d/dmd/func.c:1524) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=347f5c885f33bcd905d601faa5a93b01715eacf8;p=gcc.git 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 --- diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 99499252279..e100264fed8 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 1f6fd9f10a6..bf1c0c1f0d9 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 00000000000..7a6bc9eb063 --- /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 00000000000..47d3cf2e5bc --- /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 00000000000..b3bd56dde46 --- /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 00000000000..a4656cc856b --- /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 00000000000..fdc8dcb9244 --- /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 00000000000..19cc9a619d1 --- /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) { }