[PR,d/88958] Committed fix for ICE in walk_aliased_vdefs_1

Message ID CABOHX+f0RgUZC_zpA3xCG2Y2+uEtCYJLLznOGPreyHDWGL_=iA@mail.gmail.com
State New
Headers show
Series
  • [PR,d/88958] Committed fix for ICE in walk_aliased_vdefs_1
Related show

Commit Message

Iain Buclaw March 10, 2019, 4:30 p.m.
Hi,

This patch merges the D front-end implementation with dmd upstream
0fc786f49, fixing PR d/88958.

Bootstrapped and regression tested on x86_64-linux-gnu.

Committed to trunk as r269557.

-- 
Iain
---

Patch

diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index 3f416dbfb7b..98bf8254554 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@ 
-d517c0e6a10b548f44d82b71b3c079663cb94f8e
+0fc786f4908aa6bdd4220af87995333b1f24c3d7
 
 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/expressionsem.c b/gcc/d/dmd/expressionsem.c
index 3fd5c1fa33f..bcc1ac9ed2f 100644
--- a/gcc/d/dmd/expressionsem.c
+++ b/gcc/d/dmd/expressionsem.c
@@ -102,6 +102,12 @@  static bool preFunctionParameters(Scope *sc, Expressions *exps)
                 arg = new ErrorExp();
                 err = true;
             }
+            else if (arg->type->toBasetype()->ty == Tfunction)
+            {
+                arg->error("cannot pass type %s as a function argument", arg->toChars());
+                arg = new ErrorExp();
+                err = true;
+            }
             else if (checkNonAssignmentArrayOp(arg))
             {
                 arg = new ErrorExp();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test19608.d b/gcc/testsuite/gdc.test/fail_compilation/test19608.d
new file mode 100644
index 00000000000..cea84a6bd50
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test19608.d
@@ -0,0 +1,16 @@ 
+// https://issues.dlang.org/show_bug.cgi?id=19608
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test19608.d(15): Error: cannot pass function `*& f` as a function argument
+---
+*/
+import core.stdc.stdarg;
+
+void f(int) {}
+void g(...) {}
+void h()
+{
+    g(&f);  // OK, function address
+    g(*&f); // ICE -> Error
+}