d: Split up the grouped compilable and runnable tests.
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 21 Jul 2020 16:40:36 +0000 (18:40 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Fri, 31 Jul 2020 16:43:23 +0000 (18:43 +0200)
The majority of tests in runnable are really compilable/ICE tests, and
have have dg-do adjusted where necessary.  Tests that had a dependency
on Phobos have also been reproduced and reduced with all imports
stripped from the test.

The end result is a collection of tests that only check the compiler bug
that was being fixed, rather than the library, and a reduction in time
spent running all tests.

gcc/testsuite/ChangeLog:

* gdc.dg/compilable.d: Removed.
* gdc.dg/gdc108.d: New test.
* gdc.dg/gdc115.d: New test.
* gdc.dg/gdc121.d: New test.
* gdc.dg/gdc122.d: New test.
* gdc.dg/gdc127.d: New test.
* gdc.dg/gdc131.d: New test.
* gdc.dg/gdc133.d: New test.
* gdc.dg/gdc141.d: New test.
* gdc.dg/gdc142.d: New test.
* gdc.dg/gdc15.d: New test.
* gdc.dg/gdc17.d: New test.
* gdc.dg/gdc170.d: New test.
* gdc.dg/gdc171.d: New test.
* gdc.dg/gdc179.d: New test.
* gdc.dg/gdc183.d: New test.
* gdc.dg/gdc186.d: New test.
* gdc.dg/gdc187.d: New test.
* gdc.dg/gdc19.d: New test.
* gdc.dg/gdc191.d: New test.
* gdc.dg/gdc194.d: New test.
* gdc.dg/gdc196.d: New test.
* gdc.dg/gdc198.d: New test.
* gdc.dg/gdc200.d: New test.
* gdc.dg/gdc204.d: New test.
* gdc.dg/gdc210.d: New test.
* gdc.dg/gdc212.d: New test.
* gdc.dg/gdc213.d: New test.
* gdc.dg/gdc218.d: New test.
* gdc.dg/gdc223.d: New test.
* gdc.dg/gdc231.d: New test.
* gdc.dg/gdc239.d: New test.
* gdc.dg/gdc24.d: New test.
* gdc.dg/gdc240.d: New test.
* gdc.dg/gdc241.d: New test.
* gdc.dg/gdc242a.d: New test.
* gdc.dg/gdc242b.d: New test.
* gdc.dg/gdc248.d: New test.
* gdc.dg/gdc250.d: New test.
* gdc.dg/gdc251.d: New test.
* gdc.dg/gdc253a.d: New test.
* gdc.dg/gdc253b.d: New test.
* gdc.dg/gdc255.d: New test.
* gdc.dg/gdc256.d: New test.
* gdc.dg/gdc261.d: New test.
* gdc.dg/gdc27.d: New test.
* gdc.dg/gdc273.d: New test.
* gdc.dg/gdc280.d: New test.
* gdc.dg/gdc284.d: New test.
* gdc.dg/gdc285.d: New test.
* gdc.dg/gdc286.d: New test.
* gdc.dg/gdc300.d: New test.
* gdc.dg/gdc309.d: New test.
* gdc.dg/gdc31.d: New test.
* gdc.dg/gdc35.d: New test.
* gdc.dg/gdc36.d: New test.
* gdc.dg/gdc37.d: New test.
* gdc.dg/gdc4.d: New test.
* gdc.dg/gdc43.d: New test.
* gdc.dg/gdc47.d: New test.
* gdc.dg/gdc51.d: New test.
* gdc.dg/gdc57.d: New test.
* gdc.dg/gdc66.d: New test.
* gdc.dg/gdc67.d: New test.
* gdc.dg/gdc71.d: New test.
* gdc.dg/gdc77.d: New test.
* gdc.dg/imports/gdc239.d: Remove phobos dependency.
* gdc.dg/imports/gdc241a.d: Updated imports.
* gdc.dg/imports/gdc241b.d: Likewise.
* gdc.dg/imports/gdc251a.d: Likewise.
* gdc.dg/imports/gdc253.d: Rename to...
* gdc.dg/imports/gdc253a.d: ...this.
* gdc.dg/imports/gdc253b.d: New.
* gdc.dg/imports/gdc36.d: New.
* gdc.dg/imports/runnable.d: Removed.
* gdc.dg/link.d: Removed.
* gdc.dg/runnable.d: Removed.
* gdc.dg/runnable2.d: Removed.
* gdc.dg/simd.d: Remove phobos dependency.

79 files changed:
gcc/testsuite/gdc.dg/compilable.d [deleted file]
gcc/testsuite/gdc.dg/gdc108.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc115.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc121.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc122.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc127.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc131.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc133.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc141.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc142.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc15.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc17.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc170.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc171.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc179.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc183.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc186.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc187.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc19.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc191.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc194.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc196.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc198.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc200.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc204.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc210.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc212.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc213.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc218.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc223.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc231.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc239.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc24.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc240.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc241.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc242a.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc242b.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc248.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc250.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc251.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc253a.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc253b.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc255.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc256.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc261.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc27.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc273.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc280.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc284.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc285.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc286.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc300.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc309.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc31.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc35.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc36.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc37.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc4.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc43.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc47.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc51.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc57.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc66.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc67.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc71.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/gdc77.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/imports/gdc239.d
gcc/testsuite/gdc.dg/imports/gdc241a.d
gcc/testsuite/gdc.dg/imports/gdc241b.d
gcc/testsuite/gdc.dg/imports/gdc251a.d
gcc/testsuite/gdc.dg/imports/gdc253.d [deleted file]
gcc/testsuite/gdc.dg/imports/gdc253a.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/imports/gdc253b.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/imports/gdc36.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/imports/runnable.d [deleted file]
gcc/testsuite/gdc.dg/link.d [deleted file]
gcc/testsuite/gdc.dg/runnable.d [deleted file]
gcc/testsuite/gdc.dg/runnable2.d [deleted file]
gcc/testsuite/gdc.dg/simd.d

diff --git a/gcc/testsuite/gdc.dg/compilable.d b/gcc/testsuite/gdc.dg/compilable.d
deleted file mode 100644 (file)
index 3f92f9b..0000000
+++ /dev/null
@@ -1,444 +0,0 @@
-// { dg-options "-I $srcdir/gdc.dg -I $srcdir/gdc.dg/imports -Wno-psabi" }
-// { dg-additional-sources "imports/gdc27.d imports/gdc231.d" }
-// { dg-do compile }
-
-import core.simd;
-import gcc.attribute;
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=27
-
-import imports.gdc27;
-
-interface I_B : I_A
-{
-    void b();
-}
-
-abstract class C_B : C_A, I_B
-{
-    abstract void b();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=108
-
-@attribute("forceinline")
-void forceinline108()
-{
-}
-
-@attribute("noinline")
-void noinline108()
-{
-}
-
-@attribute("flatten")
-void flatten108()
-{
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=170
-
-import imports.gdc170;
-
-void test170()
-{
-    foo!void.foo1!void();
-    foo!void.foo2!void();
-    foo!void.foo3();
-    foo!void.foo3!void();
-    foo!void.foo4();
-    foo!void.foo4!void();
-    foo!void.foo5!void(null);
-    foo!void.foo6!void(null);
-    foo!void.foo7(null);
-    foo!void.foo7!void(null);
-    foo!void.foo8(null);
-    foo!void.foo8!void(null);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=212
-
-template hasElaborateAssign212(S)
-{
-    enum hasElaborateAssign212 = is(typeof(S.init.opAssign(rvalueOf212!S))) ||
-        is(typeof(lvalueOf212!S)) ;
-}
-
-T rvalueOf212(T)();
-
-T lvalueOf212(T)();
-
-
-template TypeTuple212(TList...)
-{
-    alias TypeTuple212 = TList;
-}
-
-template Tuple212()
-{
-    struct Tuple212
-    {
-        void opAssign(R)(R)
-        {
-            if (hasElaborateAssign212!R)
-            {
-            }
-        }
-    }
-}
-
-ref emplaceRef212()
-{
-    static if (!hasElaborateAssign212!(Tuple212!()))
-        chunk;
-}
-
-class TaskPool212
-{
-    void reduce()
-    {
-        Tuple212!() seed = void;
-        Tuple212!()[] results;
-        foreach(i; TypeTuple212!(0, 1))
-            results[i] = seed;
-    }
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=213
-
-struct S213
-{
-    int4 vec;
-}
-
-void test213()
-{
-    S213 s, b;
-
-    assert(s == b);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=218
-
-struct S218a
-{
-    this(int* pdata_)
-    {
-        pdata = pdata_;
-    }
-
-    void opIndexAssign(int, size_t) { }
-    int* pdata;
-};
-
-struct S218
-{
-    S218a getS218a()
-    {
-        return S218a(data.ptr);
-    }
-
-    int[] data;
-    int[] tab2;
-};
-
-S218 f()
-{
-    S218 r;
-
-    for(int i = 0; i < 1; ++i)
-        r.getS218a()[0] = 0;
-
-    return r;
-}
-
-S218 var;
-
-static this()
-{
-    var = f();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=223
-
-struct S223
-{
-    long[8] field;
-}
-
-class C223
-{
-    long[8] field;
-}
-
-S223 test223_1();
-real test223_2();
-string[long[8]] test223_3();
-C223 test223_4();
-long test223_5();
-long[] test223_6();
-long[8] test223_7();
-C223[8] test223_8();
-void delegate() test223_9();
-
-bool test223()
-{
-    return test223_1() == test223_1() &&
-           test223_1() is test223_1() &&
-           test223_2() == test223_2() &&
-           test223_2() is test223_2() &&
-           test223_3() == test223_3() &&
-           test223_3() is test223_3() &&
-           test223_4() == test223_4() &&
-           test223_4() is test223_4() &&
-           test223_5() == test223_5() &&
-           test223_5() is test223_5() &&
-           test223_6() == test223_6() &&
-           test223_6() is test223_6() &&
-           test223_7() == test223_7() &&
-           test223_7() is test223_7() &&
-           test223_8() == test223_8() &&
-           test223_8() is test223_8() &&
-           test223_9() == test223_9() &&
-           test223_9() is test223_9();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=231
-
-import imports.gdc231;
-
-class Range231 : Widget231
-{
-    override void* getStruct()
-    {
-        return null;
-    }
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=239
-
-import imports.gdc239;
-
-class C239
-{
-    C239a *foo;
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=240
-
-interface I204
-{
-      void f();
-}
-
-class C204 : I204
-{
-      void f();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=241
-
-import imports.gdc241a;
-public import imports.gdc241b : S241, C241, E241, N241;
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=242
-
-struct S242a
-{
-    enum M = S242a();
-    void iter() { }
-}
-
-void test242a()
-{
-    return S242a.M.iter;
-}
-
-struct S242b
-{
-    enum M = S242b();
-    void iter() { }
-}
-
-void test242b()
-{
-    S242b.M.iter;
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=251
-
-import imports.gdc251a;
-import imports.gdc251b : C251;
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=253
-
-import imports.gdc253;
-
-class C253 : C253a
-{
-    void test253() { }
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=255
-
-class C255
-{
-    void f2()
-    {
-        class C1
-        {
-            void f1()
-            {
-                void f0()
-                {
-                    class C0
-                    {
-                        void test255()
-                        {
-                            f2();
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
-
-class C255a
-{
-    void f3()
-    {
-        class C1
-        {
-            void f2()
-            {
-                void f1()
-                {
-                    void f0()
-                    {
-                        class C0
-                        {
-                            void test255a()
-                            {
-                                f3();
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
-
-class C255b
-{
-    void f4()
-    {
-        class C2
-        {
-            void f3()
-            {
-                void f2()
-                {
-                    class C1
-                    {
-                        void f1()
-                        {
-                            void f0()
-                            {
-                                class C0
-                                {
-                                    void test255b()
-                                    {
-                                        f4();
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=256
-
-import imports.gdcpkg256 : gdc256;
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=261
-
-void test261()
-{
-    class C1
-    {
-        void f1()
-        {
-            class C2
-            {
-                void f2()
-                {
-                    auto v = &f1;
-                }
-            }
-        }
-    }
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=280
-
-struct RBNode280
-{
-    RBNode280* _parent;
-
-    @property left(RBNode280*)
-    {
-        _parent = &this;
-    }
-}
-
-class RedBlackTree280
-{
-    RBNode280* _end;
-    RBNode280* _begin;
-
-    this(int[] elems...)
-    {
-        _end = new RBNode280;
-
-        foreach (e; elems)
-        {
-            _end.left = _begin;
-        }
-    }
-}
-
-__gshared s = new RedBlackTree280('h');
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=284
-
-alias v284 = __vector(int[2]);
-
-v284 test284(v284 a, ...)
-{
-    return a + a;
-}
diff --git a/gcc/testsuite/gdc.dg/gdc108.d b/gcc/testsuite/gdc.dg/gdc108.d
new file mode 100644 (file)
index 0000000..dc214e4
--- /dev/null
@@ -0,0 +1,19 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=108
+// { dg-do compile }
+
+import gcc.attribute;
+
+@attribute("forceinline")
+void forceinline108()
+{
+}
+
+@attribute("noinline")
+void noinline108()
+{
+}
+
+@attribute("flatten")
+void flatten108()
+{
+}
diff --git a/gcc/testsuite/gdc.dg/gdc115.d b/gcc/testsuite/gdc.dg/gdc115.d
new file mode 100644 (file)
index 0000000..8eca2eb
--- /dev/null
@@ -0,0 +1,16 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=115
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void main()
+{
+    union U
+    {
+        float f;
+        uint i;
+    }
+    float a = 123.0;
+    const l = U(a);
+
+    assert(l.i == U(a).i);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc121.d b/gcc/testsuite/gdc.dg/gdc121.d
new file mode 100644 (file)
index 0000000..a04a264
--- /dev/null
@@ -0,0 +1,4 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=121
+// { dg-do compile }
+
+immutable char C121 = void; // ICE
diff --git a/gcc/testsuite/gdc.dg/gdc122.d b/gcc/testsuite/gdc.dg/gdc122.d
new file mode 100644 (file)
index 0000000..0f2feef
--- /dev/null
@@ -0,0 +1,36 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=122
+// { dg-do compile }
+
+struct map(alias fun)
+{
+    @property run()
+    {
+    }
+}
+
+struct Task(Args)
+{
+    Args _args;
+}
+
+class TaskPool
+{
+    template reduce(functions...)
+    {
+        auto reduce(Args)(Args args)
+        {
+            alias RTask = Task!(typeof(args));
+            auto task = RTask();
+        }
+    }
+}
+
+TaskPool taskPool() {
+    return new TaskPool;
+}
+
+void test122()
+{
+    enum delta = 1;
+    taskPool.reduce!"a + b"(map!({ immutable x = delta; })());
+}
diff --git a/gcc/testsuite/gdc.dg/gdc127.d b/gcc/testsuite/gdc.dg/gdc127.d
new file mode 100644 (file)
index 0000000..9de85aa
--- /dev/null
@@ -0,0 +1,6 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=127
+// { dg-do compile }
+
+int[0] test127a;     // OK
+int[1][0] test127b;  // OK
+int[0][1] test127c;  // ICE
diff --git a/gcc/testsuite/gdc.dg/gdc131.d b/gcc/testsuite/gdc.dg/gdc131.d
new file mode 100644 (file)
index 0000000..394a909
--- /dev/null
@@ -0,0 +1,15 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=131
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S131
+{
+    this(string ) { }
+    string opAssign(string v) { return v; }
+}
+
+void main()
+{
+    S131[string] s;
+    s["foo"] = "bar";
+}
diff --git a/gcc/testsuite/gdc.dg/gdc133.d b/gcc/testsuite/gdc.dg/gdc133.d
new file mode 100644 (file)
index 0000000..c694db6
--- /dev/null
@@ -0,0 +1,16 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=133
+// { dg-do compile }
+
+void delegate()[] D133;
+
+void test133a(void delegate() dg)
+{
+    D133 ~= dg;
+}
+
+void test133()
+{
+    void nested()
+    {}
+    test133a(&nested);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc141.d b/gcc/testsuite/gdc.dg/gdc141.d
new file mode 100644 (file)
index 0000000..9a3d5c5
--- /dev/null
@@ -0,0 +1,14 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=141
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+bool test141(int a)
+{
+    return a > (a + 1);
+}
+
+void main()
+{
+    assert(test141(int.min) == false);
+    assert(test141(int.max) == true);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc142.d b/gcc/testsuite/gdc.dg/gdc142.d
new file mode 100644 (file)
index 0000000..92cf505
--- /dev/null
@@ -0,0 +1,15 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=142
+// { dg-do compile }
+
+import gcc.attribute;
+
+@attribute("noinline")
+int test142a()()
+{
+    return 142;
+}
+
+void test142()
+{
+    enum E142 = test142a();
+}
diff --git a/gcc/testsuite/gdc.dg/gdc15.d b/gcc/testsuite/gdc.dg/gdc15.d
new file mode 100644 (file)
index 0000000..935a428
--- /dev/null
@@ -0,0 +1,35 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=15
+// { dg-do compile }
+
+template map(fun...)
+{
+    auto map(Range)(Range r)
+    {
+        return MapResult!(fun, Range)(r);
+    }
+}
+
+private struct MapResult(alias fun, Range)
+{
+    Range _input;
+
+    this(Range input)
+    {
+        _input = input;
+    }
+}
+
+class B
+{
+    class A { }
+    A a;
+}
+
+class C
+{
+    void visit(B b)
+    {
+        auto as = [b.a];
+        map!((d) { return d; })(as);
+    }
+}
diff --git a/gcc/testsuite/gdc.dg/gdc17.d b/gcc/testsuite/gdc.dg/gdc17.d
new file mode 100644 (file)
index 0000000..0fd5847
--- /dev/null
@@ -0,0 +1,37 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=17
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+/**
+ * Parameters are not copied into a frame to be accessed from
+ * the method's __require function.
+ */
+void contractTest(string path)
+{
+    assert(path[0] == 't');
+    assert(path.length == 9);
+    assert(path[8] == 'i');
+}
+
+interface ModuleSaver
+{
+    void save(string str)
+    in
+    {
+        contractTest(str);
+    }
+}
+
+class ModuleWriter : ModuleSaver
+{
+    void save (string str)
+    in {}
+    do
+    {
+    }
+}
+
+void main()
+{
+  (new ModuleWriter()).save ("test.0.mci");
+}
diff --git a/gcc/testsuite/gdc.dg/gdc170.d b/gcc/testsuite/gdc.dg/gdc170.d
new file mode 100644 (file)
index 0000000..a63db31
--- /dev/null
@@ -0,0 +1,21 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=170
+// { dg-options "-I $srcdir/gdc.dg" }
+// { dg-do compile }
+
+import imports.gdc170;
+
+void test170()
+{
+    foo!void.foo1!void();
+    foo!void.foo2!void();
+    foo!void.foo3();
+    foo!void.foo3!void();
+    foo!void.foo4();
+    foo!void.foo4!void();
+    foo!void.foo5!void(null);
+    foo!void.foo6!void(null);
+    foo!void.foo7(null);
+    foo!void.foo7!void(null);
+    foo!void.foo8(null);
+    foo!void.foo8!void(null);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc171.d b/gcc/testsuite/gdc.dg/gdc171.d
new file mode 100644 (file)
index 0000000..f8b7fde
--- /dev/null
@@ -0,0 +1,38 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=171
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void test171a()
+{
+    int count = 0;
+    short a = -1;
+    while (a != 0)
+    {
+        a >>>= 1;
+        count++;
+        assert(count <= 16);
+    }
+}
+
+void test171b()
+{
+    uint[3] lhs = [99, 201, 300],
+            rhs = [-1, 0, 0];
+    long t = 0;
+
+    for (int i = 0; i < 3; i++)
+    {
+        t += lhs[i];
+        t -= rhs[i];
+        lhs[i] = cast(uint) t;
+        t >>= uint.sizeof * 8;
+    }
+
+    assert(lhs == [100, 200, 300]);
+}
+
+void main()
+{
+    test171a();
+    test171b();
+}
diff --git a/gcc/testsuite/gdc.dg/gdc179.d b/gcc/testsuite/gdc.dg/gdc179.d
new file mode 100644 (file)
index 0000000..72fe0b7
--- /dev/null
@@ -0,0 +1,32 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=179
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+import core.stdc.stdio;
+
+struct S179a
+{
+    @disable this(this);
+}
+
+struct S179b
+{
+    S179a s1;
+    void connect() { printf("this=%p\n", &this); }
+}
+
+class C179
+{
+    private S179b s2;
+    ref S179b value() @property
+    {
+        printf("this=%p\n", &s2);
+        return s2;
+    }
+}
+
+void main()
+{
+    C179 a = new C179;
+    a.value.connect();
+}
diff --git a/gcc/testsuite/gdc.dg/gdc183.d b/gcc/testsuite/gdc.dg/gdc183.d
new file mode 100644 (file)
index 0000000..aa8a79c
--- /dev/null
@@ -0,0 +1,60 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=183
+// { dg-do compile }
+
+struct S183a
+{
+    union I183a
+    {
+        struct
+        {
+            double x, y, z;
+        }
+        struct
+        {
+            double a, b, c;
+        }
+    }
+
+    I183a inner;
+
+    this(double x, double y, double z)
+    {
+        this.inner.x = x;
+        this.inner.y = y;
+        this.inner.z = z;
+    }
+}
+
+struct S183b
+{
+    @property get()
+    {
+        union Buf
+        {
+            void[0] result;
+        }
+        const Buf buf = { };
+        return buf.result;
+    }
+}
+
+struct S183c
+{
+    @property get()
+    {
+        union Buf
+        {
+            TypeInfo info;
+            void[0] result;
+        }
+        const Buf buf = { };
+        return buf.result;
+    }
+}
+
+void test183()
+{
+    auto v1 = S183a(0, 0, 0);
+    auto v2 = S183b().get;
+    auto v3 = S183c().get;
+}
diff --git a/gcc/testsuite/gdc.dg/gdc186.d b/gcc/testsuite/gdc.dg/gdc186.d
new file mode 100644 (file)
index 0000000..4a1a91a
--- /dev/null
@@ -0,0 +1,60 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=186
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S186
+{
+    union
+    {
+        struct
+        {
+            ubyte fieldA;
+            byte  fieldB = -1;
+            byte fieldC = -1;
+        }
+        size_t _complete;
+    }
+
+    this(size_t complete)
+    {
+        this._complete = complete;
+    }
+}
+
+static if (size_t.sizeof == 8)
+    enum checkval = 0x0200000000000002;
+else
+    enum checkval = 0x02000002;
+
+void check186(in S186 obj, byte fieldB)
+{
+    assert(obj.fieldA == 2);
+    assert(obj.fieldB == 0);
+    assert(obj.fieldC == 0);
+    assert(obj._complete == checkval);
+    assert(fieldB == 0);
+}
+
+void test186(size_t val)
+{
+    S186 obj = S186(val);
+    check186(obj, obj.fieldB);
+
+    assert(obj.fieldA == 2);
+    assert(obj.fieldB == 0);
+    assert(obj.fieldC == 0);
+    assert(obj._complete == checkval);
+
+    obj = S186(val);
+    check186(obj, obj.fieldB);
+
+    assert(obj.fieldA == 2);
+    assert(obj.fieldB == 0);
+    assert(obj.fieldC == 0);
+    assert(obj._complete == checkval);
+}
+
+void main()
+{
+    test186(checkval);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc187.d b/gcc/testsuite/gdc.dg/gdc187.d
new file mode 100644 (file)
index 0000000..2f469ad
--- /dev/null
@@ -0,0 +1,40 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=187
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+align(1) struct S187b
+{
+    align(1)
+    {
+        uint unpaddedA;
+        ushort unpaddedB;
+    }
+}
+
+struct S187a
+{
+    S187b[3] unpaddedArray;
+    ubyte wontInitialize = ubyte.init;
+}
+
+struct S187
+{
+    S187a interesting;
+}
+
+
+void prepareStack()
+{
+    byte[255] stackGarbage;
+    foreach(i, ref b; stackGarbage)
+    {
+        b  = cast(byte)(-i);
+    }
+}
+
+void main()
+{
+    prepareStack();
+    auto a = S187(S187a());
+    assert(a.interesting.wontInitialize == 0);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc19.d b/gcc/testsuite/gdc.dg/gdc19.d
new file mode 100644 (file)
index 0000000..c461e9f
--- /dev/null
@@ -0,0 +1,8 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=19
+// { dg-do compile }
+
+void test19()
+{
+   byte b;
+   --b = b;
+}
diff --git a/gcc/testsuite/gdc.dg/gdc191.d b/gcc/testsuite/gdc.dg/gdc191.d
new file mode 100644 (file)
index 0000000..4d2ca9d
--- /dev/null
@@ -0,0 +1,201 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=191
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+class C191
+{
+    int count = 0;
+
+    void testA()
+    {
+        class Inner
+        {
+            void test()
+            {
+                void localFunction()
+                {
+                    if (++count != 5)
+                        testA();
+                }
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testB()
+    {
+        class Inner
+        {
+            void test()
+            {
+                void localFunction()
+                {
+                    void anotherLocalFunction()
+                    {
+                        if (++count != 10)
+                            testB();
+                    }
+                    anotherLocalFunction();
+                }
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testC()
+    {
+        class Inner
+        {
+            int a = 1;
+
+            void test()
+            {
+                void localFunction()
+                {
+                    count += a;
+                    if (count != 15)
+                        testC();
+                    assert(a == 1);
+                }
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testD()
+    {
+        class Inner
+        {
+            void test()
+            {
+                int a = 1;
+
+                void localFunction()
+                {
+                    count += a;
+                    if (count != 20)
+                        testD();
+                    assert(a == 1);
+                }
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testE()
+    {
+        class Inner
+        {
+            int a = 1;
+
+            void test()
+            {
+                void localFunction()
+                {
+                    void anotherLocalFunction()
+                    {
+                        count += a;
+                        if (count != 25)
+                            testE();
+                        assert(a == 1);
+                    }
+
+                    anotherLocalFunction();
+                }
+
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testF()
+    {
+        class Inner
+        {
+            void test()
+            {
+                int a = 1;
+
+                void localFunction()
+                {
+                    void anotherLocalFunction()
+                    {
+                        count += a;
+                        if (count != 30)
+                            testF();
+                        assert(a == 1);
+                    }
+
+                    anotherLocalFunction();
+                }
+
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testG()
+    {
+        class Inner
+        {
+            void test()
+            {
+                void localFunction()
+                {
+                    int a = 1;
+
+                    void anotherLocalFunction()
+                    {
+                        count += a;
+                        if (count != 35)
+                            testG();
+                        assert(a == 1);
+                    }
+
+                    anotherLocalFunction();
+                }
+
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+}
+
+void main()
+{
+    scope oc = new C191();
+    oc.testA();
+    assert(oc.count == 5);
+
+    oc.testB();
+    assert(oc.count == 10);
+
+    oc.testC();
+    assert(oc.count == 15);
+
+    oc.testD();
+    assert(oc.count == 20);
+
+    oc.testE();
+    assert(oc.count == 25);
+
+    oc.testF();
+    assert(oc.count == 30);
+
+    oc.testG();
+    assert(oc.count == 35);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc194.d b/gcc/testsuite/gdc.dg/gdc194.d
new file mode 100644 (file)
index 0000000..6802895
--- /dev/null
@@ -0,0 +1,9 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=194
+// { dg-do compile }
+
+auto test194(ref bool overflow)
+{
+    import core.checkedint;
+
+    return adds(1, 1, overflow);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc196.d b/gcc/testsuite/gdc.dg/gdc196.d
new file mode 100644 (file)
index 0000000..750cef8
--- /dev/null
@@ -0,0 +1,21 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=196
+// { dg-do assemble }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+class C196
+{
+    int a;
+}
+
+struct S196
+{
+    int a;
+}
+
+void test196()
+{
+    __gshared c = new C196();
+    __gshared s = new S196(0);
+    c.a = 1;
+    s.a = 1;
+}
diff --git a/gcc/testsuite/gdc.dg/gdc198.d b/gcc/testsuite/gdc.dg/gdc198.d
new file mode 100644 (file)
index 0000000..09daf85
--- /dev/null
@@ -0,0 +1,71 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=198
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S198a
+{
+    union
+    {
+        float[3] v;
+        struct
+        {
+            float x;
+            float y;
+            float z;
+        }
+    }
+
+    this(float x_, float y_, float z_)
+    {
+        x = x_;
+        y = y_;
+        z = z_;
+    }
+
+    ref S198a opOpAssign(string op)(S198a operand)
+    if (op == "+")
+    {
+        x += operand.x;
+        y += operand.y;
+        z += operand.z;
+        return this;
+    }
+}
+
+struct S198b
+{
+    @property get()
+    {
+        union Buf
+        {
+            void[0] result;
+        }
+        const Buf buf = { };
+        return buf.result;
+    }
+}
+
+struct S198c
+{
+    @property get()
+    {
+        union Buf
+        {
+            TypeInfo info;
+            void[0] result;
+        }
+        const Buf buf = { };
+        return buf.result;
+    }
+}
+
+
+void main()
+{
+    S198a sum = S198a(0, 0, 0);
+
+    foreach(size_t v; 0 .. 3)
+        sum += S198a(1, 2, 3);
+
+    assert(sum.v == [3, 6, 9]);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc200.d b/gcc/testsuite/gdc.dg/gdc200.d
new file mode 100644 (file)
index 0000000..585d60f
--- /dev/null
@@ -0,0 +1,16 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=200
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void test200a(double x, double y)
+{
+  const double y2 = x + 1.0;
+  assert(y == y2);
+}
+
+void main()
+{
+  const double x = .012;
+  const double y = x + 1.0;
+  test200a(x, y);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc204.d b/gcc/testsuite/gdc.dg/gdc204.d
new file mode 100644 (file)
index 0000000..5c7554f
--- /dev/null
@@ -0,0 +1,12 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=204
+// { dg-do compile }
+
+interface I204
+{
+      void f();
+}
+
+class C204 : I204
+{
+      void f();
+}
diff --git a/gcc/testsuite/gdc.dg/gdc210.d b/gcc/testsuite/gdc.dg/gdc210.d
new file mode 100644 (file)
index 0000000..0f56073
--- /dev/null
@@ -0,0 +1,62 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=210
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S210
+{
+    ubyte a;
+    uint b;
+}
+
+union U210
+{
+    S210 a;
+    uint b;
+}
+
+S210 test210a()
+{
+    S210 s = S210(1, 2);
+    return s;
+}
+
+S210[2] test210b()
+{
+    S210[2] s = [S210(1, 2), S210(3, 4)];
+    return s;
+}
+
+U210 test210c()
+{
+    U210 s = U210(S210(1, 2));
+    return s;
+}
+
+U210[2] test210d()
+{
+    U210[2] s = [U210(S210(1, 2)), U210(S210(3, 4))];
+    return s;
+}
+
+void main()
+{
+    S210 a = S210(1, 2);
+    assert(a == S210(1, 2));
+    assert(a == test210a());
+    assert(a != S210(2, 1));
+
+    S210[2] b = [S210(1, 2), S210(3, 4)];
+    assert(b == [S210(1, 2), S210(3, 4)]);
+    assert(b == test210b());
+    assert(b != [S210(2, 1), S210(3, 4)]);
+
+    U210 c = U210(S210(1, 2));
+    assert(c == U210(S210(1, 2)));
+    assert(c == test210c());
+    assert(c != U210(S210(2, 1)));
+
+    U210[2] d = [U210(S210(1, 2)), U210(S210(3, 4))];
+    assert(d == [U210(S210(1, 2)), U210(S210(3, 4))]);
+    assert(d == test210d());
+    assert(d != [U210(S210(2, 1)), U210(S210(3, 4))]);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc212.d b/gcc/testsuite/gdc.dg/gdc212.d
new file mode 100644 (file)
index 0000000..417c1fc
--- /dev/null
@@ -0,0 +1,48 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=212
+// { dg-do compile }
+
+template hasElaborateAssign212(S)
+{
+    enum hasElaborateAssign212 = is(typeof(S.init.opAssign(rvalueOf212!S))) ||
+        is(typeof(lvalueOf212!S)) ;
+}
+
+T rvalueOf212(T)();
+
+T lvalueOf212(T)();
+
+
+template TypeTuple212(TList...)
+{
+    alias TypeTuple212 = TList;
+}
+
+template Tuple212()
+{
+    struct Tuple212
+    {
+        void opAssign(R)(R)
+        {
+            if (hasElaborateAssign212!R)
+            {
+            }
+        }
+    }
+}
+
+ref emplaceRef212()
+{
+    static if (!hasElaborateAssign212!(Tuple212!()))
+        chunk;
+}
+
+class TaskPool212
+{
+    void reduce()
+    {
+        Tuple212!() seed = void;
+        Tuple212!()[] results;
+        foreach(i; TypeTuple212!(0, 1))
+            results[i] = seed;
+    }
+}
diff --git a/gcc/testsuite/gdc.dg/gdc213.d b/gcc/testsuite/gdc.dg/gdc213.d
new file mode 100644 (file)
index 0000000..11e5c63
--- /dev/null
@@ -0,0 +1,17 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=213
+// { dg-options "-Wno-psabi" }
+// { dg-do compile }
+
+import core.simd;
+
+struct S213
+{
+    int4 vec;
+}
+
+void test213()
+{
+    S213 s, b;
+
+    assert(s == b);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc218.d b/gcc/testsuite/gdc.dg/gdc218.d
new file mode 100644 (file)
index 0000000..3e7eb16
--- /dev/null
@@ -0,0 +1,41 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=218
+// { dg-do compile }
+
+struct S218a
+{
+    this(int* pdata_)
+    {
+        pdata = pdata_;
+    }
+
+    void opIndexAssign(int, size_t) { }
+    int* pdata;
+};
+
+struct S218
+{
+    S218a getS218a()
+    {
+        return S218a(data.ptr);
+    }
+
+    int[] data;
+    int[] tab2;
+};
+
+S218 f()
+{
+    S218 r;
+
+    for(int i = 0; i < 1; ++i)
+        r.getS218a()[0] = 0;
+
+    return r;
+}
+
+S218 var;
+
+static this()
+{
+    var = f();
+}
diff --git a/gcc/testsuite/gdc.dg/gdc223.d b/gcc/testsuite/gdc.dg/gdc223.d
new file mode 100644 (file)
index 0000000..a5a9dcc
--- /dev/null
@@ -0,0 +1,43 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=223
+// { dg-do compile }
+
+struct S223
+{
+    long[8] field;
+}
+
+class C223
+{
+    long[8] field;
+}
+
+S223 test223_1();
+real test223_2();
+string[long[8]] test223_3();
+C223 test223_4();
+long test223_5();
+long[] test223_6();
+long[8] test223_7();
+C223[8] test223_8();
+void delegate() test223_9();
+
+bool test223()
+{
+    return test223_1() == test223_1() &&
+           test223_1() is test223_1() &&
+           test223_2() == test223_2() &&
+           test223_2() is test223_2() &&
+           test223_3() == test223_3() &&
+           test223_3() is test223_3() &&
+           test223_4() == test223_4() &&
+           test223_4() is test223_4() &&
+           test223_5() == test223_5() &&
+           test223_5() is test223_5() &&
+           test223_6() == test223_6() &&
+           test223_6() is test223_6() &&
+           test223_7()[] is test223_7()[] &&
+           test223_8() == test223_8() &&
+           test223_8()[] is test223_8()[] &&
+           test223_9() == test223_9() &&
+           test223_9() is test223_9();
+}
diff --git a/gcc/testsuite/gdc.dg/gdc231.d b/gcc/testsuite/gdc.dg/gdc231.d
new file mode 100644 (file)
index 0000000..f029fc0
--- /dev/null
@@ -0,0 +1,13 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=231
+// { dg-additional-sources "imports/gdc231.d" }
+// { dg-do compile }
+
+import imports.gdc231;
+
+class Range231 : Widget231
+{
+    override void* getStruct()
+    {
+        return null;
+    }
+}
diff --git a/gcc/testsuite/gdc.dg/gdc239.d b/gcc/testsuite/gdc.dg/gdc239.d
new file mode 100644 (file)
index 0000000..0fcc82e
--- /dev/null
@@ -0,0 +1,10 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=239
+// { dg-options "-I $srcdir/gdc.dg" }
+// { dg-do compile }
+
+import imports.gdc239;
+
+class C239
+{
+    C239a *foo;
+}
diff --git a/gcc/testsuite/gdc.dg/gdc24.d b/gcc/testsuite/gdc.dg/gdc24.d
new file mode 100644 (file)
index 0000000..b61aae4
--- /dev/null
@@ -0,0 +1,15 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=24
+// { dg-do compile }
+
+void test24()
+{
+    struct S24
+    {
+        char[1] b;
+    }
+
+    S24 a;
+
+    if (*a.b.ptr)
+        return;
+}
diff --git a/gcc/testsuite/gdc.dg/gdc240.d b/gcc/testsuite/gdc.dg/gdc240.d
new file mode 100644 (file)
index 0000000..76f6dcf
--- /dev/null
@@ -0,0 +1,16 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=240
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void test240(int a, int b)
+{
+    assert(a == 0);
+    assert(b == 0);
+}
+
+void main()
+{
+    int a = 0;
+    test240(a, a++);
+    assert(a == 1);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc241.d b/gcc/testsuite/gdc.dg/gdc241.d
new file mode 100644 (file)
index 0000000..964d81e
--- /dev/null
@@ -0,0 +1,6 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=241
+// { dg-options "-I $srcdir/gdc.dg" }
+// { dg-do compile }
+
+import imports.gdc241a;
+public import imports.gdc241b : S241, C241, E241, N241;
diff --git a/gcc/testsuite/gdc.dg/gdc242a.d b/gcc/testsuite/gdc.dg/gdc242a.d
new file mode 100644 (file)
index 0000000..1448682
--- /dev/null
@@ -0,0 +1,24 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=242
+// { dg-do compile }
+
+struct S242a
+{
+    enum M = S242a();
+    void iter() { }
+}
+
+void test242a()
+{
+    return S242a.M.iter;
+}
+
+struct S242b
+{
+    enum M = S242b();
+    void iter() { }
+}
+
+void test242b()
+{
+    S242b.M.iter;
+}
diff --git a/gcc/testsuite/gdc.dg/gdc242b.d b/gcc/testsuite/gdc.dg/gdc242b.d
new file mode 100644 (file)
index 0000000..cfba4b4
--- /dev/null
@@ -0,0 +1,25 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=242
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S242
+{
+    enum M = S242();
+    int a = 42;
+
+    auto iter()
+    {
+        this.a = 24;
+        return this;
+    }
+}
+
+S242 test242()
+{
+    return S242.M.iter;
+}
+
+void main()
+{
+    assert(test242() == S242(24));
+}
diff --git a/gcc/testsuite/gdc.dg/gdc248.d b/gcc/testsuite/gdc.dg/gdc248.d
new file mode 100644 (file)
index 0000000..0fd0277
--- /dev/null
@@ -0,0 +1,44 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=248
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+class C248b
+{
+    bool isintegral()
+    {
+        return false;
+    }
+}
+
+class C248a
+{
+    int count = 0;
+
+    C248b getMemtype()
+    {
+        count++;
+        return new C248b();
+    }
+}
+
+class C248
+{
+    C248a sym;
+
+    this()
+    {
+        this.sym = new C248a();
+    }
+
+    bool isintegral()
+    {
+        return sym.getMemtype().isintegral();
+    }
+}
+
+void main()
+{
+    C248 e = new C248();
+    e.isintegral();
+    assert(e.sym.count == 1);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc250.d b/gcc/testsuite/gdc.dg/gdc250.d
new file mode 100644 (file)
index 0000000..c8182da
--- /dev/null
@@ -0,0 +1,18 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=250
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void main()
+{
+    struct S
+    {
+        string data;
+    }
+
+    auto a = S("hello");
+    auto b = S("hello".dup);
+
+    assert(a.data == b.data);
+    assert(a == b);
+    assert([a] == [b]);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc251.d b/gcc/testsuite/gdc.dg/gdc251.d
new file mode 100644 (file)
index 0000000..2e9f18c
--- /dev/null
@@ -0,0 +1,6 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=251
+// { dg-options "-I $srcdir/gdc.dg" }
+// { dg-do compile }
+
+import imports.gdc251a;
+import imports.gdc251b : C251;
diff --git a/gcc/testsuite/gdc.dg/gdc253a.d b/gcc/testsuite/gdc.dg/gdc253a.d
new file mode 100644 (file)
index 0000000..2439721
--- /dev/null
@@ -0,0 +1,10 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=253
+// { dg-additional-sources "imports/gdc253a.d" }
+// { dg-do compile }
+
+import imports.gdc253a;
+
+class C253 : C253a
+{
+    void test253() { }
+}
diff --git a/gcc/testsuite/gdc.dg/gdc253b.d b/gcc/testsuite/gdc.dg/gdc253b.d
new file mode 100644 (file)
index 0000000..916932d
--- /dev/null
@@ -0,0 +1,19 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=253
+// { dg-additional-sources "imports/gdc253b.d" }
+// { dg-options "-I $srcdir/gdc.dg" }
+// { dg-do compile }
+
+import imports.gdc253b;
+
+interface A253
+{
+    void test253(int[int]);
+}
+
+interface C253 : A253
+{
+}
+
+class D253 : B253, C253
+{
+}
diff --git a/gcc/testsuite/gdc.dg/gdc255.d b/gcc/testsuite/gdc.dg/gdc255.d
new file mode 100644 (file)
index 0000000..8070f8e
--- /dev/null
@@ -0,0 +1,83 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=255
+// { dg-do compile }
+
+class C255
+{
+    void f2()
+    {
+        class C1
+        {
+            void f1()
+            {
+                void f0()
+                {
+                    class C0
+                    {
+                        void test255()
+                        {
+                            f2();
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+
+class C255a
+{
+    void f3()
+    {
+        class C1
+        {
+            void f2()
+            {
+                void f1()
+                {
+                    void f0()
+                    {
+                        class C0
+                        {
+                            void test255a()
+                            {
+                                f3();
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+
+class C255b
+{
+    void f4()
+    {
+        class C2
+        {
+            void f3()
+            {
+                void f2()
+                {
+                    class C1
+                    {
+                        void f1()
+                        {
+                            void f0()
+                            {
+                                class C0
+                                {
+                                    void test255b()
+                                    {
+                                        f4();
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.dg/gdc256.d b/gcc/testsuite/gdc.dg/gdc256.d
new file mode 100644 (file)
index 0000000..89b1aad
--- /dev/null
@@ -0,0 +1,5 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=256
+// { dg-options "-I $srcdir/gdc.dg" }
+// { dg-do compile }
+
+import imports.gdcpkg256 : gdc256;
diff --git a/gcc/testsuite/gdc.dg/gdc261.d b/gcc/testsuite/gdc.dg/gdc261.d
new file mode 100644 (file)
index 0000000..593e5fe
--- /dev/null
@@ -0,0 +1,19 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=261
+// { dg-do compile }
+
+void test261()
+{
+    class C1
+    {
+        void f1()
+        {
+            class C2
+            {
+                void f2()
+                {
+                    auto v = &f1;
+                }
+            }
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.dg/gdc27.d b/gcc/testsuite/gdc.dg/gdc27.d
new file mode 100644 (file)
index 0000000..d0ff61e
--- /dev/null
@@ -0,0 +1,18 @@
+// { dg-options "-I $srcdir/gdc.dg/imports" }
+// { dg-additional-sources "imports/gdc27.d" }
+// { dg-do compile }
+
+/******************************************/
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=27
+
+import imports.gdc27;
+
+interface I_B : I_A
+{
+    void b();
+}
+
+abstract class C_B : C_A, I_B
+{
+    abstract void b();
+}
diff --git a/gcc/testsuite/gdc.dg/gdc273.d b/gcc/testsuite/gdc.dg/gdc273.d
new file mode 100644 (file)
index 0000000..b5d2b10
--- /dev/null
@@ -0,0 +1,19 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=273
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+class B273
+{
+    B273[] members;
+}
+
+class D273 : B273
+{
+}
+
+void main()
+{
+    auto noPointers = ClassInfo.ClassFlags.noPointers;
+    assert((B273.classinfo.m_flags & noPointers) == 0);
+    assert((D273.classinfo.m_flags & noPointers) == 0);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc280.d b/gcc/testsuite/gdc.dg/gdc280.d
new file mode 100644 (file)
index 0000000..5be3af7
--- /dev/null
@@ -0,0 +1,30 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=280
+// { dg-do compile }
+
+struct RBNode280
+{
+    RBNode280* _parent;
+
+    @property left(RBNode280*)
+    {
+        _parent = &this;
+    }
+}
+
+class RedBlackTree280
+{
+    RBNode280* _end;
+    RBNode280* _begin;
+
+    this(int[] elems...)
+    {
+        _end = new RBNode280;
+
+        foreach (e; elems)
+        {
+            _end.left = _begin;
+        }
+    }
+}
+
+__gshared s = new RedBlackTree280('h');
diff --git a/gcc/testsuite/gdc.dg/gdc284.d b/gcc/testsuite/gdc.dg/gdc284.d
new file mode 100644 (file)
index 0000000..c885428
--- /dev/null
@@ -0,0 +1,10 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=284
+// { dg-options "-Wno-psabi" }
+// { dg-do compile }
+
+alias v284 = __vector(int[2]);
+
+v284 test284(v284 a, ...)
+{
+    return a + a;
+}
diff --git a/gcc/testsuite/gdc.dg/gdc285.d b/gcc/testsuite/gdc.dg/gdc285.d
new file mode 100644 (file)
index 0000000..f94ffb5
--- /dev/null
@@ -0,0 +1,15 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=285
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+inout(char)[] test285(inout(char)* s) @nogc @system pure nothrow
+{
+    import core.stdc.string : strlen;
+    return s ? s[0 .. strlen(s)] : null;
+}
+
+void main()
+{
+    assert(test285(null) == null);
+    assert(test285("foo") == "foo");
+}
diff --git a/gcc/testsuite/gdc.dg/gdc286.d b/gcc/testsuite/gdc.dg/gdc286.d
new file mode 100644 (file)
index 0000000..2536ef6
--- /dev/null
@@ -0,0 +1,37 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=286
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void main()
+{
+    struct K286
+    {
+        int count;
+        this(this)
+        {
+            count++;
+        }
+    }
+
+    struct S286
+    {
+        int data;
+        this(K286 key)
+        {
+            data = key.count;
+        }
+    }
+
+    S286 getData(K286 key)
+    {
+        static S286[K286] getCache;
+        auto p = key in getCache;
+        if (p)
+            return *p;
+        return (getCache[key] = S286(key));
+    }
+
+    auto s = getData(K286());
+    if (s.data == 0)
+        assert(0);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc300.d b/gcc/testsuite/gdc.dg/gdc300.d
new file mode 100644 (file)
index 0000000..d1aae59
--- /dev/null
@@ -0,0 +1,25 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=300
+// { dg-additional-options "-fmain" }
+// { dg-do link { target d_runtime_has_std_library } }
+
+struct S300(Range)
+{
+    double test(size_t remaining)
+    {
+        double r;
+        return r ^^ remaining;
+    }
+}
+
+auto link300a(Range)(Range)
+{
+    return S300!(Range)();
+}
+
+void link300()
+{
+    struct I {}
+    static assert(is(typeof(link300a(I())) == struct));
+    auto sample = link300a(I());
+    sample.test(5);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc309.d b/gcc/testsuite/gdc.dg/gdc309.d
new file mode 100644 (file)
index 0000000..bbcb6e7
--- /dev/null
@@ -0,0 +1,41 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=309
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void main()
+{
+    creal f1 = +0.0 + 0.0i;
+    creal f2 = +0.0 - 0.0i;
+    creal f3 = -0.0 + 0.0i;
+    creal f4 = +0.0 + 0.0i;
+
+    assert(f1 !is f2);
+    assert(f1 !is f3);
+    assert(f2 !is f3);
+    assert(f1 is f4);
+
+    assert(!(f1 is f2));
+    assert(!(f1 is f3));
+    assert(!(f2 is f3));
+    assert(!(f1 !is f4));
+
+    struct CReal
+    {
+        creal value;
+    }
+
+    CReal s1 = CReal(+0.0 + 0.0i);
+    CReal s2 = CReal(+0.0 - 0.0i);
+    CReal s3 = CReal(-0.0 + 0.0i);
+    CReal s4 = CReal(+0.0 + 0.0i);
+
+    assert(s1 !is s2);
+    assert(s1 !is s3);
+    assert(s2 !is s3);
+    assert(s1 is s4);
+
+    assert(!(s1 is s2));
+    assert(!(s1 is s3));
+    assert(!(s2 is s3));
+    assert(!(s1 !is s4));
+}
diff --git a/gcc/testsuite/gdc.dg/gdc31.d b/gcc/testsuite/gdc.dg/gdc31.d
new file mode 100644 (file)
index 0000000..97dc88d
--- /dev/null
@@ -0,0 +1,25 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=31
+// { dg-do compile }
+
+class RedBlackTree(T, alias less)
+{
+    struct Range
+    {
+        @property empty() { }
+    }
+
+    Range opSlice()
+    {
+        return Range();
+    }
+}
+
+auto redBlackTree(alias less, E)()
+{
+    return new RedBlackTree!(E, less);
+}
+
+void test31()
+{
+    redBlackTree!((a){}, double)();
+}
diff --git a/gcc/testsuite/gdc.dg/gdc35.d b/gcc/testsuite/gdc.dg/gdc35.d
new file mode 100644 (file)
index 0000000..773a78a
--- /dev/null
@@ -0,0 +1,73 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=35
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+/**
+ * Here the BinaryHeap instance uses an alias parameter and therefore
+ * the instance's functions (percolateDown) need to be generated in
+ * topNIndex->BinaryHeap scope and not in the declaration scope
+ * (module->BinaryHeap).
+ */
+void topNIndex()()
+{
+    bool indirectLess(int a, int b)
+    {
+        return a > b;
+    }
+
+    auto a = BinaryHeap!(indirectLess)();
+}
+
+struct BinaryHeap(alias less)
+{
+    void percolateDown()
+    {
+        less(0, 1);
+    }
+}
+
+void test35a()
+{
+    topNIndex();
+}
+
+/*
+ * Similar as test35a but with an additional indirection.
+ * The nested function chain for percolateDown should look like this:
+ * topNIndex2->BinaryHeap2->percolateDown.
+ */
+void topNIndex2()()
+{
+    bool indirectLess(int a, int b)
+    {
+        return a > b;
+    }
+    auto a = BinaryHeap2!(S35b!(indirectLess)())();
+}
+
+struct S35b(alias a)
+{
+    void foo()
+    {
+        a(0, 0);
+    }
+}
+
+struct BinaryHeap2(alias less)
+{
+    void percolateDown()
+    {
+        less.foo();
+    }
+}
+
+void test35b()
+{
+    topNIndex2();
+}
+
+void main()
+{
+    test35a();
+    test35b();
+}
diff --git a/gcc/testsuite/gdc.dg/gdc36.d b/gcc/testsuite/gdc.dg/gdc36.d
new file mode 100644 (file)
index 0000000..fbb876c
--- /dev/null
@@ -0,0 +1,125 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=36
+// { dg-additional-sources "imports/gdc36.d" }
+// { dg-options "-I $srcdir/gdc.dg" }
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+module gdc36;
+
+import imports.gdc36;
+
+/**
+ * Here getChar is a function in a template where template.isnested == false
+ * but getChar still is a nested function and needs to get a static chain
+ * containing test36a.
+ */
+void test36a()(char val)
+{
+    void error()
+    {
+    }
+
+    void getChar()()
+    {
+        error();
+    }
+
+    void parseString()
+    {
+        getChar();
+    }
+}
+
+/**
+ * Similar as test36a, but a little more complicated:
+ * Here getChar is nested in a struct template which is nested in a function.
+ * getChar's static chain still needs to contain test36b.
+ */
+void test36b()(char val)
+{
+    void error()
+    {
+    }
+
+    struct S(T)
+    {
+        void getChar()
+        {
+            error();
+        }
+    }
+
+
+    void parseString()
+    {
+        S!(int)().getChar();
+    }
+}
+
+/**
+ * If g had accessed a, the frontend would have generated a closure.
+ *
+ * As we do not access it, there's no closure. We have to be careful
+ * not to set a static chain for g containing test36c_1 though,
+ * as g can be called from outside (here from test1c). In the end
+ * we have to treat this as if everything in test36c_1 was declared
+ * at module scope.
+ */
+auto test36c_1()
+{
+    int a;
+    void c() {}
+    class Result
+    {
+        int b;
+        void g() { c(); /*a = 42;*/ }
+    }
+
+    return new Result();
+}
+
+void test36c()
+{
+    test36c_1().g();
+}
+
+/**
+ * empty is a (private) function which is nested in lightPostprocess.
+ * At the same time it's a template instance, so it has to be declared as
+ * weak or otherwise one-only. imports/gdc36.d creates another instance
+ * of Regex!char to verify that.
+ */
+struct Parser(R)
+{
+    @property program()
+    {
+        return Regex!char();
+    }
+}
+
+struct Regex(Char)
+{
+    @trusted lightPostprocess()
+    {
+        struct FixedStack(T)
+        {
+            @property empty() { return false; }
+        }
+        auto counterRange = FixedStack!uint();
+    }
+}
+
+void test36d()
+{
+    auto parser = Parser!(char[])();
+    imports.gdc36.test36d_1;
+}
+
+void main()
+{
+  test36a('n');
+  test36b('n');
+  test36c();
+  test36d();
+}
+
diff --git a/gcc/testsuite/gdc.dg/gdc37.d b/gcc/testsuite/gdc.dg/gdc37.d
new file mode 100644 (file)
index 0000000..171ace5
--- /dev/null
@@ -0,0 +1,16 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=37
+// { dg-do compile }
+
+struct S37
+{
+    int bar(const S37 s)
+    {
+        return 0;
+    }
+}
+
+int test37()
+{
+    S37 s;
+    return s.bar(s);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc4.d b/gcc/testsuite/gdc.dg/gdc4.d
new file mode 100644 (file)
index 0000000..9a7499a
--- /dev/null
@@ -0,0 +1,9 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=4
+// { dg-do compile }
+
+void test4()
+{
+    string str = "allo";
+    static assert(!__traits(compiles, str.reverse));
+    static assert(!__traits(compiles, str.sort));
+}
diff --git a/gcc/testsuite/gdc.dg/gdc43.d b/gcc/testsuite/gdc.dg/gdc43.d
new file mode 100644 (file)
index 0000000..e0d44a2
--- /dev/null
@@ -0,0 +1,29 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=43
+// { dg-do compile }
+
+void main()
+{
+    import core.vararg;
+    import core.stdc.stdio;
+
+    void formatArray(ref va_list argptr)
+    {
+        auto a = va_arg!(const(float)[])(argptr);
+        foreach(f; a)
+        {
+            printf("%f\n", f);
+        }
+    }
+
+    void doFormat(TypeInfo[] arguments, va_list argptr)
+    {
+        formatArray(argptr);
+    }
+
+    void format(...)
+    {
+        doFormat(_arguments, _argptr);
+    }
+
+    format([1.0f, 2.0f, 3.0f]);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc47.d b/gcc/testsuite/gdc.dg/gdc47.d
new file mode 100644 (file)
index 0000000..e85451a
--- /dev/null
@@ -0,0 +1,12 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=47
+// { dg-do compile }
+
+template Foo47()
+{
+    void test47()
+    {
+        asm { "nop"; }
+    }
+}
+
+mixin Foo47!();
diff --git a/gcc/testsuite/gdc.dg/gdc51.d b/gcc/testsuite/gdc.dg/gdc51.d
new file mode 100644 (file)
index 0000000..e6ffbd4
--- /dev/null
@@ -0,0 +1,29 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=51
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S51
+{
+    int x;
+    int pad;
+
+    this(this)
+    {
+        ++x;
+    }
+}
+
+void main()
+{
+    S51 s;
+    auto sarr = new S51[1];
+    auto sarr2 = sarr;
+
+    // postblit all fields.
+    sarr2 ~= s;
+
+    assert (sarr2[0].x == 1);
+    assert (sarr2[1].x == 1);
+    assert (sarr[0].x == 0);
+    assert (s.x == 0);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc57.d b/gcc/testsuite/gdc.dg/gdc57.d
new file mode 100644 (file)
index 0000000..b378286
--- /dev/null
@@ -0,0 +1,21 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=57
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S57
+{
+    int a;
+    long b;
+    // Doesn't happen for bigger structs
+}
+
+S57 bar57()
+{
+    return S57(4, 42);
+}
+
+void main()
+{
+    S57 s = bar57();
+    assert (s is S57(4, 42));
+}
diff --git a/gcc/testsuite/gdc.dg/gdc66.d b/gcc/testsuite/gdc.dg/gdc66.d
new file mode 100644 (file)
index 0000000..f499c83
--- /dev/null
@@ -0,0 +1,14 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=66
+// { dg-do run { target hw } }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void main()
+{
+    int pos = 0;
+
+    foreach(x; 0 .. 64)
+    {
+        ++pos %= 4;
+        assert (pos != 4);
+    }
+}
diff --git a/gcc/testsuite/gdc.dg/gdc67.d b/gcc/testsuite/gdc.dg/gdc67.d
new file mode 100644 (file)
index 0000000..9289abf
--- /dev/null
@@ -0,0 +1,4 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=67
+// { dg-do compile }
+
+__vector(float[4])[2] d;  // ICE
diff --git a/gcc/testsuite/gdc.dg/gdc71.d b/gcc/testsuite/gdc.dg/gdc71.d
new file mode 100644 (file)
index 0000000..c2eb2dd
--- /dev/null
@@ -0,0 +1,27 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=71
+// { dg-do compile }
+
+struct CanonicalHuffman
+{
+    int[] table;
+
+    void print()
+    {
+        table.sort!(a => a);
+    }
+}
+
+struct SortedRange(alias pred )
+{
+    auto trisect() { }
+}
+
+auto assumeSorted(alias pred , R)(R )
+{
+    return SortedRange!pred();
+}
+
+SortedRange!(less) sort(alias less, Range)(Range r)
+{
+    return assumeSorted!less(r);
+}
diff --git a/gcc/testsuite/gdc.dg/gdc77.d b/gcc/testsuite/gdc.dg/gdc77.d
new file mode 100644 (file)
index 0000000..6c08175
--- /dev/null
@@ -0,0 +1,11 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=77
+// { dg-do compile }
+
+void fun(size_t n)(ubyte[n] val)
+{
+}
+
+void test77(ubyte[3] buf)
+{
+    fun(buf[0..2]);
+}
index 3378d74bd9bcea6132cadb157379c2a65ce3f7ca..11d2bae9aa18b502c77a80ded31640aa438b89fa 100644 (file)
@@ -1,9 +1,27 @@
-import std.path : buildNormalizedPath;
+module imports.gdc239;
 
 class C239a
 {
     auto bar()
     {
-        auto path = buildNormalizedPath("/", "foo");
+        chainPath();
     }
 }
+
+auto chainPath()
+{
+    struct OnlyResult { }
+    chain([], OnlyResult(), []);
+}
+
+auto chain(Ranges...)(Ranges rs)
+{
+    static struct Result
+    {
+        Ranges source;
+        this(Ranges)
+        {
+        }
+    }
+    Result(rs);
+}
index 28ba8ebe8ee615e5540eda39faf9200d08bd4124..0ed851383a61b109cffa1434a2b07a580cf89cbc 100644 (file)
@@ -1,4 +1,6 @@
-import compilable;
+module imports.gdc241a;
+
+import gdc241;
 
 S241 *s241;     // Use indirectly imported struct
 C241 *c241;     // Use indirectly imported class
index 3632575ba0d43f17910be7d0592406deaa5327ec..c49a04716ca933a49b21c38f63c63f6f70798b47 100644 (file)
@@ -1,3 +1,4 @@
+module imports.gdc241b;
 
 class C241 { }
 
index 5c2d4d58769c1d6bf60fe01140a7484ef10c66ce..4ba927f91a7e195d19bf73d1466285bed8ba78a3 100644 (file)
@@ -1,6 +1,6 @@
 module imports.gdc251a;
 
 import imports.gdc251b;
-import compilable;
+import gdc251;
 
 C251 config;
diff --git a/gcc/testsuite/gdc.dg/imports/gdc253.d b/gcc/testsuite/gdc.dg/imports/gdc253.d
deleted file mode 100644 (file)
index 6649262..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-module imports.gdc253;
-
-interface I253a
-{
-}
-
-interface I253b
-{
-    size_t printf(...);
-    void flush();
-}
-
-class C253a : I253a , I253b
-{
-    size_t printf(...)
-    {
-        return 0;
-    }
-
-    void flush()
-    {
-    }
-}
diff --git a/gcc/testsuite/gdc.dg/imports/gdc253a.d b/gcc/testsuite/gdc.dg/imports/gdc253a.d
new file mode 100644 (file)
index 0000000..8e62910
--- /dev/null
@@ -0,0 +1,23 @@
+module imports.gdc253a;
+
+interface I253a
+{
+}
+
+interface I253b
+{
+    size_t printf(...);
+    void flush();
+}
+
+class C253a : I253a , I253b
+{
+    size_t printf(...)
+    {
+        return 0;
+    }
+
+    void flush()
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.dg/imports/gdc253b.d b/gcc/testsuite/gdc.dg/imports/gdc253b.d
new file mode 100644 (file)
index 0000000..996b0bf
--- /dev/null
@@ -0,0 +1,12 @@
+module imports.gdc253b;
+
+import gdc253b;
+
+class B253 : A253
+{
+    void test253(int[int] a)
+    {
+        if (a.get(0, 1))
+            return;
+    }
+}
diff --git a/gcc/testsuite/gdc.dg/imports/gdc36.d b/gcc/testsuite/gdc.dg/imports/gdc36.d
new file mode 100644 (file)
index 0000000..a22fd6f
--- /dev/null
@@ -0,0 +1,8 @@
+module imports.gdc36;
+
+private import gdc36;
+
+void test36d_1()
+{
+    auto parser = Parser!(char[])();
+}
diff --git a/gcc/testsuite/gdc.dg/imports/runnable.d b/gcc/testsuite/gdc.dg/imports/runnable.d
deleted file mode 100644 (file)
index f28ccdf..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-module imports.runnable;
-
-private import runnable;
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=36
-
-void test36d_1()
-{
-    auto parser = Parser!(char[])();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=253
-
-class B253 : A253
-{
-    void test253(int[int] a)
-    {
-        if (a.get(0, 1))
-            return;
-    }
-}
diff --git a/gcc/testsuite/gdc.dg/link.d b/gcc/testsuite/gdc.dg/link.d
deleted file mode 100644 (file)
index 5efd0ad..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// { dg-do link { target d_runtime_has_std_library } }
-
-/******************************************/
-
-class C1()
-{
-    static struct S1 { A1 a; }
-}
-
-enum E1 = is(C1!());
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=300
-
-struct S300(Range)
-{
-    double test(size_t remaining)
-    {
-        double r;
-        return r ^^ remaining;
-    }
-}
-
-auto link300a(Range)(Range)
-{
-    return S300!(Range)();
-}
-
-void link300()
-{
-    struct I {}
-    static assert(is(typeof(link300a(I())) == struct));
-    auto sample = link300a(I());
-    sample.test(5);
-}
-
-/******************************************/
-
-void main() {}
diff --git a/gcc/testsuite/gdc.dg/runnable.d b/gcc/testsuite/gdc.dg/runnable.d
deleted file mode 100644 (file)
index d974bda..0000000
+++ /dev/null
@@ -1,1394 +0,0 @@
-// { dg-additional-sources "imports/runnable.d" }
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-module runnable;
-
-import imports.runnable;
-import core.stdc.stdio;
-import gcc.attribute;
-
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=4
-
-void test4()
-{
-    string str = "allo";
-    static assert(!__traits(compiles, str.reverse));
-    static assert(!__traits(compiles, str.sort));
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=17
-
-/**
- * Parameters are not copied into a frame to be accessed from
- * the method's __require function.
- */
-void contractTest(string path)
-{
-    assert(path[0] == 't');
-    assert(path.length == 9);
-    assert(path[8] == 'i');
-}
-
-interface ModuleSaver
-{
-    void save(string str)
-    in
-    {
-        contractTest(str);
-    }
-}
-
-class ModuleWriter : ModuleSaver
-{
-    void save (string str)
-    in {}
-    body
-    {
-    }
-}
-
-void test17()
-{
-  (new ModuleWriter()).save ("test.0.mci");
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=19
-
-void test19()
-{
-   byte b;
-   --b = b;
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=24
-
-void test24()
-{
-    struct S24
-    {
-        char[1] b;
-    }
-
-    S24 a;
-
-    if (*a.b.ptr)
-        return;
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=31
-
-class RedBlackTree(T, alias less)
-{
-    struct Range
-    {
-        @property empty() { }
-    }
-
-    Range opSlice()
-    {
-        return Range();
-    }
-}
-
-auto redBlackTree(alias less, E)()
-{
-    return new RedBlackTree!(E, less);
-}
-
-void test31()
-{
-    redBlackTree!((a){}, double)();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=35
-
-/**
- * Here the BinaryHeap instance uses an alias parameter and therefore
- * the instance's functions (percolateDown) need to be generated in
- * topNIndex->BinaryHeap scope and not in the declaration scope
- * (module->BinaryHeap).
- */
-void topNIndex()()
-{
-    bool indirectLess(int a, int b)
-    {
-        return a > b;
-    }
-
-    auto a = BinaryHeap!(indirectLess)();
-}
-
-struct BinaryHeap(alias less)
-{
-    void percolateDown()
-    {
-        less(0, 1);
-    }
-}
-
-void test35a()
-{
-    topNIndex();
-}
-
-/*
- * Similar as test35a but with an additional indirection.
- * The nested function chain for percolateDown should look like this:
- * topNIndex2->BinaryHeap2->percolateDown.
- */
-void topNIndex2()()
-{
-    bool indirectLess(int a, int b)
-    {
-        return a > b;
-    }
-    auto a = BinaryHeap2!(S35b!(indirectLess)())();
-}
-
-struct S35b(alias a)
-{
-    void foo()
-    {
-        a(0, 0);
-    }
-}
-
-struct BinaryHeap2(alias less)
-{
-    void percolateDown()
-    {
-        less.foo();
-    }
-}
-
-void test35b()
-{
-    topNIndex2();
-}
-
-void test35()
-{
-    test35a();
-    test35b();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=36
-
-/**
- * Here getChar is a function in a template where template.isnested == false
- * but getChar still is a nested function and needs to get a static chain
- * containing test36a.
- */
-void test36a()(char val)
-{
-    void error()
-    {
-    }
-
-    void getChar()()
-    {
-        error();
-    }
-
-    void parseString()
-    {
-        getChar();
-    }
-}
-
-/**
- * Similar as test36a, but a little more complicated:
- * Here getChar is nested in a struct template which is nested in a function.
- * getChar's static chain still needs to contain test36b.
- */
-void test36b()(char val)
-{
-    void error()
-    {
-    }
-
-    struct S(T)
-    {
-        void getChar()
-        {
-            error();
-        }
-    }
-
-
-    void parseString()
-    {
-        S!(int)().getChar();
-    }
-}
-
-/**
- * If g had accessed a, the frontend would have generated a closure.
- *
- * As we do not access it, there's no closure. We have to be careful
- * not to set a static chain for g containing test36c_1 though,
- * as g can be called from outside (here from test1c). In the end
- * we have to treat this as if everything in test36c_1 was declared
- * at module scope.
- */
-auto test36c_1()
-{
-    int a;
-    void c() {}
-    class Result
-    {
-        int b;
-        void g() { c(); /*a = 42;*/ }
-    }
-
-    return new Result();
-}
-
-void test36c()
-{
-    test36c_1().g();
-}
-
-/**
- * empty is a (private) function which is nested in lightPostprocess.
- * At the same time it's a template instance, so it has to be declared as
- * weak or otherwise one-only. imports/runnable.d creates another instance
- * of Regex!char to verify that.
- */
-struct Parser(R)
-{
-    @property program()
-    {
-        return Regex!char();
-    }
-}
-
-struct Regex(Char)
-{
-    @trusted lightPostprocess()
-    {
-        struct FixedStack(T)
-        {
-            @property empty() { return false; }
-        }
-        auto counterRange = FixedStack!uint();
-    }
-}
-
-void test36d()
-{
-    auto parser = Parser!(char[])();
-    imports.runnable.test36d_1;
-}
-
-void test36()
-{
-  test36a('n');
-  test36b('n');
-  test36c();
-  test36d();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=37
-
-struct S37
-{
-    int bar(const S37 s)
-    {
-        return 0;
-    }
-}
-
-int test37()
-{
-    S37 s;
-    return s.bar(s);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=43
-
-void test43()
-{
-    import core.vararg;
-    import core.stdc.stdio;
-
-    void formatArray(ref va_list argptr)
-    {
-        auto a = va_arg!(const(float)[])(argptr);
-        foreach(f; a)
-        {
-            printf("%f\n", f);
-        }
-    }
-
-    void doFormat(TypeInfo[] arguments, va_list argptr)
-    {
-        formatArray(argptr);
-    }
-
-    void format(...)
-    {
-        doFormat(_arguments, _argptr);
-    }
-
-    format([1.0f, 2.0f, 3.0f]);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=47
-
-template Foo47()
-{
-    void test47()
-    {
-        asm { "nop"; }
-    }
-}
-
-mixin Foo47!();
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=51
-
-struct S51
-{
-    int x;
-    int pad;
-
-    this(this)
-    {
-        ++x;
-    }
-}
-
-void test51()
-{
-    S51 s;
-    auto sarr = new S51[1];
-    auto sarr2 = sarr;
-
-    // postblit all fields.
-    sarr2 ~= s;
-
-    assert (sarr2[0].x == 1);
-    assert (sarr2[1].x == 1);
-    assert (sarr[0].x == 0);
-    assert (s.x == 0);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=57
-
-struct S57
-{
-    int a;
-    long b;
-    // Doesn't happen for bigger structs
-}
-
-S57 bar57()
-{
-    return S57(4, 42);
-}
-
-void test57()
-{
-    S57 s = bar57();
-    assert (s is S57(4, 42));
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=66
-
-void test66()
-{
-    int pos = 0;
-
-    foreach(x; 0 .. 64)
-    {
-        ++pos %= 4;
-        assert (pos != 4);
-    }
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=67
-
-__vector(float[4]) d[2];  // ICE
-
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=115
-
-void test115()
-{
-    union U
-    {
-        float f;
-        uint i;
-    }
-    float a = 123.0;
-    const l = U(a);
-
-    assert(l.i == U(a).i);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=121
-
-immutable char C121 = void; // ICE
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=127
-
-int[0] test127a;     // OK
-int[1][0] test127b;  // OK
-int[0][1] test127c;  // ICE
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=131
-
-struct S131
-{
-    this(string ) { }
-    string opAssign(string v) { return v; }
-}
-
-void test131()
-{
-    S131[string] s;
-    s["foo"] = "bar";
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=133
-
-void delegate()[] D133;
-
-void test133a(void delegate() dg)
-{
-    D133 ~= dg;
-}
-
-void test133()
-{
-    void nested()
-    {}
-    test133a(&nested);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=141
-
-bool test141a(int a)
-{
-    return a > (a + 1);
-}
-
-void test141()
-{
-    assert(test141a(int.min) == false);
-    assert(test141a(int.max) == true);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=142
-
-@attribute("noinline")
-int test142a()()
-{
-    return 142;
-}
-
-void test142()
-{
-    enum E142 = test142a();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=171
-
-void test171a()
-{
-    int count = 0;
-    short a = -1;
-    while (a != 0)
-    {
-        a >>>= 1;
-        count++;
-        assert(count <= 16);
-    }
-}
-
-void test171b()
-{
-    uint[3] lhs = [99, 201, 300],
-            rhs = [-1, 0, 0];
-    long t = 0;
-
-    for (int i = 0; i < 3; i++)
-    {
-        t += lhs[i];
-        t -= rhs[i];
-        lhs[i] = cast(uint) t;
-        t >>= uint.sizeof * 8;
-    }
-
-    assert(lhs == [100, 200, 300]);
-}
-
-void test171()
-{
-    test171a();
-    test171b();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=179
-
-struct S179a
-{
-    @disable this(this);
-}
-
-struct S179b
-{
-    S179a s1;
-    void connect() { printf("this=%p\n", &this); }
-}
-
-class C179
-{
-    private S179b s2;
-    ref S179b value() @property
-    {
-        printf("this=%p\n", &s2);
-        return s2;
-    }
-}
-
-void test179()
-{
-    C179 a = new C179;
-    a.value.connect();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=183
-
-struct S183a
-{
-    union I183a
-    {
-        struct
-        {
-            double x, y, z;
-        }
-        struct
-        {
-            double a, b, c;
-        }
-    }
-
-    I183a inner;
-
-    this(double x, double y, double z)
-    {
-        this.inner.x = x;
-        this.inner.y = y;
-        this.inner.z = z;
-    }
-}
-
-struct S183b
-{
-    @property get()
-    {
-        union Buf
-        {
-            void[0] result;
-        }
-        const Buf buf = { };
-        return buf.result;
-    }
-}
-
-struct S183c
-{
-    @property get()
-    {
-        union Buf
-        {
-            TypeInfo info;
-            void[0] result;
-        }
-        const Buf buf = { };
-        return buf.result;
-    }
-}
-
-void test183()
-{
-    auto v1 = S183a(0, 0, 0);
-    auto v2 = S183b().get;
-    auto v3 = S183c().get;
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=186
-
-struct S186
-{
-    union
-    {
-        struct
-        {
-            ubyte fieldA;
-            byte  fieldB = -1;
-            byte fieldC = -1;
-        }
-        size_t _complete;
-    }
-
-    this(size_t complete)
-    {
-        this._complete = complete;
-    }
-}
-
-static if (size_t.sizeof == 8)
-    enum checkval = 0x0200000000000002;
-else
-    enum checkval = 0x02000002;
-
-void check186(in S186 obj, byte fieldB)
-{
-    assert(obj.fieldA == 2);
-    assert(obj.fieldB == 0);
-    assert(obj.fieldC == 0);
-    assert(obj._complete == checkval);
-    assert(fieldB == 0);
-}
-
-void test186a(size_t val)
-{
-    S186 obj = S186(val);
-    check186(obj, obj.fieldB);
-
-    assert(obj.fieldA == 2);
-    assert(obj.fieldB == 0);
-    assert(obj.fieldC == 0);
-    assert(obj._complete == checkval);
-
-    obj = S186(val);
-    check186(obj, obj.fieldB);
-
-    assert(obj.fieldA == 2);
-    assert(obj.fieldB == 0);
-    assert(obj.fieldC == 0);
-    assert(obj._complete == checkval);
-}
-
-void test186()
-{
-    test186a(checkval);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=187
-
-align(1) struct S187b
-{
-    align(1)
-    {
-        uint unpaddedA;
-        ushort unpaddedB;
-    }
-}
-
-struct S187a
-{
-    S187b[3] unpaddedArray;
-    ubyte wontInitialize = ubyte.init;
-}
-
-struct S187
-{
-    S187a interesting;
-}
-
-
-void prepareStack()
-{
-    byte[255] stackGarbage;
-    foreach(i, ref b; stackGarbage)
-    {
-        b  = cast(byte)(-i);
-    }
-}
-
-void test187()
-{
-    prepareStack();
-    auto a = S187(S187a());
-    assert(a.interesting.wontInitialize == 0);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=191
-
-class C191
-{
-    int count = 0;
-
-    void testA()
-    {
-        class Inner
-        {
-            void test()
-            {
-                void localFunction()
-                {
-                    if (++count != 5)
-                        testA();
-                }
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testB()
-    {
-        class Inner
-        {
-            void test()
-            {
-                void localFunction()
-                {
-                    void anotherLocalFunction()
-                    {
-                        if (++count != 10)
-                            testB();
-                    }
-                    anotherLocalFunction();
-                }
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testC()
-    {
-        class Inner
-        {
-            int a = 1;
-
-            void test()
-            {
-                void localFunction()
-                {
-                    count += a;
-                    if (count != 15)
-                        testC();
-                    assert(a == 1);
-                }
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testD()
-    {
-        class Inner
-        {
-            void test()
-            {
-                int a = 1;
-
-                void localFunction()
-                {
-                    count += a;
-                    if (count != 20)
-                        testD();
-                    assert(a == 1);
-                }
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testE()
-    {
-        class Inner
-        {
-            int a = 1;
-
-            void test()
-            {
-                void localFunction()
-                {
-                    void anotherLocalFunction()
-                    {
-                        count += a;
-                        if (count != 25)
-                            testE();
-                        assert(a == 1);
-                    }
-
-                    anotherLocalFunction();
-                }
-
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testF()
-    {
-        class Inner
-        {
-            void test()
-            {
-                int a = 1;
-
-                void localFunction()
-                {
-                    void anotherLocalFunction()
-                    {
-                        count += a;
-                        if (count != 30)
-                            testF();
-                        assert(a == 1);
-                    }
-
-                    anotherLocalFunction();
-                }
-
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testG()
-    {
-        class Inner
-        {
-            void test()
-            {
-                void localFunction()
-                {
-                    int a = 1;
-
-                    void anotherLocalFunction()
-                    {
-                        count += a;
-                        if (count != 35)
-                            testG();
-                        assert(a == 1);
-                    }
-
-                    anotherLocalFunction();
-                }
-
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-}
-
-void test191()
-{
-    scope oc = new C191();
-    oc.testA();
-    assert(oc.count == 5);
-
-    oc.testB();
-    assert(oc.count == 10);
-
-    oc.testC();
-    assert(oc.count == 15);
-
-    oc.testD();
-    assert(oc.count == 20);
-
-    oc.testE();
-    assert(oc.count == 25);
-
-    oc.testF();
-    assert(oc.count == 30);
-
-    oc.testG();
-    assert(oc.count == 35);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=194
-
-auto test194(ref bool overflow)
-{
-    import core.checkedint;
-
-    return adds(1, 1, overflow);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=196
-
-class C196
-{
-    int a;
-}
-
-struct S196
-{
-    int a;
-}
-
-void test196()
-{
-    __gshared c = new C196();
-    __gshared s = new S196(0);
-    c.a = 1;
-    s.a = 1;
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=198
-
-struct S198a
-{
-    union
-    {
-        float[3] v;
-        struct
-        {
-            float x;
-            float y;
-            float z;
-        }
-    }
-
-    this(float x_, float y_, float z_)
-    {
-        x = x_;
-        y = y_;
-        z = z_;
-    }
-
-    ref S198a opOpAssign(string op)(S198a operand)
-    if (op == "+")
-    {
-        x += operand.x;
-        y += operand.y;
-        z += operand.z;
-        return this;
-    }
-}
-
-struct S198b
-{
-    @property get()
-    {
-        union Buf
-        {
-            void[0] result;
-        }
-        const Buf buf = { };
-        return buf.result;
-    }
-}
-
-struct S198c
-{
-    @property get()
-    {
-        union Buf
-        {
-            TypeInfo info;
-            void[0] result;
-        }
-        const Buf buf = { };
-        return buf.result;
-    }
-}
-
-
-auto test198()
-{
-    S198a sum = S198a(0, 0, 0);
-
-    foreach(size_t v; 0 .. 3)
-        sum += S198a(1, 2, 3);
-
-    assert(sum.v == [3, 6, 9]);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=200
-
-void test200a(double x, double y)
-{
-  const double y2 = x + 1.0;
-  assert(y == y2);
-}
-
-void test200()
-{
-  const double x = .012;
-  const double y = x + 1.0;
-  test200a(x, y);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=210
-
-struct S210
-{
-    ubyte a;
-    uint b;
-}
-
-union U210
-{
-    S210 a;
-    uint b;
-}
-
-S210 test210a()
-{
-    S210 s = S210(1, 2);
-    return s;
-}
-
-S210[2] test210b()
-{
-    S210[2] s = [S210(1, 2), S210(3, 4)];
-    return s;
-}
-
-U210 test210c()
-{
-    U210 s = U210(S210(1, 2));
-    return s;
-}
-
-U210[2] test210d()
-{
-    U210[2] s = [U210(S210(1, 2)), U210(S210(3, 4))];
-    return s;
-}
-
-void test210()
-{
-    S210 a = S210(1, 2);
-    assert(a == S210(1, 2));
-    assert(a == test210a());
-    assert(a != S210(2, 1));
-
-    S210[2] b = [S210(1, 2), S210(3, 4)];
-    assert(b == [S210(1, 2), S210(3, 4)]);
-    assert(b == test210b());
-    assert(b != [S210(2, 1), S210(3, 4)]);
-
-    U210 c = U210(S210(1, 2));
-    assert(c == U210(S210(1, 2)));
-    assert(c == test210c());
-    assert(c != U210(S210(2, 1)));
-
-    U210[2] d = [U210(S210(1, 2)), U210(S210(3, 4))];
-    assert(d == [U210(S210(1, 2)), U210(S210(3, 4))]);
-    assert(d == test210d());
-    assert(d != [U210(S210(2, 1)), U210(S210(3, 4))]);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=240
-
-void test240a(int a, int b)
-{
-    assert(a == 0);
-    assert(b == 0);
-}
-
-void test240()
-{
-    int a = 0;
-    test240a(a, a++);
-    assert(a == 1);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=242
-
-struct S242
-{
-    enum M = S242();
-    int a = 42;
-
-    auto iter()
-    {
-        this.a = 24;
-        return this;
-    }
-}
-
-S242 test242a()
-{
-    return S242.M.iter;
-}
-
-void test242()
-{
-    assert(test242a() == S242(24));
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=248
-
-class C248b
-{
-    bool isintegral()
-    {
-        return false;
-    }
-}
-
-class C248a
-{
-    int count = 0;
-
-    C248b getMemtype()
-    {
-        count++;
-        return new C248b();
-    }
-}
-
-class C248
-{
-    C248a sym;
-
-    this()
-    {
-        this.sym = new C248a();
-    }
-
-    bool isintegral()
-    {
-        return sym.getMemtype().isintegral();
-    }
-}
-
-void test248()
-{
-    C248 e = new C248();
-    e.isintegral();
-    assert(e.sym.count == 1);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=250
-
-void test250()
-{
-    struct S
-    {
-        string data;
-    }
-
-    auto a = S("hello");
-    auto b = S("hello".dup);
-
-    assert(a.data == b.data);
-    assert(a == b);
-    assert([a] == [b]);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=253
-
-interface A253
-{
-    void test253(int[int]);
-}
-
-interface C253 : A253
-{
-}
-
-class D253 : B253, C253
-{
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=273
-
-class B273
-{
-    B273[] members;
-}
-
-class D273 : B273
-{
-}
-
-void test273()
-{
-    auto noPointers = ClassInfo.ClassFlags.noPointers;
-    assert((B273.classinfo.m_flags & noPointers) == 0);
-    assert((D273.classinfo.m_flags & noPointers) == 0);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=285
-
-inout(char)[] test285a(inout(char)* s) @nogc @system pure nothrow
-{
-    import core.stdc.string : strlen;
-    return s ? s[0 .. strlen(s)] : null;
-}
-
-void test285()
-{
-    assert(test285a(null) == null);
-    assert(test285a("foo") == "foo");
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=286
-
-void test286()
-{
-    struct K286
-    {
-        int count;
-        this(this)
-        {
-            count++;
-        }
-    }
-
-    struct S286
-    {
-        int data;
-        this(K286 key)
-        {
-            data = key.count;
-        }
-    }
-
-    S286 getData(K286 key)
-    {
-        static S286[K286] getCache;
-        auto p = key in getCache;
-        if (p)
-            return *p;
-        return (getCache[key] = S286(key));
-    }
-
-    auto s = getData(K286());
-    if (s.data == 0)
-        assert(0);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=309
-
-void test309()
-{
-    creal f1 = +0.0 + 0.0i;
-    creal f2 = +0.0 - 0.0i;
-    creal f3 = -0.0 + 0.0i;
-    creal f4 = +0.0 + 0.0i;
-
-    assert(f1 !is f2);
-    assert(f1 !is f3);
-    assert(f2 !is f3);
-    assert(f1 is f4);
-
-    assert(!(f1 is f2));
-    assert(!(f1 is f3));
-    assert(!(f2 is f3));
-    assert(!(f1 !is f4));
-
-    struct CReal
-    {
-        creal value;
-    }
-
-    CReal s1 = CReal(+0.0 + 0.0i);
-    CReal s2 = CReal(+0.0 - 0.0i);
-    CReal s3 = CReal(-0.0 + 0.0i);
-    CReal s4 = CReal(+0.0 + 0.0i);
-
-    assert(s1 !is s2);
-    assert(s1 !is s3);
-    assert(s2 !is s3);
-    assert(s1 is s4);
-
-    assert(!(s1 is s2));
-    assert(!(s1 is s3));
-    assert(!(s2 is s3));
-    assert(!(s1 !is s4));
-}
-
-/******************************************/
-
-void main()
-{
-    test4();
-    test17();
-    test35();
-    test36();
-    test43();
-    test51();
-    test57();
-    test66();
-    test115();
-    test131();
-    test133();
-    test141();
-    test179();
-    test186();
-    test187();
-    test191();
-    test196();
-    test198();
-    test200();
-    test210();
-    test240();
-    test242();
-    test248();
-    test250();
-    test273();
-    test285();
-    test286();
-    test309();
-
-    printf("Success!\n");
-}
diff --git a/gcc/testsuite/gdc.dg/runnable2.d b/gcc/testsuite/gdc.dg/runnable2.d
deleted file mode 100644 (file)
index d9463e3..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-// { dg-do run { target { hw && d_runtime_has_std_library } } }
-
-module runnable;
-
-import core.stdc.stdio;
-import gcc.attribute;
-
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=2
-
-struct S
-{
-    string toString() { return "foo"; }
-}
-
-void test2()
-{
-    import std.string : format;
-    assert(format("%s", S()) == "foo");
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=15
-
-class B
-{
-    class A { }
-    A a;
-}
-
-class C
-{
-    void visit(B b)
-    {
-        import std.algorithm : map;
-        auto as = [b.a];
-        as.map!(d => d);
-    }
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=16
-
-void test16()
-{
-    import std.parallelism : taskPool;
-
-    taskPool.reduce!"a+b"([0, 1, 2, 3]);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=18
-
-class C18
-{
-    struct Link
-    {
-        int x;
-        int y;
-    }
-
-    void sort_links()
-    {
-        import std.algorithm : sort;
-        import std.array : empty;
-        import std.exception : enforce;
-
-        enforce(!_link.empty);
-
-        bool lt(Link a, Link b)
-        {
-            if(a.x > b.x)
-                return false;
-            if(a.x < b.x)
-                return true;
-            if(a.y >= b.y)
-                return false;
-            else
-                return true;
-        }
-        sort!(lt)(_link);
-    }
-
-    this()
-    {
-        _link ~= Link(8, 3);
-        _link ~= Link(4, 7);
-        _link ~= Link(4, 6);
-        _link ~= Link(3, 7);
-        _link ~= Link(2, 7);
-        _link ~= Link(2, 2);
-        _link ~= Link(4, 1);
-    }
-
-    Link[] _link;
-}
-
-void test18()
-{
-    C18 foo = new C18;
-    foo.sort_links();
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=29
-
-void test29()
-{
-    import std.string : format;
-    import std.conv : text;
-
-    string s;
-    for (auto i = 0; i < 100000; i++)
-    {
-        s = format("%d", i);
-        s = text(i);
-    }
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=52
-
-class C52
-{
-    C52 a;
-
-    this()
-    {
-        printf("Construct: this=%p\n", cast(void*)this);
-        a = this;
-    }
-
-    bool check()
-    {
-        printf("Check: this=%p a=%p\n", cast(void*)this, cast(void*)a);
-        return this is a;
-    }
-}
-
-auto test52a()
-{
-    import std.conv, std.traits;
-
-    struct Scoped
-    {
-        void[__traits (classInstanceSize, C52) ] Scoped_store = void;
-
-        inout(C52) Scoped_payload() inout
-        {
-            void* alignedStore = cast(void*) Scoped_store.ptr;
-            return cast(inout (C52)) alignedStore;
-        }
-        alias Scoped_payload this;
-    }
-
-    Scoped result;
-    emplace!(Unqual!C52)(result.Scoped_store);
-    assert(result.Scoped_payload().check);
-    return result;
-}
-
-void test52()
-{
-    auto a1 = test52a();
-    assert(a1.Scoped_payload().check);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=71
-
-struct Leaf
-{
-    ubyte symbol;
-    ubyte codeLen;
-}
-
-struct CanonicalHuffman
-{
-    Leaf[] table;
-
-    void print()
-    {
-        import std.algorithm;
-        import std.range;
-
-        auto list = zip(iota(table.length), table.dup).array
-            .sort!((a, b) => a[1].symbol < b[1].symbol)
-            .uniq!((a, b) => (a[0] & (1 << a[1].codeLen) - 1) == (b[0] & (1 << b[1].codeLen) - 1));
-    }
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=77
-
-void fun(ubyte[3] buf)
-{
-    import std.bitmanip : bigEndianToNative;
-    bigEndianToNative!ushort(buf[0..2]);
-}
-
-void test77()
-{
-    fun([1,2,3]);
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=108
-
-@attribute("forceinline")
-void test108()
-{
-    import std.stdio : writeln;
-    writeln("Here");
-}
-
-/******************************************/
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=122
-
-void test122()
-{
-    import std.algorithm : map;
-    import std.parallelism : taskPool;
-    import std.range : iota;
-
-    immutable n = 10000;
-    enum delta = 1.0 / n;       // XBUG: was 'immutable delta' https://issues.dlang.org/show_bug.cgi?id=17092
-    immutable pi = 4.0 * delta * taskPool.reduce!"a + b"(
-        map!((int i) { immutable x = (i - 0.5) * delta; return 1.0 / (1.0 + x * x); })(iota(n)));
-}
-
-/******************************************/
-
-void main()
-{
-    test2();
-    test16();
-    test18();
-    test52();
-    test77();
-    test108();
-
-    printf("Success!\n");
-}
index 439c446837aad01929ff772bc0d6663bd706732b..40d5b5700c31bb7902429141583cfde0ad23a4ad 100644 (file)
@@ -2,7 +2,6 @@
 // { dg-do run { target hw } }
 import core.simd;
 import core.stdc.string;
-import std.stdio;
 
 alias TypeTuple(T...) = T;
 
@@ -1143,7 +1142,6 @@ float4 foo9304(float4 a)
 void test9304()
 {
     auto a = foo9304([0, 1, 2, 3]);
-    //writeln(a.array);
     assert(a.array == [0,-1,-2,-3]);
 }