re PR d/90651 (ICE in FuncDeclaration::semantic3, at d/dmd/func.c:1524)
authorIain Buclaw <ibuclaw@gcc.gnu.org>
Sun, 16 Jun 2019 07:47:46 +0000 (07:47 +0000)
committerIain Buclaw <ibuclaw@gcc.gnu.org>
Sun, 16 Jun 2019 07:47:46 +0000 (07:47 +0000)
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
gcc/d/dmd/dmodule.c
gcc/testsuite/gdc.test/compilable/test19912.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/fail19912a.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/fail19912b.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/fail19912c.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/fail19912d.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/fail19912e.d [new file with mode: 0644]

index 99499252279f8d4657e6e4507c33f3093a458bc6..e100264fed851328c69b44bc4b4c56b66c2399e6 100644 (file)
@@ -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.
index 1f6fd9f10a6d46ce874142ac3865ef14cd4161ee..bf1c0c1f0d901aa1d0ec4835f342a2e5f5b061db 100644 (file)
@@ -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 (file)
index 0000000..7a6bc9e
--- /dev/null
@@ -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 (file)
index 0000000..47d3cf2
--- /dev/null
@@ -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 (file)
index 0000000..b3bd56d
--- /dev/null
@@ -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 (file)
index 0000000..a4656cc
--- /dev/null
@@ -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 (file)
index 0000000..fdc8dcb
--- /dev/null
@@ -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 (file)
index 0000000..19cc9a6
--- /dev/null
@@ -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) { }