[PATCH v3 8/14] D: D2 Testsuite compilable tests.

Just added some more tests since previous patch for bug fixes made to the D frontend.

Tests specific to GDC have also been removed also and put in a separate directory with new dejagnu files.

---
diff --git a/gcc/testsuite/gdc.test/compilable/99bottles.d b/gcc/testsuite/gdc.test/compilable/99bottles.d
new file mode 100644
index 00000000000..e7d2f77500e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/99bottles.d
@@ -0,0 +1,52 @@
+// written by Don Clugston:
+//    http://www.digitalmars.com/d/archives/digitalmars/D/announce/4374.html
+//    http://www.99-bottles-of-beer.net/language-d-1212.html
+
+// Displays the "99 bottles of beer" song at compile time,
+// using the template metaprograming facilities of D. 
+// No executable is generated. No libraries are used.
+// Illustrates template default values, template string value parameters,
+// compile-time concatenation of constant strings, static if.
+
+module bottles99;
+
+template decimaldigit(int n) {
+    const string decimaldigit = "0123456789"[n..n+1];
+}
+
+template itoa(ulong n)
+{
+    static if ( n < 10L )
+	const string itoa = decimaldigit!(n);
+    else
+	const string itoa = itoa!( n / 10L ) ~ decimaldigit!( n % 10L );
+}
+
+template showHowMany(int n, string where, bool needcapital = false)
+{
+  static if ( n > 1 ) 
+      const string showHowMany = itoa!(n) ~ " bottles of beer" ~ where ~ "\n";
+  else static if ( n == 1 )
+      const string showHowMany = "1 bottle of beer" ~ where ~ "\n";
+  else static if ( needcapital )
+      const string showHowMany = "No more bottles of beer" ~ where ~ "\n";
+  else 
+      const string showHowMany = "no more bottles of beer" ~ where ~ "\n";
+}
+
+template beer(int maxbeers, int n = maxbeers)
+{
+  static if ( n > 0 )
+    const string beer = showHowMany!(n, " on the wall,", true)
+        ~ showHowMany!(n, ".")
+        ~ "Take one down and pass it around, " ~ "\n" 
+        ~ showHowMany!( n - 1 , " on the wall.") 
+        ~ "\n" ~ beer!(maxbeers, n - 1); // recurse for subsequent verses.
+  else
+    const string beer = showHowMany!(n, " on the wall,", true)
+        ~ showHowMany!(n, ".")
+        ~ "Go to the store and buy some more, " ~ "\n"
+        ~ showHowMany!( maxbeers, " on the wall.");
+}
+
+pragma(msg, beer!(99));
diff --git a/gcc/testsuite/gdc.test/compilable/a3682.d b/gcc/testsuite/gdc.test/compilable/a3682.d
new file mode 100644
index 00000000000..69191ec20a2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/a3682.d
@@ -0,0 +1,20 @@
+// EXTRA_SOURCES: imports/b3682.d
+// PERMUTE_ARGS:
+
+// 3682
+
+struct Tuple(Types...)
+{
+    Tuple!(Types[0..1]) slice()()
+    {
+        Tuple!(Types[0..1]) x;
+        return x;
+    }
+
+    void fail()
+    {
+        Tuple!(float, double, int) a;
+        auto s = a.slice();
+        static assert(is(typeof(s) == Tuple!(float)));
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/aliasdecl.d b/gcc/testsuite/gdc.test/compilable/aliasdecl.d
new file mode 100644
index 00000000000..90e21effac3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/aliasdecl.d
@@ -0,0 +1,40 @@
+template Test(T){ alias Type = T; }
+
+alias X1 = int;
+static assert(is(X1 == int));
+
+alias X2 = immutable(long)[], X3 = shared const double[int];
+static assert(is(X2 == immutable(long)[]));
+static assert(is(X3 == shared const double[int]));
+
+alias X4 = void delegate() const, X5 = Test!int;
+static assert(is(X4 == void delegate() const));
+static assert(is(X5.Type == int));
+
+alias FP5 = extern(C) pure nothrow @safe @nogc void function(),
+      DG5 = extern(D) pure nothrow @safe @nogc void delegate();
+static assert(FP5.stringof == "extern (C) void function() pure nothrow " /* ~ "@safe " */ ~ "@nogc");
+static assert(DG5.stringof ==            "void delegate() pure nothrow " /* ~ "@safe " */ ~ "@nogc");
+
+void main()
+{
+    alias Y1 = int;
+    static assert(is(Y1 == int));
+
+    alias Y2 = immutable(long)[], Y3 = shared const double[int];
+    static assert(is(Y2 == immutable(long)[]));
+    static assert(is(Y3 == shared const double[int]));
+
+    alias Y4 = void delegate() const, Y5 = Test!int;
+    static assert(is(Y4 == void delegate() const));
+    static assert(is(Y5.Type == int));
+
+ /+ struct S
+    {
+        int value;
+        alias this = value;
+    }
+    auto s = S(10);
+    int n = s;
+    assert(n == 10); +/
+}
diff --git a/gcc/testsuite/gdc.test/compilable/art4769.d b/gcc/testsuite/gdc.test/compilable/art4769.d
new file mode 100644
index 00000000000..b9620588eaa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/art4769.d
@@ -0,0 +1,19 @@
+// http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.bugs&article_id=4769
+
+// EXTRA_SOURCES: imports/art4769a.d imports/art4769b.d
+// PERMUTE_ARGS:
+
+module art4769;
+
+private import imports.art4769a;
+
+struct Vector(T)
+{
+    DataStreamability!(T).footype f;
+
+    static if (DataStreamability!(T).isStreamable)
+	void writeTo()
+	{
+	}
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/b1215.d b/gcc/testsuite/gdc.test/compilable/b1215.d
new file mode 100644
index 00000000000..d3b0ccd2e4a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/b1215.d
@@ -0,0 +1,146 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -o-
+
+struct A(Args...)
+{
+    enum i = 1;
+
+    // base use case.
+    Args[0].T mBase;
+    static assert(is(typeof(mBase) == B.T));
+    // chained types
+    Args[0].T.TT mChain;
+    static assert(is(typeof(mChain) == B.T.TT));
+    // chained packs
+    Args[1+1].FArgs[0] mChainPack;
+    static assert(is(typeof(mChainPack) == B));
+    // expr
+    enum mExpr = Args[1].i;
+    static assert(mExpr == B.i);
+    // Nested + index eval
+    Args[Args[0].i2].T mNested;
+    static assert(is(typeof(mNested) == B.T));
+    // index with constexpr
+    Args[i].T mCEIndex;
+    static assert(is(typeof(mCEIndex) == B.T));
+    // Nested + index with constexpr
+    Args[Args[i].i2].T mNestedCE;
+    static assert(is(typeof(mNestedCE) == B.T));
+
+    // alias, base use case
+    alias UBase = Args[0].T;
+    static assert(is(UBase == B.T));
+    // alias, chained types
+    alias UChain = Args[0].T.TT;
+    static assert(is(UChain == B.T.TT));
+    // alias, chained packs
+    alias UChainPack = Args[1+1].FArgs[0];
+    static assert(is(UChainPack == B));
+    // alias, expr
+    alias uExpr = Args[1].i;
+    static assert(uExpr == B.i);
+    // alias, Nested + index eval
+    alias UNested = Args[Args[0].i2].T;
+    static assert(is(UNested == B.T));
+    // alias, index with constexpr
+    alias UCEIndex = Args[i].T;
+    static assert(is(UCEIndex == B.T));
+    // alias, Nested + index with constexpr
+    alias UNextedCE = Args[Args[i].i2].T;
+    static assert(is(UNextedCE == B.T));
+}
+
+struct B
+{
+    struct T
+    {
+        struct TT
+        {
+        }
+    }
+    enum i = 6;
+    enum i2 = 0;
+}
+
+struct C(Args...)
+{
+    alias FArgs = Args;
+}
+
+alias Z = A!(B,B,C!(B,B));
+
+/***************************************************/
+// 14889
+
+struct A14889(alias Exc)
+{
+    alias ExceptionType = Exc;
+}
+alias TT14889(Args...) = Args;
+
+alias X14889a = TT14889!(A14889!Throwable());
+alias Y14889a = X14889a[0].ExceptionType;
+
+alias X14889b = TT14889!(A14889!Throwable);
+alias Y14889b = X14889b[0].ExceptionType;
+
+/***************************************************/
+// 14889
+
+alias TypeTuple14900(T...) = T;
+
+struct S14900
+{
+    alias T = int;
+    alias U = TypeTuple14900!(long,string);
+}
+
+alias Types14900 = TypeTuple14900!(S14900, S14900);
+
+Types14900[0].T a14900;     // Types[0] == S, then typeof(a) == S.T == int
+Types14900[0].U[1] b14900;  // Types[0].U == S.U, then typeof(b) == S.U[1] == string
+
+void test14900()
+{
+    Types14900[0].T a;      // Types[0] == S, then typeof(a) == S.T == int
+    Types14900[0].U[1] b;   // Types[0].U == S.U, then typeof(b) == S.U[1] == string
+}
+
+/***************************************************/
+// 14911
+
+void test14911()
+{
+    struct S {}
+
+    int* buf1 = new int[2].ptr; // OK
+    S* buf2 = (new S[2]).ptr;   // OK
+    S* buf3 = new S[2].ptr;     // OK <- broken
+}
+
+/***************************************************/
+// 14986
+
+alias Id14986(alias a) = a;
+
+struct Foo14986
+{
+    int tsize;
+}
+struct Bar14986
+{
+    enum Foo14986[] arr = [Foo14986()];
+}
+
+Bar14986 test14986()
+{
+    Foo14986[] types;
+    auto a1 = new void[types[0].tsize];                 // TypeIdentifier::toExpression
+    auto a2 = new void[Id14986!types[0].tsize];         // TypeInstance::toExpression
+
+    Bar14986 bar;
+    auto a3 = Id14986!(typeof(bar).arr[0].tsize);       // TypeTypeof::resolve
+    auto a4 = Id14986!(typeof(return).arr[0].tsize);    // TypeReturn::resolve
+
+    return Bar14986();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/b15428.d b/gcc/testsuite/gdc.test/compilable/b15428.d
new file mode 100644
index 00000000000..f339a755b26
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/b15428.d
@@ -0,0 +1,13 @@
+class A
+{
+    this() {}
+}
+
+class B : A
+{
+    this()
+    {
+        static if (__traits(compiles, super()))
+            super();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/b16598.d b/gcc/testsuite/gdc.test/compilable/b16598.d
new file mode 100644
index 00000000000..67cd7f5e8dd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/b16598.d
@@ -0,0 +1,15 @@
+struct S
+{
+    this(int) {}
+    ~this() {}
+}
+
+int g(S a, S b)
+{
+    return 1;
+}
+
+void main()
+{
+    true ? g(S(), S(1)) : {}();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/b16697.d b/gcc/testsuite/gdc.test/compilable/b16697.d
new file mode 100644
index 00000000000..78c9a2b1560
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/b16697.d
@@ -0,0 +1,13 @@
+version(D_SIMD)
+{
+    static assert(!is(         float       == __vector)); 
+    static assert(!is(         float[1]    == __vector)); 
+    static assert(!is(         float[4]    == __vector)); 
+    static assert( is(__vector(float[4])   == __vector)); 
+    static assert(!is(__vector(float[3])   == __vector)); 
+    static assert(!is(__vector(float[5])   == __vector)); 
+    static assert( is(__vector(float[4]) X == __vector) &&
+                   is(X == float[4])); 
+    static assert( is(__vector(byte[16]) X == __vector) &&
+                   is(X == byte[16])); 
+}
diff --git a/gcc/testsuite/gdc.test/compilable/b16967.d b/gcc/testsuite/gdc.test/compilable/b16967.d
new file mode 100644
index 00000000000..2b02fc3abb8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/b16967.d
@@ -0,0 +1,33 @@
+/* 
+ * REQUIRED_ARGS: -c
+ * TEST_OUTPUT:
+---
+compilable/b16967.d(16): Deprecation: switch case fallthrough - use 'goto default;' if intended
+compilable/b16967.d(26): Deprecation: switch case fallthrough - use 'goto default;' if intended
+---
+*/
+int foo(int x)
+in
+{
+    switch (x)
+    {
+        case 1:
+            assert(x != 0);
+        default:
+            break;
+    }
+}
+out(v)
+{
+    switch(v)
+    {
+        case 42:
+            assert(x != 0);
+        default:
+            break;
+    }
+}
+body
+{
+    return 42;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/b33.d b/gcc/testsuite/gdc.test/compilable/b33.d
new file mode 100644
index 00000000000..d422959d51e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/b33.d
@@ -0,0 +1,12 @@
+// EXTRA_SOURCES: imports/b33a.d
+// PERMUTE_ARGS:
+
+module b33;
+
+private import imports.b33a;
+
+size_t fn()
+{
+    return find( "123" );
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/b6395.d b/gcc/testsuite/gdc.test/compilable/b6395.d
new file mode 100644
index 00000000000..209b708313a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/b6395.d
@@ -0,0 +1,25 @@
+// REQUIRED_ARGS: -c -Icompilable/extra-files
+// EXTRA_SOURCES: extra-files/c6395.d
+
+// 6395
+
+import c6395;
+
+int regex(string pattern)
+{
+  return 0;
+}
+
+bool match(string r)
+{
+  return true;
+}
+
+void applyNoRemoveRegex()
+{
+  void scan(string[] noRemoveStr, string e)
+  {
+    auto a = find!((a){return match(e);})(map!regex(noRemoveStr));
+  }
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/bug11735.d b/gcc/testsuite/gdc.test/compilable/bug11735.d
new file mode 100644
index 00000000000..b94cb6e77da
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/bug11735.d
@@ -0,0 +1,36 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+print string
+print wstring
+print dstring
+يطبع الترميز الموحد
+يطبع الترميز الموحد
+يطبع الترميز الموحد
+foo_str
+foo_wstr
+foo_dstr
+---
+*/
+
+pragma(msg, "print string");
+pragma(msg, "print wstring"w);
+pragma(msg, "print dstring"d);
+
+pragma(msg, "يطبع الترميز الموحد");
+pragma(msg, "يطبع الترميز الموحد"w);
+pragma(msg, "يطبع الترميز الموحد"d);
+
+void main()
+{
+    enum a = "foo_str";
+    enum b = "foo_wstr"w;
+    enum c = "foo_dstr"d;
+
+    pragma(msg, a);
+    pragma(msg, b);
+    pragma(msg, c);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/bug6963.d b/gcc/testsuite/gdc.test/compilable/bug6963.d
new file mode 100644
index 00000000000..33d595cfedb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/bug6963.d
@@ -0,0 +1,73 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+output foo: 1e: pure nothrow @nogc @safe void(int x)
+output foo: 3e: pure nothrow @nogc @safe void(int x)
+---
+*/
+
+alias void function(int) pure nothrow @safe @nogc FuncPtrType;
+
+void foo1a(X)(X x) {}
+void foo1b(X)(X x) {}
+void foo1c(X)(X x) {}
+void foo1d(X)(X x) {}
+void foo1e(X)(X x) {}
+
+// module level declaration with type inference
+auto fptr1 = &foo1a!int;
+static assert(is(typeof(fptr1) == FuncPtrType));
+
+// array initializer
+auto fptrlist1 = [&foo1b!int];
+static assert(is(typeof(fptrlist1) == FuncPtrType[]));
+
+// static assert
+static assert(is(typeof(&foo1c!int) == FuncPtrType));
+
+// static if
+static if(is(typeof(&foo1d!int) PF))
+    static assert(is(PF == FuncPtrType));
+else
+    static assert(0);
+
+// pragma test
+pragma(msg, "output foo: 1e: ", typeof(foo1e!int).stringof);
+
+void foo2a(X)(X x) {}
+void foo2b(X)(X x) {}
+void foo2c(X)(X x) {}
+
+FuncPtrType fptr3 = &foo2a!int;     // most similar to original issue
+
+FuncPtrType[] fptrlist3 = [&foo2b!int];
+
+struct S{ FuncPtrType fp; }
+S s = { &foo2c!int };
+
+void foo3a(X)(X x) {}
+void foo3b(X)(X x) {}
+void foo3c(X)(X x) {}
+void foo3d(X)(X x) {}
+void foo3e(X)(X x) {}
+
+void main()
+{
+    auto fptr2 = &foo3a!int;
+    static assert(is(typeof(fptr2) == FuncPtrType));
+
+    auto fptrlist2 = [&foo3b!int];
+    static assert(is(typeof(fptrlist2) == FuncPtrType[]));
+
+    static assert(is(typeof(&foo1c!int) == FuncPtrType));
+
+    static if(is(typeof(&foo1d!int) PF))
+        static assert(is(PF == FuncPtrType));
+    else
+        static assert(0);
+
+    pragma(msg, "output foo: 3e: ", typeof(foo3e!int));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/callconv.d b/gcc/testsuite/gdc.test/compilable/callconv.d
new file mode 100644
index 00000000000..fbb78ed7c39
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/callconv.d
@@ -0,0 +1,75 @@
+// PERMUTE_ARGS:
+
+import core.stdc.stdarg;
+
+struct ABC
+{
+	int x[4];
+}
+
+ABC abc;
+
+int x,y,z;
+
+extern (Pascal):
+ABC test1(int xx, int yy, int zz)
+{
+    x = xx;
+    y = yy;
+    z = zz;
+    return abc;
+}
+
+extern (Pascal):
+ABC test1v(int xx, int yy, int zz, ...)
+{
+    x = xx;
+    y = yy;
+    z = zz;
+    return abc;
+}
+
+extern (C):
+ABC test2v(int xx, int yy, int zz, ...)
+{
+    x = xx;
+    y = yy;
+    z = zz;
+    return abc;
+}
+
+extern (C++):
+ABC test3(int xx, int yy, int zz)
+{
+    x = xx;
+    y = yy;
+    z = zz;
+    return abc;
+}
+
+ABC test3v(int xx, int yy, int zz, ...)
+{
+    x = xx;
+    y = yy;
+    z = zz;
+    return abc;
+}
+
+extern (D):
+ABC test4(int xx, int yy, int zz)
+{
+    x = xx;
+    y = yy;
+    z = zz;
+    return abc;
+}
+
+ABC test4v(int xx, int yy, int zz, ...)
+{
+    x = xx;
+    y = yy;
+    z = zz;
+    return abc;
+}
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/compile1.d b/gcc/testsuite/gdc.test/compilable/compile1.d
new file mode 100644
index 00000000000..7b84246793c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/compile1.d
@@ -0,0 +1,920 @@
+// PERMUTE_ARGS:
+
+/**************************************************
+    1748 class template with stringof
+**************************************************/
+
+struct S1748(T) {}
+static assert(S1748!int.stringof == "S1748!int");
+
+class C1748(T) {}
+static assert(C1748!int.stringof == "C1748!int");
+
+/**************************************************
+    2354 pragma + single semicolon DeclarationBlock
+**************************************************/
+
+version(all)
+    pragma(msg, "true");
+else
+    pragma(msg, "false");
+
+/**************************************************
+    2438
+**************************************************/
+
+alias void delegate() Dg2438;
+
+alias typeof(Dg2438.ptr)     CP2438a;
+alias typeof(Dg2438.funcptr) FP2438a;
+static assert(is(CP2438a == void*));
+static assert(is(FP2438a == void function()));
+
+alias typeof(Dg2438.init.ptr)     CP2438b;
+alias typeof(Dg2438.init.funcptr) FP2438b;
+static assert(is(CP2438b == void*));
+static assert(is(FP2438b == void function()));
+
+/**************************************************
+    4225
+**************************************************/
+
+struct Foo4225
+{
+    enum x = Foo4225();
+
+    static Foo4225 opCall()
+    {
+        return Foo4225.init;
+    }
+}
+
+/**************************************************
+    5996    ICE(expression.c)
+**************************************************/
+
+template T5996(T)
+{
+    auto bug5996() {
+        if (anyOldGarbage) {}
+        return 2;
+    }
+}
+static assert(!is(typeof(T5996!(int).bug5996())));
+
+/**************************************************
+    8532    segfault(mtype.c) - type inference + pure
+**************************************************/
+auto segfault8532(Y, R ...)(R r, Y val) pure
+{ return segfault8532(r, val); }
+
+static assert(!is(typeof( segfault8532(1,2,3))));
+
+/**************************************************
+    8982    ICE(ctfeexpr.c) __parameters with error in default value
+**************************************************/
+template ice8982(T)
+{
+    void bug8982(ref const int v = 7){}
+
+    static if (is(typeof(bug8982) P == __parameters)) {
+        pragma(msg, ((P[0..1] g) => g[0])());
+    }
+}
+
+static assert(!is(ice8982!(int)));
+
+
+/**************************************************
+    8801    ICE assigning to __ctfe
+**************************************************/
+static assert(!is(typeof( { bool __ctfe= true; })));
+static assert(!is(typeof( { __ctfe |= true; })));
+
+/**************************************************
+    5932    ICE(s2ir.c)
+    6675    ICE(glue.c)
+**************************************************/
+
+void bug3932(T)() {
+    static assert( 0 );
+    func5932( 7 );
+}
+
+void func5932(T)( T val ) {
+    void onStandardMsg() {
+        foreach( t; T ) { }
+    }
+}
+
+static assert(!is(typeof(
+    {
+        bug3932!(int)();
+    }()
+)));
+
+/**************************************************
+    6650    ICE(glue.c) or wrong-code
+**************************************************/
+
+auto bug6650(X)(X y)
+{
+    X q;
+    q = "abc";
+    return y;
+}
+
+static assert(!is(typeof(bug6650!(int)(6))));
+static assert(!is(typeof(bug6650!(int)(18))));
+
+/**************************************************
+    14710    VC-built DMD crashes on templated variadic function IFTI
+**************************************************/
+
+void bug14710a(T)(T val, T[] arr...)
+{
+}
+
+void bug14710b()
+{
+    bug14710a("", "");
+}
+
+/**************************************************
+  6661 Templates instantiated only through is(typeof()) shouldn't cause errors
+**************************************************/
+
+template bug6661(Q)
+{
+    int qutz(Q y)
+    {
+        Q q = "abc";
+        return 67;
+    }
+    static assert(qutz(13).sizeof!=299);
+    const Q blaz = 6;
+}
+
+static assert(!is(typeof(bug6661!(int).blaz)));
+
+template bug6661x(Q)
+{
+    int qutz(Q y)
+    {
+        Q q = "abc";
+        return 67;
+    }
+}
+// should pass, but doesn't in current
+//static assert(!is(typeof(bug6661x!(int))));
+
+/**************************************************
+    6599    ICE(constfold.c) or segfault
+**************************************************/
+
+string bug6599extraTest(string x) { return x ~ "abc"; }
+
+template Bug6599(X)
+{
+    class Orbit
+    {
+        Repository repository = Repository();
+    }
+
+    struct Repository
+    {
+        string fileProtocol = "file://";
+        string blah = bug6599extraTest("abc");
+        string source = fileProtocol ~ "/usr/local/orbit/repository";
+    }
+}
+
+static assert(!is(typeof(Bug6599!int)));
+
+/**************************************************
+    8422    TypeTuple of tuples can't be read at compile time
+**************************************************/
+
+template TypeTuple8422(TList...)
+{
+    alias TList TypeTuple8422;
+}
+
+struct S8422 { int x; }
+
+void test8422()
+{
+    enum a = S8422(1);
+    enum b = S8422(2);
+    enum c = [1,2,3];
+    foreach(t; TypeTuple8422!(b, a)) {
+        enum u = t;
+    }
+    foreach(t; TypeTuple8422!(c)) {
+        enum v = t;
+    }
+}
+
+/**************************************************
+    6096    ICE(el.c) with -O
+**************************************************/
+
+cdouble c6096;
+
+int bug6096()
+{
+    if (c6096) return 0;
+    return 1;
+}
+
+/**************************************************
+    7681  Segfault
+**************************************************/
+
+static assert( !is(typeof( (){
+      undefined ~= delegate(){}; return 7;
+  }())));
+
+/**************************************************
+    8639  Buffer overflow
+**************************************************/
+
+void t8639(alias a)() {}
+void bug8639() {
+  t8639!({auto r = -real.max;})();
+}
+
+/**************************************************
+    7751  Segfault
+**************************************************/
+
+static assert( !is(typeof( (){
+    bar[]r; r ~= [];
+     return 7;
+  }())));
+
+/**************************************************
+    7639  Segfault
+**************************************************/
+
+static assert( !is(typeof( (){
+    enum foo =
+    [
+        str : "functions",
+    ];
+})));
+
+/**************************************************
+    11991
+**************************************************/
+
+void main()
+{
+    int Throwable;
+    int object;
+    try
+    {
+    }
+    catch
+    {
+    }
+}
+
+/**************************************************
+    11939
+**************************************************/
+
+void test11939()
+{
+    scope(failure)
+    {
+        import object : Object;
+    }
+    throw new Exception("");
+}
+
+/**************************************************
+    5796
+**************************************************/
+
+template A(B) {
+    pragma(msg, "missing ;")
+    enum X = 0;
+}
+
+static assert(!is(typeof(A!(int))));
+
+/**************************************************
+    6720
+**************************************************/
+void bug6720() { }
+
+static assert(!is(typeof(
+cast(bool)bug6720()
+)));
+
+/**************************************************
+    1099
+**************************************************/
+
+template Mix1099(int a) {
+   alias typeof(this) ThisType;
+    static assert (ThisType.init.tupleof.length == 2);
+}
+
+
+struct Foo1099 {
+    mixin Mix1099!(0);
+    int foo;
+    mixin Mix1099!(1);
+    int bar;
+    mixin Mix1099!(2);
+}
+
+/**************************************************
+    8788 - super() and return
+**************************************************/
+
+class B8788 {
+        this ( ) { }
+}
+
+class C8788(int test) : B8788
+{
+    this ( int y )
+    {   // TESTS WHICH SHOULD PASS
+        static if (test == 1) {
+            if (y == 3) {
+                super();
+                return;
+            }
+            super();
+            return;
+        } else static if (test == 2) {
+            if (y == 3) {
+                super();
+                return;
+            }
+            super();
+        } else static if (test == 3) {
+            if (y > 3) {
+                if (y == 7) {
+                   super();
+                   return;
+                }
+                super();
+                return;
+            }
+            super();
+        } else static if (test == 4) {
+            if (y > 3) {
+                if (y == 7) {
+                   super();
+                   return;
+                }
+                else if (y> 5)
+                    super();
+                else super();
+                return;
+            }
+            super();
+        }
+        // TESTS WHICH SHOULD FAIL
+        else static if (test == 5) {
+            if (y == 3) {
+                super();
+                return;
+            }
+            return; // no super
+        } else static if (test == 6) {
+            if (y > 3) {
+                if (y == 7) {
+                   super();
+                   return;
+                }
+                super();
+            }
+            super(); // two calls
+        } else static if (test == 7) {
+            if (y == 3) {
+                return; // no super
+            }
+            super();
+        } else static if (test == 8) {
+            if (y > 3) {
+                if (y == 7) {
+                   return; // no super
+                }
+                super();
+                return;
+            }
+            super();
+        } else static if (test == 9) {
+            if (y > 3) {
+                if (y == 7) {
+                   super();
+                   return;
+                }
+                else if (y> 5)
+                    super();
+                else return; // no super
+                return;
+            }
+            super();
+        }
+    }
+}
+
+static assert( is(typeof( { new C8788!(1)(0); } )));
+static assert( is(typeof( { new C8788!(2)(0); } )));
+static assert( is(typeof( { new C8788!(3)(0); } )));
+static assert( is(typeof( { new C8788!(4)(0); } )));
+static assert(!is(typeof( { new C8788!(5)(0); } )));
+static assert(!is(typeof( { new C8788!(6)(0); } )));
+static assert(!is(typeof( { new C8788!(7)(0); } )));
+static assert(!is(typeof( { new C8788!(8)(0); } )));
+static assert(!is(typeof( { new C8788!(9)(0); } )));
+
+/**************************************************
+    4967, 7058
+**************************************************/
+
+enum Bug7058 bug7058 = { 1.5f, 2};
+static assert(bug7058.z == 99);
+
+struct Bug7058
+{
+     float x = 0;
+     float y = 0;
+     float z = 99;
+}
+
+
+/***************************************************/
+
+void test12094()
+{
+    auto n = null;
+    int *a;
+    int[int] b;
+    int[] c;
+    auto u = true ? null : a;
+    auto v = true ? null : b;
+    auto w = true ? null : c;
+    auto x = true ? n : a;
+    auto y = true ? n : b;
+    auto z = true ? n : c;
+    a = n;
+    b = n;
+    c = n;
+}
+
+/***************************************************/
+
+template test8163(T...)
+{
+    struct Point
+    {
+        T fields;
+    }
+
+    enum N = 2; // N>=2 triggers the bug
+    extern Point[N] bar();
+
+    void foo()
+    {
+        Point[N] _ = bar();
+    }
+}
+
+alias test8163!(long) _l;
+alias test8163!(double) _d;
+alias test8163!(float, float) _ff;
+alias test8163!(int, int) _ii;
+alias test8163!(int, float) _if;
+alias test8163!(ushort, ushort, ushort, ushort) _SSSS;
+alias test8163!(ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte) _BBBBBBBB;
+alias test8163!(ubyte, ubyte, ushort, float) _BBSf;
+
+
+/***************************************************/
+// 4757
+
+auto foo4757(T)(T)
+{
+    static struct Bar(T)
+    {
+        void spam()
+        {
+            foo4757(1);
+        }
+    }
+    return Bar!T();
+}
+
+void test4757()
+{
+    foo4757(1);
+}
+
+/***************************************************/
+// 9348
+
+void test9348()
+{
+    @property Object F(int E)() { return null; }
+
+    assert(F!0 !is null);
+    assert(F!0 !in [new Object():1]);
+}
+
+/***************************************************/
+// 9690
+
+@disable
+{
+    void dep9690() {}
+    void test9690()
+    {
+        dep9690();      // OK
+        void inner()
+        {
+            dep9690();  // OK <- NG
+        }
+    }
+}
+
+/***************************************************/
+// 9987
+
+static if (is(object.ModuleInfo == struct))
+{
+    struct ModuleInfo {}
+
+    static assert(!is(object.ModuleInfo == ModuleInfo));
+    static assert(object.ModuleInfo.sizeof != ModuleInfo.sizeof);
+}
+static if (is(object.ModuleInfo == class))
+{
+    class ModuleInfo {}
+
+    static assert(!is(object.ModuleInfo == ModuleInfo));
+    static assert(__traits(classInstanceSize, object.ModuleInfo) !=
+                  __traits(classInstanceSize, ModuleInfo));
+}
+
+/***************************************************/
+// 10158
+
+class Outer10158
+{
+    static struct Inner
+    {
+        int f;
+    }
+
+    void test()
+    {
+        static assert( Inner.f .offsetof == 0);  // OK <- NG
+        static assert((Inner.f).offsetof == 0);  // OK
+    }
+}
+
+void test10158()
+{
+    static assert(Outer10158.Inner.f.offsetof == 0);  // OK
+}
+
+/***************************************************/
+// 10326
+
+class C10326
+{
+    int val;
+    invariant   { assert(val == 0); }
+    invariant() { assert(val == 0); }
+}
+
+/***************************************************/
+// 11042
+
+static if           ((true  || error) == true ) {} else { static assert(0); }
+static if           ((false && error) == false) {} else { static assert(0); }
+static assert       ((true  || error) == true );
+static assert       ((false && error) == false);
+int f11042a1()() if ((true  || error) == true ) { return 0; }   enum x11042a1 = f11042a1();
+int f11042b1()() if ((false && error) == false) { return 0; }   enum x11042b1 = f11042b1();
+
+static if           (is(typeof(true  || error)) == false) {} else { static assert(0); }
+static if           (is(typeof(false && error)) == false) {} else { static assert(0); }
+static assert       (is(typeof(true  || error)) == false);
+static assert       (is(typeof(false && error)) == false);
+int f11042a2()() if (is(typeof(true  || error)) == false) { return 0; }   enum x11042a2 = f11042a2();
+int f11042b2()() if (is(typeof(false && error)) == false) { return 0; }   enum x11042b2 = f11042b2();
+
+static if           (__traits(compiles, true  || error) == false) {} else { static assert(0); }
+static if           (__traits(compiles, false && error) == false) {} else { static assert(0); }
+static assert       (__traits(compiles, true  || error) == false);
+static assert       (__traits(compiles, false && error) == false);
+int f11042a3()() if (__traits(compiles, true  || error) == false) { return 0; }   enum x11042a3 = f11042a3();
+int f11042b3()() if (__traits(compiles, false && error) == false) { return 0; }   enum x11042b3 = f11042b3();
+
+/***************************************************/
+// 11554
+
+enum E11554;
+static assert(is(E11554 == enum));
+
+struct Bro11554(N...) {}
+static assert(!is(E11554 unused : Bro11554!M, M...));
+
+/***************************************************/
+// 12302
+
+template isCallable12302(T...)
+    if (T.length == 1)
+{
+    static if (is(typeof(& T[0].opCall) == delegate))
+        enum bool isCallable12302 = true;
+    else
+    static if (is(typeof(& T[0].opCall) V : V*) && is(V == function))
+        enum bool isCallable12302 = true;
+    else
+        enum bool isCallable12302 = true;
+}
+
+class A12302
+{
+    struct X {}
+    X x;
+    auto opDispatch(string s, TArgs...)(TArgs args)
+    {
+        mixin("return x."~s~"(args);");
+    }
+}
+
+A12302 func12302() { return null; }
+enum b12302 = isCallable12302!func12302;
+
+/***************************************************/
+// 12476
+
+template A12476(T) {  }
+
+struct S12476(T)
+{
+    alias B = A12476!T;
+}
+
+class C12476(T)
+{
+    alias B = A12476!T;
+}
+
+struct Bar12476(alias Foo)
+{
+    Foo!int baz;
+    alias baz this;
+}
+
+alias Identity12476(alias A) = A;
+
+alias sb12476 = Identity12476!(Bar12476!S12476.B);
+alias cb12476 = Identity12476!(Bar12476!C12476.B);
+
+static assert(__traits(isSame, sb12476, A12476!int));
+static assert(__traits(isSame, cb12476, A12476!int));
+
+/***************************************************/
+// 12506
+
+import imports.a12506;
+private           bool[9] r12506a = f12506!(i => true)(); // OK
+private immutable bool[9] r12506b = f12506!(i => true)(); // OK <- error
+
+/***************************************************/
+// 12555
+
+class A12555(T)
+{
+    Undef12555 error;
+}
+
+static assert(!__traits(compiles, {
+    class C : A12555!C  { }
+}));
+
+/***************************************************/
+// 11622
+
+class A11622(T)
+{
+    B11622!T foo()
+    {
+        return new B11622!T;
+    }
+}
+
+class B11622(T) : T
+{
+}
+
+static assert(!__traits(compiles, {
+    class C : A11622!C  { }
+}));
+
+/***************************************************/
+// 12688
+
+void writeln12688(A...)(A) {}
+
+struct S12688
+{
+    int foo() @property { return 1; }
+}
+
+void test12688()
+{
+    S12688 s;
+    s.foo.writeln12688;   // ok
+    (s.foo).writeln12688; // ok <- ng
+}
+
+/***************************************************/
+// 12703
+
+struct S12703
+{
+    this(int) {}
+}
+
+final class C12703
+{
+    S12703 s = S12703(1);
+}
+
+/***************************************************/
+// 12799
+
+struct A12799
+{
+    int a;
+    enum C = A12799.sizeof;
+    enum D = C; // OK <- Error
+}
+
+/***************************************************/
+// 13236
+
+pragma(msg, is(typeof({ struct S { S x; } })));
+
+/***************************************************/
+// 13280
+
+struct S13280
+{
+    alias U = ubyte;
+    alias T1 =       ubyte[this.sizeof]; // ok
+    alias T2 = const     U[this.sizeof]; // ok
+    alias T3 = const ubyte[this.sizeof]; // ok <- error
+}
+
+/***************************************************/
+// 13481
+
+mixin template Mix13481(void function() callback)
+{
+    static this()
+    {
+        callback();
+    }
+}
+
+/***************************************************/
+// 13564
+
+class E13564(T)
+{
+    int pos;
+}
+
+class C13564(T)
+{
+    struct S
+    {
+        ~this()
+        {
+            C13564!int c;
+            c.element.pos = 0;
+        }
+    }
+
+    E13564!T element;
+}
+
+void test13564()
+{
+    auto c = new C13564!int();
+}
+
+/***************************************************/
+// 14166
+
+struct Proxy14166(T)
+{
+    T* ptr;
+    ref deref() { return *ptr; }
+    alias deref this;
+}
+struct Test14166
+{
+    auto opIndex() { return this; }
+    auto opIndex(int) { return 1; }
+}
+template Elem14166a(R) { alias Elem14166a = typeof(R.init[][0]); }
+template Elem14166b(R) { alias Elem14166b = typeof(R.init[0]); }
+void test14166()
+{
+    alias T = Proxy14166!Test14166;
+    static assert(is(Elem14166a!T == int));     // rejects-valid case
+    static assert(is(Elem14166b!T == int));     // regression case
+}
+
+// other related cases
+struct S14166
+{
+    int x;
+    double y;
+    int[] a;
+    S14166 opUnary(string op : "++")() { return this;  }
+}
+S14166 s14166;
+
+struct X14166 { this(int) { } X14166 opAssign(int) { return this; } }
+X14166[int] aa14166;
+X14166[int] makeAA14166() { return aa14166; }
+
+struct Tup14166(T...) { T field; alias field this; }
+Tup14166!(int, int) tup14166;
+Tup14166!(int, int) makeTup14166() { return tup14166; }
+
+pragma(msg, typeof((s14166.x += 1) = 2));    // ok <- error
+pragma(msg, typeof(s14166.a.length += 2));   // ok <- error
+pragma(msg, typeof(s14166++));               // ok <- error
+pragma(msg, typeof(s14166.x ^^ 2));          // ok <- error
+pragma(msg, typeof(s14166.y ^^= 2.5));       // ok <- error
+pragma(msg, typeof(makeAA14166()[0] = 1));   // ok <- error
+pragma(msg, typeof(tup14166.field = makeTup14166()));   // ok <- error
+
+/***************************************************/
+// 14388
+
+@property immutable(T)[] idup14388(T)(T[] a)
+{
+    alias U = immutable(T);
+    U[] res;
+    foreach (ref e; a)
+        res ~= e;
+    return res;
+}
+
+struct Data14388(A14388 a)
+{
+    auto foo()
+    {
+        return Data14388!a.init;    // [B]
+    }
+}
+
+struct A14388
+{
+    struct Item {}
+
+    immutable(Item)[] items;
+
+    this(int dummy)
+    {
+        items = [Item()].idup14388;
+    }
+}
+
+void test14388()
+{
+    auto test = Data14388!(A14388(42)).init.foo();  // [A]
+    /*
+     * A(42) is interpreter to a struct literal A([immutable(Item)()]).
+     * The internal VarDeclaration with STCmanifest for the Data's template parameteter 'a'
+     * calls syntaxCopy() on its ((ExpInitializer *)init)->exp in VarDeclaration::semantic(),
+     * and 'immutable(Item)()'->syntaxCopy() had incorrectly removed the qualifier.
+     * Then, the arguments of two Data template instances at [A] and [B] had become unmatch,
+     * and the second instantiation had created the AST duplication.
+     */
+}
+
+/**************************************************
+    3438
+**************************************************/
+import core.vararg;
+struct S3438_1 { this(int x, int y = 1) { } }
+struct S3438_2 { this(int x, ...) { } }
+struct S3438_3 { this(int x, int[] arr...) { } }
diff --git a/gcc/testsuite/gdc.test/compilable/const.d b/gcc/testsuite/gdc.test/compilable/const.d
new file mode 100644
index 00000000000..9b97037baa0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/const.d
@@ -0,0 +1,41 @@
+
+static assert(2.0  * 3.0  ==  6 );
+static assert(2.0  * 3.0i ==  6i);
+static assert(2.0i * 3.0  ==  6i);
+static assert(2.0i * 3.0i == -6 );
+
+static assert(2.0  * (4.0 + 3.0i) ==  8  + 6i);
+static assert(2.0i * (4.0 + 3.0i) ==  8i - 6 );
+static assert((4.0 + 3.0i) * 2.0  ==  8  + 6i);
+static assert((4.0 + 3.0i) * 2.0i ==  8i - 6 );
+static assert((4.0 + 3.0i) * (5 + 7i) ==  -1 + 43i );
+
+static assert((2.0).re == 2);
+static assert((2.0i).re == 0);
+static assert((3+2.0i).re == 3);
+
+static assert((4.0i).im == 4);
+static assert((2.0i).im == 2);
+static assert((3+2.0i).im == 2);
+
+static assert(6.0 / 2.0 == 3);
+static assert(6i / 2i ==  3);
+static assert(6  / 2i == -3i);
+static assert(6i / 2  ==  3i);
+
+static assert((6 + 4i) / 2 == 3 + 2i);
+static assert((6 + 4i) / 2i == -3i + 2);
+
+//static assert(2 / (6 + 4i) == -3i);
+//static assert(2i / (6 + 4i)  ==  3i);
+//static assert((1 + 2i) / (6 + 4i)  ==  3i);
+
+static assert(6.0 % 2.0 == 0);
+static assert(6.0 % 3.0 == 0);
+static assert(6.0 % 4.0 == 2);
+
+static assert(6.0i % 2.0i == 0);
+static assert(6.0i % 3.0i == 0);
+static assert(6.0i % 4.0i == 2i);
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/cppmangle.d b/gcc/testsuite/gdc.test/compilable/cppmangle.d
new file mode 100644
index 00000000000..91e00d1debe
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/cppmangle.d
@@ -0,0 +1,309 @@
+
+// Test C++ name mangling.
+// See Bugs 4059, 5148, 7024, 10058
+
+version(linux):
+
+import core.stdc.stdio;
+
+extern (C++) int foob(int i, int j, int k);
+
+class C
+{
+    extern (C++) int bar(int i, int j, int k)
+    {
+        printf("this = %p\n", this);
+        printf("i = %d\n", i);
+        printf("j = %d\n", j);
+        printf("k = %d\n", k);
+        return 1;
+    }
+}
+
+
+extern (C++)
+int foo(int i, int j, int k)
+{
+    printf("i = %d\n", i);
+    printf("j = %d\n", j);
+    printf("k = %d\n", k);
+    assert(i == 1);
+    assert(j == 2);
+    assert(k == 3);
+    return 1;
+}
+
+void test1()
+{
+    foo(1, 2, 3);
+
+    auto i = foob(1, 2, 3);
+    assert(i == 7);
+
+    C c = new C();
+    c.bar(4, 5, 6);
+}
+
+static assert(foo.mangleof == "_Z3fooiii");
+static assert(foob.mangleof == "_Z4foobiii");
+static assert(C.bar.mangleof == "_ZN1C3barEiii");
+
+/****************************************/
+
+extern (C++)
+interface D
+{
+    int bar(int i, int j, int k);
+}
+
+extern (C++) D getD();
+
+void test2()
+{
+    D d = getD();
+    int i = d.bar(9,10,11);
+    assert(i == 8);
+}
+
+static assert (getD.mangleof == "_Z4getDv");
+static assert (D.bar.mangleof == "_ZN1D3barEiii");
+
+/****************************************/
+
+extern (C++) int callE(E);
+
+extern (C++)
+interface E
+{
+    int bar(int i, int j, int k);
+}
+
+class F : E
+{
+    extern (C++) int bar(int i, int j, int k)
+    {
+        printf("F.bar: i = %d\n", i);
+        printf("F.bar: j = %d\n", j);
+        printf("F.bar: k = %d\n", k);
+        assert(i == 11);
+        assert(j == 12);
+        assert(k == 13);
+        return 8;
+    }
+}
+
+void test3()
+{
+    F f = new F();
+    int i = callE(f);
+    assert(i == 8);
+}
+
+static assert (callE.mangleof == "_Z5callEP1E");
+static assert (E.bar.mangleof == "_ZN1E3barEiii");
+static assert (F.bar.mangleof == "_ZN1F3barEiii");
+
+/****************************************/
+
+extern (C++) void foo4(char* p);
+
+void test4()
+{
+    foo4(null);
+}
+
+static assert(foo4.mangleof == "_Z4foo4Pc");
+
+/****************************************/
+
+extern(C++)
+{
+  struct foo5 { int i; int j; void* p; }
+
+  interface bar5{
+    foo5 getFoo(int i);
+  }
+
+  bar5 newBar();
+}
+
+void test5()
+{
+  bar5 b = newBar();
+  foo5 f = b.getFoo(4);
+  printf("f.p = %p, b = %p\n", f.p, cast(void*)b);
+  assert(f.p == cast(void*)b);
+}
+
+static assert(bar5.getFoo.mangleof == "_ZN4bar56getFooEi");
+static assert (newBar.mangleof == "_Z6newBarv");
+
+/****************************************/
+
+extern(C++)
+{
+    struct S6
+    {
+        int i;
+        double d;
+    }
+    S6 foo6();
+}
+
+extern (C) int foosize6();
+
+void test6()
+{
+    S6 f = foo6();
+    printf("%d %d\n", foosize6(), S6.sizeof);
+    assert(foosize6() == S6.sizeof);
+    assert(f.i == 42);
+    printf("f.d = %g\n", f.d);
+    assert(f.d == 2.5);
+}
+
+static assert (foo6.mangleof == "_Z4foo6v");
+
+/****************************************/
+
+extern (C) int foo7();
+
+struct S
+{
+    int i;
+    long l;
+}
+
+void test7()
+{
+    printf("%d %d\n", foo7(), S.sizeof);
+    assert(foo7() == S.sizeof);
+}
+
+/****************************************/
+
+extern (C++) void foo8(const char *);
+
+void test8()
+{
+    char c;
+    foo8(&c);
+}
+
+static assert(foo8.mangleof == "_Z4foo8PKc");
+
+/****************************************/
+// 4059
+
+struct elem9 { }
+
+extern(C++) void foobar9(elem9*, elem9*);
+
+void test9()
+{
+    elem9 *a;
+    foobar9(a, a);
+}
+
+static assert(foobar9.mangleof == "_Z7foobar9P5elem9S0_");
+
+/****************************************/
+// 5148
+
+extern (C++)
+{
+    void foo10(const char*, const char*);
+    void foo10(const int, const int);
+    void foo10(const char, const char);
+
+    struct MyStructType { }
+    void foo10(const MyStructType s, const MyStructType t);
+
+    enum MyEnumType { onemember }
+    void foo10(const MyEnumType s, const MyEnumType t);
+}
+
+void test10()
+{
+    char* p;
+    foo10(p, p);
+    foo10(1,2);
+    foo10('c','d');
+    MyStructType s;
+    foo10(s,s);
+    MyEnumType e;
+    foo10(e,e);
+}
+
+/**************************************/
+// 10058
+
+extern (C++)
+{
+    void test10058a(void*) { }
+    void test10058b(void function(void*)) { }
+    void test10058c(void* function(void*)) { }
+    void test10058d(void function(void*), void*) { }
+    void test10058e(void* function(void*), void*) { }
+    void test10058f(void* function(void*), void* function(void*)) { }
+    void test10058g(void function(void*), void*, void*) { }
+    void test10058h(void* function(void*), void*, void*) { }
+    void test10058i(void* function(void*), void* function(void*), void*) { }
+    void test10058j(void* function(void*), void* function(void*), void* function(void*)) { }
+    void test10058k(void* function(void*), void* function(const (void)*)) { }
+    void test10058l(void* function(void*), void* function(const (void)*), const(void)* function(void*)) { }
+}
+
+static assert(test10058a.mangleof == "_Z10test10058aPv");
+static assert(test10058b.mangleof == "_Z10test10058bPFvPvE");
+static assert(test10058c.mangleof == "_Z10test10058cPFPvS_E");
+static assert(test10058d.mangleof == "_Z10test10058dPFvPvES_");
+static assert(test10058e.mangleof == "_Z10test10058ePFPvS_ES_");
+static assert(test10058f.mangleof == "_Z10test10058fPFPvS_ES1_");
+static assert(test10058g.mangleof == "_Z10test10058gPFvPvES_S_");
+static assert(test10058h.mangleof == "_Z10test10058hPFPvS_ES_S_");
+static assert(test10058i.mangleof == "_Z10test10058iPFPvS_ES1_S_");
+static assert(test10058j.mangleof == "_Z10test10058jPFPvS_ES1_S1_");
+static assert(test10058k.mangleof == "_Z10test10058kPFPvS_EPFS_PKvE");
+static assert(test10058l.mangleof == "_Z10test10058lPFPvS_EPFS_PKvEPFS3_S_E");
+
+/**************************************/
+// 11696
+
+class Expression;
+struct Loc {}
+
+extern(C++)
+class CallExp
+{
+    static void test11696a(Loc, Expression, Expression);
+    static void test11696b(Loc, Expression, Expression*);
+    static void test11696c(Loc, Expression*, Expression);
+    static void test11696d(Loc, Expression*, Expression*);
+}
+
+static assert(CallExp.test11696a.mangleof == "_ZN7CallExp10test11696aE3LocP10ExpressionS2_");
+static assert(CallExp.test11696b.mangleof == "_ZN7CallExp10test11696bE3LocP10ExpressionPS2_");
+static assert(CallExp.test11696c.mangleof == "_ZN7CallExp10test11696cE3LocPP10ExpressionS2_");
+static assert(CallExp.test11696d.mangleof == "_ZN7CallExp10test11696dE3LocPP10ExpressionS3_");
+
+/**************************************/
+// 13337
+
+extern(C++, N13337a.N13337b.N13337c)
+{
+  struct S13337{}
+  void foo13337(S13337 s);
+}
+
+static assert(foo13337.mangleof == "_ZN7N13337a7N13337b7N13337c8foo13337ENS1_6S13337E");
+
+/**************************************/
+// 15789
+
+extern (C++) void test15789a(T...)(T args);
+
+void test15789()
+{
+    test15789a(0);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc1.d b/gcc/testsuite/gdc.test/compilable/ddoc1.d
new file mode 100644
index 00000000000..fa5042a4780
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc1.d
@@ -0,0 +1,69 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 1
+// REQUIRED_ARGS: -d
+
+/** This module is for ABC
+ * Copyright: Copyright &copy;
+ */
+
+module abc;
+
+string foos = "foo";
+
+alias int myint; ///
+alias int mytypedefint;
+
+/** windy
+ * city
+ *
+ * paragraph 2 about of F $$(NAME)
+ * -----
+ * #include <stdio.h>
+  * void main()
+ * {
+ * 	printf("hello\n");
+ * }
+ * -----
+ * Copyright: 1998
+ */
+myint f;
+enum E { e } /// comment1
+int g; /// comment2
+private int h; /// comment for H
+static int i;
+int j;
+wchar LS = 0x2028;	/// UTF line separator
+wchar PS = 0x2029;	/// UTF paragraph separator
+
+wchar _XX;	/// ditto
+wchar YY;	/// ditto
+
+/** Function foo takes argument c and adds it to argulid.
+ *
+ * Then it munges argulid, u <u>underline</u>. <!-- c, argulid, b -->
+ * Params:
+ *	c = the character which adds c to argulid
+ *	argulid = the argument
+ *	u = the other argument
+ */
+int foo(char c, int argulid, char u);
+
+int barr() { return 3; } /// doc for barr()
+
+/++ The Class Bar +/
+class Bar
+{
+    int x;	/// member X
+    int y;	/// member Y
+    protected int z;	/// member Z
+}
+
+/++ The Enum Easy +/
+
+enum Easy : int
+{
+	red,	/// the Red
+	blue,	/// the Blue
+	green,	/// the Green
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10.d b/gcc/testsuite/gdc.test/compilable/ddoc10.d
new file mode 100644
index 00000000000..90ab5a19ab2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc10.d
@@ -0,0 +1,210 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10
+
+// 294
+
+/// The foo
+struct Foo(T) { }
+/// ditto
+struct Foo(T,U) { }
+
+/** This basic case doesn't work very well. The template signature is
+  * documented twice, but the function signature (argument names and return
+  * type) is not documented at all. This comment is also repeated twice. */
+int func1(T)(T x) {}
+
+
+
+/** This comment is also repeated twice, and the second function signature is
+  * not very well documented. */
+int func2(T,U)(T x, U y) {}
+
+/// ditto
+int func2(T)(T x) {}
+
+/// Separate overload item.
+int func2()() {}
+
+
+///
+template func3(T,U) {
+        /** This used to work adequately and documented both func3 templates
+          * simultaneously. Now, it documents the first template twice and
+          * no longer documents the function argument and return types.*/
+        int func3(T x, U y) {}
+}
+
+/// ditto
+deprecated template func3(T, U=int, V:long) {
+	private int func3(T x) {}
+}
+
+
+
+/**
+ * blah
+ */
+
+void map(char rs)
+{
+}
+
+/// Ditto
+void map(int rs)
+{
+}
+
+
+
+/**
+ * blah
+ */
+
+void map2()(char rs)
+{
+}
+
+/// Ditto
+void map2()(int rs)
+{
+}
+
+
+
+/**
+ * blah http://www.map3.com map3
+ */
+
+void map3(char rs)
+{
+}
+
+
+
+
+/**
+ * blah http://www.map.com map
+ */
+
+void map4(string s)(char rs)
+{
+}
+
+
+
+/**
+ * blah http://www.map.com map
+ */
+
+template map5(string s)
+{
+}
+
+
+/** blah */
+struct bar6 {
+        int blah;
+}
+
+
+/** template bodies */
+struct Foo7(T) {
+
+    /**Attempt one:  Doc outside static if.*/
+    static if(is(T == uint)) {
+        /**Attempt two:  Inside.*/
+        void bar() {}
+    }
+    else {
+        /**Attempt two:  else.*/
+        void bar() {}
+    }
+
+    /** the abc function should be static */
+    static void abc() { }
+}
+
+
+/** show abstract */
+abstract class Foo8 { }
+
+/// a stray $(RPAREN) mustn't foul the macros
+void bug4878(string a = ")") {}
+
+/****
+ */
+struct S
+{
+    /****
+     */
+    this(long ticks) const pure nothrow { }
+
+    /****
+     */
+    const pure nothrow this(this) { }
+
+    /****
+     */
+    const pure nothrow ~this() { }
+
+    /****
+     */
+    void foo(long ticks) const pure nothrow { }
+}
+
+
+/** Produces something in (a;b] */
+float f10(float a, float b) { return (a+b)/2.0; }
+/** Produces something in [a;b) */
+float h10(float a, float b) { return (a+b)/2.0; }
+
+
+///
+void bug6090(string f="$(B b)", char g=')')(string h="$(", string i="$)") {}
+
+
+/****
+ */
+struct T
+{
+    /****
+     */
+    this(A...)(A args) { }
+    
+    ///
+    this(int){}
+}
+
+
+// 14547
+
+/// doc-comment
+int x14547 = 1;
+
+/// ditto
+enum int y14547 = 2;
+
+/// doc-comment
+enum isInt14547(T) = is(T == int);
+
+/// ditto
+enum bool isString14547(T) = is(T == string);
+
+/// ditto
+static immutable typeName14547(T) = T.stringof;
+
+/// ditto
+int storageFor14547(T) = 0;
+
+/// doc-comment
+template foo14547(T)
+{
+    enum int foo14547 = T.stringof.length;
+}
+
+/// ditto
+template bar14547(T) if (is(T == int))
+{
+    enum int bar14547 = T.stringof.length;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10236.d b/gcc/testsuite/gdc.test/compilable/ddoc10236.d
new file mode 100644
index 00000000000..25738ec34e3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc10236.d
@@ -0,0 +1,59 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -w -o-
+
+/*
+TEST_OUTPUT:
+---
+compilable/ddoc10236.d(33): Warning: Ddoc: parameter count mismatch
+compilable/ddoc10236.d(45): Warning: Ddoc: function declaration has no parameter 'y'
+compilable/ddoc10236.d(57): Warning: Ddoc: function declaration has no parameter 'y'
+compilable/ddoc10236.d(57): Warning: Ddoc: parameter count mismatch
+---
+*/
+
+/***********************************
+ * foo_good does this.
+ * Params:
+ *	x =	is for this
+ *		and not for that
+ *	y =	is for that
+ */
+
+void foo_good(int x, int y)
+{
+}
+
+/***********************************
+ * foo_count_mismatch does this.
+ * Params:
+ *	x =	is for this
+ *		and not for that
+ */
+
+void foo_count_mismatch(int x, int y)	// Warning: Ddoc: parameter count mismatch
+{
+}
+
+/***********************************
+ * foo_no_param_y does this.
+ * Params:
+ *	x =	is for this
+ *		and not for that
+ *	y =	is for that
+ */
+
+void foo_no_param_y(int x, int z)		// Warning: Ddoc: function declaration has no parameter 'y'
+{
+}
+
+/***********************************
+ * foo_count_mismatch_no_param_y does this.
+ * Params:
+ *	x =	is for this
+ *		and not for that
+ *	y =	is for that
+ */
+
+void foo_count_mismatch_no_param_y(int x)
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10236b.d b/gcc/testsuite/gdc.test/compilable/ddoc10236b.d
new file mode 100644
index 00000000000..d814d375c06
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc10236b.d
@@ -0,0 +1,69 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -w -o-
+
+/*
+TEST_OUTPUT:
+---
+compilable/ddoc10236b.d(43): Warning: Ddoc: parameter count mismatch
+compilable/ddoc10236b.d(55): Warning: Ddoc: function declaration has no parameter 'y'
+compilable/ddoc10236b.d(67): Warning: Ddoc: function declaration has no parameter 'y'
+compilable/ddoc10236b.d(67): Warning: Ddoc: parameter count mismatch
+---
+*/
+
+/***********************************
+ * foo_good does this.
+ * Params:
+ *	x =	is for this
+ *		and not for that
+ *	y =	is for that
+ */
+
+void foo_good(int x)(int y)
+{
+}
+
+/***********************************
+ * foo_good2 does this.
+ * Params:
+ *	y =	is for that
+ */
+
+void foo_good2(int x)(int y)
+{
+}
+
+/***********************************
+ * foo_count_mismatch does this.
+ * Params:
+ *	x =	is for this
+ *		and not for that
+ */
+
+void foo_count_mismatch(int x)(int y)	// Warning: Ddoc: parameter count mismatch
+{
+}
+
+/***********************************
+ * foo_no_param_y does this.
+ * Params:
+ *	x =	is for this
+ *		and not for that
+ *	y =	is for that
+ */
+
+void foo_no_param_y(int x)(int z)		// Warning: Ddoc: function declaration has no parameter 'y'
+{
+}
+
+/***********************************
+ * foo_count_mismatch_no_param_y does this.
+ * Params:
+ *	x =	is for this
+ *		and not for that
+ *	y =	is for that
+ */
+
+void foo_count_mismatch_no_param_y(int x)()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10325.d b/gcc/testsuite/gdc.test/compilable/ddoc10325.d
new file mode 100644
index 00000000000..4f0068af58d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc10325.d
@@ -0,0 +1,17 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10325
+
+module ddoc10325;
+
+/** */
+template templ(T...)
+    if (someConstraint!T)
+{
+}
+
+/** */
+void foo(T)(T t)
+    if (someConstraint!T)
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10334.d b/gcc/testsuite/gdc.test/compilable/ddoc10334.d
new file mode 100644
index 00000000000..3ff148da430
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc10334.d
@@ -0,0 +1,29 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10334
+
+module ddoc10334;
+
+template Foo10334(T) if (Bar10334!()) {}                ///
+template Foo10334(T) if (Bar10334!100) {}               ///
+template Foo10334(T) if (Bar10334!3.14) {}              ///
+template Foo10334(T) if (Bar10334!"str") {}             ///
+template Foo10334(T) if (Bar10334!1.4i) {}              ///
+template Foo10334(T) if (Bar10334!null) {}              ///
+template Foo10334(T) if (Bar10334!true) {}              ///
+template Foo10334(T) if (Bar10334!false) {}             ///
+template Foo10334(T) if (Bar10334!'A') {}               ///
+template Foo10334(T) if (Bar10334!int) {}               ///
+template Foo10334(T) if (Bar10334!string) {}            ///
+template Foo10334(T) if (Bar10334!([1,2,3])) {}         ///
+template Foo10334(T) if (Bar10334!(Baz10334!())) {}     ///
+template Foo10334(T) if (Bar10334!(Baz10334!T)) {}      ///
+template Foo10334(T) if (Bar10334!(Baz10334!100)) {}    ///
+template Foo10334(T) if (Bar10334!(.foo)) {}            ///
+template Foo10334(T) if (Bar10334!(const int)) {}       ///
+template Foo10334(T) if (Bar10334!(shared T)) {}        ///
+
+template Test10334(T...) {}     ///
+mixin Test10334!int a;          ///
+mixin Test10334!(int,long) b;   ///
+mixin Test10334!"str" c;        ///
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10366.d b/gcc/testsuite/gdc.test/compilable/ddoc10366.d
new file mode 100644
index 00000000000..5bc5f641f40
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc10366.d
@@ -0,0 +1,20 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10366
+
+///
+struct S(T)
+{
+    ///
+    void method() {}
+
+    public
+    {
+        ///
+        struct Nested
+        {
+            ///
+            void nestedMethod() {}
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10367.d b/gcc/testsuite/gdc.test/compilable/ddoc10367.d
new file mode 100644
index 00000000000..836c7d0cc50
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc10367.d
@@ -0,0 +1,28 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10367
+// REQUIRED_ARGS: -m32
+// EXTRA_SOURCES: extra-files/ddoc10367.ddoc
+
+module ddoc10367;
+
+/// A
+enum A
+{
+    a = 1, /// a
+    b = 2  /// b
+}
+
+/// B
+enum B : long
+{
+    a = 1, /// a
+    b = 2  /// b
+}
+
+/// C
+enum C : string
+{
+    a = "a", /// a
+    b = "b"  /// b
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10869.d b/gcc/testsuite/gdc.test/compilable/ddoc10869.d
new file mode 100644
index 00000000000..11b485453da
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc10869.d
@@ -0,0 +1,27 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10869
+
+module ddoc10869;
+
+///
+class C
+{
+    const
+    {
+        ///
+        void c1Foo() const { }
+
+        ///
+        void i1Foo() immutable { }
+    }
+
+    immutable
+    {
+        ///
+        void c2Foo() const { }
+
+        ///
+        void i2Foo() immutable { }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10870.d b/gcc/testsuite/gdc.test/compilable/ddoc10870.d
new file mode 100644
index 00000000000..95a82ed9ffd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc10870.d
@@ -0,0 +1,10 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10870
+
+///
+interface I
+{
+    ///
+    void f();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc11.d b/gcc/testsuite/gdc.test/compilable/ddoc11.d
new file mode 100644
index 00000000000..cf6070edfef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc11.d
@@ -0,0 +1,69 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 11
+
+/// The various floating point exceptions
+enum
+{
+    FE_INVALID      = 1,        ///
+    FE_DENORMAL     = 2,        ///
+    FE_DIVBYZERO    = 4,        ///
+    FE_OVERFLOW     = 8,        ///
+    FE_UNDERFLOW    = 0x10,     ///
+    FE_INEXACT      = 0x20,     ///
+    FE_ALL_EXCEPT   = 0x3F,     /// Mask of all the exceptions
+}
+
+alias int myint;
+
+///
+myint bar;
+
+///
+myint foo(myint x = myint.max)
+{
+    return x;
+}
+
+
+///
+class Foo
+{
+    ///
+    this(string s) { }
+}
+
+
+extern (C):
+
+///
+struct div_t { int  quot,rem; }
+///
+struct ldiv_t { int quot,rem; }
+///
+struct lldiv_t { long quot,rem; }
+
+    div_t div(int,int);	///
+    ldiv_t ldiv(int,int); ///
+    lldiv_t lldiv(long, long); ///
+
+
+
+    void *calloc(size_t, size_t);	/// 
+    void *malloc(size_t);	/// dittx
+
+/**
+Example:
+---
+private:
+    int i = 0;
+---
+*/
+void test1()
+{
+}
+
+
+
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc11479.d b/gcc/testsuite/gdc.test/compilable/ddoc11479.d
new file mode 100644
index 00000000000..d2ddb1973e8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc11479.d
@@ -0,0 +1,96 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 11479
+
+module ddoc11479;
+
+///
+struct S1(T)
+{
+    ///
+    int a;
+
+    ///
+private:
+    int x;
+
+private:
+    ///
+    int y;
+
+    ///
+public:
+    int b;
+
+public:
+    ///
+    int c;
+}
+
+
+///
+struct S2(T)
+{
+    ///
+    int a;
+
+    ///
+    private int x;
+
+    ///
+    int b;
+
+    ///
+    public int c;
+
+    public
+    ///
+    int d;
+}
+
+
+///
+struct S3(T)
+{
+    ///
+    int a;
+
+    ///
+    private { int x; }
+
+    ///
+    int b;
+
+    ///
+    private
+    {
+        int y;
+
+        public
+        {
+            int c;
+        }
+    }
+
+    private
+    {
+        int z;
+
+        ///
+        public
+        {
+            int d;
+        }
+    }
+
+    private
+    {
+        int w;
+
+        public
+        {
+            ///
+            int e;
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc11511.d b/gcc/testsuite/gdc.test/compilable/ddoc11511.d
new file mode 100644
index 00000000000..ba5829ec6d9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc11511.d
@@ -0,0 +1,20 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -w -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 11511
+module ddoc11511;
+
+/**
+Params:
+abcd = none1
+bcdef = none23
+... = doo
+*/
+void foo(int abcd, int bcdef, ...);
+
+/**
+Params:
+abcd = none1
+bcdef = none23
+arr = doo
+*/
+void foo(int abcd, int bcdef, int[] arr...);
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc11823.d b/gcc/testsuite/gdc.test/compilable/ddoc11823.d
new file mode 100644
index 00000000000..dfde4b68cc5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc11823.d
@@ -0,0 +1,7 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 11823
+module ddoc11823;
+
+/// file function name is _file, arg defaults to __FILE__ but not __something__
+void file(string arg) { }
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc12.d b/gcc/testsuite/gdc.test/compilable/ddoc12.d
new file mode 100644
index 00000000000..4fdf9cff1ef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc12.d
@@ -0,0 +1,20 @@
+﻿// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 12
+
+int ruhred; /// This documents correctly.
+int rühred; /// This should too
+
+/**
+ * BUG: The parameters are not listed under Params in the generated output
+ *
+ * Params:
+ *     ü = first
+ *     ş = second
+ *     ğ = third
+ *
+ */
+int foo(int ü, int ş, int ğ)
+{
+    return ğ;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc12706.d b/gcc/testsuite/gdc.test/compilable/ddoc12706.d
new file mode 100644
index 00000000000..399583cf8b2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc12706.d
@@ -0,0 +1,9 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 12706
+
+///
+void test()(string[] args) if (args[$])
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc12745.d b/gcc/testsuite/gdc.test/compilable/ddoc12745.d
new file mode 100644
index 00000000000..2bfaee68e9b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc12745.d
@@ -0,0 +1,25 @@
+// EXTRA_SOURCES:
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 12745
+
+/**
+i underlined $(BR)
+_i not underlined $(BR)
+__i force underscore $(BR)
+$(BR)
+_0 not underscored $(BR)
+__0 force underscored
+
+1 underscore:
+$(BR)
+1_1 $(BR)
+1_a $(BR)
+a_1 $(BR)
+a_a $(BR)
+$(BR)
+2 underscores: $(BR)
+1__a $(BR)
+2__b
+*/
+int i;
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc13.d b/gcc/testsuite/gdc.test/compilable/ddoc13.d
new file mode 100644
index 00000000000..eafc8b289be
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc13.d
@@ -0,0 +1,26 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 13
+
+/// struct doc
+struct Bug4107(T)
+{
+    /// templated function doc
+    void foo(U)(U u) { }
+}
+
+/// alpha
+struct Bug4107b(T) {
+    /// beta
+    struct B(U) {
+        /// gamma
+        struct C(V) {
+            /// delta
+            struct D(W) {
+                /// epsilon
+                B!W e(X)(C!V c, X[] x...) {}
+            }
+        }
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc13270.d b/gcc/testsuite/gdc.test/compilable/ddoc13270.d
new file mode 100644
index 00000000000..6b04922d45c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc13270.d
@@ -0,0 +1,18 @@
+// PERMUTE_ARGS: -w
+// REQUIRED_ARGS: -o- -D -Dd${RESULTS_DIR}/compilable
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 13270
+
+module ddoc13270;
+
+/**
+ * My overloaded function.
+ *
+ * Params:
+ *      task = String description of stuff to do.
+ *      tasks = Array of descriptions of stuff to do.
+ *      maxJobs = Max parallel jobs to run while doing stuff.
+ */
+void doStuff(string task) {}
+
+/// ditto
+void doStuff(string[] tasks, int maxJobs) {}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc13502.d b/gcc/testsuite/gdc.test/compilable/ddoc13502.d
new file mode 100644
index 00000000000..6ab2ca0614d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc13502.d
@@ -0,0 +1,24 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -w -o-
+/*
+TEST_OUTPUT:
+---
+compilable/ddoc13502.d(14): Warning: Ddoc: Stray '('. This may cause incorrect Ddoc output. Use $(LPAREN) instead for unpaired left parentheses.
+compilable/ddoc13502.d(17): Warning: Ddoc: Stray '('. This may cause incorrect Ddoc output. Use $(LPAREN) instead for unpaired left parentheses.
+compilable/ddoc13502.d(21): Warning: Ddoc: Stray '('. This may cause incorrect Ddoc output. Use $(LPAREN) instead for unpaired left parentheses.
+compilable/ddoc13502.d(24): Warning: Ddoc: Stray '('. This may cause incorrect Ddoc output. Use $(LPAREN) instead for unpaired left parentheses.
+---
+*/
+
+/// (
+enum isSomeString(T) = true;
+
+/// (
+enum bool isArray(T) = true;
+
+
+/// (
+extern(C) alias int T1;
+
+/// (
+extern(C) alias T2 = int;
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc13645.d b/gcc/testsuite/gdc.test/compilable/ddoc13645.d
new file mode 100644
index 00000000000..f12b3769ae4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc13645.d
@@ -0,0 +1,9 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 13645
+
+/**
+Documentation comment on module
+*/
+deprecated("msg") @(1)
+module ddoc13645;
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc14.d b/gcc/testsuite/gdc.test/compilable/ddoc14.d
new file mode 100644
index 00000000000..fe1fcc1cff2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc14.d
@@ -0,0 +1,97 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 14
+
+
+alias void V;
+alias double* P;
+
+/// -1
+struct Structure {
+    public P variable;  /// 0
+    V mNone(lazy P p) {}  /// 1
+    pure nothrow V mPrefix(lazy P p) {}   /// 2
+    V mSuffix(lazy P p) pure nothrow {}   /// 3
+//  pure nothrow V mPrefixTemplate(T)(lazy P p, T[] t...) {}   /// 4
+    V mSuffixTemplate(T)(lazy P p, T[] t...) pure nothrow {}   /// 5
+    pure nothrow {
+        V mScoped(lazy P p) {}    /// 6
+    }
+    pure nothrow auto mAutoPrefix(ref P p) { return p; } /// 7
+//  pure nothrow auto mAutoTemplatePrefix(alias T)(ref T t) { return p; } /// 8
+    auto mAutoTemplateSuffix(alias T)(ref T t) pure nothrow { return p; } /// 9
+    pure nothrow:
+    V mColon(lazy P p) {} /// 10
+}
+
+/// -1
+class Class {
+    public P variable;  /// 0
+    V mNone(lazy P p) {}  /// 1
+    pure nothrow V mPrefix(lazy P p) {}   /// 2
+    V mSuffix(lazy P p) pure nothrow {}   /// 3
+//  pure nothrow V mPrefixTemplate(T)(lazy P p, T[] t...) {}   /// 4
+    V mSuffixTemplate(T)(lazy P p, T[] t...) pure nothrow {}   /// 5
+    pure nothrow {
+        V mScoped(lazy P p) {}    /// 6
+    }
+    pure nothrow auto mAutoPrefix(ref P p) { return p; } /// 7
+//  pure nothrow auto mAutoTemplatePrefix(alias T)(ref T t) { return p; } /// 8
+    auto mAutoTemplateSuffix(alias T)(ref T t) pure nothrow { return p; } /// 9
+    pure nothrow:
+    V mColon(lazy P p) {} /// 10
+}
+
+/+
+/// -1
+struct StructTemplate() {
+    public P variable;  /// 0
+    V mNone(lazy P p) {}  /// 1
+    pure nothrow V mPrefix(lazy P p) {}   /// 2
+    V mSuffix(lazy P p) pure nothrow {}   /// 3
+//  pure nothrow V mPrefixTemplate(T)(lazy P p, T[] t...) {}   /// 4
+    V mSuffixTemplate(T)(lazy P p, T[] t...) pure nothrow {}   /// 5
+    pure nothrow {
+        V mScoped(lazy P p) {}    /// 6
+    }
+    pure nothrow auto mAutoPrefix(ref P p) { return p; } /// 7
+//  pure nothrow auto mAutoTemplatePrefix(alias T)(ref T t) { return p; } /// 8
+    auto mAutoTemplateSuffix(alias T)(ref T t) pure nothrow { return p; } /// 9
+    pure nothrow:
+    V mColon(lazy P p) {} /// 10
+}
+
+/// -1
+interface Interface {
+    V mNone(lazy P p) ;  /// 1
+    pure nothrow V mPrefix(lazy P p) ;   /// 2
+    V mSuffix(lazy P p) pure nothrow ;   /// 3
+//  pure nothrow V mPrefixTemplate(T)(lazy P p, T[] t...) ;   /// 4
+    V mSuffixTemplate(T)(lazy P p, T[] t...) pure nothrow ;   /// 5
+    pure nothrow {
+        V mScoped(lazy P p) ;    /// 6
+    }
+//  pure nothrow auto mAutoTemplatePrefix(alias T)(ref T t) { return p; } /// 8
+    auto mAutoTemplateSuffix(alias T)(ref T t) pure nothrow { return p; } /// 9
+    pure nothrow:
+    V mColon(lazy P p) ; /// 10
+}
++/
+    
+public P variable;  /// 0
+V mNone(lazy P p) {}  /// 1
+pure nothrow V mPrefix(lazy P p) {}   /// 2
+V mSuffix(lazy P p) pure nothrow {}   /// 3
+//  pure nothrow V mPrefixTemplate(T)(lazy P p, T[] t...) {}   /// 4
+V mSuffixTemplate(T)(lazy P p, T[] t...) pure nothrow {}   /// 5
+pure nothrow {
+    V mScoped(lazy P p) {}    /// 6
+}
+pure nothrow auto mAutoPrefix(ref P p) { return p; } /// 7
+//  pure nothrow auto mAutoTemplatePrefix(alias T)(ref T t) { return p; } /// 8
+auto mAutoTemplateSuffix(alias T)(ref T t) pure nothrow { return p; } /// 9
+pure nothrow:
+V mColon(lazy P p) {} /// 10
+
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc198.d b/gcc/testsuite/gdc.test/compilable/ddoc198.d
new file mode 100644
index 00000000000..16485b78b72
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc198.d
@@ -0,0 +1,35 @@
+// EXTRA_SOURCES: extra-files/ddoc198.ddoc
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 198
+
+module ddoc198;
+
+///
+interface I1 { }
+
+///
+class C1 { }
+
+///
+class Foo : C1, I1 { }
+
+///
+enum X { x = 1 }
+
+///
+enum Y : X { y = X.x }
+
+///
+struct S1 { }
+
+///
+enum enS : S1 { a = S1() }
+
+// disabled until class enums are possible
+// enum enC : C1 { a = new C1() }
+
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc2.d b/gcc/testsuite/gdc.test/compilable/ddoc2.d
new file mode 100644
index 00000000000..54e492f1011
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc2.d
@@ -0,0 +1,42 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 2
+
+/**
+ * Summary
+ *
+ * Description1
+ *
+ * Description2
+ *
+ * Description3
+ *
+ * Macros:
+ *	WIKI = StdStream
+ *	meemie
+ * See_Also:
+ *	Things to see also.
+ *
+ *	And more things.
+ */
+
+/*
+ */
+
+module std.test;
+
+/// A base class for stream exceptions.
+class StreamException: Exception {
+  /** Construct a StreamException with given error message msg.
+   * Params:
+   *	msg = the $(RED red) $(BLUE blue) $(GREEN green) $(YELLOW yellow).
+   *	foo = next parameter which is a much longer
+   *		message spanning multiple
+   *		lines.
+   */
+  this(string msg, int foo) { super(msg); }
+
+    /********** stars ***************/
+    int stars;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc2273.d b/gcc/testsuite/gdc.test/compilable/ddoc2273.d
new file mode 100644
index 00000000000..413ba71055e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc2273.d
@@ -0,0 +1,37 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 2273
+// REQUIRED_ARGS: -m32
+
+module ddoc2273;
+
+interface A { }
+
+interface C { }
+interface D { }
+
+///
+interface B : C, D { }
+
+///
+class Foo : A, B { }
+
+///
+MinType!(T1, T2, T) min(T1, T2, T...)(T1 a, T2 b, T xs) { }
+
+///
+Templ!([1, 2, 3]) max(T...)() { }
+
+///
+template Base64Impl(char Map62th, char Map63th, char Padding) { }
+
+///
+int sqlite3_config(int,...);
+
+template staticIndexOf(T, TList...) { alias int staticIndexOf; }
+
+///
+alias staticIndexOf IndexOf;
+
+void main() { }
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc3.d b/gcc/testsuite/gdc.test/compilable/ddoc3.d
new file mode 100644
index 00000000000..bc00b69e83e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc3.d
@@ -0,0 +1,71 @@
+// EXTRA_SOURCES: extra-files/ddoc3.ddoc
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 3
+
+/**
+ * Summary
+ *
+ * Description1
+ *
+ * Description2
+ *
+ * Description3
+ *
+ * Macros:
+ *	WIKI = StdStream
+ *	meemie
+ *	ARG0 = $0
+ *	ARG1 = $1
+ *	ARG2 = $2
+ *	ARG3 = $3
+ *	PLUS = $+
+ *	TROW = $(TR $(TCOL $1,$+))
+ *	TCOL = $(TD $1) $(TCOL $+)
+ *	LPAREN = (
+ * See_Also:
+ *	Things to see also.
+ *
+ *	And more things $(BR)
+ *	'arg1, arg2, arg3' : $(ARG0 arg1, arg2, arg3). $(BR)
+ *	'arg2, arg3' : $(PLUS arg1, arg2, arg3). $(BR)
+ *	'arg1' : $(ARG1 arg1, arg2, arg3). $(BR)
+ *	'arg2' : $(ARG2 arg1, arg2, arg3). $(BR)
+ *	'arg3' : $(ARG3 arg1, arg2, arg3). $(BR)
+ */
+
+/**
+ *	Things to see also $(HELLO).
+ *
+ *	$(TABLE
+ *	$(TROW 1, 2, 3)
+ *	$(TROW 4, 5, 6)
+ *	)
+ *
+ * $(D_CODE 
+      $(B pragma)( $(I name) );
+      $(B pragma)( $(I name) , $(I option) [ $(I option) ] );
+      $(U $(LPAREN))
+  )
+ */
+
+/*
+ */
+
+module std.test;
+
+/// A base class for stream exceptions.
+class StreamException: Exception {
+  /** Construct a StreamException with given error message msg.
+   * Params:
+   *	msg = the $(RED red) $(BLUE blue) $(GREEN green) $(YELLOW yellow).
+   *	foo = next parameter which is a much longer
+   *		message spanning multiple
+   *		lines.
+   */
+  this(string msg, int foo) { super(msg); }
+
+    /********** stars ***************/
+    int stars;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc4.d b/gcc/testsuite/gdc.test/compilable/ddoc4.d
new file mode 100644
index 00000000000..d0677363afb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc4.d
@@ -0,0 +1,11 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 4
+
+/**
+    a
+*/
+enum
+{
+    ONE
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc4162.d b/gcc/testsuite/gdc.test/compilable/ddoc4162.d
new file mode 100644
index 00000000000..3946eca85a6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc4162.d
@@ -0,0 +1,17 @@
+﻿// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 4162
+
+///
+interface A
+{
+	///
+	static void staticHello() { }
+
+	///
+	final void hello() { }
+}
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc4899.d b/gcc/testsuite/gdc.test/compilable/ddoc4899.d
new file mode 100644
index 00000000000..d0028f56c21
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc4899.d
@@ -0,0 +1,20 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -w -o-
+
+/*
+TEST_OUTPUT:
+---
+compilable/ddoc4899.d(16): Warning: Ddoc: Stray '('. This may cause incorrect Ddoc output. Use $(LPAREN) instead for unpaired left parentheses.
+compilable/ddoc4899.d(16): Warning: Ddoc: Stray ')'. This may cause incorrect Ddoc output. Use $(RPAREN) instead for unpaired right parentheses.
+---
+*/
+
+/++
+       (See accompanying file LICENSE_1_0.txt or copy at
+        http://www.boost.org/LICENSE_1_0.txt)
++/
+module d;
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc5.d b/gcc/testsuite/gdc.test/compilable/ddoc5.d
new file mode 100644
index 00000000000..4a8c396c66c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc5.d
@@ -0,0 +1,31 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 5
+
+/**
+
+  Test module
+
+*/
+module test;
+
+/// class to test DDOC on members
+class TestMembers(TemplateArg)
+{
+  public:
+    /**
+
+       a static method 
+
+       Params: idx = index
+   
+    */
+    static void PublicStaticMethod(int  idx)
+    {
+    }
+}
+
+void main()
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc5446.d b/gcc/testsuite/gdc.test/compilable/ddoc5446.d
new file mode 100644
index 00000000000..2e33617ede9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc5446.d
@@ -0,0 +1,69 @@
+﻿// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 5446
+module ddoc5446;
+import ddoc5446a;
+private import ddoc5446b;
+
+/** */
+alias A_Foo This_Foo;
+
+/** */
+alias A_Foo_Alias This_Foo_Alias;
+
+/** */
+alias int This_Int;
+
+/** */
+alias A_Enum This_Enum;
+
+/** */
+deprecated alias ddoc5446b.A_Enum_New A_Enum_New;
+
+struct Nested
+{
+}
+
+/** */
+struct Bar
+{
+    /** */
+    alias A_Foo Bar_A_Foo;
+    
+    /** */
+    alias A_Foo_Alias Bar_A_Foo_Alias;
+    
+    /** */
+    alias A_Int Bar_A_Int;
+    
+    /** */
+    alias This_Foo Bar_This_Foo;
+    
+    /** */
+    alias This_Foo_Alias Bar_This_Foo_Alias;
+    
+    /** */
+    alias This_Int Bar_This_Int;
+    
+    /** */
+    alias Nested Nested_Alias;
+    
+    /** */
+    alias .Nested Fake_Nested;
+    
+    /** */
+    struct Nested
+    {
+        /** */
+        alias Bar Bar_Nested_Bar_Alias;
+        
+        /** */
+        alias .Bar Bar_Alias;
+        
+        /** */
+        struct Bar
+        {
+            
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc5446a.d b/gcc/testsuite/gdc.test/compilable/ddoc5446a.d
new file mode 100644
index 00000000000..2d69dab2e5a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc5446a.d
@@ -0,0 +1,15 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+module ddoc5446a;
+
+/** */
+struct A_Foo { }
+
+/** */
+alias A_Foo A_Foo_Alias;
+
+/** */
+alias int A_Int;
+
+/** */
+enum A_Enum { x }
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc5446b.d b/gcc/testsuite/gdc.test/compilable/ddoc5446b.d
new file mode 100644
index 00000000000..f6e84d5f41b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc5446b.d
@@ -0,0 +1,6 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+module ddoc5446b;
+
+/** */
+enum A_Enum_New { x }
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc6.d b/gcc/testsuite/gdc.test/compilable/ddoc6.d
new file mode 100644
index 00000000000..6d130901602
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc6.d
@@ -0,0 +1,25 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 6
+
+/**
+ *
+ */
+struct MyStruct(T)
+{
+    static if( true )
+    {
+        void MyStruct() {}
+    }
+}
+
+void main()
+{
+}
+
+/+
+23
+C:\code\d\bugs>dmd -D -o- 148_1.d
+148_1.d(6): Error: static if conditional cannot be at global scope
++/
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc648.d b/gcc/testsuite/gdc.test/compilable/ddoc648.d
new file mode 100644
index 00000000000..49c90973a85
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc648.d
@@ -0,0 +1,90 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 648
+
+module ddoc648;
+
+/// Mixin declaration
+mixin template Mixin1()
+{
+    /// struct S
+    struct S { }
+}
+
+/// class A
+class A
+{
+    /// field x
+    int x;
+
+    /// no docs for mixin statement (only for expanded members)
+    mixin Mixin1!();
+}
+
+/// class AB
+class AB
+{
+    /// field x
+    int x;
+
+    // no docs for mixin or its contents, must be a ddoc comment
+    mixin Mixin1!();
+}
+
+/// Mixin declaration2
+mixin template Mixin2()
+{
+    /// struct S2
+    struct S2 { }
+}
+
+/// Mixin declaration3
+mixin template Mixin3()
+{
+    /// another field
+    int f;
+
+    /// no docs for mixin statement (only for expanded members)
+    mixin Mixin2!();
+}
+
+/// class B1
+class B1
+{
+    /// no docs for mixin statement (only for expanded members)
+    mixin Mixin3!();
+}
+
+
+/// Mixin declaration3
+mixin template Mixin4()
+{
+    /// another field
+    int f;
+
+    // no docs at all for non-ddoc comment
+    mixin Mixin2!();
+}
+
+/// class B2
+class B2
+{
+    /// no docs for mixin statement (only for expanded members)
+    mixin Mixin4!();
+}
+
+/// no docs for mixin statement (only for expanded members)
+mixin Mixin3!();
+
+///
+struct TS(T)
+{
+    mixin template MT()
+    {
+    }
+
+    mixin MT;  /// avoid calling semantic
+
+    ///
+    int field;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc6491.d b/gcc/testsuite/gdc.test/compilable/ddoc6491.d
new file mode 100644
index 00000000000..028792accef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc6491.d
@@ -0,0 +1,14 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 6491
+
+module ddoc6491;
+
+import core.cpuid;
+
+enum int c6491 = 4;
+
+/// test
+void bug6491a(int a = ddoc6491.c6491, string b = core.cpuid.vendor);
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc7.d b/gcc/testsuite/gdc.test/compilable/ddoc7.d
new file mode 100644
index 00000000000..81851832b8c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc7.d
@@ -0,0 +1,59 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 7
+
+//-----------------------------------------------
+/// my enum
+enum E1
+{
+    A, /// element a
+    B  /// element b
+}
+
+/// my enum
+enum E2
+{
+    /// element a
+    A,
+    /// element b
+    B
+}
+
+/// my enum
+enum E3
+{
+      A /// element a
+    , B /// element b
+}
+
+/// my enum
+enum E4
+{
+    A /// element a
+    ,
+    B /// element b
+}
+
+/// my enum
+enum E5
+{
+    /// element a
+    A
+    ,
+    /// element b
+    B
+}
+
+/// Some doc
+void foo() {}
+
+/// More doc
+alias foo bar;
+
+/// asdf
+class C
+{
+    /// Some doc
+    abstract void foo();
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc7555.d b/gcc/testsuite/gdc.test/compilable/ddoc7555.d
new file mode 100644
index 00000000000..efbb54785e1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc7555.d
@@ -0,0 +1,53 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 7555
+module ddoc7555;
+
+/**
+Dummy doc.
+
+$(X0
+  DelimitedString
+  TokenString)
+
+$(X1
+  DelimitedString
+  TokenString)
+
+$(X2 x,HexString)
+$(X2 x, HexString)
+
+$(X3 x,x,HexString)
+$(X3 x,x, HexString)
+
+$(X4 x,x,x,HexString)
+$(X4 x,x,x, HexString)
+
+$(X5 x,x,x,x,HexString)
+$(X5 x,x,x,x, HexString)
+
+$(X6 x,x,x,x,x,HexString)
+$(X6 x,x,x,x,x, HexString)
+
+$(X7 x,x,x,x,x,x,HexString)
+$(X7 x,x,x,x,x,x, HexString)
+
+$(X8 x,x,x,x,x,x,x,HexString)
+$(X8 x,x,x,x,x,x,x, HexString)
+
+$(X9 x,x,x,x,x,x,x,x,HexString)
+$(X9 x,x,x,x,x,x,x,x, HexString)
+
+Macros:
+    X0=$0
+    X1=$1
+    X2=$2
+    X3=$3
+    X4=$4
+    X5=$5
+    X6=$6
+    X7=$7
+    X8=$8
+    X9=$9
+*/
+void dummy();
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc7656.d b/gcc/testsuite/gdc.test/compilable/ddoc7656.d
new file mode 100644
index 00000000000..7a0ef0df3ce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc7656.d
@@ -0,0 +1,24 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 7656
+
+module ddoc7656;
+
+/**
+--------
+int x; // This is a $ comment (and here is some
+int y; // more information about that comment)
+--------
+*/
+void main() { }
+
+
+/**
+(Regression check)
+
+Example:
+----
+assert(add(1, 1) == 2);
+----
+*/
+int add(int a, int b) { return a + b; }
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc7715.d b/gcc/testsuite/gdc.test/compilable/ddoc7715.d
new file mode 100644
index 00000000000..ee33b28fe3a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc7715.d
@@ -0,0 +1,16 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 7715
+
+module ddoc7656;
+
+/**
+&#36;1 &#36;2
+---
+string s = "$1$2 $ &#36;4";
+---
+*/
+void foo(){}
+
+///
+void test(string a = ")") {}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc7795.d b/gcc/testsuite/gdc.test/compilable/ddoc7795.d
new file mode 100644
index 00000000000..c100f5d70b9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc7795.d
@@ -0,0 +1,17 @@
+﻿// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 7795
+
+module ddoc7795;
+
+struct TimeValue {
+    this(int hour, int minute, int second = 0, int ms = 0) {}
+}
+
+///
+struct DateTime {
+    ///
+    this(int x, TimeValue t = TimeValue(0, 0)) {}
+}
+
+void main() { }
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc8.d b/gcc/testsuite/gdc.test/compilable/ddoc8.d
new file mode 100644
index 00000000000..6683b1bb90b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc8.d
@@ -0,0 +1,9 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 8
+
+/** foo */
+
+class Foo(T) : Bar
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc8271.d b/gcc/testsuite/gdc.test/compilable/ddoc8271.d
new file mode 100644
index 00000000000..45aca90c7c7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc8271.d
@@ -0,0 +1,15 @@
+﻿// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 8271
+
+module ddoc8271;
+
+/**
+    $(まくろ)
+Macros:
+    まくろ = $(マクロ)
+    マクロ = Macro
+*/
+void ddoc8271()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc8739.d b/gcc/testsuite/gdc.test/compilable/ddoc8739.d
new file mode 100644
index 00000000000..cf7da98eda2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc8739.d
@@ -0,0 +1,19 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 8739
+
+module ddoc8739;
+
+///
+void delegate(int a) dg;
+
+///
+void delegate(int b) dg2;
+
+///
+void delegate(int c)[] dg3;
+
+///
+void delegate(int d)* dg4;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9.d b/gcc/testsuite/gdc.test/compilable/ddoc9.d
new file mode 100644
index 00000000000..21f312db44a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9.d
@@ -0,0 +1,26 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9
+
+// 273
+
+/// Template Documentation (OK)
+template Template(T) { }
+
+/// Function Documentation (Not included at all by DDoc)
+void Function(T)(T x) { }
+
+/// Class Documentation (OK)
+class Class(T) { }
+
+/// Struct Documentation
+struct Struct(T) { }
+
+/// Union Documentation
+union Union(T) { }
+
+/// Template documentation with anonymous enum
+template TemplateWithAnonEnum(T)
+{
+    enum { TemplateWithAnonEnum = 1 }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9037.d b/gcc/testsuite/gdc.test/compilable/ddoc9037.d
new file mode 100644
index 00000000000..ac4ace249e1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9037.d
@@ -0,0 +1,18 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9037
+
+module ddoc9037;
+
+/**
+Example:
+----
+D d = d;
+----
+----
+D d = d;
+----
+*/
+void test9037()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9155.d b/gcc/testsuite/gdc.test/compilable/ddoc9155.d
new file mode 100644
index 00000000000..0d288740ba2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9155.d
@@ -0,0 +1,80 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9155
+
+module ddoc9155;
+
+/++
+ +  Note:
+ +     test document note
+ +     2nd line
+ +  Example:
+ +  ---
+ +  import std.stdio;   //&
+ +  writeln("Hello world!");
+ +  if (test) {  
+ +    writefln("D programming language");
+ +  }
+ +
+ +      algorithm;
+ +  
+ +  xxx;    //comment
+ +      yyy;
+ +  /* test
+ +   * comment
+ +   */
+ +
+ + // Create MIME Base64 with CRLF, per line 76.
+ +File f = File("./text.txt", "r");
+ +uint line = 0;
+ + // The ElementType of data is not aggregation type
+ +foreach (encoded; Base64.encoder(data)) 
+ +  ---
+ +/
+
+/**
+  --------------------------------------------------------
+  wstring ws;
+  transcode("hello world",ws);
+      // transcode from UTF-8 to UTF-16
+      --------------------------------------------------------
+ */
+
+/**
+ *  Example:
+ *  ---
+ *  import std.stdio;   //&
+ *  writeln("Hello world!");
+ *  if (test) {  
+ *    writefln("D programming language");
+ *  }
+ *
+ *      algorithm;
+ *  
+ *  xxx;    //comment
+ *      yyy;
+ *  /+ test
+ *   + comment
+ *   +/
+ *  ---
+ */
+
+/**
+----
+#!/usr/bin/env rdmd
+// Computes average line length for standard input.
+import std.stdio;
+----
+*/
+/**
+	---
+	writefln(q"EOS
+	This
+	is a multi-line
+	heredoc string
+	EOS"
+	);
+	---
+*/
+
+void foo(){}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9305.d b/gcc/testsuite/gdc.test/compilable/ddoc9305.d
new file mode 100644
index 00000000000..9c9b890657c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9305.d
@@ -0,0 +1,38 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9305
+
+module ddoc9305;
+
+/**
+foo()
+*/
+void foo(alias p = (a => a))() {}
+
+/* ret / prm / body */
+/*  _  /  _  / expr */  template X(alias pred = x => x) {}                                  ///
+/*  _  /  _  / stmt */  template X(alias pred = (x){ int y; return y; }) {}                 /// ditto
+/*  _  /  x  / expr */  template X(alias pred = (int x) => x) {}                            /// ditto
+/*  _  /  x  / stmt */  template X(alias pred = (int x){ int y; return y; }) {}             /// ditto
+/*  x  /  _  / expr */
+/*  x  /  _  / stmt */
+/*  x  /  x  / expr */
+/*  x  /  x  / stmt */
+
+/*  _ /   _  / expr */  template X(alias pred = function (x) => x) {}                       ///
+/*  _ /   _  / stmt */  template X(alias pred = function (x){ return x + 1; }) {}           /// ditto
+/*  _  /  x  / expr */  template X(alias pred = function (int x) => x) {}                   /// ditto
+/*  _  /  x  / stmt */  template X(alias pred = function (int x){ return x + 1; }) {}       /// ditto
+/*  x  /  _  / expr */  template X(alias pred = function int(x) => x) {}                    /// ditto
+/*  x  /  _  / stmt */  template X(alias pred = function int(x){ return x + 1; }) {}        /// ditto
+/*  x  /  x  / expr */  template X(alias pred = function int(int x) => x) {}                /// ditto
+/*  x  /  x  / stmt */  template X(alias pred = function int(int x){ return x + 1; }) {}    /// ditto
+
+/*  _ /   _  / expr */  template X(alias pred = delegate (x) => x) {}                       ///
+/*  _ /   _  / stmt */  template X(alias pred = delegate (x){ return x + 1; }) {}           /// ditto
+/*  _  /  x  / expr */  template X(alias pred = delegate (int x) => x) {}                   /// ditto
+/*  _  /  x  / stmt */  template X(alias pred = delegate (int x){ return x + 1; }) {}       /// ditto
+/*  x  /  _  / expr */  template X(alias pred = delegate int(x) => x) {}                    /// ditto
+/*  x  /  _  / stmt */  template X(alias pred = delegate int(x){ return x + 1; }) {}        /// ditto
+/*  x  /  x  / expr */  template X(alias pred = delegate int(int x) => x) {}                /// ditto
+/*  x  /  x  / stmt */  template X(alias pred = delegate int(int x){ return x + 1; }) {}    /// ditto
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9369.d b/gcc/testsuite/gdc.test/compilable/ddoc9369.d
new file mode 100644
index 00000000000..b2ab8fe78d6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9369.d
@@ -0,0 +1,18 @@
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: /extra-files/ddoc9369.ddoc
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9369
+
+/**
+Sample:
+---
+a=1;
+writeln(&a);
+!
+?
+---
+*/
+void foo() { }
+
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9475.d b/gcc/testsuite/gdc.test/compilable/ddoc9475.d
new file mode 100644
index 00000000000..460269ce676
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9475.d
@@ -0,0 +1,29 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -w -o- -c -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9475
+
+module ddoc9475;
+
+/// foo
+void foo() { }
+
+///
+unittest
+{
+    // comment 1
+    foreach (i; 0 .. 10)
+    {
+        // comment 2
+        documentedFunction();
+    }
+}
+
+/// bar
+void bar() { }
+
+///
+unittest
+{
+    // bar comment
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9497a.d b/gcc/testsuite/gdc.test/compilable/ddoc9497a.d
new file mode 100644
index 00000000000..6617434b988
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9497a.d
@@ -0,0 +1,12 @@
+// EXTRA_SOURCES: extra-files/ddoc9497a.ddoc
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9497a
+
+/**
+    foo function.
+    Args: $(XYZ arg1, arg2)
+*/
+void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9497b.d b/gcc/testsuite/gdc.test/compilable/ddoc9497b.d
new file mode 100644
index 00000000000..62ab44c8928
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9497b.d
@@ -0,0 +1,12 @@
+// EXTRA_SOURCES: extra-files/ddoc9497b.ddoc
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9497b
+
+/**
+    foo function.
+    Args: $(XYZ arg1, arg2)
+*/
+void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9497c.d b/gcc/testsuite/gdc.test/compilable/ddoc9497c.d
new file mode 100644
index 00000000000..da9e3df11c3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9497c.d
@@ -0,0 +1,12 @@
+// EXTRA_SOURCES: extra-files/ddoc9497c.ddoc
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9497c
+
+/**
+    foo function.
+    Args: $(XYZ arg1, arg2)
+*/
+void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9497d.d b/gcc/testsuite/gdc.test/compilable/ddoc9497d.d
new file mode 100644
index 00000000000..c42f013e41c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9497d.d
@@ -0,0 +1,12 @@
+// EXTRA_SOURCES: extra-files/ddoc9497d.ddoc
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9497d
+
+/**
+    foo function.
+    Args: $(XYZ arg1, arg2)
+*/
+void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9676a.d b/gcc/testsuite/gdc.test/compilable/ddoc9676a.d
new file mode 100644
index 00000000000..fc12a6ec62d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9676a.d
@@ -0,0 +1,9 @@
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: /extra-files/ddoc9676a.ddoc
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9676a
+
+module ddoc9676a;
+
+///
+deprecated void foo() {}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9676b.d b/gcc/testsuite/gdc.test/compilable/ddoc9676b.d
new file mode 100644
index 00000000000..63145495ce8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9676b.d
@@ -0,0 +1,8 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9676b
+
+module ddoc9676b;
+
+///
+deprecated void foo() {}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9727.d b/gcc/testsuite/gdc.test/compilable/ddoc9727.d
new file mode 100644
index 00000000000..14e5fd2ab71
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9727.d
@@ -0,0 +1,25 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9727
+module ddoc9727;
+
+/** The function foo. */
+void foo(int x);
+
+/**  */
+unittest
+{
+    foo(1);
+}
+
+/** foo can be used like this: */
+unittest
+{
+    foo(2);
+}
+
+/** foo can also be used like this: */
+unittest
+{
+    foo(3);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9789.d b/gcc/testsuite/gdc.test/compilable/ddoc9789.d
new file mode 100644
index 00000000000..b220c7f8e76
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9789.d
@@ -0,0 +1,11 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -w -o- -c -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9789
+
+module ddoc9789;
+
+///
+struct S {}
+
+///
+alias A = S;
diff --git a/gcc/testsuite/gdc.test/compilable/ddoc9903.d b/gcc/testsuite/gdc.test/compilable/ddoc9903.d
new file mode 100644
index 00000000000..00b6a7982a2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddoc9903.d
@@ -0,0 +1,35 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9903
+
+/// sss
+struct S9903X {}
+/// Ditto
+struct S9903Y {}
+
+/// ccc
+class C9903X {}
+/// Ditto
+class C9903Y {}
+
+/// uuu
+union U9903X {}
+/// Ditto
+union U9903Y {}
+
+/// iii
+interface I9903X {}
+/// Ditto
+interface I9903Y {}
+
+/// eee
+enum E9903X { a }
+/// Ditto
+enum E9903Y { a }
+
+///
+enum {
+    a9903,  /// ea
+    b9903,  /// Ditto
+    c9903,  /// ec
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ddocYear.d b/gcc/testsuite/gdc.test/compilable/ddocYear.d
new file mode 100644
index 00000000000..ec8578f456b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddocYear.d
@@ -0,0 +1,6 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocYear-postscript.sh
+
+/// $(YEAR)
+int year;
diff --git a/gcc/testsuite/gdc.test/compilable/ddocbackticks.d b/gcc/testsuite/gdc.test/compilable/ddocbackticks.d
new file mode 100644
index 00000000000..8249c4b00d3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddocbackticks.d
@@ -0,0 +1,24 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh backticks
+
+/++
+        Closely related to std.datetime is <a href="core_time.html">`core.time`</a>,
+    and some of the time types used in std.datetime come from there - such as
+    $(CXREF time, Duration), $(CXREF time, TickDuration), and
+    $(CXREF time, FracSec).
+    core.time is publically imported into std.datetime, it isn't necessary
+    to import it separately.
++/
+module ddocbackticks;
+
+/// This should produce `inline code`.
+void test() {}
+
+/// But `this should NOT be inline'
+///
+/// However, restarting on a new line should be `inline again`.
+void test2() {}
+
+/// This `int foo;` should show highlight on foo, but not int.
+void foo() {}
diff --git a/gcc/testsuite/gdc.test/compilable/ddocunittest.d b/gcc/testsuite/gdc.test/compilable/ddocunittest.d
new file mode 100644
index 00000000000..940ef1caf34
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ddocunittest.d
@@ -0,0 +1,496 @@
+// PERMUTE_ARGS: -unittest
+// REQUIRED_ARGS: -D -w -o- -c -Dd${RESULTS_DIR}/compilable -o-
+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh unittest
+
+module ddocunittest;
+
+/* Insert test-cases for documented unittests feature here. */
+
+/// foo function - 1 example
+int foo(int a, int b) { return a + b; }
+
+///
+unittest
+{
+    assert(foo(1, 1) == 2);
+}
+
+/// bar function - 1 example
+bool bar() { return true; }
+
+///
+unittest
+{
+    // documented
+    assert(bar());
+}
+
+/// placeholder
+unittest
+{
+}
+
+/// doo function - no examples
+void doo() { }
+
+///
+private unittest
+{
+    // undocumented
+    doo();
+}
+
+unittest
+{
+    // undocumented
+    doo();
+}
+
+/**
+add function - 3 examples
+
+Examples:
+
+----
+assert(add(1, 1) == 2);
+----
+*/
+int add(int a, int b) { return a + b; }
+
+///
+unittest
+{
+    // documented
+    assert(add(3, 3) == 6);
+    assert(add(4, 4) == 8);
+}
+
+unittest
+{
+    // undocumented
+    assert(add(2, 2) + add(2, 2) == 8);
+}
+
+///
+unittest
+{
+    // documented
+    assert(add(5, 5) == 10);
+    assert(add(6, 6) == 12);
+}
+
+/// class Foo
+immutable pure nothrow class Foo
+{
+    int x;
+
+    ///
+    unittest
+    {
+        // another foo example
+        Foo foo = new Foo;
+    }
+}
+
+///
+unittest
+{
+    Foo foo = new Foo;
+}
+
+pure
+{
+    const
+    {
+        immutable
+        {
+            /// some class - 1 example
+            class SomeClass {}
+        }
+    }
+}
+
+///
+unittest
+{
+    SomeClass sc = new SomeClass;
+}
+
+/// Outer - 1 example
+class Outer
+{
+    /// Inner
+    static class Inner
+    {
+    }
+
+    ///
+    unittest
+    {
+        Inner inner = new Inner;
+    }
+}
+
+///
+unittest
+{
+    Outer outer = new Outer;
+}
+
+/** foobar - no examples */
+void foobar()
+{
+}
+
+unittest
+{
+    foobar();
+}
+
+/**
+func - 4 examples
+Examples:
+---
+foo(1);
+---
+
+Examples:
+---
+foo(2);
+---
+*/
+void foo(int x) {  }
+
+///
+unittest
+{
+    foo(2);
+}
+
+///
+unittest
+{
+    foo(4);
+}
+
+// ------------------------------------
+// insert import declaration between documented function and unittests
+
+///
+void fooImport() {}
+import core.stdc.stdio;
+/// test
+unittest { fooImport(); }
+
+///
+void fooStaticImport() {}
+static import core.stdc.stdlib;
+/// test
+unittest { fooStaticImport(); }
+
+///
+void fooPublicImport() {}
+public import core.stdc.string;
+/// test
+unittest { fooPublicImport(); }
+
+///
+void fooSelectiveImport() {}
+import core.stdc.ctype : isalpha;
+/// test
+unittest { fooSelectiveImport(); }
+
+///
+void fooRenamedImport() {}
+import io = core.stdc.stdio;
+/// test
+unittest { fooRenamedImport(); }
+
+// ------------------------------------
+// documented unittest after conditional declarations
+
+static if (true)
+  void fooConditionalDecl1a() {} /** */
+unittest { int x1a; }   ///
+
+static if (true)
+{ void fooConditionalDecl1b() {} /** */ }
+unittest { int x1b; }   ///
+
+static if (false)
+  void fooConditionalDecl2a() {} /** */
+unittest { int x2a; }   ///
+
+static if (false)
+{ void fooConditionalDecl2b() {} /** */ }
+unittest { int x2b; }   ///
+
+static if (true)
+{ void fooConditionalDecl3a() {} /** */ }
+else
+{ void barConditionalDecl3a() {} /** */ }
+unittest { int x3a; }   ///
+
+static if (true)
+{ void fooConditionalDecl3b() {} /** */ }
+else
+{ void barConditionalDecl3b() {} /** */ }
+unittest { int x3b; }   ///
+
+static if (false)
+  void fooConditionalDecl4a() {} /** */
+else
+  void barConditionalDecl4a() {} /** */
+unittest { int x4a; }   ///
+
+static if (false)
+{ void fooConditionalDecl4b() {} /** */ }
+else
+{ void barConditionalDecl4b() {} /** */ }
+unittest { int x4b; }   ///
+
+static if (true)
+{}
+else
+  void barConditionalDecl5a() {} /** */
+unittest { int x5a; }   ///
+
+static if (true)
+{}
+else
+{ void barConditionalDecl5b() {} /** */ }
+unittest { int x5b; }   ///
+
+static if (false)
+{}
+else
+  void barConditionalDecl6a() {} /** */
+///
+unittest { int x6a; }
+
+static if (false)
+{}
+else
+{ void barConditionalDecl6b() {} /** */ }
+///
+unittest { int x6b; }
+
+// ------------------------------------
+// 9474
+
+///
+void foo9474() { }
+
+version(none)
+unittest { }
+
+/// Example
+unittest { foo9474(); }
+
+/// doc
+void bar9474() { }
+
+version(none)
+unittest { }
+
+/// Example
+unittest { bar9474(); }
+
+///
+struct S9474
+{
+}
+///
+unittest { S9474 s; }
+
+///
+auto autovar9474 = 1;
+///
+unittest { int v = autovar9474; }
+
+///
+auto autofun9474() { return 1; }
+///
+    unittest { int n = autofun9474(); }
+
+///
+template Template9474()
+{
+    /// Shouldn't link following unittest to here
+    void foo() {}
+}
+///
+unittest { alias Template9474!() T; }
+
+// ------------------------------------
+// 9713
+
+///
+void fooNoDescription() {}
+///
+unittest { fooNoDescription(); }
+///
+unittest { if (true) {fooNoDescription(); } /* comment */ }
+
+// ------------------------------------
+
+/// test for bugzilla 9757
+void foo9757() {}
+/// ditto
+void bar9757() {}
+/// ditto
+void baz9757() {}
+///
+unittest { foo9757(); bar9757(); }
+///
+unittest { bar9757(); foo9757(); }
+
+/// with template functions
+auto redBlackTree(E)(E[] elems...)
+{
+    return 1;
+}
+/// ditto
+auto redBlackTree(bool allowDuplicates, E)(E[] elems...)
+{
+    return 2;
+}
+/// ditto
+auto redBlackTree(alias less, E)(E[] elems...)
+{
+    return 3;
+}
+///
+unittest
+{
+    auto rbt1 = redBlackTree(0, 1, 5, 7);
+    auto rbt2 = redBlackTree!string("hello", "world");
+    auto rbt3 = redBlackTree!true(0, 1, 5, 7, 5);
+    auto rbt4 = redBlackTree!"a > b"(0, 1, 5, 7);
+}
+
+// ------------------------------------
+// Issue 9758
+
+/// test
+void foo(){}
+
+///
+unittest {  }
+
+// ------------------------------------
+// Issue 10519
+
+///
+bool balancedParens10519(string, char, char) { return true; }
+///
+unittest
+{
+    auto s = "1 + (2 * (3 + 1 / 2)";
+    assert(!balancedParens10519(s, '(', ')'));
+}
+
+// ------------------------------------
+// Issue 12097
+
+/// declaration
+struct S12097
+{
+    /// method
+    void foo() {}
+}
+
+/// ditto
+void f12097() {}
+
+/// ddoc code 1
+unittest
+{
+    int a = 1;
+}
+
+/// ditto
+struct T12097(T) {}
+
+/// ddoc code 2
+unittest
+{
+    int[] arr;
+}
+
+// ------------------------------------
+// 14594
+
+/*******************
+ * testA
+ */
+void fun14594a()() {}
+///
+unittest { fun14594a(); }
+
+/*******************
+ * testB
+ */
+void fun14594b()() {}
+/// ditto
+void fun14594b(T)(T) {}
+///
+unittest { fun14594b(); fun14594b(1); }
+
+/*******************
+ * testC
+ */
+void fun14594c()() {}
+///
+unittest { fun14594c(); fun14594c(1); }
+/// ditto
+void fun14594c(T)(T) {}
+
+/*******************
+ * testD
+ */
+void fun14594d()() {}
+///
+unittest { fun14594d(); }
+/// ditto
+void fun14594d(T)(T) {}
+///
+unittest { fun14594d(1); }
+
+/*******************
+ * testE
+ */
+template fun14594e()
+{
+    /// concatenated doc-comment fun14594e
+    void fun14594e() {}
+    /// ignored-unittest fun14594e
+    unittest { fun14594e(); }
+}
+/// doc-unittest fun14594e
+unittest { fun14594e(); }
+
+/*******************
+ * testF
+ */
+template fun14594f()
+{
+    /// concatenated doc-comment fun14594f
+    void fun14594f() {}
+    /// ignored-unittest fun14594f
+    unittest { fun14594f(); }
+}
+/// ditto
+template fun14594f(T)
+{
+    /// ignored doc-comment fun14594f
+    void fun14594f(T) {}
+    /// ignored-unittest fun14594f
+    unittest { fun14594f(1); }
+}
+/// doc-unittest fun14594f
+unittest { fun14594f(); }
+
+// ------------------------------------
+
+void main() { }
diff --git a/gcc/testsuite/gdc.test/compilable/debuginfo.d b/gcc/testsuite/gdc.test/compilable/debuginfo.d
new file mode 100644
index 00000000000..5c1da4bba19
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/debuginfo.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -g
+
+struct Bug7127a {
+    const(Bug7127a)* self;
+}
+
+struct Bug7127b {
+    void function(const(Bug7127b) self) foo;
+}
+
+void main() {
+    Bug7127a a;
+    Bug7127b b;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/defa.d b/gcc/testsuite/gdc.test/compilable/defa.d
new file mode 100644
index 00000000000..4fb700bed44
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/defa.d
@@ -0,0 +1,19 @@
+// PERMUTE_ARGS:
+
+module defa;
+
+private import imports.defaa;
+	
+public abstract class A
+{
+	Display d;
+	int style;
+
+	this() {}
+
+	public this(A parent, int style)
+	{
+		this.style = style;
+		d = parent.d;
+	}
+}
diff --git a/gcc/testsuite/gdc.test/compilable/depmsg.d b/gcc/testsuite/gdc.test/compilable/depmsg.d
new file mode 100644
index 00000000000..c841916a5ff
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/depmsg.d
@@ -0,0 +1,33 @@
+// REQUIRED_ARGS: -d
+// PERMUTE_ARGS: -dw
+
+void main()
+{
+    class Inner
+    {
+        deprecated("With message!")
+        {
+            struct A { }
+            class B { }
+            interface C { }
+            union D { }
+            enum E { e };
+            //typedef int F;
+            alias int G;
+            static int H;
+            template I() { class I {} }
+        }
+    }
+    with(Inner)
+    {
+        A a;
+        B b;
+        C c;
+        D d;
+        E e;
+        //F f;
+        G g;
+        auto h = H;
+        I!() i;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/deprecate12979a.d b/gcc/testsuite/gdc.test/compilable/deprecate12979a.d
new file mode 100644
index 00000000000..b15823b77c5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/deprecate12979a.d
@@ -0,0 +1,27 @@
+// REQUIRED_ARGS: -dw
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+compilable/deprecate12979a.d(13): Deprecation: asm statement is assumed to throw - mark it with 'nothrow' if it does not
+---
+*/
+
+void foo() nothrow
+{
+    version(GNU)
+    {
+        asm
+        {
+            "";
+        }
+    }
+    else
+    {
+        asm
+        {
+            ret;
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/deprecate14283.d b/gcc/testsuite/gdc.test/compilable/deprecate14283.d
new file mode 100644
index 00000000000..9c82add1776
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/deprecate14283.d
@@ -0,0 +1,18 @@
+// REQUIRED_ARGS: -dw
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+---
+*/
+
+class C
+{
+    void bug()
+    {
+        autoref(this);  // 'auto ref' becomes non-ref parameter
+        autoref(super); // 'auto ref' becomes non-ref parameter
+    }
+}
+
+void autoref(T)(auto ref T t) { static assert(__traits(isRef, t) == false); }
diff --git a/gcc/testsuite/gdc.test/compilable/depsOutput9948.d b/gcc/testsuite/gdc.test/compilable/depsOutput9948.d
new file mode 100644
index 00000000000..5ba4897a1f5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/depsOutput9948.d
@@ -0,0 +1,12 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -deps=${RESULTS_DIR}/compilable/depsOutput9948.deps
+// POST_SCRIPT: compilable/extra-files/depsOutput.sh 
+// EXTRA_SOURCES: /extra-files/depsOutput9948a.d
+
+module depsOutput9948;
+import depsOutput9948a;
+
+void main()
+{
+   templateFunc!("import std.string;")();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/derivedarray.d b/gcc/testsuite/gdc.test/compilable/derivedarray.d
new file mode 100644
index 00000000000..7a7f3c8c44b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/derivedarray.d
@@ -0,0 +1,130 @@
+// PERMUTE_ARGS:
+
+class C {}
+class D : C {}
+
+void dynamicarrays()
+{
+    C[] a;
+    D[] b;
+    const(C)[] c;
+    const(D)[] d;
+    immutable(C)[] e;
+    immutable(D)[] f;
+
+    static assert( __traits(compiles, a = a));
+    static assert(!__traits(compiles, a = b));
+    static assert(!__traits(compiles, a = c));
+    static assert(!__traits(compiles, a = d));
+    static assert(!__traits(compiles, a = e));
+    static assert(!__traits(compiles, a = f));
+
+    static assert(!__traits(compiles, b = a));
+    static assert( __traits(compiles, b = b));
+    static assert(!__traits(compiles, b = c));
+    static assert(!__traits(compiles, b = d));
+    static assert(!__traits(compiles, b = e));
+    static assert(!__traits(compiles, b = f));
+
+    static assert( __traits(compiles, c = a));
+    static assert( __traits(compiles, c = b));
+    static assert( __traits(compiles, c = c));
+    static assert( __traits(compiles, c = d));
+    static assert( __traits(compiles, c = e));
+    static assert( __traits(compiles, c = f));
+
+    static assert(!__traits(compiles, d = a));
+    static assert( __traits(compiles, d = b));
+    static assert(!__traits(compiles, d = c));
+    static assert( __traits(compiles, d = d));
+    static assert(!__traits(compiles, d = e));
+    static assert( __traits(compiles, d = f));
+
+    static assert(!__traits(compiles, e = a));
+    static assert(!__traits(compiles, e = b));
+    static assert(!__traits(compiles, e = c));
+    static assert(!__traits(compiles, e = d));
+    static assert( __traits(compiles, e = e));
+    static assert( __traits(compiles, e = f));
+
+    static assert(!__traits(compiles, f = a));
+    static assert(!__traits(compiles, f = b));
+    static assert(!__traits(compiles, f = c));
+    static assert(!__traits(compiles, f = d));
+    static assert(!__traits(compiles, f = e));
+    static assert( __traits(compiles, f = f));
+}
+
+
+void statictodynamicarrays()
+{
+    C[] a;
+    D[] b;
+    const(C)[] c;
+    const(D)[] d;
+    immutable(C)[] e;
+    immutable(D)[] f;
+
+    C[1] sa;
+    D[1] sb;
+    const(C)[1] sc = void;
+    const(D)[1] sd = void;
+    immutable(C)[1] se = void;
+    immutable(D)[1] sf = void;
+
+    static assert( __traits(compiles, a = sa));
+    static assert(!__traits(compiles, a = sb));
+    static assert(!__traits(compiles, a = sc));
+    static assert(!__traits(compiles, a = sd));
+    static assert(!__traits(compiles, a = se));
+    static assert(!__traits(compiles, a = sf));
+
+    static assert(!__traits(compiles, b = sa));
+    static assert( __traits(compiles, b = sb));
+    static assert(!__traits(compiles, b = sc));
+    static assert(!__traits(compiles, b = sd));
+    static assert(!__traits(compiles, b = se));
+    static assert(!__traits(compiles, b = sf));
+
+    static assert( __traits(compiles, c = sa));
+    static assert( __traits(compiles, c = sb));
+    static assert( __traits(compiles, c = sc));
+    static assert( __traits(compiles, c = sd));
+    static assert( __traits(compiles, c = se));
+    static assert( __traits(compiles, c = sf));
+
+    static assert(!__traits(compiles, d = sa));
+    static assert( __traits(compiles, d = sb));
+    static assert(!__traits(compiles, d = sc));
+    static assert( __traits(compiles, d = sd));
+    static assert(!__traits(compiles, d = se));
+    static assert( __traits(compiles, d = sf));
+
+    static assert(!__traits(compiles, e = sa));
+    static assert(!__traits(compiles, e = sb));
+    static assert(!__traits(compiles, e = sc));
+    static assert(!__traits(compiles, e = sd));
+    static assert( __traits(compiles, e = se));
+    static assert( __traits(compiles, e = sf));
+
+    static assert(!__traits(compiles, f = sa));
+    static assert(!__traits(compiles, f = sb));
+    static assert(!__traits(compiles, f = sc));
+    static assert(!__traits(compiles, f = sd));
+    static assert(!__traits(compiles, f = se));
+    static assert( __traits(compiles, f = sf));
+}
+
+void staticarrays()
+{
+    C[1] sa;
+    D[1] sb;
+
+    const(C)[1] sc = sa;
+    const(D)[1] sd = sb;
+
+    sa = sb;
+    static assert(!__traits(compiles, sb = sa));
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/diag11066.d b/gcc/testsuite/gdc.test/compilable/diag11066.d
new file mode 100644
index 00000000000..3d9383189a5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/diag11066.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -w -profile
+/*
+TEST_OUTPUT:
+---
+---
+*/
+
+void main()
+{
+    string s;
+    foreach (dchar c; s) // affected by dchar
+        return;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/dip22.d b/gcc/testsuite/gdc.test/compilable/dip22.d
new file mode 100644
index 00000000000..5c0201a070f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/dip22.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -de
+import imports.dip22;
+
+class Foo : Base1, Base2
+{
+    void test()
+    {
+        static assert(typeof(bar()).sizeof == 2);
+        static assert(baz == 2);
+        static assert(T.sizeof == 2);
+    }
+}
+
+void test()
+{
+    bar(12);
+    baz(12);
+    12.bar();
+    12.baz();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/empty_file.d b/gcc/testsuite/gdc.test/compilable/empty_file.d
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/c6395.d b/gcc/testsuite/gdc.test/compilable/extra-files/c6395.d
new file mode 100644
index 00000000000..47e9c9c3523
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/c6395.d
@@ -0,0 +1,20 @@
+// 6395
+
+template map(alias fun) {
+  auto map(Range)(Range r) {
+    struct Result
+    {
+      @property auto ref front()
+      {
+        return fun("a");
+      }
+    }
+    return Result();
+  }
+}
+
+Range find(alias pred, Range)(Range haystack) {
+  pred(haystack.front);
+  return haystack;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/ddoc10367.ddoc b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc10367.ddoc
new file mode 100644
index 00000000000..2b1dcee52ab
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc10367.ddoc
@@ -0,0 +1 @@
+DDOC_ENUM_BASETYPE = $(RED $0)
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/ddoc198.ddoc b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc198.ddoc
new file mode 100644
index 00000000000..4b69e8f6bf3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc198.ddoc
@@ -0,0 +1,2 @@
+DDOC_PSYMBOL = <a name="$0"></a><span style="color:OrangeRed" class="ddoc_psymbol">$0</span>
+DDOC_PSUPER_SYMBOL = <a name="$0"></a><span style="color:blue" class="ddoc_psuper_symbol">$0</span>
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/ddoc3.ddoc b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc3.ddoc
new file mode 100644
index 00000000000..ff8fcae04a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc3.ddoc
@@ -0,0 +1,3 @@
+HELLO = world
+
+UNUSED=unused
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9369.ddoc b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9369.ddoc
new file mode 100644
index 00000000000..04fb07b446d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9369.ddoc
@@ -0,0 +1,3 @@
+ESCAPES = /&/AddressOf!/
+          /!/Exclamation/
+          /?/QuestionMark/
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497a.ddoc b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497a.ddoc
new file mode 100644
index 00000000000..b543e1f95e9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497a.ddoc
@@ -0,0 +1 @@
+DDOC_UNDEFINED_MACRO=<!-- $(DOLLAR)($1 $+) -->
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497b.ddoc b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497b.ddoc
new file mode 100644
index 00000000000..d1cdd903733
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497b.ddoc
@@ -0,0 +1 @@
+DDOC_UNDEFINED_MACRO=$(DOLLAR)($1 $+)
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497c.ddoc b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497c.ddoc
new file mode 100644
index 00000000000..5d71cdf87d5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497c.ddoc
@@ -0,0 +1 @@
+DDOC_UNDEFINED_MACRO=$+
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497d.ddoc b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497d.ddoc
new file mode 100644
index 00000000000..619fb9e2987
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9497d.ddoc
@@ -0,0 +1 @@
+DDOC_UNDEFINED_MACRO=ERROR_UNDEFINED_MACRO: "$1"
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9676a.ddoc b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9676a.ddoc
new file mode 100644
index 00000000000..63be0be03f7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9676a.ddoc
@@ -0,0 +1 @@
+DEPRECATED = <del>$0</del>
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9764.dd b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9764.dd
new file mode 100644
index 00000000000..9c8440c084a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9764.dd
@@ -0,0 +1,7 @@
+Ddoc
+
+Check ddoc9764 document.
+----
+// Check ddoc9764 comment.
+ddoc9764();
+----
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/depsOutput9948a.d b/gcc/testsuite/gdc.test/compilable/extra-files/depsOutput9948a.d
new file mode 100644
index 00000000000..3f4e3a3d3b6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/depsOutput9948a.d
@@ -0,0 +1,6 @@
+module depsOutput9948a;
+
+void templateFunc(string myImport)()
+{
+   mixin(myImport);
+}
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/example7190/controllers/HomeController.d b/gcc/testsuite/gdc.test/compilable/extra-files/example7190/controllers/HomeController.d
new file mode 100644
index 00000000000..e83653a9b32
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/example7190/controllers/HomeController.d
@@ -0,0 +1,7 @@
+module example7190.controllers.HomeController;
+
+import serenity7190.core.Controller;
+
+class HomeController : Controller {
+    mixin register!(HomeController);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/example7190/models/HomeModel.d b/gcc/testsuite/gdc.test/compilable/extra-files/example7190/models/HomeModel.d
new file mode 100644
index 00000000000..17709481874
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/example7190/models/HomeModel.d
@@ -0,0 +1,11 @@
+module example7190.models.HomeModel;
+
+import serenity7190.core.Model;
+
+struct Article {
+    ulong id;
+}
+
+class HomeModel : Model {
+    private SqlitePersister!Article mArticles;
+}
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/header1.d b/gcc/testsuite/gdc.test/compilable/extra-files/header1.d
new file mode 100644
index 00000000000..457c310fb76
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/header1.d
@@ -0,0 +1,514 @@
+module foo.bar;
+
+import core.vararg;
+import std.stdio;
+
+pragma(lib, "test");
+pragma(msg, "Hello World");
+
+static assert(true, "message");
+
+alias double mydbl;
+
+int testmain()
+in
+{
+    assert(1+(2+3) == -(1 - 2*3));
+}
+out (result)
+{
+    assert(result == 0);
+}
+body
+{
+    float f = float.infinity;
+    int i = cast(int) f;
+    writeln((i,1),2);
+    writeln(cast(int)float.max);
+    assert(i == cast(int)float.max);
+    assert(i == 0x80000000);
+    return 0;
+}
+
+struct S { int m, n; }
+
+template Foo(T, int V)
+{
+    void foo(...)
+    {
+        static if (is(Object _ : X!TL, alias X, TL...)) {}  // Bugzilla 10044
+
+        auto x = __traits(hasMember, Object, "noMember");
+        auto y = is(Object : X!TL, alias X, TL...);
+        assert(!x && !y, "message");
+
+        S s = { 1,2 };
+        auto a = [1, 2, 3];
+        auto aa = [1:1, 2:2, 3:3];
+
+        int n,m;
+    }
+
+    int bar(double d, int x)
+    {
+    if (d)
+    {   d++;
+    }
+    else
+        d--;
+
+    asm
+    {	naked ;
+        mov EAX, 3;
+    }
+
+    for (;;)
+    {
+        d = d + 1;
+    }
+
+    for (int i = 0; i < 10; i++)
+    {
+        d = i ? d + 1 : 5;
+    }
+
+    char[] s;
+    foreach (char c; s)
+    {
+        d *= 2;
+        if (d)
+        break;
+        else
+        continue;
+    }
+
+    switch (V)
+    {
+        case 1:
+        case 2: break;
+        case 3: goto case 1;
+        case 4: goto default;
+        default:
+        d /= 8;
+        break;
+    }
+
+        enum Label { A, B, C };
+        void fswitch(Label l)
+        {
+            final switch (l)
+            {
+            case A: break;
+            case B: break;
+            case C: break;
+            }
+        }
+
+    loop:
+    while (x)
+    {
+        x--;
+        if (x)
+        break loop;
+        else
+        continue loop;
+    }
+
+    do
+    {
+        x++;
+    } while (x < 10);
+
+    try
+    {
+        bar(1, 2);
+    }
+    catch (Object o)
+    {
+        x++;
+    }
+    finally
+    {
+        x--;
+    }
+
+    Object o;
+    synchronized (o)
+    {
+        x = ~x;
+    }
+
+    synchronized
+    {
+        x = x < 3;
+    }
+
+    with (o)
+    {
+        toString();
+    }
+    }
+}
+
+static this()
+{
+}
+
+static ~this()
+{
+}
+
+pure nothrow @safe @nogc static  this() {}
+pure nothrow @safe @nogc static ~this() {}
+static  this() pure nothrow @safe @nogc {}
+static ~this() pure nothrow @safe @nogc {}
+
+pure nothrow @safe @nogc shared static  this() {}
+pure nothrow @safe @nogc shared static ~this() {}
+shared static  this() pure nothrow @safe @nogc {}
+shared static ~this() pure nothrow @safe @nogc {}
+
+interface iFoo{}
+class xFoo: iFoo{}
+
+interface iFoo2{}
+class xFoo2: iFoo, iFoo2{}
+
+class Foo3
+{
+    this(int a, ...){}
+    this(int* a){}
+}
+
+alias int myint;
+
+static notquit = 1;
+
+class Test
+{
+    void a() {}
+    void b() {}
+    void c() {}
+    void d() {}
+    void e() {}
+    void f() {}
+    void g() {}
+    void h() {}
+    void i() {}
+    void j() {}
+    void k() {}
+    void l() {}
+    void m() {}
+    void n() {}
+    void o() {}
+    void p() {}
+    void q() {}
+    void r() {}
+    void s() {}
+    void t() {}
+    void u() {}
+    void v() {}
+    void w() {}
+    void x() {}
+    void y() {}
+    void z() {}
+
+    void aa() {}
+    void bb() {}
+    void cc() {}
+    void dd() {}
+    void ee() {} // Try adding or removing some functions here to see the effect.
+
+    template A(T) { }
+
+    alias A!(uint) getHUint;
+    alias A!(int) getHInt;
+    alias A!(float) getHFloat;
+    alias A!(ulong) getHUlong;
+    alias A!(long) getHLong;
+    alias A!(double) getHDouble;
+    alias A!(byte) getHByte;
+    alias A!(ubyte) getHUbyte;
+    alias A!(short) getHShort;
+    alias A!(ushort) getHUShort;
+    alias A!(real) getHReal;
+
+    alias void F();
+
+    pure nothrow @safe @nogc unittest {}
+    pure nothrow @safe @nogc invariant {}
+
+    pure nothrow @safe @nogc new (size_t sz) { return null; }
+    pure nothrow @safe @nogc delete (void* p) { }
+}
+
+template templ( T )
+{
+    void templ( T val )
+    {
+        pragma( msg, "Invalid destination type." );
+    }
+}
+
+static char[] charArray = [ '\"', '\'' ];
+
+class Point
+{
+    auto x = 10;
+    uint y = 20;
+}
+
+template Foo2(bool bar)
+{
+    void test()
+    {
+    static if(bar)
+    {
+        int i;
+    }
+    else
+    {
+    }
+    static if(!bar)
+    {
+    }
+    else
+    {
+    }
+    }
+}
+
+
+template Foo4()
+{
+        void bar()
+        {
+        }
+}
+
+template Foo4x( T... ) {}
+
+class Baz4
+{
+        mixin Foo4 foo;
+        mixin Foo4x!(int, "str") foox;
+
+        alias foo.bar baz;
+}
+
+int test(T)(T t)
+{
+        if (auto o = cast(Object)t) return 1;
+        return 0;
+}
+
+enum x6 = 1;
+
+bool foo6(int a, int b, int c, int d)
+{
+    return (a < b) != (c < d);
+}
+
+auto foo7(int x)
+{
+        return 5;
+}
+
+class D8{}
+void func8()
+{
+  scope a= new D8();
+}
+
+T func9(T)() if (true)
+{
+    T i;
+    scope(exit) i= 1;
+    scope(success) i = 2;
+    scope(failure) i = 3;
+    return i;
+}
+
+template V10(T)
+{
+    void func()
+    {
+        for(int i,j=4; i<3;i++)
+        {
+        }
+    }
+}
+
+int foo11(int function() fn)
+{
+    return fn();
+}
+
+int bar11(T)()
+{
+    return foo11(function int (){ return 0; });
+}
+
+
+struct S6360
+{
+    @property long weeks1() const pure nothrow { return 0; }
+
+    @property const pure nothrow long weeks2() { return 0; }
+}
+
+
+struct S12
+{
+    /// postfix storage class and constructor
+    this(int n) nothrow{}
+
+    /// prefix storage class (==StorageClassDeclaration) and constructor
+    nothrow this(string s){}
+}
+
+/// dummy
+struct T12
+{
+    /// postfix storage class and template constructor
+    this()(int args) immutable { }
+
+    /// prefix storage class (==StorageClassDeclaration) and template constructor
+    immutable this(A...)(A args){ }
+}
+
+
+// 6591
+import std.stdio : writeln, F = File;
+
+void foo6591()()
+{
+    import std.stdio : writeln, F = File;
+}
+
+
+// 8081
+version(unittest) {
+    pure nothrow unittest {}
+    pure nothrow unittest {}
+
+    public unittest {}
+    extern(C) unittest {}
+    align unittest {}
+}
+
+
+// 10334
+
+template Foo10334(T) if (Bar10334!()) {}                ///
+template Foo10334(T) if (Bar10334!100) {}               ///
+template Foo10334(T) if (Bar10334!3.14) {}              ///
+template Foo10334(T) if (Bar10334!"str") {}             ///
+template Foo10334(T) if (Bar10334!1.4i) {}              ///
+template Foo10334(T) if (Bar10334!null) {}              ///
+template Foo10334(T) if (Bar10334!true) {}              ///
+template Foo10334(T) if (Bar10334!false) {}             ///
+template Foo10334(T) if (Bar10334!'A') {}               ///
+template Foo10334(T) if (Bar10334!int) {}               ///
+template Foo10334(T) if (Bar10334!string) {}            ///
+template Foo10334(T) if (Bar10334!wstring) {}           ///
+template Foo10334(T) if (Bar10334!dstring) {}           ///
+template Foo10334(T) if (Bar10334!this) {}              ///
+template Foo10334(T) if (Bar10334!([1,2,3])) {}         ///
+template Foo10334(T) if (Bar10334!(Baz10334!())) {}     ///
+template Foo10334(T) if (Bar10334!(Baz10334!T)) {}      ///
+template Foo10334(T) if (Bar10334!(Baz10334!100)) {}    ///
+template Foo10334(T) if (Bar10334!(.foo)) {}            ///
+template Foo10334(T) if (Bar10334!(const int)) {}       ///
+template Foo10334(T) if (Bar10334!(shared T)) {}        ///
+
+template Test10334(T...) {}     ///
+mixin Test10334!int a;          ///
+mixin Test10334!(int,long) b;   ///
+mixin Test10334!"str" c;        ///
+
+// 12266
+auto clamp12266a(T1, T2, T3)(T1 x, T2 min_val, T3 max_val)
+{
+    return 0;
+}
+pure clamp12266b(T1, T2, T3)(T1 x, T2 min_val, T3 max_val)
+{
+    return 0;
+}
+@disable pure clamp12266c(T1, T2, T3)(T1 x, T2 min_val, T3 max_val)
+{
+    return 0;
+}
+
+// 13832
+alias Dg13832 = ref int delegate();
+
+// 16590
+class TestClass {
+    int aa;
+    int b1, b2;
+    this(int b1, int b2)
+    {
+        this.b1 = b1;
+        this.b2 = b2;
+    }
+
+    ref foo() {
+        return aa;
+    }
+
+    ref retFunc() return {
+        return aa;
+    }
+
+    ~this() @trusted @disable @nogc {
+    }
+}
+
+class FooA {
+    protected void method42() {
+
+    }
+
+    ~this() @safe {
+    }
+
+}
+
+
+class Bar : FooA {
+    override void method42() {
+
+   }
+}
+
+double foo() @trusted {
+    int a = 5;
+    return a;
+}
+
+struct Foo1(size_t Size = 42 / magic()) {
+
+}
+
+
+size_t magic() {
+    return 42;
+}
+
+class Foo2A {
+
+    immutable(FooA) Dummy = new immutable(FooA);
+    private immutable pure nothrow @nogc @safe this() {
+
+    }
+
+}
+
+// bugzilla 15676
+struct Foo3A(T)
+{
+    @disable this(this);
+    @disable this();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/header2.d b/gcc/testsuite/gdc.test/compilable/extra-files/header2.d
new file mode 100644
index 00000000000..36c31dd6b97
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/header2.d
@@ -0,0 +1,151 @@
+// for D 2.0 only
+
+class C { }
+
+void foo(const C c, const(char)[] s, const int* q, const (int*) p)
+{
+}
+
+void bar(in void *p)
+{
+}
+
+void f(void function() f2);
+
+class C2;
+void foo2(const C2 c);
+
+struct Foo3
+{
+   int k;
+   ~this() @trusted @disable @nogc { k = 1; }
+   this(this) { k = 2; }
+}
+
+
+class C3 { @property int get() { return 0; } }
+
+T foo3(T)() {}
+
+struct S4A(T)
+{
+   T x;
+   ~this() @safe {}
+}
+
+struct S4B(T) if (1)
+{
+   T x;
+}
+
+union U4A(T)
+{
+    T x;
+}
+
+union U4B(T) if (2*4 == 8)
+{
+   T x;
+}
+
+class C4A(T)
+{
+  T x;
+}
+
+class C4B(T) if (true) { T x; }
+
+class C4C(T) : C4A!int if (!false)
+{
+  T x;
+}
+
+class C4D(T) if (!false) : C4B!long, C4C!(int[])
+{
+    T x;
+}
+
+interface I4(T) if ((int[1]).length == 1) { T x; }
+
+// eponymous template case
+template MyClass4(T)
+    if (is(typeof(T.subtype)))
+{
+    alias HelperSymbol = T.subtype;
+    class MyClass4 {}
+}
+
+enum isInt(T) = is(T == int);
+enum bool isString(T) = is(T == string);
+static immutable typeName(T) = T.stringof;
+int storageFor(T) = 0;
+
+template templateVariableFoo(T)
+{
+    enum int templateVariableFoo = T.stringof.length;
+}
+template templateVariableBar(T) if (is(T == int))
+{
+    enum int templateVariableBar = T.stringof.length;
+}
+
+auto flit = 3 / 2.0;
+
+// 11217
+void foo11217()(    const int[] arr) {}
+void foo11217()(immutable int[] arr) {}
+void foo11217()(      ref int[] arr) {}
+void foo11217()(     lazy int[] arr) {}
+void foo11217()( auto ref int[] arr) {}
+void foo11217()(    scope int[] arr) {}
+void foo11217()(       in int[] arr) {}
+void foo11217()(    inout int[] arr) {}
+
+// 13275
+void test13275()
+{
+    if (        auto n = 1) {}
+    if (       const n = 1) {}
+    if (   immutable n = 1) {}
+    if (shared       n = 1) {}
+    if (shared const n = 1) {}
+
+    if (             int  n = 1) {}
+
+    if (       const int  n = 1) {}
+    if (   immutable int  n = 1) {}
+    if (shared       int  n = 1) {}
+    if (shared const int  n = 1) {}
+
+    if (       const(int) n = 1) {}
+    if (   immutable(int) n = 1) {}
+    if (shared      (int) n = 1) {}
+    if (shared const(int) n = 1) {}
+
+    foreach (             e; [1,2]) {}
+    foreach (       const e; [1,2]) {}
+    foreach (   immutable e; [1,2]) {}
+    foreach (shared       e; [1,2]) {}
+    foreach (shared const e; [1,2]) {}
+
+    foreach (             int e; [1,2]) {}
+    foreach (       const int e; [1,2]) {}
+    foreach (   immutable int e; [1,2]) {}
+    foreach (shared       int e; [1,2]) {}
+    foreach (shared const int e; [1,2]) {}
+
+    foreach (             int e; [1,2]) {}
+    foreach (       const(int) e; [1,2]) {}
+    foreach (   immutable(int) e; [1,2]) {}
+    foreach (shared      (int) e; [1,2]) {}
+    foreach (shared const(int) e; [1,2]) {}
+}
+// 9766
+align (1) struct S9766
+{
+align (true ? 2 : 3):
+    int var1;
+
+align:
+    int var2;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/imp9057.d b/gcc/testsuite/gdc.test/compilable/extra-files/imp9057.d
new file mode 100644
index 00000000000..54598dd7769
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/imp9057.d
@@ -0,0 +1,5 @@
+struct BugInt
+{
+    uint[] data = ZEROX;  
+}
+enum uint [] ZEROX = [0];
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/imp9057_2.d b/gcc/testsuite/gdc.test/compilable/extra-files/imp9057_2.d
new file mode 100644
index 00000000000..07061b32c97
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/imp9057_2.d
@@ -0,0 +1,5 @@
+struct BugInt
+{
+    uint[] data = [0];
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/json.out b/gcc/testsuite/gdc.test/compilable/extra-files/json.out
new file mode 100644
index 00000000000..52814fbc303
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/json.out
@@ -0,0 +1,589 @@
+[
+ {
+  "name" : "json",
+  "kind" : "module",
+  "members" : [
+   {
+    "name" : "_staticCtor1",
+    "kind" : "function",
+    "line" : 8,
+    "char" : 1,
+    "storageClass" : [
+     "static"
+    ],
+    "deco" : "FZv",
+    "endline" : 8,
+    "endchar" : 16
+   },
+   {
+    "name" : "_staticDtor2",
+    "kind" : "function",
+    "line" : 10,
+    "char" : 1,
+    "storageClass" : [
+     "static"
+    ],
+    "deco" : "FZv",
+    "endline" : 10,
+    "endchar" : 17
+   },
+   {
+    "name" : "myInt",
+    "kind" : "alias",
+    "line" : 13,
+    "char" : 11,
+    "deco" : "i"
+   },
+   {
+    "name" : "x",
+    "kind" : "variable",
+    "line" : 14,
+    "char" : 7,
+    "deco" : "i",
+    "originalType" : "myInt"
+   },
+   {
+    "kind" : "template",
+    "line" : 16,
+    "char" : 1,
+    "name" : "Foo",
+    "parameters" : [
+     {
+      "name" : "T",
+      "kind" : "type"
+     }
+    ],
+    "members" : [
+     {
+      "name" : "Foo",
+      "kind" : "struct",
+      "line" : 16,
+      "char" : 1,
+      "members" : [
+       {
+        "name" : "t",
+        "kind" : "variable",
+        "line" : 16,
+        "char" : 19,
+        "type" : "T"
+       }
+      ]
+     }
+    ]
+   },
+   {
+    "kind" : "template",
+    "line" : 17,
+    "char" : 1,
+    "name" : "Bar",
+    "parameters" : [
+     {
+      "name" : "T",
+      "kind" : "value",
+      "deco" : "i"
+     }
+    ],
+    "members" : [
+     {
+      "name" : "Bar",
+      "kind" : "class",
+      "line" : 17,
+      "char" : 1,
+      "members" : [
+       {
+        "name" : "t",
+        "kind" : "variable",
+        "line" : 17,
+        "char" : 25,
+        "deco" : "i",
+        "init" : "T"
+       }
+      ]
+     }
+    ]
+   },
+   {
+    "kind" : "template",
+    "line" : 18,
+    "char" : 1,
+    "name" : "Baz",
+    "parameters" : [
+     {
+      "name" : "T",
+      "kind" : "tuple"
+     }
+    ],
+    "members" : [
+     {
+      "name" : "Baz",
+      "kind" : "interface",
+      "line" : 18,
+      "char" : 1,
+      "members" : [
+       {
+        "name" : "t",
+        "kind" : "function",
+        "line" : 18,
+        "char" : 28,
+        "type" : "const T[0]()"
+       }
+      ]
+     }
+    ]
+   },
+   {
+    "kind" : "template",
+    "line" : 20,
+    "char" : 1,
+    "name" : "P",
+    "parameters" : [
+     {
+      "name" : "T",
+      "kind" : "alias"
+     }
+    ],
+    "members" : []
+   },
+   {
+    "name" : "Bar2",
+    "kind" : "class",
+    "line" : 22,
+    "char" : 1,
+    "base" : "json.Bar!1.Bar",
+    "interfaces" : [
+     "json.Baz!(int, 2, null).Baz"
+    ],
+    "members" : [
+     {
+      "name" : "this",
+      "kind" : "constructor",
+      "line" : 23,
+      "char" : 5,
+      "deco" : "FZC4json4Bar2",
+      "originalType" : "()",
+      "endline" : 23,
+      "endchar" : 13
+     },
+     {
+      "name" : "~this",
+      "kind" : "destructor",
+      "line" : 24,
+      "char" : 5,
+      "deco" : "FZv",
+      "endline" : 24,
+      "endchar" : 14
+     },
+     {
+      "name" : "foo",
+      "kind" : "function",
+      "line" : 26,
+      "char" : 12,
+      "storageClass" : [
+       "static"
+      ],
+      "deco" : "FNaNbNiNfZv",
+      "originalType" : "()",
+      "endline" : 26,
+      "endchar" : 19
+     },
+     {
+      "name" : "baz",
+      "kind" : "function",
+      "protection" : "protected",
+      "line" : 27,
+      "char" : 32,
+      "storageClass" : [
+       "abstract"
+      ],
+      "deco" : "FZS4json10__T3FooTiZ3Foo"
+     },
+     {
+      "name" : "t",
+      "kind" : "function",
+      "line" : 28,
+      "char" : 18,
+      "storageClass" : [
+       "override"
+      ],
+      "deco" : "xFZi",
+      "endline" : 28,
+      "endchar" : 40,
+      "overrides" : [
+       "json.Baz!(int, 2, null).Baz.t"
+      ]
+     },
+     {
+      "name" : "__xdtor",
+      "kind" : "alias"
+     }
+    ]
+   },
+   {
+    "name" : "Bar3",
+    "kind" : "class",
+    "line" : 31,
+    "char" : 1,
+    "base" : "json.Bar2",
+    "members" : [
+     {
+      "name" : "val",
+      "kind" : "variable",
+      "protection" : "private",
+      "line" : 32,
+      "char" : 14,
+      "deco" : "i",
+     },
+     {
+      "name" : "this",
+      "kind" : "constructor",
+      "line" : 33,
+      "char" : 5,
+      "deco" : "FiZC4json4Bar3",
+      "originalType" : "(int i)",
+      "parameters" : [
+       {
+        "name" : "i",
+        "deco" : "i"
+       }
+      ],
+      "endline" : 33,
+      "endchar" : 28
+     },
+     {
+      "name" : "baz",
+      "kind" : "function",
+      "protection" : "protected",
+      "line" : 35,
+      "char" : 32,
+      "storageClass" : [
+       "override"
+      ],
+      "deco" : "FZS4json10__T3FooTiZ3Foo",
+      "endline" : 35,
+      "endchar" : 61,
+      "overrides" : [
+       "json.Bar2.baz"
+      ]
+     }
+    ]
+   },
+   {
+    "name" : "Foo2",
+    "kind" : "struct",
+    "line" : 38,
+    "char" : 1,
+    "members" : [
+     {
+      "name" : "bar2",
+      "kind" : "variable",
+      "line" : 39,
+      "char" : 7,
+      "deco" : "C4json4Bar2",
+      "originalType" : "Bar2",
+     },
+     {
+      "name" : "U",
+      "kind" : "union",
+      "line" : 40,
+      "char" : 2,
+      "members" : [
+       {
+        "name" : "s",
+        "kind" : "variable",
+        "line" : 42,
+        "char" : 10,
+        "deco" : "s",
+       },
+       {
+        "name" : "i",
+        "kind" : "variable",
+        "line" : 43,
+        "char" : 8,
+        "deco" : "i",
+       },
+       {
+        "name" : "o",
+        "kind" : "variable",
+        "line" : 45,
+        "char" : 10,
+        "deco" : "C6Object",
+        "originalType" : "Object",
+       }
+      ]
+     }
+    ]
+   },
+   {
+    "name" : "bar",
+    "kind" : "function",
+    "line" : 52,
+    "char" : 16,
+    "deco" : "FNeKkC4json4Bar2Zi",
+    "originalType" : "@trusted myInt(ref uint blah, Bar2 foo = new Bar3(7))",
+    "parameters" : [
+     {
+      "name" : "blah",
+      "deco" : "k",
+      "storageClass" : [
+       "ref"
+      ]
+     },
+     {
+      "name" : "foo",
+      "deco" : "C4json4Bar2",
+      "default" : "new Bar3(7)"
+     }
+    ],
+    "endline" : 55,
+    "endchar" : 1
+   },
+   {
+    "name" : "outer",
+    "kind" : "function",
+    "line" : 57,
+    "char" : 15,
+    "deco" : "FNbNdZi",
+    "endline" : 74,
+    "endchar" : 1
+   },
+   {
+    "name" : "imports.jsonimport1",
+    "kind" : "import",
+    "line" : 77,
+    "char" : 8,
+    "protection" : "private",
+    "selective" : [
+     "target1",
+     "target2"
+    ]
+   },
+   {
+    "name" : "imports.jsonimport2",
+    "kind" : "import",
+    "line" : 78,
+    "char" : 8,
+    "protection" : "private",
+    "renamed" : {
+     "alias1" : "target1",
+     "alias2" : "target2"
+    }
+   },
+   {
+    "name" : "imports.jsonimport3",
+    "kind" : "import",
+    "line" : 79,
+    "char" : 8,
+    "protection" : "private",
+    "renamed" : {
+     "alias3" : "target1",
+     "alias4" : "target2"
+    },
+    "selective" : [
+     "target3"
+    ]
+   },
+   {
+    "name" : "imports.jsonimport4",
+    "kind" : "import",
+    "line" : 80,
+    "char" : 8,
+    "protection" : "private"
+   },
+   {
+    "name" : "S",
+    "kind" : "struct",
+    "line" : 82,
+    "char" : 1,
+    "members" : [
+     {
+      "kind" : "template",
+      "line" : 85,
+      "char" : 5,
+      "name" : "this",
+      "parameters" : [
+       {
+        "name" : "T",
+        "kind" : "type"
+       }
+      ],
+      "members" : [
+       {
+        "name" : "this",
+        "kind" : "constructor",
+        "line" : 85,
+        "char" : 5,
+        "type" : "(T t)",
+        "parameters" : [
+         {
+          "name" : "t",
+          "type" : "T"
+         }
+        ],
+        "endline" : 85,
+        "endchar" : 20
+       }
+      ]
+     }
+    ]
+   },
+   {
+    "kind" : "template",
+    "protection" : "private",
+    "line" : 89,
+    "char" : 9,
+    "name" : "S1_9755",
+    "parameters" : [
+     {
+      "name" : "T",
+      "kind" : "type"
+     }
+    ],
+    "members" : [
+     {
+      "name" : "S1_9755",
+      "kind" : "struct",
+      "line" : 89,
+      "char" : 9,
+      "members" : []
+     }
+    ]
+   },
+   {
+    "kind" : "template",
+    "protection" : "package",
+    "line" : 90,
+    "char" : 9,
+    "name" : "S2_9755",
+    "parameters" : [
+     {
+      "name" : "T",
+      "kind" : "type"
+     }
+    ],
+    "members" : [
+     {
+      "name" : "S2_9755",
+      "kind" : "struct",
+      "line" : 90,
+      "char" : 9,
+      "members" : []
+     }
+    ]
+   },
+   {
+    "name" : "C_9755",
+    "kind" : "class",
+    "line" : 92,
+    "char" : 1,
+    "members" : [
+     {
+      "kind" : "template",
+      "protection" : "protected",
+      "line" : 94,
+      "char" : 22,
+      "name" : "CI_9755",
+      "parameters" : [
+       {
+        "name" : "T",
+        "kind" : "type"
+       }
+      ],
+      "members" : [
+       {
+        "name" : "CI_9755",
+        "kind" : "class",
+        "line" : 94,
+        "char" : 22,
+        "members" : []
+       }
+      ]
+     }
+    ]
+   },
+   {
+    "name" : "c_10011",
+    "kind" : "variable",
+    "line" : 98,
+    "char" : 14,
+    "storageClass" : [
+     "const"
+    ],
+    "deco" : "xC6Object",
+    "originalType" : "Object",
+    "init" : "Object()"
+   },
+   {
+    "name" : "Numbers",
+    "kind" : "enum",
+    "line" : 101,
+    "char" : 1,
+    "baseDeco" : "i",
+    "members" : [
+     {
+      "name" : "unspecified1",
+      "kind" : "enum member",
+      "value" : "0",
+      "line" : 103,
+      "char" : 5
+     },
+     {
+      "name" : "one",
+      "kind" : "enum member",
+      "value" : "2",
+      "line" : 104,
+      "char" : 5
+     },
+     {
+      "name" : "two",
+      "kind" : "enum member",
+      "value" : "3",
+      "line" : 105,
+      "char" : 5
+     },
+     {
+      "name" : "FILE_NOT_FOUND",
+      "kind" : "enum member",
+      "value" : "101",
+      "line" : 106,
+      "char" : 5
+     },
+     {
+      "name" : "unspecified3",
+      "kind" : "enum member",
+      "value" : "102",
+      "line" : 107,
+      "char" : 5
+     },
+     {
+      "name" : "unspecified4",
+      "kind" : "enum member",
+      "value" : "103",
+      "line" : 108,
+      "char" : 5
+     },
+     {
+      "name" : "four",
+      "kind" : "enum member",
+      "value" : "4",
+      "line" : 109,
+      "char" : 5
+     }
+    ]
+   },
+   {
+    "kind" : "template",
+    "line" : 112,
+    "char" : 1,
+    "name" : "IncludeConstraint",
+    "parameters" : [
+     {
+      "name" : "T",
+      "kind" : "type"
+     }
+    ],
+    "constraint" : "T == string",
+    "members" : []
+   }
+  ]
+ }
+]
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37/datetime/common.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37/datetime/common.d
new file mode 100644
index 00000000000..5a402abe482
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37/datetime/common.d
@@ -0,0 +1,3 @@
+module pkgDIP37.datetime.common;
+
+void def();
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37/datetime/package.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37/datetime/package.d
new file mode 100644
index 00000000000..93b007b69fc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37/datetime/package.d
@@ -0,0 +1,3 @@
+module pkgDIP37.datetime;
+public import pkgDIP37.datetime.common;
+//alias std.datetime.common.def def;
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/liba.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/liba.d
new file mode 100644
index 00000000000..221aaff854e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/liba.d
@@ -0,0 +1,2 @@
+module pkgDIP37_10302.liba;
+void foo() {}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/libb.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/libb.d
new file mode 100644
index 00000000000..f4ef4dee48b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/libb.d
@@ -0,0 +1,11 @@
+module pkgDIP37_10302.libb;
+import pkgDIP37_10302.liba;
+void bar()
+{
+    foo();
+
+    // should be error, but unfortunately this works by bug 314 now.
+    //lib.foo();
+
+    pkgDIP37_10302.liba.foo();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/package.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/package.d
new file mode 100644
index 00000000000..820dc377dfb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/package.d
@@ -0,0 +1,2 @@
+module pkgDIP37_10302;
+public import pkgDIP37_10302.liba;
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/mbar.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/mbar.d
new file mode 100644
index 00000000000..8fced25afba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/mbar.d
@@ -0,0 +1,2 @@
+module pkgDIP37_10354.mbar;
+void bar(T)() {}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/mfoo.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/mfoo.d
new file mode 100644
index 00000000000..7cd7c8bc250
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/mfoo.d
@@ -0,0 +1,2 @@
+module pkgDIP37_10354.mfoo;
+void foo(T)() {}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/package.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/package.d
new file mode 100644
index 00000000000..9852eddba31
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/package.d
@@ -0,0 +1,3 @@
+module pkgDIP37_10354;
+public import pkgDIP37_10354.mfoo;
+public import pkgDIP37_10354.mbar;
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/algo/mod.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/algo/mod.d
new file mode 100644
index 00000000000..b149e8833e1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/algo/mod.d
@@ -0,0 +1,8 @@
+module pkgDIP37_10421.algo.mod;
+import pkgDIP37_10421.algo;     // foo
+import pkgDIP37_10421.except;   // baz
+void test()
+{
+    foo();  // should be accessible
+    baz();  // should be accessible
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/algo/package.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/algo/package.d
new file mode 100644
index 00000000000..3f51a64ce00
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/algo/package.d
@@ -0,0 +1,7 @@
+module pkgDIP37_10421.algo;
+public import pkgDIP37_10421.algo.mod;
+package
+{
+    void foo() {}
+    void bar() { foo(); }   // should be accessible
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/except.d b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/except.d
new file mode 100644
index 00000000000..e69a2239e5d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/except.d
@@ -0,0 +1,3 @@
+module pkgDIP37_10421.except;
+
+package void baz() {}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d b/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d
new file mode 100644
index 00000000000..9ade3170ee2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d
@@ -0,0 +1,8 @@
+class Controller {
+    mixin template register(T : Controller) {
+        enum _s_pkg = __traits(parent, __traits(parent, __traits(parent, T))).stringof["package ".length .. $];
+
+        enum _s_model = T.stringof[0 .. $-`Controller`.length] ~ `Model`;
+        mixin(q{enum _ = is(} ~ _s_pkg ~ q{.models.} ~ _s_model ~ q{.} ~ _s_model ~ q{ : serenity7190.core.Model.Model);});
+    }
+}
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Model.d b/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Model.d
new file mode 100644
index 00000000000..c75f9edd59a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Model.d
@@ -0,0 +1,5 @@
+class SqlitePersister(T) {
+    static assert(T.tupleof.length > 0, T.stringof ~ `(` ~ (T.tupleof.length + '0') ~ `): ` ~ T.tupleof.stringof);
+}
+
+class Model {}
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test14894a.d b/gcc/testsuite/gdc.test/compilable/extra-files/test14894a.d
new file mode 100644
index 00000000000..60d2017fead
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test14894a.d
@@ -0,0 +1,15 @@
+module imports.test14894a;
+
+mixin template Protocol()
+{
+    void onReceive() {}
+}
+
+struct Foo
+{
+    mixin Protocol!();
+
+    unittest
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test14894main.d b/gcc/testsuite/gdc.test/compilable/extra-files/test14894main.d
new file mode 100644
index 00000000000..2248aab7fa3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test14894main.d
@@ -0,0 +1,7 @@
+import test14894a;
+
+void main()
+{
+    Foo foo;
+    foo.onReceive();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test16080b.d b/gcc/testsuite/gdc.test/compilable/extra-files/test16080b.d
new file mode 100644
index 00000000000..9cd9fc8d5c7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test16080b.d
@@ -0,0 +1,6 @@
+import imp16080;
+
+void test2() {
+	A!() v = A!().a;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test6461/a.d b/gcc/testsuite/gdc.test/compilable/extra-files/test6461/a.d
new file mode 100644
index 00000000000..4880512ea3f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test6461/a.d
@@ -0,0 +1,4 @@
+module a;
+import tmpl;
+TypeInfo fun() { return typeid(Tmpl!int()); }
+
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test6461/b.d b/gcc/testsuite/gdc.test/compilable/extra-files/test6461/b.d
new file mode 100644
index 00000000000..c5c72d1edcc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test6461/b.d
@@ -0,0 +1,4 @@
+module b;
+import tmpl;
+TypeInfo fun() { return typeid(Tmpl!long()); }
+
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test6461/main.d b/gcc/testsuite/gdc.test/compilable/extra-files/test6461/main.d
new file mode 100644
index 00000000000..f74e7094e07
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test6461/main.d
@@ -0,0 +1,6 @@
+import a, b;
+void main() {
+  auto t1 = a.fun();
+  auto t2 = b.fun();
+  assert(t1 != t2);
+}
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test6461/tmpl.d b/gcc/testsuite/gdc.test/compilable/extra-files/test6461/tmpl.d
new file mode 100644
index 00000000000..89d48a8981e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test6461/tmpl.d
@@ -0,0 +1,4 @@
+module tmpl;
+struct Tmpl(T) {
+  T a;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test9680dllmain.d b/gcc/testsuite/gdc.test/compilable/extra-files/test9680dllmain.d
new file mode 100644
index 00000000000..bd388fafa94
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test9680dllmain.d
@@ -0,0 +1,6 @@
+import core.sys.windows.windows;
+extern (Windows)
+BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
+{
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test9680main.d b/gcc/testsuite/gdc.test/compilable/extra-files/test9680main.d
new file mode 100644
index 00000000000..fe08d98e404
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test9680main.d
@@ -0,0 +1 @@
+void main() { }
diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test9680winmain.d b/gcc/testsuite/gdc.test/compilable/extra-files/test9680winmain.d
new file mode 100644
index 00000000000..b92eefa28d0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/extra-files/test9680winmain.d
@@ -0,0 +1,6 @@
+import core.sys.windows.windows;
+extern(Windows)
+int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
+{
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/fail260.d b/gcc/testsuite/gdc.test/compilable/fail260.d
new file mode 100644
index 00000000000..96f4d1bdfa8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/fail260.d
@@ -0,0 +1,37 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -d
+
+struct Static(uint width2, uint height2)
+{
+    immutable width = width2;
+    immutable height = height2;
+
+    static Static opCall()
+    {
+        Static ret;
+        return ret;
+    }
+
+    alias float E;
+
+    template MultReturn(alias M1, alias M2)
+    {
+        alias Static!(M2.width, M1.height) MultReturn;
+    }
+
+    void opMultVectors(M2)(M2 b)
+    {
+        alias MultReturn!(Static, M2) ret_matrix;
+    }
+}
+
+void test()
+{
+    alias Static!(4, 1) matrix_stat;
+    static matrix_stat m4 = matrix_stat();
+
+    alias Static!(1, 4) matrix_stat2;
+    static m6 = matrix_stat2();
+
+    m6.opMultVectors(m4);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/fix17123.d b/gcc/testsuite/gdc.test/compilable/fix17123.d
new file mode 100644
index 00000000000..f6a38bca64c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/fix17123.d
@@ -0,0 +1,14 @@
+/*
+PERMUTE_ARGS:
+
+https://issues.dlang.org/show_bug.cgi?id=17123
+ */
+
+void test()
+{
+    char[256] buffer;
+
+    char[] delegate() read = () {
+        return buffer[];
+    };
+}
diff --git a/gcc/testsuite/gdc.test/compilable/fix17349.d b/gcc/testsuite/gdc.test/compilable/fix17349.d
new file mode 100644
index 00000000000..2222c355927
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/fix17349.d
@@ -0,0 +1,40 @@
+/* REQUIRED_ARGS: -dw
+ * PERMUTE_ARGS:
+ * TEST_OUTPUT:
+---
+compilable/fix17349.d(37): Deprecation: cannot implicitly override base class method `fix17349.E.foo` with `fix17349.F.foo`; add `override` attribute
+---
+ */
+
+// https://issues.dlang.org/show_bug.cgi?id=17349
+
+struct S { }
+
+class C {
+    void bar();
+    void foo(void* p);
+    void abc(Object);
+    void def(S);
+}
+
+class D : C {
+    override void bar() const;
+    override void foo(const void*);
+    override void abc(const Object);
+    override void def(const S);
+}
+
+alias fp_t = void function(int*);
+@safe void abc(const int*);
+fp_t fp = &abc;
+
+
+class E {
+    void foo(void*);
+}
+
+class F : E {
+    void foo(const void*);
+}
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/forward1.d b/gcc/testsuite/gdc.test/compilable/forward1.d
new file mode 100644
index 00000000000..7417b037bed
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/forward1.d
@@ -0,0 +1,7 @@
+// REQUIRED_ARGS: -g
+
+// 104. fails only with -g
+
+Foofunc f;
+alias int Foo;
+alias int function(Foo) Foofunc;
diff --git a/gcc/testsuite/gdc.test/compilable/iasm_labeloperand.d b/gcc/testsuite/gdc.test/compilable/iasm_labeloperand.d
new file mode 100644
index 00000000000..f88fd16511a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/iasm_labeloperand.d
@@ -0,0 +1,48 @@
+
+version (D_InlineAsm_X86)
+    version = TestInlineAsm;
+else version (D_InlineAsm_X86_64)
+    version = TestInlineAsm;
+else version (GNU)
+    version = TestInlineAsm;
+else
+    pragma(msg, "Inline asm not supported, not testing.");
+
+version (TestInlineAsm)
+{
+    void testInlineAsm()
+    {
+        version (GNU)
+        {
+        L1:
+            asm { ""; }
+            asm { "" : : : : L1, L2; }
+        L2:
+            asm { ""; }
+        }
+        else
+        {
+            asm
+            {
+		L1:
+			nop;
+			nop;
+			nop;
+			nop;
+			
+			mov EAX, dword ptr L1; // Check back references
+			mov EAX, dword ptr L2; // Check forward references
+			mov EAX, dword ptr DS:L1; // Not really useful in standard use, but who knows.
+			mov EAX, dword ptr FS:L2; // Once again, not really useful, but it is valid.
+			mov EAX, dword ptr CS:L1; // This is what the first test case should implicitly be.
+			
+		L2:
+			nop;
+			nop;
+			nop;
+			nop;
+			
+            }
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice10040.d b/gcc/testsuite/gdc.test/compilable/ice10040.d
new file mode 100644
index 00000000000..e93ea08360f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice10040.d
@@ -0,0 +1,15 @@
+struct MsgProc1 { mixin MsgMixin; }
+struct MsgProc2 { mixin MsgMixin; }
+
+struct MsgHeader {}
+
+template MsgMixin()
+{
+    mixin(mixinMembers!(MsgHeader.init));
+}
+
+string mixinMembers(T ...)()
+{
+    struct Op {}
+    return null;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice10431a.d b/gcc/testsuite/gdc.test/compilable/ice10431a.d
new file mode 100644
index 00000000000..593287ca74b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice10431a.d
@@ -0,0 +1,19 @@
+mixin ADT!();
+
+struct Tuple(TL...) { TL expand; }
+
+template Seq(T...) { alias T Seq; }
+
+template ADT()
+{
+    mixin(q{
+        struct ListI
+        {
+            private
+            {
+                size_t tag;
+                union { Seq!(Tuple!()*, Tuple!(int,ListI,)*,) data; }
+            }
+        }
+    });
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice10431b.d b/gcc/testsuite/gdc.test/compilable/ice10431b.d
new file mode 100644
index 00000000000..8dfdddc0a56
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice10431b.d
@@ -0,0 +1,11 @@
+struct X(alias Y)
+{
+}
+
+struct A
+{
+    int[] data;
+}
+
+alias X!(A([])) X1;
+alias X!(A([])) X2;
diff --git a/gcc/testsuite/gdc.test/compilable/ice10486.d b/gcc/testsuite/gdc.test/compilable/ice10486.d
new file mode 100644
index 00000000000..962a1304f05
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice10486.d
@@ -0,0 +1,5 @@
+void main()
+{
+    typeof(null) null_;
+    int[1] sarr = null_;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice10598.d b/gcc/testsuite/gdc.test/compilable/ice10598.d
new file mode 100644
index 00000000000..58a7c3be5f5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice10598.d
@@ -0,0 +1,3 @@
+// EXTRA_SOURCES: imports/ice10598a.d imports/ice10598b.d
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/ice11054.d b/gcc/testsuite/gdc.test/compilable/ice11054.d
new file mode 100644
index 00000000000..1b8c63bdc1a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice11054.d
@@ -0,0 +1,8 @@
+import imports.ice11054a;
+
+static assert(!__traits(compiles, tuple()));
+
+E[] appender(A : E, E)()
+{
+    return E;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice11300.d b/gcc/testsuite/gdc.test/compilable/ice11300.d
new file mode 100644
index 00000000000..473a1c2cba3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice11300.d
@@ -0,0 +1,5 @@
+// PERMUTE_ARGS:
+
+module ice11300;
+import imports.ice11300a;
+enum value = 42;
diff --git a/gcc/testsuite/gdc.test/compilable/ice11596.d b/gcc/testsuite/gdc.test/compilable/ice11596.d
new file mode 100644
index 00000000000..2b1600d2728
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice11596.d
@@ -0,0 +1,17 @@
+// PERMUTE_ARGS: -inline -release -g -O -version=X
+
+version(X)
+    alias M = real;
+else
+    alias M = int[2]; /* or other T[n] with n != 1 */
+
+struct S { M m; }
+
+S f() { assert(false); }
+
+class C
+{
+    S[1] ss; /* Here, size doesn't matter. */
+
+    this() { ss[] = f(); }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice11610.d b/gcc/testsuite/gdc.test/compilable/ice11610.d
new file mode 100644
index 00000000000..fb22cdb82c2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice11610.d
@@ -0,0 +1,79 @@
+
+struct Token
+{
+    TokenType type;
+}
+
+enum TokenType : ushort
+{
+    invalid
+}
+
+class Parser
+{
+    bool peekIsOneOf(TokenType[] types...)
+    {
+        canFind(types, tokens[1].type);
+        return true;
+    }
+
+    Token[] tokens;
+}
+
+/*************************************************/
+// std.algorithm
+
+R find(alias pred = "a == b", R, E)(R haystack, E needle)
+{
+    enum isIntegralNeedle = isSomeChar!E/* || isIntegral!E || isBoolean!E*/;
+
+    return haystack;
+}
+
+bool canFind(alias pred = "a == b", R, E)(R haystack, E needle)
+if (is(typeof(find!pred(haystack, needle))))        // 1st instantiate of find template with error gagging
+{
+    return find!pred(haystack, needle).length != 0; // 2nd instantiate of find template without gagging
+}
+
+/*************************************************/
+// std.traits
+
+template CharTypeOf(T)
+{
+           inout( char) idx(        inout( char) );
+           inout(wchar) idx(        inout(wchar) );
+           inout(dchar) idx(        inout(dchar) );
+    shared(inout  char) idx( shared(inout  char) );
+    shared(inout wchar) idx( shared(inout wchar) );
+    shared(inout dchar) idx( shared(inout dchar) );
+
+    static if (is(T == enum))
+    {
+        /* This line instantiates CharTypeOf!short and will make error.
+         * But, when CharTypeOf!short is re-instantiated without gagging,
+         * that's for correct error report, its 'members' does not re-created.
+         * so, members' semantic will call FuncDeclaration::overloadInsert of
+         * 'idx' functions, and will make circular linked list of
+         * FuncDeclaration::overnext. Finally, iterating it will cause
+         * infinite recursion and compiler segfault.
+         */
+        alias .CharTypeOf!(OriginalType!T) CharTypeOf;
+    }
+    else static if (is(typeof(idx(T.init)) X))
+    {
+        alias X CharTypeOf;
+    }
+    else
+        static assert(0, T.stringof~" is not a character type");
+}
+
+template isSomeChar(T)
+{
+    enum isSomeChar = is(CharTypeOf!T);
+}
+
+template OriginalType(T)
+{
+    alias OriginalType = ushort;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice11777.d b/gcc/testsuite/gdc.test/compilable/ice11777.d
new file mode 100644
index 00000000000..704f35c9b94
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice11777.d
@@ -0,0 +1,14 @@
+void f(void delegate(int)) {}
+
+class C
+{
+    int i;
+    this()
+    {
+        f((a){});
+        /* (a){} is a template lambda, so FuncExp::semantic -> TemplateDeclaration::semantic
+         * will save the scope in TemplateDeclaration::scope with fieldinit. Later push/pop
+         * of the scope for template lambda body semantics will violate the assertion in Scope::pop().
+         */
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice11906.d b/gcc/testsuite/gdc.test/compilable/ice11906.d
new file mode 100644
index 00000000000..f568701b463
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice11906.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+nothrow /*extern(Windows) */export int GetModuleHandleA(const char* lpModuleName);
+
+void main()
+{
+    /*extern(Windows) */int function(const char*) f;
+    assert(f != &GetModuleHandleA);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice11925.d b/gcc/testsuite/gdc.test/compilable/ice11925.d
new file mode 100644
index 00000000000..630af429a47
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice11925.d
@@ -0,0 +1,38 @@
+void test11925a()
+{
+    try
+    {
+        try
+        {
+            L1: {}
+        }
+        finally
+        {
+        }
+    }
+    finally
+    {
+    }
+    goto L1;
+}
+
+void test11925b()
+{
+    switch (1)
+    {
+        case 1:
+            goto L1;
+            break;
+
+        default:
+            break;
+    }
+
+    try
+    {
+        L1: { }
+    }
+    finally
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice12002.d b/gcc/testsuite/gdc.test/compilable/ice12002.d
new file mode 100644
index 00000000000..c80c9abdf8b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice12002.d
@@ -0,0 +1,24 @@
+// REQUIRED_ARGS: -inline
+// PERMUTE_ARGS:
+
+void doFormat(void delegate(dchar) putc, TypeInfo[] arguments)
+{
+    void formatArg(char fc)
+    {
+        const(char)* prefix = "";
+
+        void putstr(const char[] s)
+        {
+            //if (flags & FL0pad)
+            {
+                while (*prefix)
+                    putc(*prefix++);
+            }
+
+            foreach (dchar c; s)
+                putc(c);
+        }
+
+        putstr(null);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice12554.d b/gcc/testsuite/gdc.test/compilable/ice12554.d
new file mode 100644
index 00000000000..76452f462dc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice12554.d
@@ -0,0 +1,46 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+void main() pure
+{
+    int[] foo;
+
+    // if indirectly instantiated aggregate is struct (== MapResultS)
+    foo.map!(MapResultS, x => foo.map!(MapResultS, y => x).array);
+
+    // if indirectly instantiated aggregate is class (== MapResultC)
+    foo.map!(MapResultC, x => foo.map!(MapResultC, y => x).array);
+}
+
+T array(T)(T a)
+{
+    static int g; g = 1;    // impure operation
+    return a;
+}
+
+template map(alias MapResult, fun...)
+{
+    auto map(Range)(Range r)
+    {
+        alias AppliedReturnType(alias f) = typeof(f(r[0]));
+        static assert(!is(AppliedReturnType!fun == void));
+
+        return MapResult!(fun).init;
+    }
+}
+
+struct MapResultS(alias fun)
+{
+    @property front()
+    {
+        return fun(1);
+    }
+}
+
+class MapResultC(alias fun)
+{
+    @property front()
+    {
+        return fun(1);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice12956.d b/gcc/testsuite/gdc.test/compilable/ice12956.d
new file mode 100644
index 00000000000..69d182e4fa5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice12956.d
@@ -0,0 +1,30 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+template isCallable(T...)
+{
+    static if (is(typeof(& T[0].opCall) == delegate))
+    {
+        enum bool isCallable = true;
+    }
+    else static if (is(typeof(& T[0].opCall) V : V*) && is(V == function))
+    {
+        enum bool isCallable = true;
+    }
+    else
+        enum bool isCallable = false;
+}
+
+@property auto injectChain(Injectors...)()
+{
+    return &ChainTemplates!(Injectors);
+}
+
+template ChainTemplates(Templates...)
+{
+    alias Head = Templates[0];
+    alias Tail = Templates[1..$];
+    alias Head!(Tail) ChainTemplates;
+}
+
+static assert(!isCallable!(injectChain));
diff --git a/gcc/testsuite/gdc.test/compilable/ice13071.d b/gcc/testsuite/gdc.test/compilable/ice13071.d
new file mode 100644
index 00000000000..b180c1756fc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice13071.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+T foo(T)()
+{
+    __gshared int[] bar = [];
+    return T.init;
+}
+
+void main()
+{
+    foo!char();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice13088.d b/gcc/testsuite/gdc.test/compilable/ice13088.d
new file mode 100644
index 00000000000..326796feded
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice13088.d
@@ -0,0 +1,19 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+struct X
+{
+    void mfoo(this T)() {}
+}
+void test()
+{
+    shared const X scx;
+
+    scx.mfoo();
+}
+
+struct Vec
+{
+    int x;
+    void sc() shared const {}
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice13245.d b/gcc/testsuite/gdc.test/compilable/ice13245.d
new file mode 100644
index 00000000000..83ac0fa9eb7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice13245.d
@@ -0,0 +1,5 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+template T(alias f) {}
+static assert(!is(T!( (int x){ return invalid; } )));
diff --git a/gcc/testsuite/gdc.test/compilable/ice13323.d b/gcc/testsuite/gdc.test/compilable/ice13323.d
new file mode 100644
index 00000000000..d5d471f659b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice13323.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+struct UDA {}
+
+struct S
+{
+  @UDA:
+    import object;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice13403.d b/gcc/testsuite/gdc.test/compilable/ice13403.d
new file mode 100644
index 00000000000..bb7c4e5955e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice13403.d
@@ -0,0 +1,5 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -o-
+import imports.ice13403a;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/ice13874.d b/gcc/testsuite/gdc.test/compilable/ice13874.d
new file mode 100644
index 00000000000..9c13328982a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice13874.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+template FunctionTypeOf(func...)
+    if (func.length == 1)
+{
+    static if (is(typeof(& func[0]) Fsym : Fsym*) && is(Fsym == function) || is(typeof(& func[0]) Fsym == delegate))
+    {
+        alias Fsym FunctionTypeOf;
+    }
+    else static if (is(typeof(& func[0].opCall) Fobj == delegate))
+    {
+        alias Fobj FunctionTypeOf;
+    }
+    else
+        static assert(0);
+}
+
+enum DummyEnum;
+static assert(!is(FunctionTypeOf!DummyEnum));
diff --git a/gcc/testsuite/gdc.test/compilable/ice13886.d b/gcc/testsuite/gdc.test/compilable/ice13886.d
new file mode 100644
index 00000000000..05eebc4adc4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice13886.d
@@ -0,0 +1,14 @@
+// REQUIRED__ARGS:
+// PERMUTE_ARGS:
+
+struct Y()
+{
+    this() {}
+    ~this() { this = null; }
+    ref opAssign(S)(S) { }
+}
+
+void main()
+{
+    static if (is(typeof({ Y!(); }))) {}
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice13920.d b/gcc/testsuite/gdc.test/compilable/ice13920.d
new file mode 100644
index 00000000000..466b2e0449f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice13920.d
@@ -0,0 +1,25 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+class Foo
+{
+    void foo()
+    {
+        foreach (f; __traits(getOverloads, typeof(this), "bar"))
+        {
+            auto dg = &f;
+        }
+
+        foreach (f; __traits(getVirtualMethods, typeof(this), "bar"))
+        {
+            auto dg = &f;
+        }
+
+        foreach (f; __traits(getVirtualFunctions, typeof(this), "bar"))
+        {
+            auto dg = &f;
+        }
+    }
+
+    uint bar() { return 0; }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice13968.d b/gcc/testsuite/gdc.test/compilable/ice13968.d
new file mode 100644
index 00000000000..92f19c217fb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice13968.d
@@ -0,0 +1,18 @@
+// REQUIRED_ARGS:
+// PERMUTE_ARGS:
+
+union U
+{
+    bool a;
+    long b;
+}
+
+U test1()
+{
+    return U();
+}
+
+U* test2()
+{
+    return new U();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice14075.d b/gcc/testsuite/gdc.test/compilable/ice14075.d
new file mode 100644
index 00000000000..5dcfea4fe11
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice14075.d
@@ -0,0 +1,15 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+struct Foo
+{
+    auto opAssign(this X)(ref typeof(this));
+    auto opAssign(this X, V)(ref V) if (!is(V == typeof(this)));
+}
+
+void test()
+{
+    Foo src;
+    const(Foo) target;
+    static if (is(typeof(target = src))) {}
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice1524.d b/gcc/testsuite/gdc.test/compilable/ice1524.d
new file mode 100644
index 00000000000..ffcf81bcbc3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice1524.d
@@ -0,0 +1,22 @@
+// Issue 1524 - ICE(constfold.c) on using "is" with strings in CTFE
+
+/* 1524 PATCH Assertion failure: '0' on line 863 in file 'constfold.c'
+constfold.c
+@@ -845,9 +845,9 @@
+     Loc loc = e1->loc;
+     int cmp;
+
+-    if (e1->op == TOKnull && e2->op == TOKnull)
++    if (e1->op == TOKnull || e2->op == TOKnull)
+     {
+-        cmp = 1;
++        cmp = (e1->op == TOKnull && e2->op == TOKnull) ? 1 : 0;
+     }
+     else if (e1->op == TOKsymoff && e2->op == TOKsymoff)
+     {
+*/
+bool isNull(string str)
+{
+    return str is null;
+}
+const bool test = isNull("hello!");
diff --git a/gcc/testsuite/gdc.test/compilable/ice15333.d b/gcc/testsuite/gdc.test/compilable/ice15333.d
new file mode 100644
index 00000000000..4923dfa5b9b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice15333.d
@@ -0,0 +1,14 @@
+// EXTRA_SOURCES: imports/a15333.d
+
+module ice15333;
+
+void map(alias fun)() {}
+
+struct IdentifierResolver(alias handler)
+{
+    void resolve()
+    {
+        map!((a) {});
+        handler(true);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice15789.d b/gcc/testsuite/gdc.test/compilable/ice15789.d
new file mode 100644
index 00000000000..7829ca02b32
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice15789.d
@@ -0,0 +1,30 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+struct InputRange {}
+
+auto md5OfA(T...)(T ) {}
+auto md5OfB(T...)(T ) {}
+
+template fqnSymA(alias T : X!A, alias X, A...)
+{
+    template fqnTuple(B) { enum fqnTuple = 1; }
+    enum fqnSymA = fqnTuple!A;
+}
+template fqnSymB(alias T : X!A, alias X, A...)
+{
+    template fqnTuple(B) { enum fqnTuple = 1; }
+    enum fqnSymB = fqnTuple!A;
+}
+
+void test1()    // OK <- NG
+{
+    md5OfA(InputRange());
+    auto n = fqnSymA!(md5OfA!InputRange);
+}
+
+void test2()    // OK
+{
+    auto n = fqnSymB!(md5OfB!InputRange);
+    md5OfB(InputRange());
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice15992.d b/gcc/testsuite/gdc.test/compilable/ice15992.d
new file mode 100644
index 00000000000..07bc6c9af38
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice15992.d
@@ -0,0 +1,34 @@
+// PERMUTE_ARGS:
+
+struct Appender()
+{
+    bool canExtend = false;
+}
+
+struct CustomFloat()
+{
+    union ToBinary
+    {
+        CustomFloat!() get;
+    }
+
+    void opAssign(F)(F input)
+        if (__traits(compiles, cast(real)input))
+    {
+    }
+
+    real get()()
+    {
+        Appender!() app;
+        assert(false);
+    }
+
+    T opCast(T)() { return get!(); }
+
+    alias g = get!();
+}
+
+void f()
+{
+    alias FPTypes = CustomFloat!();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice6538.d b/gcc/testsuite/gdc.test/compilable/ice6538.d
new file mode 100644
index 00000000000..12d1ed0fa91
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice6538.d
@@ -0,0 +1,43 @@
+
+
+/**************************************/
+// 6538
+
+template allSatisfy(alias F, T...) { enum bool allSatisfy = true; }
+template isIntegral(T) { enum bool isIntegral = true; }
+
+void foo(I...)(I sizes)
+if (allSatisfy!(isIntegral, sizes)) {}
+
+void test6538a()
+{
+    foo(42, 86);
+}
+
+void bar(T1, T2)(T1 t1, T2 t2)
+if (allSatisfy!(isIntegral, t1, t2)) {}
+
+void test6538b()
+{
+    bar(42, 86);
+}
+
+/**************************************/
+// 9361
+
+template Sym(alias A)
+{
+    enum Sym = true;
+}
+
+struct S
+{
+    void foo()() if (Sym!(this)) {}
+    void bar()() { static assert(Sym!(this)); }   // OK
+}
+void test9361a()
+{
+    S s;
+    s.foo();    // fail
+    s.bar();    // OK
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice8392.d b/gcc/testsuite/gdc.test/compilable/ice8392.d
new file mode 100644
index 00000000000..5a374139ea2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice8392.d
@@ -0,0 +1,12 @@
+// EXTRA_SOURCES: imports/a8392.d
+
+module ice8392;
+
+struct A
+{
+}
+
+auto fooa(alias handler)(A a)
+{
+    return handler(null);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice854.d b/gcc/testsuite/gdc.test/compilable/ice854.d
new file mode 100644
index 00000000000..3ede52eeb59
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice854.d
@@ -0,0 +1,43 @@
+// Issue 854 - TypeTuple in anonymous delegate causes ice in glue.c
+
+/* 854 VOTE PATCH (=2863, =2251?) Assertion failure: '0' on line 935 in file 'glue.c'
+I haven't checked this patch myself.
+--- dmd/func.c  2009-03-05 01:56:46.000000000 +0100
++++ dmd-fixed/func.c        2009-03-30 00:39:41.000000000 +0200
+@@ -756,6 +756,27 @@
+             }
+         }
+
++        if (f->parameters)
++        {
++            for (size_t i = 0; i < Argument::dim(f->parameters); i++)
++            {
++                Argument *arg = (Argument *)Argument::getNth(f->parameters, i);
++                Type* nw = arg->type->semantic(0, sc);
++                if (arg->type != nw) {
++                    arg->type = nw;
++                    // Examine this index again.
++                    // This is important if it turned into a tuple.
++                    // In particular, the empty tuple should be handled or the
++                    // next parameter will be skipped.
++                    // FIXME: Maybe we only need to do this for tuples,
++                    //        and can add tuple.length after decrement?
++                    i--;
++                }
++            }
++            // update nparams to include expanded tuples
++            nparams = Argument::dim(f->parameters);
++        }
++
+         // Propagate storage class from tuple parameters to their element-parameters.
+         if (f->parameters)
+         {
+*/
+template Foo(T...)
+{
+    alias T Foo;
+}
+void main()
+{
+    auto y = (Foo!(int) x){ return 0; };
+}
diff --git a/gcc/testsuite/gdc.test/compilable/ice9663.d b/gcc/testsuite/gdc.test/compilable/ice9663.d
new file mode 100644
index 00000000000..8ea26d7f9ca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/ice9663.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -wi
+
+void main()
+{
+    int[1] a;
+    int[] b = [1];
+
+    a = 1;
+
+    b[] = a;
+
+    b = a;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a12506.d b/gcc/testsuite/gdc.test/compilable/imports/a12506.d
new file mode 100644
index 00000000000..b4307c3c3c7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a12506.d
@@ -0,0 +1,3 @@
+module imports.a12506;
+
+auto f12506(alias fun)() { return fun(1); }
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a12567.d b/gcc/testsuite/gdc.test/compilable/imports/a12567.d
new file mode 100644
index 00000000000..053e3d8d7c9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a12567.d
@@ -0,0 +1,4 @@
+deprecated("This module will be removed in future release.")
+module imports.a12567;
+
+void foo() {}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a13226.d b/gcc/testsuite/gdc.test/compilable/imports/a13226.d
new file mode 100644
index 00000000000..bbe3e68fcd0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a13226.d
@@ -0,0 +1,18 @@
+module imports.a13226;
+
+enum isFunction(alias f) = is(typeof(f) == function);
+enum isIntField(alias f) = is(typeof(f) == int);
+
+string t(alias cls, string method)()
+{
+    static if (isFunction!(mixin("cls."~method)))
+    {}
+    return "";
+}
+
+string u(alias cls, string member)()
+{
+    static if (isIntField!(mixin("cls."~member)))
+    {}
+    return "";
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a14528.d b/gcc/testsuite/gdc.test/compilable/imports/a14528.d
new file mode 100644
index 00000000000..73386a35f83
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a14528.d
@@ -0,0 +1,6 @@
+module imports.a14528;
+
+void foo(alias f)()
+{
+    f();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a15333.d b/gcc/testsuite/gdc.test/compilable/imports/a15333.d
new file mode 100644
index 00000000000..6e899a32223
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a15333.d
@@ -0,0 +1,12 @@
+module imports.a15333;
+
+import ice15333;
+
+struct StatementVisitor
+{
+    void visit()
+    {
+        int location;
+        alias IR = IdentifierResolver!((e){ location = 0; });
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a15856.d b/gcc/testsuite/gdc.test/compilable/imports/a15856.d
new file mode 100644
index 00000000000..ca252138159
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a15856.d
@@ -0,0 +1,3 @@
+module imports.a15856;
+
+alias int c_long;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a313.d b/gcc/testsuite/gdc.test/compilable/imports/a313.d
new file mode 100644
index 00000000000..8519059d73e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a313.d
@@ -0,0 +1,8 @@
+module imports.a313;
+
+// adds private package imports
+private import imports.b313;
+// adds private package core
+private import core.stdc.stdio;
+// adds public alias cstdio
+public alias cstdio = core.stdc.stdio;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a313templatemixin1.d b/gcc/testsuite/gdc.test/compilable/imports/a313templatemixin1.d
new file mode 100644
index 00000000000..29c24bd8f0d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a313templatemixin1.d
@@ -0,0 +1,3 @@
+void bug()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a313templatemixin2.d b/gcc/testsuite/gdc.test/compilable/imports/a313templatemixin2.d
new file mode 100644
index 00000000000..29c24bd8f0d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a313templatemixin2.d
@@ -0,0 +1,3 @@
+void bug()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a314.d b/gcc/testsuite/gdc.test/compilable/imports/a314.d
new file mode 100644
index 00000000000..7c33ccc2285
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a314.d
@@ -0,0 +1,5 @@
+module imports.pkg.a314; // sub package
+
+package(imports) static import imports.c314;
+package(imports) import renamed = imports.c314;
+package(imports) import imports.c314 : bug;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/a8392.d b/gcc/testsuite/gdc.test/compilable/imports/a8392.d
new file mode 100644
index 00000000000..4677b50bbf2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/a8392.d
@@ -0,0 +1,15 @@
+module imports.a8392;
+
+import ice8392;
+
+class B
+{
+    this(B);
+}
+
+void foob(A a, B b)
+{
+    a.fooa!((arg){
+            return new B(b);
+    });
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/art4769a.d b/gcc/testsuite/gdc.test/compilable/imports/art4769a.d
new file mode 100644
index 00000000000..7c994e6f0eb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/art4769a.d
@@ -0,0 +1,15 @@
+module imports.art4769a;
+
+import core.stdc.stdio;
+
+template DataStreamability(T)
+{
+     const int isStreamable = true;
+     alias T footype;
+
+     void write()
+     {
+       printf("hallo\n");
+     }
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/art4769b.d b/gcc/testsuite/gdc.test/compilable/imports/art4769b.d
new file mode 100644
index 00000000000..e43b2f201e0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/art4769b.d
@@ -0,0 +1,9 @@
+private import imports.art4769a;
+private import art4769;
+
+int main(char [][] args)
+{
+   Vector!(wchar) str;
+   return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/b313.d b/gcc/testsuite/gdc.test/compilable/imports/b313.d
new file mode 100644
index 00000000000..f5775a4b487
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/b313.d
@@ -0,0 +1,7 @@
+module imports.b313;
+
+void bug()
+{
+    // scope has access to it's own module
+    imports.b313.bug();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/b33a.d b/gcc/testsuite/gdc.test/compilable/imports/b33a.d
new file mode 100644
index 00000000000..5d52c66ceec
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/b33a.d
@@ -0,0 +1,28 @@
+module imports.b33a;
+
+struct IsEqual( T )
+{
+    bool opCall( char p1, char p2 )
+    {
+	return p1 == p2;
+    }
+}    
+
+template find_( Elem, Pred = IsEqual!(Elem) )
+{    
+    size_t fn( char[] buf, Pred pred = Pred.init )
+    {
+        return 3;
+    }
+}
+
+template find()
+{
+    size_t find( char[3] buf )
+    {
+        return find_!(char).fn( buf );
+    }
+}
+
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/b3682.d b/gcc/testsuite/gdc.test/compilable/imports/b3682.d
new file mode 100644
index 00000000000..f554e12ee7e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/b3682.d
@@ -0,0 +1,5 @@
+module imports.b3682;
+
+import a3682;
+alias Tuple!(int) tint;
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/bug8922.d b/gcc/testsuite/gdc.test/compilable/imports/bug8922.d
new file mode 100644
index 00000000000..a3567ba042c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/bug8922.d
@@ -0,0 +1 @@
+module imports.bug8922;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/c314.d b/gcc/testsuite/gdc.test/compilable/imports/c314.d
new file mode 100644
index 00000000000..5c43c8608e4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/c314.d
@@ -0,0 +1,4 @@
+module imports.c314;
+
+void bug(string s)
+{}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/defaa.d b/gcc/testsuite/gdc.test/compilable/imports/defaa.d
new file mode 100644
index 00000000000..c35167c9870
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/defaa.d
@@ -0,0 +1,15 @@
+
+module imports.defaa;
+
+class Display
+{
+
+	private import imports.defab;
+
+	B lastHittestB;
+
+	this() { }
+}
+
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/defab.d b/gcc/testsuite/gdc.test/compilable/imports/defab.d
new file mode 100644
index 00000000000..84b92096ffc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/defab.d
@@ -0,0 +1,15 @@
+
+module imports.defab;
+
+private import defa;
+
+public class B : A
+{
+
+	private import imports.defad;
+
+	D parent;
+
+	this() {}
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/defac.d b/gcc/testsuite/gdc.test/compilable/imports/defac.d
new file mode 100644
index 00000000000..a8d953630a6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/defac.d
@@ -0,0 +1,13 @@
+
+module imports.defac;
+
+private import imports.defab;
+
+public abstract class C : B
+{
+	private import imports.defad;
+
+	this() {}
+
+	this(D parent, int style) {}
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/defad.d b/gcc/testsuite/gdc.test/compilable/imports/defad.d
new file mode 100644
index 00000000000..498406d302b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/defad.d
@@ -0,0 +1,14 @@
+
+module imports.defad;
+
+private import imports.defac;
+private import imports.defab;
+
+public class D : C
+{
+	B [] tabList;
+
+	this() {}
+
+	this(D parent, int style){ }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/dip22.d b/gcc/testsuite/gdc.test/compilable/imports/dip22.d
new file mode 100644
index 00000000000..381d424d9ef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/dip22.d
@@ -0,0 +1,21 @@
+module imports.dip22;
+
+interface Base1
+{
+    private ubyte bar() { return 1; }
+    private enum baz = 1;
+    private alias T = byte;
+}
+
+interface Base2
+{
+    final short bar() { return 2; }
+    enum baz = 2;
+    alias T = short;
+}
+
+private void bar() {}
+void bar(int) {}
+
+void baz(int) {}
+private void baz() {}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/f313.d b/gcc/testsuite/gdc.test/compilable/imports/f313.d
new file mode 100644
index 00000000000..570cd091251
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/f313.d
@@ -0,0 +1,6 @@
+ // different module declaration not used for access check
+module foo.bar;
+
+void bug()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/fwdref12201a.d b/gcc/testsuite/gdc.test/compilable/imports/fwdref12201a.d
new file mode 100644
index 00000000000..c5b8817885c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/fwdref12201a.d
@@ -0,0 +1 @@
+alias int FILE;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/fwdref2_test17548.d b/gcc/testsuite/gdc.test/compilable/imports/fwdref2_test17548.d
new file mode 100644
index 00000000000..91391bbd521
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/fwdref2_test17548.d
@@ -0,0 +1,9 @@
+module fwdref2_test17548;
+
+import test17548;
+
+struct S2 {
+    void bar(int arg = .test17548.cnst) {}
+    S1 s;
+    import fwdref2_test17548;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/fwdref9514.d b/gcc/testsuite/gdc.test/compilable/imports/fwdref9514.d
new file mode 100644
index 00000000000..fe1298fbfab
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/fwdref9514.d
@@ -0,0 +1,4 @@
+bool find9514(alias pred, R)(R range)
+{
+    return true;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/g313.d b/gcc/testsuite/gdc.test/compilable/imports/g313.d
new file mode 100644
index 00000000000..92e703a10a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/g313.d
@@ -0,0 +1,24 @@
+module imports.g313;
+
+// adds public package imports (see Bugzilla 15900)
+public import imports.g313public;
+// same w/ deferred semantics
+static if (true)
+    public import imports.g313staticif;
+mixin("public import imports.g313stringmixin;");
+
+template impD()
+{
+    public import imports.g313templatemixin;
+}
+
+mixin impD!();
+
+void test15900()
+{
+    // publically imported modules should obviously be available in here as well
+    imports.g313public.bug();
+    imports.g313staticif.bug();
+    imports.g313stringmixin.bug();
+    imports.g313templatemixin.bug();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/g313public.d b/gcc/testsuite/gdc.test/compilable/imports/g313public.d
new file mode 100644
index 00000000000..29c24bd8f0d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/g313public.d
@@ -0,0 +1,3 @@
+void bug()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/g313staticif.d b/gcc/testsuite/gdc.test/compilable/imports/g313staticif.d
new file mode 100644
index 00000000000..29c24bd8f0d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/g313staticif.d
@@ -0,0 +1,3 @@
+void bug()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/g313stringmixin.d b/gcc/testsuite/gdc.test/compilable/imports/g313stringmixin.d
new file mode 100644
index 00000000000..29c24bd8f0d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/g313stringmixin.d
@@ -0,0 +1,3 @@
+void bug()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/g313templatemixin.d b/gcc/testsuite/gdc.test/compilable/imports/g313templatemixin.d
new file mode 100644
index 00000000000..29c24bd8f0d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/g313templatemixin.d
@@ -0,0 +1,3 @@
+void bug()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice10598a.d b/gcc/testsuite/gdc.test/compilable/imports/ice10598a.d
new file mode 100644
index 00000000000..b0e9c3b99a3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/ice10598a.d
@@ -0,0 +1,5 @@
+module imports.ice10598a;
+
+template TypeTuple(TL...) { alias TL TypeTuple; }
+
+alias TypeTuple!(__traits(getMember, imports.ice10598b, (__traits(allMembers, imports.ice10598b)[1])))[0] notImportedType;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice10598b.d b/gcc/testsuite/gdc.test/compilable/imports/ice10598b.d
new file mode 100644
index 00000000000..de5078709fc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/ice10598b.d
@@ -0,0 +1,3 @@
+module imports.ice10598b;
+
+struct LocalType {}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice11054a.d b/gcc/testsuite/gdc.test/compilable/imports/ice11054a.d
new file mode 100644
index 00000000000..a81d3d77801
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/ice11054a.d
@@ -0,0 +1,21 @@
+template Tuple()
+{
+    string injectNamedFields()
+    {
+        formatNthX();
+        return "";
+    }
+}
+Tuple!T tuple(T...)()
+{
+}
+
+void formatNthX(A...)(A)
+{
+    static gencode(size_t count)()
+    {
+        result ~= "";   // comment out this line will remove the ICE
+        return "";
+    }
+    mixin(gencode!(A.length)());
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice11300a.d b/gcc/testsuite/gdc.test/compilable/imports/ice11300a.d
new file mode 100644
index 00000000000..0b31623655e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/ice11300a.d
@@ -0,0 +1,3 @@
+module imports.ice11300a;
+static import ice11300;
+enum value = ice11300.value;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice13403a.d b/gcc/testsuite/gdc.test/compilable/imports/ice13403a.d
new file mode 100644
index 00000000000..d30901c0e7c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/ice13403a.d
@@ -0,0 +1,7 @@
+module imports.ice13403a;
+
+package(imports):
+
+template BacktrackingMatcher()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp12242a.d b/gcc/testsuite/gdc.test/compilable/imports/imp12242a.d
new file mode 100644
index 00000000000..5e5259dc762
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp12242a.d
@@ -0,0 +1,17 @@
+module imports.imp12242a;
+
+public:
+import imports.imp12242a1;  // std.string
+import imports.imp12242a2;  // std.algorithm
+
+
+private mixin template MixTmp(T, int x)
+{
+    template foo(U) if (is(U == T))
+    {
+        enum foo = x;
+    }
+}
+
+mixin MixTmp!(int,  1);
+mixin MixTmp!(long, 2);
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp12242a1.d b/gcc/testsuite/gdc.test/compilable/imports/imp12242a1.d
new file mode 100644
index 00000000000..5c5e5233068
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp12242a1.d
@@ -0,0 +1,8 @@
+module imports.imp12242a1;
+
+// std.string.strip
+int stripA(C)(C[] str) @safe pure
+    if (is(immutable C == immutable char))
+{
+    return 1;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp12242a2.d b/gcc/testsuite/gdc.test/compilable/imports/imp12242a2.d
new file mode 100644
index 00000000000..c0d789031a5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp12242a2.d
@@ -0,0 +1,11 @@
+module imports.imp12242a2;
+
+// std.algorithm.strip
+auto stripA(R, E)(R range, E element)
+{
+    return 2;
+}
+auto stripA(alias pred, R)(R range)
+{
+    return 3;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp12242b.d b/gcc/testsuite/gdc.test/compilable/imports/imp12242b.d
new file mode 100644
index 00000000000..886104f54c9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp12242b.d
@@ -0,0 +1,17 @@
+module imports.imp12242b;
+
+public:
+import imports.imp12242b1;  // std.string
+import imports.imp12242b2;  // std.algorithm
+
+
+private mixin template MixTmp(T, int x)
+{
+    template foo(U) if (is(U == T))
+    {
+        enum foo = x;
+    }
+}
+
+mixin MixTmp!(float, 3);
+mixin MixTmp!(real,  4);
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp12242b1.d b/gcc/testsuite/gdc.test/compilable/imports/imp12242b1.d
new file mode 100644
index 00000000000..e23fdc8da2e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp12242b1.d
@@ -0,0 +1,8 @@
+module imports.imp12242b1;
+
+// std.string.strip
+int stripB(C)(C[] str) @safe pure
+    if (is(immutable C == immutable char))
+{
+    return 1;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp12242b2.d b/gcc/testsuite/gdc.test/compilable/imports/imp12242b2.d
new file mode 100644
index 00000000000..0f559988722
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp12242b2.d
@@ -0,0 +1,11 @@
+module imports.imp12242b2;
+
+// std.algorithm.strip
+auto stripB(R, E)(R range, E element)
+{
+    return 2;
+}
+auto stripB(alias pred, R)(R range)
+{
+    return 3;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp15490a.d b/gcc/testsuite/gdc.test/compilable/imports/imp15490a.d
new file mode 100644
index 00000000000..edb3b45e600
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp15490a.d
@@ -0,0 +1,8 @@
+module imports.imp15490a;
+
+import imports.imp15490b;
+
+void listenTCP()
+{
+    enum r = regex();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp15490b.d b/gcc/testsuite/gdc.test/compilable/imports/imp15490b.d
new file mode 100644
index 00000000000..3a2490c9f6c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp15490b.d
@@ -0,0 +1,12 @@
+module imports.imp15490b;
+
+int regex()
+{
+    return regexImpl();
+}
+
+auto regexImpl()
+{
+    int r = 0;
+    return r;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp15907.d b/gcc/testsuite/gdc.test/compilable/imports/imp15907.d
new file mode 100644
index 00000000000..2ffce94db1d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp15907.d
@@ -0,0 +1,23 @@
+module imports.imp15907;
+
+void process(T)(T t)
+{
+    foreach (member; __traits(allMembers, T))
+    {
+        static if (__traits(getProtection, __traits(getMember, t, member)) != "private")
+        {
+        }
+    }
+}
+
+enum allMembers(T) = [__traits(allMembers, T)];
+
+struct PublicStruct
+{
+    private struct S {}
+}
+
+private:
+
+struct PrivateStruct {}
+int privateVar;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp15925.d b/gcc/testsuite/gdc.test/compilable/imports/imp15925.d
new file mode 100644
index 00000000000..c9d537aa769
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp15925.d
@@ -0,0 +1 @@
+enum X = 1;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp16080.d b/gcc/testsuite/gdc.test/compilable/imports/imp16080.d
new file mode 100644
index 00000000000..1afd9b565c0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp16080.d
@@ -0,0 +1,4 @@
+struct A() {
+	static immutable A a;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp16085.d b/gcc/testsuite/gdc.test/compilable/imports/imp16085.d
new file mode 100644
index 00000000000..6b250ba5930
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp16085.d
@@ -0,0 +1,29 @@
+struct Pass
+{
+}
+
+struct S
+{
+    import imports.imp16085b : functionAndFunction, staticFunctionAndFunction,
+        functionAndTemplate, templateAndTemplate; //<- private
+    // public
+    Pass functionAndFunction()
+    {
+        return Pass();
+    }
+
+    static Pass staticFunctionAndFunction()
+    {
+        return Pass();
+    }
+
+    Pass functionAndTemplate()
+    {
+        return Pass();
+    }
+
+    Pass templateAndTemplate()()
+    {
+        return Pass();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp16085b.d b/gcc/testsuite/gdc.test/compilable/imports/imp16085b.d
new file mode 100644
index 00000000000..4f22740dee5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp16085b.d
@@ -0,0 +1,25 @@
+import imp16085 : S;
+
+struct Fail
+{
+}
+
+Fail functionAndFunction(ref S)
+{
+    return Fail();
+}
+
+Fail staticFunctionAndFunction(int)
+{
+    return Fail();
+}
+
+Fail functionAndTemplate(T)(T)
+{
+    return Fail();
+}
+
+Fail templateAndTemplate(T)(T)
+{
+    return Fail();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp16460.d b/gcc/testsuite/gdc.test/compilable/imports/imp16460.d
new file mode 100644
index 00000000000..f729004e9c0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp16460.d
@@ -0,0 +1,3 @@
+module imports.imp16460;
+
+package enum val = 0;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp16798.d b/gcc/testsuite/gdc.test/compilable/imports/imp16798.d
new file mode 100644
index 00000000000..8ddc9985b19
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/imp16798.d
@@ -0,0 +1,4 @@
+
+module its.a.dessert.topping;
+
+pragma(msg, "it's a dessert topping");
diff --git a/gcc/testsuite/gdc.test/compilable/imports/jsonimport1.d b/gcc/testsuite/gdc.test/compilable/imports/jsonimport1.d
new file mode 100644
index 00000000000..e989e6af030
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/jsonimport1.d
@@ -0,0 +1,3 @@
+module imports.jsonimport1;
+
+int target1, target2;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/jsonimport2.d b/gcc/testsuite/gdc.test/compilable/imports/jsonimport2.d
new file mode 100644
index 00000000000..f6e89a2945a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/jsonimport2.d
@@ -0,0 +1,3 @@
+module imports.jsonimport2;
+
+int target1, target2;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/jsonimport3.d b/gcc/testsuite/gdc.test/compilable/imports/jsonimport3.d
new file mode 100644
index 00000000000..8c8bc675dc4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/jsonimport3.d
@@ -0,0 +1,3 @@
+module imports.jsonimport3;
+
+int target1, target2, target3;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/jsonimport4.d b/gcc/testsuite/gdc.test/compilable/imports/jsonimport4.d
new file mode 100644
index 00000000000..531931faf01
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/jsonimport4.d
@@ -0,0 +1 @@
+module imports.jsonimport4;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg313/c313.d b/gcc/testsuite/gdc.test/compilable/imports/pkg313/c313.d
new file mode 100644
index 00000000000..bd2a7ae97e8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/pkg313/c313.d
@@ -0,0 +1,5 @@
+module imports.pkg313.c313;
+
+void bug()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkgmod313/mod.d b/gcc/testsuite/gdc.test/compilable/imports/pkgmod313/mod.d
new file mode 100644
index 00000000000..2612892ffae
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/pkgmod313/mod.d
@@ -0,0 +1,3 @@
+module imports.pkgmod313.mod;
+
+void bar() {}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkgmod313/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkgmod313/package.d
new file mode 100644
index 00000000000..41022629978
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/pkgmod313/package.d
@@ -0,0 +1,5 @@
+module imports.pkgmod313;
+
+public import imports.pkgmod313.mod;
+
+void foo() {}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/protectionimp.d b/gcc/testsuite/gdc.test/compilable/imports/protectionimp.d
new file mode 100644
index 00000000000..6c99cf325d9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/protectionimp.d
@@ -0,0 +1,30 @@
+private
+{
+    void privF() {}
+    class privC {}
+    struct privS {}
+    union privU {}
+    interface privI {}
+    enum privE { foo }
+    mixin template privMT() {}
+
+    void privTF(T)() {}
+    class privTC(T) {}
+    struct privTS(T) {}
+    union privTU(T) {}
+    interface privTI(T) {}
+}
+
+void publF(T)() {}
+void publFA(alias A)() {}
+private alias privC privA;
+
+public mixin template publMT() {}
+
+/***************************************************/
+// 14169
+
+template GetName14169(TemplateParam)
+{
+    enum GetName14169 = TemplateParam.Name;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/stdio4003.d b/gcc/testsuite/gdc.test/compilable/imports/stdio4003.d
new file mode 100644
index 00000000000..f37b70e4d78
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/stdio4003.d
@@ -0,0 +1,3 @@
+module imports.stdio4003;
+
+import imports.typecons4003;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test10375a.d b/gcc/testsuite/gdc.test/compilable/imports/test10375a.d
new file mode 100644
index 00000000000..36d84c05013
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test10375a.d
@@ -0,0 +1,6 @@
+module imports.test10375a;
+
+private template Pack(T...)
+{
+    alias T tuple;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test10752.d b/gcc/testsuite/gdc.test/compilable/imports/test10752.d
new file mode 100644
index 00000000000..42bff3aae68
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test10752.d
@@ -0,0 +1,2 @@
+module imports.test10752;
+private int priv;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test11225b.d b/gcc/testsuite/gdc.test/compilable/imports/test11225b.d
new file mode 100644
index 00000000000..8d5d1e23eaa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test11225b.d
@@ -0,0 +1,13 @@
+module imports.test11225b;
+import test11225a;
+
+interface J : I {} // remove this line to make it work
+
+static assert(is(typeof({ import imports.test11225c; }))); // OK
+pragma(msg, B!().result); // just instantiates the template
+
+template B()
+{
+    static assert(is(typeof({ import imports.test11225c; }))); // FAILS
+    enum result = "WORKS";
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test11225c.d b/gcc/testsuite/gdc.test/compilable/imports/test11225c.d
new file mode 100644
index 00000000000..22e814b9bbf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test11225c.d
@@ -0,0 +1,2 @@
+module imports.test11225c;
+// empty
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test11563core_bitop.d b/gcc/testsuite/gdc.test/compilable/imports/test11563core_bitop.d
new file mode 100644
index 00000000000..c808d164b2e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test11563core_bitop.d
@@ -0,0 +1 @@
+module test11563core_bitop;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test11563std_array.d b/gcc/testsuite/gdc.test/compilable/imports/test11563std_array.d
new file mode 100644
index 00000000000..6dc0af69701
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test11563std_array.d
@@ -0,0 +1,6 @@
+module imports.test11563std_array;
+
+void popFront(S)(ref S str)// @trusted pure nothrow
+{
+    import imports.test11563core_bitop;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test11563std_range.d b/gcc/testsuite/gdc.test/compilable/imports/test11563std_range.d
new file mode 100644
index 00000000000..f71289a7be0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test11563std_range.d
@@ -0,0 +1,12 @@
+module imports.test11563std_range;
+
+public import imports.test11563std_array;
+
+template isInputRange(R)
+{
+    enum bool isInputRange = is(typeof(
+    {
+        R r = void;
+        r.popFront();
+    }));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test11563std_traits.d b/gcc/testsuite/gdc.test/compilable/imports/test11563std_traits.d
new file mode 100644
index 00000000000..983fd11be4f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test11563std_traits.d
@@ -0,0 +1,22 @@
+module imports.test11563std_traits;
+
+import imports.test11563std_range;
+
+bool startsWith(R1, R2)(R1 doesThisStart, R2 withThis)
+if (isInputRange!R1)
+{
+    return true;
+}
+
+template moduleName(alias T)
+{
+    static if (T.stringof.startsWith("module "))
+    {
+        enum moduleName = "b";
+    }
+    else
+    {
+        pragma(msg, "--error--");
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test1238a.d b/gcc/testsuite/gdc.test/compilable/imports/test1238a.d
new file mode 100644
index 00000000000..58bfd2d590c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test1238a.d
@@ -0,0 +1,3 @@
+module imports.test1238a;
+
+private int zuiop;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test1238b.d b/gcc/testsuite/gdc.test/compilable/imports/test1238b.d
new file mode 100644
index 00000000000..30f1a2faa4e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test1238b.d
@@ -0,0 +1,3 @@
+module imports.test1238b;
+
+public int zuiop;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test13242a.d b/gcc/testsuite/gdc.test/compilable/imports/test13242a.d
new file mode 100644
index 00000000000..941c9941b1b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test13242a.d
@@ -0,0 +1,19 @@
+module imports.test13242a;
+
+template expensiveArgs(alias v)
+{
+    pragma(msg, "a.expensiveArgs: ", v);
+}
+
+template expensiveTemplate(Args...)
+{
+    pragma(msg, "a.expensiveTemplate: ", Args[0]);
+}
+
+alias apiSym1 = expensiveTemplate!(1, expensiveArgs!(1));
+
+alias apiSym2 = expensiveTemplate!(2, expensiveArgs!(2));
+
+public import imports.test13242b : apiSym3;
+
+void cheapFunc() {}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test13242b.d b/gcc/testsuite/gdc.test/compilable/imports/test13242b.d
new file mode 100644
index 00000000000..fab8d686726
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test13242b.d
@@ -0,0 +1,13 @@
+module imports.test13242b;
+
+template expensiveArgs(alias v)
+{
+    pragma(msg, "b.expensiveArgs: ", v);
+}
+
+template expensiveTemplate(Args...)
+{
+    pragma(msg, "b.expensiveTemplate: ", Args[0]);
+}
+
+alias apiSym3 = expensiveTemplate!(3, expensiveArgs!(3));
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test14666a.d b/gcc/testsuite/gdc.test/compilable/imports/test14666a.d
new file mode 100644
index 00000000000..ee6c4248b71
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test14666a.d
@@ -0,0 +1,9 @@
+module imports.test14666a;
+
+auto getNames()
+{
+    import imports.test14666b;
+    return "";
+}
+
+enum Names = getNames;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test14666b.d b/gcc/testsuite/gdc.test/compilable/imports/test14666b.d
new file mode 100644
index 00000000000..edfa970c74b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test14666b.d
@@ -0,0 +1,8 @@
+module imports.test14666b;
+
+import test14666;
+
+struct Token
+{
+    Location location;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test15117a.d b/gcc/testsuite/gdc.test/compilable/imports/test15117a.d
new file mode 100644
index 00000000000..9daf6f187d4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test15117a.d
@@ -0,0 +1,9 @@
+module imports.test15117a;
+
+struct AssertResult {}
+
+auto test_usr_1()
+{
+    // 2. generate TyepInfoStructDeclaration
+    auto x = typeid(AssertResult);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test15150a.d b/gcc/testsuite/gdc.test/compilable/imports/test15150a.d
new file mode 100644
index 00000000000..fe3b8ab06be
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test15150a.d
@@ -0,0 +1,6 @@
+module imports.test15150a;
+
+enum
+{
+    x
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test15150b.d b/gcc/testsuite/gdc.test/compilable/imports/test15150b.d
new file mode 100644
index 00000000000..24b0928cc79
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test15150b.d
@@ -0,0 +1,3 @@
+module imports.test15150b;
+
+import imports.test15150a : x;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test15785.d b/gcc/testsuite/gdc.test/compilable/imports/test15785.d
new file mode 100644
index 00000000000..b596f9b5382
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test15785.d
@@ -0,0 +1,13 @@
+module imports.test15785;
+
+interface IBase2
+{
+    final protected void faz() {}
+}
+
+class Base
+{
+    protected void foo() {}
+    protected void bar() {}
+    protected alias T = int;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test15857a.d b/gcc/testsuite/gdc.test/compilable/imports/test15857a.d
new file mode 100644
index 00000000000..9362e06143e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test15857a.d
@@ -0,0 +1,2 @@
+public import imports.test15857b;
+public import imports.test15857c;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test15857b.d b/gcc/testsuite/gdc.test/compilable/imports/test15857b.d
new file mode 100644
index 00000000000..511ef9f9a77
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test15857b.d
@@ -0,0 +1 @@
+void bar15857(int) {}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test15857c.d b/gcc/testsuite/gdc.test/compilable/imports/test15857c.d
new file mode 100644
index 00000000000..8652d8ea26d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test15857c.d
@@ -0,0 +1 @@
+void bar15857(string) {}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test16348.d b/gcc/testsuite/gdc.test/compilable/imports/test16348.d
new file mode 100644
index 00000000000..c9f871cc43a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test16348.d
@@ -0,0 +1,6 @@
+module mypackage.bar;
+
+package bool bar()
+{
+    return false;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test1754a.d b/gcc/testsuite/gdc.test/compilable/imports/test1754a.d
new file mode 100644
index 00000000000..08fc0dd158c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test1754a.d
@@ -0,0 +1,5 @@
+module imports.test1754a;
+
+private void bar()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test1754b.d b/gcc/testsuite/gdc.test/compilable/imports/test1754b.d
new file mode 100644
index 00000000000..e8e8f3c55b9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test1754b.d
@@ -0,0 +1,5 @@
+module imports.test1754b;
+
+void bar()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test1imp.d b/gcc/testsuite/gdc.test/compilable/imports/test1imp.d
new file mode 100644
index 00000000000..35d2253b143
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test1imp.d
@@ -0,0 +1,2 @@
+
+    alias uint DWORD;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test25a.d b/gcc/testsuite/gdc.test/compilable/imports/test25a.d
new file mode 100644
index 00000000000..1de08f9d0e4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test25a.d
@@ -0,0 +1,12 @@
+module imports.test25a;
+
+import imports.test25b;
+import core.stdc.stdio;
+
+class Afoo
+{
+    static this()
+    {
+	printf("Afoo()\n");
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test25b.d b/gcc/testsuite/gdc.test/compilable/imports/test25b.d
new file mode 100644
index 00000000000..089f69bfb68
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test25b.d
@@ -0,0 +1,9 @@
+module imports.test25b;
+
+import imports.test25a;
+
+import core.stdc.stdio;
+
+class Bfoo
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test2991.d b/gcc/testsuite/gdc.test/compilable/imports/test2991.d
new file mode 100644
index 00000000000..52fae39ebd8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test2991.d
@@ -0,0 +1,5 @@
+module imports.test2991;
+
+private void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test3602a.d b/gcc/testsuite/gdc.test/compilable/imports/test3602a.d
new file mode 100644
index 00000000000..30038240ed8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test3602a.d
@@ -0,0 +1,14 @@
+module imports.test3602a;
+
+class Base
+{
+   void method(int x, int y)
+   in
+   {
+       assert(x > 0);
+       assert(y > 0);
+   }
+   body
+   {
+   }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test4003a.d b/gcc/testsuite/gdc.test/compilable/imports/test4003a.d
new file mode 100644
index 00000000000..a05a16d5b90
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test4003a.d
@@ -0,0 +1,6 @@
+module imports.test4003a;
+
+import imports.typecons4003;
+
+Tuple!(string) t;
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test50a.d b/gcc/testsuite/gdc.test/compilable/imports/test50a.d
new file mode 100644
index 00000000000..da5bf3684de
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test50a.d
@@ -0,0 +1,6 @@
+module imports.test50a;
+
+class Foo {
+        protected int a;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test5230a.d b/gcc/testsuite/gdc.test/compilable/imports/test5230a.d
new file mode 100644
index 00000000000..dc56033e3f5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test5230a.d
@@ -0,0 +1,13 @@
+module imports.test5230a;
+
+class Base
+{
+    int method()
+    out (res)
+    {
+    }
+    body
+    {
+        return 42;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test55a.d b/gcc/testsuite/gdc.test/compilable/imports/test55a.d
new file mode 100644
index 00000000000..e6fa224d057
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test55a.d
@@ -0,0 +1,14 @@
+module imports.test55a;
+
+import test55;
+
+class Arm {
+  alias int ListHead;
+  MessageQueue.ListHead mqueue;
+}
+
+class Arm2 {
+  alias int ListHead;
+  Queue2.ListHead mqueue;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test59a.d b/gcc/testsuite/gdc.test/compilable/imports/test59a.d
new file mode 100644
index 00000000000..5078d67105c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test59a.d
@@ -0,0 +1,5 @@
+module imports.test59a;
+
+import test59;
+
+HRESULT h;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test59b.d b/gcc/testsuite/gdc.test/compilable/imports/test59b.d
new file mode 100644
index 00000000000..bf12c6f6f50
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test59b.d
@@ -0,0 +1,3 @@
+module imports.test59b;
+
+alias int HRESULT;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test6013.d b/gcc/testsuite/gdc.test/compilable/imports/test6013.d
new file mode 100644
index 00000000000..30bcc57eb0f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test6013.d
@@ -0,0 +1,11 @@
+module imports.test6013;
+
+int value;
+int func() { return 0; };
+
+public alias value public_alias_value;
+private alias value private_alias_value;
+public alias func public_alias_func;
+private alias func private_alias_func;
+public alias int public_alias_type;
+private alias int private_alias_type;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test61a.d b/gcc/testsuite/gdc.test/compilable/imports/test61a.d
new file mode 100644
index 00000000000..b08f637c87f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test61a.d
@@ -0,0 +1,4 @@
+module imports.test61a;
+
+enum FooA { fooA };
+void bar(FooA x) {}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test62a.d b/gcc/testsuite/gdc.test/compilable/imports/test62a.d
new file mode 100644
index 00000000000..7179f3a906f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test62a.d
@@ -0,0 +1,15 @@
+module imports.test62a;
+
+import test62;
+
+struct T()
+{
+   struct Nested
+   {
+      S member;
+   }
+}
+
+alias T!() instance;
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test63a.d b/gcc/testsuite/gdc.test/compilable/imports/test63a.d
new file mode 100644
index 00000000000..a8edbd8ae0f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test63a.d
@@ -0,0 +1,10 @@
+module imports.test63a;
+
+private import test63;
+
+struct s {
+
+    char a[ SIZE ];
+
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test66a.d b/gcc/testsuite/gdc.test/compilable/imports/test66a.d
new file mode 100644
index 00000000000..7e605331644
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test66a.d
@@ -0,0 +1,7 @@
+module imports.test66a;
+
+import test66;
+
+class A : Lexer
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test67a.d b/gcc/testsuite/gdc.test/compilable/imports/test67a.d
new file mode 100644
index 00000000000..796ab800137
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test67a.d
@@ -0,0 +1,19 @@
+module imports.test67a;
+
+import test67;
+
+class Base
+{
+    I create() {
+        return null;
+    }
+}
+
+class Derived : Base
+{
+    override SubI create() {
+        return null;
+    }
+}
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test68a.d b/gcc/testsuite/gdc.test/compilable/imports/test68a.d
new file mode 100644
index 00000000000..7e44f3e0f2e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test68a.d
@@ -0,0 +1,9 @@
+module imports.test68a;
+
+class OtherModuleClass
+{
+        protected void foo()
+        {
+        }
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test70.d b/gcc/testsuite/gdc.test/compilable/imports/test70.d
new file mode 100644
index 00000000000..6015ce99864
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test70.d
@@ -0,0 +1,5 @@
+module imports.test70;
+
+void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test71.d b/gcc/testsuite/gdc.test/compilable/imports/test71.d
new file mode 100644
index 00000000000..1e91b3fcb12
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test71.d
@@ -0,0 +1,6 @@
+module imports_test71;
+import imports = object;
+
+void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test72a.d b/gcc/testsuite/gdc.test/compilable/imports/test72a.d
new file mode 100644
index 00000000000..c695bae1c1f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test72a.d
@@ -0,0 +1,2 @@
+module imports.test72a;
+public import imports.test72b;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test72b.d b/gcc/testsuite/gdc.test/compilable/imports/test72b.d
new file mode 100644
index 00000000000..96da53c040d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test72b.d
@@ -0,0 +1,2 @@
+module imports.test72b;
+private import imports.test72c : foo;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test72c.d b/gcc/testsuite/gdc.test/compilable/imports/test72c.d
new file mode 100644
index 00000000000..49b13152bf4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test72c.d
@@ -0,0 +1,5 @@
+module imports.test72c;
+
+void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test7491a.d b/gcc/testsuite/gdc.test/compilable/imports/test7491a.d
new file mode 100644
index 00000000000..6a2bb01f36d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test7491a.d
@@ -0,0 +1 @@
+module imports.test7491a;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test7491b.d b/gcc/testsuite/gdc.test/compilable/imports/test7491b.d
new file mode 100644
index 00000000000..2e8a0025e92
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test7491b.d
@@ -0,0 +1 @@
+module imports.test7491b;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9276decl.d b/gcc/testsuite/gdc.test/compilable/imports/test9276decl.d
new file mode 100644
index 00000000000..0f507bc2ce6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9276decl.d
@@ -0,0 +1,14 @@
+module imports.test9276decl;
+
+import imports.test9276sem, imports.test9276visitors, imports.test9276util;
+
+class Declaration
+{
+    mixin DownCastMethods!TemplateDecl;
+}
+
+class TemplateDecl : OverloadableDecl
+{
+    mixin Visitors;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9276expr.d b/gcc/testsuite/gdc.test/compilable/imports/test9276expr.d
new file mode 100644
index 00000000000..376d6a4eb3b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9276expr.d
@@ -0,0 +1,15 @@
+module imports.test9276expr;
+
+import imports.test9276parser;
+import imports.test9276util;
+
+class Node
+{
+    mixin DownCastMethods!Declaration;
+
+}
+
+class Expression : Node
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9276hash.d b/gcc/testsuite/gdc.test/compilable/imports/test9276hash.d
new file mode 100644
index 00000000000..de714dccf2a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9276hash.d
@@ -0,0 +1 @@
+module imports.test9276hash;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9276parser.d b/gcc/testsuite/gdc.test/compilable/imports/test9276parser.d
new file mode 100644
index 00000000000..5e307eec37a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9276parser.d
@@ -0,0 +1,4 @@
+module imports.test9276parser;
+
+public import imports.test9276expr, imports.test9276decl;
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9276sem.d b/gcc/testsuite/gdc.test/compilable/imports/test9276sem.d
new file mode 100644
index 00000000000..3b660f420dc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9276sem.d
@@ -0,0 +1,25 @@
+module imports.test9276sem;
+
+class Declaration
+{
+    mixin Visitors;
+}
+
+template Semantic(T)
+{
+private:
+    struct
+    {
+        import imports.test9276hash;
+    }
+
+}
+
+
+
+import imports.test9276visitors;
+
+class OverloadableDecl : Declaration
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9276type.d b/gcc/testsuite/gdc.test/compilable/imports/test9276type.d
new file mode 100644
index 00000000000..8a2cb3c98a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9276type.d
@@ -0,0 +1,12 @@
+module imports.test9276type;
+
+import imports.test9276parser;
+
+class Type : Expression     // <- note to Walter.
+{
+}
+
+class BasicType : Type
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9276util.d b/gcc/testsuite/gdc.test/compilable/imports/test9276util.d
new file mode 100644
index 00000000000..f3a95d9fc90
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9276util.d
@@ -0,0 +1,13 @@
+module imports.test9276util;
+
+string _dgliteral(T...)()
+{
+    foreach (t; T)
+        return t.stringof;
+    assert(0);
+}
+template DownCastMethods(T...)
+{
+    enum x = _dgliteral!T;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9276visitors.d b/gcc/testsuite/gdc.test/compilable/imports/test9276visitors.d
new file mode 100644
index 00000000000..e2d507c639c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9276visitors.d
@@ -0,0 +1,16 @@
+module imports.test9276visitors;
+
+template Visitors()
+{
+    mixin Semantic!(typeof(this));
+    mixin DeepDup!(typeof(this));
+}
+
+import imports.test9276type;
+
+template DeepDup(T) if (is(T : BasicType))
+{}
+
+template DeepDup(T)
+{}
+
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9399a.d b/gcc/testsuite/gdc.test/compilable/imports/test9399a.d
new file mode 100644
index 00000000000..dbc80310dbb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9399a.d
@@ -0,0 +1,5 @@
+module imports.test9399a;
+
+void call(alias n)() {
+    n();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9436aggr.d b/gcc/testsuite/gdc.test/compilable/imports/test9436aggr.d
new file mode 100644
index 00000000000..a80d372a3bb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9436aggr.d
@@ -0,0 +1,11 @@
+module imports.test9436aggr;
+
+import imports.test9436type;
+
+class Aggregate : Type
+{
+}
+
+class Class
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9436interp.d b/gcc/testsuite/gdc.test/compilable/imports/test9436interp.d
new file mode 100644
index 00000000000..57405119b49
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9436interp.d
@@ -0,0 +1,16 @@
+module imports.test9436interp;
+
+import imports.test9436type;
+import imports.test9436aggr;
+
+class ReferenceValueT(T)
+{
+    void doCast()
+    {
+        auto x = Type.ConversionFlags.kAllowBaseClass;
+    }
+}
+
+class ClassValue : ReferenceValueT!Class
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9436node.d b/gcc/testsuite/gdc.test/compilable/imports/test9436node.d
new file mode 100644
index 00000000000..8ec09586137
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9436node.d
@@ -0,0 +1,7 @@
+module imports.test9436node;
+
+import imports.test9436aggr;
+
+template ForwardCtor()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9436type.d b/gcc/testsuite/gdc.test/compilable/imports/test9436type.d
new file mode 100644
index 00000000000..d1f14e73f90
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9436type.d
@@ -0,0 +1,13 @@
+module imports.test9436type;
+
+import imports.test9436node;
+
+class Type
+{
+    mixin ForwardCtor!();
+
+    enum ConversionFlags
+    {
+        kAllowBaseClass = 0
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9672a.d b/gcc/testsuite/gdc.test/compilable/imports/test9672a.d
new file mode 100644
index 00000000000..3ca7552ab7a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9672a.d
@@ -0,0 +1,32 @@
+module imports.test9672a;   // interpret
+
+import test9672;            // node
+
+class Type
+{
+    mixin ForwardCtor!();
+}
+
+//BasicType only created for standard types associated with tokens
+class BasicType : Type
+{
+    static Type createType()
+    {
+        return null;
+    }
+}
+
+class ValueT(T)
+{
+    Type getType()
+    {
+        return BasicType.createType();
+    }
+}
+class CharValue : ValueT!char
+{
+    string toStr()
+    {
+        return null;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9692b.d b/gcc/testsuite/gdc.test/compilable/imports/test9692b.d
new file mode 100644
index 00000000000..25be84b3413
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9692b.d
@@ -0,0 +1,2 @@
+module imports.test9692b;
+int j;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9919a.d b/gcc/testsuite/gdc.test/compilable/imports/test9919a.d
new file mode 100644
index 00000000000..8bf3faf6eda
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9919a.d
@@ -0,0 +1,3 @@
+module imports.test9919a;
+
+import imports.test9919c;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9919b.d b/gcc/testsuite/gdc.test/compilable/imports/test9919b.d
new file mode 100644
index 00000000000..0b9f1fd48cf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9919b.d
@@ -0,0 +1,19 @@
+module imports.test9919b;
+
+class Event
+{
+    mixin genToString;  // @BUG@
+}
+
+class MouseEvent : Event
+{
+    enum Action { A, B }
+}
+
+mixin template genToString()
+{
+    override string toString()
+    {
+        return "";
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test9919c.d b/gcc/testsuite/gdc.test/compilable/imports/test9919c.d
new file mode 100644
index 00000000000..ed50b1e0453
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test9919c.d
@@ -0,0 +1,5 @@
+module imports.test9919c;
+
+import test9919;
+
+MouseEvent.Action action;
diff --git a/gcc/testsuite/gdc.test/compilable/imports/typecons4003.d b/gcc/testsuite/gdc.test/compilable/imports/typecons4003.d
new file mode 100644
index 00000000000..d1d2eff80ad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/typecons4003.d
@@ -0,0 +1,22 @@
+module imports.typecons4003;
+
+struct Tuple(T...)
+{
+    alias T Types;
+    Types field;
+
+    ref Tuple!(Types[from .. to]) slice(uint from, uint to)()
+    {
+        return *cast(typeof(return) *) &(field[from]);
+    }
+
+    void test() //unittest
+    {
+        .Tuple!(int, string, float, double) a;
+        a.field[1] = "abc";
+        a.field[2] = 4.5;
+        auto s = a.slice!(1, 3);
+        static assert(is(typeof(s) == Tuple!(string, float)));
+        //assert(s.field[0] == "abc" && s.field[1] == 4.5);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/udamodule1.d b/gcc/testsuite/gdc.test/compilable/imports/udamodule1.d
new file mode 100644
index 00000000000..b51b7d75dbb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/udamodule1.d
@@ -0,0 +1,5 @@
+@(1) deprecated("This module will be removed.") @(2) module imports.udamodule1;
+
+void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/udamodule2.d b/gcc/testsuite/gdc.test/compilable/imports/udamodule2.d
new file mode 100644
index 00000000000..131b4b2aa83
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/udamodule2.d
@@ -0,0 +1,7 @@
+@UDA(1) @UDA(2) module imports.udamodule2;
+
+import imports.udamodule2a;
+
+void foo()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/udamodule2a.d b/gcc/testsuite/gdc.test/compilable/imports/udamodule2a.d
new file mode 100644
index 00000000000..bd6ebd98af9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/udamodule2a.d
@@ -0,0 +1,6 @@
+module imports.udamodule2a;
+
+struct UDA
+{
+    int a;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/wax16798.d b/gcc/testsuite/gdc.test/compilable/imports/wax16798.d
new file mode 100644
index 00000000000..af98706b696
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/wax16798.d
@@ -0,0 +1,4 @@
+module its.a.floorwax.wax16798;
+
+pragma(msg, "it's a floor wax");
+
diff --git a/gcc/testsuite/gdc.test/compilable/interpret3.d b/gcc/testsuite/gdc.test/compilable/interpret3.d
new file mode 100644
index 00000000000..d030943062d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/interpret3.d
@@ -0,0 +1,7707 @@
+﻿// PERMUTE_ARGS: -inline
+
+template compiles(int T)
+{
+    bool compiles = true;
+}
+
+alias TypeTuple(T...) = T;
+
+/**************************************************
+    3901 Arbitrary struct assignment, ref return
+**************************************************/
+
+struct ArrayRet
+{
+    int x;
+}
+
+int arrayRetTest(int z)
+{
+    ArrayRet[6] w;
+    int q = (w[3].x = z);
+    return q;
+}
+static assert(arrayRetTest(51) == 51);
+
+// Bugzilla 3842 -- must not segfault
+int ice3842(int z)
+{
+    ArrayRet w;
+    return arrayRetTest((*(&w)).x);
+}
+static assert(true || is(typeof(compiles!(ice3842(51)))));
+
+int arrayret2()
+{
+    int[5] a;
+    int[3] b;
+    b[] = a[1 .. $-1] = 5;
+    return b[1];
+}
+static assert(arrayret2() == 5);
+
+struct DotVarTest
+{
+    ArrayRet z;
+}
+
+struct DotVarTest2
+{
+    ArrayRet z;
+    DotVarTest p;
+}
+
+int dotvar1()
+{
+    DotVarTest w;
+    w.z.x = 3;
+    return w.z.x;
+}
+static assert(dotvar1() == 3);
+
+int dotvar2()
+{
+    DotVarTest2[4] m;
+    m[2].z.x = 3;
+    m[1].p.z.x = 5;
+    return m[2].z.x + 7;
+}
+static assert(dotvar2() == 10);
+
+
+struct RetRefStruct
+{
+    int x;
+    char c;
+}
+
+// Return value reference tests, for D2 only.
+
+ref RetRefStruct reffunc1(ref RetRefStruct a)
+{
+    int y = a.x;
+    return a;
+}
+
+ref RetRefStruct reffunc2(ref RetRefStruct a)
+{
+    RetRefStruct z = a;
+    return reffunc1(a);
+}
+
+ref int reffunc7(ref RetRefStruct aa)
+{
+    return reffunc1(aa).x;
+}
+
+ref int reffunc3(ref int a)
+{
+    return a;
+}
+
+struct RefTestStruct
+{
+    RetRefStruct r;
+
+    ref RefTestStruct reffunc4(ref RetRefStruct[3] a)
+    {
+        return this;
+    }
+
+    ref int reffunc6()
+    {
+        return this.r.x;
+    }
+}
+
+ref RetRefStruct reffunc5(ref RetRefStruct[3] a)
+{
+    int t = 1;
+    for (int i = 0; i < 10; ++i)
+    {
+        if (i == 7)
+            ++t;
+    }
+    return a[reffunc3(t)];
+}
+
+int retRefTest1()
+{
+    RetRefStruct b = RetRefStruct(0, 'a');
+    reffunc1(b).x = 3;
+    return b.x - 1;
+}
+
+int retRefTest2()
+{
+    RetRefStruct b = RetRefStruct(0, 'a');
+    reffunc2(b).x = 3;
+    RetRefStruct[3] z;
+    RefTestStruct w;
+    w.reffunc4(z).reffunc4(z).r.x = 4;
+    assert(w.r.x == 4);
+    w.reffunc6() = 218;
+    assert(w.r.x == 218);
+    z[2].x = 3;
+    int q = 4;
+    int u = reffunc5(z).x + reffunc3(q);
+    assert(u == 7);
+    reffunc5(z).x += 7;
+    assert(z[2].x == 10);
+    RetRefStruct m = RetRefStruct(7, 'c');
+    m.x = 6;
+    reffunc7(m) += 3;
+    assert(m.x == 9);
+    return b.x - 1;
+}
+
+int retRefTest3()
+{
+    RetRefStruct b = RetRefStruct(0, 'a');
+    auto deleg = function (RetRefStruct a){ return a; };
+    typeof(deleg)[3] z;
+    z[] = deleg;
+    auto y = deleg(b).x + 27;
+    b.x = 5;
+    assert(y == 27);
+    y = z[1](b).x + 22;
+    return y - 1;
+}
+
+int retRefTest4()
+{
+    RetRefStruct b = RetRefStruct(0, 'a');
+    reffunc3(b.x) = 218;
+    assert(b.x == 218);
+    return b.x;
+}
+
+static assert(retRefTest1() == 2);
+static assert(retRefTest2() == 2);
+static assert(retRefTest3() == 26);
+static assert(retRefTest4() == 218);
+
+/**************************************************
+    Bug 7887 assign to returned reference
+**************************************************/
+
+bool test7887()
+{
+    ref int f(ref int x) { return x; }
+    int a;
+    f(a) = 42;
+    return (a == 42);
+}
+static assert(test7887());
+
+/**************************************************
+    Bug 7473 struct non-ref
+**************************************************/
+
+struct S7473
+{
+    int i;
+}
+
+static assert({
+    S7473 s = S7473(1);
+    assert(s.i == 1);
+    bug7473(s);
+    assert(s.i == 1);
+    return true;
+}());
+
+void bug7473(S7473 s)
+{
+    s.i = 2;
+}
+
+struct S7473b
+{
+    S7473 m;
+}
+
+static assert({
+    S7473b s = S7473b(S7473(7));
+    assert(s.m.i == 7);
+    bug7473b(s);
+    assert(s.m.i == 7);
+    return true;
+}());
+
+void bug7473b(S7473b s)
+{
+    s.m.i = 2;
+}
+
+/**************************************************
+    Bug 4389
+**************************************************/
+
+int bug4389()
+{
+    string s;
+    dchar c = '\u2348';
+    s ~= c;
+    assert(s.length == 3);
+    dchar d = 'D';
+    s ~= d;
+    assert(s.length == 4);
+    s = "";
+    s ~= c;
+    assert(s.length == 3);
+    s ~= d;
+    assert(s.length == 4);
+    string z;
+    wchar w = '\u0300';
+    z ~= w;
+    assert(z.length == 2);
+    z = "";
+    z ~= w;
+    assert(z.length == 2);
+    return 1;
+}
+
+static assert(bug4389());
+
+// ICE(constfold.c)
+int ice4389()
+{
+    string s;
+    dchar c = '\u2348';
+    s ~= c;
+    s = s ~ "xxx";
+   return 1;
+}
+
+static assert(ice4389());
+
+// ICE(expression.c)
+string ice4390()
+{
+    string s;
+    dchar c = '`';
+    s ~= c;
+    s ~= c;
+   return s;
+}
+
+static assert(mixin(ice4390()) == ``);
+
+// bug 5248 (D1 + D2)
+struct Leaf5248
+{
+    string Compile_not_ovloaded()
+    {
+        return "expression";
+    }
+}
+struct Matrix5248
+{
+    Leaf5248 Right;
+
+    string Compile()
+    {
+        return Right.Compile_not_ovloaded();
+    }
+};
+
+static assert(Matrix5248().Compile());
+
+/**************************************************
+    4837   >>>=
+**************************************************/
+
+bool bug4837()
+{
+    ushort x = 0x89AB;
+    x >>>= 4;
+    assert(x == 0x89A);
+    byte y = 0x7C;
+    y >>>= 2;
+    assert(y == 0x1F);
+    return true;
+}
+
+static assert(bug4837());
+
+/**************************************************
+  10252 shift out of range
+**************************************************/
+
+int lshr10252(int shift)
+{
+     int a = 5;
+     return a << shift;
+}
+
+int rshr10252(int shift)
+{
+     int a = 5;
+     return a >> shift;
+}
+
+int ushr10252(int shift)
+{
+     int a = 5;
+     return a >>> shift;
+}
+
+static assert( is(typeof(compiles!(lshr10252( 4)))));
+static assert(!is(typeof(compiles!(lshr10252(60)))));
+static assert( is(typeof(compiles!(rshr10252( 4)))));
+static assert(!is(typeof(compiles!(rshr10252(80)))));
+static assert( is(typeof(compiles!(ushr10252( 2)))));
+static assert(!is(typeof(compiles!(ushr10252(60)))));
+
+/**************************************************
+  1982 CTFE null problems
+**************************************************/
+
+enum a1982 = [1, 2, 3];
+static assert(a1982 !is null);
+
+string foo1982() { return null; }
+static assert(foo1982() is null);
+static assert(!foo1982().length);
+
+static assert(null is null);
+
+/**************************************************
+  7988 CTFE return values should be allowed in compile-time expressions
+**************************************************/
+
+class X7988 { int y; this() { y = 2; } }
+static assert((new X7988).y == 2);
+
+/**************************************************
+  8253 ICE: calling of member function of non-CTFE class variable
+**************************************************/
+
+class Bug8253
+{
+    bool j()
+    {
+        return true;
+    }
+}
+Bug8253 m8253;
+static assert(!is(typeof(compiles!(m8253.j()))));
+
+/**************************************************
+  8285 Issue with slice returned from CTFE function
+**************************************************/
+
+string foo8285()
+{
+    string s = "ab";
+    return s[0 .. $];
+}
+
+template T8285b(string s) { }
+
+template T8285a()
+{
+    enum s = foo8285();
+    alias T8285b!(s) t2;
+}
+
+int bar8285()
+{
+    alias T8285a!() t1;
+    return 0;
+}
+
+int baz8285(int x)
+{
+    return 0;
+}
+
+static assert(baz8285(bar8285()) == 0);
+
+// test case 2
+
+string xbar8285()
+{
+    string s = "ab";
+    return s[0 .. $];
+}
+
+template xT8285a()
+{
+    enum xT8285a = xbar8285()[0 .. $];
+}
+
+string xbaz8285()
+{
+    return xT8285a!();
+}
+
+string xfoo8285(string s)
+{
+    return s;
+}
+
+static assert(xfoo8285(xbaz8285()) == "ab");
+
+/**************************************************
+  'this' parameter bug revealed during refactoring
+**************************************************/
+
+int thisbug1(int x) { return x; }
+
+struct ThisBug1
+{
+    int m = 1;
+    int wut()
+    {
+        return thisbug1(m);
+    }
+}
+
+int thisbug2()
+{
+    ThisBug1 spec;
+    return spec.wut();
+}
+
+static assert(thisbug2());
+
+/**************************************************
+   6972 ICE with cast()cast()assign
+**************************************************/
+
+int bug6972()
+{
+    ubyte n = 6;
+    n /= 2u;
+    return n;
+}
+static assert(bug6972() == 3);
+
+/**************************************************
+    Bug 6164
+**************************************************/
+
+size_t bug6164()
+{
+    int[] ctfe2(int n)
+    {
+        int[] r = [];
+        if (n != 0)
+            r ~= [1] ~ ctfe2(n - 1);
+        return r;
+    }
+    return ctfe2(2).length;
+}
+static assert(bug6164() == 2);
+
+/**************************************************
+    Interpreter code coverage tests
+**************************************************/
+
+int cov1(int a)
+{
+    a %= 15382;
+    a /= 5;
+    a = ~ a;
+    bool c = (a == 0);
+    bool b = true && c;
+    assert(b == 0);
+    b = false && c;
+    assert(b == 0);
+    b = false || c;
+    assert(b == 0);
+    a ^= 0x45349;
+    a = ~ a;
+    a &= 0xFF3F;
+    a >>>= 1;
+    a = a ^ 0x7393;
+    a = a >> 1;
+    a = a >>> 1;
+    a = a | 0x010101;
+    return a;
+}
+static assert(cov1(534564) == 71589);
+
+int cov2()
+{
+    int i = 0;
+    do
+    {
+        goto DOLABEL;
+    DOLABEL:
+        if (i != 0)
+        {
+            goto IFLABEL;
+    IFLABEL:
+            switch(i)
+            {
+            case 3:
+                break;
+            case 6:
+                goto SWITCHLABEL;
+    SWITCHLABEL:
+                i = 27;
+                goto case 3;
+            default:
+                assert(0);
+            }
+            return i;
+        }
+        i = 6;
+    } while(true);
+    return 88; // unreachable
+}
+static assert(cov2() == 27);
+
+template CovTuple(T...)
+{
+    alias T CovTuple;
+}
+
+alias CovTuple!(int, long) TCov3;
+
+int cov3(TCov3 t)
+{
+    TCov3 s;
+    s = t;
+    assert(s[0] == 1);
+    assert(s[1] == 2);
+    return 7;
+}
+static assert(cov3(1, 2) == 7);
+
+int badassert1(int z)
+{
+    assert(z == 5, "xyz");
+    return 1;
+}
+
+size_t badslice1(int[] z)
+{
+    return z[0 .. 3].length;
+}
+
+size_t badslice2(int[] z)
+{
+    return z[0 .. badassert1(1)].length;
+}
+
+size_t badslice3(int[] z)
+{
+    return z[badassert1(1) .. 2].length;
+}
+
+static assert(!is(typeof(compiles!(badassert1(67)))));
+static assert( is(typeof(compiles!(badassert1(5)))));
+static assert(!is(typeof(compiles!(badslice1([1,2])))));
+static assert(!is(typeof(compiles!(badslice2([1,2])))));
+static assert(!is(typeof(compiles!(badslice3([1,2,3])))));
+
+/*******************************************/
+
+int bug7894()
+{
+    for (int k = 0; k < 2; ++k)
+    {
+        goto Lagain;
+Lagain:
+        ;
+    }
+    int m = 1;
+    do
+    {
+        ++m;
+        goto Ldo;
+Ldo: ;
+    } while (m < 3);
+    assert(m == 3);
+
+    return 1;
+}
+static assert(bug7894());
+
+/*******************************************/
+
+size_t bug5524(int x, int[] more...)
+{
+    int[0] zz;
+    assert(zz.length == 0);
+    return 7 + more.length + x;
+}
+static assert(bug5524(3) == 10);
+
+
+// 5722
+
+static assert(("" ~ "\&copy;"[0]).length == 1);
+const char[] null5722 = null;
+static assert((null5722 ~ "\&copy;"[0]).length == 1);
+static assert(("\&copy;"[0] ~ null5722).length == 1);
+
+/*******************************************
+ * Tests for CTFE Array support.
+ * Including bugs 1330, 3801, 3835, 4050,
+ * 4051, 5147, and major functionality
+ *******************************************/
+
+char[] bug1330StringIndex()
+{
+    char[] blah = "foo".dup;
+    assert(blah == "foo");
+    char[] s = blah[0 .. 2];
+    blah[0] = 'h';
+    assert(s == "ho");
+    s[0] = 'm';
+    return blah;
+}
+static assert(bug1330StringIndex() == "moo");
+static assert(bug1330StringIndex() == "moo"); // check we haven't clobbered any string literals
+
+int[] bug1330ArrayIndex()
+{
+    int[] blah = [1,2,3];
+    int[] s = blah;
+    s = blah[0 .. 2];
+    int z = blah[0] = 6;
+    assert(z == 6);
+    assert(blah[0] == 6);
+    assert(s[0] == 6);
+    assert(s == [6, 2]);
+    s[1] = 4;
+    assert(z == 6);
+    return blah;
+}
+static assert(bug1330ArrayIndex() == [6, 4, 3]);
+static assert(bug1330ArrayIndex() == [6, 4, 3]); // check we haven't clobbered any literals
+
+char[] bug1330StringSliceAssign()
+{
+    char[] blah = "food".dup;
+    assert(blah == "food");
+    char[] s = blah[1 .. 4];
+    blah[0 .. 2] = "hc";
+    assert(s == "cod");
+    s[0 .. 2] = ['a', 'b'];   // Mix string + array literal
+    assert(blah == "habd");
+    s[0 .. 2] = "mq";
+    return blah;
+}
+static assert(bug1330StringSliceAssign() == "hmqd");
+static assert(bug1330StringSliceAssign() == "hmqd");
+
+int[] bug1330ArraySliceAssign()
+{
+    int[] blah = [1, 2, 3, 4];
+    int[] s = blah[1 .. 4];
+    blah[0 .. 2] = [7, 9];
+    assert(s == [9, 3, 4]);
+    s[0 .. 2] = [8, 15];
+    return blah;
+}
+static assert(bug1330ArraySliceAssign() == [7, 8, 15, 4]);
+
+int[] bug1330ArrayBlockAssign()
+{
+    int[] blah = [1, 2, 3, 4, 5];
+    int[] s = blah[1 .. 4];
+    blah[0 .. 2] = 17;
+    assert(s == [17, 3, 4]);
+    s[0 .. 2] = 9;
+    return blah;
+}
+static assert(bug1330ArrayBlockAssign() == [17, 9, 9, 4, 5]);
+
+char[] bug1330StringBlockAssign()
+{
+    char[] blah = "abcde".dup;
+    char[] s = blah[1 .. 4];
+    blah[0 .. 2] = 'x';
+    assert(s == "xcd");
+    s[0 .. 2] = 'y';
+    return blah;
+}
+static assert(bug1330StringBlockAssign() == "xyyde");
+
+int assignAA(int x)
+{
+    int[int] aa;
+    int[int] cc = aa;
+    assert(cc.values.length == 0);
+    assert(cc.keys.length == 0);
+    aa[1] = 2;
+    aa[x] = 6;
+    int[int] bb = aa;
+    assert(bb.keys.length == 2);
+    assert(cc.keys.length == 0); // cc is not affected to aa, because it is null
+    aa[500] = 65;
+    assert(bb.keys.length == 3); // but bb is affected by changes to aa
+    return aa[1] + aa[x];
+}
+static assert(assignAA(12) == 8);
+
+template Compileable(int z) { bool OK; }
+
+int arraybounds(int j, int k)
+{
+    int[] xxx = [1, 2, 3, 4, 5];
+    int[] s = xxx[1 .. $];
+    s = s[j .. k]; // slice of slice
+    return s[$ - 1];
+}
+static assert(!is(typeof(Compileable!(arraybounds(1, 14)))));
+static assert(!is(typeof(Compileable!(arraybounds(15, 3)))));
+static assert(arraybounds(2, 4) == 5);
+
+int arraybounds2(int j, int k)
+{
+    int[] xxx = [1, 2, 3, 4, 5];
+    int[] s = xxx[j .. k]; // direct slice
+    return 1;
+}
+static assert(!is(typeof(Compileable!(arraybounds2(1, 14)))));
+static assert(!is(typeof(Compileable!(arraybounds2(15, 3)))));
+static assert(arraybounds2(2, 4) == 1);
+
+int bug5147a()
+{
+    int[1][2] a = 37;
+    return a[0][0];
+}
+static assert(bug5147a() == 37);
+
+int bug5147b()
+{
+    int[4][2][3][17] a = 37;
+    return a[0][0][0][0];
+}
+static assert(bug5147b() == 37);
+
+int setlen()
+{
+    int[][] zzz;
+    zzz.length = 2;
+    zzz[0].length = 10;
+    assert(zzz.length == 2);
+    assert(zzz[0].length == 10);
+    assert(zzz[1].length == 0);
+    return 2;
+}
+static assert(setlen() == 2);
+
+int[1][1] bug5147()
+{
+    int[1][1] a = 1;
+    return a;
+}
+static assert(bug5147() == [[1]]);
+
+enum int[1][1] enum5147 = bug5147();
+static assert(enum5147 == [[1]]);
+
+immutable int[1][1] bug5147imm = bug5147();
+
+// Index referencing
+int[2][2] indexref1()
+{
+    int[2][2] a = 2;
+    a[0] = 7;
+
+    int[][] b = [null, null];
+    b[0 .. $] = a[0][0 .. 2];
+    assert(b[0][0] == 7);
+    assert(b[0][1] == 7);
+    int[] w;
+    w = a[0];
+    assert(w[0] == 7);
+    w[0 .. $] = 5;
+    assert(a[0] != [7, 7]);
+    assert(a[0] == [5, 5]);
+    assert(b[0] == [5, 5]);
+    return a;
+}
+int[2][2] indexref2()
+{
+    int[2][2] a = 2;
+    a[0] = 7;
+
+    int[][2] b = null;
+    b[0 .. $] = a[0];
+    assert(b[0][0] == 7);
+    assert(b[0][1] == 7);
+    assert(b == [[7, 7], [7, 7]]);
+    int[] w;
+    w = a[0];
+    assert(w[0] == 7);
+    w[0 .. $] = 5;
+    assert(a[0] != [7, 7]);
+    assert(a[0] == [5, 5]);
+    assert(b[0] == [5, 5]);
+    return a;
+}
+int[2][2] indexref3()
+{
+    int[2][2] a = 2;
+    a[0]=7;
+
+    int[][2] b = [null, null];
+    b[0 .. $] = a[0];
+    assert(b[0][0] == 7);
+    assert(b[0][1] == 7);
+    int[] w;
+    w = a[0];
+    assert(w[0] == 7);
+    w[0 .. $] = 5;
+    assert(a[0] != [7, 7]);
+    assert(a[0] == [5, 5]);
+    assert(b[0] == [5, 5]);
+    return a;
+}
+int[2][2] indexref4()
+{
+    int[2][2] a = 2;
+    a[0] = 7;
+
+    int[][2] b =[[1, 2, 3], [1, 2, 3]]; // wrong code
+    b[0] = a[0];
+    assert(b[0][0] == 7);
+    assert(b[0][1] == 7);
+    int[] w;
+    w = a[0]; //[0 .. $];
+    assert(w[0] == 7);
+    w[0 .. $] = 5;
+    assert(a[0] != [7, 7]);
+    assert(a[0] == [5, 5]);
+    assert(b[0] == [5, 5]);
+    return a;
+}
+static assert(indexref1() == [[5, 5], [2, 2]]);
+static assert(indexref2() == [[5, 5], [2, 2]]);
+static assert(indexref3() == [[5, 5], [2, 2]]);
+static assert(indexref4() == [[5, 5], [2, 2]]);
+
+int staticdynamic()
+{
+    int[2][1] a = 2;
+    assert(a == [[2, 2]]);
+
+    int[][1] b = a[0][0 .. 1];
+    assert(b[0] == [2]);
+    auto k = b[0];
+    auto m = a[0][0 .. 1];
+    assert(k == [2]);
+    assert(m == k);
+    return 0;
+}
+static assert(staticdynamic() == 0);
+
+int chainassign()
+{
+    int[4] x = 6;
+    int[] y = new int[4];
+    auto k = (y[] = (x[] = 2));
+    return k[0];
+}
+static assert(chainassign() == 2);
+
+// index assignment
+struct S3801
+{
+    char c;
+    int[3] arr;
+
+    this(int x, int y)
+    {
+        c = 'x';
+        arr[0] = x;
+        arr[1] = y;
+    }
+}
+
+int bug3801()
+{
+    S3801 xxx = S3801(17, 67);
+    int[] w = xxx.arr;
+    xxx.arr[1] = 89;
+    assert(xxx.arr[0] == 17);
+    assert(w[1] == 89);
+    assert(w == [17, 89, 0]);
+    return xxx.arr[1];
+}
+
+enum : S3801 { bug3801e = S3801(17, 18) }
+static assert(bug3801e.arr == [17, 18, 0]);
+
+immutable S3801 bug3801u = S3801(17, 18);
+static assert(bug3801u.arr == [17, 18, 0]);
+static assert(bug3801() == 89);
+
+int bug3835()
+{
+    int[4] arr;
+    arr[] = 19;
+    arr[0] = 4;
+    int kk;
+    foreach (ref el; arr)
+    {
+        el += 10;
+        kk = el;
+    }
+    assert(arr[2] == 29);
+    arr[0] += 3;
+    return arr[0];
+}
+static assert(bug3835() == 17);
+
+auto bug5852(const(string) s)
+{
+    string[] r;
+    r ~= s;
+    assert(r.length == 1);
+    return r[0].length;
+}
+static assert(bug5852("abc") == 3);
+
+// 7217
+
+struct S7217 { int[] arr; }
+
+bool f7217()
+{
+    auto s = S7217();
+    auto t = s.arr;
+    return true;
+}
+static assert(f7217());
+
+/*******************************************
+    Set array length
+*******************************************/
+
+static assert(
+{
+    struct W { int[] z; }
+    W w;
+    w.z.length = 2;
+    assert(w.z.length == 2);
+    w.z.length = 6;
+    assert(w.z.length == 6);
+    return true;
+}());
+
+// 7185 char[].length = n
+
+bool bug7185()
+{
+    auto arr = new char[2];
+    auto arr2 = new char[2];
+    arr2[] = "ab";
+    arr.length = 1;
+    arr2.length = 7;
+    assert(arr.length == 1);
+    assert(arr2.length == 7);
+    assert(arr2[0 .. 2] == "ab");
+    return true;
+}
+static assert(bug7185());
+
+bool bug9908()
+{
+    static const int[3] sa = 1;
+    return sa == [1, 1, 1];
+}
+static assert(bug9908());
+
+/*******************************************
+    6934
+*******************************************/
+
+struct Struct6934
+{
+    int[] x = [1, 2];
+}
+
+void bar6934(ref int[] p)
+{
+    p[0] = 12;
+    assert(p[0] == 12);
+    p[0 .. 1] = 17;
+    assert(p[0] == 17);
+    p = p[1 .. $];
+}
+
+int bug6934()
+{
+    Struct6934 q;
+    bar6934(q.x);
+    int[][] y = [[2, 5], [3, 6, 8]];
+    bar6934(y[0]);
+    return 1;
+}
+static assert(bug6934());
+
+/*******************************************
+             Bug 5671
+*******************************************/
+
+static assert(['a', 'b'] ~ "c" == "abc");
+
+/*******************************************
+      8624
+*******************************************/
+
+int evil8624()
+{
+    long  m =  0x1_0000_0000L;
+    assert(m != 0);
+    long[] a = [0x1_0000_0000L];
+    long[] b = [0x4_0000_0000L];
+    assert(a[] != b[]);
+    return 1;
+}
+static assert(evil8624());
+
+/*******************************************
+        8644 array literal >,<
+*******************************************/
+
+int bug8644()
+{
+    auto m = "a";
+    auto z = ['b'];
+    auto c = "b7";
+    auto d = ['b', '6'];
+    assert(m < z);
+    assert(z > m);
+    assert(z <= c);
+    assert(c > z);
+    assert(c > d);
+    assert(d >= d);
+    return true;
+}
+static assert(bug8644());
+
+/*******************************************
+        Bug 6159
+*******************************************/
+
+struct A6159 {}
+
+static assert({ return A6159.init is A6159.init; }());
+static assert({ return [1] is [1]; }());
+
+/*******************************************
+        Bug 5685
+*******************************************/
+
+string bug5685()
+{
+    return "xxx";
+}
+struct Bug5865
+{
+    void test1()
+    {
+        enum file2 = (bug5685())[0 .. $];
+    }
+}
+
+/*******************************************
+    6235 - Regression ICE on $ in template
+*******************************************/
+
+struct Bug6235(R)
+{
+    enum XXX = is(typeof(R.init[0 .. $]) : const ubyte[]);
+}
+
+Bug6235!(ubyte[]) bug6235;
+
+/*******************************************
+    8673 ICE
+*******************************************/
+
+enum dollar8673 = [0][(() => $ - 1)()];
+
+/*******************************************
+        Bug 5840
+*******************************************/
+
+struct Bug5840
+{
+    string g;
+    int w;
+}
+
+int bug5840(int u)
+{
+    // check for clobbering
+    Bug5840 x = void;
+    x.w = 4;
+    x.g = "3gs";
+    if (u == 1)
+        bug5840(2);
+    if (u == 2)
+    {
+        x.g = "abc";
+        x.w = 3465;
+    }
+    else
+    {
+        assert(x.g == "3gs");
+        assert(x.w == 4);
+    }
+    return 56;
+}
+static assert(bug5840(1) == 56);
+
+/*******************************************
+        7810
+*******************************************/
+
+int bug7810()
+{
+    int[1][3] x = void;
+    x[0] = [2];
+    x[1] = [7];
+    assert(x[0][0] == 2);
+
+    char[1][3] y = void;
+    y[0] = "a";
+    y[1] = "b";
+    assert(y[0][0] == 'a');
+
+    return 1;
+}
+static assert(bug7810());
+
+struct Bug7810
+{
+    int w;
+}
+int bug7810b(T)(T[] items...)
+{
+    assert(items[0] == Bug7810(20));
+    return 42;
+}
+static assert(bug7810b(Bug7810(20), Bug7810(10)) == 42);
+
+/*******************************************
+    std.datetime ICE (30 April 2011)
+*******************************************/
+
+struct TimeOfDayZ
+{
+public:
+    this(int hour) { }
+    invariant() { }
+}
+const testTODsThrownZ = TimeOfDayZ(0);
+
+/*******************************************
+        Bug 5954
+*******************************************/
+
+struct Bug5954
+{
+    int x;
+    this(int xx)
+    {
+        this.x = xx;
+    }
+}
+void bug5954()
+{
+    enum f = Bug5954(10);
+    static assert(f.x == 10);
+}
+
+/*******************************************
+        Bug 5972
+*******************************************/
+
+int bug5972()
+{
+    char[] z = "abc".dup;
+    char[][] a = [null, null];
+    a[0]  = z[0 .. 2];
+    char[] b = a[0];
+    assert(b == "ab");
+    a[0][1] = 'q';
+    assert(a[0] == "aq");
+    assert(b == "aq");
+    assert(b[1] == 'q');
+    //a[0][0 .. $ - 1][0 .. $] = a[0][0 .. $ - 1][0 .. $];  // overlap
+    return 56;
+}
+static assert(bug5972() == 56);
+
+/*******************************************
+    2.053beta [CTFE]ICE 'global errors'
+*******************************************/
+
+int wconcat(wstring replace)
+{
+    wstring value;
+    value  = "A"w;
+    value = value ~ replace;
+    return 1;
+}
+static assert(wconcat("X"w));
+
+/*******************************************
+    10397 string concat
+*******************************************/
+
+static assert(!is(typeof(compiles!("abc" ~ undefined))));
+static assert(!is(typeof(compiles!(otherundefined ~ "abc"))));
+
+/*******************************************
+    9634 struct concat
+*******************************************/
+
+struct Bug9634
+{
+    int raw;
+}
+
+bool bug9634()
+{
+    Bug9634[] jr = [Bug9634(42)];
+
+    Bug9634[] ir = null ~ jr;
+    Bug9634[] kr = jr ~ null;
+    Bug9634[] mr = jr ~ jr;
+
+    jr[0].raw = 6;
+    assert(ir[0].raw == 42);
+    assert(kr[0].raw == 42);
+    assert(jr[0].raw == 6);
+    assert(&mr[0] != &mr[1]);
+    return true;
+}
+
+static assert(bug9634());
+
+/*******************************************
+    Bug 4001: A Space Oddity
+*******************************************/
+
+int space() { return 4001; }
+
+void oddity4001(int q)
+{
+    const int bowie = space();
+    static assert(space() == 4001);
+    static assert(bowie == 4001);
+}
+
+/*******************************************
+    Bug 3779
+*******************************************/
+
+static const bug3779 = ["123"][0][$ - 1];
+
+/*******************************************
+    Bug 8893 ICE with bad struct literal
+*******************************************/
+
+struct Foo8893
+{
+    char[3] data;
+}
+int bar8893(Foo8893 f)
+{
+    return f.data[0];
+}
+static assert(!is(typeof(compiles!(bar8893(Foo8893(['a','b']))))));
+
+/*******************************************
+    non-Cow struct literals
+*******************************************/
+
+struct Zadok
+{
+    int[3] z;
+    char[4] s = void;
+    ref int[] fog(ref int[] q) { return q; }
+    int bfg()
+    {
+        z[0] = 56;
+        auto zs = z[];
+        fog(zs) = [56, 6, 8];
+
+        assert(z[0] == 56);
+        assert(z[1] == 61);
+        assert(z[2] == 61);
+
+        assert(zs[0] == 56);
+        assert(zs[1] == 6);
+        return zs[2];
+    }
+}
+
+struct Vug
+{
+    Zadok p;
+    int[] other;
+}
+
+int quop()
+{
+    int[] heap = new int[5];
+    heap[] = 738;
+    Zadok pong;
+    pong.z = 3;
+    int[] w = pong.z;
+    assert(w[0] == 3);
+    Zadok phong;
+    phong.z = 61;
+    pong = phong;
+    assert(w[0] == 61);
+    Vug b = Vug(Zadok(17, "abcd"));
+    b = Vug(Zadok(17, "abcd"), heap);
+    b.other[2] = 78;
+    assert(heap[2] == 78);
+    char[] y = b.p.s;
+    assert(y[2] == 'c');
+    phong.s = ['z','x','f', 'g'];
+    w = b.p.z;
+    assert(y[2] == 'c');
+    assert(w[0] == 17);
+    b.p = phong;
+    assert(y[2] == 'f');
+
+    Zadok wok = Zadok(6, "xyzw");
+    b.p = wok;
+    assert(y[2] == 'z');
+    b.p = phong;
+    assert(w[0] == 61);
+    Vug q;
+    q.p = pong;
+    return pong.bfg();
+}
+
+static assert(quop() == 8);
+static assert(quop() == 8); // check for clobbering
+
+/**************************************************
+   Bug 5676 tuple assign of struct that has void opAssign
+**************************************************/
+
+struct S5676
+{
+    int x;
+    void opAssign(S5676 rhs) { x = rhs.x; }
+}
+
+struct Tup5676(E...)
+{
+    E g;
+    void foo(E values) { g = values; }
+}
+
+bool ice5676()
+{
+    Tup5676!(S5676) q;
+    q.foo(S5676(3));
+    assert(q.g[0].x == 3);
+    return true;
+}
+
+static assert(ice5676());
+
+/**************************************************
+   Bug 5682 Wrong CTFE with operator overloading
+**************************************************/
+
+struct A
+{
+    int n;
+    auto opBinary(string op : "*")(A rhs)
+    {
+        return A(n * rhs.n);
+    }
+}
+
+A foo(A[] lhs, A[] rhs)
+{
+    A current;
+    for (size_t k = 0; k < rhs.length; ++k)
+    {
+        current = lhs[k] * rhs[k];
+    }
+    return current;
+}
+
+auto test()
+{
+    return foo([A(1), A(2)], [A(3), A(4)]);
+}
+
+static assert(test().n == 8);
+
+/**************************************************
+   Attempt to modify a read-only string literal
+**************************************************/
+struct Xarg
+{
+    char[] s;
+}
+
+int zfs(int n)
+{
+    char[] m = "exy".dup;
+    if (n == 1)
+    {
+        // it's OK to cast to const, then cast back
+        string ss = cast(string)m;
+        m = cast(char[])ss;
+        m[2]='q';
+        return 56;
+    }
+    auto q = Xarg(cast(char[])"abc");
+    assert(q.s[1] == 'b');
+    if (n == 2)
+        q.s[1] = 'p';
+    else if (n == 3)
+        q.s[0 .. $] = 'p';
+    char* w = &q.s[2];
+    if (n == 4)
+        *w = 'z';
+    return 76;
+}
+
+static assert(!is(typeof(compiles!(zfs(2)))));
+static assert(!is(typeof(compiles!(zfs(3)))));
+static assert(!is(typeof(compiles!(zfs(4)))));
+static assert( is(typeof(compiles!(zfs(1)))));
+static assert( is(typeof(compiles!(zfs(5)))));
+
+/**************************************************
+   .dup must protect string literals
+**************************************************/
+
+string mutateTheImmutable(immutable string _s)
+{
+    char[] s = _s.dup;
+    foreach (ref c; s)
+        c = 'x';
+    return s.idup;
+}
+
+string doharm(immutable string _name)
+{
+    return mutateTheImmutable(_name[2 .. $].idup);
+}
+
+enum victimLiteral = "CL_INVALID_CONTEXT";
+
+enum thug = doharm(victimLiteral);
+static assert(victimLiteral == "CL_INVALID_CONTEXT");
+
+/**************************************************
+        Use $ in a slice of a dotvar slice
+**************************************************/
+
+int sliceDollar()
+{
+    Xarg z;
+    z.s = new char[20];
+    z.s[] = 'b';
+    z.s = z.s[2 .. $ - 2];
+    z.s[$ - 2] = 'c';
+    return z.s[$ - 2];
+}
+static assert(sliceDollar() == 'c');
+
+/**************************************************
+   Variation of 5972 which caused segfault
+**************************************************/
+
+int bug5972crash()
+{
+    char[] z = "abc".dup;
+    char[][] a = [null, null];
+    a[0] = z[0 .. 2];
+    a[0][1] = 'q';
+    return 56;
+}
+static assert(bug5972crash() == 56);
+
+/**************************************************
+   String slice assignment through ref parameter
+**************************************************/
+
+void popft(A)(ref A a)
+{
+    a = a[1 .. $];
+}
+
+int sdfgasf()
+{
+    auto scp = "abc".dup;
+    popft(scp);
+    return 1;
+}
+static assert(sdfgasf() == 1);
+
+/**************************************************
+   8830 slice of slice.ptr
+**************************************************/
+
+string bug8830(string s)
+{
+    auto ss = s[1 .. $];
+    return ss.ptr[0 .. 2];
+}
+static assert(bug8830("hello") == "el");
+
+/**************************************************
+   8608 ICE
+**************************************************/
+
+void bug8608(ref int m) {}
+void test8608()
+{
+    int z;
+    int foo(bool b)
+    {
+        if (b)
+            bug8608(z);
+        return 1;
+    }
+    static assert( is(typeof(compiles!(foo(false)))));
+    static assert(!is(typeof(compiles!(foo(true) ))));
+}
+
+/**************************************************
+   Bug 7770
+**************************************************/
+
+immutable char[] foo7770 = "abcde";
+
+int bug7770a(string a)
+{
+    return 1;
+}
+
+bool bug7770b(char c)
+{
+    return true;
+}
+
+static assert(bug7770a(foo7770[0 .. $]));
+static assert(bug7770b(foo7770[$ - 2]));
+
+void baz7770()
+{
+    static assert(bug7770a(foo7770[0 .. $]));
+    static assert(bug7770b(foo7770[$ - 2]));
+}
+
+/**************************************************
+   8601 ICE
+**************************************************/
+
+dchar bug8601(dstring s)
+{
+    dstring w = s[1 .. $];
+    return w[0];
+}
+
+enum dstring e8601 = [cast(dchar)'o', 'n'];
+static assert(bug8601(e8601) == 'n');
+
+/**************************************************
+   Bug 6015
+**************************************************/
+
+struct Foo6015
+{
+    string field;
+}
+
+bool func6015(string input)
+{
+    Foo6015 foo;
+    foo.field = input[0 .. $];
+    assert(foo.field == "test");
+    foo.field = "test2";
+    assert(foo.field != "test");
+    assert(foo.field == "test2");
+    return true;
+}
+
+static assert(func6015("test"));
+
+/**************************************************
+   Bug 6001
+**************************************************/
+
+void bug6001e(ref int[] s)
+{
+    int[] r = s;
+    s ~= 0;
+}
+bool bug6001f()
+{
+    int[] s;
+    bug6001e(s);
+    return true;
+}
+static assert(bug6001f());
+
+// Assignment to AAs
+
+void blah(int[char] as)
+{
+    auto k = [6: as];
+    as = k[6];
+}
+int blaz()
+{
+    int[char] q;
+    blah(q);
+    return 67;
+}
+static assert(blaz() == 67);
+
+void bug6001g(ref int[] w)
+{
+    w = [88];
+    bug6001e(w);
+    w[0] = 23;
+}
+
+bool bug6001h()
+{
+    int[] s;
+    bug6001g(s);
+    assert(s.length == 2);
+    assert(s[1] == 0);
+    assert(s[0] == 23);
+    return true;
+}
+static assert(bug6001h());
+
+/**************************************************
+   10243 wrong code *&arr as ref parameter
+   10551 wrong code (&arr)[0] as ref parameter
+**************************************************/
+
+void bug10243(ref int n)
+{
+    n = 3;
+}
+
+void bug10551(int* p)
+{
+    bug10243(p[0]);
+}
+
+bool test10243()
+{
+    int[1] arr;
+    bug10243(*arr.ptr);
+    assert(arr[0] == 3);
+    int[1] arr2;
+    bug10551(arr2.ptr);
+    assert(arr2[0] == 3);
+    int v;
+    bug10551(&v);
+    assert(v == 3);
+    return true;
+}
+
+static assert(test10243());
+
+/**************************************************
+   Bug 4910
+**************************************************/
+
+int bug4910(int a)
+{
+    return a;
+}
+
+static int var4910;
+static assert(!is(typeof(Compiles!(bug4910(var4910)))));
+
+static assert(bug4910(123));
+
+/**************************************************
+    Bug 5845 - Regression(2.041)
+**************************************************/
+
+void test5845(ulong cols) {}
+
+uint solve(bool niv, ref ulong cols)
+{
+    if (niv)
+        solve(false, cols);
+    else
+        test5845(cols);
+    return 65;
+}
+
+ulong nqueen(int n)
+{
+    ulong cols = 0;
+    return solve(true, cols);
+}
+
+static assert(nqueen(2) == 65);
+
+/**************************************************
+    Bug 5258
+**************************************************/
+
+struct Foo5258 { int x; }
+void bar5258(int n, ref Foo5258 fong)
+{
+    if (n)
+        bar5258(n - 1, fong);
+    else
+        fong.x++;
+}
+int bug5258()
+{
+    Foo5258 foo5258 = Foo5258();
+    bar5258(1, foo5258);
+    return 45;
+}
+static assert(bug5258() == 45);
+
+struct Foo5258b { int[2] r; }
+void baqopY(int n, ref int[2] fongo)
+{
+    if (n)
+        baqopY(n - 1, fongo);
+    else
+        fongo[0]++;
+}
+int bug5258b()
+{
+    Foo5258b qq;
+    baqopY(1, qq.r);
+    return 618;
+}
+static assert(bug5258b() == 618);
+
+// Notice that this case involving reassigning the dynamic array
+struct Foo5258c { int[] r; }
+void baqop(int n, ref int[] fongo)
+{
+    if (n)
+        baqop(n - 1, fongo);
+    else
+    {
+        fongo = new int[20];
+        fongo[0]++;
+    }
+}
+size_t bug5258c()
+{
+    Foo5258c qq;
+    qq.r = new int[30];
+    baqop(1, qq.r);
+    return qq.r.length;
+}
+static assert(bug5258c() == 20);
+
+/**************************************************
+    Bug 6049
+**************************************************/
+
+struct Bug6049
+{
+    int m;
+    this(int x) {  m = x; }
+    invariant() { }
+}
+
+const Bug6049[] foo6049 = [Bug6049(6),  Bug6049(17)];
+
+static assert(foo6049[0].m == 6);
+
+/**************************************************
+    Bug 6052
+**************************************************/
+
+struct Bug6052
+{
+    int a;
+}
+
+bool bug6052()
+{
+    Bug6052[2] arr;
+    for (int i = 0; i < 2; ++ i)
+    {
+        Bug6052 el = {i};
+        Bug6052 ek = el;
+        arr[i] = el;
+        el.a = i + 2;
+        assert(ek.a == i);      // ok
+        assert(arr[i].a == i);  // fail
+    }
+    assert(arr[1].a == 1);  // ok
+    assert(arr[0].a == 0);  // fail
+    return true;
+}
+
+static assert(bug6052());
+
+bool bug6052b()
+{
+    int[][1] arr;
+    int[1] z = [7];
+    arr[0] = z;
+    assert(arr[0][0] == 7);
+    arr[0] = z;
+    z[0] = 3;
+    assert(arr[0][0] == 3);
+    return true;
+}
+
+static assert(bug6052b());
+
+struct Bug6052c
+{
+    int x;
+    this(int a) { x = a; }
+}
+
+int bug6052c()
+{
+    Bug6052c[] pieces = [];
+    for (int c = 0; c < 2; ++ c)
+        pieces ~= Bug6052c(c);
+    assert(pieces[1].x == 1);
+    assert(pieces[0].x == 0);
+    return 1;
+}
+static assert(bug6052c() == 1);
+static assert(bug6052c() == 1);
+
+
+static assert({
+    Bug6052c[] pieces = [];
+    pieces.length = 2;
+    int c = 0;
+    pieces[0] = Bug6052c(c);
+    ++c;
+    pieces[1] = Bug6052c(c);
+    assert(pieces[0].x == 0);
+    return true;
+}());
+
+static assert({
+    int[1][] pieces = [];
+    pieces.length = 2;
+    for (int c = 0; c < 2; ++ c)
+        pieces[c][0] = c;
+    assert(pieces[1][0] == 1);
+    assert(pieces[0][0] == 0);
+    return true;
+}());
+
+static assert({
+    Bug6052c[] pieces = [];
+    for (int c = 0; c < 2; ++ c)
+        pieces ~= Bug6052c(c);
+    assert(pieces[1].x == 1);
+    assert(pieces[0].x == 0);
+    return true;
+}());
+
+static assert({
+    int[1] z = 7;
+    int[1][] pieces = [z,z];
+    pieces[1][0]=3;
+    assert(pieces[0][0] == 7);
+    pieces = pieces ~ [z,z];
+    pieces[3][0] = 16;
+    assert(pieces[2][0] == 7);
+    pieces = [z,z] ~ pieces;
+    pieces[5][0] = 16;
+    assert(pieces[4][0] == 7);
+    return true;
+}());
+
+/**************************************************
+    Bug 6749
+**************************************************/
+
+struct CtState
+{
+    string code;
+}
+
+CtState bug6749()
+{
+    CtState[] pieces;
+    CtState r = CtState("correct");
+    pieces ~= r;
+    r = CtState("clobbered");
+    return pieces[0];
+}
+static assert(bug6749().code == "correct");
+
+/**************************************************
+    Index + slice assign to function returns
+**************************************************/
+
+int[] funcRetArr(int[] a)
+{
+    return a;
+}
+
+int testFuncRetAssign()
+{
+    int[] x = new int[20];
+    funcRetArr(x)[2] = 4;
+    assert(x[2] == 4);
+    funcRetArr(x)[] = 27;
+    assert(x[15] == 27);
+    return 5;
+}
+static assert(testFuncRetAssign() == 5);
+
+int keyAssign()
+{
+    int[int] pieces;
+    pieces[3] = 1;
+    pieces.keys[0] = 4;
+    pieces.values[0] = 27;
+    assert(pieces[3] == 1);
+    return 5;
+}
+static assert(keyAssign() == 5);
+
+/**************************************************
+    Bug 6054 -- AA literals
+**************************************************/
+
+enum x6054 = {
+    auto p = {
+        int[string] pieces;
+        pieces[['a'].idup] = 1;
+        return pieces;
+    }();
+    return p;
+}();
+
+/**************************************************
+    Bug 6077
+**************************************************/
+
+enum bug6077 = {
+    string s;
+    string t;
+    return s ~ t;
+}();
+
+/**************************************************
+    Bug 6078 -- Pass null array by ref
+**************************************************/
+
+struct Foo6078
+{
+    int[] bar;
+}
+
+static assert({
+    Foo6078 f;
+    int i;
+    foreach (ref e; f.bar)
+    {
+        i += e;
+    }
+    return i;
+}() == 0);
+
+int bug6078(ref int[] z)
+{
+    int[] q = z;
+    return 2;
+}
+
+static assert({
+    Foo6078 f;
+    return bug6078(f.bar);
+}() == 2);
+
+/**************************************************
+    Bug 6079 -- Array bounds checking
+**************************************************/
+
+static assert(!is(typeof(compiles!({
+    int[] x = [1, 2, 3, 4];
+    x[4] = 1;
+    return true;
+}()
+))));
+
+/**************************************************
+    Bug 6100
+**************************************************/
+
+struct S6100
+{
+    int a;
+}
+
+S6100 init6100(int x)
+{
+    S6100 s = S6100(x);
+    return s;
+}
+
+static const S6100[2] s6100a = [init6100(1), init6100(2)];
+static assert(s6100a[0].a == 1);
+
+/**************************************************
+    Bug 4825 -- failed with -inline
+**************************************************/
+
+int a4825()
+{
+    int r;
+    return r;
+}
+
+int b4825()
+{
+    return a4825();
+}
+
+void c4825()
+{
+    void d()
+    {
+        auto e = b4825();
+    }
+    static const int f = b4825();
+}
+
+/**************************************************
+    Bug 5708 -- failed with -inline
+**************************************************/
+
+string b5708(string s) { return s; }
+string a5708(string s) { return b5708(s); }
+
+void bug5708()
+{
+    void m() { a5708("lit"); }
+    static assert(a5708("foo") == "foo");
+    static assert(a5708("bar") == "bar");
+}
+
+/**************************************************
+    Bug 6120 -- failed with -inline
+**************************************************/
+
+struct Bug6120(T)
+{
+    this(int x) { }
+}
+static assert({
+    auto s = Bug6120!int(0);
+    return true;
+}());
+
+/**************************************************
+    Bug 6123 -- failed with -inline
+**************************************************/
+
+struct Bug6123(T)
+{
+    void f() {}
+    // can also trigger if the struct is normal but f is template
+}
+static assert({
+    auto piece = Bug6123!int();
+    piece.f();
+    return true;
+}());
+
+/**************************************************
+    Bug 6053 -- ICE involving pointers
+**************************************************/
+
+static assert({
+    int* a = null;
+    assert(a is null);
+    assert(a == null);
+    return true;
+}());
+
+static assert({
+    int b;
+    int* a = &b;
+    assert(a !is null);
+    *a = 7;
+    assert(b == 7);
+    assert(*a == 7);
+    return true;
+}());
+
+int dontbreak6053()
+{
+    auto q = &dontbreak6053;
+    void caz() {}
+    auto tr = &caz;
+    return 5;
+}
+static assert(dontbreak6053());
+
+static assert({
+    int a;
+    *(&a) = 15;
+    assert(a == 15);
+    assert(*(&a) == 15);
+    return true;
+}());
+
+static assert({
+    int a = 5, b = 6, c = 2;
+    assert(*(c ? &a : &b) == 5);
+    assert(*(!c ? &a : &b) == 6);
+    return true;
+}());
+
+static assert({
+    int a, b, c;
+    (c ? a : b) = 1;
+    return true;
+}());
+
+static assert({
+    int a, b, c = 1;
+    int* p = &a;
+    (c ? *p : b) = 51;
+    assert(a == 51);
+    return true;
+}());
+
+/**************************************************
+  Pointer arithmetic, dereference, and comparison
+**************************************************/
+
+// dereference null pointer
+static assert(!is(typeof(compiles!({
+    int a, b, c = 1;
+    int* p;
+    (c ? *p : b) = 51;
+    return 6;
+}()
+))));
+static assert(!is(typeof(compiles!({
+    int* a = null;
+    assert(*a != 6);
+    return 72;
+}()
+))));
+
+// cannot <, > compare pointers to different arrays
+static assert(!is(typeof(compiles!({
+    int[5] a, b;
+    bool c = (&a[0] > &b[0]);
+    return 72;
+}()
+))));
+
+// can ==, is, !is, != compare pointers for different arrays
+static assert({
+    int[5] a;
+    int[5] b;
+    assert(!(&a[0] == &b[0]));
+    assert(&a[0] != &b[0]);
+    assert(!(&a[0] is &b[0]));
+    assert(&a[0] !is &b[0]);
+    return 72;
+}());
+
+static assert({
+    int[5] a;
+    a[0] = 25;
+    a[1] = 5;
+    int* b = &a[1];
+    assert(*b == 5);
+    *b = 34;
+    int c = *b;
+    *b += 6;
+    assert(b == &a[1]);
+    assert(b != &a[0]);
+    assert(&a[0] < &a[1]);
+    assert(&a[0] <= &a[1]);
+    assert(!(&a[0] >= &a[1]));
+    assert(&a[4] > &a[0]);
+    assert(c == 34);
+    assert(*b == 40);
+    assert(a[1] == 40);
+    return true;
+}());
+
+static assert({
+    int[12] x;
+    int* p = &x[10];
+    int* q = &x[4];
+    return p - q;
+}() == 6);
+
+static assert({
+    int[12] x;
+    int* p = &x[10];
+    int* q = &x[4];
+    q = p;
+    assert(p == q);
+    q = &x[4];
+    assert(p != q);
+    q = q + 6;
+    assert(q is p);
+    return 6;
+}() == 6);
+
+static assert({
+    int[12] x;
+    int[] y = x[2 .. 8];
+    int* p = &y[4];
+    int* q = &x[6];
+    assert(p == q);
+    p = &y[5];
+    assert(p > q);
+    p = p + 5; // OK, as long as we don't dereference
+    assert(p > q);
+    return 6;
+}() == 6);
+
+static assert({
+    char[12] x;
+    const(char)* p = "abcdef";
+    const (char)* q = p;
+    q = q + 2;
+    assert(*q == 'c');
+    assert(q > p);
+    assert(q - p == 2);
+    assert(p - q == -2);
+    q = &x[7];
+    p = &x[1];
+    assert(q>p);
+    return 6;
+}() == 6);
+
+// Relations involving null pointers
+bool nullptrcmp()
+{
+    // null tests
+    void* null1 = null, null2 = null;
+    int x = 2;
+    void* p = &x;
+    assert(null1 == null2);
+    assert(null1 is null2);
+    assert(null1 <= null2);
+    assert(null1 >= null2);
+    assert(!(null1 > null2));
+    assert(!(null2 > null1));
+    assert(null1 != p);
+    assert(null1 !is p);
+    assert(p != null1);
+    assert(p !is null1);
+    assert(null1 <= p);
+    assert(p >= null2);
+    assert(p > null1);
+    assert(!(null1 > p));
+    return true;
+}
+static assert(nullptrcmp());
+
+/**************************************************
+ 10840 null pointer in dotvar
+**************************************************/
+
+struct Data10840
+{
+    bool xxx;
+}
+
+struct Bug10840
+{
+    Data10840* _data;
+}
+
+bool bug10840(int n)
+{
+    Bug10840 stack;
+    if (n == 1)
+    {
+        // detect deref through null pointer
+        return stack._data.xxx;
+    }
+    // Wrong-code for ?:
+    return stack._data ? false : true;
+}
+
+static assert(bug10840(0));
+static assert(!is(typeof(Compileable!(bug10840(1)))));
+
+/**************************************************
+  8216 ptr inside a pointer range
+**************************************************/
+
+// Four-pointer relations. Return true if [p1 .. p2] points inside [q1 .. q2]
+// (where the end points dont coincide).
+bool ptr4cmp(void* p1, void* p2, void* q1, void* q2)
+{
+// Each compare can be written with <, <=, >, or >=.
+// Either && or || can be used, giving 32 permutations.
+// Additionally each compare can be negated with !, yielding 128 in total.
+    bool b1 = (p1 > q1 && p2 <= q2);
+    bool b2 = (p1 > q1 && p2 < q2);
+    bool b3 = (p1 >= q1 && p2 <= q2);
+    bool b4 = (p1 >= q1 && p2 < q2);
+
+    bool b5 = (q1 <= p1 && q2 > p2);
+    bool b6 = (q1 <= p1 && q2 >= p2);
+    bool b7 = (p2 <= q2 && p1 > q1);
+    bool b8 = (!(p1 <= q1) && p2 <= q2);
+    bool b9 = (!(p1 <= q1) && !(p2 > q2));
+    bool b10 = (!!!(p1 <= q1) && !(p2 > q2));
+
+    assert(b1 == b2 && b1 == b3 && b1 == b4 && b1 == b5 && b1 == b6);
+    assert(b1 == b7 && b1 == b8 && b1 == b9 && b1 == b10);
+
+    bool c1 = (p1 <= q1 || p2 > q2);
+    assert(c1 == !b1);
+    bool c2 = (p1 < q1 || p2 >= q2);
+    bool c3 = (!(q1 <= p1) || !(q2 >= p2));
+    assert(c1 == c2 && c1 == c3);
+    return b1;
+}
+
+bool bug8216()
+{
+    int[4] a;
+    int[13] b;
+    int v;
+    int* p = &v;
+    assert(!ptr4cmp(&a[0], &a[3], p, p));
+    assert(!ptr4cmp(&b[2], &b[9], &a[1], &a[2]));
+    assert(!ptr4cmp(&b[1], &b[9], &b[2], &b[8]));
+    assert( ptr4cmp(&b[2], &b[8], &b[1], &b[9]));
+    return 1;
+}
+static assert(bug8216());
+
+/**************************************************
+  6517 ptr++, ptr--
+**************************************************/
+
+int bug6517()
+{
+    int[] arr = [1, 2, 3];
+    auto startp = arr.ptr;
+    auto endp = arr.ptr + arr.length;
+
+    for (; startp < endp; startp++) {}
+    startp = arr.ptr;
+    assert(startp++ == arr.ptr);
+    assert(startp != arr.ptr);
+    assert(startp-- != arr.ptr);
+    assert(startp == arr.ptr);
+
+    return 84;
+}
+static assert(bug6517() == 84);
+
+/**************************************************
+  Out-of-bounds pointer assignment and deference
+**************************************************/
+
+int ptrDeref(int ofs, bool wantDeref)
+{
+    int[5] a;
+    int* b = &a[0];
+    b = b + ofs; // OK
+    if (wantDeref)
+        return *b; // out of bounds
+    return 72;
+}
+
+static assert(!is(typeof(compiles!(ptrDeref(-1, true)))));
+static assert( is(typeof(compiles!(ptrDeref(4, true)))));
+static assert( is(typeof(compiles!(ptrDeref(5, false)))));
+static assert(!is(typeof(compiles!(ptrDeref(5, true)))));
+static assert(!is(typeof(compiles!(ptrDeref(6, false)))));
+static assert(!is(typeof(compiles!(ptrDeref(6, true)))));
+
+/**************************************************
+  Pointer +=
+**************************************************/
+static assert({
+    int[12] x;
+    int zzz;
+    assert(&zzz);
+    int* p = &x[10];
+    int* q = &x[4];
+    q = p;
+    assert(p == q);
+    q = &x[4];
+    assert(p != q);
+    q += 4;
+    assert(q == &x[8]);
+    q = q - 2;
+    q = q + 4;
+    assert(q is p);
+    return 6;
+}() == 6);
+
+/**************************************************
+  Reduced version of bug 5615
+**************************************************/
+
+const(char)[] passthrough(const(char)[] x)
+{
+    return x;
+}
+
+sizediff_t checkPass(Char1)(const(Char1)[] s)
+{
+    const(Char1)[] balance = s[1 .. $];
+    return passthrough(balance).ptr - s.ptr;
+}
+static assert(checkPass("foobar") == 1);
+
+/**************************************************
+  Pointers must not escape from CTFE
+**************************************************/
+
+struct Toq
+{
+    const(char)* m;
+}
+
+Toq ptrRet(bool b)
+{
+    string x = "abc";
+    return Toq(b ? x[0 .. 1].ptr : null);
+}
+
+static assert(is(typeof(compiles!({
+    enum Toq boz = ptrRet(false); // OK - ptr is null
+    Toq z = ptrRet(true); // OK -- ptr doesn't escape
+    return 4;
+}()
+))));
+
+static assert(!is(typeof(compiles!({
+    enum Toq boz = ptrRet(true); // fail - ptr escapes
+    return 4;
+}()
+))));
+
+/**************************************************
+    Pointers to struct members
+**************************************************/
+
+struct Qoz
+{
+    int w;
+    int[3] yof;
+}
+
+static assert({
+    int[3] gaz;
+    gaz[2] = 3156;
+    Toq z = ptrRet(true);
+    auto p = z.m;
+    assert(*z.m == 'a');
+    assert(*p == 'a');
+    auto q = &z.m;
+    assert(*q == p);
+    assert(**q == 'a');
+    Qoz g = Qoz(2, [5, 6, 7]);
+    auto r = &g.w;
+    assert(*r == 2);
+    r = &g.yof[1];
+    assert(*r == 6);
+    g.yof[0] = 15;
+    ++r;
+    assert(*r == 7);
+    r -= 2;
+    assert(*r == 15);
+    r = &gaz[0];
+    r += 2;
+    assert(*r == 3156);
+    return *p;
+}() == 'a');
+
+struct AList
+{
+    AList* next;
+    int value;
+    static AList* newList()
+    {
+        AList[] z = new AList[1];
+        return &z[0];
+    }
+    static AList* make(int i, int j)
+    {
+        auto r = newList();
+        r.next = (new AList[1]).ptr;
+        r.value = 1;
+        AList* z = r.next;
+        (*z).value = 2;
+        r.next.value = j;
+        assert(r.value == 1);
+        assert(r.next.value == 2);
+        r.next.next = &(new AList[1])[0];
+        assert(r.next.next != null);
+        assert(r.next.next);
+        r.next.next.value = 3;
+        assert(r.next.next.value == 3);
+        r.next.next = newList();
+        r.next.next.value = 9;
+        return r;
+    }
+    static int checkList()
+    {
+        auto r = make(1,2);
+        assert(r.value == 1);
+        assert(r.next.value == 2);
+        assert(r.next.next.value == 9);
+        return 2;
+    }
+}
+
+static assert(AList.checkList() == 2);
+
+/**************************************************
+    7194 pointers as struct members
+**************************************************/
+
+struct S7194 { int* p, p2; }
+
+int f7194()
+{
+    assert(S7194().p == null);
+    assert(!S7194().p);
+    assert(S7194().p == S7194().p2);
+    S7194 s = S7194();
+    assert(!s.p);
+    assert(s.p == null);
+    assert(s.p == s.p2);
+    int x;
+    s.p = &x;
+    s.p2 = s.p;
+    assert(s.p == &x);
+    return 0;
+}
+
+int g7194()
+{
+    auto s = S7194();
+    assert(s.p);  // should fail
+    return 0;
+}
+
+static assert(f7194() == 0);
+static assert(!is(typeof(compiles!(g7194()))));
+
+/**************************************************
+    7248 recursive struct pointers in array
+**************************************************/
+
+struct S7248 { S7248* ptr; }
+
+bool bug7248()
+{
+    S7248[2] sarr;
+    sarr[0].ptr = &sarr[1];
+    sarr[0].ptr = null;
+    S7248* t = sarr[0].ptr;
+    return true;
+}
+static assert(bug7248());
+
+/**************************************************
+    7216 calling a struct pointer member
+**************************************************/
+
+struct S7216
+{
+    S7216* p;
+    int t;
+
+    void f() { }
+    void g() { ++t; }
+}
+
+bool bug7216()
+{
+    S7216 s0, s1;
+    s1.t = 6;
+    s0.p = &s1;
+    s0.p.f();
+    s0.p.g();
+    assert(s1.t == 7);
+    return true;
+}
+
+static assert(bug7216());
+
+/**************************************************
+    10858 Wrong code with array of pointers
+**************************************************/
+
+bool bug10858()
+{
+    int*[4] x;
+    x[0] = null;
+    assert(x[0] == null);
+    return true;
+}
+static assert(bug10858());
+
+/**************************************************
+    12528 - painting inout type for value type literals
+**************************************************/
+
+inout(T)[] dup12528(T)(inout(T)[] a)
+{
+    inout(T)[] res;
+    foreach (ref e; a)
+        res ~= e;
+    return res;
+}
+
+enum arr12528V1 = dup12528([0]);
+enum arr12528V2 = dup12528([0, 1]);
+static assert(arr12528V1 == [0]);
+static assert(arr12528V2 == [0, 1]);
+
+/**************************************************
+    9745 Allow pointers to static variables
+**************************************************/
+
+shared int x9745;
+shared int[5] y9745;
+
+shared(int)* bug9745(int m)
+{
+    auto k = &x9745;
+    auto j = &x9745;
+    auto p = &y9745[0];
+    auto q = &y9745[3];
+    assert(j - k == 0);
+    assert(j == k);
+    assert(q - p == 3);
+    --q;
+    int a = 0;
+    assert(p + 2 == q);
+    if (m == 7)
+    {
+        auto z1 = y9745[0 .. 2]; // slice global pointer
+    }
+    if (m == 8)
+        p[1] = 7; // modify through a pointer
+    if (m == 9)
+         a = p[1]; // read from a pointer
+    if (m == 0)
+        return &x9745;
+    return &y9745[1];
+}
+
+int test9745(int m)
+{
+    bug9745(m);
+    // type painting
+    shared int* w = bug9745(0);
+    return 1;
+}
+
+shared int* w9745a = bug9745(0);
+shared int* w9745b = bug9745(1);
+static assert( is(typeof(compiles!(test9745(6)))));
+static assert(!is(typeof(compiles!(test9745(7)))));
+static assert(!is(typeof(compiles!(test9745(8)))));
+static assert(!is(typeof(compiles!(test9745(9)))));
+
+// pointers cast from an absolute address
+// (mostly applies to fake pointers, eg Windows HANDLES)
+bool test9745b()
+{
+    void* b6 = cast(void*)0xFEFEFEFE;
+    void* b7 = cast(void*)0xFEFEFEFF;
+    assert(b6 is b6);
+    assert(b7 != b6);
+    return true;
+}
+static assert(test9745b());
+
+/**************************************************
+    9364 ICE with pointer to local struct
+**************************************************/
+
+struct S9364
+{
+    int i;
+}
+
+bool bug9364()
+{
+    S9364 s;
+    auto k = (&s).i;
+    return 1;
+}
+
+static assert(bug9364());
+
+/**************************************************
+    10251 Pointers to const globals
+**************************************************/
+
+static const int glob10251 = 7;
+
+const(int)* bug10251()
+{
+   return &glob10251;
+}
+
+static a10251 = &glob10251; //  OK
+static b10251 = bug10251();
+
+/**************************************************
+    4065 [CTFE] AA "in" operator doesn't work
+**************************************************/
+
+bool bug4065(string s)
+{
+    enum int[string] aa = ["aa":14, "bb":2];
+    int* p = s in aa;
+    if (s == "aa")
+        assert(*p == 14);
+    else if (s == "bb")
+        assert(*p == 2);
+    else
+        assert(!p);
+    int[string] zz;
+    assert(!("xx" in zz));
+    bool c = !p;
+    return cast(bool)(s in aa);
+}
+
+static assert(!bug4065("xx"));
+static assert( bug4065("aa"));
+static assert( bug4065("bb"));
+
+/**************************************************
+    12689 - assigning via pointer from 'in' expression
+**************************************************/
+
+int g12689()
+{
+    int[int] aa;
+    aa[1] = 13;
+    assert(*(1 in aa) == 13);
+    *(1 in aa) = 42;
+    return aa[1];
+}
+static assert(g12689() == 42);
+
+/**************************************************
+    Pointers in ? :
+**************************************************/
+
+static assert({
+    int[2] x;
+    int* p = &x[1];
+    return p ? true: false;
+}());
+
+/**************************************************
+    Pointer slicing
+**************************************************/
+
+int ptrSlice()
+{
+    auto arr = new int[5];
+    int* x = &arr[0];
+    int[] y = x[0 .. 5];
+    x[1 .. 3] = 6;
+    ++x;
+    x[1 .. 3] = 14;
+    assert(arr[1] == 6);
+    assert(arr[2] == 14);
+    //x[-1 .. 4] = 5;   // problematic because negative lower boundary will throw RangeError in runtime
+    (x - 1)[0 .. 3] = 5;
+    int[] z = arr[1 .. 2];
+    z.length = 4;
+    z[$ - 1] = 17;
+    assert(arr.length == 5);
+    return 2;
+}
+static assert(ptrSlice() == 2);
+
+/**************************************************
+    6344 - create empty slice from null pointer
+**************************************************/
+
+static assert({
+    char* c = null;
+    auto m = c[0 .. 0];
+    return true;
+}());
+
+/**************************************************
+    8365 - block assignment of enum arrays
+**************************************************/
+
+enum E8365 { first = 7, second, third, fourth }
+static assert({ E8365[2]       x; return x[0];       }() == E8365.first);
+static assert({ E8365[2][2]    x; return x[0][0];    }() == E8365.first);
+static assert({ E8365[2][2][2] x; return x[0][0][0]; }() == E8365.first);
+
+/**************************************************
+    4448 - labelled break + continue
+**************************************************/
+
+int bug4448()
+{
+    int n = 2;
+L1:
+    do
+    {
+        switch(n)
+        {
+        case 5:
+            return 7;
+        default:
+            n = 5;
+            break L1;
+        }
+        int w = 7;
+    } while (0);
+    return 3;
+}
+static assert(bug4448() == 3);
+
+int bug4448b()
+{
+    int n = 2;
+L1:
+    for (n = 2; n < 5; ++n)
+    {
+        for (int m = 1; m < 6; ++m)
+        {
+            if (n < 3)
+            {
+                assert(m == 1);
+                continue L1;
+            }
+        }
+        break;
+    }
+    return 3;
+}
+static assert(bug4448b() == 3);
+
+/**************************************************
+    6985 - non-constant case
+**************************************************/
+
+int bug6985(int z)
+{
+    int q = z * 2 - 6;
+    switch(z)
+    {
+    case q:
+        q = 87;
+        break;
+    default:
+    }
+    return q;
+}
+static assert(bug6985(6) == 87);
+
+/**************************************************
+    6281 - [CTFE] A null pointer '!is null' returns 'true'
+**************************************************/
+
+static assert(!{
+    auto p = null;
+    return p !is null;
+}());
+
+static assert(!{
+    auto p = null;
+    return p != null;
+}());
+
+/**************************************************
+    6331 - evaluate SliceExp on if condition
+**************************************************/
+
+bool bug6331(string s)
+{
+    if (s[0 .. 1])
+        return true;
+    return false;
+}
+static assert(bug6331("str"));
+
+/**************************************************
+    6283 - assign to AA with slice as index
+**************************************************/
+
+static assert({
+    immutable p = "pp";
+    int[string] pieces = [p: 0];
+    pieces["qq"] = 1;
+    return true;
+}());
+
+static assert({
+    immutable renames = [0: "pp"];
+    int[string] pieces;
+    pieces[true ? renames[0] : "qq"] = 1;
+    pieces["anything"] = 1;
+    return true;
+}());
+
+static assert({
+    immutable qq = "qq";
+    string q = qq;
+    int[string] pieces = ["a":1];
+    pieces[q] = 0;
+    string w = "ab";
+    int z = pieces[w[0 .. 1]];
+    assert(z == 1);
+    return true;
+}());
+
+/**************************************************
+    6282 - dereference 'in' of an AA
+**************************************************/
+
+static assert({
+    int[] w = new int[4];
+    w[2] = 6;
+    auto c = [5: w];
+    auto kk  = (*(5 in c))[2];
+    (*(5 in c))[2] = 8;
+    (*(5 in c))[1 .. $ - 2] = 4;
+    auto a = [4:"1"];
+    auto n = *(4 in a);
+    return n;
+}() == "1");
+
+/**************************************************
+    6337 - member function call on struct literal
+**************************************************/
+
+struct Bug6337
+{
+    int k;
+    void six()
+    {
+        k = 6;
+    }
+    int ctfe()
+    {
+        six();
+        return k;
+    }
+}
+static assert(Bug6337().ctfe() == 6);
+
+/**************************************************
+    6603 call manifest function pointer
+**************************************************/
+
+int f6603(int a) { return a + 5; }
+enum bug6603 = &f6603;
+static assert(bug6603(6) == 11);
+
+/**************************************************
+    6375
+**************************************************/
+
+struct D6375
+{
+    int[] arr;
+}
+A6375 a6375(int[] array)
+{
+    return A6375(array);
+}
+struct A6375
+{
+    D6375* _data;
+    this(int[] arr)
+    {
+        _data = new D6375;
+        _data.arr = arr;
+    }
+    int[] data()
+    {
+        return _data.arr;
+    }
+}
+static assert({
+    int[] a = [1, 2];
+    auto app2 = a6375(a);
+    auto data = app2.data();
+    return true;
+}());
+
+/**************************************************
+    6280 Converting pointers to bool
+**************************************************/
+
+static assert({
+    if ((0 in [0:0])) {}
+    if ((0 in [0:0]) && (0 in [0:0])) {}
+    return true;
+}());
+
+/**************************************************
+    6276 ~=
+**************************************************/
+
+struct Bug6276
+{
+    int[] i;
+}
+static assert({
+    Bug6276 foo;
+    foo.i ~= 1;
+    foo.i ~= 2;
+    return true;
+}());
+
+/**************************************************
+    6374   ptr[n] = x, x = ptr[n]
+**************************************************/
+
+static assert({
+    int[] arr = [1];
+    arr.ptr[0] = 2;
+    auto k = arr.ptr[0];
+    assert(k == 2);
+    return arr[0];
+}() == 2);
+
+/**************************************************
+    6306  recursion and local variables
+**************************************************/
+
+void recurse6306()
+{
+    bug6306(false);
+}
+
+bool bug6306(bool b)
+{
+    int x = 0;
+    if (b)
+        recurse6306();
+    assert(x == 0);
+    x = 1;
+    return true;
+}
+static assert(bug6306(true));
+
+/**************************************************
+    6386  ICE on unsafe pointer cast
+**************************************************/
+
+static assert(!is(typeof(compiles!({
+    int x = 123;
+    int* p = &x;
+    float z;
+    float* q = cast(float*)p;
+    return true;
+}()
+))));
+
+static assert({
+    int[] x = [123, 456];
+    int* p = &x[0];
+    auto m = cast(const(int)*)p;
+    auto q = p;
+    return *q;
+}());
+
+/**************************************************
+    6420  ICE on dereference of invalid pointer
+**************************************************/
+
+static assert({
+    // Should compile, but pointer can't be dereferenced
+    int x = 123;
+    int* p = cast(int*)x;
+    auto q = cast(char*)x;
+    auto r = cast(char*)323;
+    // Valid const-changing cast
+    const float *m = cast(immutable float*)[1.2f,2.4f,3f];
+    return true;
+}()
+);
+
+static assert(!is(typeof(compiles!({
+    int x = 123;
+    int* p = cast(int*)x;
+    int a = *p;
+    return true;
+}()
+))));
+
+static assert(!is(typeof(compiles!({
+    int* p = cast(int*)123;
+    int a = *p;
+    return true;
+}()
+))));
+
+static assert(!is(typeof(compiles!({
+    auto k = cast(int*)45;
+    *k = 1;
+    return true;
+}()
+))));
+
+static assert(!is(typeof(compiles!({
+    *cast(float*)"a" = 4.0;
+    return true;
+}()
+))));
+
+static assert(!is(typeof(compiles!({
+    float f = 2.8;
+    long *p = &f;
+    return true;
+}()
+))));
+
+static assert(!is(typeof(compiles!({
+    long *p = cast(long*)[1.2f, 2.4f, 3f];
+    return true;
+}()
+))));
+
+/**************************************************
+    6250  deref pointers to array
+**************************************************/
+
+int[]* simple6250(int[]* x) { return x; }
+
+void swap6250(int[]* lhs, int[]* rhs)
+{
+    int[] kk = *lhs;
+    assert(simple6250(lhs) == lhs);
+    lhs = simple6250(lhs);
+    assert(kk[0] == 18);
+    assert((*lhs)[0] == 18);
+    assert((*rhs)[0] == 19);
+    *lhs = *rhs;
+    assert((*lhs)[0] == 19);
+    *rhs = kk;
+    assert(*rhs == kk);
+    assert(kk[0] == 18);
+    assert((*rhs)[0] == 18);
+}
+
+int ctfeSort6250()
+{
+     int[][2] x;
+     int[3] a = [17, 18, 19];
+     x[0] = a[1 .. 2];
+     x[1] = a[2 .. $];
+     assert(x[0][0] == 18);
+     assert(x[0][1] == 19);
+     swap6250(&x[0], &x[1]);
+     assert(x[0][0] == 19);
+     assert(x[1][0] == 18);
+     a[1] = 57;
+     assert(x[0][0] == 19);
+     return x[1][0];
+}
+
+static assert(ctfeSort6250() == 57);
+
+/**************************************************
+    6672 circular references in array
+**************************************************/
+
+void bug6672(ref string lhs, ref string rhs)
+{
+    auto tmp = lhs;
+    lhs = rhs;
+    rhs = tmp;
+}
+
+static assert({
+    auto kw = ["a"];
+    bug6672(kw[0], kw[0]);
+    return true;
+}());
+
+void slice6672(ref string[2] agg, ref string lhs)
+{
+    agg[0 .. $] = lhs;
+}
+
+static assert({
+    string[2] kw = ["a", "b"];
+    slice6672(kw, kw[0]);
+    assert(kw[0] == "a");
+    assert(kw[1] == "a");
+    return true;
+}());
+
+// an unrelated rejects-valid bug
+static assert({
+    string[2] kw = ["a", "b"];
+    kw[0 .. 2] = "x";
+    return true;
+}());
+
+void bug6672b(ref string lhs, ref string rhs)
+{
+    auto tmp = lhs;
+    assert(tmp == "a");
+    lhs = rhs;
+    assert(tmp == "a");
+    rhs = tmp;
+}
+
+static assert({
+    auto kw=["a", "b"];
+    bug6672b(kw[0], kw[1]);
+    assert(kw[0] == "b");
+    assert(kw[1] == "a");
+    return true;
+}());
+
+/**************************************************
+    6399 (*p).length = n
+**************************************************/
+
+struct A6399
+{
+    int[] arr;
+    int subLen()
+    {
+        arr = [1, 2, 3, 4, 5];
+        arr.length -= 1;
+        return cast(int)arr.length;
+    }
+}
+
+static assert({
+    A6399 a;
+    return a.subLen();
+}() == 4);
+
+/**************************************************
+    7789 (*p).length++ where *p is null
+**************************************************/
+
+struct S7789
+{
+    size_t foo()
+    {
+        _ary.length += 1;
+        return _ary.length;
+    }
+
+    int[] _ary;
+}
+
+static assert(S7789().foo());
+
+/**************************************************
+    6418 member named 'length'
+**************************************************/
+
+struct Bug6418
+{
+    size_t length() { return 189; }
+}
+static assert(Bug6418.init.length == 189);
+
+/**************************************************
+    4021 rehash
+**************************************************/
+
+bool bug4021()
+{
+    int[int] aa = [1: 1];
+    aa.rehash;
+    return true;
+}
+static assert(bug4021());
+
+/**************************************************
+    11629 crash on AA.rehash
+**************************************************/
+
+struct Base11629
+{
+    alias T = ubyte, Char = char;
+    alias String = immutable(Char)[];
+
+    const Char[T] toChar;
+
+    this(int _dummy)
+    {
+        Char[T] toCharTmp = [0:'A'];
+
+        toChar = toCharTmp.rehash;
+    }
+}
+enum ct11629 = Base11629(4);
+
+/**************************************************
+    3512 foreach (dchar; string)
+    6558 foreach (int, dchar; string)
+**************************************************/
+
+bool test3512()
+{
+    string s = "öhai";
+    int q = 0;
+
+    foreach (wchar c; s)
+    {
+        if (q == 2)
+            assert(c == 'a');
+        ++q;
+    }
+    assert(q == 4);
+
+    // _aApplycd1
+    foreach (dchar c; s)
+    {
+        ++q;
+        if (c == 'h')
+            break;
+    }
+    assert(q == 6);
+
+    // _aApplycw2
+    foreach (int i, wchar c; s)
+    {
+        assert(i >= 0 && i < s.length);
+    }
+
+    // _aApplycd2
+    foreach (int i, dchar c; s)
+    {
+        assert(i >= 0 && i < s.length);
+    }
+
+    wstring w = "xüm";
+
+    // _aApplywc1
+    foreach (char c; w)
+    {
+        ++q;
+    }
+    assert(q == 10);
+
+    // _aApplywd1
+    foreach (dchar c; w)
+    {
+        ++q;
+    }
+    assert(q == 13);
+
+    // _aApplywc2
+    foreach (int i, char c; w)
+    {
+        assert(i >= 0 && i < w.length);
+    }
+
+    // _aApplywd2
+    foreach (int i, dchar c; w)
+    {
+        assert(i >= 0 && i < w.length);
+    }
+
+    dstring d = "yäq";
+
+    // _aApplydc1
+    q = 0;
+    foreach (char c; d)
+    {
+        ++q;
+    }
+    assert(q == 4);
+
+    // _aApplydw1
+    q = 0;
+    foreach (wchar c; d)
+    {
+        ++q;
+    }
+    assert(q == 3);
+
+    // _aApplydc2
+    foreach (int i, char c; d)
+    {
+        assert(i >= 0 && i < d.length);
+    }
+    // _aApplydw2
+    foreach (int i, wchar c; d)
+    {
+        assert(i >= 0 && i < d.length);
+    }
+
+    dchar[] dr = "squop"d.dup;
+
+    foreach (int n, char c; dr)
+    {
+        if (n == 2)
+            break;
+        assert(c != 'o');
+    }
+
+    // _aApplyRdc1
+    foreach_reverse (char c; dr)
+    {}
+
+    // _aApplyRdw1
+    foreach_reverse (wchar c; dr)
+    {}
+
+    // _aApplyRdc2
+    foreach_reverse (int n, char c; dr)
+    {
+        if (n == 4)
+            break;
+        assert(c != 'o');
+    }
+
+    // _aApplyRdw2
+    foreach_reverse (int i, wchar c; dr)
+    {
+        assert(i >= 0 && i < dr.length);
+    }
+
+    q = 0;
+    wstring w2 = ['x', 'ü', 'm']; // foreach over array literals
+    foreach_reverse (int n, char c; w2)
+    {
+        ++q;
+        if (c == 'm') assert(n == 2 && q == 1);
+        if (c == 'x') assert(n == 0 && q == 4);
+    }
+    return true;
+}
+static assert(test3512());
+
+/**************************************************
+    6510 ICE only with -inline
+**************************************************/
+
+struct Stack6510
+{
+    struct Proxy
+    {
+        void shrink() {}
+    }
+    Proxy stack;
+    void pop()
+    {
+        stack.shrink();
+    }
+}
+
+int bug6510()
+{
+    static int used()
+    {
+        Stack6510 junk;
+        junk.pop();
+        return 3;
+    }
+    return used();
+}
+
+void test6510()
+{
+    static assert(bug6510() == 3);
+}
+
+/**************************************************
+    6511   arr[] shouldn't make a copy
+**************************************************/
+
+T bug6511(T)()
+{
+    T[1] a = [1];
+    a[] += a[];
+    return a[0];
+}
+static assert(bug6511!ulong() == 2);
+static assert(bug6511!long() == 2);
+
+/**************************************************
+    6512   new T[][]
+**************************************************/
+
+bool bug6512(int m)
+{
+    auto x = new int[2][][](m, 5);
+    assert(x.length == m);
+    assert(x[0].length == 5);
+    assert(x[0][0].length == 2);
+    foreach (i; 0.. m)
+        foreach (j; 0 .. 5)
+            foreach (k; 0 .. 2)
+                x[i][j][k] = k + j*10 + i*100;
+    foreach (i; 0.. m)
+        foreach (j; 0 .. 5)
+            foreach (k; 0 .. 2)
+                assert(x[i][j][k] == k + j*10 + i*100);
+    return true;
+}
+static assert(bug6512(3));
+
+/**************************************************
+    6516   ICE(constfold.c)
+**************************************************/
+
+dstring bug6516()
+{
+    return cast(dstring)new dchar[](0);
+}
+
+static assert(bug6516() == ""d);
+
+/**************************************************
+    6727   ICE(interpret.c)
+**************************************************/
+
+const(char)* ice6727(const(char)* z) { return z; }
+static assert({
+    auto q = ice6727("a".dup.ptr);
+    return true;
+}());
+
+/**************************************************
+    6721   Cannot get pointer to start of char[]
+**************************************************/
+
+static assert({
+    char[] c1 = "".dup;
+    auto p = c1.ptr;
+    string c2 = "";
+    auto p2 = c2.ptr;
+    return 6;
+}() == 6);
+
+/**************************************************
+    6693   Assign to null AA
+**************************************************/
+
+struct S6693
+{
+    int[int] m;
+}
+
+static assert({
+    int[int][int] aaa;
+    aaa[3][1] = 4;
+    int[int][3] aab;
+    aab[2][1] = 4;
+    S6693 s;
+    s.m[2] = 4;
+    return 6693;
+}() == 6693);
+
+/**************************************************
+    7602   Segfault AA.keys on null AA
+**************************************************/
+
+string[] test7602()
+{
+    int[string] array;
+    return array.keys;
+}
+
+enum bug7602 = test7602();
+
+/**************************************************
+    6739   Nested AA assignment
+**************************************************/
+
+static assert({
+    int[int][int][int] aaa;
+    aaa[3][1][6] = 14;
+    return aaa[3][1][6];
+}() == 14);
+
+static assert({
+    int[int][int] aaa;
+    aaa[3][1] = 4;
+    aaa[3][3] = 3;
+    aaa[1][5] = 9;
+    auto kk = aaa[1][5];
+    return kk;
+}() == 9);
+
+/**************************************************
+    6751   ref AA assignment
+**************************************************/
+
+void bug6751(ref int[int] aa)
+{
+    aa[1] = 2;
+}
+
+static assert({
+    int[int] aa;
+    bug6751(aa);
+    assert(aa[1] == 2);
+    return true;
+}());
+
+void bug6751b(ref int[int][int] aa)
+{
+    aa[1][17] = 2;
+}
+
+struct S6751
+{
+    int[int][int] aa;
+    int[int] bb;
+}
+
+static assert({
+    S6751 s;
+    bug6751b(s.aa);
+    assert(s.aa[1][17] == 2);
+    return true;
+}());
+
+static assert({
+    S6751 s;
+    s.aa[7][56] = 57;
+    bug6751b(s.aa);
+    assert(s.aa[1][17] == 2);
+    assert(s.aa[7][56] == 57);
+    bug6751c(s.aa);
+    assert(s.aa.keys.length == 1);
+    assert(s.aa.values.length == 1);
+    return true;
+}());
+
+static assert({
+    S6751 s;
+    s.bb[19] = 97;
+    bug6751(s.bb);
+    assert(s.bb[1] == 2);
+    assert(s.bb[19] == 97);
+    return true;
+}());
+
+void bug6751c(ref int[int][int] aa)
+{
+    aa = [38: [56 : 77]];
+}
+
+/**************************************************
+   7790   AA foreach ref
+**************************************************/
+
+struct S7790
+{
+    size_t id;
+}
+
+size_t bug7790(S7790[string] tree)
+{
+    foreach (k, ref v; tree)
+        v.id = 1;
+    return tree["a"].id;
+}
+
+static assert(bug7790(["a":S7790(0)]) == 1);
+
+/**************************************************
+    6765   null AA.length
+**************************************************/
+
+static assert({
+    int[int] w;
+    return w.length;
+}() == 0);
+
+/**************************************************
+    6769   AA.keys, AA.values with -inline
+**************************************************/
+
+static assert({
+    double[char[3]] w = ["abc" : 2.3];
+    double[] z = w.values;
+    return w.keys.length;
+}() == 1);
+
+/**************************************************
+    4022   AA.get
+**************************************************/
+
+static assert({
+    int[int] aa = [58: 13];
+    int r = aa.get(58, 1000);
+    assert(r == 13);
+    r = aa.get(59, 1000);
+    return r;
+}() == 1000);
+
+/**************************************************
+    6775 AA.opApply
+**************************************************/
+
+static assert({
+    int[int] aa = [58: 17, 45:6];
+    int valsum = 0;
+    int keysum = 0;
+    foreach (m; aa)  // aaApply
+    {
+        valsum += m;
+    }
+    assert(valsum == 17 + 6);
+    valsum = 0;
+    foreach (n, m; aa)  // aaApply2
+    {
+        valsum += m;
+        keysum += n;
+    }
+    assert(valsum == 17 + 6);
+    assert(keysum == 58 + 45);
+    // Check empty AA
+    valsum = 0;
+    int[int] bb;
+    foreach (m; bb)
+    {
+        ++valsum;
+    }
+    assert(valsum == 0);
+    return true;
+}());
+
+/**************************************************
+    7890   segfault struct with AA field
+**************************************************/
+
+struct S7890
+{
+    int[int] tab;
+}
+
+S7890 bug7890()
+{
+    S7890 foo;
+    foo.tab[0] = 0;
+    return foo;
+}
+
+enum e7890 = bug7890();
+
+/**************************************************
+    AA.remove
+**************************************************/
+
+static assert({
+    int[int] aa = [58: 17, 45:6];
+    aa.remove(45);
+    assert(aa.length == 1);
+    aa.remove(7);
+    assert(aa.length == 1);
+    aa.remove(58);
+    assert(aa.length == 0);
+    return true;
+}());
+
+/**************************************************
+    try, finally
+**************************************************/
+
+static assert({
+    int n = 0;
+
+    try
+    {
+        n = 1;
+    }
+    catch (Exception e)
+    {}
+    assert(n == 1);
+
+    try
+    {
+        n = 2;
+    }
+    catch (Exception e)
+    {}
+    finally
+    {
+        assert(n == 2);
+        n = 3;
+    }
+    assert(n == 3);
+    return true;
+}());
+
+/**************************************************
+    6800 bad pointer casts
+**************************************************/
+
+bool badpointer(int k)
+{
+    int m = 6;
+    int* w =  &m;
+    assert(*w == 6);
+    int[3] a = [17, 2, 21];
+    int* w2 = &a[2];
+    assert(*w2 == 21);
+
+    // cast int* to uint* is OK
+    uint* u1 = cast(uint*)w;
+    assert(*u1 == 6);
+    uint* u2 = cast(uint*)w2;
+    assert(*u2 == 21);
+    uint* u3 = cast(uint*)&m;
+    assert(*u3 == 6);
+    // cast int* to void* is OK
+    void* v1 = cast(void*)w;
+    void* v3 = &m;
+    void* v4 = &a[0];
+    // cast from void* back to int* is OK
+    int* t3 = cast(int*)v3;
+    assert(*t3 == 6);
+    int* t4 = cast(int*)v4;
+    assert(*t4 == 17);
+    // cast from void* to uint* is OK
+    uint* t1 = cast(uint*)v1;
+    assert(*t1 == 6);
+    // and check that they're real pointers
+    m = 18;
+    assert(*t1 == 18);
+    assert(*u3 == 18);
+
+    int** p = &w;
+
+    if (k == 1) // bad reinterpret
+        double *d1 = cast(double*)w;
+    if (k == 3) // bad reinterpret
+        char* d3 = cast(char*)w2;
+    if (k == 4) {
+        void* q1 = cast(void*)p;    // OK-void is int*
+        void* *q = cast(void**)p;   // OK-void is int
+    }
+    if (k == 5)
+        void*** q = cast(void***)p;  // bad: too many *
+    if (k == 6) // bad reinterpret through void*
+        double* d1 = cast(double*)v1;
+    if (k == 7)
+        double* d7 = cast(double*)v4;
+    if (k == 8)
+        ++v4; // can't do pointer arithmetic on void*
+    return true;
+}
+static assert(badpointer(4));
+static assert(!is(typeof(compiles!(badpointer(1)))));
+static assert( is(typeof(compiles!(badpointer(2)))));
+static assert(!is(typeof(compiles!(badpointer(3)))));
+static assert( is(typeof(compiles!(badpointer(4)))));
+static assert(!is(typeof(compiles!(badpointer(5)))));
+static assert(!is(typeof(compiles!(badpointer(6)))));
+static assert(!is(typeof(compiles!(badpointer(7)))));
+static assert(!is(typeof(compiles!(badpointer(8)))));
+
+/**************************************************
+    10211 Allow casts S**->D**, when S*->D* is OK
+**************************************************/
+
+int bug10211()
+{
+    int m = 7;
+    int* x = &m;
+    int** y = &x;
+    assert(**y == 7);
+    uint* p = cast(uint*)x;
+    uint** q = cast(uint**)y;
+    return 1;
+}
+
+static assert(bug10211());
+
+/**************************************************
+    10568 CTFE rejects function pointer safety casts
+**************************************************/
+
+@safe void safetyDance() {}
+
+int isItSafeToDance()
+{
+    void function() @trusted yourfriends = &safetyDance;
+    void function() @safe nofriendsOfMine = yourfriends;
+    return 1;
+}
+
+static assert(isItSafeToDance());
+
+/**************************************************
+    12296 CTFE rejects const compatible AA pointer cast
+**************************************************/
+
+int test12296()
+{
+    immutable x = [5 : 4];
+    auto aa = &x;
+    const(int[int])* y = aa;
+    return 1;
+}
+static assert(test12296());
+
+/**************************************************
+    9170 Allow reinterpret casts float<->int
+**************************************************/
+
+int f9170(float x)
+{
+    return *(cast(int*)&x);
+}
+
+float i9170(int x)
+{
+    return *(cast(float*)&x);
+}
+
+float u9170(uint x)
+{
+    return *(cast(float*)&x);
+}
+
+int f9170arr(float[] x)
+{
+    return *(cast(int*)&(x[1]));
+}
+
+long d9170(double x)
+{
+    return *(cast(long*)&x);
+}
+
+int fref9170(ref float x)
+{
+    return *(cast(int*)&x);
+}
+
+long dref9170(ref double x)
+{
+    return *(cast(long*)&x);
+}
+
+bool bug9170()
+{
+    float f = 1.25;
+    double d = 1.25;
+    assert(f9170(f) == 0x3FA0_0000);
+    assert(fref9170(f) == 0x3FA0_0000);
+    assert(d9170(d) == 0x3FF4_0000_0000_0000L);
+    assert(dref9170(d) == 0x3FF4_0000_0000_0000L);
+    float [3] farr = [0, 1.25, 0];
+    assert(f9170arr(farr) == 0x3FA0_0000);
+    int i = 0x3FA0_0000;
+    assert(i9170(i) == 1.25);
+    uint u = 0x3FA0_0000;
+    assert(u9170(u) == 1.25);
+    return true;
+}
+
+static assert(bug9170());
+
+/**************************************************
+    6792 ICE with pointer cast of indexed array
+**************************************************/
+
+struct S6792
+{
+    int i;
+}
+
+static assert({
+    {
+        void* p;
+        p = [S6792(1)].ptr;
+        S6792 s = *(cast(S6792*)p);
+        assert(s.i == 1);
+    }
+    {
+        void*[] ary;
+        ary ~= [S6792(2)].ptr;
+        S6792 s = *(cast(S6792*)ary[0]);
+        assert(s.i == 2);
+    }
+    {
+        void*[7] ary;
+        ary[6]= [S6792(2)].ptr;
+        S6792 s = *(cast(S6792*)ary[6]);
+        assert(s.i == 2);
+    }
+    {
+        void* p;
+        p = [S6792(1)].ptr;
+        void*[7] ary;
+        ary[5]= p;
+        S6792 s = *(cast(S6792*)ary[5]);
+        assert(s.i == 1);
+    }
+    {
+        S6792*[string] aa;
+        aa["key"] = [S6792(3)].ptr;
+        const(S6792) s = *(cast(const(S6792)*)aa["key"]);
+        assert(s.i == 3);
+    }
+    {
+        S6792[string] blah;
+        blah["abc"] = S6792(6);
+        S6792*[string] aa;
+        aa["kuy"] = &blah["abc"];
+        const(S6792) s = *(cast(const(S6792)*)aa["kuy"]);
+        assert(s.i == 6);
+
+        void*[7] ary;
+        ary[5]= &blah["abc"];
+        S6792 t = *(cast(S6792*)ary[5]);
+        assert(t.i == 6);
+
+        int q = 6;
+        ary[3]= &q;
+        int gg = *(cast(int*)(ary[3]));
+    }
+    return true;
+}());
+
+/**************************************************
+   7780 array cast
+**************************************************/
+
+int bug7780(int testnum)
+{
+    int[] y = new int[2];
+    y[0] = 2000000;
+    if (testnum == 1)
+    {
+        void[] x = y;
+        return (cast(byte[])x)[1];
+    }
+    if (testnum == 2)
+    {
+        int[] x = y[0 .. 1];
+        return (cast(byte[])x)[1];
+    }
+    return 1;
+}
+
+static assert( is(typeof(compiles!(bug7780(0)))));
+static assert(!is(typeof(compiles!(bug7780(1)))));
+static assert(!is(typeof(compiles!(bug7780(2)))));
+
+/**************************************************
+    14028 - static array pointer that refers existing array elements.
+**************************************************/
+
+int test14028a(size_t ofs)(bool ct)
+{
+    int[4] a;
+    int[2]* p;
+    int num = ofs;
+
+    if (ct)
+        p = cast(int[2]*)&a[ofs];    // SymOffExp
+    else
+        p = cast(int[2]*)&a[num];    // CastExp + AddrExp
+
+    // pointers comparison
+    assert(cast(void*)a.ptr <= cast(void*)p);
+    assert(cast(void*)a.ptr <= cast(void*)&(*p)[0]);
+    assert(cast(void*)&a[0] <= cast(void*)p);
+
+    return 1;
+}
+static assert(test14028a!0(true));
+static assert(test14028a!0(false));
+static assert(test14028a!3(true));
+static assert(test14028a!3(false));
+static assert(!is(typeof(compiles!(test14028a!4(true)))));
+static assert(!is(typeof(compiles!(test14028a!4(false)))));
+
+int test14028b(int num)
+{
+    int[4] a;
+    int[2]* p;
+
+    if (num == 1)
+    {
+        p = cast(int[2]*)&a[0]; // &a[0..2];
+        (*p)[0] = 1;            // a[0] = 1
+        (*p)[1] = 2;            // a[1] = 2
+        assert(a == [1,2,0,0]);
+        p = p + 1;              // &a[0] -> &a[2]
+        (*p)[0] = 3;            // a[2] = 3
+        (*p)[1] = 4;            // a[3] = 4
+        assert(a == [1,2,3,4]);
+    }
+    if (num == 2)
+    {
+        p = cast(int[2]*)&a[1]; // &a[1..3];
+        (*p)[0] = 1;            // a[1] = 1
+        p = p + 1;              // &a[1..3] -> &a[3..5]
+        (*p)[0] = 2;            // a[3] = 2
+        assert(a == [0,1,0,2]);
+    }
+    if (num == 3)
+    {
+        p = cast(int[2]*)&a[1]; // &a[1..3];
+        (*p)[0] = 1;            // a[1] = 1
+        p = p + 1;              // &a[1..3] -> &a[3..5]
+        (*p)[0] = 2;            // a[3] = 2
+        (*p)[1] = 3;            // a[4] = 3 (CTFE error)
+    }
+    if (num == 4)
+    {
+        p = cast(int[2]*)&a[0]; // &a[0..2];
+        p = p + 1;              // &a[0..2] -> &a[2..4]
+        p = p + 1;              // &a[2..4] -> &a[4..6] (ok)
+    }
+    if (num == 5)
+    {
+        p = cast(int[2]*)&a[1]; // &a[1..3];
+        p = p + 2;              // &a[1..3] -> &a[5..7] (CTFE error)
+    }
+    return 1;
+}
+static assert(test14028b(1));
+static assert(test14028b(2));
+static assert(!is(typeof(compiles!(test14028b(3)))));
+static assert(test14028b(4));
+static assert(!is(typeof(compiles!(test14028b(5)))));
+
+/**************************************************
+    10275 cast struct literals to immutable
+**************************************************/
+
+struct Bug10275
+{
+    uint[] ivals;
+}
+
+Bug10275 bug10275()
+{
+    return Bug10275([1, 2, 3]);
+}
+
+int test10275()
+{
+    immutable(Bug10275) xxx = cast(immutable(Bug10275))bug10275();
+    return 1;
+}
+
+static assert(test10275());
+
+/**************************************************
+    6851 passing pointer by argument
+**************************************************/
+
+void set6851(int* pn)
+{
+    *pn = 20;
+}
+void bug6851()
+{
+    int n = 0;
+    auto pn = &n;
+    *pn = 10;
+    assert(n == 10);
+    set6851(&n);
+}
+static assert({ bug6851(); return true; }());
+
+/**************************************************
+    7876
+**************************************************/
+
+int* bug7876(int n) @system
+{
+    int x;
+    auto ptr = &x;
+    if (n == 2)
+        ptr = null;
+    return ptr;
+}
+
+struct S7876
+{
+    int* p;
+}
+
+S7876 bug7876b(int n) @system
+{
+    int x;
+    S7876 s;
+    s.p = &x;
+    if (n == 11)
+        s.p = null;
+    return s;
+}
+
+int test7876(int n)
+{
+    if (n >= 10)
+    {
+        S7876 m = bug7876b(n);
+        return 1;
+    }
+    int* p = bug7876(n);
+    return 1;
+}
+
+static assert( is(typeof(compiles!(test7876(2)))));
+static assert(!is(typeof(compiles!(test7876(0)))));
+static assert( is(typeof(compiles!(test7876(11)))));
+static assert(!is(typeof(compiles!(test7876(10)))));
+
+/**************************************************
+    11824
+**************************************************/
+
+int f11824(T)()
+{
+    T[] arr = new T[](1);
+    T* getAddr(ref T a)
+    {
+        return &a;
+    }
+    getAddr(arr[0]);
+    return 1;
+}
+static assert(f11824!int());        // OK
+static assert(f11824!(int[])());    // OK <- NG
+
+/**************************************************
+    6817 if converted to &&, only with -inline
+**************************************************/
+
+static assert({
+    void toggle()
+    {
+        bool b;
+        if (b)
+            b = false;
+    }
+    toggle();
+    return true;
+}());
+
+/**************************************************
+    cast to void
+**************************************************/
+
+static assert({
+    cast(void)(71);
+    return true;
+}());
+
+/**************************************************
+    6816 nested function can't access this
+**************************************************/
+
+struct S6816
+{
+    size_t foo()
+    {
+        return (){ return value +1 ; }();
+    }
+    size_t value;
+}
+
+enum s6816 = S6816().foo();
+
+/**************************************************
+    7277 ICE nestedstruct.init.tupleof
+**************************************************/
+
+struct Foo7277
+{
+    int a;
+    int func()
+    {
+        int b;
+        void nested()
+        {
+            b = 7;
+            a = 10;
+        }
+        nested();
+        return a+b;
+    }
+}
+
+static assert(Foo7277().func() == 17);
+
+/**************************************************
+    10217 ICE. CTFE version of 9315
+**************************************************/
+
+bool bug10217()
+{
+    struct S
+    {
+        int i;
+        void bar() {}
+    }
+    auto yyy = S.init.tupleof[$ - 1];
+    assert(!yyy);
+    return 1;
+}
+
+static assert(bug10217());
+
+/**************************************************
+    8276 ICE
+**************************************************/
+
+void bug8676(int n)
+{
+    const int X1 = 4 + n;
+    const int X2 = 4;
+    int X3 = 4;
+    int bar1() { return X1; }
+    int bar2() { return X2; }
+    int bar3() { return X3; }
+    static assert(!is(typeof(compiles!(bar1()))));
+    static assert( is(typeof(compiles!(bar2()))));
+    static assert(!is(typeof(compiles!(bar3()))));
+}
+
+/**************************************************
+    classes and interfaces
+**************************************************/
+
+interface SomeInterface
+{
+    int daz();
+    float bar(char);
+    int baz();
+}
+
+interface SomeOtherInterface
+{
+    int xxx();
+}
+
+class TheBase : SomeInterface, SomeOtherInterface
+{
+    int q = 88;
+    int rad = 61;
+    int a = 14;
+    int somebaseclassfunc() { return 28; }
+    int daz() { return 0; }
+    int baz() { return 0; }
+    int xxx() { return 762; }
+    int foo() { return q; }
+    float bar(char c) { return 3.6; }
+}
+
+class SomeClass : TheBase, SomeInterface
+{
+    int gab = 9;
+    int fab;
+    int a = 17;
+    int b = 23;
+    override int foo() { return gab + a; }
+    override float bar(char c) { return 2.6; }
+    int something() { return 0; }
+    override int daz() { return 0; }
+    override int baz() { return 0; }
+}
+
+class Unrelated : TheBase
+{
+    this(int x) { a = x; }
+}
+
+auto classtest1(int n)
+{
+    SomeClass c = new SomeClass;
+    assert(c.a == 17);
+    assert(c.q == 88);
+    TheBase d = c;
+    assert(d.a == 14);
+    assert(d.q == 88);
+    if (n == 7)
+    {
+        // bad cast -- should fail
+        Unrelated u = cast(Unrelated)d;
+        assert(u is null);
+    }
+    SomeClass e = cast(SomeClass)d;
+    d.q = 35;
+    assert(c.q == 35);
+    assert(c.foo() == 9 + 17);
+    ++c.a;
+    assert(c.foo() == 9 + 18);
+    assert(d.foo() == 9 + 18);
+    d = new TheBase;
+    SomeInterface fc = c;
+    SomeOtherInterface ot = c;
+    assert(fc.bar('x') == 2.6);
+    assert(ot.xxx() == 762);
+    fc = d;
+    ot = d;
+    assert(fc.bar('x') == 3.6);
+    assert(ot.xxx() == 762);
+
+    Unrelated u2 = new Unrelated(7);
+    assert(u2.a == 7);
+    return 6;
+}
+static assert(classtest1(1));
+static assert(classtest1(2));
+static assert(classtest1(7)); // bug 7154
+
+// can't initialize enum with not null class
+SomeClass classtest2(int n)
+{
+    return n == 5 ? (new SomeClass) : null;
+}
+static assert( is(typeof((){ enum const(SomeClass) xx = classtest2(2);}())));
+static assert(!is(typeof((){ enum const(SomeClass) xx = classtest2(5);}())));
+
+class RecursiveClass
+{
+   int x;
+   this(int n) { x = n; }
+   RecursiveClass b;
+   void doit() { b = new RecursiveClass(7); b.x = 2;}
+}
+
+int classtest3()
+{
+    RecursiveClass x = new RecursiveClass(17);
+    x.doit();
+    RecursiveClass y = x.b;
+    assert(y.x == 2);
+    assert(x.x == 17);
+    return 1;
+}
+
+static assert(classtest3());
+
+/**************************************************
+    12016 class cast and qualifier reinterpret
+**************************************************/
+
+class B12016 { }
+
+class C12016 : B12016 { }
+
+bool f12016(immutable B12016 b)
+{
+    assert(b);
+    return true;
+}
+
+static assert(f12016(new immutable C12016));
+
+/**************************************************
+    10610 ice immutable implicit conversion
+**************************************************/
+
+class Bug10610(T)
+{
+    int baz() immutable
+    {
+        return 1;
+    }
+    static immutable(Bug10610!T) min = new Bug10610!T();
+}
+
+void ice10610()
+{
+   alias T10610 = Bug10610!(int);
+   static assert (T10610.min.baz());
+}
+
+/**************************************************
+    13141 regression fix caused by 10610
+**************************************************/
+
+struct MapResult13141(alias pred)
+{
+    int[] range;
+    @property empty() { return range.length == 0; }
+    @property front() { return pred(range[0]); }
+    void popFront() { range = range[1 .. $]; }
+}
+
+string[] array13141(R)(R r)
+{
+    typeof(return) result;
+    foreach (e; r)
+        result ~= e;
+    return result;
+}
+
+//immutable string[] splitterNames = [4].map!(e => "4").array();
+immutable string[] splitterNames13141 = MapResult13141!(e => "4")([4]).array13141();
+
+/**************************************************
+    11587 AA compare
+**************************************************/
+
+static assert([1:2, 3:4] == [3:4, 1:2]);
+
+/**************************************************
+    14325 more AA comparisons
+**************************************************/
+
+static assert([1:1] != [1:2, 2:1]);      // OK
+static assert([1:1] != [1:2]);           // OK
+static assert([1:1] != [2:1]);           // OK <- Error
+static assert([1:1, 2:2] != [3:3, 4:4]); // OK <- Error
+
+/**************************************************
+    7147 typeid()
+**************************************************/
+
+static assert({
+    TypeInfo xxx = typeid(Object);
+    TypeInfo yyy = typeid(new Error("xxx"));
+    return true;
+}());
+
+int bug7147(int n)
+{
+    Error err = n ? new Error("xxx") : null;
+    TypeInfo qqq = typeid(err);
+    return 1;
+}
+
+// Must not segfault if class is null
+static assert(!is(typeof(compiles!(bug7147(0)))));
+static assert( is(typeof(compiles!(bug7147(1)))));
+
+
+/**************************************************
+    14123 - identity TypeInfo objects
+**************************************************/
+
+static assert({
+    bool eq(TypeInfo t1, TypeInfo t2)
+    {
+        return t1 is t2;
+    }
+
+    class C {}
+    struct S {}
+
+    assert( eq(typeid(C), typeid(C)));
+    assert(!eq(typeid(C), typeid(Object)));
+    assert( eq(typeid(S), typeid(S)));
+    assert(!eq(typeid(S), typeid(int)));
+    assert( eq(typeid(int), typeid(int)));
+    assert(!eq(typeid(int), typeid(long)));
+
+    Object o = new Object;
+    Object c = new C;
+    assert( eq(typeid(o), typeid(o)));
+    assert(!eq(typeid(c), typeid(o)));
+    assert(!eq(typeid(o), typeid(S)));
+
+    return 1;
+}());
+
+/**************************************************
+    6885 wrong code with new array
+**************************************************/
+
+struct S6885
+{
+    int p;
+}
+
+int bug6885()
+{
+    auto array = new double[1][2];
+    array[1][0] = 6;
+    array[0][0] = 1;
+    assert(array[1][0] == 6);
+
+    auto barray = new S6885[2];
+    barray[1].p = 5;
+    barray[0].p = 2;
+    assert(barray[1].p == 5);
+    return 1;
+}
+
+static assert(bug6885());
+
+/**************************************************
+    6886 ICE with new array of dynamic arrays
+**************************************************/
+
+int bug6886()
+{
+    auto carray = new int[][2];
+    carray[1] = [6];
+    carray[0] = [4];
+    assert(carray[1][0] == 6);
+    return 1;
+}
+
+static assert(bug6886());
+
+/**************************************************
+    10198 Multidimensional struct block initializer
+**************************************************/
+
+struct Block10198
+{
+    int val[3][4];
+}
+
+int bug10198()
+{
+    Block10198 pp = Block10198(67);
+    assert(pp.val[2][3] == 67);
+    assert(pp.val[1][3] == 67);
+    return 1;
+}
+static assert(bug10198());
+
+/**************************************************
+    14440 Multidimensional block initialization should create distinct arrays for each elements
+**************************************************/
+
+struct Matrix14440(E, size_t row, size_t col)
+{
+    E[col][row] array2D;
+
+    @safe pure nothrow
+    this(E[row * col] numbers...)
+    {
+        foreach (r; 0 .. row)
+        {
+            foreach (c; 0 .. col)
+            {
+                array2D[r][c] = numbers[r * col + c];
+            }
+        }
+    }
+}
+
+void test14440()
+{
+    // Replace 'enum' with 'auto' here and it will work fine.
+    enum matrix = Matrix14440!(int, 3, 3)(
+        1, 2, 3,
+        4, 5, 6,
+        7, 8, 9
+    );
+
+    static assert(matrix.array2D[0][0] == 1);
+    static assert(matrix.array2D[0][1] == 2);
+    static assert(matrix.array2D[0][2] == 3);
+    static assert(matrix.array2D[1][0] == 4);
+    static assert(matrix.array2D[1][1] == 5);
+    static assert(matrix.array2D[1][2] == 6);
+    static assert(matrix.array2D[2][0] == 7);
+    static assert(matrix.array2D[2][1] == 8);
+    static assert(matrix.array2D[2][2] == 9);
+}
+
+/****************************************************
+ * Exception chaining tests from xtest46.d
+ ****************************************************/
+
+class A75
+{
+    pure static void raise(string s)
+    {
+        throw new Exception(s);
+    }
+}
+
+int test75()
+{
+    int x = 0;
+    try
+    {
+        A75.raise("a");
+    }
+    catch (Exception e)
+    {
+        x = 1;
+    }
+    assert(x == 1);
+    return 1;
+}
+static assert(test75());
+
+/****************************************************
+ * Exception chaining tests from test4.d
+ ****************************************************/
+
+int test4_test54()
+{
+    int status = 0;
+
+    try
+    {
+        try
+        {
+            status++;
+            assert(status == 1);
+            throw new Exception("first");
+        }
+        finally
+        {
+            status++;
+            assert(status == 2);
+            status++;
+            throw new Exception("second");
+        }
+    }
+    catch (Exception e)
+    {
+        assert(e.msg == "first");
+        assert(e.next.msg == "second");
+    }
+    return true;
+}
+
+static assert(test4_test54());
+
+void foo55()
+{
+    try
+    {
+        Exception x = new Exception("second");
+        throw x;
+    }
+    catch (Exception e)
+    {
+        assert(e.msg == "second");
+    }
+}
+
+int test4_test55()
+{
+    int status = 0;
+    try
+    {
+        try
+        {
+            status++;
+            assert(status == 1);
+            Exception x = new Exception("first");
+            throw x;
+        }
+        finally
+        {
+            status++;
+            assert(status == 2);
+            status++;
+            foo55();
+        }
+    }
+    catch (Exception e)
+    {
+        assert(e.msg == "first");
+        assert(status == 3);
+    }
+    return 1;
+}
+
+static assert(test4_test55());
+
+/****************************************************
+ * Exception chaining tests from eh.d
+ ****************************************************/
+
+void bug1513outer()
+{
+    int result1513;
+
+    void bug1513a()
+    {
+         throw new Exception("d");
+    }
+
+    void bug1513b()
+    {
+        try
+        {
+            try
+            {
+                bug1513a();
+            }
+            finally
+            {
+                result1513 |= 4;
+                throw new Exception("f");
+            }
+        }
+        catch (Exception e)
+        {
+            assert(e.msg == "d");
+            assert(e.next.msg == "f");
+            assert(!e.next.next);
+        }
+    }
+
+    void bug1513c()
+    {
+        try
+        {
+            try
+            {
+                throw new Exception("a");
+            }
+            finally
+            {
+                result1513 |= 1;
+                throw new Exception("b");
+            }
+        }
+        finally
+        {
+            bug1513b();
+            result1513 |= 2;
+            throw new Exception("c");
+        }
+    }
+
+    void bug1513()
+    {
+        result1513 = 0;
+        try
+        {
+            bug1513c();
+        }
+        catch (Exception e)
+        {
+            assert(result1513 == 7);
+            assert(e.msg == "a");
+            assert(e.next.msg == "b");
+            assert(e.next.next.msg == "c");
+        }
+    }
+
+    bug1513();
+}
+
+void collideone()
+{
+    try
+    {
+        throw new Exception("x");
+    }
+    finally
+    {
+        throw new Exception("y");
+    }
+}
+
+void doublecollide()
+{
+    try
+    {
+        try
+        {
+            try
+            {
+                throw new Exception("p");
+            }
+            finally
+            {
+                throw new Exception("q");
+            }
+        }
+        finally
+        {
+            collideone();
+        }
+    }
+    catch (Exception e)
+    {
+        assert(e.msg == "p");
+        assert(e.next.msg == "q");
+        assert(e.next.next.msg == "x");
+        assert(e.next.next.next.msg == "y");
+        assert(!e.next.next.next.next);
+    }
+}
+
+void collidetwo()
+{
+    try
+    {
+        try
+        {
+            throw new Exception("p2");
+        }
+        finally
+        {
+            throw new Exception("q2");
+        }
+    }
+    finally
+    {
+        collideone();
+    }
+}
+
+void collideMixed()
+{
+    int works = 6;
+    try
+    {
+        try
+        {
+            try
+            {
+                throw new Exception("e");
+            }
+            finally
+            {
+                throw new Error("t");
+            }
+        }
+        catch (Exception f)
+        {
+            // Doesn't catch, because Error is chained to it.
+            works += 2;
+        }
+    }
+    catch (Error z)
+    {
+        works += 4;
+        assert(z.msg == "t"); // Error comes first
+        assert(z.next is null);
+        assert(z.bypassedException.msg == "e");
+    }
+    assert(works == 10);
+}
+
+class AnotherException : Exception
+{
+    this(string s)
+    {
+        super(s);
+    }
+}
+
+void multicollide()
+{
+    try
+    {
+        try
+        {
+            try
+            {
+                try
+                {
+                    throw new Exception("m2");
+                }
+                finally
+                {
+                    throw new AnotherException("n2");
+                }
+            }
+            catch (AnotherException s)
+            {
+                // Not caught -- we needed to catch the root cause "m2", not
+                // just the collateral "n2" (which would leave m2 uncaught).
+                assert(0);
+            }
+        }
+        finally
+        {
+            collidetwo();
+        }
+    }
+    catch (Exception f)
+    {
+        assert(f.msg == "m2");
+        assert(f.next.msg == "n2");
+        Throwable e = f.next.next;
+        assert(e.msg == "p2");
+        assert(e.next.msg == "q2");
+        assert(e.next.next.msg == "x");
+        assert(e.next.next.next.msg == "y");
+        assert(!e.next.next.next.next);
+    }
+}
+
+int testsFromEH()
+{
+    bug1513outer();
+    doublecollide();
+    collideMixed();
+    multicollide();
+    return 1;
+}
+static assert(testsFromEH());
+
+/**************************************************
+    With + synchronized statements + bug 6901
+**************************************************/
+
+struct With1
+{
+    int a;
+    int b;
+}
+
+class Foo6
+{
+}
+
+class Foo32
+{
+    struct Bar
+    {
+        int x;
+    }
+}
+
+class Base56
+{
+    private string myfoo;
+    private string mybar;
+
+    // Get/set properties that will be overridden.
+    void foo(string s) { myfoo = s; }
+    string foo() { return myfoo; }
+
+    // Get/set properties that will not be overridden.
+    void bar(string s) { mybar = s; }
+    string bar() { return mybar; }
+}
+
+class Derived56 : Base56
+{
+    alias Base56.foo foo; // Bring in Base56's foo getter.
+    override void foo(string s) { super.foo = s; } // Override foo setter.
+}
+
+int testwith()
+{
+    With1 x = With1(7);
+    with (x)
+    {
+        a = 2;
+    }
+    assert(x.a == 2);
+
+    // from test11.d
+    Foo6 foo6 = new Foo6();
+
+    with (foo6)
+    {
+        int xx;
+        xx = 4;
+    }
+    with (new Foo32)
+    {
+        Bar z;
+        z.x = 5;
+    }
+    Derived56 d = new Derived56;
+    with (d)
+    {
+        foo = "hi";
+        d.foo = "hi";
+        bar = "hi";
+        assert(foo == "hi");
+        assert(d.foo == "hi");
+        assert(bar == "hi");
+    }
+    int w = 7;
+    synchronized
+    {
+        ++w;
+    }
+    assert(w == 8);
+    return 1;
+}
+
+static assert(testwith());
+
+/**************************************************
+    9236 ICE  switch with(EnumType)
+**************************************************/
+
+enum Command9236
+{
+    Char,
+    Any,
+};
+
+bool bug9236(Command9236 cmd)
+{
+    int n = 0;
+    with (Command9236) switch (cmd)
+    {
+    case Any:
+        n = 1;
+        break;
+    default:
+        n = 2;
+    }
+    assert(n == 1);
+
+    switch (cmd) with (Command9236)
+    {
+    case Any:
+        return true;
+    default:
+        return false;
+    }
+}
+
+static assert(bug9236(Command9236.Any));
+
+/**************************************************
+    6416 static struct declaration
+**************************************************/
+
+static assert({
+    static struct S { int y = 7; }
+    S a;
+    a.y += 6;
+    assert(a.y == 13);
+    return true;
+}());
+
+/**************************************************
+    10499 static template struct declaration
+**************************************************/
+
+static assert({
+    static struct Result() {}
+    return true;
+}());
+
+/**************************************************
+    13757 extern(C) alias declaration
+**************************************************/
+
+static assert({
+    alias FP1 = extern(C) int function();
+    alias extern(C) int function() FP2;
+    return true;
+}());
+
+/**************************************************
+    6522 opAssign + foreach ref
+**************************************************/
+
+struct Foo6522
+{
+    bool b = false;
+    void opAssign(int x)
+    {
+        this.b = true;
+    }
+}
+
+bool foo6522()
+{
+    Foo6522[1] array;
+    foreach (ref item; array)
+        item = 1;
+    return true;
+}
+
+static assert(foo6522());
+
+/**************************************************
+    7245 pointers + foreach ref
+**************************************************/
+
+int bug7245(int testnum)
+{
+    int[3] arr;
+    arr[0] = 4;
+    arr[1] = 6;
+    arr[2] = 8;
+    int* ptr;
+
+    foreach (i, ref p; arr)
+    {
+        if (i == 1)
+            ptr = &p;
+        if (testnum == 1)
+            p = 5;
+    }
+
+    return *ptr;
+}
+
+static assert(bug7245(0) == 6);
+static assert(bug7245(1) == 5);
+
+/**************************************************
+    8498 modifying foreach
+    7658 foreach ref
+    8539 nested funcs, ref param, -inline
+**************************************************/
+
+int bug8498()
+{
+    foreach (ref i; 0 .. 5)
+    {
+        assert(i == 0);
+        i = 100;
+    }
+    return 1;
+}
+static assert(bug8498());
+
+string bug7658()
+{
+    string[] children = ["0"];
+    foreach (ref child; children)
+        child = "1";
+    return children[0];
+}
+
+static assert(bug7658() == "1");
+
+int bug8539()
+{
+    static void one(ref int x)
+    {
+        x = 1;
+    }
+    static void go()
+    {
+        int y;
+        one(y);
+        assert(y == 1); // fails with -inline
+    }
+    go();
+    return 1;
+}
+
+static assert(bug8539());
+
+/**************************************************
+    7874, 13297, 13740 - better lvalue handling
+**************************************************/
+
+int bug7874(int x){ return ++x = 1; }
+static assert(bug7874(0) == 1);
+
+// ----
+
+struct S13297
+{
+    int* p;
+}
+void f13297(ref int* p)
+{
+    p = cast(int*) 1;
+    assert(p); // passes
+}
+static assert(
+{
+    S13297 s;
+    f13297(s.p);
+    return s.p != null; // false
+}());
+
+// ----
+
+class R13740
+{
+    int e;
+    bool empty = false;
+    @property ref front() { return e; }
+    void popFront() { empty = true; }
+}
+static assert({
+    auto r = new R13740();
+    foreach (ref e; r)
+        e = 42;
+    assert(r.e == 42); /* fails in CTFE */
+
+    return true;
+}());
+
+/**************************************************
+    6919
+**************************************************/
+
+void bug6919(int* val)
+{
+    *val = 1;
+}
+void test6919()
+{
+    int n;
+    bug6919(&n);
+    assert(n == 1);
+}
+static assert({ test6919(); return true; }());
+
+void bug6919b(string* val)
+{
+    *val = "1";
+}
+
+void test6919b()
+{
+    string val;
+    bug6919b(&val);
+    assert(val == "1");
+}
+static assert({ test6919b(); return true; }());
+
+/**************************************************
+    6995
+**************************************************/
+
+struct Foo6995
+{
+    static size_t index(size_t v)()
+    {
+        return v;
+    }
+}
+
+static assert(Foo6995.index!(27)() == 27);
+
+/**************************************************
+    7043 ref with -inline
+**************************************************/
+
+int bug7043(S)(ref int x)
+{
+    return x;
+}
+
+static assert({
+    int i = 416;
+    return bug7043!(char)(i);
+}() == 416);
+
+/**************************************************
+    6037 recursive ref
+**************************************************/
+
+void bug6037(ref int x, bool b)
+{
+    int w = 3;
+    if (b)
+    {
+        bug6037(w, false);
+        assert(w == 6);
+    }
+    else
+    {
+        x = 6;
+        assert(w == 3); // fails
+    }
+}
+
+int bug6037outer()
+{
+    int q;
+    bug6037(q, true);
+    return 401;
+}
+
+static assert(bug6037outer() == 401);
+
+/**************************************************
+    14299 - [REG2.067a], more than one depth of recursive call with ref
+**************************************************/
+
+string gen14299(int max, int idx, ref string name)
+{
+    string ret;
+    name = [cast(char)(idx + '0')];
+    ret ~= name;
+    if (idx < max)
+    {
+        string subname;
+        ret ~= gen14299(max, idx + 1, subname);
+    }
+    ret ~= name;
+    return ret;
+}
+string test14299(int max)
+{
+    string n;
+    return gen14299(max, 0, n);
+}
+static assert(test14299(1) ==     "0110");      // OK <- fail
+static assert(test14299(2) ==    "012210");     // OK <- ICE
+static assert(test14299(3) ==   "01233210");
+static assert(test14299(4) ==  "0123443210");
+static assert(test14299(5) == "012345543210");
+
+/**************************************************
+    7940 wrong code for complicated assign
+**************************************************/
+
+struct Bug7940
+{
+    int m;
+}
+
+struct App7940
+{
+    Bug7940[] x;
+}
+
+int bug7940()
+{
+    Bug7940[2] y;
+    App7940 app;
+    app.x = y[0 .. 1];
+    app.x[0].m = 12;
+    assert(y[0].m == 12);
+    assert(app.x[0].m == 12);
+    return 1;
+}
+
+static assert(bug7940());
+
+/**************************************************
+    10298 wrong code for struct array literal init
+**************************************************/
+
+struct Bug10298
+{
+    int m;
+}
+
+int bug10298()
+{
+    Bug10298[1] y = [Bug10298(78)];
+    y[0].m = 6;
+    assert(y[0].m == 6);
+
+    // Root cause
+    Bug10298[1] x;
+    x[] = [cast(const Bug10298)(Bug10298(78))];
+    assert(x[0].m == 78);
+    return 1;
+}
+
+static assert(bug10298());
+
+/**************************************************
+    7266 dotvar ref parameters
+**************************************************/
+
+struct S7266 { int a; }
+
+bool bug7266()
+{
+    S7266 s;
+    s.a = 4;
+    bar7266(s.a);
+    assert(s.a == 5);
+    out7266(s.a);
+    assert(s.a == 7);
+    return true;
+}
+
+void bar7266(ref int b)
+{
+    b = 5;
+    assert(b == 5);
+}
+
+void out7266(out int b)
+{
+    b = 7;
+    assert(b == 7);
+}
+
+static assert(bug7266());
+
+/**************************************************
+    9982 dotvar assign through pointer
+**************************************************/
+
+struct Bug9982
+{
+    int a;
+}
+
+int test9982()
+{
+    Bug9982 x;
+    int*q = &x.a;
+    *q = 99;
+    assert(x.a == 99);
+    return 1;
+}
+
+static assert(test9982());
+
+// 9982, rejects-valid case
+
+struct SS9982
+{
+    Bug9982 s2;
+    this(Bug9982 s1)
+    {
+        s2.a = 6;
+        emplace9982(&s2, s1);
+        assert(s2.a == 3);
+    }
+}
+
+void emplace9982(Bug9982* chunk, Bug9982 arg)
+{
+    *chunk = arg;
+}
+
+enum s9982 = Bug9982(3);
+enum p9982 = SS9982(s9982);
+
+/**************************************************
+    11618 dotvar assign through casted pointer
+**************************************************/
+
+struct Tuple11618(T...)
+{
+    T field;
+    alias field this;
+}
+
+static assert({
+    Tuple11618!(immutable dchar) result = void;
+    auto addr = cast(dchar*)&result[0];
+    *addr = dchar.init;
+    return (result[0] == dchar.init);
+}());
+
+/**************************************************
+    7143 'is' for classes
+**************************************************/
+
+class C7143
+{
+    int x;
+}
+
+int bug7143(int test)
+{
+    C7143 c = new C7143;
+    C7143 d = new C7143;
+    if (test == 1)
+    {
+        if (c)
+            return c.x + 8;
+        return -1;
+    }
+    if (test == 2)
+    {
+        if (c is null)
+            return -1;
+        return c.x + 45;
+    }
+    if (test == 3)
+    {
+        if (c is c)
+            return 58;
+    }
+    if (test == 4)
+    {
+        if (c !is c)
+            return -1;
+        else
+            return 48;
+    }
+    if (test == 6)
+        d = c;
+    if (test == 5 || test == 6)
+    {
+        if (c is d)
+            return 188;
+        else
+            return 48;
+    }
+    return -1;
+}
+
+static assert(bug7143(1) == 8);
+static assert(bug7143(2) == 45);
+static assert(bug7143(3) == 58);
+static assert(bug7143(4) == 48);
+static assert(bug7143(5) == 48);
+static assert(bug7143(6) == 188);
+
+/**************************************************
+    7147 virtual function calls from base class
+**************************************************/
+
+class A7147
+{
+    int foo() { return 0; }
+
+    int callfoo()
+    {
+        return foo();
+    }
+}
+
+class B7147 : A7147
+{
+    override int foo() { return 1; }
+}
+
+int test7147()
+{
+    A7147 a = new B7147;
+    return a.callfoo();
+}
+
+static assert(test7147() == 1);
+
+/**************************************************
+    7158
+**************************************************/
+
+class C7158
+{
+    bool b() { return true; }
+}
+struct S7158
+{
+    C7158 c;
+}
+
+bool test7158()
+{
+    S7158 s = S7158(new C7158);
+    return s.c.b;
+}
+static assert(test7158());
+
+/**************************************************
+    8484
+**************************************************/
+
+class C8484
+{
+    int n;
+    int b() { return n + 3; }
+}
+
+struct S
+{
+    C8484 c;
+}
+
+int t8484(ref C8484 c)
+{
+    return c.b();
+}
+
+int test8484()
+{
+    auto s = S(new C8484);
+    s.c.n = 4;
+    return t8484(s.c);
+}
+static assert(test8484() == 7);
+
+/**************************************************
+    7419
+**************************************************/
+
+struct X7419
+{
+    double x;
+    this(double x)
+    {
+        this.x = x;
+    }
+}
+
+void bug7419()
+{
+    enum x = {
+        auto p = X7419(3);
+        return p.x;
+    }();
+    static assert(x == 3);
+}
+
+/**************************************************
+    9445 ice
+**************************************************/
+
+template c9445(T...) { }
+
+void ice9445(void delegate() expr, void function() f2)
+{
+    static assert(!is(typeof(c9445!(f2()))));
+    static assert(!is(typeof(c9445!(expr()))));
+}
+
+/**************************************************
+    10452 delegate ==
+**************************************************/
+
+struct S10452
+{
+    bool func() { return true; }
+}
+
+struct Outer10452
+{
+    S10452 inner;
+}
+
+class C10452
+{
+    bool func() { return true; }
+}
+
+bool delegate() ref10452(ref S10452 s)
+{
+    return &s.func;
+}
+
+bool test10452()
+{
+    bool delegate() bar = () { return true; };
+
+    assert(bar !is null);
+    assert(bar is bar);
+
+    S10452 bag;
+    S10452[6] bad;
+    Outer10452 outer;
+    C10452 tag = new C10452;
+
+    auto rat = &outer.inner.func;
+    assert(rat == rat);
+    auto tat = &tag.func;
+    assert(tat == tat);
+
+    auto bat = &outer.inner.func;
+    auto mat = &bad[2].func;
+    assert(mat is mat);
+    assert(rat == bat);
+
+    auto zat = &bag.func;
+    auto cat = &bag.func;
+    assert(zat == zat);
+    assert(zat == cat);
+
+    auto drat = ref10452(bag);
+    assert(cat == drat);
+    assert(drat == drat);
+    drat = ref10452(bad[2]);
+    assert( drat == mat);
+    assert(tat != rat);
+    assert(zat != rat);
+    assert(rat != cat);
+    assert(zat != bar);
+    assert(tat != cat);
+    cat = bar;
+    assert(cat == bar);
+    return true;
+}
+static assert(test10452());
+
+/**************************************************
+    7162 and 4711
+**************************************************/
+
+void f7162() { }
+
+bool ice7162()
+{
+    false && f7162();
+    false || f7162();
+    false && f7162();  // bug 4711
+    true && f7162();
+    return true;
+}
+
+static assert(ice7162());
+
+/**************************************************
+    8857, only with -inline (creates an &&)
+**************************************************/
+
+struct Result8857 { char[] next; }
+
+void bug8857()()
+{
+    Result8857 r;
+    r.next = null;
+    if (true)
+    {
+       auto next = r.next;
+    }
+}
+static assert({
+    bug8857();
+    return true;
+}());
+
+/**************************************************
+    7527
+**************************************************/
+
+struct Bug7527
+{
+    char[] data;
+}
+
+int bug7527()
+{
+    auto app = Bug7527();
+
+    app.data.ptr[0 .. 1] = "x";
+    return 1;
+}
+
+static assert(!is(typeof(compiles!(bug7527()))));
+
+/**************************************************
+    7527
+**************************************************/
+
+int bug7380;
+
+static assert(!is(typeof( compiles!(
+    (){
+        return &bug7380;
+    }()
+))));
+
+/**************************************************
+    7165
+**************************************************/
+
+struct S7165
+{
+    int* ptr;
+    bool f() const { return !!ptr; }
+}
+
+static assert(!S7165().f());
+
+/**************************************************
+    7187
+**************************************************/
+
+int[] f7187() { return [0]; }
+int[] f7187b(int n) { return [0]; }
+
+int g7187(int[] r)
+{
+    auto t = r[0 .. 0];
+    return 1;
+}
+
+static assert(g7187(f7187()));
+static assert(g7187(f7187b(7)));
+
+struct S7187 { const(int)[] field; }
+
+const(int)[] f7187c()
+{
+    auto s = S7187([0]);
+    return s.field;
+}
+
+bool g7187c(const(int)[] r)
+{
+    auto t = r[0 .. 0];
+    return true;
+}
+
+static assert(g7187c(f7187c()));
+
+
+/**************************************************
+    6933 struct destructors
+**************************************************/
+
+struct Bug6933
+{
+    int x = 3;
+    ~this() { }
+}
+
+int test6933()
+{
+    Bug6933 q;
+    assert(q.x == 3);
+    return 3;
+}
+
+static assert(test6933());
+
+/**************************************************
+    7197
+**************************************************/
+
+int foo7197(int[] x...)
+{
+    return 1;
+}
+template bar7197(y...)
+{
+    enum int bar7197 = foo7197(y);
+}
+enum int bug7197 = 7;
+static assert(bar7197!(bug7197));
+
+/**************************************************
+    Enum string compare
+**************************************************/
+
+enum EScmp : string { a = "aaa" }
+
+bool testEScmp()
+{
+    EScmp x = EScmp.a;
+    assert(x < "abc");
+    return true;
+}
+
+static assert(testEScmp());
+
+/**************************************************
+    7667
+**************************************************/
+
+bool baz7667(int[] vars...)
+{
+     return true;
+}
+
+struct S7667
+{
+    static void his(int n)
+    {
+        static assert(baz7667(2));
+    }
+}
+
+bool bug7667()
+{
+    S7667 unused;
+    unused.his(7);
+    return true;
+}
+enum e7667 = bug7667();
+
+/**************************************************
+    7536
+**************************************************/
+
+bool bug7536(string expr)
+{
+    return true;
+}
+
+void vop()
+{
+    const string x7536 = "x";
+    static assert(bug7536(x7536));
+}
+
+/**************************************************
+    6681 unions
+**************************************************/
+
+struct S6681
+{
+    this(int a, int b) { this.a = b; this.b = a; }
+    union
+    {
+        ulong g;
+        struct { int a, b; };
+    }
+}
+
+static immutable S6681 s6681 = S6681(0, 1);
+
+bool bug6681(int test)
+{
+    S6681 x = S6681(0, 1);
+    x.g = 5;
+    auto u = &x.g;
+    auto v = &x.a;
+    long w = *u;
+    int  z;
+    assert(w == 5);
+    if (test == 4)
+        z = *v; // error
+    x.a = 2; // invalidate g, and hence u.
+    if (test == 1)
+        w = *u; // error
+    z = *v;
+    assert(z == 2);
+    x.g = 6;
+    w = *u;
+    assert(w == 6);
+    if (test == 3)
+        z = *v;
+    return true;
+}
+static assert(bug6681(2));
+static assert(!is(typeof(compiles!(bug6681(1)))));
+static assert(!is(typeof(compiles!(bug6681(3)))));
+static assert(!is(typeof(compiles!(bug6681(4)))));
+
+/**************************************************
+    9113 ICE with struct in union
+**************************************************/
+
+union U9113
+{
+    struct M
+    {
+        int y;
+    }
+    int xx;
+}
+
+int bug9113(T)()
+{
+    U9113 x;
+    x.M.y = 10; // error, need 'this'
+    return 1;
+}
+
+static assert(!is(typeof(compiles!(bug9113!(int)()))));
+
+/**************************************************
+    Creation of unions
+**************************************************/
+
+union UnionTest1
+{
+    int x;
+    float y;
+}
+
+int uniontest1()
+{
+    UnionTest1 u = UnionTest1(1);
+    return 1;
+}
+
+static assert(uniontest1());
+
+/**************************************************
+    6438 void
+**************************************************/
+
+struct S6438
+{
+    int a;
+    int b = void;
+}
+
+void fill6438(int[] arr, int testnum)
+{
+    if (testnum == 2)
+    {
+        auto u = arr[0];
+    }
+    foreach (ref x; arr)
+        x = 7;
+    auto r = arr[0];
+    S6438[2] s;
+    auto p = &s[0].b;
+    if (testnum == 3)
+    {
+        auto v = *p;
+    }
+}
+
+bool bug6438(int testnum)
+{
+    int[4] stackSpace = void;
+    fill6438(stackSpace[], testnum);
+    assert(stackSpace == [7, 7, 7, 7]);
+    return true;
+}
+
+static assert( is(typeof(compiles!(bug6438(1)))));
+static assert(!is(typeof(compiles!(bug6438(2)))));
+static assert(!is(typeof(compiles!(bug6438(3)))));
+
+/**************************************************
+    10994 void static array members
+**************************************************/
+
+struct Bug10994
+{
+    ubyte[2] buf = void;
+}
+
+static bug10994 = Bug10994.init;
+
+/**************************************************
+    10937 struct inside union
+**************************************************/
+
+struct S10937
+{
+    union
+    {
+        ubyte[1] a;
+        struct
+        {
+            ubyte b;
+        }
+    }
+
+    this(ubyte B)
+    {
+        if (B > 6)
+            this.b = B;
+        else
+            this.a[0] = B;
+    }
+}
+
+enum test10937 = S10937(7);
+enum west10937 = S10937(2);
+
+/**************************************************
+    13831
+**************************************************/
+
+struct Vector13831()
+{
+}
+
+struct Coord13831
+{
+    union
+    {
+        struct { short x; }
+        Vector13831!() vector;
+    }
+}
+
+struct Chunk13831
+{
+    this(Coord13831)
+    {
+        coord = coord;
+    }
+
+    Coord13831 coord;
+
+    static const Chunk13831* unknownChunk = new Chunk13831(Coord13831());
+}
+
+/**************************************************
+    7732
+**************************************************/
+
+struct AssociativeArray
+{
+    int* impl;
+    int f()
+    {
+        if (impl !is null)
+            auto x = *impl;
+        return 1;
+    }
+}
+
+int test7732()
+{
+    AssociativeArray aa;
+    return aa.f;
+}
+
+static assert(test7732());
+
+/**************************************************
+    7784
+**************************************************/
+struct Foo7784
+{
+    void bug()
+    {
+        tab["A"] = Bar7784(&this);
+        auto pbar = "A" in tab;
+        auto bar = *pbar;
+    }
+
+    Bar7784[string] tab;
+}
+
+struct Bar7784
+{
+    Foo7784* foo;
+    int val;
+}
+
+bool ctfe7784()
+{
+    auto foo = Foo7784();
+    foo.bug();
+    return true;
+}
+
+static assert(ctfe7784());
+
+/**************************************************
+    7781
+**************************************************/
+
+static assert(({ return; }(), true));
+
+/**************************************************
+    7785
+**************************************************/
+
+bool bug7785(int n)
+{
+    int val = 7;
+    auto p = &val;
+    if (n == 2)
+    {
+        auto ary = p[0 .. 1];
+    }
+    auto x = p[0];
+    val = 6;
+    assert(x == 7);
+    if (n == 3)
+        p[0 .. 1] = 1;
+    return true;
+}
+
+static assert(bug7785(1));
+static assert(!is(typeof(compiles!(bug7785(2)))));
+static assert(!is(typeof(compiles!(bug7785(3)))));
+
+/**************************************************
+    7987
+**************************************************/
+
+class C7987
+{
+    int m;
+}
+
+struct S7987
+{
+    int* p;
+    C7987 c;
+}
+
+bool bug7987()
+{
+    int[7] q;
+    int[][2] b = q[0 .. 5];
+    assert(b == b);
+    assert(b is b);
+    C7987 c1 = new C7987;
+    C7987 c2 = new C7987;
+    S7987 s, t;
+    s.p = &q[0];
+    t.p = &q[1];
+    assert(s != t);
+    s.p = &q[1];
+    /*assert(s == t);*/     assert(s.p == t.p);
+    s.c = c1;
+    t.c = c2;
+    /*assert(s != t);*/     assert(s.c !is t.c);
+    assert(s !is t);
+    s.c = c2;
+    /*assert(s == t);*/     assert(s.p == t.p && s.c is t.c);
+    assert(s is t);
+    return true;
+}
+
+static assert(bug7987());
+
+/**************************************************
+    10579 typeinfo.func() must not segfault
+**************************************************/
+
+static assert(!is(typeof(compiles!(typeid(int).toString.length))));
+
+class Bug10579
+{
+    int foo() { return 1; }
+}
+Bug10579 uninitialized10579;
+
+static assert(!is(typeof(compiles!(uninitialized10579.foo()))));
+
+/**************************************************
+    10804 mixin ArrayLiteralExp typed string
+**************************************************/
+
+void test10804()
+{
+    String identity(String)(String a) { return a; }
+
+    string cfun()
+    {
+        char[] s;
+        s.length = 8 + 2 + (2) + 1 + 2;
+        s[] = "identity(`Ω`c)"c[];
+        return cast(string)s;   // Return ArrayLiteralExp as the CTFE result
+    }
+    {
+        enum a1 = "identity(`Ω`c)"c;
+        enum a2 = cfun();
+        static assert(cast(ubyte[])mixin(a1) == [0xCE, 0xA9]);
+        static assert(cast(ubyte[])mixin(a2) == [0xCE, 0xA9]);  // should pass
+    }
+
+    wstring wfun()
+    {
+        wchar[] s;
+        s.length = 8 + 2 + (2) + 1 + 2;
+        s[] = "identity(`\U0002083A`w)"w[];
+        return cast(wstring)s;  // Return ArrayLiteralExp as the CTFE result
+    }
+    {
+        enum a1 = "identity(`\U0002083A`w)"w;
+        enum a2 = wfun();
+        static assert(cast(ushort[])mixin(a1) == [0xD842, 0xDC3A]);
+        static assert(cast(ushort[])mixin(a2) == [0xD842, 0xDC3A]);
+    }
+
+    dstring dfun()
+    {
+        dchar[] s;
+        s.length = 8 + 2 + (1) + 1 + 2;
+        s[] = "identity(`\U00101000`d)"d[];
+        return cast(dstring)s;  // Return ArrayLiteralExp as the CTFE result
+    }
+    {
+        enum a1 = "identity(`\U00101000`d)"d;
+        enum a2 = dfun();
+        static assert(cast(uint[])mixin(a1) == [0x00101000]);
+        static assert(cast(uint[])mixin(a2) == [0x00101000]);
+    }
+}
+
+/******************************************************/
+
+struct B73 {}
+struct C73 { B73 b; }
+C73 func73() { C73 b = void; b.b = B73(); return b; }
+C73 test73 = func73();
+
+/******************************************************/
+
+struct S74
+{
+    int n[1];
+    static S74 test(){ S74 ret = void; ret.n[0] = 0; return ret; }
+}
+
+enum Test74 = S74.test();
+
+/******************************************************/
+
+static bool bug8865()
+in
+{
+    int x = 0;
+label:
+    foreach (i; (++x) .. 3)
+    {
+        if (i == 1)
+            continue label;     // doesn't work.
+        else
+            break label;        // doesn't work.
+    }
+}
+out
+{
+    int x = 0;
+label:
+    foreach (i; (++x) .. 3)
+    {
+        if (i == 1)
+            continue label;     // doesn't work.
+        else
+            break label;        // doesn't work.
+    }
+}
+body
+{
+    int x = 0;
+label:
+    foreach (i; (++x) .. 3)
+    {
+        if (i == 1)
+            continue label;     // works.
+        else
+            break label;        // works.
+    }
+
+    return true;
+}
+static assert(bug8865());
+
+/******************************************************/
+
+struct Test75
+{
+    this(int) pure {}
+}
+
+static assert( __traits(compiles, { static shared(Test75*)   t75 = new shared(Test75)(0);    return t75; }));
+static assert( __traits(compiles, { static shared(Test75)*   t75 = new shared(Test75)(0);    return t75; }));
+static assert( __traits(compiles, { static __gshared Test75* t75 = new Test75(0);            return t75; }));
+static assert( __traits(compiles, { static const(Test75*)    t75 = new const(Test75)(0);     return t75; }));
+static assert( __traits(compiles, { static immutable Test75* t75 = new immutable(Test75)(0); return t75; }));
+static assert(!__traits(compiles, { static Test75*           t75 = new Test75(0);            return t75; }));
+/+
+static assert(!__traits(compiles, { enum                 t75 = new shared(Test75)(0); return t75; }));
+static assert(!__traits(compiles, { enum                 t75 = new Test75(0);         return t75; }));
+static assert(!__traits(compiles, { enum shared(Test75)* t75 = new shared(Test75)(0); return t75; }));
+static assert(!__traits(compiles, { enum Test75*         t75 = new Test75(0);         return t75; }));
+
+static assert( __traits(compiles, { enum                    t75 = new const(Test75)(0);     return t75;}));
+static assert( __traits(compiles, { enum                    t75 = new immutable(Test75)(0); return t75;}));
+static assert( __traits(compiles, { enum const(Test75)*     t75 = new const(Test75)(0);     return t75;}));
+static assert( __traits(compiles, { enum immutable(Test75)* t75 = new immutable(Test75)(0); return t75;}));
++/
+/******************************************************/
+
+class Test76
+{
+    this(int) pure {}
+}
+/+
+static assert(!__traits(compiles, { enum                   t76 = new shared(Test76)(0); return t76;}));
+static assert(!__traits(compiles, { enum                   t76 = new Test76(0);         return t76;}));
+static assert(!__traits(compiles, { enum shared(Test76)    t76 = new shared(Test76)(0); return t76;}));
+static assert(!__traits(compiles, { enum Test76            t76 = new Test76(0);         return t76;}));
+
+static assert( __traits(compiles, { enum                   t76 = new const(Test76)(0);     return t76;}));
+static assert( __traits(compiles, { enum                   t76 = new immutable(Test76)(0); return t76;}));
+static assert( __traits(compiles, { enum const(Test76)     t76 = new const(Test76)(0);     return t76;}));
+static assert( __traits(compiles, { enum immutable(Test76) t76 = new immutable(Test76)(0); return t76;}));
++/
+/******************************************************/
+
+static assert( __traits(compiles, { static shared Test76    t76 = new shared(Test76)(0);   return t76; }));
+static assert( __traits(compiles, { static shared(Test76)   t76 = new shared(Test76)(0);   return t76; }));
+static assert( __traits(compiles, { static __gshared Test76 t76 = new Test76(0);           return t76; }));
+static assert( __traits(compiles, { static const Test76     t76 = new const(Test76)(0);    return t76; }));
+static assert( __traits(compiles, { static immutable Test76 t76 = new immutable Test76(0); return t76; }));
+static assert(!__traits(compiles, { static Test76           t76 = new Test76(0);           return t76; }));
+
+/***** Bug 5678 *********************************/
+
+struct Bug5678
+{
+    this(int) {}
+}
+
+static assert(!__traits(compiles, { enum const(Bug5678)* b5678 = new const(Bug5678)(0); return b5678; }));
+
+/**************************************************
+    10782 run semantic2 for class field
+**************************************************/
+
+enum e10782 = 0;
+class C10782 { int x = e10782; }
+string f10782()
+{
+    auto c = new C10782();
+    return "";
+}
+mixin(f10782());
+
+/**************************************************
+    10929 NRVO support in CTFE
+**************************************************/
+
+struct S10929
+{
+    this(this)
+    {
+        postblitCount++;
+    }
+    ~this()
+    {
+        dtorCount++;
+    }
+    int payload;
+    int dtorCount;
+    int postblitCount;
+}
+
+auto makeS10929()
+{
+    auto s = S10929(42, 0, 0);
+    return s;
+}
+
+bool test10929()
+{
+    auto s = makeS10929();
+    assert(s.postblitCount == 0);
+    assert(s.dtorCount == 0);
+    return true;
+};
+static assert(test10929());
+
+/**************************************************
+    9245 - support postblit call on array assignments
+**************************************************/
+
+bool test9245()
+{
+    int postblits = 0;
+    struct S
+    {
+        this(this)
+        {
+            ++postblits;
+        }
+    }
+
+    S s;
+    S[2] a;
+    assert(postblits == 0);
+
+    {
+        S[2] arr = s;
+        assert(postblits == 2);
+        arr[] = s;
+        assert(postblits == 4);
+        postblits = 0;
+
+        S[2] arr2 = arr;
+        assert(postblits == 2);
+        arr2 = arr;
+        assert(postblits == 4);
+        postblits = 0;
+
+        const S[2] constArr = s;
+        assert(postblits == 2);
+        postblits = 0;
+
+        const S[2] constArr2 = arr;
+        assert(postblits == 2);
+        postblits = 0;
+    }
+    {
+        S[2][2] arr = s;
+        assert(postblits == 4);
+        arr[] = a;
+        assert(postblits == 8);
+        postblits = 0;
+
+        S[2][2] arr2 = arr;
+        assert(postblits == 4);
+        arr2 = arr;
+        assert(postblits == 8);
+        postblits = 0;
+
+        const S[2][2] constArr = s;
+        assert(postblits == 4);
+        postblits = 0;
+
+        const S[2][2] constArr2 = arr;
+        assert(postblits == 4);
+        postblits = 0;
+    }
+
+    return true;
+}
+static assert(test9245());
+
+/**************************************************
+    12906 don't call postblit on blit initializing
+**************************************************/
+
+struct S12906 { this(this) { assert(0); } }
+
+static assert({
+    S12906[1] arr;
+    return true;
+}());
+
+/**************************************************
+    11510 support overlapped field access in CTFE
+**************************************************/
+
+struct S11510
+{
+    union
+    {
+        size_t x;
+        int* y; // pointer field
+    }
+}
+bool test11510()
+{
+    S11510 s;
+
+    s.y = [1,2,3].ptr;            // writing overlapped pointer field is OK
+    assert(s.y[0 .. 3] == [1,2,3]); // reading valid field is OK
+
+    s.x = 10;
+    assert(s.x == 10);
+
+    // There's no reinterpretation between S.x and S.y
+    return true;
+}
+static assert(test11510());
+
+/**************************************************
+    11534 - subtitude inout
+**************************************************/
+
+struct MultiArray11534
+{
+    void set(size_t[] sizes...)
+    {
+        storage = new size_t[5];
+    }
+
+    @property auto raw_ptr() inout
+    {
+        return storage.ptr + 1;
+    }
+    size_t[] storage;
+}
+
+enum test11534 = () {
+    auto m = MultiArray11534();
+    m.set(3,2,1);
+    auto start = m.raw_ptr;   //this trigger the bug
+    //auto start = m.storage.ptr + 1; //this obviously works
+    return 0;
+}();
+
+/**************************************************
+    11941 - Regression of 11534 fix
+**************************************************/
+
+void takeConst11941(const string[]) {}
+string[] identity11941(string[] x) { return x; }
+
+bool test11941a()
+{
+    struct S { string[] a; }
+    S s;
+
+    takeConst11941(identity11941(s.a));
+    s.a ~= [];
+
+    return true;
+}
+static assert(test11941a());
+
+bool test11941b()
+{
+    struct S { string[] a; }
+    S s;
+
+    takeConst11941(identity11941(s.a));
+    s.a ~= "foo"; /* Error refers to this line (15), */
+    string[] b = s.a[]; /* but only when this is here. */
+
+    return true;
+}
+static assert(test11941b());
+
+/**************************************************
+    11535 - element-wise assignment from string to ubyte array literal
+**************************************************/
+
+struct Hash11535
+{
+    ubyte[6] _buffer;
+
+    void put(scope const(ubyte)[] data...)
+    {
+        uint i = 0, index = 0;
+        auto inputLen = data.length;
+
+        (&_buffer[index])[0 .. inputLen - i] = (&data[i])[0 .. inputLen - i];
+    }
+}
+
+auto md5_digest11535(T...)(scope const T data)
+{
+    Hash11535 hash;
+    hash.put(cast(const(ubyte[]))data[0]);
+    return hash._buffer;
+}
+
+static assert(md5_digest11535(`TEST`) == [84, 69, 83, 84, 0, 0]);
+
+/**************************************************
+    11540 - goto label + try-catch-finally / with statement
+**************************************************/
+
+static assert(()
+{
+    // enter to TryCatchStatement.body
+    {
+        bool c = false;
+        try
+        {
+            if (c)  // need to bypass front-end optimization
+                throw new Exception("");
+            else
+            {
+                goto Lx;
+              L1:
+                c = true;
+            }
+        }
+        catch (Exception e) {}
+
+      Lx:
+        if (!c)
+            goto L1;
+    }
+
+    // jump inside TryCatchStatement.body
+    {
+        bool c = false;
+        try
+        {
+            if (c)  // need to bypass front-end optimization
+                throw new Exception("");
+            else
+                goto L2;
+          L2:
+            ;
+        }
+        catch (Exception e) {}
+    }
+
+    // exit from TryCatchStatement.body
+    {
+        bool c = false;
+        try
+        {
+            if (c)  // need to bypass front-end optimization
+                throw new Exception("");
+            else
+                goto L3;
+        }
+        catch (Exception e) {}
+
+        c = true;
+      L3:
+        assert(!c);
+    }
+
+    return 1;
+}());
+
+static assert(()
+{
+    // enter to TryCatchStatement.catches which has no exception variable
+    {
+        bool c = false;
+        goto L1;
+        try
+        {
+            c = true;
+        }
+        catch (Exception/* e*/)
+        {
+          L1:
+            ;
+        }
+        assert(c == false);
+    }
+
+    // jump inside TryCatchStatement.catches
+    {
+        bool c = false;
+        try
+        {
+            throw new Exception("");
+        }
+        catch (Exception e)
+        {
+            goto L2;
+            c = true;
+          L2:
+            ;
+        }
+        assert(c == false);
+    }
+
+    // exit from TryCatchStatement.catches
+    {
+        bool c = false;
+        try
+        {
+            throw new Exception("");
+        }
+        catch (Exception e)
+        {
+            goto L3;
+            c = true;
+        }
+      L3:
+        assert(c == false);
+    }
+
+    return 1;
+}());
+
+static assert(()
+{
+    // enter forward to TryFinallyStatement.body
+    {
+        bool c = false;
+        goto L0;
+        c = true;
+        try
+        {
+          L0:
+            ;
+        }
+        finally {}
+        assert(!c);
+    }
+
+    // enter back to TryFinallyStatement.body
+    {
+        bool c = false;
+        try
+        {
+            goto Lx;
+          L1:
+            c = true;
+        }
+        finally {
+        }
+
+      Lx:
+        if (!c)
+            goto L1;
+    }
+
+    // jump inside TryFinallyStatement.body
+    {
+        try
+        {
+            goto L2;
+          L2: ;
+        }
+        finally {}
+    }
+
+    // exit from TryFinallyStatement.body
+    {
+        bool c = false;
+        try
+        {
+            goto L3;
+        }
+        finally {}
+
+        c = true;
+      L3:
+        assert(!c);
+    }
+
+    // enter in / exit out from finally block is rejected in semantic analysis
+
+    // jump inside TryFinallyStatement.finalbody
+    {
+        bool c = false;
+        try
+        {
+        }
+        finally
+        {
+            goto L4;
+            c = true;
+          L4:
+            assert(c == false);
+        }
+    }
+
+    return 1;
+}());
+
+static assert(()
+{
+    {
+        bool c = false;
+        with (Object.init)
+        {
+            goto L2;
+            c = true;
+          L2:
+            ;
+        }
+        assert(c == false);
+    }
+
+    {
+        bool c = false;
+        with (Object.init)
+        {
+            goto L3;
+            c = true;
+        }
+      L3:
+        assert(c == false);
+    }
+
+    return 1;
+}());
+
+/**************************************************
+    11627 -  cast dchar to char at compile time on AA assignment
+**************************************************/
+
+bool test11627()
+{
+    char[ubyte] toCharTmp;
+    dchar letter = 'A';
+
+    //char c = cast(char)letter;    // OK
+    toCharTmp[0] = cast(char)letter;    // NG
+
+    return true;
+}
+static assert(test11627());
+
+/**************************************************
+    11664 - ignore function local static variables
+**************************************************/
+
+bool test11664()
+{
+    static int x;
+    static int y = 1;
+    return true;
+}
+static assert(test11664());
+
+/**************************************************
+    12110 - operand of dereferencing does not need to be an lvalue
+**************************************************/
+
+struct SliceOverIndexed12110
+{
+    Uint24Array12110* arr;
+
+    @property front(uint val)
+    {
+        arr.dupThisReference();
+    }
+}
+
+struct Uint24Array12110
+{
+    ubyte[] data;
+
+    this(ubyte[] range)
+    {
+        data = range;
+        SliceOverIndexed12110(&this).front = 0;
+        assert(data.length == range.length * 2);
+    }
+
+    void dupThisReference()
+    {
+        auto new_data = new ubyte[data.length * 2];
+        data = new_data;
+    }
+}
+
+static m12110 = Uint24Array12110([0x80]);
+
+/**************************************************
+    12310 - heap allocation for built-in sclar types
+**************************************************/
+
+bool test12310()
+{
+    auto p1 = new int, p2 = p1;
+    assert(*p1 == 0);
+    assert(*p2 == 0);
+    *p1 = 10;
+    assert(*p1 == 10);
+    assert(*p2 == 10);
+
+    auto q1 = new int(3), q2 = q1;
+    assert(*q1 == 3);
+    assert(*q2 == 3);
+    *q1 = 20;
+    assert(*q1 == 20);
+    assert(*q2 == 20);
+
+    return true;
+}
+static assert(test12310());
+
+/**************************************************
+    12499 - initialize TupleDeclaraion in CTFE
+**************************************************/
+
+auto f12499()
+{
+    //Initialize 3 ints to 5.
+    TypeTuple!(int, int, int) a = 5;
+    return a[0]; //Error: variable _a_field_0 cannot be read at compile time
+}
+static assert(f12499() == 5);
+
+/**************************************************
+    12602 - slice in struct literal members
+**************************************************/
+
+struct Result12602
+{
+    uint[] source;
+}
+
+auto wrap12602a(uint[] r)
+{
+    return Result12602(r);
+}
+
+auto wrap12602b(uint[] r)
+{
+    Result12602 x;
+    x.source = r;
+    return x;
+}
+
+auto testWrap12602a()
+{
+    uint[] dest = [1, 2, 3, 4];
+
+    auto ra = wrap12602a(dest[0 .. 2]);
+    auto rb = wrap12602a(dest[2 .. 4]);
+
+    foreach (i; 0 .. 2)
+        rb.source[i] = ra.source[i];
+
+    assert(ra.source == [1,2]);
+    assert(rb.source == [1,2]);
+    assert(&ra.source[0] == &dest[0]);
+    assert(&rb.source[0] == &dest[2]);
+    assert(dest == [1,2,1,2]);
+    return dest;
+}
+
+auto testWrap12602b()
+{
+    uint[] dest = [1, 2, 3, 4];
+
+    auto ra = wrap12602b(dest[0 .. 2]);
+    auto rb = wrap12602b(dest[2 .. 4]);
+
+    foreach (i; 0 .. 2)
+        rb.source[i] = ra.source[i];
+
+    assert(ra.source == [1,2]);
+    assert(rb.source == [1,2]);
+    assert(&ra.source[0] == &dest[0]);
+    assert(&rb.source[0] == &dest[2]);
+    assert(dest == [1,2,1,2]);
+    return dest;
+}
+
+auto testWrap12602c()
+{
+    uint[] dest = [1, 2, 3, 4];
+
+    auto ra = Result12602(dest[0 .. 2]);
+    auto rb = Result12602(dest[2 .. 4]);
+
+    foreach (i; 0 .. 2)
+        rb.source[i] = ra.source[i];
+
+    assert(ra.source == [1,2]);
+    assert(rb.source == [1,2]);
+    assert(&ra.source[0] == &dest[0]);
+    assert(&rb.source[0] == &dest[2]);
+    assert(dest == [1,2,1,2]);
+    return dest;
+}
+
+auto testWrap12602d()
+{
+    uint[] dest = [1, 2, 3, 4];
+
+    Result12602 ra; ra.source = dest[0 .. 2];
+    Result12602 rb; rb.source = dest[2 .. 4];
+
+    foreach (i; 0 .. 2)
+        rb.source[i] = ra.source[i];
+
+    assert(ra.source == [1,2]);
+    assert(rb.source == [1,2]);
+    assert(&ra.source[0] == &dest[0]);
+    assert(&rb.source[0] == &dest[2]);
+    assert(dest == [1,2,1,2]);
+    return dest;
+}
+
+static assert(testWrap12602a() == [1,2,1,2]);
+static assert(testWrap12602b() == [1,2,1,2]);
+static assert(testWrap12602c() == [1,2,1,2]);
+static assert(testWrap12602d() == [1,2,1,2]);
+
+/**************************************************
+    12677 - class type initializing from DotVarExp
+**************************************************/
+
+final class C12677
+{
+    TypeTuple!(Object, int[]) _test;
+    this()
+    {
+        auto t0 = _test[0]; //
+        auto t1 = _test[1]; //
+        assert(t0 is null);
+        assert(t1 is null);
+    }
+}
+
+struct S12677
+{
+    auto f = new C12677();
+}
+
+/**************************************************
+    12851 - interpret function local const static array
+**************************************************/
+
+void test12851()
+{
+    const int[5] arr;
+    alias staticZip = TypeTuple!(arr[0]);
+}
+
+/**************************************************
+    13630 - indexing and setting array element via pointer
+**************************************************/
+
+struct S13630(T)
+{
+    T[3] arr;
+
+    this(A...)(auto ref in A args)
+    {
+        auto p = arr.ptr;
+
+        foreach (ref v; args)
+        {
+            *p = 0;
+        }
+    }
+}
+
+enum s13630 = S13630!float(1);
+
+/**************************************************
+    13827
+**************************************************/
+
+struct Matrix13827(T, uint N)
+{
+    private static defaultMatrix()
+    {
+        T arr[N];
+        return arr;
+    }
+
+    union
+    {
+        T[N] A = defaultMatrix;
+        T[N] flat;
+    }
+
+    this(A...)(auto ref in A args)
+    {
+        uint k;
+
+        foreach (ref v; args)
+            flat[k++] = cast(T)v;
+    }
+}
+enum m13827 = Matrix13827!(int, 3)(1, 2, 3);
+
+/**************************************************
+    13847 - support DotTypeExp
+**************************************************/
+
+class B13847
+{
+    int foo() { return 1; }
+}
+
+class C13847 : B13847
+{
+    override int foo() { return 2; }
+
+    final void test(int n)
+    {
+        assert(foo() == n);
+        assert(B13847.foo() == 1);
+        assert(C13847.foo() == 2);
+        assert(this.B13847.foo() == 1);
+        assert(this.C13847.foo() == 2);
+    }
+}
+
+class D13847 : C13847
+{
+    override int foo() { return 3; }
+}
+
+static assert({
+    C13847 c = new C13847();
+    c.test(2);
+    assert(c.B13847.foo() == 1);
+    assert(c.C13847.foo() == 2);
+
+    D13847 d = new D13847();
+    d.test(3);
+    assert(d.B13847.foo() == 1);
+    assert(d.C13847.foo() == 2);
+    assert(d.D13847.foo() == 3);
+
+    c = d;
+    c.test(3);
+    assert(c.B13847.foo() == 1);
+    assert(c.C13847.foo() == 2);
+    return true;
+}());
+
+/**************************************************
+    12495 - cast from string to immutable(ubyte)[]
+**************************************************/
+
+string getStr12495()
+{
+    char[1] buf = void;                     // dummy starting point.
+    string s = cast(string)buf[0..0];       // empty slice, .ptr points mutable.
+    assert(buf.ptr == s.ptr);
+    s ~= 'a';                               // this should allocate.
+    assert(buf.ptr != s.ptr);
+    return s.idup;                          // this should allocate again, and
+                                            // definitly point immutable memory.
+}
+auto indexOf12495(string s)
+{
+    auto p1 = s.ptr;
+    auto p2 = (cast(immutable(ubyte)[])s).ptr;
+    assert(cast(void*)p1 == cast(void*)p2); // OK <- fails
+    return cast(void*)p2 - cast(void*)p1;   // OK <- "cannot subtract pointers ..."
+}
+static assert(indexOf12495(getStr12495()) == 0);
+
+/**************************************************
+    13992 - Repainting pointer arithmetic result
+**************************************************/
+
+enum hash13992 = hashOf13992("abcd".ptr);
+
+@trusted hashOf13992(const void* buf)
+{
+    auto data = cast(const(ubyte)*) buf;
+    size_t hash;
+    data += 2;      // problematic pointer arithmetic
+    hash += *data;  // CTFE internal issue was shown by the dereference
+    return hash;
+}
+
+/**************************************************
+    13739 - Precise copy for ArrayLiteralExp elements
+**************************************************/
+
+static assert(
+{
+    int[] a1 = [13];
+    int[][] a2 = [a1];
+    assert(a2[0] is a1);            // OK
+    assert(a2[0].ptr is a1.ptr);    // OK <- NG
+
+    a1[0] = 1;
+    assert(a2[0][0] == 1);  // OK <- NG
+
+    a2[0][0] = 2;
+    assert(a1[0] == 2);     // OK <- NG
+
+    return 1;
+}());
+
+/**************************************************
+    14463 - ICE on slice assignment without postblit
+**************************************************/
+
+struct Boo14463
+{
+    private int[1] c;
+    this(int[] x)
+    {
+        c = x;
+    }
+}
+immutable Boo14463 a14463 = Boo14463([1]);
+
+/**************************************************
+    13295 - Don't copy struct literal in VarExp::interpret()
+**************************************************/
+
+struct S13295
+{
+    int n;
+}
+
+void f13295(ref const S13295 s)
+{
+    *cast(int*) &s.n = 1;
+    assert(s.n == 1);     // OK <- fail
+}
+
+static assert(
+{
+    S13295 s;
+    f13295(s);
+    return s.n == 1; // true <- false
+}());
+
+int foo14061(int[] a)
+{
+    foreach (immutable x; a)
+    {
+        auto b = a ~ x;
+        return b == [1, 1];
+    }
+    return 0;
+}
+static assert(foo14061([1]));
+
+/**************************************************
+    14024 - CTFE version
+**************************************************/
+
+bool test14024()
+{
+    string op;
+
+    struct S
+    {
+        char x = 'x';
+        this(this) { op ~= x-0x20; }    // upper case
+        ~this()    { op ~= x; }         // lower case
+    }
+
+    S[4] mem;
+    ref S[2] slice(int a, int b) { return mem[a .. b][0 .. 2]; }
+
+    op = null;
+    mem[0].x = 'a';
+    mem[1].x = 'b';
+    mem[2].x = 'x';
+    mem[3].x = 'y';
+    slice(0, 2) = slice(2, 4);  // [ab] = [xy]
+    assert(op == "XaYb", op);
+
+    op = null;
+    mem[0].x = 'x';
+    mem[1].x = 'y';
+    mem[2].x = 'a';
+    mem[3].x = 'b';
+    slice(2, 4) = slice(0, 2);  // [ab] = [xy]
+    assert(op == "XaYb", op);
+
+    op = null;
+    mem[0].x = 'a';
+    mem[1].x = 'b';
+    mem[2].x = 'c';
+    slice(0, 2) = slice(1, 3);  // [ab] = [bc]
+    assert(op == "BaCb", op);
+
+    op = null;
+    mem[0].x = 'x';
+    mem[1].x = 'y';
+    mem[2].x = 'z';
+    slice(1, 3) = slice(0, 2);  // [yz] = [xy]
+    assert(op == "YzXy", op);
+
+    return true;
+}
+static assert(test14024());
+
+/**************************************************
+    14304 - cache of static immutable value
+**************************************************/
+
+immutable struct Bug14304
+{
+    string s_name;
+    alias s_name this;
+
+    string fun()()
+    {
+        return "fun";
+    }
+}
+class Buggy14304
+{
+    static string fun(string str)()
+    {
+        return str;
+    }
+    static immutable val = immutable Bug14304("val");
+}
+void test14304()
+{
+    enum kt = Buggy14304.fun!(Buggy14304.val);
+    static assert(kt == "val");
+    enum bt = Buggy14304.val.fun();
+    static assert(bt == "fun");
+}
+
+/**************************************************
+    14371 - evaluate BinAssignExp as lvalue
+**************************************************/
+
+int test14371()
+{
+    int x;
+    ++(x += 1);
+    return x;
+}
+static assert(test14371() == 2);
+
+/**************************************************
+    7151 - [CTFE] cannot compare classes with ==
+**************************************************/
+
+bool test7151()
+{
+    auto a = new Object;
+    return a == a && a != new Object;
+}
+static assert(test7151());
+
+
+/**************************************************
+    12603 - [CTFE] goto does not correctly call dtors
+**************************************************/
+
+struct S12603
+{
+    this(uint* dtorCalled)
+    {
+        *dtorCalled = 0;
+        this.dtorCalled = dtorCalled;
+    }
+
+    @disable this();
+
+    ~this()
+    {
+        ++*dtorCalled;
+    }
+
+    uint* dtorCalled;
+}
+
+
+auto numDtorCallsByGotoWithinScope()
+{
+    uint dtorCalled;
+    {
+        S12603 s = S12603(&dtorCalled);
+        assert(dtorCalled == 0);
+        goto L_abc;
+        L_abc:
+        assert(dtorCalled == 0);
+    }
+    assert(dtorCalled == 1);
+    return dtorCalled;
+}
+static assert(numDtorCallsByGotoWithinScope() == 1);
+
+
+auto numDtorCallsByGotoOutOfScope()
+{
+    uint dtorCalled;
+    {
+        S12603 s = S12603(&dtorCalled);
+        assert(dtorCalled == 0);
+        goto L_abc;
+    }
+    L_abc:
+    assert(dtorCalled == 1);
+    return dtorCalled;
+}
+static assert(numDtorCallsByGotoOutOfScope() == 1);
+
+
+uint numDtorCallsByGotoDifferentScopeAfter()
+{
+    uint dtorCalled;
+    {
+        S12603 s = S12603(&dtorCalled);
+        assert(dtorCalled == 0);
+    }
+    assert(dtorCalled == 1);
+    goto L_abc;
+    L_abc:
+    assert(dtorCalled == 1);
+    return dtorCalled;
+}
+static assert(numDtorCallsByGotoDifferentScopeAfter() == 1);
+
+
+auto numDtorCallsByGotoDifferentScopeBefore()
+{
+    uint dtorCalled;
+    assert(dtorCalled == 0);
+    goto L_abc;
+    L_abc:
+    assert(dtorCalled == 0);
+    {
+        S12603 s = S12603(&dtorCalled);
+        assert(dtorCalled == 0);
+    }
+    assert(dtorCalled == 1);
+    return dtorCalled;
+}
+static assert(numDtorCallsByGotoDifferentScopeBefore() == 1);
+
+
+struct S12603_2
+{
+    ~this()
+    {
+        dtorCalled = true;
+    }
+
+    bool dtorCalled = false;
+}
+
+auto structInCaseScope()
+{
+    auto charsets = S12603_2();
+    switch(1)
+    {
+    case 0:
+        auto set = charsets;
+        break;
+    default:
+        break;
+    }
+    return charsets.dtorCalled;
+}
+
+static assert(!structInCaseScope());
+
+/**************************************************
+    15251 - void cast in ForStatement.increment
+**************************************************/
+
+int test15251()
+{
+    for (ubyte lwr = 19;
+        lwr != 20;
+        cast(void)++lwr)    // have to to be evaluated with ctfeNeedNothing
+    {}
+    return 1;
+}
+static assert(test15251());
+
+/**************************************************
+    15998 - Sagfault caused by memory corruption
+**************************************************/
+
+immutable string[2] foo15998 = ["",""];
+immutable string[2][] bar15998a = foo15998 ~ baz15998;
+immutable string[2][] bar15998b = baz15998 ~ foo15998;
+
+auto baz15998()
+{
+    immutable(string[2])[] r;
+    return r;
+}
+
+static assert(bar15998a == [["", ""]]);
+static assert(bar15998b == [["", ""]]);
+
+/**************************************************
+    16094 - Non-overlapped slice assignment on an aggregate
+**************************************************/
+
+char[] f16094a()
+{
+    char[] x = new char[](6);
+    x[3..6] = x[0..3];
+    return x;
+}
+
+int[] f16094b()
+{
+    int[] x = new int[](6);
+    x[3..6] = x[0..3];
+    return x;
+}
+
+enum copy16094a = f16094a();
+enum copy16094b = f16094b();
+
+/**************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=17407
+
+bool foo17407()
+{
+    void delegate ( ) longest_convert;
+    return __traits(compiles, longest_convert = &doesNotExists);
+}
+
+static assert(!foo17407);
+
diff --git a/gcc/testsuite/gdc.test/compilable/json.d b/gcc/testsuite/gdc.test/compilable/json.d
new file mode 100644
index 00000000000..b0bcada5e22
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/json.d
@@ -0,0 +1,113 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -o- -X -Xf${RESULTS_DIR}/compilable/json.out
+// POST_SCRIPT: compilable/extra-files/json-postscript.sh
+// EXTRA_SOURCES: imports/jsonimport1.d imports/jsonimport2.d imports/jsonimport3.d imports/jsonimport4.d
+
+module json;
+
+
+static this() {}
+
+static ~this() {}
+
+
+alias int myInt;
+myInt x; // bug 3404
+
+struct Foo(T) { T t; }
+class  Bar(int T) { int t = T; }
+interface Baz(T...) { T[0] t() const; } // bug 3466
+
+template P(alias T) {}
+
+class Bar2 : Bar!1, Baz!(int, 2, null) {
+    this() {}
+    ~this() {} // bug 4178
+
+    static foo() {}
+    protected abstract Foo!int baz();
+    override int t() const { return 0; }
+}
+
+class Bar3 : Bar2 {
+	private int val;
+    this(int i) { val = i; }
+
+    protected override Foo!int baz() { return Foo!int(val); }
+}
+
+struct Foo2 {
+	Bar2 bar2;
+	union U {
+		struct {
+			short s;
+			int i;
+		}
+		Object o;
+	}
+}
+
+/++
+ + Documentation test
+ +/
+@trusted myInt bar(ref uint blah, Bar2 foo = new Bar3(7)) // bug 4477
+{
+	return -1;
+}
+
+@property int outer() nothrow
+in {
+	assert(true);
+}
+out(result) {
+	assert(result == 18);
+}
+body {
+	int x = 8;
+	int inner(void* v) nothrow
+	{
+		int y = 2;
+		assert(true);
+		return x + y;
+	}
+	int z = inner(null);
+	return x + z;
+}
+
+/** Issue 9484 - selective and renamed imports */
+import imports.jsonimport1 : target1, target2;
+import imports.jsonimport2 : alias1 = target1, alias2 = target2;
+import imports.jsonimport3 : alias3 = target1, alias4 = target2, target3;
+import imports.jsonimport4;
+
+struct S
+{
+    /** Issue 9480 - Template name should be stripped of parameters */
+    this(T)(T t) { }
+}
+
+/** Issue 9755 - Protection not emitted properly for Templates. */
+private struct S1_9755(T) { }
+package struct S2_9755(T) { }
+
+class C_9755
+{
+    protected static class CI_9755(T) { }
+}
+
+/** Issue 10011 - init property is wrong for object initializer. */
+const Object c_10011 = new Object();
+
+///
+enum Numbers
+{
+    unspecified1,
+    one  = 2,
+    two  = 3,
+    FILE_NOT_FOUND = 101,
+    unspecified3,
+    unspecified4,
+    four = 4,
+}
+
+template IncludeConstraint(T) if (T == string) {}
diff --git a/gcc/testsuite/gdc.test/compilable/line.d b/gcc/testsuite/gdc.test/compilable/line.d
new file mode 100644
index 00000000000..bf06ea30314
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/line.d
@@ -0,0 +1,34 @@
+#line 1
+module line;
+
+static assert(__LINE__ == 3);
+
+int #line 10
+x;
+
+static assert(__LINE__ == 12);
+version(Windows)
+{
+    static assert(__FILE__ == "compilable\\line.d");
+    static assert(__FILE_FULL_PATH__[1..3] == ":\\");
+}
+else
+{
+    static assert(__FILE__ == "compilable/line.d");
+    static assert(__FILE_FULL_PATH__[0] == '/');
+}
+static assert(__FILE_FULL_PATH__[$-__FILE__.length..$] == __FILE__);
+
+#line 100 "newfile.d"
+
+static assert(__LINE__ == 101);
+static assert(__FILE__ == "newfile.d");
+static assert(__FILE_FULL_PATH__ == "newfile.d");
+
+# line 200
+
+static assert(__LINE__ == 201);
+static assert(__FILE__ == "newfile.d");
+static assert(__FILE_FULL_PATH__ == "newfile.d");
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/nogc.d b/gcc/testsuite/gdc.test/compilable/nogc.d
new file mode 100644
index 00000000000..c2581da9c26
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/nogc.d
@@ -0,0 +1,111 @@
+// REQUIRED_ARGS: -o-
+
+/***************** Covariance ******************/
+
+class C1
+{
+    void foo() @nogc;
+    void bar();
+}
+
+class D1 : C1
+{
+    override void foo();        // no error
+    override void bar() @nogc;  // no error
+}
+
+/******************************************/
+// __traits(compiles)
+
+static assert(__traits(compiles, new Object()));
+
+void foo_compiles() {}
+
+@nogc void test_compiles()
+{
+    auto fp = &foo_compiles;
+    static assert(!__traits(compiles, foo_compiles()));
+    static assert(!__traits(compiles, fp()));
+    static assert(!__traits(compiles, (*fp)()));
+
+    static assert(!__traits(compiles, [1,2,3]));
+    static assert(!__traits(compiles, [1:1, 2:2]));
+
+    struct Struct {}
+    static assert(!__traits(compiles, new int));
+    static assert(!__traits(compiles, new Struct()));
+    static assert(!__traits(compiles, new Object()));
+
+    int* p;
+    static assert(!__traits(compiles, delete p));
+
+    int[int] aa;
+    static assert(!__traits(compiles, aa[0]));
+
+    int[] a;
+    static assert(!__traits(compiles, a.length = 1));
+    static assert(!__traits(compiles, a.length += 1));
+    static assert(!__traits(compiles, a.length -= 1));
+
+    static assert(!__traits(compiles, a ~= 1));
+    static assert(!__traits(compiles, a ~ a));
+}
+
+/******************************************/
+// 12630
+
+void test12630() @nogc
+{
+    // All of these declarations should cause no errors.
+
+    static const ex1 = new Exception("invalid");
+  //enum         ex2 = new Exception("invalid");
+
+    static const arr1 = [[1,2], [3, 4]];
+    enum         arr2 = [[1,2], [3, 4]];
+
+  //static const aa1 = [1:1, 2:2];
+    enum         aa2 = [1:1, 2:2];
+
+  //static const v1 = aa1[1];
+    enum         v2 = aa2[1];
+
+    Object o;
+    //static const del1 = (delete o).sizeof;
+    //enum         del2 = (delete o).sizeof;
+
+    int[] a;
+    static const len1 = (a.length = 1).sizeof;
+    enum         len2 = (a.length = 1).sizeof;
+
+    static const cata1 = (a ~= 1).sizeof;
+    enum         cata2 = (a ~= 1).sizeof;
+
+    static const cat1 = (a ~ a).sizeof;
+    enum         cat2 = (a ~ a).sizeof;
+}
+
+/******************************************/
+// 12642
+
+static if (is(__vector(ulong[2])))
+{
+    import core.simd;
+
+    ulong2 test12642() @nogc
+    {
+        return [0, 0];
+    }
+}
+
+/******************************************/
+// 13550
+
+auto foo13550() @nogc
+{
+    static int[] bar()
+    {
+        return new int[2];
+    }
+    return &bar;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/protattr.d b/gcc/testsuite/gdc.test/compilable/protattr.d
new file mode 100644
index 00000000000..ca53a5e7ec4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protattr.d
@@ -0,0 +1,5 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+import protection.basic.tests;
+import protection.subpkg.tests;
+import protection.subpkg2.tests;
diff --git a/gcc/testsuite/gdc.test/compilable/protection.d b/gcc/testsuite/gdc.test/compilable/protection.d
new file mode 100644
index 00000000000..3d6198d757c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection.d
@@ -0,0 +1,96 @@
+// REQUIRED_ARGS: -de
+import imports.protectionimp;
+
+alias TypeTuple(T...) = T;
+
+private
+{
+    void localF() {}
+    class localC {}
+    struct localS {}
+    union localU {}
+    interface localI {}
+    enum localE { foo }
+    mixin template localMT() {}
+
+    class localTC(T) {}
+    struct localTS(T) {}
+    union localTU(T) {}
+    interface localTI(T) {}
+    void localTF(T)() {}
+}
+
+void main()
+{
+    // Private non-template declarations
+    static assert(!__traits(compiles, privF()));
+    static assert(!__traits(compiles, privC));
+    static assert(!__traits(compiles, privS));
+    static assert(!__traits(compiles, privU));
+    static assert(!__traits(compiles, privI));
+    static assert(!__traits(compiles, privE));
+    static assert(!__traits(compiles, privMT));
+
+    // Private local non-template declarations.
+    static assert( __traits(compiles, localF()));
+    static assert( __traits(compiles, localC));
+    static assert( __traits(compiles, localS));
+    static assert( __traits(compiles, localU));
+    static assert( __traits(compiles, localI));
+    static assert( __traits(compiles, localE));
+    static assert( __traits(compiles, localMT));
+
+    // Private template declarations.
+    static assert(!__traits(compiles, privTF!int()));
+    static assert(!__traits(compiles, privTC!int));
+    static assert(!__traits(compiles, privTS!int));
+    static assert(!__traits(compiles, privTU!int));
+    static assert(!__traits(compiles, privTI!int));
+
+    // Private local template declarations.
+    static assert( __traits(compiles, localTF!int()));
+    static assert( __traits(compiles, localTC!int));
+    static assert( __traits(compiles, localTS!int));
+    static assert( __traits(compiles, localTU!int));
+    static assert( __traits(compiles, localTI!int));
+
+    // Public template function with private type parameters.
+    static assert(!__traits(compiles, publF!privC()));
+    static assert(!__traits(compiles, publF!privS()));
+    static assert(!__traits(compiles, publF!privU()));
+    static assert(!__traits(compiles, publF!privI()));
+    static assert(!__traits(compiles, publF!privE()));
+
+    // Public template function with private alias parameters.
+    static assert(!__traits(compiles, publFA!privC()));
+    static assert(!__traits(compiles, publFA!privS()));
+    static assert(!__traits(compiles, publFA!privU()));
+    static assert(!__traits(compiles, publFA!privI()));
+    static assert(!__traits(compiles, publFA!privE()));
+
+    // Private alias.
+    static assert(!__traits(compiles, privA));
+
+    // Public template mixin.
+    static assert( __traits(compiles, publMT));
+}
+
+/***************************************************/
+// 14169
+
+template staticMap14169(alias fun, T...)
+{
+    static if (T.length > 0)
+        alias staticMap14169 = TypeTuple!(fun!(T[0]), staticMap14169!(fun, T[1..$]));
+    else
+        alias staticMap14169 = TypeTuple!();
+}
+
+class C14169
+{
+    private struct InnerStruct(string NameS)
+    {
+        alias Name = NameS;
+    }
+    alias DimensionNames = staticMap14169!(GetName14169, InnerStruct!"A");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/protection/aggregate/mod14275.d b/gcc/testsuite/gdc.test/compilable/protection/aggregate/mod14275.d
new file mode 100644
index 00000000000..a6bcb415c62
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/aggregate/mod14275.d
@@ -0,0 +1,11 @@
+module protection.aggregate.mod14275;
+
+public struct Foo
+{
+    package(protection) void foo() {}
+    package void foo2() {}
+}
+
+package(protection) void bar()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/protection/basic/mod1.d b/gcc/testsuite/gdc.test/compilable/protection/basic/mod1.d
new file mode 100644
index 00000000000..76527bd5ca7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/basic/mod1.d
@@ -0,0 +1,13 @@
+module protection.basic.mod1;
+
+public void publicFoo() {}
+package void packageFoo() {}
+private void privateFoo() {}
+
+class Test
+{
+    public void publicFoo();
+    protected void protectedFoo();
+    package void packageFoo();
+    private void privateFoo();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/protection/basic/tests.d b/gcc/testsuite/gdc.test/compilable/protection/basic/tests.d
new file mode 100644
index 00000000000..6d3ee5aa25d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/basic/tests.d
@@ -0,0 +1,23 @@
+module protection.basic.tests;
+
+import protection.basic.mod1;
+
+static assert ( is(typeof(publicFoo())));
+static assert ( is(typeof(packageFoo())));
+static assert (!is(typeof(privateFoo())));
+
+static assert ( is(typeof(Test.init.publicFoo())));
+static assert (!is(typeof(Test.init.protectedFoo())));
+static assert ( is(typeof(Test.init.packageFoo())));
+static assert (!is(typeof(Test.init.privateFoo())));
+
+class Deriv : Test
+{
+    void stub()
+    {
+        static assert ( is(typeof(this.publicFoo())));
+        static assert ( is(typeof(this.protectedFoo())));
+        static assert ( is(typeof(this.packageFoo())));
+        static assert (!is(typeof(this.privateFoo())));
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/protection/bug/bug14275.d b/gcc/testsuite/gdc.test/compilable/protection/bug/bug14275.d
new file mode 100644
index 00000000000..90b7ea7a03a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/bug/bug14275.d
@@ -0,0 +1,12 @@
+module protection.bug.bug14275;
+
+import protection.aggregate.mod14275;
+
+// https://issues.dlang.org/show_bug.cgi?id=14275
+
+void main() {
+    Foo f;
+    f.foo();
+    static assert (!is(typeof(f.foo2())));
+    bar();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/protection/subpkg/explicit.d b/gcc/testsuite/gdc.test/compilable/protection/subpkg/explicit.d
new file mode 100644
index 00000000000..306ec9f2866
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/subpkg/explicit.d
@@ -0,0 +1,4 @@
+module protection.subpkg.explicit;
+
+package(protection) void commonAncestorFoo();
+package(protection.subpkg) void samePkgFoo();
diff --git a/gcc/testsuite/gdc.test/compilable/protection/subpkg/tests.d b/gcc/testsuite/gdc.test/compilable/protection/subpkg/tests.d
new file mode 100644
index 00000000000..0e8c716d3cf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/subpkg/tests.d
@@ -0,0 +1,12 @@
+module protection.subpkg.tests;
+
+import crosspkg = protection.basic.mod1;
+
+static assert ( is(typeof(crosspkg.publicFoo())));
+static assert (!is(typeof(crosspkg.packageFoo())));
+static assert (!is(typeof(crosspkg.privateFoo())));
+
+import samepkg = protection.subpkg.explicit;
+
+static assert ( is(typeof(samepkg.commonAncestorFoo())));
+static assert ( is(typeof(samepkg.samePkgFoo())));
diff --git a/gcc/testsuite/gdc.test/compilable/protection/subpkg2/tests.d b/gcc/testsuite/gdc.test/compilable/protection/subpkg2/tests.d
new file mode 100644
index 00000000000..9458a8e6b96
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/protection/subpkg2/tests.d
@@ -0,0 +1,5 @@
+module protection.subpkg2.tests;
+
+import pkg = protection.subpkg.explicit;
+
+static assert (is(typeof(pkg.commonAncestorFoo())));
diff --git a/gcc/testsuite/gdc.test/compilable/riia_ctor.d b/gcc/testsuite/gdc.test/compilable/riia_ctor.d
new file mode 100644
index 00000000000..1c8e142b796
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/riia_ctor.d
@@ -0,0 +1,44 @@
+// https://issues.dlang.org/show_bug.cgi?id=17494
+struct S
+{
+    ~this() {}
+}
+
+class C
+{
+    S s;
+
+    this() nothrow {}
+}
+
+// https://issues.dlang.org/show_bug.cgi?id=17505
+struct Array
+{
+    int[] _payload;
+    ~this()
+    {
+        import core.stdc.stdlib : free;
+        free(_payload.ptr);
+    }
+}
+
+class Scanner
+{
+    Array arr;
+    this() @safe {}
+}
+
+// https://issues.dlang.org/show_bug.cgi?id=17506
+struct TreeMap
+{
+    this() @disable;
+    this(TTree tree) { this.tree = tree; }
+    TTree tree;
+}
+
+struct TTree
+{
+    this() @disable;
+    this(int foo) {}
+    ~this() {}
+}
diff --git a/gcc/testsuite/gdc.test/compilable/scope.d b/gcc/testsuite/gdc.test/compilable/scope.d
new file mode 100644
index 00000000000..4f53730df1f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/scope.d
@@ -0,0 +1,14 @@
+/*
+ currently fails with extra safety checks
+ PERMUTE_FIXME_ARGS: -dip1000
+*/
+
+struct Cache
+{
+    ubyte[1] v;
+
+    ubyte[] set(ubyte[1] v)
+    {
+        return this.v[] = v[];
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/sw_transition_complex.d b/gcc/testsuite/gdc.test/compilable/sw_transition_complex.d
new file mode 100644
index 00000000000..f034c69e99e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/sw_transition_complex.d
@@ -0,0 +1,136 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -c -transition=complex
+
+/*
+TEST_OUTPUT:
+---
+compilable/sw_transition_complex.d(15): use of complex type 'creal' is scheduled for deprecation, use 'std.complex.Complex!(real)' instead
+compilable/sw_transition_complex.d(16): use of complex type 'cdouble' is scheduled for deprecation, use 'std.complex.Complex!(double)' instead
+compilable/sw_transition_complex.d(17): use of complex type 'cfloat' is scheduled for deprecation, use 'std.complex.Complex!(float)' instead
+compilable/sw_transition_complex.d(19): use of imaginary type 'ireal' is scheduled for deprecation, use 'real' instead
+compilable/sw_transition_complex.d(20): use of imaginary type 'idouble' is scheduled for deprecation, use 'double' instead
+compilable/sw_transition_complex.d(21): use of imaginary type 'ifloat' is scheduled for deprecation, use 'float' instead
+---
+*/
+creal c80value;
+cdouble c64value;
+cfloat c32value;
+
+ireal i80value;
+idouble i64value;
+ifloat i32value;
+
+/*
+TEST_OUTPUT:
+---
+compilable/sw_transition_complex.d(34): use of complex type 'creal*' is scheduled for deprecation, use 'std.complex.Complex!(real)' instead
+compilable/sw_transition_complex.d(35): use of complex type 'cdouble*' is scheduled for deprecation, use 'std.complex.Complex!(double)' instead
+compilable/sw_transition_complex.d(36): use of complex type 'cfloat*' is scheduled for deprecation, use 'std.complex.Complex!(float)' instead
+compilable/sw_transition_complex.d(38): use of imaginary type 'ireal*' is scheduled for deprecation, use 'real' instead
+compilable/sw_transition_complex.d(39): use of imaginary type 'idouble*' is scheduled for deprecation, use 'double' instead
+compilable/sw_transition_complex.d(40): use of imaginary type 'ifloat*' is scheduled for deprecation, use 'float' instead
+---
+*/
+creal* c80pointer;
+cdouble* c64pointer;
+cfloat* c32pointer;
+
+ireal* i80pointer;
+idouble* i64pointer;
+ifloat* i32pointer;
+
+/*
+TEST_OUTPUT:
+---
+compilable/sw_transition_complex.d(53): use of complex type 'creal[]*' is scheduled for deprecation, use 'std.complex.Complex!(real)' instead
+compilable/sw_transition_complex.d(54): use of complex type 'cdouble[]*' is scheduled for deprecation, use 'std.complex.Complex!(double)' instead
+compilable/sw_transition_complex.d(55): use of complex type 'cfloat[]*' is scheduled for deprecation, use 'std.complex.Complex!(float)' instead
+compilable/sw_transition_complex.d(57): use of imaginary type 'ireal[]*' is scheduled for deprecation, use 'real' instead
+compilable/sw_transition_complex.d(58): use of imaginary type 'idouble[]*' is scheduled for deprecation, use 'double' instead
+compilable/sw_transition_complex.d(59): use of imaginary type 'ifloat[]*' is scheduled for deprecation, use 'float' instead
+---
+*/
+creal[]* c80arrayp;
+cdouble[]* d64arrayp;
+cfloat[]* c32arrayp;
+
+ireal[]* i80arrayp;
+idouble[]* i64arrayp;
+ifloat[]* i32arrayp;
+
+/*
+TEST_OUTPUT:
+---
+compilable/sw_transition_complex.d(72): use of complex type 'creal[4][]*' is scheduled for deprecation, use 'std.complex.Complex!(real)' instead
+compilable/sw_transition_complex.d(73): use of complex type 'cdouble[4][]*' is scheduled for deprecation, use 'std.complex.Complex!(double)' instead
+compilable/sw_transition_complex.d(74): use of complex type 'cfloat[4][]*' is scheduled for deprecation, use 'std.complex.Complex!(float)' instead
+compilable/sw_transition_complex.d(76): use of imaginary type 'ireal[4][]*' is scheduled for deprecation, use 'real' instead
+compilable/sw_transition_complex.d(77): use of imaginary type 'idouble[4][]*' is scheduled for deprecation, use 'double' instead
+compilable/sw_transition_complex.d(78): use of imaginary type 'ifloat[4][]*' is scheduled for deprecation, use 'float' instead
+---
+*/
+creal[4][]* c80sarrayp;
+cdouble[4][]* c64sarrayp;
+cfloat[4][]* c32sarrayp;
+
+ireal[4][]* i80sarrayp;
+idouble[4][]* i64sarrayp;
+ifloat[4][]* i32sarrayp;
+
+/*
+TEST_OUTPUT:
+---
+compilable/sw_transition_complex.d(96): use of complex type 'creal' is scheduled for deprecation, use 'std.complex.Complex!(real)' instead
+compilable/sw_transition_complex.d(97): use of complex type 'creal*' is scheduled for deprecation, use 'std.complex.Complex!(real)' instead
+compilable/sw_transition_complex.d(98): use of complex type 'creal[]' is scheduled for deprecation, use 'std.complex.Complex!(real)' instead
+compilable/sw_transition_complex.d(99): use of complex type 'creal[4]' is scheduled for deprecation, use 'std.complex.Complex!(real)' instead
+compilable/sw_transition_complex.d(101): use of imaginary type 'ireal' is scheduled for deprecation, use 'real' instead
+compilable/sw_transition_complex.d(102): use of imaginary type 'ireal*' is scheduled for deprecation, use 'real' instead
+compilable/sw_transition_complex.d(103): use of imaginary type 'ireal[]' is scheduled for deprecation, use 'real' instead
+compilable/sw_transition_complex.d(104): use of imaginary type 'ireal[4]' is scheduled for deprecation, use 'real' instead
+---
+*/
+alias C14488 = creal;
+alias I14488 = ireal;
+
+C14488 calias1;
+C14488* calias2;
+C14488[] calias3;
+C14488[4] calias4;
+
+I14488 ialias1;
+I14488* ialias2;
+I14488[] ialias3;
+I14488[4] ialias4;
+
+/*
+TEST_OUTPUT:
+---
+compilable/sw_transition_complex.d(115): use of complex type 'cdouble' is scheduled for deprecation, use 'std.complex.Complex!(double)' instead
+compilable/sw_transition_complex.d(116): use of imaginary type 'idouble' is scheduled for deprecation, use 'double' instead
+compilable/sw_transition_complex.d(117): use of complex type 'cdouble' is scheduled for deprecation, use 'std.complex.Complex!(double)' instead
+compilable/sw_transition_complex.d(118): use of complex type 'cdouble[]' is scheduled for deprecation, use 'std.complex.Complex!(double)' instead
+---
+*/
+auto cauto = 1 + 0i;
+auto iauto = 1i;
+size_t c64sizeof = (cdouble).sizeof;
+TypeInfo c64ti = typeid(cdouble[]);
+
+/*
+TEST_OUTPUT:
+---
+compilable/sw_transition_complex.d(128): use of complex type 'creal*' is scheduled for deprecation, use 'std.complex.Complex!(real)' instead
+compilable/sw_transition_complex.d(128): use of imaginary type 'ireal' is scheduled for deprecation, use 'real' instead
+compilable/sw_transition_complex.d(132): use of complex type 'creal' is scheduled for deprecation, use 'std.complex.Complex!(real)' instead
+---
+*/
+void test14488a(creal *p, real r, ireal i)
+{
+}
+
+creal test14488b()
+{
+    return 1 + 0i;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/sw_transition_field.d b/gcc/testsuite/gdc.test/compilable/sw_transition_field.d
new file mode 100644
index 00000000000..83dd2617459
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/sw_transition_field.d
@@ -0,0 +1,25 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -c -transition=field
+/*
+TEST_OUTPUT:
+---
+compilable/sw_transition_field.d(15): sw_transition_field.S1.ix is immutable field
+compilable/sw_transition_field.d(16): sw_transition_field.S1.cx is const field
+compilable/sw_transition_field.d(21): sw_transition_field.S2!(immutable(int)).S2.f is immutable field
+compilable/sw_transition_field.d(21): sw_transition_field.S2!(const(int)).S2.f is const field
+---
+*/
+
+struct S1
+{
+    immutable int ix = 1;
+    const int cx = 2;
+}
+
+struct S2(F)
+{
+    F f = F.init;
+}
+
+alias S2!(immutable int) S2I;
+alias S2!(    const int) S2C;
diff --git a/gcc/testsuite/gdc.test/compilable/sw_transition_tls.d b/gcc/testsuite/gdc.test/compilable/sw_transition_tls.d
new file mode 100644
index 00000000000..1085e80c401
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/sw_transition_tls.d
@@ -0,0 +1,16 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -c -transition=tls
+/*
+TEST_OUTPUT:
+---
+compilable/sw_transition_tls.d(11): x is thread local
+compilable/sw_transition_tls.d(15): y is thread local
+---
+*/
+
+int x;
+
+struct S
+{
+    static int y;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test1.d b/gcc/testsuite/gdc.test/compilable/test1.d
new file mode 100644
index 00000000000..80c382b5e71
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test1.d
@@ -0,0 +1,13 @@
+// PERMUTE_ARGS:
+
+class File
+{
+    import imports.test1imp;
+
+    static char[] read(char[] name)
+    {
+	DWORD size;	// DWORD is defined in test1imp
+	return null;
+    }
+
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10056.d b/gcc/testsuite/gdc.test/compilable/test10056.d
new file mode 100644
index 00000000000..ec076d5d24d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10056.d
@@ -0,0 +1,66 @@
+void main()
+{
+    alias Zoo = Foo10056!(false, false, 1);
+}
+
+struct Foo10056(bool S, bool L, size_t N)
+{
+    string bar()
+    {
+        Appender10056!(string) w;
+        char[] buf; put10056(w, buf);
+        return "";
+    }
+
+    public bool opEquals(T)(T other) //const
+    //If you add const, also fails to compile with 2.062.
+    {
+        alias Foo10056!(typeof(this), T, "CMP") P;
+        return false;
+    }
+}
+
+template Foo10056(T, U, string OP)
+{
+    static if (T.ISEMPTY && U.ISEMPTY)
+        enum bool S = false;
+    else
+        enum bool S = false;
+
+    alias Foo10056 = Foo10056!(false, false, 0);
+}
+
+/**********************************************/
+
+void put10056(R, E)(ref R r, E e)
+{
+    static if (is(typeof(r.put(e))))
+    {
+        r.put(e);
+    }
+    else
+    {
+        static assert(false, "Cannot put a "~E.stringof~" into a "~R.stringof);
+    }
+}
+
+struct Appender10056(A : T[], T)
+{
+    private template canPutItem(U)
+    {
+        enum bool canPutItem = is(U : T);
+    }
+    private template canPutRange(R)
+    {
+        enum bool canPutRange = is(typeof(Appender10056.init.put(R.init[0])));
+    }
+
+    void put(U)(U item) if (canPutItem!U)
+    {
+        char[T.sizeof == 1 ? 4 : 2] encoded;
+        put(encoded[]);
+    }
+    void put(R)(R items) if (canPutRange!R)
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10066.d b/gcc/testsuite/gdc.test/compilable/test10066.d
new file mode 100644
index 00000000000..fc3ffe2cb3c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10066.d
@@ -0,0 +1,66 @@
+void main()
+{
+    alias Zoo = Foo!(1);
+}
+
+struct Foo(size_t N)
+{
+    string bar()
+    {
+        Appender!(string) w;
+        char[] buf; put(w, buf);
+        return "";
+    }
+
+    public bool opEquals(T)(T other) const
+    // Add const, different from bug 10056
+    {
+        alias Foo!(typeof(this), T, "CMP") P;
+        return false;
+    }
+}
+
+template Foo(T, U, string OP)
+{
+    static if (T.ISEMPTY && U.ISEMPTY)
+        enum bool S = false;
+    else
+        enum bool S = false;
+
+    alias Foo = Foo!(0);
+}
+
+/**********************************************/
+
+void put(R, E)(ref R r, E e)
+{
+    static if (is(typeof(r.put(e))))
+    {
+        r.put(e);
+    }
+    else
+    {
+        static assert(false, "Cannot put a "~E.stringof~" into a "~R.stringof);
+    }
+}
+
+struct Appender(A : T[], T)
+{
+    private template canPutItem(U)
+    {
+        enum bool canPutItem = is(U : T);
+    }
+    private template canPutRange(R)
+    {
+        enum bool canPutRange = is(typeof(Appender.init.put(R.init[0])));
+    }
+
+    void put(U)(U item) if (canPutItem!U)
+    {
+        char[T.sizeof == 1 ? 4 : 2] encoded;
+        put(encoded[]);
+    }
+    void put(R)(R items) if (canPutRange!R)
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10073.d b/gcc/testsuite/gdc.test/compilable/test10073.d
new file mode 100644
index 00000000000..1faf6bf18e4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10073.d
@@ -0,0 +1,24 @@
+struct Arr(T)
+{
+    T[] dArr;
+    alias dArr this;
+    bool opEquals(Arr!T d)
+    {
+        foreach (idx, it; d)
+        {
+            if (this[idx] != it)
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+}
+
+class Bar
+{
+    Arr!Foo fooQ;
+}
+
+class Foo {}    // NG
+
diff --git a/gcc/testsuite/gdc.test/compilable/test10186.d b/gcc/testsuite/gdc.test/compilable/test10186.d
new file mode 100644
index 00000000000..d7eccbc7e38
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10186.d
@@ -0,0 +1,27 @@
+struct S {
+    @disable this();
+
+    this(int i) {
+    }
+}
+
+class C {
+    this() {
+        s = S(1);
+    }
+
+    S s;
+}
+
+class CR
+{
+    S s;
+
+    this() {
+        s = S(1);
+    }
+}
+
+void main() {
+    auto c = new C;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10312.d b/gcc/testsuite/gdc.test/compilable/test10312.d
new file mode 100644
index 00000000000..db56bc2b5e2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10312.d
@@ -0,0 +1,11 @@
+
+version(D_SIMD)
+{
+    const __vector(float[4]) si = [1f, 1f, 1f, 1f];
+
+    void main()
+    {
+        auto arr = si;
+        return;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10375.d b/gcc/testsuite/gdc.test/compilable/test10375.d
new file mode 100644
index 00000000000..b9704f6a244
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10375.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -o-
+
+import imports.test10375a;
+
+void packIt(Pack)(Pack p){ }  //3
+
+void main()
+{
+    alias p = packIt!(int);
+    p(2);               // OK <- NG
+    packIt(2);          // OK <- NG
+    packIt!(int)(2);    // OK <- NG
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10520.d b/gcc/testsuite/gdc.test/compilable/test10520.d
new file mode 100644
index 00000000000..9a24d840527
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10520.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -debug -profile
+
+// Issue 10520 [profile+nothrow] Building with profiler results in "is not nothrow" error on some contracts
+
+void f() { }
+
+void g()()
+in { f(); } // OK <- Error: 'main.f' is not nothrow
+body { }
+
+alias gi = g!();
diff --git a/gcc/testsuite/gdc.test/compilable/test10695.d b/gcc/testsuite/gdc.test/compilable/test10695.d
new file mode 100644
index 00000000000..c4894cd0a8b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10695.d
@@ -0,0 +1,9 @@
+// PERMUTE_ARGS:
+module a;
+
+void main()
+{
+    mixin("string mod1 = __MODULE__;");
+    mixin("enum mod2 = __MODULE__;");
+    static assert(mod2 == "a");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10726.d b/gcc/testsuite/gdc.test/compilable/test10726.d
new file mode 100644
index 00000000000..3db2f807ab2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10726.d
@@ -0,0 +1,53 @@
+// PERMUTE_ARGS:
+
+public struct CirBuff(T)
+{
+    private T[] data;
+    private size_t head = 0;
+    private size_t size = 0;
+    public size_t length() const { return size; }
+
+    public bool opEquals(CirBuff!T d) @trusted
+    {
+        if (length != d.length)
+            return false;
+        for (size_t i=0; i!=size; ++i)
+        {
+            if (this.data[(this.head+i) % this.data.length] !=
+                d.data[(d.head + i) % d.data.length])
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+}
+
+class Once
+{
+    Foo!Bar _bar;
+}
+
+class Bar
+{
+    static Once _once;
+    mixin(sync!(Once, "_once"));
+}
+
+class Foo(T = int)
+{
+    CirBuff!T _buff;
+}
+
+template sync(T, string U = "this", size_t ITER = 0)
+{
+    static if (ITER == __traits(derivedMembers, T).length)
+        enum sync = "";
+    else
+    {
+        enum string mem = __traits(derivedMembers, T)[ITER];
+        enum string sync =
+            "static if(! __traits(isVirtualMethod, " ~ U ~ "." ~ mem ~ ")) { }"
+            ~ sync!(T, U, ITER+1);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10752.d b/gcc/testsuite/gdc.test/compilable/test10752.d
new file mode 100644
index 00000000000..449377e3f06
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10752.d
@@ -0,0 +1,6 @@
+import imports.test10752;
+void main()
+{
+    static assert(!__traits(compiles, priv));
+    static assert(!__traits(compiles, priv));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10981.d b/gcc/testsuite/gdc.test/compilable/test10981.d
new file mode 100644
index 00000000000..f0a6820fa7e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10981.d
@@ -0,0 +1,24 @@
+void foo(int i)
+in
+{
+    class X1
+    {
+        void in_nested() pure
+        in { assert(i); }   // OK <- NG
+        out { assert(i); }  // OK <- NG
+        body {}
+    }
+}
+out
+{
+    class X2
+    {
+        void out_nested() pure
+        in { assert(i); }   // OK <- NG
+        out { assert(i); }  // OK <- NG
+        body {}
+    }
+}
+body
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10992.d b/gcc/testsuite/gdc.test/compilable/test10992.d
new file mode 100644
index 00000000000..8462939ed79
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10992.d
@@ -0,0 +1,11 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -unittest
+
+unittest { }
+unittest { }
+unittest { }
+
+void main()
+{
+    static assert(__traits(getUnitTests, mixin(__MODULE__)).length == 3);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10992b.d b/gcc/testsuite/gdc.test/compilable/test10992b.d
new file mode 100644
index 00000000000..67c7d41d71c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10992b.d
@@ -0,0 +1,16 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -unittest
+
+version(none)
+{}
+else
+{
+    unittest { }
+    unittest { }
+    unittest { }
+}
+
+void main()
+{
+    static assert(__traits(getUnitTests, mixin(__MODULE__)).length == 3);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test10993.d b/gcc/testsuite/gdc.test/compilable/test10993.d
new file mode 100644
index 00000000000..e5a1b847976
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test10993.d
@@ -0,0 +1,33 @@
+module test10993;
+
+auto foo(T)(T a)
+{
+	static immutable typeof(a) q;
+//	pragma(msg, "foo: " ~ typeof(q).mangleof);
+	return q;
+}
+
+struct test(alias fn)
+{
+	bool ini = true;
+	void* p;
+}
+
+auto fun()
+{
+	auto x = foo!()(test!(a=>a)());
+//	pragma(msg, "fun: " ~ typeof(x).mangleof);
+	
+	return x;
+}
+
+void main()
+{
+	const x = fun();
+	enum mangle_x = typeof(x).mangleof;
+//	pragma(msg, "x  : " ~ mangle_x);
+	auto y = cast()x;
+	enum mangle_y = typeof(y).mangleof;
+//	pragma(msg, "y  : " ~ mangle_y);
+	static assert (mangle_y == mangle_x[1..$]);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test11169.d b/gcc/testsuite/gdc.test/compilable/test11169.d
new file mode 100644
index 00000000000..10a3df2c7a6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11169.d
@@ -0,0 +1,45 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+1: false
+2: true
+3: true
+---
+*/
+
+class A
+{
+    abstract void foo();
+}
+
+template MixinAbstractBar() { abstract void bar(); }
+
+class B1 : A
+{
+    // Use pragma instead of static assert, in order to evaluate
+    // __traits during ClassDeclaration.semantic().
+    pragma(msg, "1: ", __traits(isAbstractClass, typeof(this)));
+    override void foo() {}
+}
+
+class B2 : A
+{
+    pragma(msg, "2: ", __traits(isAbstractClass, typeof(this)));
+    override void foo() {}
+    abstract void bar();
+}
+
+class B3 : A
+{
+    pragma(msg, "3: ", __traits(isAbstractClass, typeof(this)));
+    override void foo() {}
+    mixin MixinAbstractBar!();
+}
+
+void main()
+{
+    static assert( __traits(compiles, { auto b = new B1(); }));
+    static assert(!__traits(compiles, { auto b = new B2(); }));
+    static assert(!__traits(compiles, { auto b = new B3(); }));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test11225a.d b/gcc/testsuite/gdc.test/compilable/test11225a.d
new file mode 100644
index 00000000000..58df82793e3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11225a.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+WORKS
+---
+*/
+
+import imports.test11225b;
+interface I {}
diff --git a/gcc/testsuite/gdc.test/compilable/test11237.d b/gcc/testsuite/gdc.test/compilable/test11237.d
new file mode 100644
index 00000000000..1700af426f7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11237.d
@@ -0,0 +1,4 @@
+// PERMUTE_ARGS:
+// POST_SCRIPT: compilable/extra-files/test11237.sh
+
+struct Buffer { ubyte[64 * 1024] buffer; }
diff --git a/gcc/testsuite/gdc.test/compilable/test11371.d b/gcc/testsuite/gdc.test/compilable/test11371.d
new file mode 100644
index 00000000000..c5229292a62
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11371.d
@@ -0,0 +1,11 @@
+
+version(D_SIMD)
+{
+    __vector(long[2]) f()
+    {
+        __vector(long[2]) q;
+        return q;
+    }
+
+    enum __vector(long[2]) v = f();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test11471.d b/gcc/testsuite/gdc.test/compilable/test11471.d
new file mode 100644
index 00000000000..1df7e80f20a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11471.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -profile
+
+void main() nothrow
+{
+    // Error: asm statements are assumed to throw
+    version(GNU)
+        asm { ""; }
+    else
+        asm { nop; }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test11559upgradeoptlink.d b/gcc/testsuite/gdc.test/compilable/test11559upgradeoptlink.d
new file mode 100644
index 00000000000..b61ffc81d27
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11559upgradeoptlink.d
@@ -0,0 +1,16 @@
+// REQUIRED_ARGS: -g
+
+// If this is failing, you need optlink 8.00.14 or higher
+
+string gen()
+{
+    string m;
+    foreach(i; 0..4096)
+        m ~= "mixin(\"assert(0);\n\n\n\n\");\n";
+    return m;
+}
+
+void main()
+{
+    mixin(gen());
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test11563.d b/gcc/testsuite/gdc.test/compilable/test11563.d
new file mode 100644
index 00000000000..b208215bdb6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11563.d
@@ -0,0 +1,9 @@
+import imports.test11563std_traits;
+
+interface J : I {} // comment out to let compilation succeed
+
+struct A { }
+pragma(msg, moduleName!A);
+
+
+interface I {}
diff --git a/gcc/testsuite/gdc.test/compilable/test11656.d b/gcc/testsuite/gdc.test/compilable/test11656.d
new file mode 100644
index 00000000000..4de3065088d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11656.d
@@ -0,0 +1,10 @@
+
+version(D_SIMD)
+{
+	struct Foo
+	{
+		__vector(float[4]) x;
+	}
+	static assert(Foo.x.offsetof == 0);
+	static assert(Foo.x.stringof == "x");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test11824.d b/gcc/testsuite/gdc.test/compilable/test11824.d
new file mode 100644
index 00000000000..0ec0dd63e48
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11824.d
@@ -0,0 +1,72 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+struct Take(R)
+{
+    public R source;
+    private size_t _maxAvailable;
+
+    alias R Source;
+
+    @property bool empty()
+    {
+        return _maxAvailable == 0 || source.empty;
+    }
+
+    @property auto ref front()
+    {
+        return source.front;
+    }
+
+    void popFront()
+    {
+        source.popFront();
+        --_maxAvailable;
+    }
+
+    @property size_t length() const
+    {
+        return _maxAvailable;
+    }
+}
+
+struct Repeat(T)
+{
+    private T _value;
+
+    enum bool empty = false;
+    @property inout(T) front() inout { return _value; }
+    void popFront() {}
+}
+
+Take!(Repeat!T) repeat(T)(T value, size_t n)
+{
+    return typeof(return)(Repeat!T(value), n);
+}
+
+auto array(Range)(Range r)
+{
+    alias E = typeof(r.front);
+    //static if (hasLength!Range)
+    {
+        if (r.length == 0)
+            return null;
+
+        auto result = new E[](r.length);
+
+        size_t i;
+        static auto trustedGetAddr(T)(ref T t) @trusted nothrow pure
+        {
+            return &t;
+        }
+        foreach (e; r)
+        {
+            *trustedGetAddr(result[i]) = e;
+            ++i;
+        }
+        return cast(E[])result;
+    }
+}
+
+enum r = [1].repeat(1).array;
+static assert(r == [[1]]);
diff --git a/gcc/testsuite/gdc.test/compilable/test11914.d b/gcc/testsuite/gdc.test/compilable/test11914.d
new file mode 100644
index 00000000000..f3195f1abe1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11914.d
@@ -0,0 +1,118 @@
+// std.array
+@property bool empty(T)(in T[] a) { return !a.length; }
+@property ref T front(T)(T[] a) { return a[0]; }
+void popFront(T)(ref T[] a) { a = a[1 .. $]; }
+
+// std.typecons
+struct Tuple(T...)
+{
+    T field;
+    alias field this;
+}
+Tuple!T tuple(T...)(T args) { return typeof(return)(args); }
+
+// std.range
+template ElementType(R)
+{
+    static if (is(typeof(R.init.front.init) T))
+        alias T ElementType;
+    else
+        alias void ElementType;
+}
+
+struct Repeat(T)
+{
+    private T _value;
+
+    enum bool empty = false;
+    @property inout(T) front() inout { return _value; }
+    void popFront() {}
+}
+Repeat!T repeat(T)(T value) { return Repeat!T(value); }
+
+struct Zip(R...)
+{
+    //alias Tuple!(staticMap!(.ElementType, R)) ElementType;
+    static if (R.length == 3)
+        alias Tuple!(int, int, int) ElementType;
+    static if (R.length == 2)
+        alias Tuple!(int, int) ElementType;
+
+    R ranges;
+
+    this(R rs)
+    {
+        foreach (i, Unused; R)
+        {
+            ranges[i] = rs[i];
+        }
+    }
+
+    @property bool empty()
+    {
+        foreach (i, Unused; R)
+        {
+            if (ranges[i].empty)
+                return true;
+        }
+        return false;
+    }
+    @property ElementType front()
+    {
+        ElementType result;
+        return result;
+    }
+    void popFront()
+    {
+        foreach (i, Unused; R)
+        {
+            ranges[i].popFront();
+        }
+    }
+
+    ElementType opIndex(size_t n)
+    {
+        ElementType result;
+        return result;
+    }
+}
+auto zip(Rs...)(Rs ranges) { return Zip!Rs(ranges); }
+
+// std.algorithm
+template map(fun...)
+{
+    auto map(Range)(Range r)
+    {
+        return MapResult!(fun, Range)(r);
+    }
+}
+private struct MapResult(alias fun, R)
+{
+    R _input;
+
+    this(R input)
+    {
+        _input = input;
+    }
+
+    @property bool empty() { return _input.empty; }
+    @property auto ref front() { return fun(_input.front); }
+    void popFront() { _input.popFront(); }
+}
+
+auto cartesianProduct(R1, R2)(R1 range1, R2 range2)
+{
+    return range2.map!((ElementType!R2 a) => zip(range1, repeat(a)));
+}
+auto cartesianProduct(R1, R2, RR...)(R1 range1, R2 range2, RR otherRanges)
+{
+    return map!(a => tuple(a[0], a[1][0], a[1][1]))(
+        cartesianProduct(range1, cartesianProduct(range2, otherRanges))
+    );
+}
+
+// test
+void main()
+{
+    foreach (i, j, k; cartesianProduct([1], [1], [1])) {}
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test11980.d b/gcc/testsuite/gdc.test/compilable/test11980.d
new file mode 100644
index 00000000000..27974e42451
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test11980.d
@@ -0,0 +1,2 @@
+void start() {}
+pragma(startaddress, start);
diff --git a/gcc/testsuite/gdc.test/compilable/test12009.d b/gcc/testsuite/gdc.test/compilable/test12009.d
new file mode 100644
index 00000000000..be6049bf757
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12009.d
@@ -0,0 +1,36 @@
+struct RefCounted(T)
+{
+    struct RefCountedStore
+    {
+        private struct Impl
+        {
+            T _payload;
+        }
+
+        private Impl* _store;
+    }
+    RefCountedStore _refCounted;
+
+    ~this()
+    {
+        import core.stdc.stdlib : free;
+    }
+}
+
+struct GroupBy(R)
+{
+    struct SharedInput
+    {
+        Group unused;
+    }
+
+    struct Group
+    {
+        private RefCounted!SharedInput _allGroups;
+    }
+}
+
+void main()
+{
+    GroupBy!(int[]) g1;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test1238.d b/gcc/testsuite/gdc.test/compilable/test1238.d
new file mode 100644
index 00000000000..fa19d619b04
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test1238.d
@@ -0,0 +1,10 @@
+module test1238;
+
+import imports.test1238a;
+import imports.test1238b;
+
+void foo()
+{
+    int qwert = zuiop;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test12523.d b/gcc/testsuite/gdc.test/compilable/test12523.d
new file mode 100644
index 00000000000..8a8eae15097
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12523.d
@@ -0,0 +1,15 @@
+void test12523(inout(int))
+{
+    void check(T)()
+    {
+        T[] a;
+        foreach (ref e; a)
+            static assert(is(typeof(e) == T));
+    }
+
+    check!(int)();
+    check!(inout(int))();
+    check!(inout(const(int)))();
+    check!(const(int))();
+    check!(immutable(int))();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test12527.d b/gcc/testsuite/gdc.test/compilable/test12527.d
new file mode 100644
index 00000000000..b075b9ede03
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12527.d
@@ -0,0 +1,10 @@
+// https://issues.dlang.org/show_bug.cgi?id=12527
+
+@system:
+    alias Fun = void function() @safe;
+    pragma (msg, Fun.stringof);
+    static assert(Fun.stringof == "void function() @safe");
+    alias Del = void delegate() @safe;
+    pragma (msg, Del.stringof);
+    static assert(Del.stringof == "void delegate() @safe");
+
diff --git a/gcc/testsuite/gdc.test/compilable/test12567a.d b/gcc/testsuite/gdc.test/compilable/test12567a.d
new file mode 100644
index 00000000000..53cc377e632
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12567a.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS:
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+---
+*/
+deprecated
+module test12567a;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/test12567b.d b/gcc/testsuite/gdc.test/compilable/test12567b.d
new file mode 100644
index 00000000000..2e37d31c786
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12567b.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS:
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+---
+*/
+deprecated("message")
+module test12567b;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/test12567c.d b/gcc/testsuite/gdc.test/compilable/test12567c.d
new file mode 100644
index 00000000000..cadc375bf0b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12567c.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS:
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+compilable/test12567c.d(9): Deprecation: module imports.a12567 is deprecated - This module will be removed in future release.
+---
+*/
+import imports.a12567;
+
+void main() { foo(); }
diff --git a/gcc/testsuite/gdc.test/compilable/test12567d.d b/gcc/testsuite/gdc.test/compilable/test12567d.d
new file mode 100644
index 00000000000..512f0b76e23
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12567d.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -d
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+---
+*/
+import imports.a12567;
+
+void main() { foo(); }
diff --git a/gcc/testsuite/gdc.test/compilable/test12593.d b/gcc/testsuite/gdc.test/compilable/test12593.d
new file mode 100644
index 00000000000..1b2dcacc0d2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12593.d
@@ -0,0 +1,12 @@
+int[R] aa;  // Place before the declaration of key struct
+
+struct R
+{
+    int opCmp(ref const R) const { return 0; }
+
+    //bool opEquals(ref const R) const { return true; }
+    //size_t toHash() const nothrow @safe { return 0; }
+}
+
+void main()
+{}
diff --git a/gcc/testsuite/gdc.test/compilable/test12967.d b/gcc/testsuite/gdc.test/compilable/test12967.d
new file mode 100644
index 00000000000..dd238386866
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12967.d
@@ -0,0 +1,64 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+void foo() {}
+alias F = typeof(foo);
+
+const        { void block_c() {} }
+immutable    { void block_i() {} }
+inout        { void block_w() {} }
+shared       { void block_s() {} }
+shared const { void block_sc() {} }
+shared inout { void block_sw() {} }
+
+static assert(is(typeof(block_c) == F));
+static assert(is(typeof(block_i) == F));
+static assert(is(typeof(block_w) == F));
+static assert(is(typeof(block_s) == F));
+static assert(is(typeof(block_sc) == F));
+static assert(is(typeof(block_sw) == F));
+
+version (all) { const:        void label_c() {} }
+version (all) { immutable:    void label_i() {} }
+version (all) { inout:        void label_w() {} }
+version (all) { shared:       void label_s() {} }
+version (all) { shared const: void label_sc() {} }
+version (all) { shared inout: void label_sw() {} }
+
+static assert(is(typeof(label_c) == F));
+static assert(is(typeof(label_i) == F));
+static assert(is(typeof(label_w) == F));
+static assert(is(typeof(label_s) == F));
+static assert(is(typeof(label_sc) == F));
+static assert(is(typeof(label_sw) == F));
+
+class C
+{
+    const        { static void block_c() {} }
+    immutable    { static void block_i() {} }
+    inout        { static void block_w() {} }
+    shared       { static void block_s() {} }
+    shared const { static void block_sc() {} }
+    shared inout { static void block_sw() {} }
+
+    static assert(is(typeof(block_c) == F));
+    static assert(is(typeof(block_i) == F));
+    static assert(is(typeof(block_w) == F));
+    static assert(is(typeof(block_s) == F));
+    static assert(is(typeof(block_sc) == F));
+    static assert(is(typeof(block_sw) == F));
+
+    version (all) { const:        static void label_c() {} }
+    version (all) { immutable:    static void label_i() {} }
+    version (all) { inout:        static void label_w() {} }
+    version (all) { shared:       static void label_s() {} }
+    version (all) { shared const: static void label_sc() {} }
+    version (all) { shared inout: static void label_sw() {} }
+
+    static assert(is(typeof(label_c) == F));
+    static assert(is(typeof(label_i) == F));
+    static assert(is(typeof(label_w) == F));
+    static assert(is(typeof(label_s) == F));
+    static assert(is(typeof(label_sc) == F));
+    static assert(is(typeof(label_sw) == F));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test12979a.d b/gcc/testsuite/gdc.test/compilable/test12979a.d
new file mode 100644
index 00000000000..14ca6efc0ee
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12979a.d
@@ -0,0 +1,5 @@
+void parse()
+{
+    asm pure nothrow @nogc @trusted {}
+    asm @safe {}
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test12979b.d b/gcc/testsuite/gdc.test/compilable/test12979b.d
new file mode 100644
index 00000000000..41c76a251e8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test12979b.d
@@ -0,0 +1,64 @@
+// REQUIRED_ARGS: -w -de
+
+void foo() pure nothrow @nogc @safe
+{
+    version(GNU)
+    {
+        asm pure nothrow @nogc @trusted
+        {
+            "";
+        }
+    }
+    else
+    {
+        asm pure nothrow @nogc @trusted
+        {
+            ret;
+        }
+    }
+}
+
+void bar()()
+{
+    version(GNU)
+    {
+        asm pure nothrow @nogc @trusted
+        {
+            "";
+        }
+    }
+    else
+    {
+        asm pure nothrow @nogc @trusted
+        {
+            ret;
+        }
+    }
+}
+
+static assert(__traits(compiles, () pure nothrow @nogc @safe => bar()));
+
+void baz()()
+{
+    version(GNU)
+    {
+        asm
+        {
+            "";
+        }
+    }
+    else
+    {
+        asm
+        {
+            ret;
+        }
+    }
+}
+
+// wait for deprecation of asm pure inference
+// static assert(!__traits(compiles, () pure => baz()));
+static assert(!__traits(compiles, () nothrow => baz()));
+// wait for deprecation of asm @nogc inference
+// static assert(!__traits(compiles, () @nogc => baz()));
+static assert(!__traits(compiles, () @safe => baz()));
diff --git a/gcc/testsuite/gdc.test/compilable/test13008.d b/gcc/testsuite/gdc.test/compilable/test13008.d
new file mode 100644
index 00000000000..fd1f41db9cd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13008.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS: -d -de -dw
+/*
+TEST_OUTPUT*
+---
+---
+*/
+deprecated class Dep { }
+deprecated Dep depFunc1(); // error
+deprecated void depFunc2(Dep); // error
diff --git a/gcc/testsuite/gdc.test/compilable/test13053.d b/gcc/testsuite/gdc.test/compilable/test13053.d
new file mode 100644
index 00000000000..3f8b4219c96
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13053.d
@@ -0,0 +1,13 @@
+// PERMUTE_ARGS: -w -wi
+/*
+TEST_OUTPUT:
+---
+---
+*/
+
+@system:
+
+struct S
+{
+    int[] a;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test13193.d b/gcc/testsuite/gdc.test/compilable/test13193.d
new file mode 100644
index 00000000000..58cb617c497
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13193.d
@@ -0,0 +1,126 @@
+// REQUIRED_ARGS: -O -inline -c
+
+
+final class SharedLib {
+    void getSymbol() {return getSymbolImpl();}
+    void getSymbolImpl() {return getSymbol_();}
+    /* add more intermediate functions to go slower */
+    void getSymbol_() {}
+}
+
+
+void test13193()
+{
+SharedLib ssllib;
+void bindFunc() {ssllib.getSymbol();}
+    bindFunc(); /* add more of these to go slower */
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc(); /* 10 */
+
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc(); /* 20 */
+
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc(); /* 30 */
+
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc(); /* 40 */
+
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc(); /* 50 */
+
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc(); /* 60 */
+
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc(); /* 70 */
+
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc(); /* 80 */
+
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc(); /* 90 */
+
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc();
+    bindFunc(); /* 100 */
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test13194.d b/gcc/testsuite/gdc.test/compilable/test13194.d
new file mode 100644
index 00000000000..cefa7ba0fed
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13194.d
@@ -0,0 +1,17 @@
+module test13194;
+
+class C13194
+{
+    static Object o = void;
+}
+
+struct S13194
+{
+    static Object o = void;
+}
+
+union U13194
+{
+    static Object o = void;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test13226.d b/gcc/testsuite/gdc.test/compilable/test13226.d
new file mode 100644
index 00000000000..65bf3356630
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13226.d
@@ -0,0 +1,32 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS: -version=bug
+
+import imports.a13226;
+
+class C
+{
+    // class C member m is not accessible
+    version(bug) mixin(t!(typeof(this), "f")); else {}
+    version(bug) mixin(u!(typeof(this), "v")); else {}
+
+    void f() {}
+    int v;
+
+    // here is ok
+    version(bug) {} else mixin(t!(typeof(this), "f"));
+    version(bug) {} else mixin(u!(typeof(this), "v"));
+}
+
+struct S
+{
+    // struct S member m is not accessible
+    version(bug) mixin(t!(typeof(this), "f")); else {}
+    version(bug) mixin(u!(typeof(this), "v")); else {}
+
+    void f() {}
+    int v;
+
+    // here is ok
+    version(bug) {} else mixin(t!(typeof(this), "f"));
+    version(bug) {} else mixin(u!(typeof(this), "v"));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test13242.d b/gcc/testsuite/gdc.test/compilable/test13242.d
new file mode 100644
index 00000000000..0d6ef276aa0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13242.d
@@ -0,0 +1,34 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+main
++alias apiSym1
+a.expensiveArgs: 1
+a.expensiveTemplate: 1
+-alias apiSym1
++alias apiSym3
+b.expensiveArgs: 3
+b.expensiveTemplate: 3
+-alias apiSym3
+---
+*/
+
+import imports.test13242a;
+
+void main()
+{
+    pragma(msg, "main");
+
+    cheapFunc();
+
+    pragma(msg, "+alias apiSym1");
+    alias apiSym1 = .apiSym1;
+    pragma(msg, "-alias apiSym1");
+
+    // imports.test13242a.apiSym2 is not analyzed.
+
+    pragma(msg, "+alias apiSym3");
+    alias apiSym3 = .apiSym3;
+    pragma(msg, "-alias apiSym3");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test13281.d b/gcc/testsuite/gdc.test/compilable/test13281.d
new file mode 100644
index 00000000000..0d747faf3fd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13281.d
@@ -0,0 +1,47 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+123
+123u
+123L
+123LU
+123.5
+123.5F
+123.5L
+123.5i
+123.5Fi
+123.5Li
+(123.5+5.5i)
+(123.5F+5.5Fi)
+(123.5L+5.5Li)
+---
+*/
+pragma(msg, 123);
+pragma(msg, 123u);
+pragma(msg, 123L);
+pragma(msg, 123uL);
+pragma(msg, 123.5);
+pragma(msg, 123.5f);
+pragma(msg, 123.5L);
+pragma(msg, 123.5i);
+pragma(msg, 123.5fi);
+pragma(msg, 123.5Li);
+pragma(msg, 123.5 +5.5i);
+pragma(msg, 123.5f+5.5fi);
+pragma(msg, 123.5L+5.5Li);
+
+static assert((123  ).stringof == "123");
+static assert((123u ).stringof == "123u");
+static assert((123L ).stringof == "123L");
+static assert((123uL).stringof == "123LU");
+static assert((123.5  ).stringof == "1.235e+2");
+static assert((123.5f ).stringof == "1.235e+2F");
+static assert((123.5L ).stringof == "1.235e+2L");
+static assert((123.5i ).stringof == "1.235e+2i");
+static assert((123.5fi).stringof == "1.235e+2Fi");
+static assert((123.5Li).stringof == "1.235e+2Li");
+static assert((123.5 +5.5i ).stringof == "1.235e+2 + 5.5e+0i");
+static assert((123.5f+5.5fi).stringof == "1.235e+2F + 5.5e+0Fi");
+static assert((123.5L+5.5Li).stringof == "1.235e+2L + 5.5e+0Li");
diff --git a/gcc/testsuite/gdc.test/compilable/test1353.d b/gcc/testsuite/gdc.test/compilable/test1353.d
new file mode 100644
index 00000000000..b724aa818b1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test1353.d
@@ -0,0 +1,14 @@
+
+class A {}
+interface B {}
+interface C {}
+interface D(X) {}
+
+void fun()
+{
+    class T : typeof(new A), .B, const(C), D!int {}
+    version(none)
+    {
+        class U : int, float, __vector(int[3]) {}
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test13600.d b/gcc/testsuite/gdc.test/compilable/test13600.d
new file mode 100644
index 00000000000..a16b39c197f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13600.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -g
+
+class Retry
+{
+    alias bool delegate ( lazy void ) SuccessDecider;
+
+    SuccessDecider success_decide;
+
+    void on_retry ( )
+    {
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test13668.d b/gcc/testsuite/gdc.test/compilable/test13668.d
new file mode 100644
index 00000000000..d69c764b91c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13668.d
@@ -0,0 +1,38 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+tuple("id", "toString", "toHash", "opCmp", "opEquals", "Monitor", "factory")
+genProps
+---
+*/
+
+class User : Entity!User
+{
+    int id;
+}
+
+class Entity(T)
+{
+    pragma(msg, generateProperties!T);
+    /* Compiler runs pragma(msg) in semantic() phase, but it does not insert any members
+     * in this class. Therefore getting __traits(allMembers, User) while evaluating
+     * generateProperties!User should work.
+     */
+}
+
+template generateProperties(alias To)
+{
+    string getProperties(alias Ta)()
+    {
+        string toRet = "genProps";
+
+        // This line is bad
+        pragma(msg, __traits(allMembers, Ta));
+
+        return toRet;
+    }
+
+    enum generateProperties = getProperties!(To);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test13858.d b/gcc/testsuite/gdc.test/compilable/test13858.d
new file mode 100644
index 00000000000..5a0432c59ce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13858.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -w
+// 13858
+
+void foo() { assert(0); }
+
+void main()
+{
+    int x = 0;
+
+    LSwitch: switch (x)
+    {
+        case 0:
+            break LSwitch;
+
+        default: return;
+    }
+
+    foo();
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test13902.d b/gcc/testsuite/gdc.test/compilable/test13902.d
new file mode 100644
index 00000000000..af4c90470a4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test13902.d
@@ -0,0 +1,8 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+void foo()
+{
+    int a;
+    int* bar() { return &a; }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test14275.d b/gcc/testsuite/gdc.test/compilable/test14275.d
new file mode 100644
index 00000000000..66f899c11a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test14275.d
@@ -0,0 +1,4 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+import protection.bug.bug14275;
diff --git a/gcc/testsuite/gdc.test/compilable/test14317.d b/gcc/testsuite/gdc.test/compilable/test14317.d
new file mode 100644
index 00000000000..ff97e731402
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test14317.d
@@ -0,0 +1,15 @@
+
+// REQUIRED_ARGS: -O -profile -inline
+
+struct Range {
+    private string s;
+    char charAt(int unused1) { return s[0]; }
+}
+
+bool count(Range* r, int* unused2)
+{
+    *unused2 = 0;
+    int unused3;
+    char c = r.charAt(0);
+    return true;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test14375.d b/gcc/testsuite/gdc.test/compilable/test14375.d
new file mode 100644
index 00000000000..30206d844cd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test14375.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+---
+ */
+interface IKeysAPI(string greetings) {
+    static assert(greetings == "Hello world", greetings);
+}
+
+void main() {
+    foreach (method; __traits(allMembers, IKeysAPI!("Hello world"))) {
+        static assert (method.length, "Empty string from the compiler ??");
+        pragma(msg, method);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test14528.d b/gcc/testsuite/gdc.test/compilable/test14528.d
new file mode 100644
index 00000000000..badab92006f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test14528.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -o-
+// PERMTE_ARGS:
+
+import imports.a14528;
+
+class C
+{
+    protected static void func() {}
+
+    void test()
+    {
+        foo!func();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test14666.d b/gcc/testsuite/gdc.test/compilable/test14666.d
new file mode 100644
index 00000000000..6162dd9ea6b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test14666.d
@@ -0,0 +1,8 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+module test14666;
+
+struct Location
+{
+    import imports.test14666a;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test14747.d b/gcc/testsuite/gdc.test/compilable/test14747.d
new file mode 100644
index 00000000000..eb0b418933d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test14747.d
@@ -0,0 +1,31 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS: -w
+
+int foo(Args...)()
+{
+    int x;
+
+    foreach (arg; Args)
+    {
+        static if(is(arg == int))
+        {
+            return 0;
+        }
+        static if(is(arg == long))
+        {
+            // fallthrough
+            ++x;    // this statement might be unreachable, but
+                    // UnrollStatement does not warn that.
+        }
+    }
+    // no return
+}
+
+void main()
+{
+    auto r1 = foo!(int)();          // return
+    auto r2 = foo!(int, long)();    // return -> fallthrough (it's unreachable)
+    auto r3 = foo!(long, int)();    // fallthough -> return
+    static assert(!__traits(compiles, foo!(long)()));       // fallthough
+    static assert(!__traits(compiles, foo!(long, long)())); // fallthough -> fallthough
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test14781.d b/gcc/testsuite/gdc.test/compilable/test14781.d
new file mode 100644
index 00000000000..3ccf5d0b798
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test14781.d
@@ -0,0 +1,38 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+void impure() {}    // impure
+
+auto fb1(T)() pure
+{
+    int x;
+    struct A(S)
+    {
+        void fc(T2)()
+        {
+            x = 1;      // accessing pure function context is just ok
+            impure();   // impure function call makes fc as impure
+        }
+        this(S a) {}
+    }
+    return A!int();
+}
+auto fb2(T)() pure
+{
+    int x;
+    struct A(S)
+    {
+        void fc(T2)()
+        {
+            impure();   // impure function call makes fc as impure
+            x = 1;      // accessing pure function context is just ok
+        }
+        this(S a) {}
+    }
+    return A!int();
+}
+void test1()
+{
+    fb1!int().fc!int();
+    fb2!int().fc!int();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test14838.d b/gcc/testsuite/gdc.test/compilable/test14838.d
new file mode 100644
index 00000000000..c1d698ff495
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test14838.d
@@ -0,0 +1,91 @@
+// PERMUTE_ARGS:
+
+struct A(T) { ~this() {} }
+class C { A!int[1] array; }
+
+void test14838() pure nothrow @nogc @safe
+{
+    C c;
+    c.__xdtor();    // C.~this() will also be inferred to
+                    // pure nothrow @nogc @safe
+
+    A!int[1] array;
+    // scope destructor call does not cause attribute violation.
+}
+
+// ----
+
+/*
+ * This is a reduced test case comes from std.container.Array template,
+ * to fix the semantic analysis order issue for correct destructor attribute inference.
+ *
+ * Before the bugfix:
+ *   1. StructDeclaration('Array!int')->semantic() instantiates
+ *      RangeT!(Array!int) at the `alias Range = ...;`, but
+ *      StructDeclaration('RangeT!(Array!int)')->semantic() exits
+ *      with sizeok == SIZEOKfwd, because the size of _outer_ field is not yet determined.
+ *   2. StructDeclaration('Array!int')->semantic() succeeds to determine the size
+ *      (sizeok = SIZEOKdone).
+ *   3. StructDeclaration('Array!int')->buildOpAssign() will generate opAssign because
+ *      Array!int._data field has identity opAssign member function.
+ *   4. The semantic3 will get called for the generated opAssign, then
+ *         6-1. Array!int.~this() semantic3, and
+ *         6-2. RefCounted!(Array!int.Payload).~this() semantic3
+ *      will also get called to infer their attributes.
+ *   5. In RefCounted!(Array!int.Payload).~this(), destroy(t) will be instantiated.
+ *      At that, TemplateInstance::expandMembers() will invoke runDeferredSemantic()
+ *      and it will re-run StructDeclaration('RangeT!(Array!int)')->semantic().
+ *   6. StructDeclaration('RangeT!(Array!int)')->semantic() determines the size
+ *      (sizeok = SIZEOKdone). Then, it will generate identity opAssign and run its semantic3.
+ *      It will need to infer RangeT!(Array!int).~this() attribute, then it requires the
+ *      correct attribute of Array!int.~this().
+ * 
+ *      However, the Array!int.~this() attribute is not yet determined! [bug]
+ *      -> it's wongly handled as impure/system/throwable/gc-able.
+ * 
+ *      -> then, the attribute inference results for
+ *         RangeT!(Array!int).~this() and Array!int.~this() will be incorrect.
+ *
+ * After the bugfix:
+ *   In 6, StructDeclaration('RangeT!(Array!int)')->semantic() will check that:
+ *   all base struct types of the instance fields have completed addition of
+ *   special functions (dtor, opAssign, etc).
+ *   If not, it will defer the completion of its semantic pass.
+ */
+
+void destroy14838(S)(ref S s) if (is(S == struct))
+{
+    s.__xdtor();
+}
+
+struct RefCounted14838(T)
+{
+    ~this()
+    {
+        T t;
+        .destroy14838(t);
+    }
+
+    void opAssign(typeof(this) rhs) {}
+}
+
+struct RangeT14838(A)
+{
+    A[1] _outer_;
+}
+
+struct Array14838(T)
+{
+    struct Payload
+    {
+        ~this() {}
+    }
+    RefCounted14838!Payload _data;
+
+    alias Range = RangeT14838!Array14838;
+}
+
+class Test14838
+{
+    Array14838!int[1] field;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test14962.d b/gcc/testsuite/gdc.test/compilable/test14962.d
new file mode 100644
index 00000000000..69c0d89eb43
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test14962.d
@@ -0,0 +1,41 @@
+template map(fun...)
+{
+    auto map(R)(R r)
+    {
+        return MapResult!(fun, R)(r);
+    }
+}
+
+struct MapResult(alias fun, R)
+{
+    R _input;
+
+    @property bool empty() { return _input.length == 0; }
+    @property auto front() { return fun(_input[0]); }
+    void popFront() { _input = _input[1..$]; }
+}
+
+struct Foo
+{
+    int baz(int v)
+    {
+        static int id;
+        return v + id++;
+    }
+    void bar()
+    {
+        auto arr1 = [1, 2, 3];
+        auto arr2 = [4, 5, 6];
+        arr1.map!(
+            // lambda1
+            i =>
+                arr2.map!(
+                    // lambda2
+                    j =>
+                        baz(i + j)
+                )
+        );
+    }
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/test14973.d b/gcc/testsuite/gdc.test/compilable/test14973.d
new file mode 100644
index 00000000000..b76c89dbd27
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test14973.d
@@ -0,0 +1,104 @@
+template map(fun...)
+{
+    auto map(R)(R r)
+    {
+        return MapResult!(fun, R)(r);
+    }
+}
+
+struct MapResult(alias fun, R)
+{
+    R _input;
+
+    @property bool empty() { return _input.length == 0; }
+    @property auto front() { return fun(_input[0]); }
+    void popFront() { _input = _input[1..$]; }
+}
+
+class Foo
+{
+    int baz() { return 1; }
+    void bar()
+    {
+        auto s = [1].map!(i => baz()); // compiles
+        auto r = [1].map!(  // returns MapResult-1
+            // lambda1
+            i =>
+                [1].map!(   // returns MapResult-2
+                    // lambda2
+                    j =>
+                        baz()
+                )
+        ); // compiles <- error
+
+        // When lambda1 is called in MapResult-1.front(), it was changed to
+        // TOKfunction in functionResolve. But in that time, MapResult-2 semantic3
+        // was not yet finished, then the lambda2 call in MapResult-2.front()
+        // could not access to enclosing scope frame to call baz().
+        // To fix the issue, MapResult-2 semantic3 should be finished during the
+        // lambda1 body analysis.
+    }
+}
+
+class Bar
+{
+    int baz;
+    void bar()
+    {
+        auto s = [1].map!(i => baz); // compiles
+        auto r = [1].map!(
+            // lambda1
+            i =>
+                [1].map!(
+                    // lambda2
+                    j =>
+                        baz
+                )
+        ); // compiles <- error
+    }
+}
+
+/*******************************************/
+
+struct ChunkByImpl(alias eq)
+{
+    struct Group
+    {
+        int[] start;
+        int[] current;
+
+        void popFront()
+        {
+            // In here:
+            //  SortedRange.pred == (a, b) => a  @ test14978b()
+            //  ChunkByImpl.eq == (a, b) => pred(a, b)  @ SortedRange.groupBy()
+            //
+            // The context deduction should be:
+            //  First pred is deduced to function pointer,
+            //  and then, eq is also deduced to function pointer because pred is function pointer.
+            //
+            // Therefore, when ChunkByImpl is instantiated in groupBy(), its semantic3
+            // needs to be invoked to analyze ???
+            eq(start, current);
+        }
+    }
+}
+
+struct SortedRange(alias pred)
+{
+    int[] input;
+
+    auto groupBy()
+    {
+        ChunkByImpl!(
+            (a, b) => pred(a, b)
+        ) r;
+    }
+}
+
+void test14973b()
+{
+    SortedRange!(
+        (a, b) => a
+    ) r;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15056.d b/gcc/testsuite/gdc.test/compilable/test15056.d
new file mode 100644
index 00000000000..5beccba6bd3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15056.d
@@ -0,0 +1,28 @@
+nothrow:
+
+version (Windows)
+{
+    version (LP_64)
+        import core.stdc.stdlib;
+    else
+        // doesn't currently work b/c SEH remains present even in nothrow code
+        void* alloca(size_t) { return null; }
+}
+else
+    import core.stdc.stdlib;
+
+struct S
+{
+	~this() nothrow {}
+}
+
+S foo(void* p = alloca(1234))
+{
+	return S();
+}
+
+int main()
+{
+	foo();
+	return 0;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15150.d b/gcc/testsuite/gdc.test/compilable/test15150.d
new file mode 100644
index 00000000000..3a00b80348b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15150.d
@@ -0,0 +1,8 @@
+// PERMUTE_ARGS:
+
+module test15150;
+
+import imports.test15150a;
+import imports.test15150b;
+
+enum y = x;
diff --git a/gcc/testsuite/gdc.test/compilable/test15177.d b/gcc/testsuite/gdc.test/compilable/test15177.d
new file mode 100644
index 00000000000..0bb2d0498c6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15177.d
@@ -0,0 +1,23 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: imports/test15117a.d
+
+import users = imports.test15117a;
+
+void RunApiTest(T...)()
+{
+    foreach (name; __traits(allMembers, users))
+    {
+        // 3. list the name of TyepInfoStructDeclaration,
+        //    but it's just internal symbol and invisible.
+        mixin("alias func = users . " ~ name ~ ";");
+    }
+}
+
+void main()
+{
+    // 1. run semantic3 of users.test_usr_1
+    users.test_usr_1();
+
+    RunApiTest!();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test1537.d b/gcc/testsuite/gdc.test/compilable/test1537.d
new file mode 100644
index 00000000000..a1717abfc00
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test1537.d
@@ -0,0 +1,106 @@
+// 1537
+
+void foo(char[] s)
+{
+    int x = -1;
+
+    while (s.length)
+    {
+        char c = s[0];
+
+        if (c == '}')
+           break;
+
+        assert (c >= '0' && c <= '9', s[0..$]);
+
+        if (x == -1)
+            x = 0;
+    }
+}
+
+/**************************************/
+
+enum bug4732 = 42;
+static assert( __traits(identifier, bug4732) == "bug4732");
+
+/**************************************/
+
+template Compileable(int z) { bool OK=true;}
+
+int bug5245a(U)()
+{
+    { enum   T { a = 5  } T v; }
+    { enum   T { a = 6  } T w; }
+    return 91;
+}
+
+int bug5245b(U)()
+{
+    { struct T { int a = 2; } T v; }
+    { union  T { int a = 3; } T w; }
+    return 91;
+}
+
+int bug5245c(U)()
+{
+    { struct T { int a = 2; } T v; }
+    { class  T { int a = 3; } T w; }
+    return 91;
+}
+
+int bug5245d(U)()
+{
+    { enum  T { a = 3 } T w; }
+    { struct T { int a = 2; } T v; }
+    return 91;
+}
+
+
+static assert(!is(typeof(Compileable!(bug5245a!(int)()).OK)));
+static assert(!is(typeof(Compileable!(bug5245b!(int)()).OK)));
+static assert(!is(typeof(Compileable!(bug5245c!(int)()).OK)));
+static assert(!is(typeof(Compileable!(bug5245d!(int)()).OK)));
+
+/**************************************/
+
+class Bug5349(T) // segfault D2.051
+{
+    int x;
+    static int g()
+    {
+        class B
+        {
+            int inner()
+            {
+                return x; // should not compile
+            }
+        }
+        return (new B).inner();
+    }
+    int y =  g();
+}
+
+static assert(!is(typeof(Bug5349!(int))));
+
+/**************************************/
+
+class Bug4033 {}
+
+class Template4033(T) {
+    static assert(is(T : Bug4033));
+}
+
+alias Template4033!(Z4033) Bla;
+
+class Z4033 : Bug4033 { }
+
+/**************************************/
+
+struct Bug4322 {
+    int[1] a = void;
+}
+
+void bug4322() {
+    Bug4322 f = Bug4322();
+    Bug4322 g = Bug4322.init;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15389_x.d b/gcc/testsuite/gdc.test/compilable/test15389_x.d
new file mode 100644
index 00000000000..896f81a2a42
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15389_x.d
@@ -0,0 +1,7 @@
+import test15389_y;
+
+//struct ns
+extern (C++, ns)
+{
+    class X { test15389_y.ns.Y a; }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15389_y.d b/gcc/testsuite/gdc.test/compilable/test15389_y.d
new file mode 100644
index 00000000000..35e6a2511fa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15389_y.d
@@ -0,0 +1,8 @@
+import test15389_x;
+
+//struct ns
+extern (C++, ns)
+{
+    class Y { test15389_x.ns.X b; }
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test15490.d b/gcc/testsuite/gdc.test/compilable/test15490.d
new file mode 100644
index 00000000000..eab5c61a74c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15490.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -o- -inline
+// PERMUTE_ARGS:
+module test15490;
+
+import imports.imp15490a;
+import imports.imp15490b;
+
+void main()
+{
+    regex();
+    listenTCP();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15519_x.d b/gcc/testsuite/gdc.test/compilable/test15519_x.d
new file mode 100644
index 00000000000..53cfe920a7a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15519_x.d
@@ -0,0 +1,7 @@
+
+import test15519_y;
+
+extern(C++, ns)
+{
+ class X { test15519_y.ns.Y v; }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15519_y.d b/gcc/testsuite/gdc.test/compilable/test15519_y.d
new file mode 100644
index 00000000000..58db30b2141
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15519_y.d
@@ -0,0 +1,8 @@
+
+import test15519_x: NS = ns;            // fails
+//import test15519_x; alias test15519_x.ns NS;  // works
+
+extern(C++, ns)
+{
+ class Y { NS.X v; }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15550.d b/gcc/testsuite/gdc.test/compilable/test15550.d
new file mode 100644
index 00000000000..7a016fa4814
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15550.d
@@ -0,0 +1,16 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+struct Vector(T, int N)
+{
+    void opDispatch(string, U)(U)
+    {
+    }
+
+    void baz(string, U)(U)
+    {
+    }
+}
+
+static assert(!is(typeof(Vector!(int, 2)._isMatrix)));
+static assert(!is(typeof(Vector!(int, 2).baz!"_isMatrix")));
diff --git a/gcc/testsuite/gdc.test/compilable/test15578.d b/gcc/testsuite/gdc.test/compilable/test15578.d
new file mode 100644
index 00000000000..81dd76a6e8f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15578.d
@@ -0,0 +1,10 @@
+__gshared private:
+    int j;
+    extern(C++, ns) int k;
+
+void f()
+{
+    j = 0; // works as expected
+    k = 0; // Error: variable foo.ns.k is private
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test15618.d b/gcc/testsuite/gdc.test/compilable/test15618.d
new file mode 100644
index 00000000000..f99c4417f37
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15618.d
@@ -0,0 +1,19 @@
+class Base
+{
+    ~this() {}
+    size_t x = 4;
+}
+
+interface Interface
+{
+    int Method();
+}
+
+class Derived : Base, Interface
+{
+    size_t y = 5;
+    int Method() { return 3; }
+}
+
+static assert(Derived.x.offsetof == (void*).sizeof * 2);
+static assert(Derived.y.offsetof == (void*).sizeof * 4);
diff --git a/gcc/testsuite/gdc.test/compilable/test15762.d b/gcc/testsuite/gdc.test/compilable/test15762.d
new file mode 100644
index 00000000000..c87c0469d82
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15762.d
@@ -0,0 +1,12 @@
+// https://issues.dlang.org/show_bug.cgi?id=15762
+
+enum Windows1252Char : ubyte { init }
+
+void main() @safe {
+       ubyte[] a = [1, 2, 3, 4];
+       auto aw = cast(Windows1252Char[]) a;
+       auto caw = cast(const(Windows1252Char)[]) a;
+       const(ubyte)[] c = [1, 2, 3, 4];
+       auto d = cast(const(ubyte)[]) c;
+       auto e = cast(const(Windows1252Char)[]) c;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15780.d b/gcc/testsuite/gdc.test/compilable/test15780.d
new file mode 100644
index 00000000000..f69de081949
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15780.d
@@ -0,0 +1,17 @@
+// PERMUTE_ARGS:
+// https://issues.dlang.org/show_bug.cgi?id=15780
+
+import std.typecons;
+//import std.stdio;
+
+void foo(alias fields)() {
+    foreach(i, field; fields) {
+        enum string a = fields[i];  // OK
+        enum string b = field;      // not OK with 2.069.2 ???
+       //writeln(field);
+    }
+}
+
+void main() {
+    foo!(tuple("H", "I"))();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15784.d b/gcc/testsuite/gdc.test/compilable/test15784.d
new file mode 100644
index 00000000000..33b1bf3c919
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15784.d
@@ -0,0 +1,47 @@
+// PERMUTE_ARGS:
+
+template AddField(T)
+{
+    T b;
+    this(Args...)(T b, auto ref Args args)
+    {
+        this.b = b;
+        this(args);
+    }
+}
+
+template construcotrs()
+{
+    int a;
+    this(int a)
+    {
+        this.a = a;
+    }
+}
+
+class B
+{
+    mixin construcotrs;
+    mixin AddField!(string);
+}
+
+class C : B
+{
+    this(A...)(A args)
+    {
+        // The called super ctor is an overload set.
+        super(args);
+    }
+}
+
+struct S
+{
+    mixin construcotrs;
+    mixin AddField!(string);
+}
+
+void main()
+{
+    auto s = S("bar", 15);
+    auto c = new C("bar", 15);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15785.d b/gcc/testsuite/gdc.test/compilable/test15785.d
new file mode 100644
index 00000000000..c8ad24096e8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15785.d
@@ -0,0 +1,22 @@
+// REQUIRED_ARGS: -de
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+---
+*/
+import imports.test15785;
+
+class Derived : Base, IBase2
+{
+    override void foo()
+    {
+        super.foo();
+        bar();
+        // Base.bar(); // doesn't work yet due to a bug in checkAccess
+        faz();
+        // IBase2.faz(); // doesn't work yet due to a bug in checkAccess
+    }
+
+    super.T t;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15856.d b/gcc/testsuite/gdc.test/compilable/test15856.d
new file mode 100644
index 00000000000..b61d1c4a812
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15856.d
@@ -0,0 +1,17 @@
+// REQUIRED_ARGS: -transition=checkimports -de
+// PERMUTE_ARGS:
+/*
+TEST_PUTPUT:
+---
+---
+*/
+
+class Foo
+{
+    import imports.a15856;
+
+    struct Bar
+    {
+        c_long a;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test15898.d b/gcc/testsuite/gdc.test/compilable/test15898.d
new file mode 100644
index 00000000000..01c325e9982
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15898.d
@@ -0,0 +1,27 @@
+// REQUIRED_ARGS: -O
+// https://issues.dlang.org/show_bug.cgi?id=15898
+
+int addAssignSimple(int[] , const(int)[] )
+{
+    uint c;
+    return c;
+}
+
+void mulKaratsuba(int[] result, const(int)[] x, const(int)[] y, int[] )
+{
+    const(int)[] y1 = y;
+    int[] newscratchbuff;
+    int[] resultHigh = result;
+
+    bool ysmaller2 = x.length >= y1.length;
+    newscratchbuff[0..y1.length] = resultHigh;
+    mulKaratsuba(
+        resultHigh[1..$],
+        ysmaller2 ? x[1..$] : y1,
+        ysmaller2 ? y1 : x,
+        newscratchbuff[y1.length..$]
+    );
+
+    addAssignSimple(resultHigh[1..$], newscratchbuff[0..y1.length]);
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test15907.d b/gcc/testsuite/gdc.test/compilable/test15907.d
new file mode 100644
index 00000000000..c362e04dbc4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15907.d
@@ -0,0 +1,18 @@
+// REQUIRED_ARGS: -de
+// PERMUTE_ARGS:
+import imports.imp15907;
+
+struct S
+{
+    private int a;
+}
+
+void test()
+{
+    process(S());
+}
+
+static assert(allMembers!S == ["a"]);
+enum sz = __traits(getMember, imports.imp15907, "PrivateStruct").sizeof;
+static assert(__traits(hasMember, imports.imp15907, "privateVar"));
+typeof(__traits(getMember, PublicStruct, "S").init) s;
diff --git a/gcc/testsuite/gdc.test/compilable/test15925.d b/gcc/testsuite/gdc.test/compilable/test15925.d
new file mode 100644
index 00000000000..02639e86da2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test15925.d
@@ -0,0 +1,19 @@
+// REQUIRED_ARGS: -transition=import -transition=checkimports
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+compilable/test15925.d(17): Deprecation: local import search method found variable imp15925.X instead of nothing
+---
+*/
+
+mixin template Import()
+{
+    import imports.imp15925;
+}
+
+class Foo
+{
+    mixin Import!();
+    static assert(X == 1);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16031.d b/gcc/testsuite/gdc.test/compilable/test16031.d
new file mode 100644
index 00000000000..7239522e107
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16031.d
@@ -0,0 +1,33 @@
+// REQUIRED_ARGS: -fPIC -lib
+// PERMUTE_ARGS:
+// DISABLED: win32 win64
+extern void throwing();
+
+void foo()
+{
+    // create plenty of symbols, so that the catch references get a high symbol index
+    static int a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+        b0, b1, b2, b3, b4, b5, b6, b7, b8, b9,
+        c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,
+        d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
+    try
+    {
+        throwing();
+    }
+    catch (Exception)
+    {
+    }
+}
+
+void bar()
+{
+    try
+    {
+        throwing();
+    }
+    // symbol index for DW.ref._D9Exception7__ClassZ
+    // gets reused for another object and is out of bounds
+    catch (Exception)
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16080.d b/gcc/testsuite/gdc.test/compilable/test16080.d
new file mode 100644
index 00000000000..a3cf503c836
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16080.d
@@ -0,0 +1,6 @@
+// REQUIRED_ARGS: -lib -Icompilable/imports
+// EXTRA_SOURCES: extra-files/test16080b.d
+// https://issues.dlang.org/show_bug.cgi?id=16080
+
+import imp16080;
+
diff --git a/gcc/testsuite/gdc.test/compilable/test16085.d b/gcc/testsuite/gdc.test/compilable/test16085.d
new file mode 100644
index 00000000000..936a1fbdaca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16085.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -de
+// PERMUTE_ARGS:
+import imports.imp16085;
+
+void test()
+{
+    S s;
+    assert(s.functionAndFunction() == Pass());
+    assert(s.staticFunctionAndFunction() == Pass());
+    // assert(S.staticFunctionAndFunction() == Pass()); // erroneous not accessible error
+    assert(s.functionAndTemplate() == Pass());
+    assert(s.templateAndTemplate() == Pass());
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16225.d b/gcc/testsuite/gdc.test/compilable/test16225.d
new file mode 100644
index 00000000000..6600842b769
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16225.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -O -m64
+// PERMUTE_ARGS:
+
+// https://issues.dlang.org/show_bug.cgi?id=16225
+
+struct C
+{
+    hash_t foo( )
+    {
+        int y;
+        return ((cast(ubyte*)&y)[1]);
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test16292.d b/gcc/testsuite/gdc.test/compilable/test16292.d
new file mode 100644
index 00000000000..b82e69fd42a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16292.d
@@ -0,0 +1,18 @@
+// PERMUTE_ARGS:
+// https://issues.dlang.org/show_bug.cgi?id=16292
+
+void main()
+{
+    goto label;
+    if (makeS()[0])
+    {
+        label:
+    }
+}
+
+S makeS() { return S(); }
+
+struct S
+{
+    int opIndex(size_t i) { return 0; }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16303.d b/gcc/testsuite/gdc.test/compilable/test16303.d
new file mode 100644
index 00000000000..38589750755
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16303.d
@@ -0,0 +1,13 @@
+// https://issues.dlang.org/show_bug.cgi?id=16303
+
+void yayf(void function(int*) fp);
+void yayd(void delegate(int*) dg);
+
+void bar()
+{
+    void function(const(int)* p) fp;
+    yayf(fp);                   // should be good but produces error
+
+    void delegate(const(int)* p) dg;
+    yayd(dg);                   // should be good but produces error
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16348.d b/gcc/testsuite/gdc.test/compilable/test16348.d
new file mode 100644
index 00000000000..4efe24f1190
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16348.d
@@ -0,0 +1,13 @@
+// EXTRA_SOURCES: imports/test16348.d
+module mypackage.foo;
+
+void bug()
+{
+    // removing the if-else also removes the segfault
+    if (true) {}
+    else
+    {
+        import mypackage.bar;
+        auto b = bar();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16460.d b/gcc/testsuite/gdc.test/compilable/test16460.d
new file mode 100644
index 00000000000..868e7ecec4a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16460.d
@@ -0,0 +1,13 @@
+module imports.test16460;
+
+void bug()
+{
+    auto d1 = (){
+        import imports.imp16460;
+        return val;
+    };
+    enum d2 = (){
+        import imports.imp16460;
+        return val;
+    };
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16525.d b/gcc/testsuite/gdc.test/compilable/test16525.d
new file mode 100644
index 00000000000..6c85e0cad5f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16525.d
@@ -0,0 +1,19 @@
+static immutable templ(alias var) = 1234;
+
+struct D
+{
+    int memvar;
+}
+
+extern(C++) struct CPP
+{
+    int memvar;
+}
+
+void test()
+{
+    pragma(msg, templ!(D.memvar));
+    pragma(msg, templ!(CPP.memvar));
+    // root cause, C++ member variables have no mangling
+    pragma(msg, CPP.memvar.mangleof);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16570.d b/gcc/testsuite/gdc.test/compilable/test16570.d
new file mode 100644
index 00000000000..20b84857605
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16570.d
@@ -0,0 +1,8 @@
+static immutable int _a = 0;
+
+enum Regression
+{
+    a = _a,
+}
+
+static assert(is(typeof(Regression.a) == Regression));
diff --git a/gcc/testsuite/gdc.test/compilable/test16574.d b/gcc/testsuite/gdc.test/compilable/test16574.d
new file mode 100644
index 00000000000..ad19994cdf2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16574.d
@@ -0,0 +1,34 @@
+// https://issues.dlang.org/show_bug.cgi?id=16574
+template Recursive(T) if (is(T == class))
+{
+    // fails because T is still forward referenced
+    // speculative determineSize must not set type to error
+    static assert (!__traits(compiles, { new T; }));
+    // known size of class
+    static assert (is(typeof(T.init) == T));
+
+    alias Recursive = T;
+}
+
+// must be resolvable
+class C
+{
+    Recursive!C r;
+}
+
+template Recursive(T) if (is(T == struct))
+{
+    // fails because T is still forward referenced
+    // speculative determineSize must not set type to error
+    static assert (!__traits(compiles, { T t; }));
+    // no size yet for struct
+    static assert (!is(typeof(T.init)));
+
+    alias Recursive = T*;
+}
+
+// must be resolvable
+struct S
+{
+    Recursive!S r;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16607.d b/gcc/testsuite/gdc.test/compilable/test16607.d
new file mode 100644
index 00000000000..7009d9aea3a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16607.d
@@ -0,0 +1,15 @@
+struct A(T)
+{
+    T t; // causes A to be SIZEOKfwd b/c B (passed as T) isn't yet done
+
+     // On the 2nd semantic pass through A, _scope of C got set again,
+     // even though the struct was already done.
+    struct C
+    {
+    }
+}
+
+struct B
+{
+    A!B* a; // causes instantiation of A!B, but can finish semantic with A!B still being fwdref
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test1673.d b/gcc/testsuite/gdc.test/compilable/test1673.d
new file mode 100644
index 00000000000..bd91468c3ad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test1673.d
@@ -0,0 +1,52 @@
+module test1673;
+
+template Foo(T...) { }
+
+template Bar(T...)
+{
+    template Doo(T...)
+    {
+    }
+}
+
+template Tuple(T...) { alias Tuple = T; }
+
+void main()
+{
+    static assert( __traits(isTemplate, Foo));
+    static assert(!__traits(isTemplate, Foo!int));
+    static assert(!__traits(isTemplate, main));
+
+    static assert( __traits(isTemplate, Bar));
+    static assert(!__traits(isTemplate, Bar!int));
+    static assert( __traits(isTemplate, Bar!(int).Doo));
+    static assert(!__traits(isTemplate, Bar!(int).Doo!int));
+
+    alias Tup = Tuple!(Foo, Foo!int, Bar, Bar!int, Bar!(int).Doo, Bar!(int).Doo!int);
+
+    static assert( __traits(isTemplate, Tup[0]));
+    static assert(!__traits(isTemplate, Tup[1]));
+    static assert( __traits(isTemplate, Tup[2]));
+    static assert(!__traits(isTemplate, Tup[3]));
+    static assert( __traits(isTemplate, Tup[4]));
+    static assert(!__traits(isTemplate, Tup[5]));
+}
+
+/// test overloads
+void foo_over() { }
+void foo_over(T : int)(T) { }
+void foo_over(T : float)(T) { }
+static assert(__traits(isTemplate, foo_over));
+
+/// ditto
+void bar_over() { }
+void bar_over(int) { }
+static assert(!__traits(isTemplate, bar_over));
+
+/// alias to overloads
+alias a_foo_over = foo_over;
+static assert(__traits(isTemplate, a_foo_over));
+
+/// ditto
+alias a_bar_over = bar_over;
+static assert(!__traits(isTemplate, a_bar_over));
diff --git a/gcc/testsuite/gdc.test/compilable/test16747.d b/gcc/testsuite/gdc.test/compilable/test16747.d
new file mode 100644
index 00000000000..a0badc2bba7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16747.d
@@ -0,0 +1,13 @@
+/*
+PERMUTE_ARGS:
+*/
+
+class C { @safe ~this() { } }
+class D : C { }
+
+void fwd() @safe
+{
+    scope o = new Object();
+    scope c = new C();
+    scope d = new D();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16798.d b/gcc/testsuite/gdc.test/compilable/test16798.d
new file mode 100644
index 00000000000..41e09e0134a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16798.d
@@ -0,0 +1,13 @@
+/*
+REQUIRED_ARGS: -mv=its.a.dessert.topping=imports/imp16798.d -mv=its.a.floorwax=imports/
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+it's a floor wax
+it's a dessert topping
+---
+*/
+
+import its.a.floorwax.wax16798;
+import its.a.dessert.topping;
+
diff --git a/gcc/testsuite/gdc.test/compilable/test17059.d b/gcc/testsuite/gdc.test/compilable/test17059.d
new file mode 100644
index 00000000000..b7eb26af86a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17059.d
@@ -0,0 +1,11 @@
+mixin template impl()
+{
+    alias T = typeof(this);
+    enum doImplement = is(T : I);
+
+    static if (doImplement)
+    {}
+}
+
+interface I {}
+class A : I {mixin impl;}
diff --git a/gcc/testsuite/gdc.test/compilable/test17143.d b/gcc/testsuite/gdc.test/compilable/test17143.d
new file mode 100644
index 00000000000..403c9aa456c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17143.d
@@ -0,0 +1,4 @@
+import std.typecons : tuple;
+enum foo = tuple(1, 2).expand;
+pragma(msg, typeof(foo).stringof);
+pragma(msg, foo.stringof);
diff --git a/gcc/testsuite/gdc.test/compilable/test17168.d b/gcc/testsuite/gdc.test/compilable/test17168.d
new file mode 100644
index 00000000000..1cfbfbbc51b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17168.d
@@ -0,0 +1,4 @@
+// REQUIRED_ARGS: -O
+// PERMUTE_ARGS:
+
+void fn(uint x){uint a = 0 << x;}
diff --git a/gcc/testsuite/gdc.test/compilable/test17215.d b/gcc/testsuite/gdc.test/compilable/test17215.d
new file mode 100644
index 00000000000..047039e7681
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17215.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -O
+version (X86_64):
+alias vec = __vector(int[4]);
+
+vec binop(vec a)
+{
+    vec b = a;
+    return b;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test17339.d b/gcc/testsuite/gdc.test/compilable/test17339.d
new file mode 100644
index 00000000000..c908af9c724
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17339.d
@@ -0,0 +1,19 @@
+void foo(alias param)()
+{
+}
+
+const CONST1 = 1;
+const CONST2 = 1;
+static assert(&foo!CONST1 !is &foo!CONST2);
+static assert(foo!CONST1.mangleof != foo!CONST2.mangleof);
+
+immutable IMM1 = 1;
+immutable IMM2 = 1;
+static assert(&foo!IMM1 !is &foo!IMM2);
+static assert(foo!IMM1.mangleof != foo!IMM2.mangleof);
+
+// Behaves different for manifest constants!
+enum ENUM1 = 1;
+enum ENUM2 = 1;
+static assert(&foo!ENUM1 is &foo!ENUM2);
+static assert(foo!ENUM1.mangleof == foo!ENUM2.mangleof);
diff --git a/gcc/testsuite/gdc.test/compilable/test17349.d b/gcc/testsuite/gdc.test/compilable/test17349.d
new file mode 100644
index 00000000000..06070e6d751
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17349.d
@@ -0,0 +1,30 @@
+
+/* REQUIRED_ARGS:
+   PERMUTE_ARGS:
+ */
+
+// https://issues.dlang.org/show_bug.cgi?id=16538
+
+const(int) retConst1();
+int retConst2();
+auto retConst = [&retConst1, &retConst2];
+
+const(int*) retConstPtr1();
+const(int)* retConstPtr2();
+auto retConstPtr = [&retConstPtr1, &retConstPtr2];
+
+void constArray1(const(int)[1]);
+void constArray2(const(int[1]));
+auto constArray = [&constArray1, &constArray2];
+
+const(int)[] retConstSlice1();
+const(int[]) retConstSlice2();
+auto retConstSlice = [&retConstSlice1, &retConstSlice2];
+
+void constSlice1(const(int)[]);
+void constSlice2(const(int[]));
+auto constSlice = [&constSlice1, &constSlice2];
+
+void ptrToConst1(const(int)*);
+void ptrToConst2(const(int*));
+auto ptrToConst = [&ptrToConst1, &ptrToConst2];
diff --git a/gcc/testsuite/gdc.test/compilable/test17419.d b/gcc/testsuite/gdc.test/compilable/test17419.d
new file mode 100644
index 00000000000..219ed4f712e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17419.d
@@ -0,0 +1,37 @@
+// https://issues.dlang.org/show_bug.cgi?id=17419
+
+
+extern (C) int fooc();
+alias aliasc = fooc;
+
+static assert(__traits(getLinkage, fooc) == "C");
+static assert(__traits(getLinkage, aliasc) == "C");
+
+extern (D) int food();
+extern (C++) int foocpp();
+extern (Windows) int foow();
+extern (Pascal) int foop();
+extern (Objective-C) int fooobjc();
+extern (System) int foos();
+
+static assert(__traits(getLinkage, food) == "D");
+static assert(__traits(getLinkage, foocpp) == "C++");
+static assert(__traits(getLinkage, foow) == "Windows");
+static assert(__traits(getLinkage, foop) == "Pascal");
+static assert(__traits(getLinkage, fooobjc) == "Objective-C");
+version (Windows)
+    static assert(__traits(getLinkage, foos) == "Windows");
+else
+    static assert(__traits(getLinkage, foos) == "C");
+
+extern (C) int global;
+static assert(__traits(getLinkage, global) == "C");
+
+static assert(__traits(getLinkage, typeof(fooc)) == "C");
+static assert(__traits(getLinkage, typeof(&fooc)) == "C");
+
+void bar()
+{
+    void nested() { }
+    static assert(__traits(getLinkage, typeof(&nested)) == "D");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test17421.d b/gcc/testsuite/gdc.test/compilable/test17421.d
new file mode 100644
index 00000000000..e5075fb460e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17421.d
@@ -0,0 +1,19 @@
+// https://issues.dlang.org/show_bug.cgi?id=17421
+
+import core.stdc.stdarg;
+
+void novar() {}
+extern(C) void cstyle(int, ...) {}
+extern(C++) void cppstyle(int, ...) {}
+void dstyle(...) {}
+void typesafe(int[]...) {}
+
+static assert(__traits(getFunctionVariadicStyle, novar) == "none");
+static assert(__traits(getFunctionVariadicStyle, cstyle) == "stdarg");
+static assert(__traits(getFunctionVariadicStyle, cppstyle) == "stdarg");
+static assert(__traits(getFunctionVariadicStyle, dstyle) == "argptr");
+static assert(__traits(getFunctionVariadicStyle, typesafe) == "typesafe");
+
+static assert(__traits(getFunctionVariadicStyle, (int[] a...) {}) == "typesafe");
+static assert(__traits(getFunctionVariadicStyle, typeof(cstyle)) == "stdarg");
+
diff --git a/gcc/testsuite/gdc.test/compilable/test17502.d b/gcc/testsuite/gdc.test/compilable/test17502.d
new file mode 100644
index 00000000000..7737a4a6720
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17502.d
@@ -0,0 +1,31 @@
+// https://issues.dlang.org/show_bug.cgi?id=17502
+class Foo
+{
+    auto foo()
+    out {}
+    body {}
+
+    auto bar()
+    out { assert (__result > 5); }
+    body { return 6; }
+
+    auto bar_2()
+    out (res) { assert (res > 5); }
+    body { return 6; }
+
+    int concrete()
+    out { assert(__result > 5); }
+    body { return 6; }
+
+    int concrete_2()
+    out(res) { assert (res > 5); }
+    body { return 6; }
+
+    void void_foo()
+    out {}
+    body {}
+
+    auto void_auto()
+    out {}
+    body {}
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test17502a.d b/gcc/testsuite/gdc.test/compilable/test17502a.d
new file mode 100644
index 00000000000..8f69458226b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17502a.d
@@ -0,0 +1,44 @@
+// https://issues.dlang.org/show_bug.cgi?id=17502
+// Order of declaration: (Foo), (Baz : Bar), (Bar : Foo)
+class Foo
+{
+    int method(int p)
+    in
+    {
+        assert(p > 5);
+    }
+    out(res)
+    {
+        assert(res > 5);
+    }
+    body
+    {
+        return p;
+    }
+}
+
+class Baz : Bar
+{
+    override int method(int p)
+    in
+    {
+        assert(p > 3);
+    }
+    body
+    {
+        return p * 2;
+    }
+}
+
+class Bar : Foo
+{
+    override int method(int p)
+    in
+    {
+        assert(p > 2);
+    }
+    body
+    {
+        return p * 3;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test17502b.d b/gcc/testsuite/gdc.test/compilable/test17502b.d
new file mode 100644
index 00000000000..52298b8869e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17502b.d
@@ -0,0 +1,44 @@
+// https://issues.dlang.org/show_bug.cgi?id=17502
+// Order of declaration: (Baz : Bar), (Bar : Foo), (Foo)
+class Baz : Bar
+{
+    override int method(int p)
+    in
+    {
+        assert(p > 3);
+    }
+    body
+    {
+        return p * 2;
+    }
+}
+
+class Bar : Foo
+{
+    override int method(int p)
+    in
+    {
+        assert(p > 2);
+    }
+    body
+    {
+        return p * 3;
+    }
+}
+
+class Foo
+{
+    int method(int p)
+    in
+    {
+        assert(p > 5);
+    }
+    out(res)
+    {
+        assert(res > 5);
+    }
+    body
+    {
+        return p;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test1754.d b/gcc/testsuite/gdc.test/compilable/test1754.d
new file mode 100644
index 00000000000..3193477d309
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test1754.d
@@ -0,0 +1,9 @@
+module test1754;
+
+import imports.test1754a;
+import imports.test1754b;
+
+void foo()
+{
+    bar();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test17545.d b/gcc/testsuite/gdc.test/compilable/test17545.d
new file mode 100644
index 00000000000..bb0c2ae9ace
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17545.d
@@ -0,0 +1,16 @@
+/* TEST_OUTPUT:
+---
+tuple((Attrib))
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=17545
+
+module example;
+
+struct Attrib {}
+
+@Attrib enum TEST = 123;
+
+pragma(msg, __traits(getAttributes, 
+                     __traits(getMember, example, "TEST")));
diff --git a/gcc/testsuite/gdc.test/compilable/test17548.d b/gcc/testsuite/gdc.test/compilable/test17548.d
new file mode 100644
index 00000000000..67b32d7a3ad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17548.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -c
+
+module test17548;
+
+struct S1 {
+    void foo(scope S2 arg) {}
+    int myField;
+}
+
+enum cnst = 4321;
+
+import imports.fwdref2_test17548;
diff --git a/gcc/testsuite/gdc.test/compilable/test17590.d b/gcc/testsuite/gdc.test/compilable/test17590.d
new file mode 100644
index 00000000000..6eec76f7423
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test17590.d
@@ -0,0 +1,40 @@
+// REQUIRED_ARGS: -o-
+
+void lazyfun(scope lazy int a) @nogc;
+
+// Test that returning a local _static_ struct does not lead to allocation of a closure.
+auto foo_static(int a, bool b) @nogc {
+    static struct SInside {}
+
+    SInside res;
+
+    lazyfun(a);
+
+    return res;
+}
+
+// Test that returning a local _non-static_ struct that does not reference any local variable does not lead to allocation of a closure.
+auto foo_nonstatic(int a, bool b) @nogc {
+    struct SInside {}
+
+    SInside res;
+
+    lazyfun(a);
+
+    return res;
+}
+
+// Test that returning a local non-static struct that references a local variable does lead to allocation of a closure.
+static assert(!__traits(compiles, () @nogc => goo(1)));
+static assert(__traits(compiles, () => goo(1)));
+auto goo(T)(T a) {
+    struct SInside {
+        T foo() { return a; }
+    }
+
+    SInside res;
+
+    lazyfun(a);
+
+    return res;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test1878a.d b/gcc/testsuite/gdc.test/compilable/test1878a.d
new file mode 100644
index 00000000000..6c8fb6b628c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test1878a.d
@@ -0,0 +1,16 @@
+void main()
+{
+  ubyte from, to;
+  foreach(i; from..to)
+  {
+    static assert(is(typeof(i) == ubyte));
+  }
+  foreach(i; 'a'..'l')
+  {
+    static assert(is(typeof(i) == char));
+  }
+  foreach(i; 'א' .. 'ת')
+  {
+    static assert(is(typeof(i) == wchar));
+  }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test25.d b/gcc/testsuite/gdc.test/compilable/test25.d
new file mode 100644
index 00000000000..42fc8141b47
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test25.d
@@ -0,0 +1,10 @@
+// PERMUTE_ARGS:
+
+import imports.test25a, imports.test25b;
+
+import std.stdio;
+
+void main()
+{
+    std.stdio.writefln("hello");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test2991.d b/gcc/testsuite/gdc.test/compilable/test2991.d
new file mode 100644
index 00000000000..61281b83444
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test2991.d
@@ -0,0 +1,12 @@
+module test2991;
+
+void foo()
+{
+}
+
+class C
+{
+    import imports.test2991;
+
+    void bar() { foo(); }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test313a.d b/gcc/testsuite/gdc.test/compilable/test313a.d
new file mode 100644
index 00000000000..daa6afb3a0e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test313a.d
@@ -0,0 +1,36 @@
+/*
+REQUIRED_ARGS: -de
+*/
+module test313;
+
+import imports.a313;
+
+void test1()
+{
+    import imports.b313;
+    imports.b313.bug();
+}
+
+void test2()
+{
+    cstdio.printf("");
+}
+
+import imports.pkg313.c313;
+void test3()
+{
+    imports.pkg313.c313.bug();
+}
+
+template imp()
+{
+    static import imports.a313templatemixin1;
+    import imports.a313templatemixin2;
+}
+
+mixin imp!();
+void test4()
+{
+    imports.a313templatemixin1.bug();
+    imports.a313templatemixin2.bug();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test313b.d b/gcc/testsuite/gdc.test/compilable/test313b.d
new file mode 100644
index 00000000000..7ef27c5e0d0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test313b.d
@@ -0,0 +1,6 @@
+// REQUIRED_ARGS: -de
+void test1()
+{
+    import core.stdc.stdio;
+    core.stdc.stdio.printf("");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test313c.d b/gcc/testsuite/gdc.test/compilable/test313c.d
new file mode 100644
index 00000000000..3b075bd6ebf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test313c.d
@@ -0,0 +1,8 @@
+// REQUIRED_ARGS: -de
+import imports.pkgmod313;
+
+void test()
+{
+    imports.pkgmod313.foo();
+    imports.pkgmod313.bar();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test313d.d b/gcc/testsuite/gdc.test/compilable/test313d.d
new file mode 100644
index 00000000000..7545d8012d9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test313d.d
@@ -0,0 +1,9 @@
+// first imported as package
+// EXTRA_SOURCES: imports/pkgmod313/mod.d
+// REQUIRED_ARGS: -de
+import imports.pkgmod313; // then as package module
+
+void test()
+{
+    imports.pkgmod313.foo();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test313e.d b/gcc/testsuite/gdc.test/compilable/test313e.d
new file mode 100644
index 00000000000..b24f24ef6af
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test313e.d
@@ -0,0 +1,9 @@
+// first resolved as package, then created as module (with name package)
+// EXTRA_SOURCES: imports/pkgmod313/mod.d imports/pkgmod313/package.d
+// REQUIRED_ARGS: -de
+import imports.pkgmod313; // then imported as package module
+
+void test()
+{
+    imports.pkgmod313.foo();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test313f.d b/gcc/testsuite/gdc.test/compilable/test313f.d
new file mode 100644
index 00000000000..e758e37c9db
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test313f.d
@@ -0,0 +1,7 @@
+// REQUIRED_ARGS: -de
+import imports.f313;
+
+void test()
+{
+    imports.f313.bug();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test313g.d b/gcc/testsuite/gdc.test/compilable/test313g.d
new file mode 100644
index 00000000000..f2052147d1a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test313g.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -de
+// EXTRA_SOURCES: imports/g313.d
+import imports.g313;
+
+void test15900()
+{
+    // publically imported modules from g313 should be available here
+    imports.g313public.bug();
+    imports.g313staticif.bug();
+    imports.g313stringmixin.bug();
+    imports.g313templatemixin.bug();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test314.d b/gcc/testsuite/gdc.test/compilable/test314.d
new file mode 100644
index 00000000000..b7c15e39ca5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test314.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -de
+module imports.test314; // package imports
+
+import imports.a314;
+
+void main()
+{
+    imports.a314.bug("This should work.\n");
+    renamed.bug("This should work.\n");
+    bug("This should work.\n");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test3602.d b/gcc/testsuite/gdc.test/compilable/test3602.d
new file mode 100644
index 00000000000..8ae4723b317
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test3602.d
@@ -0,0 +1,17 @@
+// EXTRA_SOURCES: imports/test3602a.d
+// https://issues.dlang.org/show_bug.cgi?id=5230
+
+import imports.test3602a;
+
+class Derived : Base
+{
+   override void method(int x, int y)
+   in
+   {
+       assert(x > 0);
+       assert(y > 0);
+   }
+   body
+   {
+   }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test3673.d b/gcc/testsuite/gdc.test/compilable/test3673.d
new file mode 100644
index 00000000000..3d118be8da3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test3673.d
@@ -0,0 +1,48 @@
+class Base {}
+
+class Foo(T)
+    if (is(T == int)) : Base { }
+
+class Bar(T) : Base
+    if (is(T == bool))
+{ }
+
+interface OutputRange(T...)
+    if (T.length == 1)
+{
+    void put(T[0] value);
+}
+
+interface OutputRange(T...) : OutputRange!(T[0]), OutputRange!(T[1 .. $])
+    if (T.length > 1)
+{
+}
+
+alias OutputRange!(int, float) OR;
+
+class COR : OR
+{
+    void put(int) { }
+    void put(float) { }
+}
+
+class A {};
+class B(T) : A if (true) {}
+class C(T) if (false) : A {}
+
+alias Foo!int FooInt;
+alias Bar!bool BarBool;
+
+static assert(!__traits(compiles, Foo!bool));
+static assert(!__traits(compiles, Bar!int));
+
+void main()
+{
+    auto fi = new FooInt;
+    auto bb = new BarBool;
+    auto cor = new COR;
+
+    auto a = new A();
+    auto b = new B!int();
+    static assert(!__traits(compiles, new C!int()));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test3775.d b/gcc/testsuite/gdc.test/compilable/test3775.d
new file mode 100644
index 00000000000..47b9b88660c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test3775.d
@@ -0,0 +1,9 @@
+// 3775
+
+struct Bug3775 {
+  static int byLine()() { return 1; }
+}
+
+static assert(cast(int)Bug3775.byLine == 1);
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/test4003.d b/gcc/testsuite/gdc.test/compilable/test4003.d
new file mode 100644
index 00000000000..8a401f219bd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test4003.d
@@ -0,0 +1,6 @@
+// EXTRA_SOURCES: imports/test4003a.d
+// PERMUTE_ARGS:
+
+import imports.stdio4003;
+void main(){}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test4090.d b/gcc/testsuite/gdc.test/compilable/test4090.d
new file mode 100644
index 00000000000..8f8f7c9f26d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test4090.d
@@ -0,0 +1,235 @@
+void test4090a()
+{
+    // for the mutable elements
+    {
+        int[] arr = [1,2,3];
+
+        // inference + qualifier
+        foreach (          x; arr) static assert(is(typeof(x) == int));
+        foreach (    const x; arr) static assert(is(typeof(x) == const int));
+        foreach (immutable x; arr) static assert(is(typeof(x) == immutable int));
+
+        // inference + qualifier + ref
+        foreach (          ref x; arr) static assert(is(typeof(x) == int));
+        foreach (    const ref x; arr) static assert(is(typeof(x) == const int));
+      static assert(!__traits(compiles, {
+        foreach (immutable ref x; arr) {}
+      }));
+
+        // with exact type + qualifier
+        foreach (          int x; arr) static assert(is(typeof(x) == int));
+        foreach (    const int x; arr) static assert(is(typeof(x) == const int));
+        foreach (immutable int x; arr) static assert(is(typeof(x) == immutable int));
+
+        // with exact type + qualifier + ref
+        foreach (          ref int x; arr) static assert(is(typeof(x) == int));
+        foreach (    const ref int x; arr) static assert(is(typeof(x) == const int));
+      static assert(!__traits(compiles, {
+        foreach (immutable ref int x; arr) {}
+      }));
+
+        // convertible type + qualifier
+        foreach (          double x; arr) static assert(is(typeof(x) == double));
+        foreach (    const double x; arr) static assert(is(typeof(x) == const double));
+        foreach (immutable double x; arr) static assert(is(typeof(x) == immutable double));
+
+        // convertible type + qualifier + ref
+      static assert(!__traits(compiles, {
+        foreach (          ref double x; arr) {}
+      }));
+      static assert(!__traits(compiles, {
+        foreach (    const ref double x; arr) {}
+      }));
+      static assert(!__traits(compiles, {
+        foreach (immutable ref double x; arr) {}
+      }));
+    }
+    // for the immutable elements
+    {
+        immutable(int)[] iarr = [1,2,3];
+
+        // inference + qualifier
+        foreach (          x; iarr) static assert(is(typeof(x) == immutable int));  // same as variable declaration
+        foreach (    const x; iarr) static assert(is(typeof(x) == immutable int));  // same as variable declaration
+        foreach (immutable x; iarr) static assert(is(typeof(x) == immutable int));
+
+        // inference + qualifier + ref
+        foreach (          ref x; iarr) static assert(is(typeof(x) == immutable int));  // same as variable declaration
+        foreach (    const ref x; iarr) static assert(is(typeof(x) == immutable int));  // same as variable declaration
+        foreach (immutable ref x; iarr) static assert(is(typeof(x) == immutable int));
+
+        // with exact type + qualifier
+        foreach (          int x; iarr) static assert(is(typeof(x) == int));
+        foreach (    const int x; iarr) static assert(is(typeof(x) == const int));
+        foreach (immutable int x; iarr) static assert(is(typeof(x) == immutable int));
+
+        // with exact type + qualifier + ref
+      static assert(!__traits(compiles, {
+        foreach (          ref int x; iarr) {}
+      }));
+        foreach (    const ref int x; iarr) static assert(is(typeof(x) == const int));
+        foreach (immutable ref int x; iarr) static assert(is(typeof(x) == immutable int));
+
+        // convertible type + qualifier
+        foreach (          double x; iarr) static assert(is(typeof(x) == double));
+        foreach (    const double x; iarr) static assert(is(typeof(x) == const double));
+        foreach (immutable double x; iarr) static assert(is(typeof(x) == immutable double));
+
+        // convertible type + qualifier + ref
+      static assert(!__traits(compiles, {
+        foreach (ref double x; iarr) {}
+      }));
+      static assert(!__traits(compiles, {
+        foreach (const ref double x; iarr) {}
+      }));
+      static assert(!__traits(compiles, {
+        foreach (immutable ref double x; iarr) {}
+      }));
+    }
+}
+
+void test4090b()
+{
+    // for the key
+    {
+        int[] arr = [1,2,3];
+
+        // inference + qualifier
+        foreach (          i, x; arr) static assert(is(typeof(i) == size_t));
+        foreach (    const i, x; arr) static assert(is(typeof(i) == const size_t));
+        foreach (immutable i, x; arr) static assert(is(typeof(i) == immutable size_t));
+
+        // inference + qualifier + ref
+        foreach (          ref i, x; arr) static assert(is(typeof(i) == size_t));
+        foreach (    const ref i, x; arr) static assert(is(typeof(i) == const size_t));
+      static assert(!__traits(compiles, {
+        foreach (immutable ref i, x; arr) {}
+      }));
+
+        // with exact type + qualifier
+        foreach (          size_t i, x; arr) static assert(is(typeof(i) == size_t));
+        foreach (    const size_t i, x; arr) static assert(is(typeof(i) == const size_t));
+        foreach (immutable size_t i, x; arr) static assert(is(typeof(i) == immutable size_t));
+
+        // with exact type + qualifier + ref
+        foreach (          ref size_t i, x; arr) static assert(is(typeof(i) == size_t));
+        foreach (    const ref size_t i, x; arr) static assert(is(typeof(i) == const size_t));
+      static assert(!__traits(compiles, {
+        foreach (immutable ref size_t i, x; arr) {}
+      }));
+    }
+
+    // for the mutable elements
+    {
+        int[] arr = [1,2,3];
+
+        // inference + qualifier
+        foreach (i,           x; arr) static assert(is(typeof(x) == int));
+        foreach (i,     const x; arr) static assert(is(typeof(x) == const int));
+        foreach (i, immutable x; arr) static assert(is(typeof(x) == immutable int));
+
+        // inference + qualifier + ref
+        foreach (i,           ref x; arr) static assert(is(typeof(x) == int));
+        foreach (i,     const ref x; arr) static assert(is(typeof(x) == const int));
+      static assert(!__traits(compiles, {
+        foreach (i, immutable ref x; arr) {}
+      }));
+
+        // with exact type + qualifier
+        foreach (i,           int x; arr) static assert(is(typeof(x) == int));
+        foreach (i,     const int x; arr) static assert(is(typeof(x) == const int));
+        foreach (i, immutable int x; arr) static assert(is(typeof(x) == immutable int));
+
+        // with exact type + qualifier + ref
+        foreach (i,           ref int x; arr) static assert(is(typeof(x) == int));
+        foreach (i,     const ref int x; arr) static assert(is(typeof(x) == const int));
+      static assert(!__traits(compiles, {
+        foreach (i, immutable ref int x; arr) {}
+      }));
+
+        // convertible type + qualifier
+        foreach (i,           double x; arr) static assert(is(typeof(x) == double));
+        foreach (i,     const double x; arr) static assert(is(typeof(x) == const double));
+        foreach (i, immutable double x; arr) static assert(is(typeof(x) == immutable double));
+
+        // convertible type + qualifier + ref
+      static assert(!__traits(compiles, {
+        foreach (i,           ref double x; arr) {}
+      }));
+      static assert(!__traits(compiles, {
+        foreach (i,     const ref double x; arr) {}
+      }));
+      static assert(!__traits(compiles, {
+        foreach (i, immutable ref double x; arr) {}
+      }));
+    }
+    // for the immutable elements
+    {
+        immutable(int)[] iarr = [1,2,3];
+
+        // inference + qualifier
+        foreach (i,           x; iarr) static assert(is(typeof(x) == immutable int));  // same as variable declaration
+        foreach (i,     const x; iarr) static assert(is(typeof(x) == immutable int));  // same as variable declaration
+        foreach (i, immutable x; iarr) static assert(is(typeof(x) == immutable int));
+
+        // inference + qualifier + ref
+        foreach (i,           ref x; iarr) static assert(is(typeof(x) == immutable int));  // same as variable declaration
+        foreach (i,     const ref x; iarr) static assert(is(typeof(x) == immutable int));  // same as variable declaration
+        foreach (i, immutable ref x; iarr) static assert(is(typeof(x) == immutable int));
+
+        // with exact type + qualifier
+        foreach (i,           int x; iarr) static assert(is(typeof(x) == int));
+        foreach (i,     const int x; iarr) static assert(is(typeof(x) == const int));
+        foreach (i, immutable int x; iarr) static assert(is(typeof(x) == immutable int));
+
+        // with exact type + qualifier + ref
+      static assert(!__traits(compiles, {
+        foreach (i,           ref int x; iarr) {}
+      }));
+        foreach (i,     const ref int x; iarr) static assert(is(typeof(x) == const int));
+        foreach (i, immutable ref int x; iarr) static assert(is(typeof(x) == immutable int));
+
+        // convertible type + qualifier
+        foreach (i      ,     double x; iarr) static assert(is(typeof(x) == double));
+        foreach (i,     const double x; iarr) static assert(is(typeof(x) == const double));
+        foreach (i, immutable double x; iarr) static assert(is(typeof(x) == immutable double));
+
+        // convertible type + qualifier + ref
+      static assert(!__traits(compiles, {
+        foreach (i, ref double x; iarr) {}
+      }));
+      static assert(!__traits(compiles, {
+        foreach (i, const ref double x; iarr) {}
+      }));
+      static assert(!__traits(compiles, {
+        foreach (i, immutable ref double x; iarr) {}
+      }));
+    }
+}
+
+void test4090c()
+{
+    foreach (          x; 1..11) static assert(is(typeof(x) == int));
+    foreach (    const x; 1..11) static assert(is(typeof(x) == const int));
+    foreach (immutable x; 1..11) static assert(is(typeof(x) == immutable int));
+
+    foreach (          int x; 1..11) static assert(is(typeof(x) == int));
+    foreach (    const int x; 1..11) static assert(is(typeof(x) == const int));
+    foreach (immutable int x; 1..11) static assert(is(typeof(x) == immutable int));
+
+    foreach (          ref x; 1..11) static assert(is(typeof(x) == int));
+    foreach (    const ref x; 1..11) static assert(is(typeof(x) == const int));
+  static assert(!__traits(compiles, {
+    foreach (immutable ref x; 1..11) {}
+  }));
+
+    foreach (          double x; 1..11) static assert(is(typeof(x) == double));
+    foreach (    const double x; 1..11) static assert(is(typeof(x) == const double));
+    foreach (immutable double x; 1..11) static assert(is(typeof(x) == immutable double));
+
+    foreach (          ref double x; 1..11) static assert(is(typeof(x) == double));
+    foreach (    const ref double x; 1..11) static assert(is(typeof(x) == const double));
+  static assert(!__traits(compiles, {
+    foreach (immutable ref double x; 1..11) {}
+  }));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test4364.d b/gcc/testsuite/gdc.test/compilable/test4364.d
new file mode 100644
index 00000000000..fb4e913b123
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test4364.d
@@ -0,0 +1,8 @@
+struct Object{}
+class Game {}
+
+void main()
+{
+    static assert(is(Object == struct));
+    static assert(is(object.Object == class));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test4375.d b/gcc/testsuite/gdc.test/compilable/test4375.d
new file mode 100644
index 00000000000..777595a4a14
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test4375.d
@@ -0,0 +1,472 @@
+// 4375: disallow dangling else
+
+void main() {
+
+	if (true) {
+		if (false) {
+			assert(1);
+		} else {
+			assert(2);
+		}
+	}
+
+
+    if (true) {
+        if (false)
+            assert(7);
+    } else
+        assert(8);
+
+
+    if (true) {
+        if (false)
+            assert(9);
+        else
+            assert(10);
+    }
+
+
+    {
+        if (true)
+            assert(11);
+        else
+            assert(12);
+    }
+
+
+    {
+label1:
+        if (true)
+            assert(13);
+        else
+            assert(14);
+    }
+
+
+	if (true)
+		foreach (i; 0 .. 5) {
+			if (true)
+				assert(17);
+            else
+                assert(18);
+        }
+
+
+	if (true) {
+		foreach (i; 0 .. 5)
+			if (true)
+				assert(18.1);
+    } else
+        assert(18.2);
+
+
+    if (true)
+        assert(19);
+    else
+        assert(20);
+
+
+    if (true)
+        assert(21);
+    else if (false)
+        assert(22);
+    else
+        assert(23);
+
+
+    version (A) {
+        if (true)
+            assert(26);
+    } else
+        assert(27);
+
+
+    version (A) {
+        if (true)
+            assert(28);
+        else
+            assert(29);
+    }
+
+
+    version (A)
+        assert(30);
+    else version (B)
+        assert(31);
+    else
+        assert(32);
+
+
+    static if (true) {
+        static if (true)
+            assert(35);
+    } else
+        assert(36);
+
+
+    static if (true) {
+        static if (true)
+            assert(37);
+        else
+            assert(38);
+    }
+
+
+    static if (true)
+        assert(39);
+    else static if (true)
+        assert(40);
+    else
+        assert(41);
+
+    switch (4) {
+        case 0:
+            if (true)
+                assert(42);
+            else
+                assert(43);
+            break;
+        case 1: .. case 5:
+            if (true)
+                assert(44);
+            else
+                assert(45);
+            break;
+        default:
+            if (true)
+                assert(46);
+            else
+                assert(47);
+            break;
+    }
+
+    // (o_O)
+    switch (1)
+        default:
+            if (true)
+                assert(113);
+            else
+                assert(114);
+
+    // (o_O)
+    final switch (1)
+        case 1:
+            if (true)
+                assert(117);
+            else
+                assert(118);
+
+    mixin(q{
+        if (true)
+            assert(56);
+        else
+            assert(57);
+    });
+
+
+
+    while (false)
+        if (true)
+            assert(66);
+        else
+            assert(67);
+
+
+    if (true)
+        while (false)
+            assert(68);
+    else
+        assert(69);
+
+
+    do
+        if (true)
+            assert(72);
+        else
+            assert(73);
+    while (false);
+
+
+    if (true)
+        do
+            if (true)
+                assert(74);
+            else
+                assert(75);
+        while (false);
+
+    for (
+        if (true)        // (o_O)
+            assert(78);
+        else
+            assert(79);
+        false; false
+    )
+        if (true)
+            assert(80);
+        else
+            assert(81);
+
+    if (true)
+        for (if (true) assert(84); else assert(85); false;)
+            assert(86);
+
+
+    if (true)
+        if (true)
+            if (true)
+                if (true)
+                    if (true)
+                        assert(87);
+
+    auto x = new C;
+
+
+    if (true)
+        while (false)
+            for (;;)
+                scope (exit)
+                    synchronized (x)
+                        assert(88);
+    else
+        assert(89);
+
+
+    if (true)
+        while (false)
+            for (;;) {
+                scope (exit)
+                    synchronized (x)
+                        if (true)
+                            assert(90);
+                        else
+                            assert(89);
+            }
+
+
+    if (true)
+        while (false)
+            for (;;)
+                scope (exit)
+                    synchronized (x)
+                        if (true)
+                            assert(90);
+                        else
+                            assert(89);
+    else
+        assert(12); 
+
+
+    with (x)
+        if (false)
+            assert(92);
+        else
+            assert(93);
+
+
+    try
+        if (true)
+            assert(94);
+        else
+            assert(95);
+    catch (Exception e)
+        if (true)
+            assert(96);
+        else
+            assert(97);
+    finally
+        if (true)
+            assert(98);
+        else
+            assert(99);
+
+
+    if (true)
+        try
+            if (true)
+                assert(100);
+            else
+                assert(101);
+        finally
+            assert(102);
+
+    if (true)
+        try
+            assert(109);
+        catch(Exception e)
+            if (true)
+                assert(110);
+            else
+                assert(112);                
+        finally
+            assert(111);
+
+    static struct F {
+        static if (true)
+            int x;
+        else
+            int y;
+
+        static if (true) {
+            static if (false)
+                int z;
+        } else
+            int w;
+
+        static if (true)
+            int t; 
+        else static if (false)
+            int u;
+        else
+            int v;
+    }
+
+    if (true)
+        if (true)
+            assert(113);
+        else
+            assert(114);
+    else
+        assert(115);
+
+    static if (true)
+        static if (true)
+            assert(116);
+        else
+            assert(117);
+    else
+        assert(118);
+
+}
+
+unittest {
+    if (true)
+        assert(50);
+    else
+        assert(51);
+}
+
+class C {
+    invariant() {
+        if (true)
+            assert(58);
+        else
+            assert(59);
+    }
+
+    int f()
+    in {
+        if (true)
+            assert(60);
+        else
+            assert(61);
+    }
+    out(res) {
+        if (true)
+            assert(62);
+        else
+            assert(63);
+    }
+    body {
+        if (true)
+            assert(64);
+        else
+            assert(65);
+        return 0;
+    }
+}
+
+enum q = q{
+    if(true)
+        if(true)
+            assert(54.1);
+    else
+        assert(55.2);
+};
+
+static if (true)
+    struct F0 {}
+else static if (true)
+    struct F1 {}
+else
+    struct F2 {}
+
+static if (true) {
+    static if (false)
+        struct F3 {}
+} else
+    struct F4 {}
+
+version(A) {
+    version(B)
+        struct F5 {}
+} else
+    struct F6 {}
+
+version(A) {
+    version(B)
+        struct F5a {}
+    else
+        struct F5b {}
+}
+
+version (C)
+    struct F5c {}
+else
+    struct F5d {}
+
+struct F7 {
+    static if (true)
+        int x;
+    else
+        float x;
+
+private:
+    static if (true)
+        int y;
+    else
+        float y;
+}
+
+template F8() {
+    static if (true)
+        int x;
+    else
+        float x;
+}
+
+static if (true)
+    align(1)
+        static if (false)
+            struct F9 {}
+
+static if (true)
+    align(1) {
+        extern(C)
+            pure
+                static if (false)
+                    void F10(){}
+                else
+                    void F11(){}
+    }
+
+
+void f() {
+    int[] x;
+    static if (5 > 0)
+        version (Y)
+            scope (failure)
+                foreach (i, e; x)
+                    while (i > 20)
+                        with (e)
+                            if (e < 0)
+                                synchronized(e)
+                                    assert(1);
+                            else
+                                assert(2);
+        else
+            x = null;
+    else
+        x = null;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test50.d b/gcc/testsuite/gdc.test/compilable/test50.d
new file mode 100644
index 00000000000..f05c3e4bc06
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test50.d
@@ -0,0 +1,10 @@
+// EXTRA_SOURCES: imports/test50a.d
+// PERMUTE_ARGS:
+
+import imports.test50a;
+
+class Bar : Foo {
+        alias typeof(Foo.tupleof) Bleh;
+}
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/test5230.d b/gcc/testsuite/gdc.test/compilable/test5230.d
new file mode 100644
index 00000000000..cae3f30c136
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test5230.d
@@ -0,0 +1,12 @@
+// EXTRA_SOURCES: imports/test5230a.d
+// https://issues.dlang.org/show_bug.cgi?id=5230
+
+import imports.test5230a;
+
+class Derived : Base
+{
+    override int method()
+    {
+        return 69;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test55.d b/gcc/testsuite/gdc.test/compilable/test55.d
new file mode 100644
index 00000000000..0dd7b7b4136
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test55.d
@@ -0,0 +1,20 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test55a.d
+// PERMUTE_ARGS: -dw
+// REQUIRED_ARGS: -d
+
+public import imports.test55a;
+
+class Queue {
+  alias int ListHead;
+  Arm a;
+}
+
+class MessageQueue : Queue {
+}
+
+class Queue2 {
+  alias int ListHead;
+  Arm2 a;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test59.d b/gcc/testsuite/gdc.test/compilable/test59.d
new file mode 100644
index 00000000000..c9f4edfba18
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test59.d
@@ -0,0 +1,4 @@
+// PERMUTE_ARGS:
+
+public import imports.test59a;
+public import imports.test59b;
diff --git a/gcc/testsuite/gdc.test/compilable/test6013.d b/gcc/testsuite/gdc.test/compilable/test6013.d
new file mode 100644
index 00000000000..5824c9155b9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test6013.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -de
+import imports.test6013;
+
+static assert(__traits(compiles, public_alias_value));
+static assert(!__traits(compiles, private_alias_value));
+static assert(__traits(compiles, public_alias_func()));
+static assert(!__traits(compiles, private_alias_func()));
+static assert(__traits(compiles, () { public_alias_type val; }));
+static assert(!__traits(compiles, () { private_alias_type val; }));
diff --git a/gcc/testsuite/gdc.test/compilable/test602.d b/gcc/testsuite/gdc.test/compilable/test602.d
new file mode 100644
index 00000000000..979af91e5ef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test602.d
@@ -0,0 +1,412 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+// Disallow skipping variable decl
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    int x;
+    label: {}
+    assert(!x);
+}));
+
+// Disallow skipping variable in block backwards
+static assert(!__traits(compiles, (bool b)
+{
+    {
+        int x;
+        label: {}
+        assert(!x);
+    }
+    if (b) goto label;
+}));
+
+// Disallow skipping backwards int block
+static assert(!__traits(compiles, (bool b)
+{
+    {
+    int x;
+    label: {}
+    assert(!x);
+    }
+    if (b) goto label;
+}));
+
+// Variable inside try block
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    try
+    {
+        int x;
+    label: {}
+        assert(!x);
+    }
+    catch
+    {
+    }
+}));
+
+// Variable inside catch block
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    try
+    {
+    }
+    catch
+    {
+        int x;
+    label: {}
+        assert(!x);
+    }
+}));
+
+// Goto into catch block with unnamed exception
+static assert(__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    try
+    {
+    }
+    catch(Exception)
+    {
+    label: {}
+    }
+}));
+
+// Goto into catch block with named exception
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    try
+    {
+    }
+    catch(Exception e)
+    {
+    label: {}
+        assert(e);
+    }
+}));
+
+// Goto into finally block
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    try
+    {
+    }
+    finally
+    {
+    label: {}
+    }
+}));
+
+// Goto into variable with block
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    struct S
+    {
+        int x;
+    }
+    with (S())
+    {
+    label: {}
+        assert(!x);
+    }
+}));
+
+// Goto backwards into variable with block
+static assert(!__traits(compiles, (bool b)
+{
+    struct S
+    {
+        int x;
+    }
+    with (S())
+    {
+    label: {}
+        assert(!x);
+    }
+    if (b) goto label;
+}));
+
+// Goto into symbolic with block
+static assert(__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    struct S
+    {
+        int x;
+    }
+    with (S)
+    {
+    label: {}
+    }
+}));
+
+// Goto backwards into symbolic with block
+static assert(__traits(compiles, (bool b)
+{
+    struct S
+    {
+        int x;
+    }
+    with (S)
+    {
+    label: {}
+    }
+    if (b) goto label;
+}));
+
+// Goto into for loop
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    for (int i = 0; i < 8; ++i)
+    {
+    label: {}
+        assert(i);
+    }
+}));
+
+// Goto into for loop backwards
+static assert(!__traits(compiles, (bool b)
+{
+    for (int i = 0; i < 8; ++i)
+    {
+    label: {}
+        assert(i);
+    }
+    if (b) goto label;
+}));
+
+// Goto into foreach loop
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    foreach(i; 0..8)
+    {
+    label: {}
+        assert(i);
+    }
+}));
+
+// Goto into foreach loop backwards
+static assert(!__traits(compiles, (bool b)
+{
+    foreach(i; 0..8)
+    {
+    label: {}
+        assert(i);
+    }
+    if (b) goto label;
+}));
+
+// Goto into if block with variable
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    if (auto x = b)
+    {
+    label: {}
+        assert(x);
+    }
+}));
+
+// Goto backwards into if block with variable
+static assert(!__traits(compiles, (bool b)
+{
+    if (auto x = b)
+    {
+    label: {}
+        assert(x);
+    }
+    if (b) goto label;
+}));
+
+// Goto into if block without variable
+static assert(__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    if (b)
+    {
+    label: {}
+    }
+}));
+
+// Goto into else block
+static assert(__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    if (auto x = b)
+    {
+    }
+    else
+    {
+    label: {}
+    }
+}));
+
+// Goto backwards into else with variable
+static assert(!__traits(compiles, (bool b)
+{
+    if (auto x = b)
+    {
+    }
+    else
+    {
+        int y;
+    label: {}
+    }
+    if (b) goto label;
+}));
+
+// Goto into while block
+static assert(__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    while (b)
+    {
+    label: {}
+    }
+}));
+
+// Goto into while block with internal variable
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    while (b)
+    {
+        int x;
+    label: {}
+        assert(!x);
+    }
+}));
+
+// Goto into do block
+static assert(__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    do
+    {
+    label: {}
+    }
+    while (b);
+}));
+
+// Goto over switch variable
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    switch(0)
+    {
+    default:
+        break;
+        int x;
+    label: {}
+    }
+}));
+
+// Goto over switch variable
+static assert(!__traits(compiles, (bool b)
+{
+    if (b) goto label;
+    switch(0)
+    {
+    default:
+        break;
+    case 0:
+        int x;
+    label: {}
+    }
+}));
+
+// Goto into synchronized statement
+static assert(!__traits(compiles, (bool b)
+{
+    if (b)
+        goto label;
+    synchronized
+    {
+    label: {}
+    }
+}));
+
+// Goto into scope(success) with variable
+static assert(!__traits(compiles, (bool b)
+{
+    scope(success) { int x; label: {} assert(!x); }
+    if (b)
+        goto label;
+}));
+
+// Goto into scope(failure)
+static assert(!__traits(compiles, (bool b)
+{
+    if (b)
+        goto label;
+    scope(failure) { label: {} }
+}));
+
+// Goto into scope(failure) with variable
+static assert(!__traits(compiles, (bool b)
+{
+    scope(failure) { int x; label: {} assert(!x); }
+    if (b)
+        goto label;
+}));
+
+// Goto into scope(exit)
+static assert(!__traits(compiles, (bool b)
+{
+    if (b)
+        goto label;
+    scope(exit) { label: {} }
+}));
+
+// Goto into scope(exit)
+static assert(!__traits(compiles, (bool b)
+{
+    scope(exit) { label: {} }
+    if (b)
+        goto label;
+}));
+
+// Goto into scope(exit) with variable
+static assert(!__traits(compiles, (bool b)
+{
+    scope(exit) { int x; label: {} assert(!x); }
+    if (b)
+        goto label;
+}));
+
+/***************************************************/
+// 11659
+
+int test11659()
+{
+    goto LABEL;
+    enum expr = "0";
+ LABEL:
+    return mixin(expr);
+}
+
+/***************************************************/
+// 13321
+
+void test13321(bool b)
+{
+    static struct Foo
+    {
+        this(int) {}
+    }
+
+    Foo x;
+    if (b)
+        goto EXIT;
+    x = Foo(1);
+  EXIT:
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test6056a.d b/gcc/testsuite/gdc.test/compilable/test6056a.d
new file mode 100644
index 00000000000..fb4f1897870
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test6056a.d
@@ -0,0 +1,3 @@
+alias const(typeof('c')*) A;
+alias const(typeof(0)*) B;
+static assert(is(B == const(int*)));
diff --git a/gcc/testsuite/gdc.test/compilable/test6056b.d b/gcc/testsuite/gdc.test/compilable/test6056b.d
new file mode 100644
index 00000000000..ff0d6bb1bfe
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test6056b.d
@@ -0,0 +1,5 @@
+template X(T) { alias T X; }
+
+alias const(X!char*) A;
+alias const(X!int*) B;
+static assert(is(B == const(int*)));
diff --git a/gcc/testsuite/gdc.test/compilable/test6056c.d b/gcc/testsuite/gdc.test/compilable/test6056c.d
new file mode 100644
index 00000000000..c17b3339dd9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test6056c.d
@@ -0,0 +1,3 @@
+alias int T;
+static assert( is( T** : const(T**) ));
+static assert( is( T*  : const(T* ) ));
diff --git a/gcc/testsuite/gdc.test/compilable/test6089.d b/gcc/testsuite/gdc.test/compilable/test6089.d
new file mode 100644
index 00000000000..b1fa2cf4b8f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test6089.d
@@ -0,0 +1,6 @@
+// PERMUTE_ARGS:
+void main()
+{
+    extern int[1][1] foo;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test61.d b/gcc/testsuite/gdc.test/compilable/test61.d
new file mode 100644
index 00000000000..e4d3d659367
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test61.d
@@ -0,0 +1,15 @@
+// PERMUTE_ARGS:
+
+import imports.test61a;
+alias imports.test61a.bar bar;
+
+mixin(`
+enum FooB { fooB };
+void bar(FooB x) {}
+`);
+
+void test()
+{
+    bar(FooA.fooA);
+    bar(FooB.fooB);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test62.d b/gcc/testsuite/gdc.test/compilable/test62.d
new file mode 100644
index 00000000000..c723a96b788
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test62.d
@@ -0,0 +1,7 @@
+// PERMUTE_ARGS:
+
+import imports.test62a;
+
+struct S { }
+
+void main() { }
diff --git a/gcc/testsuite/gdc.test/compilable/test63.d b/gcc/testsuite/gdc.test/compilable/test63.d
new file mode 100644
index 00000000000..70d49646f77
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test63.d
@@ -0,0 +1,7 @@
+// EXTRA_SOURCES: imports/test63a.d
+// PERMUTE_ARGS:
+
+private import imports.test63a;
+
+const int SIZE = 7;
+
diff --git a/gcc/testsuite/gdc.test/compilable/test6319.d b/gcc/testsuite/gdc.test/compilable/test6319.d
new file mode 100644
index 00000000000..fb036d744d9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test6319.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -debug
+
+int x;
+
+void main() pure
+{
+    debug
+    {
+        {
+            x = 0;
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test6395.d b/gcc/testsuite/gdc.test/compilable/test6395.d
new file mode 100644
index 00000000000..95f1a7eae6e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test6395.d
@@ -0,0 +1,7 @@
+// REQUIRED_ARGS: -c -Icompilable/extra-files
+// EXTRA_SOURCES: b6395.d
+
+// 6395
+
+import c6395;
+
diff --git a/gcc/testsuite/gdc.test/compilable/test6534.d b/gcc/testsuite/gdc.test/compilable/test6534.d
new file mode 100644
index 00000000000..513655d3b70
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test6534.d
@@ -0,0 +1,39 @@
+void main()
+{
+                 class  MC{ int x; }
+           const class  CC{ int x; }    static assert(is(typeof( CC.x) == const));
+       immutable class  IC{ int x; }    static assert(is(typeof( IC.x) == immutable));
+          shared class  SC{ int x; }    static assert(is(typeof( SC.x) == shared));
+    shared const class SCC{ int x; }    static assert(is(typeof(SCC.x) == shared) && is(typeof(SCC.x) == const));
+
+                 struct  MS{ int x; }
+           const struct  CS{ int x; }   static assert(is(typeof( CS.x) == const));
+       immutable struct  IS{ int x; }   static assert(is(typeof( IS.x) == immutable));
+          shared struct  SS{ int x; }   static assert(is(typeof( SS.x) == shared));
+    shared const struct SCS{ int x; }   static assert(is(typeof(SCS.x) == shared) && is(typeof(SCS.x) == const));
+
+                 union  MU{ int x; }
+           const union  CU{ int x; }    static assert(is(typeof( CU.x) == const));
+       immutable union  IU{ int x; }    static assert(is(typeof( IU.x) == immutable));
+          shared union  SU{ int x; }    static assert(is(typeof( SU.x) == shared));
+    shared const union SCU{ int x; }    static assert(is(typeof(SCU.x) == shared) && is(typeof(SCU.x) == const));
+
+
+                 static class  S_MC{ int x; }
+           const static class  S_CC{ int x; }    static assert(is(typeof( S_CC.x) == const));
+       immutable static class  S_IC{ int x; }    static assert(is(typeof( S_IC.x) == immutable));
+          shared static class  S_SC{ int x; }    static assert(is(typeof( S_SC.x) == shared));
+    shared const static class S_SCC{ int x; }    static assert(is(typeof(S_SCC.x) == shared) && is(typeof(S_SCC.x) == const));
+
+                 static struct  S_MS{ int x; }
+           const static struct  S_CS{ int x; }   static assert(is(typeof( S_CS.x) == const));
+       immutable static struct  S_IS{ int x; }   static assert(is(typeof( S_IS.x) == immutable));
+          shared static struct  S_SS{ int x; }   static assert(is(typeof( S_SS.x) == shared));
+    shared const static struct S_SCS{ int x; }   static assert(is(typeof(S_SCS.x) == shared) && is(typeof(S_SCS.x) == const));
+
+                 static union  S_MU{ int x; }
+           const static union  S_CU{ int x; }    static assert(is(typeof( S_CU.x) == const));
+       immutable static union  S_IU{ int x; }    static assert(is(typeof( S_IU.x) == immutable));
+          shared static union  S_SU{ int x; }    static assert(is(typeof( S_SU.x) == shared));
+    shared const static union S_SCU{ int x; }    static assert(is(typeof(S_SCU.x) == shared) && is(typeof(S_SCU.x) == const));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test6552.d b/gcc/testsuite/gdc.test/compilable/test6552.d
new file mode 100644
index 00000000000..4a06f5cb68e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test6552.d
@@ -0,0 +1,26 @@
+// REQUIRED_ARGS: -w
+
+void main()
+{
+    int i;
+    switch (i)
+    {
+        case 1, 2:
+        case 3, 4: break;
+        default: break;
+    }
+
+    char ch;
+    switch (ch)
+    {
+        case 'U', 'u':
+        case 'L', 'l':
+        default:
+    }
+
+    switch (i)
+    {
+        default: case 1:
+        case 3,4:
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test66.d b/gcc/testsuite/gdc.test/compilable/test66.d
new file mode 100644
index 00000000000..1213884f72f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test66.d
@@ -0,0 +1,21 @@
+// PERMUTE_ARGS:
+
+import imports.test66a;
+
+alias int TOK;
+
+enum
+{
+	TOKmax
+};
+
+struct Token
+{
+    static char[] tochars[TOKmax];
+}
+
+class Lexer
+{
+    Token token;
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test67.d b/gcc/testsuite/gdc.test/compilable/test67.d
new file mode 100644
index 00000000000..bcd48b20ddf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test67.d
@@ -0,0 +1,12 @@
+// PERMUTE_ARGS:
+
+import imports.test67a;
+
+interface I
+{
+}
+
+interface SubI : I
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test68.d b/gcc/testsuite/gdc.test/compilable/test68.d
new file mode 100644
index 00000000000..bfac489342d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test68.d
@@ -0,0 +1,19 @@
+// PERMUTE_ARGS:
+
+// Bugzilla 4278
+
+import imports.test68a;
+
+class Foo : OtherModuleClass
+{
+        override void foo()
+        {
+                super.foo();
+        }
+}
+
+void main()
+{
+        new Foo();
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test69.d b/gcc/testsuite/gdc.test/compilable/test69.d
new file mode 100644
index 00000000000..fb8e1ba30c8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test69.d
@@ -0,0 +1,54 @@
+// PERMUTE_ARGS:
+
+// ICE(expression.c) DMD 0.110
+// http://www.digitalmars.com/d/archives/digitalmars/D/bugs/2966.html
+
+string str255() { return "\255"; }
+void fromFail49()
+{
+    switch("abc")
+    {
+	case "":
+	case str255():
+	    break;
+    default:
+        break;
+    }
+}
+
+// Bugzilla 5735
+
+struct A {}
+void b() {}
+
+void foo(bool cond) {}
+
+void main()
+{
+    A a;
+    int i;
+
+    static assert(!__traits(compiles, assert(a)));
+    static assert(!__traits(compiles, assert(i || a)));
+    static assert(!__traits(compiles, assert(0 || a)));
+    static assert(!__traits(compiles, assert(i && a)));
+    static assert(!__traits(compiles, assert(1 && a)));
+
+    static assert(!__traits(compiles, foo(a)));
+    static assert(!__traits(compiles, foo(i || a)));
+    static assert(!__traits(compiles, foo(0 || a)));
+    static assert(!__traits(compiles, foo(i && a)));
+    static assert(!__traits(compiles, foo(1 && a)));
+
+    static assert(!__traits(compiles, assert(b)));
+    static assert(!__traits(compiles, assert(i || b)));
+    static assert(!__traits(compiles, assert(0 || b)));
+    static assert(!__traits(compiles, assert(i && b)));
+    static assert(!__traits(compiles, assert(1 && b)));
+
+    static assert(!__traits(compiles, foo(b)));
+    static assert(!__traits(compiles, foo(i || b)));
+    static assert(!__traits(compiles, foo(0 || b)));
+    static assert(!__traits(compiles, foo(i && b)));
+    static assert(!__traits(compiles, foo(1 && b)));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test6999.d b/gcc/testsuite/gdc.test/compilable/test6999.d
new file mode 100644
index 00000000000..c4e916f75cf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test6999.d
@@ -0,0 +1,29 @@
+// 6999: inout in front of return type
+
+struct A
+{
+inout:
+    inout(int) foo()
+    {
+        return 0;
+    }
+}
+
+struct B
+{
+    inout
+    {
+        inout(int) foo()
+        {
+            return 0;
+        }
+    }
+}
+
+struct C
+{
+    inout inout(int) foo()
+    {
+        return 0;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test70.d b/gcc/testsuite/gdc.test/compilable/test70.d
new file mode 100644
index 00000000000..9a821b23202
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test70.d
@@ -0,0 +1,10 @@
+import imports.test70 : foo;
+
+void foo(int) // overloads with selective import
+{
+}
+
+void bar()
+{
+    foo();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test7030.d b/gcc/testsuite/gdc.test/compilable/test7030.d
new file mode 100644
index 00000000000..c03a6b1f62b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test7030.d
@@ -0,0 +1,22 @@
+extern(C++)
+{
+    struct S
+    {
+        void foo(int) const;
+        void bar(int);
+        static __gshared int boo;
+    }
+}
+
+version (OSX)
+{
+    static assert(S.foo.mangleof == "__ZNK1S3fooEi");
+    static assert(S.bar.mangleof == "__ZN1S3barEi");
+    static assert(S.boo.mangleof == "__ZN1S3booE");
+}
+else version (Posix)
+{
+    static assert(S.foo.mangleof == "_ZNK1S3fooEi");
+    static assert(S.bar.mangleof == "_ZN1S3barEi");
+    static assert(S.boo.mangleof == "_ZN1S3booE");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test7065.d b/gcc/testsuite/gdc.test/compilable/test7065.d
new file mode 100644
index 00000000000..e078debc7cd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test7065.d
@@ -0,0 +1,38 @@
+void main()
+{
+    align(1)
+    struct X1 { ubyte b; int n; }
+    static assert(X1.sizeof == 8);
+    static assert(X1.b.offsetof == 0);
+    static assert(X1.n.offsetof == 4);
+    //X1 x1;
+    //assert(cast(void*)&x1.b == cast(void*)&x1 + 0);
+    //assert(cast(void*)&x1.n == cast(void*)&x1 + 1);
+
+    struct Y1 { ubyte b; int n; }
+    static assert(Y1.sizeof == 8);
+    static assert(Y1.b.offsetof == 0);
+    static assert(Y1.n.offsetof == 4);
+    //Y1 y1;
+    //assert(cast(void*)&y1.b == cast(void*)&y1 + 0);
+    //assert(cast(void*)&y1.n == cast(void*)&y1 + 4);
+
+    int local;
+
+    align(1)
+    struct X2 { ubyte b; int n; int f(){ return local; } }
+    static assert(X2.sizeof == 8 + (void*).sizeof);
+    static assert(X2.b.offsetof == 0);
+    static assert(X2.n.offsetof == 4);
+    //X2 x2;
+    //assert(cast(void*)&x2.b == cast(void*)&x2 + 0);
+    //assert(cast(void*)&x2.n == cast(void*)&x2 + 1);
+
+    struct Y2 { ubyte b; int n; int f(){ return local; } }
+    static assert(Y2.sizeof == 8 + (void*).sizeof);
+    static assert(Y2.b.offsetof == 0);
+    static assert(Y2.n.offsetof == 4);
+    //Y2 y2;
+    //assert(cast(void*)&y2.b == cast(void*)&y2 + 0);
+    //assert(cast(void*)&y2.n == cast(void*)&y2 + 4);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test71.d b/gcc/testsuite/gdc.test/compilable/test71.d
new file mode 100644
index 00000000000..83b24a01b32
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test71.d
@@ -0,0 +1,6 @@
+import imports.test71;
+
+void bar()
+{
+    imports.test71.foo();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test7172.d b/gcc/testsuite/gdc.test/compilable/test7172.d
new file mode 100644
index 00000000000..a4cf663066e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test7172.d
@@ -0,0 +1,23 @@
+void main()
+{
+    abstract class AbstractC{}
+    static assert(!__traits(compiles, { new AbstractC(); }));
+
+    final class FinalC{}
+    static assert(!__traits(compiles, { class D : FinalC{} }));
+
+    scope class ScopeC{}
+    static assert(!__traits(compiles, { auto  sc = new ScopeC(); }));
+    static assert( __traits(compiles, { scope sc = new ScopeC(); }));
+
+    synchronized class SyncC{ void f(){} }
+    static assert(SyncC.f.mangleof[$-13..$] == "5SyncC1fMOFZv");
+
+    @safe    class SCx{ void f(){} }
+    @trusted class SCy{ void f(){} }
+    @system  class SCz{ void f(){} }
+
+    static assert(SCx.f.mangleof[$-12..$] == "3SCx1fMFNfZv");   // Nf: FuncAttrSafe
+    static assert(SCy.f.mangleof[$-12..$] == "3SCy1fMFNeZv");   // Ne: FuncAttrTrusted
+    static assert(SCz.f.mangleof[$-10..$] == "3SCz1fMFZv");     // (none)
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test7190.d b/gcc/testsuite/gdc.test/compilable/test7190.d
new file mode 100644
index 00000000000..aac01b2f8cc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test7190.d
@@ -0,0 +1,7 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -c -Icompilable/extra-files
+
+import example7190.controllers.HomeController;
+import example7190.models.HomeModel;
+
+void main(){}
diff --git a/gcc/testsuite/gdc.test/compilable/test72.d b/gcc/testsuite/gdc.test/compilable/test72.d
new file mode 100644
index 00000000000..5de9d42a72d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test72.d
@@ -0,0 +1,8 @@
+module test72;
+
+import imports.test72a, imports.test72c;
+
+void bar()
+{
+    foo();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test7252.d b/gcc/testsuite/gdc.test/compilable/test7252.d
new file mode 100644
index 00000000000..9cef2abe081
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test7252.d
@@ -0,0 +1,10 @@
+alias char* function() Func;
+
+alias const char* function() CFunc;
+
+void to(S)(S) { }
+
+void foo(CFunc cFunc)
+{
+    to(cFunc());
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test7399.d b/gcc/testsuite/gdc.test/compilable/test7399.d
new file mode 100644
index 00000000000..76ac9202c68
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test7399.d
@@ -0,0 +1,6 @@
+// 7399
+static assert(!__traits(compiles, { import non.existing.file; }));
+
+// 7400
+static assert(!is(typeof({import non_existing_file;})));
+
diff --git a/gcc/testsuite/gdc.test/compilable/test7491.d b/gcc/testsuite/gdc.test/compilable/test7491.d
new file mode 100644
index 00000000000..eb742e23598
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test7491.d
@@ -0,0 +1,53 @@
+struct Struct
+{
+    import object;
+    import imports.test7491a;
+    import renamed=imports.test7491b;
+}
+
+struct AliasThis
+{
+    Struct _struct;
+    alias _struct this;
+}
+
+class Base
+{
+    import object;
+    import imports.test7491a;
+    import renamed=imports.test7491b;
+}
+
+class Derived : Base
+{
+}
+
+interface Interface
+{
+    import object;
+    import imports.test7491a;
+    import renamed=imports.test7491b;
+}
+
+class Impl : Interface
+{
+}
+
+static assert(__traits(compiles, Struct.object));
+static assert(__traits(compiles, Struct.imports));
+static assert(__traits(compiles, Struct.renamed));
+static assert(__traits(compiles, AliasThis.object));
+static assert(__traits(compiles, AliasThis.imports));
+static assert(__traits(compiles, AliasThis.renamed));
+static assert(__traits(compiles, Base.object));
+static assert(__traits(compiles, Base.imports));
+static assert(__traits(compiles, Base.renamed));
+static assert(__traits(compiles, Derived.object));
+static assert(__traits(compiles, Derived.imports));
+static assert(__traits(compiles, Derived.renamed));
+static assert(__traits(compiles, Interface.object));
+static assert(__traits(compiles, Interface.imports));
+static assert(__traits(compiles, Interface.renamed));
+static assert(__traits(compiles, Impl.object));
+static assert(__traits(compiles, Impl.imports));
+static assert(__traits(compiles, Impl.renamed));
diff --git a/gcc/testsuite/gdc.test/compilable/test7524.d b/gcc/testsuite/gdc.test/compilable/test7524.d
new file mode 100644
index 00000000000..6ff491a7159
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test7524.d
@@ -0,0 +1,3 @@
+// 7524
+
+#line __LINE__ "y.d"
diff --git a/gcc/testsuite/gdc.test/compilable/test7569.d b/gcc/testsuite/gdc.test/compilable/test7569.d
new file mode 100644
index 00000000000..59d73aa4f74
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test7569.d
@@ -0,0 +1,9 @@
+template Tuple(T...)
+{
+    alias T Tuple;
+}
+
+void main()
+{
+    Tuple!(int, int) tup1 = void;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test7754.d b/gcc/testsuite/gdc.test/compilable/test7754.d
new file mode 100644
index 00000000000..1ce9b448995
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test7754.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -H -Hd${RESULTS_DIR}/compilable
+// POST_SCRIPT: compilable/extra-files/test7754-postscript.sh
+// PERMUTE_ARGS: -d -dw
+
+struct Foo(T)
+{
+   shared static this()
+   {
+   }
+
+   static this()
+   {
+   }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8038.d b/gcc/testsuite/gdc.test/compilable/test8038.d
new file mode 100644
index 00000000000..436d7072a42
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8038.d
@@ -0,0 +1,13 @@
+template t(T){alias T t;}
+
+t!(#line 10
+    t!(
+        int,
+    )
+) i;
+
+t!(
+    t!(#line 10
+        int,
+    )
+) j;
diff --git a/gcc/testsuite/gdc.test/compilable/test8041.d b/gcc/testsuite/gdc.test/compilable/test8041.d
new file mode 100644
index 00000000000..ee47120e0ca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8041.d
@@ -0,0 +1,10 @@
+// PERMUTE_ARGS:
+
+struct Foo { }
+
+void main()
+{
+    static Foo sf;  // ok
+    __gshared Foo gf;  // was: Error: non-constant expression gf = 0
+    __gshared int[1][1] arr;  // dup: Issue 6089
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8296.d b/gcc/testsuite/gdc.test/compilable/test8296.d
new file mode 100644
index 00000000000..d27ba15f3e0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8296.d
@@ -0,0 +1,33 @@
+struct bar2
+{
+  int i;
+  @disable this();
+  this(int i)
+  {
+    this.i = i;
+  }
+}
+
+class InnerBar {
+  bar2 b;
+  
+  this()
+  {
+    b = bar2(0);
+  }
+}
+
+struct bar1
+{
+  InnerBar b;
+}
+  
+class Foo
+{
+  bar1 m_bar1;
+}
+
+void main(string[] args)
+{
+  auto foo = new Foo();
+}
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/compilable/test8509.d b/gcc/testsuite/gdc.test/compilable/test8509.d
new file mode 100644
index 00000000000..a9072231fe8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8509.d
@@ -0,0 +1,11 @@
+module test8509;
+enum E : string { a = "hello", b = "world" }
+struct S { E opCat(S s) { return E.a; } E opCat(string s) { return E.a; } }
+
+void main()
+{
+    E e3 = S() ~ S();
+    E e4 = S() ~ "a";
+    assert(e3 == E.a);
+    assert(e4 == E.a);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8513.d b/gcc/testsuite/gdc.test/compilable/test8513.d
new file mode 100644
index 00000000000..bcdc657be93
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8513.d
@@ -0,0 +1,32 @@
+interface I_Foo { void i_outer(); }
+class C_Foo { void c_outer() { } }
+
+class Bar
+{
+    interface I_Foo { void i_inner(); }
+    class C_Foo { void c_inner() { } }
+    
+    class Impl1 : C_Foo, I_Foo
+    {
+        override void i_inner() { }
+        override void c_inner() { }
+    }
+    
+    class Impl2 : C_Foo, .I_Foo
+    {
+        override void i_outer() { }
+        override void c_inner() { }
+    }
+    
+    class Impl3 : .C_Foo, I_Foo
+    {
+        override void i_inner() { }
+        override void c_outer() { }
+    }
+    
+    class Impl4 : .C_Foo, .I_Foo
+    {
+        override void i_outer() { }
+        override void c_outer() { }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8543.d b/gcc/testsuite/gdc.test/compilable/test8543.d
new file mode 100644
index 00000000000..4b29542647e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8543.d
@@ -0,0 +1,32 @@
+
+version (D_SIMD)
+{
+    struct vfloat
+    {
+    public:
+        __vector(float[4]) f32;
+
+        this(float X) nothrow
+        {
+            f32.ptr[0] = X;
+            f32.ptr[1] = X;
+            f32.ptr[2] = X;
+            f32.ptr[3] = X;
+        }
+        this(float X, float Y, float Z, float W) nothrow
+        {
+            f32.array[0] = X;
+            f32.array[1] = Y;
+            f32.array[2] = Z;
+            f32.array[3] = W;
+        }
+        this(float[4] values) nothrow
+        {
+            f32.array = values;
+        }
+    }
+
+    immutable GvfGlobal_ThreeA = vfloat(3.0f);
+    immutable GvfGlobal_ThreeB = vfloat(3.0f, 3.0f, 3.0f, 3.0f);
+    immutable GvfGlobal_ThreeC = vfloat([3.0f, 3.0f, 3.0f, 3.0f]);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8631.d b/gcc/testsuite/gdc.test/compilable/test8631.d
new file mode 100644
index 00000000000..662729f2535
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8631.d
@@ -0,0 +1,12 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -de
+
+class B {
+    int foo() immutable { return 2; }
+    int foo() const { return 2; }
+}
+class D : B {
+    override int foo() immutable { return 2; }
+             int foo() const shared { return 2; }
+    override int foo() const { return 2; }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8675.d b/gcc/testsuite/gdc.test/compilable/test8675.d
new file mode 100644
index 00000000000..ecabfdd6567
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8675.d
@@ -0,0 +1,17 @@
+class MyError : Error
+{
+    this(string msg)
+    {
+        super(msg);
+    }
+}
+
+void foo() nothrow
+{
+    throw new Error("Some error");
+}
+
+void bar() nothrow
+{
+    throw new MyError("Some error");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8696.d b/gcc/testsuite/gdc.test/compilable/test8696.d
new file mode 100644
index 00000000000..755d52996a3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8696.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -w
+
+// 8696: incorrect dangling else with version():
+version (all):
+
+version (linux)
+{
+}
+else version (OSX)
+{
+}
+else
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8717.d b/gcc/testsuite/gdc.test/compilable/test8717.d
new file mode 100644
index 00000000000..26a2866c682
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8717.d
@@ -0,0 +1,63 @@
+module test8717;
+
+struct SPR
+{
+private:
+    enum e = 1;
+    immutable int ii = 1;
+    immutable static int sii = 1;
+    static int sf() { return 1; }
+    int f() const { return 1; }
+}
+
+static assert(SPR.e == 1);
+//static assert(SPR.ii == 1);
+static assert(SPR.sii == 1);
+static assert(SPR.sf() == 1);
+static assert(SPR.init.e == 1);
+static assert(SPR.init.ii == 1);
+static assert(SPR.init.sii == 1);
+static assert(SPR.sf() == 1);
+static assert(SPR.init.f() == 1);
+
+static if(SPR.e != 1) { static assert(0); }
+//static if(SPR.ii != 1) { static assert(0); }
+static if(SPR.sii != 1) { static assert(0); }
+static if(SPR.sf() != 1) { static assert(0); }
+static if(SPR.init.e != 1) { static assert(0); }
+static if(SPR.init.ii != 1) { static assert(0); }
+static if(SPR.init.sii != 1) { static assert(0); }
+static if(SPR.sf() != 1) { static assert(0); }
+static if(SPR.init.f() != 1) { static assert(0); }
+
+struct SPT
+{
+protected:
+    enum e = 1;
+    immutable int ii = 1;
+    immutable static int sii = 1;
+    static int sf() { return 1; }
+    int f() const { return 1; }
+}
+
+static assert(SPT.e == 1);
+//static assert(SPT.ii == 1);
+static assert(SPT.sii == 1);
+static assert(SPT.sf() == 1);
+static assert(SPT.init.e == 1);
+static assert(SPT.init.ii == 1);
+static assert(SPT.init.sii == 1);
+static assert(SPT.sf() == 1);
+static assert(SPT.init.f() == 1);
+
+static if(SPT.e != 1) { static assert(0); }
+//static if(SPT.ii != 1) { static assert(0); }
+static if(SPT.sii != 1) { static assert(0); }
+static if(SPT.sf() != 1) { static assert(0); }
+static if(SPT.init.e != 1) { static assert(0); }
+static if(SPT.init.ii != 1) { static assert(0); }
+static if(SPT.init.sii != 1) { static assert(0); }
+static if(SPT.sf() != 1) { static assert(0); }
+static if(SPT.init.f() != 1) { static assert(0); }
+
+void main() { }
diff --git a/gcc/testsuite/gdc.test/compilable/test8802.d b/gcc/testsuite/gdc.test/compilable/test8802.d
new file mode 100644
index 00000000000..7365e91fe77
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8802.d
@@ -0,0 +1,39 @@
+// PERMUTE_ARGS:
+enum A : typeof(null)*
+{
+    a = null
+}
+
+enum B : typeof(null)**
+{
+    a = null
+}
+
+enum C : void*
+{
+    a = null
+}
+
+enum D : void**
+{
+    a = null
+}
+
+enum NullEn : void*
+{
+    z = null
+}
+
+enum E : NullEn
+{
+    a = null
+}
+
+void main()
+{
+    auto a = A.a;
+    auto b = B.a;
+    auto c = C.a;
+    auto d = D.a;
+    auto e = E.a;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8898.d b/gcc/testsuite/gdc.test/compilable/test8898.d
new file mode 100644
index 00000000000..9433a77ff58
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8898.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -w
+// PERMUTE_ARGS:
+
+static if (true):
+
+version (Foo)
+{
+}
+else
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8922a.d b/gcc/testsuite/gdc.test/compilable/test8922a.d
new file mode 100644
index 00000000000..e2f3d5c2c67
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8922a.d
@@ -0,0 +1,9 @@
+// PERMUTE_ARGS:
+import imports.bug8922;
+
+void test()
+{
+    static assert(!__traits(compiles, __traits(parent, imports)));
+    enum x = __traits(parent, imports.bug8922).stringof;
+    static assert(x == "package imports");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8922b.d b/gcc/testsuite/gdc.test/compilable/test8922b.d
new file mode 100644
index 00000000000..a91601b3219
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8922b.d
@@ -0,0 +1,9 @@
+// PERMUTE_ARGS:
+void test()
+{
+    import imports.bug8922;
+    static assert(!__traits(compiles, __traits(parent, imports)));
+    enum x = __traits(parent, imports.bug8922).stringof;
+    static assert(x == "package imports");
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test8922c.d b/gcc/testsuite/gdc.test/compilable/test8922c.d
new file mode 100644
index 00000000000..da5ad3a6267
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8922c.d
@@ -0,0 +1,10 @@
+// PERMUTE_ARGS:
+static import imports.bug8922;
+
+void test()
+{
+    static assert(!__traits(compiles, __traits(parent, imports)));
+    static assert(!__traits(compiles, __traits(parent, bug8922)));
+    enum x = __traits(parent, imports.bug8922).stringof;
+    static assert(x == "package imports");
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8922d.d b/gcc/testsuite/gdc.test/compilable/test8922d.d
new file mode 100644
index 00000000000..4a56dd7f190
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8922d.d
@@ -0,0 +1,10 @@
+// PERMUTE_ARGS:
+void test()
+{
+    static import imports.bug8922;
+    static assert(!__traits(compiles, __traits(parent, imports)));
+    static assert(!__traits(compiles, __traits(parent, bug8922)));
+    enum x = __traits(parent, imports.bug8922).stringof;
+    static assert(x == "package imports");
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/test8922e.d b/gcc/testsuite/gdc.test/compilable/test8922e.d
new file mode 100644
index 00000000000..3c52d006b49
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8922e.d
@@ -0,0 +1,11 @@
+// PERMUTE_ARGS:
+import renamed = imports.bug8922;
+
+void test()
+{
+    enum x = __traits(parent, renamed).stringof;
+    static assert(x == "package imports");
+    static assert(!__traits(compiles, __traits(parent, imports)));
+    static assert(!__traits(compiles, __traits(parent, bug8922)));
+    static assert(!__traits(compiles, __traits(parent, imports.bug8922)));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8922f.d b/gcc/testsuite/gdc.test/compilable/test8922f.d
new file mode 100644
index 00000000000..2b2eb0fb9c7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8922f.d
@@ -0,0 +1,10 @@
+// PERMUTE_ARGS:
+void test()
+{
+    import renamed = imports.bug8922;
+    enum x = __traits(parent, renamed).stringof;
+    static assert(x == "package imports");
+    static assert(!__traits(compiles, __traits(parent, imports)));
+    static assert(!__traits(compiles, __traits(parent, bug8922)));
+    static assert(!__traits(compiles, __traits(parent, imports.bug8922)));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8937.d b/gcc/testsuite/gdc.test/compilable/test8937.d
new file mode 100644
index 00000000000..c6f59bc1c56
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8937.d
@@ -0,0 +1,60 @@
+
+mixin template X8937()
+{
+    int value;
+}
+
+debug = test;
+
+void main()
+{
+    // (static) import statement
+    {
+        static assert(!__traits(compiles, cos(0)));
+        if (true)
+        {
+            static assert(!__traits(compiles, cos(0)));
+            import core.stdc.math;
+            static assert( __traits(compiles, cos(0)));
+        }
+        static assert(!__traits(compiles, cos(0)));
+
+        if (true)
+            import core.stdc.math;
+        static assert(!__traits(compiles, cos(0))); // fails
+
+        if (true)
+            static import core.stdc.math;
+        static assert(!__traits(compiles, core.stdc.math.cos(0))); // fails
+    }
+    static assert(!__traits(compiles, cos(0)));
+
+    // mixin statement
+    {
+        if (true)
+            mixin X8937!();
+        static assert(!__traits(compiles, value)); // fails
+    }
+
+    // enum declaration
+    {
+        if (true)
+            enum E { x = 10 }
+        static assert(!__traits(compiles, E)); // fails
+    }
+
+    // conditional declarations
+    {
+        if (true)
+            static if (true) struct S1 {}
+        static assert(!__traits(compiles, S1)); // fails
+
+        if (true)
+            version (all) struct S2 {}
+        static assert(!__traits(compiles, S2)); // fails
+
+        if (true)
+            debug (test) struct S3 {}
+        static assert(!__traits(compiles, S3)); // fails
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test8959.d b/gcc/testsuite/gdc.test/compilable/test8959.d
new file mode 100644
index 00000000000..b7805bbf131
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test8959.d
@@ -0,0 +1,55 @@
+/*
+TEST_OUTPUT:
+---
+U1 = int
+U2 = int
+V1 = long, K1 = string
+V2 = long, K2 = string
+TL1 = (int, string)
+TL2 = (int, string)
+U3 = int
+U4 = int
+V3 = long, K3 = string
+V4 = long, K4 = string
+TL3 = (int, string)
+TL4 = (int, string)
+---
+*/
+
+static if (is(int* == U1*, U1)) { pragma(msg, "U1 = ", U1); }
+static if (is(int* :  U2*, U2)) { pragma(msg, "U2 = ", U2); }
+static assert(is(int* == U*, U));
+static assert(is(int* :  U*, U));
+
+alias AA = long[string];
+static if (is(AA == V1[K1], V1, K1)) { pragma(msg, "V1 = ", V1, ", K1 = ", K1); }
+static if (is(AA :  V2[K2], V2, K2)) { pragma(msg, "V2 = ", V2, ", K2 = ", K2); }
+static assert(is(AA == V[K], V, K));
+static assert(is(AA :  V[K], V, K));
+
+class B(TL...) {}
+class C(TL...) : B!TL {}
+alias X = C!(int, string);
+
+static if (is(X == C!TL1, TL1...)) { pragma(msg, "TL1 = ", TL1); }
+static if (is(X :  B!TL2, TL2...)) { pragma(msg, "TL2 = ", TL2); }
+static assert(is(X == C!TL, TL...));
+static assert(is(X :  B!TL, TL...));
+
+void test8959()
+{
+    static if (is(int* == U3*, U3)) { pragma(msg, "U3 = ", U3); }
+    static if (is(int* :  U4*, U4)) { pragma(msg, "U4 = ", U4); }
+    static assert(is(int* == U*, U));
+    static assert(is(int* :  U*, U));
+
+    static if (is(AA == V3[K3], V3, K3)) { pragma(msg, "V3 = ", V3, ", K3 = ", K3); }
+    static if (is(AA :  V4[K4], V4, K4)) { pragma(msg, "V4 = ", V4, ", K4 = ", K4); }
+    static assert(is(AA == V[K], V, K));
+    static assert(is(AA :  V[K], V, K));
+
+    static if (is(X == C!TL3, TL3...)) { pragma(msg, "TL3 = ", TL3); }
+    static if (is(X :  B!TL4, TL4...)) { pragma(msg, "TL4 = ", TL4); }
+    static assert(is(X == C!TL, TL...));
+    static assert(is(X :  B!TL, TL...));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9057.d b/gcc/testsuite/gdc.test/compilable/test9057.d
new file mode 100644
index 00000000000..d54b9cd03c7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9057.d
@@ -0,0 +1,19 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -c -Icompilable/extra-files
+
+struct Bug9057(T)
+{
+    T x;
+}
+
+void test9507() {
+    import imp9057;
+    Bug9057!(BugInt) xxx;
+}
+
+void test9507_2() {
+    import imp9057_2;
+    Bug9057!(BugInt) xxx;
+}
+
+
diff --git a/gcc/testsuite/gdc.test/compilable/test9209.d b/gcc/testsuite/gdc.test/compilable/test9209.d
new file mode 100644
index 00000000000..03c2b79904a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9209.d
@@ -0,0 +1,16 @@
+// PERMUTE_ARGS:
+
+// 9209
+
+auto array(T)(T t){ return t; }
+
+auto bar()(in int* x)
+{
+    if (true) return 0;
+    return array(bar(x));
+}
+
+void main ()
+{
+    bar(null);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9276.d b/gcc/testsuite/gdc.test/compilable/test9276.d
new file mode 100644
index 00000000000..f6cefa5b48c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9276.d
@@ -0,0 +1,6 @@
+// EXTRA_SOURCES: imports/test9276parser.d
+
+
+// This is a dummy module for compilable test
+void main()
+{}
diff --git a/gcc/testsuite/gdc.test/compilable/test9278a.d b/gcc/testsuite/gdc.test/compilable/test9278a.d
new file mode 100644
index 00000000000..932411fc656
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9278a.d
@@ -0,0 +1,16 @@
+// PREMUTE_ARGS:
+
+// Works fine here
+struct datum { float num = 0.0; }
+
+datum emitOne()
+{
+    datum t;
+    return t;
+}
+const dataArr = [emitOne()];
+
+// A very bad day
+//struct datum { float num = 0.0; }
+
+void main(){}
diff --git a/gcc/testsuite/gdc.test/compilable/test9278b.d b/gcc/testsuite/gdc.test/compilable/test9278b.d
new file mode 100644
index 00000000000..0b4fee2f491
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9278b.d
@@ -0,0 +1,16 @@
+// PREMUTE_ARGS:
+
+// Works fine here
+//struct datum { float num = 0.0; }
+
+datum emitOne()
+{
+    datum t;
+    return t;
+}
+const dataArr = [emitOne()];
+
+// A very bad day
+struct datum { float num = 0.0; }
+
+void main(){}
diff --git a/gcc/testsuite/gdc.test/compilable/test9399.d b/gcc/testsuite/gdc.test/compilable/test9399.d
new file mode 100644
index 00000000000..47879e78fe2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9399.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -c -inline -Icompilable/imports
+// EXTRA_SOURCES: imports/test9399a.d
+
+import imports.test9399a;
+void fun(int a) {
+    void nested() {
+        a = 42;
+    }
+    call!nested();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9434.d b/gcc/testsuite/gdc.test/compilable/test9434.d
new file mode 100644
index 00000000000..26c711731bf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9434.d
@@ -0,0 +1,19 @@
+import test9435;//semantic;
+
+template Visitors()
+{
+    mixin Semantic!(typeof(this));
+}
+
+class Node
+{
+    mixin Visitors;
+}
+
+class Expression : Node
+{
+}
+
+class BinaryExp(TokenType op) : Expression
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9435.d b/gcc/testsuite/gdc.test/compilable/test9435.d
new file mode 100644
index 00000000000..7046fdd8a15
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9435.d
@@ -0,0 +1,17 @@
+import test9434;//expression;
+
+enum TokenType { Dot }
+
+template Tok(string type)
+{
+    enum Tok = TokenType.Dot;
+}
+
+template Semantic(T)
+{
+    invariant(){}
+}
+
+template Semantic(T) if (is(T == BinaryExp!(Tok!".")))
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9436.d b/gcc/testsuite/gdc.test/compilable/test9436.d
new file mode 100644
index 00000000000..c80bdc59e82
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9436.d
@@ -0,0 +1,5 @@
+// REQUIRED_ARGS: -c
+// EXTRA_SOURCES: imports/test9436interp.d
+
+// this is a dummy module for test 9436.
+
diff --git a/gcc/testsuite/gdc.test/compilable/test9526.d b/gcc/testsuite/gdc.test/compilable/test9526.d
new file mode 100644
index 00000000000..2a18539f95a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9526.d
@@ -0,0 +1,21 @@
+template forward(args...)
+{
+    @property fwd()() { return args[0]; }
+    static assert(__traits(compiles, { auto ex = fwd; }));
+    alias fwd forward;
+}
+
+void initializeClassInstance(C, Args...)(C chunk, auto ref Args args)
+{
+    chunk.__ctor(forward!args);
+}
+
+void main()
+{
+    static int si = 0;
+    static class C { this(int) { ++si; } }
+    void[__traits(classInstanceSize, C)] buff = void;
+    auto c = cast(C) buff.ptr;
+    initializeClassInstance(c, 0);
+    assert(si);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9554.d b/gcc/testsuite/gdc.test/compilable/test9554.d
new file mode 100644
index 00000000000..c2270f94771
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9554.d
@@ -0,0 +1,22 @@
+// REQUIRED_ARGS: -o-
+
+module pkg.test9554;
+alias mod = pkg.test9554;
+
+template Test(alias name) { enum Test = name; }
+void fun() {}
+
+static assert(fun.stringof == Test!(fun.stringof));
+static assert(fun.stringof == "fun()");
+static assert(fun.mangleof == Test!(fun.mangleof));
+static assert(fun.mangleof == "_D3pkg8test95543funFZv");
+
+static assert(mod.stringof == Test!(mod.stringof));
+static assert(mod.stringof == "module test9554");
+static assert(mod.mangleof == Test!(mod.mangleof));
+static assert(mod.mangleof == "3pkg8test9554");
+
+static assert(pkg.stringof == Test!(pkg.stringof));
+static assert(pkg.stringof == "package pkg");
+static assert(pkg.mangleof == Test!(pkg.mangleof));
+static assert(pkg.mangleof == "3pkg");
diff --git a/gcc/testsuite/gdc.test/compilable/test9565.d b/gcc/testsuite/gdc.test/compilable/test9565.d
new file mode 100644
index 00000000000..9e3ee6a8170
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9565.d
@@ -0,0 +1,86 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+template TypeTuple(T...) { alias TypeTuple = T; }
+
+bool startsWith(string s, string m) { return s[0 .. m.length] == m; }
+
+void main()
+{
+    enum string castPrefix = "cast(" ~ size_t.stringof ~ ")";
+
+    // TypeSArray
+    static assert((int[10]).stringof == "int[10]", T.stringof);
+
+    int[] arr;
+
+    // IndexExp
+    {
+        // index == IntegerExp
+        static assert((arr[ 4  ]).stringof == "arr[4]");
+        static assert((arr[ 4U ]).stringof == "arr[4]");
+        static assert((arr[ 4L ]).stringof == "arr[4]");
+        static assert((arr[ 4LU]).stringof == "arr[4]");
+
+        // index == UAddExp
+        static assert((arr[+4  ]).stringof == "arr[4]");
+        static assert((arr[+4U ]).stringof == "arr[4]");
+        static assert((arr[+4L ]).stringof == "arr[4]");
+        static assert((arr[+4LU]).stringof == "arr[4]");
+
+        // index == NegExp
+        static assert((arr[-4  ]).stringof == "arr[" ~ castPrefix ~ "-4]");
+        static assert((arr[-4U ]).stringof == "arr[4294967292]");
+        static assert((arr[int.min] ).stringof == "arr[" ~ castPrefix ~ "-2147483648]");
+      static if (is(size_t == ulong))
+      {
+        static assert((arr[-4L ]).stringof == "arr[" ~ castPrefix ~ "-4L]");
+        static assert((arr[-4LU]).stringof == "arr[-4LU]");
+
+        // IntegerLiteral needs suffix if the value is greater than long.max
+        static assert((arr[long.max + 0]).stringof == "arr[9223372036854775807]");
+        static assert((arr[long.max + 1]).stringof == "arr[" ~ castPrefix ~ "(9223372036854775807L + 1L)]");
+      }
+
+        foreach (Int; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong))
+        {
+            enum Int p4 = +4;
+            enum string result1 = (arr[p4]).stringof;
+            static assert(result1 == "arr[4]");
+
+            enum string result2 = (arr[cast(Int)+4]).stringof;
+            static assert(result2 == "arr[4]");
+        }
+        foreach (Int; TypeTuple!(byte, short, int, long))
+        {
+            // keep "cast(Type)" in the string representation
+
+            enum Int m4 = -4;
+            static if (is(typeof({ size_t x = m4; })))
+            {
+                enum string result1 = (arr[m4]).stringof;
+                static assert(result1.startsWith("arr[" ~ castPrefix));
+            }
+            else
+                static assert(!__traits(compiles, arr[m4]));
+
+            enum string result2 = (arr[cast(Int)-4]).stringof;
+            static assert(result2.startsWith("arr[" ~ castPrefix));
+        }
+    }
+
+    // SliceExp
+    {
+        // lwr,upr == IntegerExp
+        static assert((arr[4   .. 8  ]).stringof == "arr[4..8]");
+        static assert((arr[4U  .. 8U ]).stringof == "arr[4..8]");
+        static assert((arr[4L  .. 8L ]).stringof == "arr[4..8]");
+        static assert((arr[4LU .. 8LU]).stringof == "arr[4..8]");
+
+        // lwr,upr == UAddExp
+        static assert((arr[+4   .. +8  ]).stringof == "arr[4..8]");
+        static assert((arr[+4U  .. +8U ]).stringof == "arr[4..8]");
+        static assert((arr[+4L  .. +8L ]).stringof == "arr[4..8]");
+        static assert((arr[+4LU .. +8LU]).stringof == "arr[4..8]");
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9570.d b/gcc/testsuite/gdc.test/compilable/test9570.d
new file mode 100644
index 00000000000..c9df59cf320
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9570.d
@@ -0,0 +1,59 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+void main()
+{
+    ubyte[256] data;
+
+    foreach (immutable        i; 0..256) data[i] = i;
+    foreach (    const        i; 0..256) data[i] = i;
+    foreach (                 i; 0..256) static assert(!__traits(compiles, (data[i] = i)));
+    foreach (immutable int    i; 0..256) data[i] = i;
+    foreach (    const int    i; 0..256) data[i] = i;
+    foreach (          int    i; 0..256) static assert(!__traits(compiles, (data[i] = i)));
+    foreach (immutable(int)   i; 0..256) data[i] = i;
+    foreach (    const(int)   i; 0..256) data[i] = i;
+    foreach (          int    i; 0..256) static assert(!__traits(compiles, (data[i] = i)));
+    foreach (immutable(ulong) i; 0..256) data[i] = i;
+    foreach (    const(ulong) i; 0..256) data[i] = i;
+    foreach (          ulong  i; 0..256) static assert(!__traits(compiles, (data[i] = i)));
+
+    foreach (immutable        i, x; data) data[i] = i;
+    foreach (    const        i, x; data) data[i] = i;
+    foreach (                 i, x; data) static assert(!__traits(compiles, (data[i] = i)));
+    foreach (immutable int    i, x; data) data[i] = i;
+    foreach (    const int    i, x; data) data[i] = i;
+    foreach (          int    i, x; data) static assert(!__traits(compiles, (data[i] = i)));
+    foreach (immutable(int)   i, x; data) data[i] = i;
+    foreach (    const(int)   i, x; data) data[i] = i;
+    foreach (          int    i, x; data) static assert(!__traits(compiles, (data[i] = i)));
+    foreach (immutable(ulong) i, x; data) data[i] = i;
+    foreach (    const(ulong) i, x; data) data[i] = i;
+    foreach (          ulong  i, x; data) static assert(!__traits(compiles, (data[i] = i)));
+
+    foreach_reverse (immutable        i; 0..256) data[i] = i;
+    foreach_reverse (    const        i; 0..256) data[i] = i;
+    foreach_reverse (                 i; 0..256) static assert(!__traits(compiles, (data[i] = i)));
+    foreach_reverse (immutable int    i; 0..256) data[i] = i;
+    foreach_reverse (    const int    i; 0..256) data[i] = i;
+    foreach_reverse (          int    i; 0..256) static assert(!__traits(compiles, (data[i] = i)));
+    foreach_reverse (immutable(int)   i; 0..256) data[i] = i;
+    foreach_reverse (    const(int)   i; 0..256) data[i] = i;
+    foreach_reverse (          int    i; 0..256) static assert(!__traits(compiles, (data[i] = i)));
+    foreach_reverse (immutable(ulong) i; 0..256) data[i] = i;
+    foreach_reverse (    const(ulong) i; 0..256) data[i] = i;
+    foreach_reverse (          ulong  i; 0..256) static assert(!__traits(compiles, (data[i] = i)));
+
+    foreach_reverse (immutable        i, x; data) data[i] = i;
+    foreach_reverse (    const        i, x; data) data[i] = i;
+    foreach_reverse (                 i, x; data) static assert(!__traits(compiles, (data[i] = i)));
+  //foreach_reverse (immutable int    i, x; data) data[i] = i;
+  //foreach_reverse (    const int    i, x; data) data[i] = i;
+  //foreach_reverse (          int    i, x; data) static assert(!__traits(compiles, (data[i] = i)));
+  //foreach_reverse (immutable(int)   i, x; data) data[i] = i;
+  //foreach_reverse (    const(int)   i, x; data) data[i] = i;
+  //foreach_reverse (          int    i, x; data) static assert(!__traits(compiles, (data[i] = i)));
+    foreach_reverse (immutable(ulong) i, x; data) data[i] = i;
+    foreach_reverse (    const(ulong) i, x; data) data[i] = i;
+    foreach_reverse (          ulong  i, x; data) static assert(!__traits(compiles, (data[i] = i)));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9613.d b/gcc/testsuite/gdc.test/compilable/test9613.d
new file mode 100644
index 00000000000..c49c293282f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9613.d
@@ -0,0 +1,32 @@
+// PREMUTE_ARGS:
+struct S9613
+{
+    int f(
+        const(byte) a = const(byte).init,
+        immutable(byte) b = immutable(byte).init,
+        shared(byte) c = shared(byte).init,
+        inout(byte) d = inout(byte).init,
+    ) inout
+    {
+        assert(a == byte.init);
+        assert(b == byte.init);
+        assert(c == byte.init);
+        assert(d == byte.init);
+        static assert(const(byte).init == byte.init);
+        static assert(immutable(byte).init == byte.init);
+        static assert(shared(byte).init == byte.init);
+        static assert(inout(byte).init == byte.init);
+        return 0;
+    }
+}
+
+void main()
+{
+    static assert(const(byte).init == byte.init);
+    static assert(immutable(byte).init == byte.init);
+    static assert(shared(byte).init == byte.init);
+    static assert(const(byte).init.sizeof == byte.sizeof);
+    static assert(const(byte[2]).init[0] == byte.init);
+    enum s = S9613();
+    enum v = s.f();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9639.d b/gcc/testsuite/gdc.test/compilable/test9639.d
new file mode 100644
index 00000000000..e79db9ecb81
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9639.d
@@ -0,0 +1,19 @@
+class A { this(A) {} }
+class B {}
+class C {}
+
+// two sibling nested functions in main
+typeof(null) foo(alias fn)(A a) { fn(a); return foo!fn(B.init); }
+typeof(null) foo(alias fn)(B b) {        return foo!fn(A.init); }
+
+// three sibling nested functions in main
+typeof(null) bar(alias fn)(A a) { fn(a); return bar!fn(B.init); }
+typeof(null) bar(alias fn)(B b) {        return bar!fn(C.init); }
+typeof(null) bar(alias fn)(C c) {        return bar!fn(A.init); }
+
+void main()
+{
+    A a;
+    foo!((stuff){ new A(a); })(a);
+    bar!((stuff){ new A(a); })(a);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9672.d b/gcc/testsuite/gdc.test/compilable/test9672.d
new file mode 100644
index 00000000000..bb10e3a33f4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9672.d
@@ -0,0 +1,7 @@
+module test9672;            // node
+
+import imports.test9672a;   // interpret
+
+mixin template ForwardCtor()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test9692.d b/gcc/testsuite/gdc.test/compilable/test9692.d
new file mode 100644
index 00000000000..765b657c1de
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9692.d
@@ -0,0 +1,7 @@
+module test9692;
+
+import test9692a;
+import imports.test9692b;
+
+enum x = [__traits(allMembers, imports.test9692b)];  // ok
+enum y = [__traits(allMembers, test9692a)];  // ng: should work
diff --git a/gcc/testsuite/gdc.test/compilable/test9692a.d b/gcc/testsuite/gdc.test/compilable/test9692a.d
new file mode 100644
index 00000000000..6fd304b2d1a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9692a.d
@@ -0,0 +1,2 @@
+module test9692a;
+int j;
diff --git a/gcc/testsuite/gdc.test/compilable/test9766.d b/gcc/testsuite/gdc.test/compilable/test9766.d
new file mode 100644
index 00000000000..3cfc22f0464
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9766.d
@@ -0,0 +1,77 @@
+// PERMUTE_ARGS:
+
+size_t getAlign9766(size_t n) { return n; }
+
+struct S9766
+{
+align(getAlign9766(1)):
+    ubyte[5] pad1;
+    ubyte var1;
+
+align(getAlign9766(2)):
+    ubyte[5] pad2;
+    ubyte var2;
+
+align(getAlign9766(4)):
+    ubyte[5] pad3;
+    ubyte var3;
+
+align(getAlign9766(8)):
+    ubyte[5] pad4;
+    ubyte var4;
+}
+
+static assert(S9766.pad1.offsetof == 0);
+static assert(S9766.var1.offsetof == 5);
+
+static assert(S9766.pad2.offsetof == 6);
+static assert(S9766.var2.offsetof == 12);
+
+static assert(S9766.pad3.offsetof == 16);
+static assert(S9766.var3.offsetof == 24);
+
+static assert(S9766.pad4.offsetof == 32);
+static assert(S9766.var4.offsetof == 40);
+
+union U9766
+{
+    struct
+    {
+    align(getAlign9766(1)):
+        ubyte[5] pad1;
+        ubyte var1;
+
+    align(getAlign9766(2)):
+        ubyte[5] pad2;
+        ubyte var2;
+
+    align(getAlign9766(4)):
+        ubyte[5] pad3;
+        ubyte var3;
+
+    align(getAlign9766(8)):
+        ubyte[5] pad4;
+        ubyte var4;
+    }
+}
+
+static assert(U9766.pad1.offsetof == 0);
+static assert(U9766.var1.offsetof == 5);
+
+static assert(U9766.pad2.offsetof == 6);
+static assert(U9766.var2.offsetof == 12);
+
+static assert(U9766.pad3.offsetof == 16);
+static assert(U9766.var3.offsetof == 24);
+
+static assert(U9766.pad4.offsetof == 32);
+static assert(U9766.var4.offsetof == 40);
+
+struct TestMaxAlign
+{
+align(1u << 31):
+    ubyte a;
+    ubyte b;
+}
+
+static assert(TestMaxAlign.b.offsetof == 2147483648u);
diff --git a/gcc/testsuite/gdc.test/compilable/test9818.d b/gcc/testsuite/gdc.test/compilable/test9818.d
new file mode 100644
index 00000000000..779b1cf0fe6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9818.d
@@ -0,0 +1,76 @@
+/************************************/
+// 9818
+
+/*
+TEST_OUTPUT:
+---
+sa1: [1, 1, 1]
+ea1: [1, 1, 1]
+sa2: [1, 1, 1]
+ea2: [1, 1, 1]
+eas: [1, 1, 1]
+eac: [1, 1, 1]
+sa3: [1, 1, 1]
+ea3: [1, 1, 1]
+sa4: [1, 1, 1]
+ea4: [1, 1, 1]
+---
+*/
+
+static const int[3] sa1 = 1;
+pragma(msg, "sa1: ", sa1);          // doesn't work
+static assert(sa1 == [1, 1, 1]);    // doesn't work
+
+enum int[3] ea1 = 1;
+pragma(msg, "ea1: ", ea1);          // prints "1" - bad
+static assert(ea1 == [1, 1, 1]);    // doesn't work
+
+struct X
+{
+    static const int[3] sa2 = 1;
+    pragma(msg, "sa2: ", sa1);          // doesn't work
+    static assert(sa2 == [1, 1, 1]);    // doesn't work
+
+    enum int[3] ea2 = 1;
+    pragma(msg, "ea2: ", ea2);          // prints "1" - bad
+    static assert(ea2 == [1, 1, 1]);    // doesn't work
+}
+
+struct S
+{
+    enum int[3] eas = 1;
+}
+pragma(msg, "eas: ", S.eas);
+static assert(S.eas == [1, 1, 1]);
+class C
+{
+    enum int[3] eac = 1;
+}
+pragma(msg, "eac: ", C.eac);
+static assert(C.eac == [1, 1, 1]);
+
+void test()
+{
+    static const int[3] sa3 = 1;
+    pragma(msg, "sa3: ", sa3);          // doesn't work
+    static assert(sa3 == [1, 1, 1]);    // doesn't work
+
+    enum int[3] ea3 = 1;
+    pragma(msg, "ea3: ", ea3);          // prints "1" - bad
+    static assert(ea3 == [1, 1, 1]);    // doesn't work
+
+    struct Y
+    {
+        static const int[3] sa4 = 1;
+        pragma(msg, "sa4: ", sa4);          // doesn't work
+        static assert(sa4 == [1, 1, 1]);    // doesn't work
+
+        enum int[3] ea4 = 1;
+        pragma(msg, "ea4: ", ea4);          // prints "1" - bad
+        static assert(ea4 == [1, 1, 1]);    // doesn't work
+    }
+}
+
+/************************************/
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/test9919.d b/gcc/testsuite/gdc.test/compilable/test9919.d
new file mode 100644
index 00000000000..5cf8bc99cce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test9919.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -o-
+
+module test9919;
+
+public
+{
+    import imports.test9919a;
+    import imports.test9919b;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testDIP37.d b/gcc/testsuite/gdc.test/compilable/testDIP37.d
new file mode 100644
index 00000000000..22e7263ed94
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testDIP37.d
@@ -0,0 +1,36 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -c -Icompilable/extra-files
+
+void test1()
+{
+    import pkgDIP37.datetime;
+    def();
+    pkgDIP37.datetime.def();
+    pkgDIP37.datetime.common.def();
+}
+
+void test3()
+{
+    import pkgDIP37.datetime.common;
+    def();
+    pkgDIP37.datetime.def();
+    pkgDIP37.datetime.common.def();
+}
+
+void test4()
+{
+    import pkgDIP37.datetime : def;
+    def();
+    static assert(!__traits(compiles, pkgDIP37.datetime.def()));
+    static assert(!__traits(compiles, pkgDIP37.datetime.common.def()));
+}
+
+
+void test7()
+{
+    static import pkgDIP37.datetime;
+    static assert(!__traits(compiles, def()));
+    pkgDIP37.datetime.def();
+    pkgDIP37.datetime.common.def();
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/testDIP37_10302.d b/gcc/testsuite/gdc.test/compilable/testDIP37_10302.d
new file mode 100644
index 00000000000..76ae352e0d5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testDIP37_10302.d
@@ -0,0 +1,7 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -c -Icompilable/extra-files
+// EXTRA_SOURCES: extra-files/pkgDIP37_10302/liba.d extra-files/pkgDIP37_10302/libb.d
+
+module test;
+import pkgDIP37_10302;
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/testDIP37_10354.d b/gcc/testsuite/gdc.test/compilable/testDIP37_10354.d
new file mode 100644
index 00000000000..97b0f727958
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testDIP37_10354.d
@@ -0,0 +1,11 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -o- -Icompilable/extra-files
+
+module testDIP37_10354;
+import pkgDIP37_10354.mfoo;
+void main()
+{
+    import pkgDIP37_10354;
+    foo!string();   // OK
+    bar!string();   // OK <- ICE
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testDIP37_10421.d b/gcc/testsuite/gdc.test/compilable/testDIP37_10421.d
new file mode 100644
index 00000000000..9c24e45cd99
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testDIP37_10421.d
@@ -0,0 +1,9 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -c -Icompilable/extra-files
+// EXTRA_SOURCES: extra-files/pkgDIP37_10421/algo/package.d
+// EXTRA_SOURCES: extra-files/pkgDIP37_10421/algo/mod.d
+// EXTRA_SOURCES: extra-files/pkgDIP37_10421/except.d
+
+module testDIP37_10421;
+import pkgDIP37_10421.algo;
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/testDIP37a.d b/gcc/testsuite/gdc.test/compilable/testDIP37a.d
new file mode 100644
index 00000000000..8bd8b2d3397
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testDIP37a.d
@@ -0,0 +1,8 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -c -Icompilable/extra-files
+// EXTRA_SOURCES: extra-files/pkgDIP37/datetime/package.d
+// EXTRA_SOURCES: extra-files/pkgDIP37/datetime/common.d
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testDIP42.d b/gcc/testsuite/gdc.test/compilable/testDIP42.d
new file mode 100644
index 00000000000..7bb154619eb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testDIP42.d
@@ -0,0 +1,97 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+// enum ident(tpl) = Initializer;
+
+enum isIntegral(T) = is(T == int) || is(T == long);
+static assert( isIntegral!int);
+static assert( isIntegral!long);
+static assert(!isIntegral!double);
+static assert(!isIntegral!(int[]));
+
+version(none)
+{
+enum
+    allSatisfy(alias pred, TL...) =
+        TL.length == 0 || (pred!(TL[0]) && allSatisfy!(pred, TL[1..$])),
+    anySatisfy(alias pred, TL...) =
+        TL.length != 0 && (pred!(TL[0]) || anySatisfy!(pred, TL[1..$])) || false;
+static assert( allSatisfy!(isIntegral, int, long));
+static assert(!allSatisfy!(isIntegral, int, double));
+static assert( anySatisfy!(isIntegral, int, double));
+static assert(!anySatisfy!(isIntegral, int[], double));
+}
+
+void test1()
+{
+    // statement
+    enum isIntegral2(T) = is(T == int) || is(T == long);
+    static assert(isIntegral2!int);
+}
+
+/******************************************/
+// alias ident(tpl) = Type;
+
+alias TypeTuple(TL...) = TL;
+static assert(is(TypeTuple!(int, long)[0] == int));
+static assert(is(TypeTuple!(int, long)[1] == long));
+
+alias Id(T) = T, Id(alias A) = A;
+static assert(is(Id!int == int));
+static assert(__traits(isSame, Id!TypeTuple, TypeTuple));
+
+void test2()
+{
+    // statement
+    alias TypeTuple2(TL...) = TL;
+    static assert(is(TypeTuple2!(int, long)[0] == int));
+    static assert(is(TypeTuple2!(int, long)[1] == long));
+
+    alias IdT(T) = T, IdA(alias A) = A;
+    static assert(is(IdT!int == int));
+    static assert(__traits(isSame, IdA!TypeTuple, TypeTuple));
+}
+
+/******************************************/
+// template auto declaration
+
+auto tynameLen(T) = T.stringof.length;
+
+void test3()
+{
+    assert(tynameLen!int == 3);
+    assert(tynameLen!long == 4);
+    tynameLen!int = 4;
+    tynameLen!long = 5;
+    assert(tynameLen!int == 4);
+    assert(tynameLen!long == 5);
+
+    // statement
+    auto tynameLen2(T) = T.stringof.length;
+
+    assert(tynameLen2!int == 3);
+    assert(tynameLen2!long == 4);
+    tynameLen2!int = 4;
+    tynameLen2!long = 5;
+    assert(tynameLen2!int == 4);
+    assert(tynameLen2!long == 5);
+}
+
+/******************************************/
+// template variable declaration
+
+static T math_pi(T) = cast(T)3.1415;
+
+enum bool isFloatingPoint(T) = is(T == float) || is(T == double);
+static assert( isFloatingPoint!double);
+static assert(!isFloatingPoint!string);
+
+void main()
+{
+    assert(math_pi!int == 3);
+    assert(math_pi!double == 3.1415);
+
+    enum bool isFloatingPoint2(T) = is(T == float) || is(T == double);
+    static assert( isFloatingPoint2!double);
+    static assert(!isFloatingPoint2!string);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testInference.d b/gcc/testsuite/gdc.test/compilable/testInference.d
new file mode 100644
index 00000000000..2209fa88ef3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testInference.d
@@ -0,0 +1,817 @@
+
+/***************************************************/
+// 6265.
+
+pure nothrow @safe int h6265() {
+    return 1;
+}
+int f6265a(alias g)() {
+    return g();
+}
+pure nothrow @safe int i6265a() {
+    return f6265a!h6265();
+}
+
+int f6265b()() {
+    return h6265();
+}
+pure nothrow @safe int i6265b() {
+    return f6265b();
+}
+
+pure nothrow @safe int i6265c() {
+    return {
+        return h6265();
+    }();
+}
+
+/***************************************************/
+// Make sure a function is not infered as pure if it isn't.
+
+int fNPa() {
+    return 1;
+}
+int gNPa()() {
+    return fNPa();
+}
+static assert( __traits(compiles, function int ()         { return gNPa(); }));
+static assert(!__traits(compiles, function int () pure    { return gNPa(); }));
+static assert(!__traits(compiles, function int () nothrow { return gNPa(); }));
+static assert(!__traits(compiles, function int () @safe   { return gNPa(); }));
+
+/***************************************************/
+// Need to ensure the comment in Expression::checkPurity is not violated.
+
+void fECPa() {
+    void g()() {
+        void h() {
+        }
+        h();
+    }
+    static assert( is(typeof(&g!()) == void delegate() pure nothrow @nogc @safe));
+    static assert(!is(typeof(&g!()) == void delegate()));
+}
+
+void fECPb() {
+    void g()() {
+        void h() {
+        }
+        fECPb();
+    }
+    static assert(!is(typeof(&g!()) == void delegate() pure));
+    static assert( is(typeof(&g!()) == void delegate()));
+}
+
+/***************************************************/
+// 5635
+
+pure bool foo5635(R = int)(string x)
+{
+    bool result = false;
+    foreach (dchar d; x)
+        result = true;
+    return result;
+}
+
+void test5635()
+{
+    foo5635("hi");
+}
+
+/***************************************************/
+// 5936
+
+auto bug5936c(R)(R i) @safe pure nothrow {
+    return true;
+}
+static assert( bug5936c(0) );
+
+/***************************************************/
+// 6351
+
+void bug6351(alias dg)()
+{
+    dg();
+}
+
+void test6351()
+{
+    void delegate(int[] a...) deleg6351 = (int[] a...){};
+    alias bug6351!(deleg6351) baz6531;
+}
+
+/***************************************************/
+// 6359
+
+void    impure6359()      nothrow @safe @nogc {}
+void throwable6359() pure         @safe @nogc {}
+void    system6359() pure nothrow       @nogc {}
+void    gcable6359() pure nothrow @safe       {}
+
+int global6359;
+
+void f6359() pure nothrow @safe @nogc
+{
+    static assert(!__traits(compiles,    impure6359()));
+    static assert(!__traits(compiles, throwable6359()));
+    static assert(!__traits(compiles,    system6359()));
+    static assert(!__traits(compiles,    gcable6359()));
+    static assert(!__traits(compiles,    global6359++));
+
+    static assert(!__traits(compiles, {    impure6359(); }()));
+    static assert(!__traits(compiles, { throwable6359(); }()));
+    static assert(!__traits(compiles, {    system6359(); }()));
+    static assert(!__traits(compiles, {    gcable6359(); }()));
+    static assert(!__traits(compiles, {    global6359++; }()));
+}
+
+void g6359()() pure nothrow @safe @nogc
+{
+    static assert(!__traits(compiles,    impure6359()));
+    static assert(!__traits(compiles, throwable6359()));
+    static assert(!__traits(compiles,    system6359()));
+    static assert(!__traits(compiles,    gcable6359()));
+    static assert(!__traits(compiles,    global6359++));
+
+    static assert(!__traits(compiles, {    impure6359(); }()));
+    static assert(!__traits(compiles, { throwable6359(); }()));
+    static assert(!__traits(compiles, {    system6359(); }()));
+    static assert(!__traits(compiles, {    gcable6359(); }()));
+    static assert(!__traits(compiles, {    global6359++; }()));
+}
+
+// attribute inference is not affected by the expressions inside __traits(compiles)
+void h6359()()
+{
+    static assert( __traits(compiles,    impure6359()));
+    static assert( __traits(compiles, throwable6359()));
+    static assert( __traits(compiles,    system6359()));
+    static assert( __traits(compiles,    gcable6359()));
+    static assert( __traits(compiles,    global6359++));
+
+    static assert( __traits(compiles, {    impure6359(); }()));
+    static assert( __traits(compiles, { throwable6359(); }()));
+    static assert( __traits(compiles, {    system6359(); }()));
+    static assert( __traits(compiles, {    gcable6359(); }()));
+    static assert( __traits(compiles, {    global6359++; }()));
+}
+
+void test6359() pure nothrow @safe @nogc
+{
+    f6359();
+    g6359();
+    h6359();
+}
+
+/***************************************************/
+// 7017
+
+template map7017(fun...) if (fun.length >= 1)
+{
+    auto map7017()
+    {
+        struct Result {
+            this(int dummy){}   // impure member function -> inferred to pure by fixing issue 10329
+        }
+        return Result(0);   // impure call -> inferred to pure by fixing issue 10329
+    }
+}
+
+int foo7017(immutable int x) pure nothrow { return 1; }
+
+void test7017a() pure
+{
+    int bar7017(immutable int x) pure nothrow { return 1; }
+
+    static assert(__traits(compiles, map7017!((){})()));
+    static assert(__traits(compiles, map7017!q{ 1 }()));
+    static assert(__traits(compiles, map7017!foo7017()));
+    static assert(__traits(compiles, map7017!bar7017()));
+}
+
+/***************************************************/
+// 7017 (little simpler cases)
+
+auto map7017a(alias fun)() { return fun();     }    // depends on purity of fun
+auto map7017b(alias fun)() { return;           }    // always pure
+auto map7017c(alias fun)() { return yyy7017(); }    // always impure
+
+int xxx7017() pure { return 1; }
+int yyy7017() { return 1; }
+
+void test7017b() pure
+{
+    static assert( __traits(compiles, map7017a!xxx7017() ));
+    static assert(!__traits(compiles, map7017a!yyy7017() ));
+
+    static assert( __traits(compiles, map7017b!xxx7017() ));
+    static assert( __traits(compiles, map7017b!yyy7017() ));
+
+    static assert(!__traits(compiles, map7017c!xxx7017() ));
+    static assert(!__traits(compiles, map7017c!yyy7017() ));
+}
+
+/***************************************************/
+// Test case from std.process
+
+auto escapeArgumentImpl(alias allocator)()
+{
+    return allocator();
+}
+
+auto escapeShellArgument(alias allocator)()
+{
+    return escapeArgumentImpl!allocator();
+}
+
+pure string escapeShellArguments()
+{
+    char[] allocator()
+    {
+        return new char[1];
+    }
+
+    /* Both escape!allocator and escapeImpl!allocator are impure,
+     * but they are nested template function that instantiated here.
+     * Then calling them from here doesn't break purity.
+     */
+    return escapeShellArgument!allocator();
+}
+
+/***************************************************/
+// 8234
+
+void test8234()
+{
+    immutable int x = 0;
+
+    alias FP = typeof({ enum e = x; return e; });
+    static assert(is(FP : int function()));
+
+    auto fp = { enum e = x; return e; };
+    static assert(is(typeof(fp) : int function()));
+
+    alias DG = typeof({ auto e = x; return e; });
+    static assert(is(DG : int delegate()));
+
+    auto dg = { auto e = x; return e; };
+    static assert(is(typeof(dg) : int delegate()));
+}
+
+/***************************************************/
+// 8504
+
+void foo8504()()
+{
+    static assert(typeof(foo8504!()).stringof == "void()");
+    static assert(typeof(foo8504!()).mangleof == "FZv");
+    static assert(foo8504!().mangleof == "_D13testInference12__T7foo8504Z7foo8504FZv");
+}
+
+auto toDelegate8504a(F)(auto ref F fp) { return fp; }
+   F toDelegate8504b(F)(auto ref F fp) { return fp; }
+
+extern(C) void testC8504() {}
+
+void test8504()
+{
+    static assert(typeof(foo8504!()).stringof == "pure nothrow @nogc @safe void()");
+    static assert(typeof(foo8504!()).mangleof == "FNaNbNiNfZv");
+    static assert(foo8504!().mangleof == "_D13testInference12__T7foo8504Z7foo8504FNaNbNiNfZv");
+
+    auto fp1 = toDelegate8504a(&testC8504);
+    auto fp2 = toDelegate8504b(&testC8504);
+    static assert(is(typeof(fp1) == typeof(fp2)));
+    static assert(typeof(fp1).stringof == "extern (C) void function()");
+    static assert(typeof(fp2).stringof == "extern (C) void function()");
+    static assert(typeof(fp1).mangleof == "PUZv");
+    static assert(typeof(fp2).mangleof == "PUZv");
+}
+
+/***************************************************/
+// 8751
+
+alias bool delegate(in int) pure Bar8751;
+Bar8751 foo8751a(immutable int x) pure
+{
+    return y => x > y; // OK
+}
+Bar8751 foo8751b(const int x) pure
+{
+    return y => x > y; // error -> OK
+}
+
+/***************************************************/
+// 8793
+
+alias bool delegate(in int) pure Dg8793;
+alias bool function(in int) pure Fp8793;
+
+Dg8793 foo8793fp1(immutable Fp8793 f) pure { return x => (*f)(x); } // OK
+Dg8793 foo8793fp2(    const Fp8793 f) pure { return x => (*f)(x); } // OK
+
+Dg8793 foo8793dg1(immutable Dg8793 f) pure { return x => f(x); } // OK
+Dg8793 foo8793dg2(    const Dg8793 f) pure { return x => f(x); } // OK <- error
+
+Dg8793 foo8793pfp1(immutable Fp8793* f) pure { return x => (*f)(x); } // OK
+Dg8793 foo8793pdg1(immutable Dg8793* f) pure { return x => (*f)(x); } // OK
+
+Dg8793 foo8793pfp2(const Fp8793* f) pure { return x => (*f)(x); } // OK <- error
+Dg8793 foo8793pdg2(const Dg8793* f) pure { return x => (*f)(x); } // OK <- error
+
+// general case for the hasPointer type
+Dg8793 foo8793ptr1(immutable int* p) pure { return x => *p == x; } // OK
+
+Dg8793 foo8793ptr2(const int* p) pure { return x => *p == x; } // OK <- error
+
+/***************************************************/
+// 9072
+
+struct A9072(T)
+{
+    this(U)(U x) {}
+    ~this() {}
+}
+void test9072()
+{
+    A9072!int a = A9072!short();
+}
+
+/***************************************************/
+// 5933 + Issue 8504 - Template attribute inferrence doesn't work
+
+int foo5933()(int a) { return a*a; }
+struct S5933
+{
+    double foo()(double a) { return a * a; }
+}
+// outside function
+static assert(typeof(foo5933!()).stringof == "pure nothrow @nogc @safe int(int a)");
+static assert(typeof(S5933.init.foo!()).stringof == "pure nothrow @nogc @safe double(double a)");
+
+void test5933()
+{
+    // inside function
+    static assert(typeof(foo5933!()).stringof == "pure nothrow @nogc @safe int(int a)");
+    static assert(typeof(S5933.init.foo!()).stringof == "pure nothrow @nogc @safe double(double a)");
+}
+
+/***************************************************/
+// 9148
+
+void test9148a() pure
+{
+    static int g;
+    int x;
+
+    void foo1() /+pure+/
+    {
+        static assert(!__traits(compiles, g++));
+        x++;
+    }
+    void foo2() pure
+    {
+        static assert(!__traits(compiles, g++));
+        x++;
+    }
+    foo1();
+    static assert(is(typeof(&foo1) == void delegate() pure nothrow @nogc @safe));
+    foo2();
+    static assert(is(typeof(&foo2) == void delegate() pure nothrow @nogc @safe));
+
+    void bar1() immutable /+pure+/
+    {
+        static assert(!__traits(compiles, g++));
+        static assert(!__traits(compiles, x++));
+    }
+    void bar2() immutable pure
+    {
+        static assert(!__traits(compiles, g++));
+        static assert(!__traits(compiles, x++));
+    }
+    bar1();
+    static assert(is(typeof(&bar1) == void delegate() pure immutable nothrow @nogc @safe));
+    bar2();
+    static assert(is(typeof(&bar2) == void delegate() pure immutable nothrow @nogc @safe));
+
+    struct S
+    {
+        void foo1() /+pure+/
+        {
+            static assert(!__traits(compiles, g++));
+            x++;
+        }
+        void foo2() pure
+        {
+            static assert(!__traits(compiles, g++));
+            x++;
+        }
+        void bar1() immutable /+pure+/
+        {
+            static assert(!__traits(compiles, g++));
+            static assert(!__traits(compiles, x++));
+        }
+        void bar2() immutable pure
+        {
+            static assert(!__traits(compiles, g++));
+            static assert(!__traits(compiles, x++));
+        }
+    }
+
+    S sm;
+    sm.foo1();
+    static assert(is(typeof(&sm.foo1) == void delegate() pure));
+    sm.foo2();
+    static assert(is(typeof(&sm.foo2) == void delegate() pure));
+
+    immutable S si;
+    si.bar1();
+    static assert(is(typeof(&si.bar1) == void delegate() pure immutable));
+    si.bar2();
+    static assert(is(typeof(&si.bar2) == void delegate() pure immutable));
+}
+
+// ----
+// inheritance of pure and @safe
+
+void test9148b() pure nothrow @nogc @safe
+{
+    void nf() {}
+    static assert(is(typeof(&nf) == void delegate() pure nothrow @nogc @safe));
+
+    struct NS
+    {
+        void mf() {}
+        static void sf() {}
+    }
+    NS ns;
+    static assert(is(typeof(&ns.mf) == void delegate() pure nothrow @nogc @safe));
+    static assert(is(typeof(&NS.sf) == void function() pure nothrow @nogc @safe));
+
+    static void sf() {}
+    static assert(is(typeof(&sf) == void function() pure nothrow @nogc @safe));
+
+    static struct SS
+    {
+        void mf() {}
+        static void sf() {}
+    }
+    SS ss;
+    static assert(is(typeof(&ss.mf) == void delegate() pure nothrow @nogc @safe));
+    static assert(is(typeof(&SS.sf) == void function() pure nothrow @nogc @safe));
+}
+
+void impureSystem9148b() {}
+void func9148b()()
+{
+    void bar()  // do not inherit PUREfwdref
+    {
+        static assert(is(typeof(&bar) == void delegate()));
+        impureSystem9148b();
+    }
+    static assert(is(typeof(&bar) == void delegate()));
+}
+static assert(is(typeof(&func9148b!()) == void function() pure nothrow @nogc @safe));
+
+// ----
+// from fail_compilation/fail283.d
+
+pure int double_sqr9148c(int x)
+{
+    int y = x;
+    void do_sqr() pure { y *= y; }
+    do_sqr();
+    return y;
+}
+
+void test9148c()
+{
+    assert(double_sqr9148c(10) == 100);
+}
+
+// ----
+// from fail_compilation/fail348.d
+
+void test9148d() pure
+{
+    void g()    // implicitly marked as 'pure'
+    {
+        void h() pure
+        {
+            // i() and j() are implicitly marked as 'pure'
+            void i() { }
+            void j() { i(); g(); }  // can call i() and g()
+        }
+    }
+}
+
+void test9148e()
+{
+    int x;
+    static assert(is(typeof((int a){ return a + x; }) == int delegate(int) pure nothrow @nogc @safe));
+
+    auto dg = (int a){ return a + x; };
+    static assert(is(typeof(dg) == int delegate(int) pure nothrow @nogc @safe));
+}
+
+/***************************************************/
+// 12912
+
+struct S12912(alias fun)
+{
+    void f() { fun(); }
+}
+
+class C12912
+{
+    int n;
+
+    void f() pure
+    {
+        S12912!(() => n) s;
+        // Here lambda should be inferred to weak purity.
+
+        s.f();
+        // And this call will be a pure member function call.
+    }
+}
+
+/***************************************************/
+// 10002
+
+void impure10002() {}
+void remove10002(alias pred, bool impure = false, Range)(Range range)
+{
+    pred(range[0]);
+    static if (impure) impure10002();
+}
+class Node10002
+{
+    Node10002 parent;
+    Node10002[] children;
+
+    void foo() pure
+    {
+        parent.children.remove10002!(n => n is parent)();
+        remove10002!(n => n is parent)(parent.children);
+        static assert(!__traits(compiles, parent.children.remove10002x!(n => n is parent, true)()));
+        static assert(!__traits(compiles, remove10002x!(n => n is parent, true)(parent.children)));
+
+        Node10002 p;
+        p.children.remove10002!(n => n is p)();
+        remove10002!(n => n is p)(p.children);
+        static assert(!__traits(compiles, p.children.remove10002x!(n => n is p, true)()));
+        static assert(!__traits(compiles, remove10002x!(n => n is p, true)(p.children)));
+    }
+}
+
+/***************************************************/
+// 10148
+
+void fa10148() {}  // fa is @system
+
+auto fb10148(T)()
+{
+    struct A(S)
+    {
+        // [4] Parent function fb is already inferred to @safe, then
+        // fc is forcely marked @safe on default until 2.052.
+        // But fc should keep attribute inference ability
+        // by overriding the inherited @safe-ty from its parent.
+        void fc(T2)()
+        {
+            // [5] During semantic3 process, fc is not @safe on default.
+            static assert(is(typeof(&fc) == void delegate()));
+            fa10148();
+        }
+        // [1] this is now inferred to @safe by implementing issue 7511
+        this(S a) {}
+    }
+
+    // [2] A!int(0) is now calling @safe function, then fb!T also be inferred to @safe
+    return A!int(0);
+}
+
+void test10148()
+{
+    fb10148!int.fc!int;  // [0] instantiate fb
+                         // [3] instantiate fc
+
+    // [6] Afer semantic3 done, fc!int is deduced to @system.
+    static assert(is(typeof(&fb10148!int.fc!int) == void delegate() @system));
+}
+
+/***************************************************/
+// 10289
+
+void test10289()
+{
+    void foo(E)()
+    {
+        throw new E("");
+    }
+    void bar(E1, E2)()
+    {
+        throw new E1("");
+        throw new E2("");
+    }
+    void baz(E1, E2)(bool cond)
+    {
+        if (cond)
+            throw new E1("");
+        else
+            throw new E2("");
+    }
+
+    import core.exception;
+    static class MyException : Exception
+    {
+        this(string) @safe pure nothrow { super(""); }
+    }
+
+    static assert( __traits(compiles, () nothrow { foo!Error(); }));
+    static assert( __traits(compiles, () nothrow { foo!AssertError(); }));
+
+    static assert(!__traits(compiles, () nothrow { foo!Exception(); }));
+    static assert(!__traits(compiles, () nothrow { foo!MyException(); }));
+
+    static assert( __traits(compiles, () nothrow { bar!(Error, Exception)(); }));
+    static assert(!__traits(compiles, () nothrow { bar!(Exception, Error)(); }));
+
+    static assert(!__traits(compiles, () nothrow { baz!(Error, Exception)(); }));
+    static assert(!__traits(compiles, () nothrow { baz!(Exception, Error)(); }));
+}
+
+/***************************************************/
+// 10296
+
+void foo10296()()
+{
+    int[3] a;
+
+    void bar()() { a[1] = 2; }
+    bar();
+    pragma(msg, typeof(bar!()));    // nothrow @safe void()
+}
+pure void test10296()
+{
+    foo10296();
+}
+
+/***************************************************/
+// 12025
+
+struct Foo12025
+{
+    int[5] bar;
+}
+
+void test12025a() pure
+{
+    enum n1 = typeof(Foo12025.bar).length;  // OK
+    enum n2 =        Foo12025.bar .length;  // OK <- error
+
+    auto x1 = typeof(Foo12025.bar).length;  // OK
+    auto x2 =        Foo12025.bar .length;  // OK <- error
+}
+
+void test12025b() pure
+{
+    static int[5] bar;
+
+    enum n1 = typeof(bar).length;  // OK
+    enum n2 =        bar .length;  // OK <- error
+
+    auto x1 = typeof(bar).length;  // OK
+    auto x2 =        bar .length;  // OK <- error
+}
+
+/***************************************************/
+// 12542
+
+int logOf12542(T)(T n)
+{
+    if (n)
+        return 1 + logOf12542(n/2);
+    return 0;
+}
+
+void test12542() @safe nothrow pure
+{
+    int log = logOf12542(9);
+}
+
+/***************************************************/
+// 12704
+
+void foo12704() @system;
+alias FP12704 = typeof(function() { foo12704(); });
+static assert(is(FP12704 == void function() @system));
+
+/***************************************************/
+// 12970
+
+@system { @safe void f12970a() {} }
+@system { void f12970b() @safe {} }
+static assert(is(typeof(&f12970a) == void function() @safe));
+static assert(is(typeof(&f12970b) == void function() @safe));
+
+@system { @trusted void f12970c() {} }
+@system { void f12970d() @trusted {} }
+static assert(is(typeof(&f12970c) == void function() @trusted));
+static assert(is(typeof(&f12970d) == void function() @trusted));
+
+@safe { @system void f12970e() {} }
+@safe { void f12970f() @system {} }
+static assert(is(typeof(&f12970e) == void function() @system));
+static assert(is(typeof(&f12970f) == void function() @system));
+
+@safe { @trusted void f12970g() {} }
+@safe { void f12970h() @trusted {} }
+static assert(is(typeof(&f12970g) == void function() @trusted));
+static assert(is(typeof(&f12970h) == void function() @trusted));
+
+@trusted { @safe void f12970i() {} }
+@trusted { void f12970j() @safe {} }
+static assert(is(typeof(&f12970i) == void function() @safe));
+static assert(is(typeof(&f12970j) == void function() @safe));
+
+@trusted { @system void f12970k() {} }
+@trusted { void f12970l() @system {} }
+static assert(is(typeof(&f12970k) == void function() @system));
+static assert(is(typeof(&f12970l) == void function() @system));
+
+/***************************************************/
+// Parsing prefix STC_FUNCATTR for variable declaration
+
+__gshared immutable pure nothrow @property @nogc @safe void function() prefix_qualified_fp1;
+__gshared{immutable{pure{nothrow{@property{@nogc{@safe{void function() prefix_qualified_fp2;}}}}}}}
+static assert(typeof(prefix_qualified_fp1).stringof == typeof(prefix_qualified_fp2).stringof);
+static assert(typeof(prefix_qualified_fp1).stringof
+        == "immutable(void function() pure nothrow @nogc @property @safe)");
+
+const pure nothrow @property @nogc @safe void function()[] prefix_qualified_fp_array1;
+const{pure{nothrow{@property{@nogc{@safe{void function()[] prefix_qualified_fp_array2;}}}}}}
+static assert(typeof(prefix_qualified_fp_array1).stringof == typeof(prefix_qualified_fp_array2).stringof);
+static assert(typeof(prefix_qualified_fp_array1).stringof
+        == "const(void function() pure nothrow @nogc @property @safe[])");
+
+/***************************************************/
+// Parsing prefix, intermediate, or postfix @safe for alias declaration
+
+@safe alias void function() AliasDecl_FP1;
+alias @safe void function() AliasDecl_FP2;    // is not @safe
+alias void function() @safe AliasDecl_FP3;
+static assert(AliasDecl_FP1.stringof == "void function() @safe");
+static assert(AliasDecl_FP2.stringof == "void function()");
+static assert(AliasDecl_FP3.stringof == "void function() @safe");
+
+/***************************************************/
+// 13217
+
+void writeln13217(string) {}
+
+nothrow void a13217(T)(T x)
+{
+    try
+    {
+        () { writeln13217("a"); } ();
+    }
+    catch (Exception e) {}
+}
+
+void test13217()
+{
+    a13217(1);
+}
+
+/***************************************************/
+// 13840
+
+struct Foo13840
+{
+    int opApply(int delegate(int))
+    {
+        return 0;
+    }
+}
+
+void func13840()
+{
+}
+
+void test13840() nothrow
+{
+    try
+    {
+        foreach (i; Foo13840()) // generated delegate is throwable
+        {
+            func13840();        // throwable function call
+        }
+    }
+    catch
+    {}
+}
+
+// Add more tests regarding inferences later.
+
diff --git a/gcc/testsuite/gdc.test/compilable/testVRP.d b/gcc/testsuite/gdc.test/compilable/testVRP.d
new file mode 100644
index 00000000000..96a499fa4ac
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testVRP.d
@@ -0,0 +1,331 @@
+// PERMUTE_ARGS: -O -inline
+
+// Test value-range propagation.
+// See Bug 3147, Bug 6000, Bug 5225.
+
+void add() {
+    byte x, y;
+    short a = x + y;
+}
+
+void leftShift() {
+    byte x, y;
+    short z = x << 1;
+}
+
+void leftShiftFail() {
+    ubyte x, y;
+    ushort z;
+    static assert(!__traits(compiles, z = x << y));
+    // 1 << 31 surely overflows the range of 'ushort'.
+}
+
+void rightShiftFail() {
+    short x;
+    byte y, z;
+    static assert(!__traits(compiles, z = x >> y));
+    // [this passes in 2.053.]
+}
+
+void rightShift() {
+    ushort x;
+    ubyte y = x >> 16;
+}
+
+void unsignedRightShiftFail() {
+    int x;
+    ubyte y;
+    static assert(!__traits(compiles, y = x >>> 2));
+    // [this passes in 2.053.]
+}
+
+void subtract() {
+    ubyte x, y;
+    short z = x - y;
+}
+
+void multiply() {
+    byte x, y;
+    short z = x * y;
+}
+
+void subMulFail() {
+    ubyte x, y;
+    ubyte z;
+    static assert(!__traits(compiles, z = x - y));
+    static assert(!__traits(compiles, z = x * y));
+    // [these pass in 2.053.]
+}
+
+void multiplyNeg1() {
+    byte b;
+    b = -1 + (b * -1);
+    static assert(!__traits(compiles, b = -1 + b * ulong.max));
+}
+
+void divide() {
+    short w;
+    byte y = w / 300;
+}
+
+void divideFail() {
+    short w;
+    byte y;
+    static assert(!__traits(compiles, y = w / -1));
+}
+
+void plus1Fail() {
+    byte u, v;
+    static assert(!__traits(compiles, v = u + 1));
+    // [these pass in 2.053.]
+}
+
+void modulus() {
+    int x;
+    byte u = x % 128;
+}
+
+void modulus_bug6000a() {
+    ulong t;
+    uint u = t % 16;
+}
+
+void modulus_bug6000b() {
+    long n = 10520;
+    ubyte b;
+    static assert(!__traits(compiles, b = n % 10));
+}
+
+void modulus2() {
+    short s;
+    byte b = byte.max;
+    byte c = s % b;
+}
+
+void modulus3() {
+    int i;
+    short s = short.max;
+    short t = i % s;
+}
+
+void modulus4() {
+    uint i;
+    ushort s;
+    short t;
+    static assert(!__traits(compiles, t = i % s));
+}
+
+void modulusFail() {
+    int i;
+    short s;
+    byte b;
+    static assert(!__traits(compiles, b = i % s));
+    static assert(!__traits(compiles, b = i % 257));
+    // [these pass in 2.053.]
+}
+
+void bitwise() {
+    ubyte a, b, c;
+    uint d;
+    c = a & b;
+    c = a | b;
+    c = a ^ b;
+    c = d & 0xff;
+    // [these pass in 2.053.]
+}
+
+void bitAnd() {
+    byte c;
+    int d;
+    c = (0x3ff_ffffU << (0&c)) & (0x4000_0000U << (0&c));
+    // the result of the above is always 0 :).
+}
+
+void bitOrFail() {
+    ubyte c;
+    static assert(!__traits(compiles, c = c | 0x100));
+    // [this passes in 2.053.]
+}
+
+void bitAndOr() {
+    ubyte c;
+    c = (c | 0x1000) & ~0x1000;
+}
+
+void bitAndFail() {
+    int d;
+    short s;
+    byte c;
+    static assert(!__traits(compiles, c = d & s));
+    static assert(!__traits(compiles, c = d & 256));
+    // [these pass in 2.053.]
+}
+
+void bitXor() {
+    ushort s;
+    ubyte c;
+    c = (0xffff << (s&0)) ^ 0xff00;
+}
+
+void bitComplement() {
+    int i;
+    ubyte b = ~(i | ~0xff);
+}
+
+void bitComplementFail() {
+    ubyte b;
+    static assert(!__traits(compiles, b = ~(b | 1)));
+    // [this passes in 2.053.]
+}
+
+void negation() {
+    int x;
+    byte b = -(x & 0x7);
+}
+
+void negationFail() {
+    int x;
+    byte b;
+    static assert(!__traits(compiles, b = -(x & 255)));
+    // [this passes in 2.053.]
+}
+
+short bug5225(short a) {
+    return a>>1;
+}
+
+short bug1977_comment5(byte i) {
+  byte t = 1;
+  short o = t - i;
+  return o;
+}
+
+void testDchar() {
+    dchar d;
+    uint i;
+    /+
+    static assert(!__traits(compiles, d = i));
+    static assert(!__traits(compiles, d = i & 0x1fffff));
+    +/
+    d = i % 0x110000;
+}
+
+void bug1977_comment11() {
+    uint a;
+    byte b = a & 1;
+    // [this passes in 2.053.]
+}
+
+void bug1977_comment20() {
+    long a;
+    int b = a % 1000;
+}
+
+/******************************************/
+// 9617
+
+void test9617()
+{
+    void f1(int) {}
+    void f2(short) {}
+    void f3(byte) {}
+
+    // Why these calls are accepted?
+    static assert(!__traits(compiles, f1(ulong.max)));
+    static assert(!__traits(compiles, f2(ulong.max)));
+    static assert(!__traits(compiles, f3(ulong.max)));
+
+    // But, if argument is not constant value, compilation fails.
+    ulong x;
+    static assert(!__traits(compiles, f1(x)));  // is not callable using argument types (ulong)
+    static assert(!__traits(compiles, f2(x)));  // is not callable using argument types (ulong)
+    static assert(!__traits(compiles, f3(x)));  // is not callable using argument types (ulong)
+
+    void f4(uint) {}
+    void f5(ushort) {}
+    void f6(ubyte) {}
+
+    // If parameter type is unsigned, it is collectly rejected
+    static assert(!__traits(compiles, f4(ulong.max)));  // is not callable using argument types (ulong)
+    static assert(!__traits(compiles, f5(ulong.max)));  // is not callable using argument types (ulong)
+    static assert(!__traits(compiles, f6(ulong.max)));  // is not callable using argument types (ulong)
+}
+
+//import std.typetuple;
+template TypeTuple(T...) { alias TypeTuple = T; }
+template staticIota(size_t end)
+{
+    static if (0 < end)
+        alias staticIota = TypeTuple!(staticIota!(end - 1), end - 1);
+    else
+        alias staticIota = TypeTuple!();
+}
+void test9617a()
+{
+    alias Repr = TypeTuple!(
+        byte,   "127",      // T and literal representation of T.max
+        ubyte,  "255",
+        short,  "32767",
+        ushort, "65535",
+        int,    "2147483647",
+        uint,   "4294967295",
+        long,   "9223372036854775807",
+        ulong,  "18446744073709551615"  // "" or "L" -> "signed integral overflow"
+    );
+    alias Indices = staticIota!(Repr.length / 2);
+
+    foreach (t; Indices)
+    {
+        alias T = Repr[t * 2];
+        void func(T)(T) {}
+        alias func!T f;
+
+        foreach (r; Indices)
+        {
+            alias S = Repr[r * 2];
+            S src = S.max;
+
+            enum x = Repr[r * 2 + 1];
+            foreach (repr; TypeTuple!(S.stringof~".max", x~"", x~"U", x~"L", x~"LU"))
+            {
+                static if (S.sizeof != T.sizeof)
+                static if (is(typeof(mixin(repr)) R))
+                {
+                    // "Compilable" test should be equal, even if
+                    // the given argument is either constant or runtime variable.
+                    enum ct = __traits(compiles, f( mixin(repr) ));
+                    enum rt = __traits(compiles, f( src ));
+
+                    static assert(ct == rt);
+                    //import std.string;
+                    //enum msg = format("%6s.max to %-6s variable/constant = %d/%d, constant_repr = (%s) %s",
+                    //                    S.stringof, T.stringof, rt, ct, R.stringof, repr);
+                    //static if (ct != rt) pragma(msg, msg);
+                }
+            }
+        }
+    }
+}
+
+void test10018(ubyte value)
+{
+    const int c = value;
+    ubyte b = c;
+    static assert(!__traits(compiles, b = c - 1));
+    static assert(!__traits(compiles, b = c + 1));
+    immutable int i = value;
+    b = i;
+    static assert(!__traits(compiles, b = i - 1));
+    static assert(!__traits(compiles, b = i + 1));
+}
+
+void test13001(bool unknown)
+{
+    foreach (const i; 0..unknown?2:3)
+    {
+        ubyte b = i;
+        static assert(!__traits(compiles, b = i - 1));
+        b = i + 253;
+        static assert(!__traits(compiles, b = i + 254));
+    }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testcheckimports.d b/gcc/testsuite/gdc.test/compilable/testcheckimports.d
new file mode 100644
index 00000000000..328b8a9825b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testcheckimports.d
@@ -0,0 +1,33 @@
+// REQUIRED_ARGS: -transition=checkimports -de
+/*
+TEST_OUTPUT:
+---
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=15825
+
+template anySatisfy15825(T...)
+{
+    alias anySatisfy15825 = T[$ - 1];
+}
+
+alias T15825 = anySatisfy15825!(int);
+
+// https://issues.dlang.org/show_bug.cgi?id=15857
+
+template Mix15857(T)
+{
+    void foo15857(T) {}
+}
+mixin Mix15857!int;
+mixin Mix15857!string;
+
+// will find an overloadset on 2nd lookup w/ SearchImportsOnly set
+import imports.test15857a;
+
+void test15857()
+{
+    foo15857(1);
+    bar15857(1);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testexpression.d b/gcc/testsuite/gdc.test/compilable/testexpression.d
new file mode 100644
index 00000000000..352ee9267ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testexpression.d
@@ -0,0 +1,121 @@
+
+template TT(T...) { alias T TT; }
+
+void TestOpAssign(Tx, Ux, ops)()
+{
+    foreach(T; Tx.x)
+    foreach(U; Ux.x)
+    foreach(op; ops.x)
+    {
+        T a = cast(T)1;
+        mixin("a " ~ op ~ " cast(U)1;");
+    }
+}
+
+void TestOpAssignAssign(Tx, Ux, ops)()
+{
+    foreach(T; Tx.x)
+    foreach(U; Ux.x)
+    foreach(op; ops.x)
+    {
+        T a = cast(T)1;
+        U b = cast(U)1;
+        T r;
+        mixin("r = a " ~ op ~ " cast(U)1;");
+    }
+}
+
+void TestOpAssignAuto(Tx, Ux, ops)()
+{
+    foreach(T; Tx.x)
+    foreach(U; Ux.x)
+    static if (U.sizeof <= T.sizeof)
+    foreach(op; ops.x)
+    {
+        T a = cast(T)1;
+        U b = cast(U)1;
+        mixin("auto r = a " ~ op ~ " cast(U)1;");
+    }
+}
+
+void TestOpAndAssign(Tx, Ux, ops)()
+{
+    foreach(T; Tx.x)
+    foreach(U; Ux.x)
+    static if (U.sizeof <= T.sizeof && T.sizeof >= 4)
+    foreach(op; ops.x)
+    {
+        T a = cast(T)1;
+        U b = cast(U)1;
+        mixin("a = a " ~ op[0..$-1] ~ " cast(U)1;");
+    }
+}
+
+struct boolean   { alias TT!(bool) x; }
+struct integral  { alias TT!(byte, ubyte, short, ushort, int, uint, long, ulong) x; }
+struct floating  { alias TT!(float, double, real) x; }
+struct imaginary { alias TT!(ifloat, idouble, ireal) x; }
+struct complex   { alias TT!(cfloat, cdouble, creal) x; }
+
+struct all       { alias TT!("+=", "-=", "*=", "/=", "%=", "&=", "|=", "^=", "<<=", ">>=", ">>>=") x; }
+struct arith     { alias TT!("+=", "-=", "*=", "/=", "%=") x; }
+struct bitwise   { alias TT!("&=", "|=", "^=") x; }
+struct shift     { alias TT!("<<=", ">>=", ">>>=") x; }
+struct addsub    { alias TT!("+=", "-=") x; }
+struct muldivmod { alias TT!("*=", "/=", "%=") x; }
+struct nomod     { alias TT!("+=", "-=", "*=", "/=") x; }
+
+void OpAssignCases(alias X)()
+{
+    X!(boolean, boolean, bitwise)();
+
+    X!(integral, boolean, all)();
+    X!(integral, integral, all)();
+    X!(integral, floating, arith)();
+
+    X!(floating, boolean, arith)();
+    X!(floating, integral, arith)();
+    X!(floating, floating, arith)();
+
+    X!(imaginary, boolean, muldivmod)();
+    X!(imaginary, integral, muldivmod)();
+    X!(imaginary, floating, muldivmod)();
+    X!(imaginary, imaginary, addsub)();
+
+    X!(complex, boolean, arith)();
+    X!(complex, integral, arith)();
+    X!(complex, floating, arith)();
+    X!(complex, imaginary, arith)();
+    X!(complex, complex, nomod)();
+}
+
+void OpReAssignCases(alias X)()
+{
+    X!(boolean, boolean, bitwise)();
+
+    X!(integral, boolean, all)();
+    X!(integral, integral, all)();
+
+    X!(floating, boolean, arith)();
+    X!(floating, integral, arith)();
+    X!(floating, floating, arith)();
+
+    X!(imaginary, boolean, muldivmod)();
+    X!(imaginary, integral, muldivmod)();
+    X!(imaginary, floating, muldivmod)();
+    X!(imaginary, imaginary, addsub)();
+
+    X!(complex, boolean, arith)();
+    X!(complex, integral, arith)();
+    X!(complex, floating, arith)();
+    X!(complex, imaginary, arith)();
+    X!(complex, complex, nomod)();
+}
+
+void main()
+{
+    OpAssignCases!TestOpAssign();
+    //OpAssignCases!TestOpAssignAssign(); // disabled due to bug 7436
+    //OpAssignCases!TestOpAssignAuto(); // 5181
+    OpReAssignCases!TestOpAndAssign();
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testfptr.d b/gcc/testsuite/gdc.test/compilable/testfptr.d
new file mode 100644
index 00000000000..e6a0dd670df
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testfptr.d
@@ -0,0 +1,423 @@
+// PERMUTE_ARGS:
+
+ref int frvv();
+class A {}
+class B : A {}
+
+B restrictedfunc(in const(int)) @safe pure nothrow;
+A relaxedfunc(in int);
+
+void bug3797()
+{
+    // Cannot convert if the return type or parameters are different
+
+    void function() vv;
+    void function(int) vi;
+    int function() iv;
+    const(int) function() cv;
+    immutable(int) function() xv;
+
+    static assert( is(typeof( vv = vv )));
+    static assert(!is(typeof( vv = vi )));
+    static assert(!is(typeof( vv = iv )));
+    static assert(!is(typeof( vv = cv )));
+    static assert(!is(typeof( vv = xv )));
+
+    static assert(!is(typeof( vi = vv )));
+    static assert( is(typeof( vi = vi )));
+    static assert(!is(typeof( vi = iv )));
+    static assert(!is(typeof( vi = cv )));
+    static assert(!is(typeof( vi = cx )));
+
+    static assert(!is(typeof( iv = vv )));
+    static assert(!is(typeof( iv = vi )));
+    static assert( is(typeof( iv = iv )));
+    static assert( is(typeof( iv = cv )));
+    static assert( is(typeof( iv = xv )));
+
+    static assert(!is(typeof( cv = vv )));
+    static assert( is(typeof( cv = iv )));
+    static assert(!is(typeof( cv = vi )));
+    static assert( is(typeof( cv = cv )));
+    static assert( is(typeof( cv = xv )));
+
+    static assert(!is(typeof( xv = vv )));
+    static assert( is(typeof( xv = iv )));
+    static assert(!is(typeof( xv = vi )));
+    static assert( is(typeof( xv = cv )));
+    static assert( is(typeof( xv = xv )));
+
+    int* function() ipfunc;
+    const(int*) function() cipfunc;
+
+    static assert( is(typeof( cipfunc = ipfunc )) );
+    static assert(!is(typeof( ipfunc = cipfunc )) );
+
+    // functions with different linkages can't convert
+
+    extern(C) void function() cfunc;
+    extern(D) void function() dfunc;
+
+    static assert(!is(typeof( cfunc = dfunc )));
+    static assert(!is(typeof( dfunc = cfunc )));
+
+    // ref return can't convert to non-ref return
+
+    typeof(&frvv) rvv;
+
+    static assert(!is(typeof( rvv = iv )));
+    static assert(!is(typeof( rvv = cv )));
+
+    static assert(!is(typeof( iv = rvv )));
+    static assert(!is(typeof( cv = rvv )));
+
+    // variadic functions don't mix
+
+    void function(...) vf;
+
+    static assert(!is(typeof( vf = vv )));
+    static assert(!is(typeof( vv = vf )));
+
+    // non-nothrow -> nothrow
+
+    void function() nothrow ntf;
+
+    static assert(!is(typeof( ntf = vv )));
+    static assert( is(typeof( vv = ntf )));
+
+    // @safe <-> @trusted -> @system
+
+    void function() @system systemfunc;
+    void function() @trusted trustedfunc;
+    void function() @safe safefunc;
+
+    static assert( is(typeof( trustedfunc = safefunc )));
+    static assert( is(typeof( systemfunc = trustedfunc )));
+    static assert( is(typeof( systemfunc = safefunc )));
+    static assert( is(typeof( safefunc = trustedfunc )));
+
+    static assert(!is(typeof( trustedfunc = systemfunc )));
+    static assert(!is(typeof( safefunc = systemfunc )));
+
+    // pure -> non-pure
+
+    void function() nonpurefunc;
+    void function() pure purefunc;
+
+    static assert(!is(typeof( purefunc = nonpurefunc )));
+    static assert( is(typeof( nonpurefunc = purefunc )));
+
+    // Cannot convert parameter storage classes (except const to in and in to const)
+
+    void function(const(int)) constfunc;
+    void function(in int) infunc;
+    void function(out int) outfunc;
+    void function(ref int) reffunc;
+    void function(lazy int) lazyfunc;
+
+    static assert(is(typeof( infunc = constfunc )));
+    static assert(is(typeof( constfunc = infunc )));
+
+    static assert(!is(typeof( infunc = outfunc )));
+    static assert(!is(typeof( infunc = reffunc )));
+    static assert(!is(typeof( infunc = lazyfunc )));
+
+    static assert(!is(typeof( outfunc = infunc )));
+    static assert(!is(typeof( outfunc = reffunc )));
+    static assert(!is(typeof( outfunc = lazyfunc )));
+
+    static assert(!is(typeof( reffunc = infunc )));
+    static assert(!is(typeof( reffunc = outfunc )));
+    static assert(!is(typeof( reffunc = lazyfunc )));
+
+    static assert(!is(typeof( lazyfunc = infunc )));
+    static assert(!is(typeof( lazyfunc = outfunc )));
+    static assert(!is(typeof( lazyfunc = reffunc )));
+
+    // Test class covariance
+
+    A function() afunc;
+    B function() bfunc;
+
+    static assert( is(typeof( afunc = bfunc )));
+    static assert(!is(typeof( bfunc = afunc )));
+
+    // Test all the conversions at once
+    typeof(&restrictedfunc) prestrictedfunc;
+    typeof(&relaxedfunc) prelaxedfunc = prestrictedfunc;
+}
+
+void bug3797dg()
+{
+    ref int frvv() { return *(new int); }
+    B restrictedfunc(in const(int)) @safe pure nothrow { return null; }
+    A relaxedfunc(in int) { return null; }
+    // Cannot convert if the return type or parameters are different
+
+    void delegate() vv;
+    void delegate(int) vi;
+    int delegate() iv;
+    const(int) delegate() cv;
+    immutable(int) delegate() xv;
+
+    static assert( is(typeof( vv = vv )));
+    static assert(!is(typeof( vv = vi )));
+    static assert(!is(typeof( vv = iv )));
+    static assert(!is(typeof( vv = cv )));
+    static assert(!is(typeof( vv = xv )));
+
+    static assert(!is(typeof( vi = vv )));
+    static assert( is(typeof( vi = vi )));
+    static assert(!is(typeof( vi = iv )));
+    static assert(!is(typeof( vi = cv )));
+    static assert(!is(typeof( vi = cx )));
+
+    static assert(!is(typeof( iv = vv )));
+    static assert(!is(typeof( iv = vi )));
+    static assert( is(typeof( iv = iv )));
+    static assert( is(typeof( iv = cv )));
+    static assert( is(typeof( iv = xv )));
+
+    static assert(!is(typeof( cv = vv )));
+    static assert( is(typeof( cv = iv )));
+    static assert(!is(typeof( cv = vi )));
+    static assert( is(typeof( cv = cv )));
+    static assert( is(typeof( cv = xv )));
+
+    static assert(!is(typeof( xv = vv )));
+    static assert( is(typeof( xv = iv )));
+    static assert(!is(typeof( xv = vi )));
+    static assert( is(typeof( xv = cv )));
+    static assert( is(typeof( xv = xv )));
+
+    int* delegate() ipfunc;
+    const(int*) delegate() cipfunc;
+
+    static assert( is(typeof( cipfunc = ipfunc )) );
+    static assert(!is(typeof( ipfunc = cipfunc )) );
+
+    // delegates with different linkages can't convert
+
+    extern(C) void delegate() cfunc;
+    extern(D) void delegate() dfunc;
+
+    static assert(!is(typeof( cfunc = dfunc )));
+    static assert(!is(typeof( dfunc = cfunc )));
+
+    // ref return can't convert to non-ref return
+
+    typeof(&frvv) rvv;
+
+    static assert(!is(typeof( rvv = iv )));
+    static assert(!is(typeof( rvv = cv )));
+
+    static assert(!is(typeof( iv = rvv )));
+    static assert(!is(typeof( cv = rvv )));
+
+    // variadic delegates don't mix
+
+    void delegate(...) vf;
+
+    static assert(!is(typeof( vf = vv )));
+    static assert(!is(typeof( vv = vf )));
+
+    // non-nothrow -> nothrow
+
+    void delegate() nothrow ntf;
+
+    static assert(!is(typeof( ntf = vv )));
+    static assert( is(typeof( vv = ntf )));
+
+    // @safe <-> @trusted -> @system
+
+    void delegate() @system systemfunc;
+    void delegate() @trusted trustedfunc;
+    void delegate() @safe safefunc;
+
+    static assert( is(typeof( trustedfunc = safefunc )));
+    static assert( is(typeof( systemfunc = trustedfunc )));
+    static assert( is(typeof( systemfunc = safefunc )));
+    static assert( is(typeof( safefunc = trustedfunc )));
+
+    static assert(!is(typeof( trustedfunc = systemfunc )));
+    static assert(!is(typeof( safefunc = systemfunc )));
+
+    // pure -> non-pure
+
+    void delegate() nonpurefunc;
+    void delegate() pure purefunc;
+
+    static assert(!is(typeof( purefunc = nonpurefunc )));
+    static assert( is(typeof( nonpurefunc = purefunc )));
+
+    // Cannot convert parameter storage classes (except const to in and in to const)
+
+    void delegate(const(int)) constfunc;
+    void delegate(in int) infunc;
+    void delegate(out int) outfunc;
+    void delegate(ref int) reffunc;
+    void delegate(lazy int) lazyfunc;
+
+    static assert(is(typeof( infunc = constfunc )));
+    static assert(is(typeof( constfunc = infunc )));
+
+    static assert(!is(typeof( infunc = outfunc )));
+    static assert(!is(typeof( infunc = reffunc )));
+    static assert(!is(typeof( infunc = lazyfunc )));
+
+    static assert(!is(typeof( outfunc = infunc )));
+    static assert(!is(typeof( outfunc = reffunc )));
+    static assert(!is(typeof( outfunc = lazyfunc )));
+
+    static assert(!is(typeof( reffunc = infunc )));
+    static assert(!is(typeof( reffunc = outfunc )));
+    static assert(!is(typeof( reffunc = lazyfunc )));
+
+    static assert(!is(typeof( lazyfunc = infunc )));
+    static assert(!is(typeof( lazyfunc = outfunc )));
+    static assert(!is(typeof( lazyfunc = reffunc )));
+
+    // Test class covariance
+
+    A delegate() afunc;
+    B delegate() bfunc;
+
+    static assert( is(typeof( afunc = bfunc )));
+    static assert(!is(typeof( bfunc = afunc )));
+
+    // Test all the conversions at once
+    typeof(&restrictedfunc) prestrictedfunc;
+    typeof(&relaxedfunc) prelaxedfunc = prestrictedfunc;
+}
+
+void bug3268()
+{
+    auto a = &bug3268;
+    const b = a;
+    assert(a == a);
+    assert(a == b);
+    assert(b == b);
+    immutable c = cast(immutable)a;
+    assert(a == c);
+    assert(b == c);
+    assert(c == c);
+
+    static assert(is(typeof(*a) == typeof(*b)));
+    static assert(is(typeof(*a) == typeof(*c)));
+}
+
+void bug3268dg()
+{
+    void bug3268x() {}
+    auto a = &bug3268x;
+    const b = a;
+    assert(a == a);
+    assert(a == b);
+    assert(b == b);
+    immutable c = cast(immutable)a;
+    assert(a == c);
+    assert(b == c);
+    assert(c == c);
+}
+
+void bug3833()
+{
+    bool b;
+
+    void function() func;
+    void function() pure purefunc;
+    void function() nothrow nothrowfunc;
+    void function() @safe safefunc;
+    void function() @trusted trustedfunc;
+
+    static assert( is(typeof( b ? func : purefunc )     == typeof( func )));
+    static assert( is(typeof( b ? func : nothrowfunc )  == typeof( func )));
+    static assert( is(typeof( b ? func : safefunc )     == typeof( func )));
+    static assert( is(typeof( b ? func : trustedfunc )  == typeof( func )));
+
+    static assert( is(typeof( b ? purefunc : nothrowfunc )  == typeof( func )));
+    static assert( is(typeof( b ? purefunc : safefunc )     == typeof( func )));
+    static assert( is(typeof( b ? purefunc : trustedfunc )  == typeof( func )));
+
+    static assert( is(typeof( b ? nothrowfunc : safefunc )      == typeof( func )));
+    static assert( is(typeof( b ? nothrowfunc : trustedfunc )   == typeof( func )));
+
+    static assert( is(typeof( b ? safefunc : trustedfunc )      == typeof( trustedfunc )));
+
+    auto arr = [func, purefunc, nothrowfunc, safefunc, trustedfunc];
+
+    static assert( is(typeof( arr ) == typeof(func)[]) );
+}
+
+void bug3833dg()
+{
+    bool b;
+
+    void delegate() func;
+    void delegate() pure purefunc;
+    void delegate() nothrow nothrowfunc;
+    void delegate() @safe safefunc;
+    void delegate() @trusted trustedfunc;
+
+    static assert( is(typeof( b ? func : purefunc )     == typeof( func )));
+    static assert( is(typeof( b ? func : nothrowfunc )  == typeof( func )));
+    static assert( is(typeof( b ? func : safefunc )     == typeof( func )));
+    static assert( is(typeof( b ? func : trustedfunc )  == typeof( func )));
+
+    static assert( is(typeof( b ? purefunc : nothrowfunc )  == typeof( func )));
+    static assert( is(typeof( b ? purefunc : safefunc )     == typeof( func )));
+    static assert( is(typeof( b ? purefunc : trustedfunc )  == typeof( func )));
+
+    static assert( is(typeof( b ? nothrowfunc : safefunc )      == typeof( func )));
+    static assert( is(typeof( b ? nothrowfunc : trustedfunc )   == typeof( func )));
+
+    static assert( is(typeof( b ? safefunc : trustedfunc )      == typeof( trustedfunc )));
+
+    auto arr = [func, purefunc, nothrowfunc, safefunc, trustedfunc];
+
+    static assert( is(typeof( arr ) == typeof(func)[]) );
+}
+
+void bug4838()
+{
+    void delegate() const dgc;
+    static assert(typeof(dgc).stringof == "void delegate() const");
+
+    void delegate() immutable dgi;
+    static assert(typeof(dgi).stringof == "void delegate() immutable");
+
+    void delegate() shared dgs;
+    static assert(typeof(dgs).stringof == "void delegate() shared");
+
+    void delegate() shared const dgsc;
+    static assert(typeof(dgsc).stringof == "void delegate() shared const");
+
+    void delegate() inout dgw;
+    static assert(typeof(dgw).stringof == "void delegate() inout");
+
+    void delegate() shared inout dgsw;
+    static assert(typeof(dgsw).stringof == "void delegate() shared inout");
+}
+
+void test8822()
+{
+    struct S { void foo() const {} }
+    S s;
+    void delegate() const dg = &s.foo;      // OK
+
+    void foo(void delegate() const dg){}    // OK
+
+    struct Foo(T) {}
+    alias Foo!(void delegate() const) X;    // NG -> OK
+}
+
+void main()
+{
+    static assert(is(typeof(&main) P : U*, U));
+    auto x = cast(void*)&main;
+
+    const void * p = &main;
+
+    __gshared void function() gp = null;
+    __gshared void delegate() gp2 = null;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testfwdref.d b/gcc/testsuite/gdc.test/compilable/testfwdref.d
new file mode 100644
index 00000000000..c79b21cb100
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testfwdref.d
@@ -0,0 +1,651 @@
+// PERMUTE_ARGS:
+
+/***************************************************/
+// 6766
+
+class Foo6766
+{
+    this(int x) { }
+    void test(Foo6766 foo = new Foo6766(1)) { }
+}
+
+struct Bar6766
+{
+    this(int x) { }
+    void test(Bar6766 bar = Bar6766(1)) { }
+}
+
+/***************************************************/
+// 8609
+
+struct Tuple8609(T)
+{
+    T arg;
+}
+
+// ----
+
+struct Foo8609a
+{
+    Bar8609a b;
+}
+struct Bar8609a
+{
+    int x;
+    Tuple8609!(Foo8609a) spam() { return Tuple8609!(Foo8609a)(); }
+}
+
+// ----
+
+struct Foo8609b
+{
+    Bar8609b b;
+}
+struct Bar8609b
+{
+    int x;
+    Tuple8609!(Foo8609b[1]) spam() { return Tuple8609!(Foo8609b[1])(); }
+}
+
+/***************************************************/
+// 8698
+
+interface IRoot8698a {}
+interface IClass8698a : IRoot8698a { }
+struct Struct8698a { }
+class Class8698a : IClass8698a { alias Struct8698a Value; }
+void test8698a(Class8698a.Value) { }
+//interface IRoot8698a {}
+
+// ----
+
+//interface IRoot8698b {}
+interface IClass8698b : IRoot8698b { }
+struct Struct8698b { }
+class Class8698b : IClass8698b { alias Struct8698b Value; }
+void test8698b(Class8698b.Value) { }
+interface IRoot8698b {}
+
+/***************************************************/
+// 9514
+
+template TStructHelpers9514a()
+{
+    void opEquals(Foo9514a)
+    {
+        auto n = FieldNames9514a!();
+    }
+}
+
+struct Foo9514a
+{
+    mixin TStructHelpers9514a!();
+}
+
+import imports.fwdref9514 : find9514;  // selective import without aliasing
+
+template FieldNames9514a()
+{
+    static if (find9514!`true`([1])) enum int FieldNames9514a = 1;
+}
+
+// ----
+
+template TStructHelpers9514b()
+{
+    void opEquals(Foo9514b)
+    {
+        auto n = FieldNames9514b!();
+    }
+}
+
+struct Foo9514b
+{
+    mixin TStructHelpers9514b!();
+}
+
+import imports.fwdref9514 : foo9514 = find9514;  // selective import with aliasing
+
+template FieldNames9514b()
+{
+    static if (foo9514!`true`([1])) enum int FieldNames9514b = 1;
+}
+
+/***************************************************/
+// 10015
+
+struct S10015(T) { alias X = int; }
+
+alias Y10015 = s10015.X;
+S10015!int s10015;
+
+/***************************************************/
+// 10101
+
+int front10101(int);
+
+mixin template reflectRange10101()
+{
+    static if (is(typeof(this.front10101)))
+    {
+        int x;
+    }
+}
+
+struct S10101(R)
+{
+    R r_;
+
+    typeof(r_.front10101) front10101() @property { return r_.front10101; }
+
+    mixin reflectRange10101;
+}
+
+void test10101()
+{
+    S10101!(int) s;
+}
+
+/***************************************************/
+// 11019
+
+class A11019
+{
+    A11019 View() { return null; }
+}
+
+class B11019 : A11019
+{
+    override D11019 View() { return null; }
+}
+
+class D11019 : B11019 {}
+
+/***************************************************/
+// 11166
+
+template Tup11166(T...) { alias Tup11166 = T; }
+
+struct S11166a
+{
+    enum S11166a a = S11166a(0);
+    enum S11166a b = S11166a(1);
+
+    this(long value) { }
+
+    long value;
+
+    // only triggered when private and a template instance.
+    private alias types = Tup11166!(a, b);
+}
+
+struct S11166b
+{
+    enum S11166b a = S11166b(0);
+    enum S11166b b = S11166b(1);
+
+    // not at the last of members
+    alias types = Tup11166!(a, b);
+
+    this(long value) { }
+
+    long value;
+}
+
+/***************************************************/
+// 12152
+
+class A12152
+{
+    alias Y = B12152.X;
+}
+
+class B12152 : A12152
+{
+    alias int X;
+}
+
+static assert(is(A12152.Y == int));
+
+/***************************************************/
+// 12201
+
+template T12201()
+{
+    alias imports.fwdref12201a.FILE* FP;
+}
+
+struct S12201a
+{
+    mixin T12201;
+    import imports.fwdref12201a;
+}
+
+union U12201
+{
+    mixin T12201;
+    import imports.fwdref12201a;
+}
+
+class C12201
+{
+    mixin T12201;
+    import imports.fwdref12201a;
+}
+
+interface I12201
+{
+    mixin T12201;
+    import imports.fwdref12201a;
+}
+
+
+template TI12201()
+{
+    mixin T12201;
+    import imports.fwdref12201a;
+}
+mixin template TM12201()
+{
+    mixin T12201;
+    import imports.fwdref12201a;
+}
+struct S12201b
+{
+    alias ti = TI12201!();
+
+    mixin TM12201;
+}
+
+/***************************************************/
+// 12531
+
+struct Node12531(T)
+{
+    T _val;
+}
+
+void test12531()
+{
+    static struct Foo
+    {
+        Node12531!Foo* node;
+    }
+}
+
+/***************************************************/
+// 12543
+
+class C12543;
+static assert(C12543.sizeof == (void*).sizeof);
+static assert(C12543.alignof == (void*).sizeof);
+static assert(C12543.mangleof == "C10testfwdref6C12543");
+
+/***************************************************/
+// 14010
+
+enum E14010;
+static assert(E14010.mangleof == "E10testfwdref6E14010");
+
+struct S14010;
+static assert(S14010.mangleof == "S10testfwdref6S14010");
+
+/***************************************************/
+// 12983
+
+alias I12983 = int;
+class B12983(T) { alias MyC = C12983!string; }
+
+class C12983(T) : B12983!float
+{
+    void m() { f12983(0); }
+}
+
+alias MyB12983 = B12983!float;
+
+void f12983();
+void f12983(I12983);
+
+/***************************************************/
+// 12984
+
+class B12984a { alias MyD = D12984a!int; }
+class C12984a : B12984a { }
+
+class D12984a(T) { alias MyE = E12984a!float; }
+class E12984a(T) : D12984a!int
+{
+    void m()
+    {
+        auto c = new C12984a();
+    }
+}
+
+static assert(__traits(classInstanceSize, B12984a) == (void*).sizeof * 2);
+static assert(__traits(classInstanceSize, C12984a) == (void*).sizeof * 2);
+
+// ----
+
+class B12984b { int b; alias MyD = D12984b!int; }
+class C12984b : B12984b { int c; }
+
+class D12984b(T) { int d; alias MyE = E12984b!float; }
+class E12984b(T) : D12984b!int
+{
+    int e;
+    void m()
+    {
+        auto c = new C12984b();
+    }
+}
+
+static assert(__traits(classInstanceSize, B12984b) == (void*).sizeof * 2 + int.sizeof);
+static assert(__traits(classInstanceSize, C12984b) == (void*).sizeof * 2 + int.sizeof * 2);
+
+/***************************************************/
+// 14390
+
+class B14390a { alias MyD = D14390a!int; }
+class C14390a : B14390a { void f(int) {} }
+class D14390a(T) { alias MyE = E14390a!float; }
+class E14390a(T) : D14390a!int { void m() { auto c = new C14390a(); } }
+
+class B14390b { alias MyD = D14390b!int; }
+class C14390b : B14390b { static struct S {} }
+class D14390b(T) { alias MyE = E14390b!float; }
+class E14390b(T) : D14390b!int { void m() { auto c = new C14390b(); } }
+
+/***************************************************/
+// 13860
+
+/*
+TEST_OUTPUT:
+---
+pure nothrow @nogc @safe void()
+pure nothrow @nogc @safe void()
+---
+*/
+
+struct Foo13860(Bar...)
+{
+    Bar bars;
+    auto baz(size_t d)() {}
+    pragma(msg, typeof(baz!0));
+}
+
+auto bar13860(S, R)(S s, R r)
+{
+    pragma(msg, typeof(Foo13860!().baz!0));
+}
+
+void test13860()
+{
+    int[] x;
+    int[] y;
+    x.bar13860(y);
+}
+
+/***************************************************/
+// 14083
+
+class NBase14083
+{
+    int foo(NA14083 a) { return 1; }
+    int foo(NB14083 a) { return 2; }
+}
+class NA14083 : NBase14083
+{
+    int v;
+    this(int v) { this.v = v; }
+}
+class NB14083 : NBase14083
+{
+    override int foo(NA14083 a) { return a.v; }
+}
+
+class TBase14083(T)
+{
+    int foo(TA14083!T a) { return 1; }
+    int foo(TB14083!T a) { return 2; }
+}
+class TA14083(T) : TBase14083!T
+{
+    T v;
+    this(T v) { this.v = v; }
+}
+class TB14083(T) : TBase14083!T
+{
+    override int foo(TA14083!T a) { return a.v; }
+}
+
+static assert(
+{
+    NA14083 na = new NA14083(10);
+    NB14083 nb = new NB14083();
+    assert(na.foo(na) == 1);
+    assert(na.foo(nb) == 2);
+    assert(nb.foo(na) == 10);
+
+    TA14083!int ta = new TA14083!int(10);
+    TB14083!int tb = new TB14083!int();
+    assert(ta.foo(ta) == 1);
+    assert(ta.foo(tb) == 2);
+    assert(tb.foo(ta) == 10);
+
+    return true;
+}());
+
+/***************************************************/
+// 14549
+
+string foo14549(T)()
+{
+    static if (T.tupleof.length >= 0)
+        return "";
+}
+
+class Frop14549
+{
+    mixin(foo14549!(typeof(this)));
+
+    static if (__traits(compiles, undefined))
+    {
+    }
+    else
+    {
+        int bar = 0;
+    }
+
+    static if (!__traits(isVirtualMethod, this.bar)) {}
+}
+
+// ----
+// regression case
+
+template Mix14549()
+{
+    mixin(code14549!(typeof(this)));
+}
+
+template code14549(T)
+{
+    enum string code14549 =
+        q{ static if (!__traits(isVirtualMethod, "boo")) {} };
+}
+
+class Bar14549
+{
+    mixin Mix14549;
+    int boo;
+}
+
+// ----
+// 14609 - regression case
+
+interface Foo14609(T)
+{
+    static if (is(T == int))
+        public int bar();
+}
+class Frop14609 : Foo14609!int
+{
+    public int bar() { return 0; }
+}
+
+/***************************************************/
+// test case 1, comes from Phobos
+/*
+TEST_OUTPUT:
+---
++alias Alias12540
++anySatisfy, T.length == 1
++isStaticArray
++T.stringof in StaticArrayTypeOf
+-T.stringof in StaticArrayTypeOf
+-isStaticArray
++hasElaborateCpCtor S == struct or else
+-hasElaborateCpCtor S == struct or else
+-anySatisfy, T.length == 1
+-alias Alias12540
+---
+*/
+
+template anySatisfy15726x(alias F, T...)
+{
+    //static if (T.length == 1)
+    //{
+        pragma(msg, "+anySatisfy, T.length == 1");
+        enum anySatisfy15726x = F!(T[0]);
+        pragma(msg, "-anySatisfy, T.length == 1");
+    //}
+}
+
+template StaticArrayTypeOf15726x(T)
+{
+    alias X = T;
+
+    static if (is(X : E[n], E, size_t n))
+    {
+        //alias StaticArrayTypeOf15726x = X;
+    }
+    else
+    {
+        pragma(msg, "+T.stringof in StaticArrayTypeOf");
+        // Fixed: T.stringof (T == Class12540) should not invoke
+        //        T.size() in ClassDeclaration.search().
+        static assert(0, T.stringof~" is not a static array type");
+        pragma(msg, "-T.stringof in StaticArrayTypeOf");
+    }
+}
+
+//enum bool isStaticArray(T) = is(StaticArrayTypeOf15726x!T);
+template isStaticArray15726x(T)
+{
+    pragma(msg, "+isStaticArray");
+    enum bool isStaticArray15726x = is(StaticArrayTypeOf15726x!T);
+    pragma(msg, "-isStaticArray");
+}
+
+template hasElaborateCpCtor15726x(S)
+{
+    static if (isStaticArray15726x!S && S.length)
+    {
+        //pragma(msg, "X+");
+        enum bool hasElaborateCpCtor15726x =
+            hasElaborateCpCtor15726x!(typeof(S.init[0]));
+        //pragma(msg, "X-");
+    }
+    else
+    {
+        pragma(msg, "+hasElaborateCpCtor S == struct or else");
+        static if (is(S == struct))
+        {
+            enum bool hasElaborateCpCtor15726x = true;
+            //enum hasElaborateCpCtor15726x = hasMember!(S, "__postblit")
+            //    || anySatisfy15726x!(.hasElaborateCpCtor15726x, FieldTypeTuple!S);
+        }
+        else
+        {
+            enum bool hasElaborateCpCtor15726x = false;
+        }
+        pragma(msg, "-hasElaborateCpCtor S == struct or else");
+    }
+}
+
+struct VariantN15726x(AllowedTypesParam...)
+{
+    alias AllowedTypes = AllowedTypesParam;
+
+    static if (!AllowedTypes.length ||
+               anySatisfy15726x!(hasElaborateCpCtor15726x, AllowedTypes))
+    {
+    }
+}
+
+template Algebraic15726x(T)
+{
+    alias Algebraic15726x = VariantN15726x!(T);
+}
+
+void test15726x()
+{
+    static struct DummyScope
+    {
+        pragma(msg, "+alias Alias12540");
+        alias Alias12540 = Algebraic15726x!Class12540;
+        pragma(msg, "-alias Alias12540");
+        static class Class12540
+        {
+            Alias12540 entity;
+        }
+    }
+}
+
+/***************************************************/
+// test case 2, comes from Phobos
+
+struct RefCounted15726y(T)
+{
+    struct RefCountedStore
+    {
+        struct Impl
+        {
+            T _payload;
+        }
+        Impl* _store;
+    }
+    RefCountedStore _refCounted;
+
+    this(this) {}
+
+    ~this()
+    {
+        _refCounted._store._payload.__xdtor();
+    }
+}
+
+struct RangeT15726y(A)
+{
+    A[1] _outer_;
+    alias RC = RangeT15726y!(const(A));
+}
+
+struct Array15726y(T)
+{
+    struct Payload
+    {
+        ~this();
+    }
+
+    alias Data = RefCounted15726y!(Payload);
+    Data _data;
+
+    alias Range = RangeT15726y!Array15726y;
+}
+
+void test15726y()
+{
+    alias Range = RangeT15726y!(Array15726y!int);
+    Range r;
+    r = r;  // opAssign
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testheader1.d b/gcc/testsuite/gdc.test/compilable/testheader1.d
new file mode 100644
index 00000000000..c46728d64c9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testheader1.d
@@ -0,0 +1,6 @@
+// EXTRA_SOURCES: extra-files/header1.d
+// REQUIRED_ARGS: -o- -unittest -H -Hf${RESULTS_DIR}/compilable/header1.di
+// PERMUTE_ARGS: -d -dw
+// POST_SCRIPT: compilable/extra-files/header-postscript.sh header1
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/testheader12567a.d b/gcc/testsuite/gdc.test/compilable/testheader12567a.d
new file mode 100644
index 00000000000..27c14756880
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testheader12567a.d
@@ -0,0 +1,7 @@
+// REQUIRED_ARGS: -o- -H -Hf${RESULTS_DIR}/compilable/header12567a.di
+// PERMUTE_ARGS:
+// POST_SCRIPT: compilable/extra-files/header-postscript.sh header12567a
+
+deprecated module header12567a;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/testheader12567b.d b/gcc/testsuite/gdc.test/compilable/testheader12567b.d
new file mode 100644
index 00000000000..93393c50928
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testheader12567b.d
@@ -0,0 +1,7 @@
+// REQUIRED_ARGS: -o- -H -Hf${RESULTS_DIR}/compilable/header12567b.di
+// PERMUTE_ARGS:
+// POST_SCRIPT: compilable/extra-files/header-postscript.sh header12567b
+
+deprecated("message") module header12567b;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/testheader1i.d b/gcc/testsuite/gdc.test/compilable/testheader1i.d
new file mode 100644
index 00000000000..98599925965
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testheader1i.d
@@ -0,0 +1,6 @@
+// EXTRA_SOURCES: extra-files/header1.d
+// REQUIRED_ARGS: -o- -H -Hf${RESULTS_DIR}/compilable/header1i.di -inline
+// PERMUTE_ARGS: -d -dw
+// POST_SCRIPT: compilable/extra-files/header-postscript.sh header1i
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/testheader2.d b/gcc/testsuite/gdc.test/compilable/testheader2.d
new file mode 100644
index 00000000000..003d56467a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testheader2.d
@@ -0,0 +1,6 @@
+// EXTRA_SOURCES: extra-files/header2.d
+// REQUIRED_ARGS: -o- -H -Hf${RESULTS_DIR}/compilable/header2.di
+// PERMUTE_ARGS:
+// POST_SCRIPT: compilable/extra-files/header-postscript.sh header2
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/testheader2i.d b/gcc/testsuite/gdc.test/compilable/testheader2i.d
new file mode 100644
index 00000000000..79662edd184
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testheader2i.d
@@ -0,0 +1,6 @@
+// EXTRA_SOURCES: extra-files/header2.d
+// REQUIRED_ARGS: -o- -H -Hf${RESULTS_DIR}/compilable/header2i.di -inline
+// PERMUTE_ARGS:
+// POST_SCRIPT: compilable/extra-files/header-postscript.sh header2i
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/testheaderudamodule.d b/gcc/testsuite/gdc.test/compilable/testheaderudamodule.d
new file mode 100644
index 00000000000..1a7d6506669
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testheaderudamodule.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -o- -H -Hf${RESULTS_DIR}/compilable/testheaderudamodule.di
+// PERMUTE_ARGS:
+// POST_SCRIPT: compilable/extra-files/header-postscript.sh testheaderudamodule
+
+@(1, UDA(2))
+module testheaderudamodule;
+
+struct UDA
+{
+    int a;
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/testimport12242.d b/gcc/testsuite/gdc.test/compilable/testimport12242.d
new file mode 100644
index 00000000000..1d1cccd0100
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testimport12242.d
@@ -0,0 +1,26 @@
+// PERMUTE_ARGS:
+
+module testimport12242;
+
+import imports.imp12242a;   // test         // stripA == OverloadSet
+import imports.imp12242a1;  // std.string   // stripA == template
+
+import imports.imp12242b1;  // std.string   // stripB == template
+import imports.imp12242b;   // test         // stripB == OverloadSet
+
+void main()
+{
+    static assert(stripA(" af ") == 1);
+    static assert(" af ".stripA() == 1);    // UFCS (1)
+    static assert(" af ".stripA == 1);      // UFCS (2)
+
+    static assert(stripB(" af ") == 1);
+    static assert(" af ".stripB() == 1);    // UFCS (1)
+    static assert(" af ".stripB == 1);      // UFCS (2)
+
+
+    static assert(foo!int   == 1);
+    static assert(foo!long  == 2);
+    static assert(foo!float == 3);
+    static assert(foo!real  == 4);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/testparse.d b/gcc/testsuite/gdc.test/compilable/testparse.d
new file mode 100644
index 00000000000..d6713ad40c2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testparse.d
@@ -0,0 +1,168 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -o-
+
+/***************************************************/
+// 6719
+
+pragma(msg, __traits(compiles, mixin("(const(A))[0..0]")));
+
+/***************************************************/
+// 9232
+
+struct Foo9232
+{
+    void bar(T)() {}
+    void baz() {}
+}
+
+void test9232()
+{
+    Foo9232 foo;
+    (foo).bar!int();   // OK <- Error: found '!' when expecting ';' following statement
+    ((foo)).bar!int(); // OK
+    foo.bar!int();     // OK
+    (foo).baz();       // OK
+}
+
+/***************************************************/
+// 9401
+
+struct S9401a
+{
+    ~this() nothrow pure @safe { }
+}
+
+struct S9401b
+{
+    @safe ~this() pure nothrow { }
+}
+
+void test9401() nothrow pure @safe
+{
+    S9401a s1;
+    S9401b s2;
+}
+
+/***************************************************/
+// 9649
+
+class Outer9649
+{
+    class Inner
+    {
+    }
+}
+
+void test9649()
+{
+    Outer9649 outer9649;
+    (outer9649).new Inner();
+}
+
+/***************************************************/
+// 9679
+
+void test9679(inout int = 0)
+{
+    if (        auto n = 1) { static assert(is(typeof(n) ==              int)); }
+    if (       const n = 1) { static assert(is(typeof(n) ==        const int)); }
+    if (   immutable n = 1) { static assert(is(typeof(n) ==    immutable int)); }
+    if (shared       n = 1) { static assert(is(typeof(n) == shared       int)); }
+    if (shared const n = 1) { static assert(is(typeof(n) == shared const int)); }
+    if (       inout n = 1) { static assert(is(typeof(n) ==        inout int)); }
+    if (shared inout n = 1) { static assert(is(typeof(n) == shared inout int)); }
+
+    if (       const int n = 1) { static assert(is(typeof(n) ==        const int)); }
+    if (   immutable int n = 1) { static assert(is(typeof(n) ==    immutable int)); }
+    if (shared       int n = 1) { static assert(is(typeof(n) == shared       int)); }
+    if (shared const int n = 1) { static assert(is(typeof(n) == shared const int)); }
+    if (       inout int n = 1) { static assert(is(typeof(n) ==        inout int)); }
+    if (shared inout int n = 1) { static assert(is(typeof(n) == shared inout int)); }
+
+    if (       const(int) n = 1) { static assert(is(typeof(n) ==        const int)); }
+    if (   immutable(int) n = 1) { static assert(is(typeof(n) ==    immutable int)); }
+    if (shared      (int) n = 1) { static assert(is(typeof(n) == shared       int)); }
+    if (shared const(int) n = 1) { static assert(is(typeof(n) == shared const int)); }
+    if (       inout(int) n = 1) { static assert(is(typeof(n) ==        inout int)); }
+    if (shared inout(int) n = 1) { static assert(is(typeof(n) == shared inout int)); }
+
+    if (immutable(int)[] n = [1]) { static assert(is(typeof(n) == immutable(int)[])); }
+}
+
+/***************************************************/
+// 9901
+
+template isGood9901(T)
+{
+    enum isGood9901 = true;
+}
+void test9901()
+{
+    string foo(R)(R data) if (isGood9901!R)
+    {
+        return "";
+    }
+    foo(1);
+}
+
+/***************************************************/
+// 10199
+
+void test10199()
+{
+    goto label;
+label:
+}
+
+/***************************************************/
+// 12460
+
+void f12460(T)()
+{
+    static if (is(T == int))
+    {
+        goto end;
+    }
+end:
+}
+
+void test12460()
+{
+    f12460!int();
+}
+
+/***************************************************/
+// 11689
+
+void test11689()
+{
+    deprecated void foo() {}
+}
+
+/***************************************************/
+// 11751
+
+static assert(is(float == typeof(0x0.1p1F)));
+
+/***************************************************/
+// 11957
+
+extern(C++) class C11957
+{
+    void x() {}
+}
+
+void test11957()
+{
+    extern(C++) class D : C11957
+    {
+        override void x() {}
+    }
+}
+
+/***************************************************/
+// 13049
+
+enum mangle13049(T) = T.mangleof;
+alias FP13049 = void function(scope int);                                       // OK
+static assert(mangle13049!FP13049 == mangle13049!(void function(scope int)));   // OK <- NG
diff --git a/gcc/testsuite/gdc.test/compilable/testpostblit.d b/gcc/testsuite/gdc.test/compilable/testpostblit.d
new file mode 100644
index 00000000000..60a0f4a1ce9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testpostblit.d
@@ -0,0 +1,17 @@
+struct Test1a
+{
+    this(this)
+    {
+    }
+}
+
+struct Test1b
+{
+    Test1a a;
+}
+
+struct Test1c
+{
+    const Test1b b;
+    @disable this(this);
+} 
diff --git a/gcc/testsuite/gdc.test/compilable/testprofile.d b/gcc/testsuite/gdc.test/compilable/testprofile.d
new file mode 100644
index 00000000000..2f7beebbe43
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/testprofile.d
@@ -0,0 +1,23 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -profile
+
+template LaLa(E...) {
+        class LaLa {
+                this() {
+
+                }
+        }
+}
+
+void main() {
+        // doesn't work
+        new LaLa!("lala", "lalalalala", "lala",
+                "lala", "lala", "lala", "lalalala",
+                "lala", "lala", "lala", "lalala",
+                "lala", "lala", "lala", "lala",
+                "lala", "lala", "lala", "lala",
+                "lala", "lala", "lala", "lala",
+                "lala", "lala", "lala", "lala");
+
+}
+
diff --git a/gcc/testsuite/gdc.test/compilable/udamodule1.d b/gcc/testsuite/gdc.test/compilable/udamodule1.d
new file mode 100644
index 00000000000..4631642afb3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/udamodule1.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS:
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+compilable/udamodule1.d(9): Deprecation: module imports.udamodule1 is deprecated - This module will be removed.
+---
+*/
+import imports.udamodule1;
+
+void main() { foo(); }
diff --git a/gcc/testsuite/gdc.test/compilable/udamodule2.d b/gcc/testsuite/gdc.test/compilable/udamodule2.d
new file mode 100644
index 00000000000..f2c0794e582
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/udamodule2.d
@@ -0,0 +1,5 @@
+import imports.udamodule2;
+import imports.udamodule2a;
+
+enum Attrib = __traits(getAttributes, imports.udamodule2);
+static assert(Attrib[0] == UDA(1) && Attrib[1] == UDA(2));
diff --git a/gcc/testsuite/gdc.test/compilable/verrors_spec.d b/gcc/testsuite/gdc.test/compilable/verrors_spec.d
new file mode 100644
index 00000000000..f96030ed0e8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/verrors_spec.d
@@ -0,0 +1,14 @@
+/*
+PERMUTE_ARGS:
+REQUIRED_ARGS: -verrors=spec
+TEST_OUTPUT:
+---
+(spec:1) compilable/verrors_spec.d(13): Error: cannot implicitly convert expression (& i) of type int* to int
+---
+*/
+
+void foo(int i)
+{
+    int p;
+    bool b = __traits(compiles, {p = &i;});
+}
diff --git a/gcc/testsuite/gdc.test/compilable/vgc1.d b/gcc/testsuite/gdc.test/compilable/vgc1.d
new file mode 100644
index 00000000000..87b35a41cbc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/vgc1.d
@@ -0,0 +1,87 @@
+// REQUIRED_ARGS: -vgc -o-
+// PERMUTE_ARGS:
+
+/***************** NewExp *******************/
+
+struct S1 { }
+struct S2 { this(int); }
+struct S3 { this(int) @nogc; }
+struct S4 { new(size_t); }
+struct S5 { @nogc new(size_t); }
+
+/*
+TEST_OUTPUT:
+---
+compilable/vgc1.d(27): vgc: 'new' causes GC allocation
+compilable/vgc1.d(29): vgc: 'new' causes GC allocation
+compilable/vgc1.d(30): vgc: 'new' causes GC allocation
+compilable/vgc1.d(32): vgc: 'new' causes GC allocation
+compilable/vgc1.d(33): vgc: 'new' causes GC allocation
+compilable/vgc1.d(34): vgc: 'new' causes GC allocation
+compilable/vgc1.d(38): vgc: 'new' causes GC allocation
+---
+*/
+
+void testNew()
+{
+    int* p1 = new int;
+
+    int[] a1 = new int[3];
+    int[][] a2 = new int[][](2, 3);
+
+    S1* ps1 = new S1();
+    S2* ps2 = new S2(1);
+    S3* ps3 = new S3(1);
+    S4* ps4 = new S4;   // no error
+    S5* ps5 = new S5;   // no error
+
+    Object o1 = new Object();
+}
+
+/*
+TEST_OUTPUT:
+---
+compilable/vgc1.d(55): vgc: 'new' causes GC allocation
+compilable/vgc1.d(57): vgc: 'new' causes GC allocation
+compilable/vgc1.d(58): vgc: 'new' causes GC allocation
+compilable/vgc1.d(60): vgc: 'new' causes GC allocation
+compilable/vgc1.d(61): vgc: 'new' causes GC allocation
+compilable/vgc1.d(62): vgc: 'new' causes GC allocation
+---
+*/
+
+void testNewScope()
+{
+    scope int* p1 = new int;
+
+    scope int[] a1 = new int[3];
+    scope int[][] a2 = new int[][](2, 3);
+
+    scope S1* ps1 = new S1();
+    scope S2* ps2 = new S2(1);
+    scope S3* ps3 = new S3(1);
+    scope S4* ps4 = new S4;             // no error
+    scope S5* ps5 = new S5;             // no error
+
+    scope Object o1 = new Object();     // no error
+    scope o2 = new Object();            // no error
+    scope Object o3;
+    o3 = o2;                            // no error
+}
+
+/***************** DeleteExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+compilable/vgc1.d(84): vgc: 'delete' requires GC
+compilable/vgc1.d(85): vgc: 'delete' requires GC
+compilable/vgc1.d(86): vgc: 'delete' requires GC
+---
+*/
+void testDelete(int* p, Object o, S1* s)
+{
+    delete p;
+    delete o;
+    delete s;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/vgc2.d b/gcc/testsuite/gdc.test/compilable/vgc2.d
new file mode 100644
index 00000000000..b1a7f187a23
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/vgc2.d
@@ -0,0 +1,104 @@
+// REQUIRED_ARGS: -vgc -o-
+// PERMUTE_ARGS:
+
+/***************** CatExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+compilable/vgc2.d(21): vgc: operator ~ may cause GC allocation
+compilable/vgc2.d(22): vgc: operator ~ may cause GC allocation
+compilable/vgc2.d(23): vgc: operator ~ may cause GC allocation
+compilable/vgc2.d(25): vgc: operator ~ may cause GC allocation
+compilable/vgc2.d(26): vgc: operator ~ may cause GC allocation
+compilable/vgc2.d(27): vgc: operator ~ may cause GC allocation
+compilable/vgc2.d(28): vgc: operator ~ may cause GC allocation
+compilable/vgc2.d(29): vgc: operator ~ may cause GC allocation
+---
+*/
+void testCat(int[] a, string s)
+{
+    int[] a1 = a ~ a;
+    int[] a2 = a ~ 1;
+    int[] a3 = 1 ~ a;
+
+    string s1 = s ~ s;
+    string s2 = s ~ "a";
+    string s3 = "a" ~ s;
+    string s4 = s ~ 'c';
+    string s5 = 'c' ~ s;
+
+    string s6 = "a" ~ "b";      // no error
+    string s7 = "a" ~ 'c';      // no error
+    string s8 = 'c' ~ "b";      // no error
+}
+
+/***************** CatAssignExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+compilable/vgc2.d(48): vgc: operator ~= may cause GC allocation
+compilable/vgc2.d(50): vgc: operator ~= may cause GC allocation
+compilable/vgc2.d(51): vgc: operator ~= may cause GC allocation
+---
+*/
+void testCatAssign(int[] a, string s)
+{
+    a ~= 1;
+
+    s ~= "a";
+    s ~= 'c';
+}
+
+/***************** ArrayLiteralExp *******************/
+
+int* barA();
+
+/*
+TEST_OUTPUT:
+---
+compilable/vgc2.d(70): vgc: array literal may cause GC allocation
+compilable/vgc2.d(71): vgc: array literal may cause GC allocation
+---
+*/
+void testArray()
+{
+    enum arrLiteral = [null, null];
+
+    int* p;
+    auto a = [p, p, barA()];
+    a = arrLiteral;
+}
+
+/***************** AssocArrayLiteralExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+compilable/vgc2.d(87): vgc: associative array literal may cause GC allocation
+compilable/vgc2.d(88): vgc: associative array literal may cause GC allocation
+---
+*/
+void testAssocArray()
+{
+    enum aaLiteral = [10: 100];
+
+    auto aa = [1:1, 2:3, 4:5];
+    aa = aaLiteral;
+}
+
+/***************** IndexExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+compilable/vgc2.d(102): vgc: indexing an associative array may cause GC allocation
+compilable/vgc2.d(103): vgc: indexing an associative array may cause GC allocation
+---
+*/
+void testIndex(int[int] aa)
+{
+    aa[1] = 0;
+    int n = aa[1];
+}
diff --git a/gcc/testsuite/gdc.test/compilable/vgc3.d b/gcc/testsuite/gdc.test/compilable/vgc3.d
new file mode 100644
index 00000000000..4bf889ce997
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/vgc3.d
@@ -0,0 +1,68 @@
+// REQUIRED_ARGS: -vgc -o-
+// PERMUTE_ARGS:
+
+/***************** AssignExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+compilable/vgc3.d(16): vgc: setting 'length' may cause GC allocation
+compilable/vgc3.d(17): vgc: setting 'length' may cause GC allocation
+compilable/vgc3.d(18): vgc: setting 'length' may cause GC allocation
+---
+*/
+void testArrayLength(int[] a)
+{
+    a.length = 3;
+    a.length += 1;
+    a.length -= 1;
+}
+
+/***************** CallExp *******************/
+
+void barCall();
+
+/*
+TEST_OUTPUT:
+---
+---
+*/
+
+
+void testCall()
+{
+    auto fp = &barCall;
+    (*fp)();
+    barCall();
+}
+
+/****************** Closure ***********************/
+
+@nogc void takeDelegate2(scope int delegate() dg) {}
+@nogc void takeDelegate3(      int delegate() dg) {}
+
+/*
+TEST_OUTPUT:
+---
+compilable/vgc3.d(51): vgc: using closure causes GC allocation
+compilable/vgc3.d(63): vgc: using closure causes GC allocation
+---
+*/
+auto testClosure1()
+{
+    int x;
+    int bar() { return x; }
+    return &bar;
+}
+void testClosure2()
+{
+    int x;
+    int bar() { return x; }
+    takeDelegate2(&bar);     // no error
+}
+void testClosure3()
+{
+    int x;
+    int bar() { return x; }
+    takeDelegate3(&bar);
+}
diff --git a/gcc/testsuite/gdc.test/compilable/warn3882.d b/gcc/testsuite/gdc.test/compilable/warn3882.d
new file mode 100644
index 00000000000..bf824b8c035
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/warn3882.d
@@ -0,0 +1,84 @@
+// PERMUTE_ARGS: -w -wi -debug
+/*
+TEST_OUTPUT:
+---
+---
+*/
+
+@safe pure nothrow void strictVoidReturn(T)(T x) {}
+@safe pure nothrow void nonstrictVoidReturn(T)(ref T x) {}
+
+void test3882()
+{
+    int x = 3;
+    strictVoidReturn(x);
+    nonstrictVoidReturn(x);
+}
+
+/******************************************/
+// 12619
+
+extern (C) @system nothrow pure void* memcpy(void* s1, in void* s2, size_t n);
+// -> weakly pure
+
+void test12619() pure
+{
+    ubyte[10] a, b;
+    debug memcpy(a.ptr, b.ptr, 5);  // memcpy call should have side effect
+}
+
+/******************************************/
+// 12760
+
+struct S12760(T)
+{
+    T i;
+    this(T j) inout {}
+}
+
+struct K12760
+{
+    S12760!int nullable;
+
+    this(int)
+    {
+        nullable = 0;   // weak purity
+    }
+}
+
+/******************************************/
+// 12909
+
+int f12909(immutable(int[])[int] aa) pure nothrow
+{
+    //aa[0] = [];   // fix for issue 13701
+    return 0;
+}
+
+void test12909()
+{
+    immutable(int[])[int] aa;
+    f12909(aa);
+
+    // from 12910
+    const(int[])[int] makeAA() { return null; }  // to make r-value
+    makeAA().rehash();
+}
+
+/******************************************/
+// 13899
+
+const struct Foo13899
+{
+    int opApply(immutable int delegate(in ref int) pure nothrow dg) pure nothrow
+    {
+        return 1;
+    }
+}
+
+void test13899()
+{
+    foreach (x; Foo13899())
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/aacmp10381.d b/gcc/testsuite/gdc.test/fail_compilation/aacmp10381.d
new file mode 100644
index 00000000000..397f36d0346
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/aacmp10381.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/aacmp10381.d(12): Error: > is not defined for associative arrays
+---
+*/
+
+bool test10381()
+{
+    int[int] aa1 = [0: 1];
+    int[int] aa2 = [0: 1];
+    return aa1 > aa2;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/b3841.d b/gcc/testsuite/gdc.test/fail_compilation/b3841.d
new file mode 100644
index 00000000000..4a99e9a6963
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/b3841.d
@@ -0,0 +1,78 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -w -o-
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/b3841.d-mixin-31(31): Warning: char += float is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: int += float is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: long += double is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: char -= float is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: int -= float is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: long -= double is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: char *= float is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: int *= float is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: long *= double is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: char /= float is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: int /= float is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: long /= double is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: char %= float is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: int %= float is performing truncating conversion
+fail_compilation/b3841.d-mixin-31(31): Warning: long %= double is performing truncating conversion
+---
+*/
+
+
+void f(string op, LHS, RHS)()
+{
+    // pragma(msg, LHS, " += ", RHS);
+    LHS a;
+    RHS b;
+    mixin("a "~op~" b;");
+}
+
+template Ops(T...)
+{
+    alias Ops = T;
+}
+
+void main()
+{
+    foreach (string op; Ops!("+=", "-=", "*=", "/=", "%="))
+    {
+        // OK
+        f!(op, int, int)();
+        f!(op, long, int)();
+        f!(op, long, short)();
+        f!(op, float, long)();
+        f!(op, cfloat, long)();
+        f!(op, double, float)();
+        
+        // Should that really be OK ?
+        f!(op, short, int)();
+        f!(op, float, double)();
+
+        // Not OK, truncating conversion.
+        f!(op, char, float)();
+        f!(op, int, float)();
+        f!(op, long, double)();
+    }
+
+    foreach (string op; Ops!("+=", "-="))
+    {
+        // OK
+        f!(op, idouble, ifloat)();
+
+        // Should that really be OK ?
+        f!(op, ifloat, idouble)();
+    }
+    
+    // OK
+    f!("^^=", int, int)();
+    f!("^^=", long, int)();
+    f!("^^=", long, short)();
+    f!("^^=", float, long)();
+    f!("^^=", double, float)();
+    // Should that really be OK ?
+    f!("^^=", float, double)();
+}
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug4283.d b/gcc/testsuite/gdc.test/fail_compilation/bug4283.d
new file mode 100644
index 00000000000..5e5dc7133e7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/bug4283.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/bug4283.d(12): Error: declaration expected, not '}'
+---
+*/
+
+template Foo(bool b) {
+    static if (b)
+        enum bool Foo = 1;
+    else
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug5.d b/gcc/testsuite/gdc.test/fail_compilation/bug5.d
new file mode 100644
index 00000000000..7878af75b54
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/bug5.d
@@ -0,0 +1,8 @@
+// REQUIRED_ARGS:
+
+int test1()
+{
+    if (false)
+        return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug5b.d b/gcc/testsuite/gdc.test/fail_compilation/bug5b.d
new file mode 100644
index 00000000000..ca7ddd905e4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/bug5b.d
@@ -0,0 +1,6 @@
+// REQUIRED_ARGS:
+
+int test1()
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug8150a.d b/gcc/testsuite/gdc.test/fail_compilation/bug8150a.d
new file mode 100644
index 00000000000..906b73c3fcc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/bug8150a.d
@@ -0,0 +1,13 @@
+// Bugzilla 8150: nothrow check doesn't work for constructor
+
+struct Foo
+{
+    this(int) nothrow
+    {
+        throw new Exception("something");
+    }
+}
+
+void main() {
+    Foo(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug8150b.d b/gcc/testsuite/gdc.test/fail_compilation/bug8150b.d
new file mode 100644
index 00000000000..b861aeecc8b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/bug8150b.d
@@ -0,0 +1,13 @@
+// Bugzilla 8150: nothrow check doesn't work for constructor
+
+struct Foo
+{
+    this()(int) nothrow
+    {
+        throw new Exception("something");
+    }
+}
+
+void main() {
+    Foo(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug8891.d b/gcc/testsuite/gdc.test/fail_compilation/bug8891.d
new file mode 100644
index 00000000000..b58256eae2b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/bug8891.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/bug8891.d(21): Error: need 'this' for 'opCall' of type 'S(int n)'
+---
+*/
+
+struct S
+{
+    int value = 10;
+    S opCall(int n) // non-static
+    {
+        //printf("this.value = %d\n", this.value);    // prints garbage!
+        S s;
+        s.value = n;
+        return s;
+    }
+}
+void main()
+{
+    S s = 10;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports1a.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports1a.d
new file mode 100644
index 00000000000..a27ddea9591
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports1a.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -transition=checkimports -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/checkimports1a.d(16): Deprecation: local import search method found struct imports.diag12598a.lines instead of variable checkimports1a.C.lines
+---
+*/
+
+
+// new lookup + information
+class C
+{
+    void f()
+    {
+        import imports.diag12598a;
+        lines ~= "";
+    }
+
+    string[] lines;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports1b.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports1b.d
new file mode 100644
index 00000000000..60d3ae82b92
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports1b.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -transition=import -transition=checkimports
+/*
+TEST_OUTPUT:
+---
+fail_compilation/checkimports1b.d(16): Deprecation: local import search method found struct imports.diag12598a.lines instead of variable checkimports1b.C.lines
+fail_compilation/checkimports1b.d(16): Error: struct 'lines' is a type, not an lvalue
+---
+*/
+
+// old lookup + information
+class C
+{
+    void f()
+    {
+        import imports.diag12598a;
+        lines ~= "";
+    }
+
+    string[] lines;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports1c.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports1c.d
new file mode 100644
index 00000000000..f6587ef9219
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports1c.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -transition=checkimports -transition=import
+/*
+TEST_OUTPUT:
+---
+fail_compilation/checkimports1c.d(16): Deprecation: local import search method found struct imports.diag12598a.lines instead of variable checkimports1c.C.lines
+fail_compilation/checkimports1c.d(16): Error: struct 'lines' is a type, not an lvalue
+---
+*/
+
+// old lookup + information (the order of switches is reverse)
+class C
+{
+    void f()
+    {
+        import imports.diag12598a;
+        lines ~= "";
+    }
+
+    string[] lines;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d
new file mode 100644
index 00000000000..d4f3c729441
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d
@@ -0,0 +1,37 @@
+// REQUIRED_ARGS: -transition=checkimports
+/*
+TEST_OUTPUT:
+---
+fail_compilation/checkimports2a.d(26): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2a.X
+fail_compilation/checkimports2a.d(32): Deprecation: local import search method found variable imports.imp2.X instead of nothing
+fail_compilation/checkimports2a.d(32): Error: no property 'X' for type 'checkimports2a.B'
+fail_compilation/checkimports2a.d(32):        while evaluating: static assert((B).X == 0)
+fail_compilation/checkimports2a.d(33): Deprecation: local import search method found variable imports.imp2.Y instead of nothing
+fail_compilation/checkimports2a.d(33): Error: no property 'Y' for type 'checkimports2a.B'
+fail_compilation/checkimports2a.d(33):        while evaluating: static assert((B).Y == 2)
+fail_compilation/checkimports2a.d(35): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2a.X
+fail_compilation/checkimports2a.d(36): Deprecation: local import search method found variable imports.imp2.Y instead of variable imports.imp1.Y
+---
+*/
+
+// new lookup + information
+
+import imports.imp1;
+
+enum X = 0;
+
+class B
+{
+    import imports.imp2;
+    static assert(X == 0);      // imp2.X --> .X
+    int[Y] aa;                  // imp2.Y
+}
+
+class C : B
+{
+    static assert(B.X == 0);    // imp2.X --> error
+    static assert(B.Y == 2);    // imp2.Y --> error
+
+    static assert(X == 0);      // imp2.X --> .X
+    static assert(Y == 1);      // imp2.Y --> imp1.Y
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d
new file mode 100644
index 00000000000..a56b12c65b9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d
@@ -0,0 +1,38 @@
+// REQUIRED_ARGS: -transition=import -transition=checkimports -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/checkimports2b.d(27): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2b.X
+fail_compilation/checkimports2b.d(27):        while evaluating: static assert(2 == 2)
+fail_compilation/checkimports2b.d(33): Deprecation: local import search method found variable imports.imp2.X instead of nothing
+fail_compilation/checkimports2b.d(33):        while evaluating: static assert(2 == 2)
+fail_compilation/checkimports2b.d(34): Deprecation: local import search method found variable imports.imp2.Y instead of nothing
+fail_compilation/checkimports2b.d(34):        while evaluating: static assert(2 == 2)
+fail_compilation/checkimports2b.d(36): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2b.X
+fail_compilation/checkimports2b.d(36):        while evaluating: static assert(2 == 2)
+fail_compilation/checkimports2b.d(37): Deprecation: local import search method found variable imports.imp2.Y instead of variable imports.imp1.Y
+fail_compilation/checkimports2b.d(37):        while evaluating: static assert(2 == 2)
+---
+*/
+
+// old lookup + information
+
+import imports.imp1;
+
+enum X = 0;
+
+class B
+{
+    import imports.imp2;
+    static assert(X == 2);      // imp2.X --> .X (information)
+    int[Y] aa;                  // imp2.Y
+}
+
+class C : B
+{
+    static assert(B.X == 2);    // imp2.X --> error (keep old lookup rule)
+    static assert(B.Y == 2);    // imp2.Y --> error (keep old lookup rule)
+
+    static assert(X == 2);      // imp2.X --> .X (information)
+    static assert(Y == 2);      // imp2.Y --> imp1.Y (information)
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d
new file mode 100644
index 00000000000..9dee644fdc5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d
@@ -0,0 +1,38 @@
+// REQUIRED_ARGS: -transition=checkimports -transition=import -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/checkimports2c.d(28): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2c.X
+fail_compilation/checkimports2c.d(28):        while evaluating: static assert(2 == 2)
+fail_compilation/checkimports2c.d(34): Deprecation: local import search method found variable imports.imp2.X instead of nothing
+fail_compilation/checkimports2c.d(34):        while evaluating: static assert(2 == 2)
+fail_compilation/checkimports2c.d(35): Deprecation: local import search method found variable imports.imp2.Y instead of nothing
+fail_compilation/checkimports2c.d(35):        while evaluating: static assert(2 == 2)
+fail_compilation/checkimports2c.d(37): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2c.X
+fail_compilation/checkimports2c.d(37):        while evaluating: static assert(2 == 2)
+fail_compilation/checkimports2c.d(38): Deprecation: local import search method found variable imports.imp2.Y instead of variable imports.imp1.Y
+fail_compilation/checkimports2c.d(38):        while evaluating: static assert(2 == 2)
+---
+*/
+
+// old lookup + information (the order of switches is reverse)
+
+import imports.imp1;
+
+enum X = 0;
+
+class B
+{
+    import imports.imp2;
+    static assert(X == 2);      // imp2.X --> .X (information)
+    int[Y] aa;                  // imp2.Y
+}
+
+class C : B
+{
+    static assert(B.X == 2);    // imp2.X --> error (keep old lookup rule)
+    static assert(B.Y == 2);    // imp2.Y --> error (keep old lookup rule)
+
+    static assert(X == 2);      // imp2.X --> .X (information)
+    static assert(Y == 2);      // imp2.Y --> imp1.Y (information)
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports3.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports3.d
new file mode 100644
index 00000000000..e9d44a71b26
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports3.d
@@ -0,0 +1,15 @@
+/*
+REQUIRED_ARGS: -transition=checkimports -de
+TEST_OUTPUT:
+---
+fail_compilation/checkimports3.d(14): Deprecation: local import search method found overloadset checkimports3.foo (3 overloads) instead of overloadset checkimports3.foo (2 overloads)
+---
+*/
+import imports.checkimports3a;
+import imports.checkimports3b;
+import imports.checkimports3c;
+
+void test()
+{
+    foo();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/circ10280.d b/gcc/testsuite/gdc.test/fail_compilation/circ10280.d
new file mode 100644
index 00000000000..b839b9f4702
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/circ10280.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/circ10280.d(11): Error: circular initialization of variable 'circ10280.q10280'
+fail_compilation/circ10280.d(10):        called from here: foo10280()
+---
+*/
+// 10280
+
+const int q10280 = foo10280();
+int foo10280() { return q10280; }
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/class1.d b/gcc/testsuite/gdc.test/fail_compilation/class1.d
new file mode 100644
index 00000000000..261652c6412
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/class1.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/class1.d(11): Error: class class1.C identity assignment operator overload is illegal
+---
+*/
+
+class C
+{
+    // Non-templated identity opAssign
+    void opAssign(C rhs){}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/class2.d b/gcc/testsuite/gdc.test/fail_compilation/class2.d
new file mode 100644
index 00000000000..f4894ee7ba3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/class2.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/class2.d(11): Error: class class2.C identity assignment operator overload is illegal
+---
+*/
+
+class C
+{
+    // Templated identity opAssign
+    void opAssign(T)(T rhs){}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/commaexp.d b/gcc/testsuite/gdc.test/fail_compilation/commaexp.d
new file mode 100644
index 00000000000..3296046e234
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/commaexp.d
@@ -0,0 +1,43 @@
+/* REQUIRED_ARGS: -o- -de
+TEST_OUTPUT:
+---
+fail_compilation/commaexp.d(24): Deprecation: Using the result of a comma expression is deprecated
+fail_compilation/commaexp.d(36): Deprecation: Using the result of a comma expression is deprecated
+fail_compilation/commaexp.d(37): Deprecation: Using the result of a comma expression is deprecated
+fail_compilation/commaexp.d(38): Deprecation: Using the result of a comma expression is deprecated
+fail_compilation/commaexp.d(39): Deprecation: Using the result of a comma expression is deprecated
+fail_compilation/commaexp.d(41): Deprecation: Using the result of a comma expression is deprecated
+fail_compilation/commaexp.d(42): Deprecation: Using the result of a comma expression is deprecated
+---
+*/
+
+class Entry {}
+class MyContainerClass { bool append (Entry) { return false; } }
+
+int main () {
+    bool ok;
+    size_t aggr;
+    MyContainerClass mc;
+
+    // Bug 15997
+    enum WINHTTP_ERROR_BASE = 4200;
+    enum ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED = (WINHTTP_ERROR_BASE, + 44);
+
+    // OK
+    for (size_t i; i < 5; ++i, i += 1) {}
+    for (size_t i; i < 5; ++i, i += 1, i++) {}
+    if (!mc)
+        mc = new MyContainerClass, mc.append(new Entry);
+    if (Object o = cast(Object)mc) {} // Lowering
+    ok = true, mc.append(new Entry);
+    assert(ok);
+
+    // NOPE
+    for (size_t i; i < 5; ++i, i += (i++, 1)) {}
+    for (; aggr++, aggr > 5;) {}
+    if (Object o = (ok = true, null)) {}
+    ok = (true, mc.append(new Entry));
+    assert(!ok);
+    ok = true, (ok = (true, false));
+    return 42, 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/cppeh1.d b/gcc/testsuite/gdc.test/fail_compilation/cppeh1.d
new file mode 100644
index 00000000000..e60368c1506
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/cppeh1.d
@@ -0,0 +1,30 @@
+// DISABLED: win32 win64
+/*
+TEST_OUTPUT:
+---
+fail_compilation/cppeh1.d(26): Error: cannot catch C++ class objects in @safe code
+---
+*/
+
+version (Windows) static assert(0, "This test should not run on this platform");
+
+extern (C++, std)
+{
+    class exception { }
+}
+
+@safe:
+void bar();
+void abc();
+
+void foo()
+{
+    try
+    {
+        bar();
+    }
+    catch (std.exception e)
+    {
+        abc();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/cppeh2.d b/gcc/testsuite/gdc.test/fail_compilation/cppeh2.d
new file mode 100644
index 00000000000..1d3ddc67e7f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/cppeh2.d
@@ -0,0 +1,33 @@
+// DISABLED: win32 win64
+/*
+TEST_OUTPUT:
+---
+fail_compilation/cppeh2.d(21): Error: cannot mix catching D and C++ exceptions in the same try-catch
+---
+*/
+
+version(Windows) static assert(0, "This test should not run on this platform");
+
+extern (C++, std)
+{
+    class exception { }
+}
+
+void bar();
+void abc();
+
+void foo()
+{
+    try
+    {
+        bar();
+    }
+    catch (std.exception e)
+    {
+        abc();
+    }
+    catch (Exception e)
+    {
+        abc();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ctfe10989.d b/gcc/testsuite/gdc.test/fail_compilation/ctfe10989.d
new file mode 100644
index 00000000000..c9ab96a5c20
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ctfe10989.d
@@ -0,0 +1,36 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ctfe10989.d(11): Error: uncaught CTFE exception object.Exception("abc"c)
+fail_compilation/ctfe10989.d(14):        called from here: throwing()
+fail_compilation/ctfe10989.d(14):        while evaluating: static assert(throwing())
+---
+*/
+int throwing()
+{
+    throw new Exception(['a', 'b', 'c']);
+    return 0;
+}
+static assert(throwing());
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ctfe10989.d(33): Error: uncaught CTFE exception object.Exception("abc"c)
+fail_compilation/ctfe10989.d(36):        called from here: throwing2()
+fail_compilation/ctfe10989.d(36):        while evaluating: static assert(throwing2())
+---
+*/
+int throwing2()
+{
+    string msg = "abc";
+
+    char[] arr;
+    arr.length = msg.length;
+    arr = arr[0 .. $];
+    arr[] = msg;
+
+    throw new Exception(cast(string)arr);
+    return 0;
+}
+static assert(throwing2());
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ctfe10995.d b/gcc/testsuite/gdc.test/fail_compilation/ctfe10995.d
new file mode 100644
index 00000000000..ca424956c78
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ctfe10995.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ctfe10995.d(19): Error: cannot read uninitialized variable a in CTFE
+fail_compilation/ctfe10995.d(25): Error: cannot read uninitialized variable a in CTFE
+---
+*/
+struct T
+{
+    short a = void;
+}
+
+T foo()
+{
+    auto t = T.init;
+    return t;
+}
+
+enum i = foo().a;
+
+struct T2
+{
+    short a = void;
+}
+enum i2 = T2.init.a;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ctfe11467.d b/gcc/testsuite/gdc.test/fail_compilation/ctfe11467.d
new file mode 100644
index 00000000000..a5a22ad99a8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ctfe11467.d
@@ -0,0 +1,52 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ctfe11467.d(15): Error: overlapping slice assignment [0..4] = [1..5]
+fail_compilation/ctfe11467.d(24):        called from here: test11467a()
+fail_compilation/ctfe11467.d(24):        while evaluating: static assert(test11467a())
+fail_compilation/ctfe11467.d(21): Error: overlapping slice assignment [1..5] = [0..4]
+fail_compilation/ctfe11467.d(25):        called from here: test11467b()
+fail_compilation/ctfe11467.d(25):        while evaluating: static assert(test11467b())
+---
+*/
+int test11467a()
+{
+    auto a = [0, 1, 2, 3, 4];
+    a[0 .. 4] = a[1 .. 5];
+    return 1;
+}
+int test11467b()
+{
+    auto a = [0, 1, 2, 3, 4];
+    a[1 .. 5] = a[0 .. 4];
+    return 1;
+}
+static assert(test11467a());
+static assert(test11467b());
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ctfe11467.d(41): Error: overlapping slice assignment [0..4] = [1..5]
+fail_compilation/ctfe11467.d(50):        called from here: test11467c()
+fail_compilation/ctfe11467.d(50):        while evaluating: static assert(test11467c())
+fail_compilation/ctfe11467.d(47): Error: overlapping slice assignment [1..5] = [0..4]
+fail_compilation/ctfe11467.d(51):        called from here: test11467d()
+fail_compilation/ctfe11467.d(51):        while evaluating: static assert(test11467d())
+---
+*/
+int test11467c()
+{
+    auto a = "abcde".dup;
+    a[0 .. 4] = a[1 .. 5];
+    return 1;
+}
+int test11467d()
+{
+    auto a = "abcde".dup;
+    a[1 .. 5] = a[0 .. 4];
+    return 1;
+}
+static assert(test11467c());
+static assert(test11467d());
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ctfe13612.d b/gcc/testsuite/gdc.test/fail_compilation/ctfe13612.d
new file mode 100644
index 00000000000..8433772eaff
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ctfe13612.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ctfe13612.d(15): Error: function ctfe13612.S.recurse CTFE recursion limit exceeded
+fail_compilation/ctfe13612.d(20):        called from here: s.recurse()
+fail_compilation/ctfe13612.d(15):        1000 recursive calls to function recurse
+fail_compilation/ctfe13612.d(23):        called from here: (new S).recurse()
+fail_compilation/ctfe13612.d(23):        while evaluating: static assert((new S).recurse())
+---
+*/
+
+class S
+{
+    int x;
+    int recurse()
+    {
+        S s;
+        assert(!x); // Error: class 'this' is null and cannot be dereferenced
+        s = new S();
+        return s.recurse();
+    }
+}
+static assert(new S().recurse());
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ctfe14207.d b/gcc/testsuite/gdc.test/fail_compilation/ctfe14207.d
new file mode 100644
index 00000000000..511f7553c2d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ctfe14207.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ctfe14207.d(13): Error: cannot convert &immutable(ulong) to ubyte[8]* at compile time
+fail_compilation/ctfe14207.d(18):        called from here: nativeToBigEndian()
+fail_compilation/ctfe14207.d(22):        called from here: digest()
+---
+*/
+
+ubyte[8] nativeToBigEndian()
+{
+    immutable ulong res = 1;
+    return *cast(ubyte[8]*) &res;
+}
+
+auto digest()
+{
+    ubyte[8] bits = nativeToBigEndian();
+    return bits;
+}
+
+enum h = digest();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ctfe14465.d b/gcc/testsuite/gdc.test/fail_compilation/ctfe14465.d
new file mode 100644
index 00000000000..f4851606eca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ctfe14465.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ctfe14465.d(19): Error: uncaught CTFE exception ctfe14465.E("message")
+fail_compilation/ctfe14465.d(22):        called from here: foo()
+fail_compilation/ctfe14465.d(22):        while evaluating: static assert(foo())
+---
+*/
+class E : Exception
+{
+    this(string msg)
+    {
+        super(msg);
+    }
+}
+
+bool foo()
+{
+    throw new E("message");
+}
+
+static assert(foo());
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ctfe14731.d b/gcc/testsuite/gdc.test/fail_compilation/ctfe14731.d
new file mode 100644
index 00000000000..5f2067fa91f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ctfe14731.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ctfe14731.d(16): Error: cannot implicitly convert expression (["a b"]) of type string[] to string
+fail_compilation/ctfe14731.d(17): Error: cannot implicitly convert expression (split("a b")) of type string[] to string
+---
+*/
+
+string[] split(string a)
+{
+    return [a];
+}
+
+void main()
+{
+    enum string list1 = "a b".split();
+         string list2 = "a b".split();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/depmsg.d b/gcc/testsuite/gdc.test/fail_compilation/depmsg.d
new file mode 100644
index 00000000000..186576a5473
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/depmsg.d
@@ -0,0 +1,106 @@
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/depmsg.d(40): Deprecation: struct depmsg.main.Inner.A is deprecated - With message!
+fail_compilation/depmsg.d(40): Deprecation: struct depmsg.main.Inner.A is deprecated - With message!
+fail_compilation/depmsg.d(41): Deprecation: class depmsg.main.Inner.B is deprecated - With message!
+fail_compilation/depmsg.d(41): Deprecation: class depmsg.main.Inner.B is deprecated - With message!
+fail_compilation/depmsg.d(42): Deprecation: interface depmsg.main.Inner.C is deprecated - With message!
+fail_compilation/depmsg.d(42): Deprecation: interface depmsg.main.Inner.C is deprecated - With message!
+fail_compilation/depmsg.d(43): Deprecation: union depmsg.main.Inner.D is deprecated - With message!
+fail_compilation/depmsg.d(43): Deprecation: union depmsg.main.Inner.D is deprecated - With message!
+fail_compilation/depmsg.d(44): Deprecation: enum depmsg.main.Inner.E is deprecated - With message!
+fail_compilation/depmsg.d(44): Deprecation: enum depmsg.main.Inner.E is deprecated - With message!
+fail_compilation/depmsg.d(46): Deprecation: alias depmsg.main.Inner.G is deprecated - With message!
+fail_compilation/depmsg.d(47): Deprecation: variable depmsg.main.Inner.H is deprecated - With message!
+fail_compilation/depmsg.d(48): Deprecation: class depmsg.main.Inner.I!().I is deprecated - With message!
+---
+*/
+
+void main()
+{
+    class Inner
+    {
+        deprecated("With message!")
+        {
+            struct A { }
+            class B { }
+            interface C { }
+            union D { }
+            enum E { e };
+            //typedef int F;
+            alias int G;
+            static int H;
+            template I() { class I {} }
+        }
+    }
+    with(Inner)
+    {
+        A a;
+        B b;
+        C c;
+        D d;
+        E e;
+        //F f;
+        G g;
+        auto h = H;
+        I!() i;
+    }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/depmsg.d(94): Deprecation: function depmsg.test12954.Foo.bar1 is deprecated - [C] Use Foo.bar42 instead
+fail_compilation/depmsg.d(95): Deprecation: function depmsg.test12954.Foo.bar2 is deprecated - [E] Use Foo.bar42 instead
+fail_compilation/depmsg.d(96): Deprecation: function depmsg.test12954.Foo.bar3 is deprecated - [S] Use Foo.bar42 instead
+fail_compilation/depmsg.d(97): Deprecation: function depmsg.test12954.Foo.bar4 is deprecated - [F] Use Foo.bar42 instead
+fail_compilation/depmsg.d(98): Deprecation: variable depmsg.test12954.Foo.v2 is deprecated - Forward reference
+fail_compilation/depmsg.d(105): Deprecation: class depmsg.test12954.Obsolete is deprecated
+fail_compilation/depmsg.d(105): Deprecation: function depmsg.test12954.Obsolete.obs is deprecated - Function is obsolete
+---
+*/
+void test12954()
+{
+    struct Foo
+    {
+        enum DeprecatedReasonEnum = "[E] Use Foo.bar42 instead";
+        static const DeprecatedReasonStatic = "[S] Use Foo.bar42 instead";
+        static immutable DeprecatedReasonFunc = reason("Foo.bar42");
+
+        static string reason (string name)
+        {
+            return "[F] Use " ~ name ~ " instead";
+        }
+
+        deprecated("[C] Use " ~ `Foo.bar42 instead`)
+        void bar1 () {}
+
+        deprecated(DeprecatedReasonEnum)
+        void bar2 () {}
+
+        deprecated(DeprecatedReasonStatic)
+        void bar3 () {}
+
+        deprecated(DeprecatedReasonFunc)
+        void bar4 () {}
+
+        deprecated(Forward ~ Reference) int v2 = 2;
+        enum Forward = "Forward ", Reference = "reference";
+    }
+
+    Foo f;
+    f.bar1;
+    f.bar2;
+    f.bar3;
+    f.bar4;
+    assert(f.v2 == 2);
+
+    deprecated class Obsolete
+    {
+        deprecated("Function is obsolete") void obs() {}
+    }
+
+    (new Obsolete).obs();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/depmsg15814.d b/gcc/testsuite/gdc.test/fail_compilation/depmsg15814.d
new file mode 100644
index 00000000000..1a2b9f89d39
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/depmsg15814.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/depmsg15814.d(9): Deprecation: function depmsg15814.get15814 is deprecated - bug15814
+---
+*/
+deprecated("bug15814") int get15814() { return 0; }
+enum val15814 = get15814();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/depmsg15815.d b/gcc/testsuite/gdc.test/fail_compilation/depmsg15815.d
new file mode 100644
index 00000000000..72abbd77306
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/depmsg15815.d
@@ -0,0 +1,23 @@
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/depmsg15815.d(23): Deprecation: alias depmsg15815.Alias!(const(Foo)).Alias is deprecated - message
+Foo
+---
+*/
+
+template Unqual(T)
+{
+    static if (is(T U == const U)) alias Unqual = U;
+    else alias Unqual = T;
+}
+
+deprecated("message")
+template Alias(T)
+{
+    alias Alias = Unqual!T;
+}
+
+struct Foo {}
+pragma(msg, Alias!(const(Foo)));
diff --git a/gcc/testsuite/gdc.test/fail_compilation/deprecate12979a.d b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979a.d
new file mode 100644
index 00000000000..fefcf87cf39
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979a.d
@@ -0,0 +1,18 @@
+// REQUIRED_ARGS: -de
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/deprecate12979a.d(14): Deprecation: asm statement is assumed to throw - mark it with 'nothrow' if it does not
+fail_compilation/deprecate12979a.d(12): Error: nothrow function 'deprecate12979a.foo' may throw
+---
+*/
+
+void foo() nothrow
+{
+    asm
+    {
+        ret;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/deprecate12979b.d b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979b.d
new file mode 100644
index 00000000000..0d675cb558f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979b.d
@@ -0,0 +1,17 @@
+// REQUIRED_ARGS: -de
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/deprecate12979b.d(13): Deprecation: asm statement is assumed to be impure - mark it with 'pure' if it is not
+---
+*/
+
+void foo() pure
+{
+    asm
+    {
+        ret;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/deprecate12979c.d b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979c.d
new file mode 100644
index 00000000000..782700469cd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979c.d
@@ -0,0 +1,17 @@
+// REQUIRED_ARGS: -de
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/deprecate12979c.d(13): Deprecation: asm statement is assumed to use the GC - mark it with '@nogc' if it does not
+---
+*/
+
+void foo() @nogc
+{
+    asm
+    {
+        ret;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/deprecate12979d.d b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979d.d
new file mode 100644
index 00000000000..afff5671027
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979d.d
@@ -0,0 +1,16 @@
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/deprecate12979d.d(12): Error: asm statement is assumed to be @system - mark it with '@trusted' if it is not
+---
+*/
+
+void foo() @safe
+{
+    asm
+    {
+        ret;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/deprecate1553.d b/gcc/testsuite/gdc.test/fail_compilation/deprecate1553.d
new file mode 100644
index 00000000000..4a03a6fa41b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/deprecate1553.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -de
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/deprecate1553.d(19): Deprecation: cannot use foreach_reverse with a delegate
+---
+*/
+
+struct S
+{
+    int dg(int delegate(ref int a)) { return 0; }
+}
+
+void main()
+{
+    S s;
+    foreach_reverse(a; &s.dg) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10089.d b/gcc/testsuite/gdc.test/fail_compilation/diag10089.d
new file mode 100644
index 00000000000..ea47660319b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10089.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10089.d(15): Error: undefined identifier 'chunks' in package 'imports'
+fail_compilation/diag10089.d(17): Error: template Foo() does not have property 'chunks'
+---
+*/
+
+import imports.diag10089a, imports.diag10089b;
+
+template Foo() {}
+
+void main()
+{
+    imports.chunks("abcdef", 2);
+
+    Foo.chunks("abcdef", 2);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10099.d b/gcc/testsuite/gdc.test/fail_compilation/diag10099.d
new file mode 100644
index 00000000000..a26ca85e19d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10099.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10099.d(15): Error: variable diag10099.main.s default construction is disabled for type S
+---
+*/
+
+struct S
+{
+    @disable this();
+}
+
+void main()
+{
+    S s;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10141.d b/gcc/testsuite/gdc.test/fail_compilation/diag10141.d
new file mode 100644
index 00000000000..e9ca913767f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10141.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10141.d(9): Error: module imports.diag10141a import 'unexisting_symbol' not found
+---
+*/
+
+import imports.diag10141a;
+import imports.diag10141a : unexisting_symbol;
+
+Tuple!(int) fun()
+{
+    return Tuple!(int).init;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10169.d b/gcc/testsuite/gdc.test/fail_compilation/diag10169.d
new file mode 100644
index 00000000000..4aabff85fd8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10169.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10169.d(12): Deprecation: imports.a10169.B.x is not visible from module diag10169
+fail_compilation/diag10169.d(12): Error: struct imports.a10169.B member x is not accessible
+---
+*/
+import imports.a10169;
+
+void main()
+{
+    auto a = B.init.x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10221.d b/gcc/testsuite/gdc.test/fail_compilation/diag10221.d
new file mode 100644
index 00000000000..db84194d1be
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10221.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10221.d(10): Error: cannot implicitly convert expression (256) of type int to ubyte
+---
+*/
+
+void main()
+{
+    foreach(ref ubyte i; 0..256) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10221a.d b/gcc/testsuite/gdc.test/fail_compilation/diag10221a.d
new file mode 100644
index 00000000000..923b80c2768
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10221a.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10221a.d(10): Error: cannot implicitly convert expression (257) of type int to ubyte
+---
+*/
+
+void main()
+{
+    foreach(ubyte i; 0..257) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10319.d b/gcc/testsuite/gdc.test/fail_compilation/diag10319.d
new file mode 100644
index 00000000000..5178891a8f4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10319.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10319.d(25): Error: pure function 'D main' cannot call impure function 'diag10319.foo'
+fail_compilation/diag10319.d(25): Error: @safe function 'D main' cannot call @system function 'diag10319.foo'
+fail_compilation/diag10319.d(26): Error: pure function 'D main' cannot call impure function 'diag10319.bar!int.bar'
+fail_compilation/diag10319.d(26): Error: @safe function 'D main' cannot call @system function 'diag10319.bar!int.bar'
+fail_compilation/diag10319.d(25): Error: function 'diag10319.foo' is not nothrow
+fail_compilation/diag10319.d(26): Error: function 'diag10319.bar!int.bar' is not nothrow
+fail_compilation/diag10319.d(23): Error: nothrow function 'D main' may throw
+---
+*/
+
+void foo() {}
+
+void bar(T)()
+{
+    static int g; g = 10;       // impure
+    int x; auto p = &x;         // system
+    throw new Exception("");    // may throw
+}
+
+@safe pure nothrow void main()  // L23
+{
+    foo();      // L25
+    bar!int();  // L26
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10327.d b/gcc/testsuite/gdc.test/fail_compilation/diag10327.d
new file mode 100644
index 00000000000..1d163c770ea
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10327.d
@@ -0,0 +1 @@
+import imports.test10327;  // package.d missing
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10359.d b/gcc/testsuite/gdc.test/fail_compilation/diag10359.d
new file mode 100644
index 00000000000..142cec98e0c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10359.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10359.d(10): Error: pointer slicing not allowed in safe functions
+---
+*/
+
+void foo(int* p) @safe
+{
+    auto a = p[0 .. 10];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10405.d b/gcc/testsuite/gdc.test/fail_compilation/diag10405.d
new file mode 100644
index 00000000000..c80c821ebd0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10405.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10405.d(10): Error: cannot return non-void from void function
+---
+*/
+
+void main()
+{
+    return 10;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10415.d b/gcc/testsuite/gdc.test/fail_compilation/diag10415.d
new file mode 100644
index 00000000000..a92b7a474ff
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10415.d
@@ -0,0 +1,40 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10415.d(36): Error: none of the overloads of 'x' are callable using argument types (int) const, candidates are:
+fail_compilation/diag10415.d(13):        diag10415.C.x()
+fail_compilation/diag10415.d(18):        diag10415.C.x(int _param_0)
+fail_compilation/diag10415.d(39): Error: d.x is not an lvalue
+---
+*/
+
+class C
+{
+    @property int x() const
+    {
+        return 0;
+    }
+
+    @property void x(int)
+    {
+    }
+}
+
+template AddProp() { @property int x() { return 1; } }
+template AddFunc() { void x(int, int) {} }
+
+class D
+{
+    // overloadset
+    mixin AddProp;
+    mixin AddFunc;
+}
+
+void main()
+{
+    const c = new C();
+    c.x = 1;
+
+    auto d = new D();
+    d.x = 1;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10688.d b/gcc/testsuite/gdc.test/fail_compilation/diag10688.d
new file mode 100644
index 00000000000..70db7f96fe0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10688.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10688.d(12): Error: function diag10688.Bar.foo private method is not virtual and cannot override
+fail_compilation/diag10688.d(14): Error: function diag10688.Bar.bar package method is not virtual and cannot override
+---
+*/
+
+class Bar
+{
+private:
+    override void foo() { }
+package:
+    override void bar() { }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10768.d b/gcc/testsuite/gdc.test/fail_compilation/diag10768.d
new file mode 100644
index 00000000000..03b18a10689
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10768.d
@@ -0,0 +1,42 @@
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10768.d(36): Error: cannot implicitly override base class method diag10768.Frop.frop with diag10768.Foo.frop; add 'override' attribute
+---
+*/
+
+struct CirBuff(T)
+{
+    import std.traits: isArray;
+    CirBuff!T opAssign(R)(R) if (isArray!R)
+    {}
+
+    T[] toArray()
+    {
+        T[] ret; //  = new T[this.length];
+        return ret;
+    }
+    alias toArray this;
+}
+
+class Bar(T=int)
+{
+    CirBuff!T _bar;
+}
+
+class Once
+{
+    Bar!Foo _foobar;
+}
+
+class Foo : Frop
+{
+    // override
+    public int frop() { return 1; }
+}
+
+class Frop
+{
+    public int frop() { return 0; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10783.d b/gcc/testsuite/gdc.test/fail_compilation/diag10783.d
new file mode 100644
index 00000000000..e53ff9bba94
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10783.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10783.d(14): Error: no property 'type' for type 'Event'
+fail_compilation/diag10783.d(14): Error: undefined identifier 'En'
+---
+*/
+
+struct Event { }
+
+void main()
+{
+    Event event;
+    switch (event.type) with (En)
+    {
+        default:
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10792.d b/gcc/testsuite/gdc.test/fail_compilation/diag10792.d
new file mode 100644
index 00000000000..d16fe7de05d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10792.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10792.d(2): Error: semicolon expected following auto declaration, not 'EOF'
+---
+*/
+
+#line 1
+enum isPred(T) = asdf
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10805.d b/gcc/testsuite/gdc.test/fail_compilation/diag10805.d
new file mode 100644
index 00000000000..fa52d9aca47
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10805.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10805.d(10): Error: delimited string must end in FOO"
+fail_compilation/diag10805.d(12): Error: unterminated string constant starting at fail_compilation/diag10805.d(12)
+fail_compilation/diag10805.d(13): Error: semicolon expected following auto declaration, not 'EOF'
+---
+*/
+
+enum s = q"FOO
+FOO
+";
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10862.d b/gcc/testsuite/gdc.test/fail_compilation/diag10862.d
new file mode 100644
index 00000000000..669f5711dce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10862.d
@@ -0,0 +1,93 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10862.d(13): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(14): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(15): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(28): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(29): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(30): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(31): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(32): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(34): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(35): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(36): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(37): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(39): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(40): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(41): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(42): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(44): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(45): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(46): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(47): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(49): Error: undefined identifier 'semanticError'
+---
+*/
+
+void test1()
+{
+    int a, b;
+
+    if (a = b) {}
+    if ((a = b) = 0) {}
+    if ((a = b) = (a = b)) {}
+    if (a = 0, b = 0) {}        // Bugzilla 15384
+    if (auto x = a = b) {}      // this is error, today
+
+    while (a = b) {}
+    while ((a = b) = 0) {}
+    while ((a = b) = (a = b)) {}
+    while (a = 0, b = 0) {}     // Bugzilla 15384
+
+    do {} while (a = b);
+    do {} while ((a = b) = 0);
+    do {} while ((a = b) = (a = b));
+    do {} while (a = 0, b = 0); // Bugzilla 15384
+
+    for (;  a = b; ) {}
+    for (;  (a = b) = 0; ) {}
+    for (;  (a = b) = (a = b); ) {}
+    for (;  a = 0, b = 0; ) {}  // Bugzilla 15384
+
+    semanticError;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10862.d(73): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d(76): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d-mixin-79(79): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d-mixin-80(80): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d-mixin-81(81): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d-mixin-82(82): Error: assignment cannot be used as a condition, perhaps == was meant?
+fail_compilation/diag10862.d-mixin-85(85): Error: a + b is not an lvalue
+fail_compilation/diag10862.d-mixin-86(86): Error: undefined identifier 'c'
+fail_compilation/diag10862.d(88): Error: undefined identifier 'semanticError'
+---
+*/
+void test2()
+{
+    int a, b;
+
+    // (a + b) cannot be an assignment target.
+    // However checkAssignAsCondition specilatively rerites it to EqualExp,
+    // then the pointless error "is not an lvalue" would not happen.
+    if (a + b = a * b) {}
+
+    // The suggestion error masks "undefined identifier" error
+    if (a = undefinedIdentifier) {}
+
+    // If the condition is a mixin expression
+    if (mixin("a = b")) {}
+    if (mixin("(a = b) = 0")) {}
+    if (mixin("(a = b) = (a = b)")) {}
+    if (mixin("a = 0, b = 0")) {}
+    if (auto x = mixin("a = b")) {}     // Note: no error
+
+    if (mixin("a + b = a * b")) {}      // Note: "a + b is not an lvalue"
+    if (mixin("a = c")) {}
+
+    semanticError;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10926.d b/gcc/testsuite/gdc.test/fail_compilation/diag10926.d
new file mode 100644
index 00000000000..bd590ba2151
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10926.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10926.d(11): Error: cast(const(int)[])c is not an lvalue
+---
+*/
+
+void main() {
+    const(int)[] a, b;
+    int[] c, d;
+    (true ? a : c) ~= 20; // line 6, Error: a is not an lvalue
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10984.d b/gcc/testsuite/gdc.test/fail_compilation/diag10984.d
new file mode 100644
index 00000000000..33e0eaf25d9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag10984.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag10984.d(11): Error: static function diag10984.f.n cannot access frame of function diag10984.f
+---
+*/
+
+void f()
+{
+    int x;
+    static void n() { x++; }
+}
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11078.d b/gcc/testsuite/gdc.test/fail_compilation/diag11078.d
new file mode 100644
index 00000000000..7507875c947
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11078.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11078.d(19): Error: none of the overloads of 'value' are callable using argument types (double), candidates are:
+fail_compilation/diag11078.d(12):        diag11078.S1.value()
+fail_compilation/diag11078.d(13):        diag11078.S1.value(int n)
+---
+*/
+
+struct S1
+{
+    @property int value() { return 1; }
+    @property void value(int n) { }
+}
+
+void main()
+{
+    S1 s1;
+    s1.value = 1.0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11088.d b/gcc/testsuite/gdc.test/fail_compilation/diag11088.d
new file mode 100644
index 00000000000..720a2f82fb3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11088.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11088.d(11): Error: enum member diag11088.E.B initialization with (E.A + 1) causes overflow for type 'int'
+fail_compilation/diag11088.d(17): Error: enum member diag11088.E1.B initialization with (E1.A + 1) causes overflow for type 'short'
+---
+*/
+enum E
+{
+    A = int.max,
+    B
+}
+
+enum E1 : short
+{
+    A = short.max,
+    B
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11132.d b/gcc/testsuite/gdc.test/fail_compilation/diag11132.d
new file mode 100644
index 00000000000..74062c2dc2e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11132.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11132.d(22): Error: overlapping initialization for field a and b
+---
+*/
+
+struct S
+{
+    int x;
+    union
+    {
+        int a;
+        int b;
+    }
+
+    int z;
+}
+
+void main()
+{
+    S s = { 1, 2, 3 };
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11198.d b/gcc/testsuite/gdc.test/fail_compilation/diag11198.d
new file mode 100644
index 00000000000..ebefa4dc6af
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11198.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11198.d(11): Error: version conditions can only be declared at module scope
+fail_compilation/diag11198.d(12): Error: debug conditions can only be declared at module scope
+---
+*/
+
+void main()
+{
+    version = blah;
+    debug = blah;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11423.d b/gcc/testsuite/gdc.test/fail_compilation/diag11423.d
new file mode 100644
index 00000000000..90daaf8fb9f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11423.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11423.d(9): Error: undefined identifier 'Foo'
+---
+*/
+void main()
+{
+    auto foo = new shared Foo();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11425.d b/gcc/testsuite/gdc.test/fail_compilation/diag11425.d
new file mode 100644
index 00000000000..16c99cc4116
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11425.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11425.d(13): Error: variable x is shadowing variable diag11425.main.x
+---
+*/
+
+void main()
+{
+    int x;
+
+    {
+        int x = 1;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11727.d b/gcc/testsuite/gdc.test/fail_compilation/diag11727.d
new file mode 100644
index 00000000000..907c9bb404d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11727.d
@@ -0,0 +1,39 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11727.d(10): Error: type n is not an expression
+---
+*/
+auto returnEnum()
+{
+    enum n;
+    return n;
+}
+void main()
+{
+    assert(returnEnum() == 0);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11727.d(26): Error: type void is not an expression
+---
+*/
+auto returnVoid()
+{
+    alias v = void;
+    return v;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11727.d(38): Error: template t() has no type
+---
+*/
+auto returnTemplate()
+{
+    template t() {}
+    return t;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11756.d b/gcc/testsuite/gdc.test/fail_compilation/diag11756.d
new file mode 100644
index 00000000000..28e07eb7a9a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11756.d
@@ -0,0 +1,39 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11756.d(15): Error: cannot read uninitialized variable cnt in CTFE
+fail_compilation/diag11756.d(34):        called from here: foo.ptr2.opAssign(Ptr(& n))
+fail_compilation/diag11756.d(39):        called from here: test()
+fail_compilation/diag11756.d(39):        while evaluating: static assert(test())
+---
+*/
+
+struct Ptr
+{
+    void opAssign(Ptr other)
+    {
+        (*cnt)--;   // error
+        cnt = other.cnt;
+        (*cnt)++;
+    }
+    size_t *cnt;
+}
+
+union Foo
+{
+    size_t *ptr1;
+    Ptr ptr2;
+}
+
+bool test()
+{
+    Foo foo;
+    size_t cnt = 1;
+    foo.ptr1 = &cnt;
+    size_t n;
+    foo.ptr2 = Ptr(&n);
+    assert(cnt == 0);
+
+    return true;
+}
+static assert(test());
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11759.d b/gcc/testsuite/gdc.test/fail_compilation/diag11759.d
new file mode 100644
index 00000000000..e0b7b864c13
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11759.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11759.d(8): Error: lower case integer suffix 'l' is not allowed. Please use 'L' instead
+---
+*/
+
+ulong x = 123ul;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11769.d b/gcc/testsuite/gdc.test/fail_compilation/diag11769.d
new file mode 100644
index 00000000000..bfe4e1b4c8d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11769.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11769.d(18): Error: diag11769.foo!string.bar called with argument types (string) matches both:
+fail_compilation/diag11769.d(13):     diag11769.foo!string.bar(wstring _param_0)
+and:
+fail_compilation/diag11769.d(14):     diag11769.foo!string.bar(dstring _param_0)
+---
+*/
+
+template foo(T)
+{
+    void bar(wstring) {}
+    void bar(dstring) {}
+}
+void main()
+{
+    foo!string.bar("abc");
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11819a.d b/gcc/testsuite/gdc.test/fail_compilation/diag11819a.d
new file mode 100644
index 00000000000..338f9b27559
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11819a.d
@@ -0,0 +1,51 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11819a.d(30): Error: unrecognized trait 'DoesNotExist'
+fail_compilation/diag11819a.d(31): Error: unrecognized trait 'IsAbstractClass', did you mean 'isAbstractClass'?
+fail_compilation/diag11819a.d(32): Error: unrecognized trait 'IsArithmetic', did you mean 'isArithmetic'?
+fail_compilation/diag11819a.d(33): Error: unrecognized trait 'IsAssociativeArray', did you mean 'isAssociativeArray'?
+fail_compilation/diag11819a.d(34): Error: unrecognized trait 'IsFinalClass', did you mean 'isFinalClass'?
+fail_compilation/diag11819a.d(35): Error: unrecognized trait 'IsPOD', did you mean 'isPOD'?
+fail_compilation/diag11819a.d(36): Error: unrecognized trait 'IsNested', did you mean 'isNested'?
+fail_compilation/diag11819a.d(37): Error: unrecognized trait 'IsFloating', did you mean 'isFloating'?
+fail_compilation/diag11819a.d(38): Error: unrecognized trait 'IsIntegral', did you mean 'isIntegral'?
+fail_compilation/diag11819a.d(39): Error: unrecognized trait 'IsScalar', did you mean 'isScalar'?
+fail_compilation/diag11819a.d(40): Error: unrecognized trait 'IsStaticArray', did you mean 'isStaticArray'?
+fail_compilation/diag11819a.d(41): Error: unrecognized trait 'IsUnsigned', did you mean 'isUnsigned'?
+fail_compilation/diag11819a.d(42): Error: unrecognized trait 'IsVirtualFunction', did you mean 'isVirtualFunction'?
+fail_compilation/diag11819a.d(43): Error: unrecognized trait 'IsVirtualMethod', did you mean 'isVirtualMethod'?
+fail_compilation/diag11819a.d(44): Error: unrecognized trait 'IsAbstractFunction', did you mean 'isAbstractFunction'?
+fail_compilation/diag11819a.d(45): Error: unrecognized trait 'IsFinalFunction', did you mean 'isFinalFunction'?
+fail_compilation/diag11819a.d(46): Error: unrecognized trait 'IsOverrideFunction', did you mean 'isOverrideFunction'?
+fail_compilation/diag11819a.d(47): Error: unrecognized trait 'IsStaticFunction', did you mean 'isStaticFunction'?
+fail_compilation/diag11819a.d(48): Error: unrecognized trait 'IsRef', did you mean 'isRef'?
+fail_compilation/diag11819a.d(49): Error: unrecognized trait 'IsOut', did you mean 'isOut'?
+fail_compilation/diag11819a.d(50): Error: unrecognized trait 'IsLazy', did you mean 'isLazy'?
+---
+*/
+
+void main()
+{
+    if (__traits(DoesNotExist)) { }
+    if (__traits(IsAbstractClass)) { }
+    if (__traits(IsArithmetic)) { }
+    if (__traits(IsAssociativeArray)) { }
+    if (__traits(IsFinalClass)) { }
+    if (__traits(IsPOD)) { }
+    if (__traits(IsNested)) { }
+    if (__traits(IsFloating)) { }
+    if (__traits(IsIntegral)) { }
+    if (__traits(IsScalar)) { }
+    if (__traits(IsStaticArray)) { }
+    if (__traits(IsUnsigned)) { }
+    if (__traits(IsVirtualFunction)) { }
+    if (__traits(IsVirtualMethod)) { }
+    if (__traits(IsAbstractFunction)) { }
+    if (__traits(IsFinalFunction)) { }
+    if (__traits(IsOverrideFunction)) { }
+    if (__traits(IsStaticFunction)) { }
+    if (__traits(IsRef)) { }
+    if (__traits(IsOut)) { }
+    if (__traits(IsLazy)) { }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d b/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d
new file mode 100644
index 00000000000..a7e6046c12b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d
@@ -0,0 +1,47 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11819b.d(28): Error: unrecognized trait 'HasMember', did you mean 'hasMember'?
+fail_compilation/diag11819b.d(29): Error: unrecognized trait 'Identifier', did you mean 'identifier'?
+fail_compilation/diag11819b.d(30): Error: unrecognized trait 'GetProtection', did you mean 'getProtection'?
+fail_compilation/diag11819b.d(31): Error: unrecognized trait 'Parent', did you mean 'parent'?
+fail_compilation/diag11819b.d(32): Error: unrecognized trait 'GetMember', did you mean 'getMember'?
+fail_compilation/diag11819b.d(33): Error: unrecognized trait 'GetOverloads', did you mean 'getOverloads'?
+fail_compilation/diag11819b.d(34): Error: unrecognized trait 'GetVirtualFunctions', did you mean 'getVirtualFunctions'?
+fail_compilation/diag11819b.d(35): Error: unrecognized trait 'GetVirtualMethods', did you mean 'getVirtualMethods'?
+fail_compilation/diag11819b.d(36): Error: unrecognized trait 'ClassInstanceSize', did you mean 'classInstanceSize'?
+fail_compilation/diag11819b.d(37): Error: unrecognized trait 'AllMembers', did you mean 'allMembers'?
+fail_compilation/diag11819b.d(38): Error: unrecognized trait 'DerivedMembers', did you mean 'derivedMembers'?
+fail_compilation/diag11819b.d(39): Error: unrecognized trait 'IsSame', did you mean 'isSame'?
+fail_compilation/diag11819b.d(40): Error: unrecognized trait 'Compiles', did you mean 'compiles'?
+fail_compilation/diag11819b.d(41): Error: unrecognized trait 'Parameters', did you mean 'parameters'?
+fail_compilation/diag11819b.d(42): Error: unrecognized trait 'GetAliasThis', did you mean 'getAliasThis'?
+fail_compilation/diag11819b.d(43): Error: unrecognized trait 'GetAttributes', did you mean 'getAttributes'?
+fail_compilation/diag11819b.d(44): Error: unrecognized trait 'GetFunctionAttributes', did you mean 'getFunctionAttributes'?
+fail_compilation/diag11819b.d(45): Error: unrecognized trait 'GetUnitTests', did you mean 'getUnitTests'?
+fail_compilation/diag11819b.d(46): Error: unrecognized trait 'GetVirtualIndex', did you mean 'getVirtualIndex'?
+---
+*/
+
+void main()
+{
+    if (__traits(HasMember)) { }
+    if (__traits(Identifier)) { }
+    if (__traits(GetProtection)) { }
+    if (__traits(Parent)) { }
+    if (__traits(GetMember)) { }
+    if (__traits(GetOverloads)) { }
+    if (__traits(GetVirtualFunctions)) { }
+    if (__traits(GetVirtualMethods)) { }
+    if (__traits(ClassInstanceSize)) { }
+    if (__traits(AllMembers)) { }
+    if (__traits(DerivedMembers)) { }
+    if (__traits(IsSame)) { }
+    if (__traits(Compiles)) { }
+    if (__traits(Parameters)) { }
+    if (__traits(GetAliasThis)) { }
+    if (__traits(GetAttributes)) { }
+    if (__traits(GetFunctionAttributes)) { }
+    if (__traits(GetUnitTests)) { }
+    if (__traits(GetVirtualIndex)) { }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11840.d b/gcc/testsuite/gdc.test/fail_compilation/diag11840.d
new file mode 100644
index 00000000000..064195e3c0c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11840.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag11840.d(12): Error: undefined identifier 'i'
+fail_compilation/diag11840.d(12): Error: undefined identifier 'j'
+---
+*/
+
+void main()
+{
+    int[10] data;
+    data[i .. j] = 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12063.d b/gcc/testsuite/gdc.test/fail_compilation/diag12063.d
new file mode 100644
index 00000000000..e029810b1dc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12063.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12063.d(11): Error: no property 'max' for type 'Foo'
+fail_compilation/diag12063.d(14): Error: incompatible types for ((Foo()) + (1)): 'Bar' and 'int'
+---
+*/
+
+struct Foo {}
+
+enum Bar : Foo
+{
+    a = Foo(),
+    b
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12124.d b/gcc/testsuite/gdc.test/fail_compilation/diag12124.d
new file mode 100644
index 00000000000..320cfb2291e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12124.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12124.d(14): Error: struct diag12124.S1 static opCall is hidden by constructors and can never be called
+fail_compilation/diag12124.d(14):        Please use a factory method instead, or replace all constructors with static opCall.
+fail_compilation/diag12124.d(20): Error: struct diag12124.S2 static opCall is hidden by constructors and can never be called
+fail_compilation/diag12124.d(20):        Please use a factory method instead, or replace all constructors with static opCall.
+---
+*/
+
+struct S1
+{
+    this(int) {}
+    static S1 opCall() { assert(0); }
+}
+
+struct S2
+{
+    this(int) {}
+    static S2 opCall()() { assert(0); }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12280.d b/gcc/testsuite/gdc.test/fail_compilation/diag12280.d
new file mode 100644
index 00000000000..82aad8de0a1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12280.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12280.d(15): Error: undefined identifier 'nonexistent'
+fail_compilation/diag12280.d(13): Error: template instance diag12280.f!10 error instantiating
+fail_compilation/diag12280.d(18):        11 recursive instantiations from here: f!0
+---
+*/
+
+void f(int i)()
+{
+    static if (i < 10)
+        f!(i + 1);
+    else
+        nonexistent();
+}
+
+alias f0 = f!0;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12312.d b/gcc/testsuite/gdc.test/fail_compilation/diag12312.d
new file mode 100644
index 00000000000..7120a8f0d21
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12312.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12312.d(10): Error: variable diag12312.main.arr void[16] does not have a default initializer
+---
+*/
+
+void main()
+{
+    void[16] arr;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12380.d b/gcc/testsuite/gdc.test/fail_compilation/diag12380.d
new file mode 100644
index 00000000000..3a9e13fab2e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12380.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12380.d(12): Error: cannot implicitly convert expression (cast(E)0) of type E to void*
+---
+*/
+
+enum E { a, b, }
+
+void main()
+{
+    void* a = E.init;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12432.d b/gcc/testsuite/gdc.test/fail_compilation/diag12432.d
new file mode 100644
index 00000000000..10755d84a03
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12432.d
@@ -0,0 +1,61 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12432.d(55): Error: cannot infer argument types, expected 1 argument, not 2
+fail_compilation/diag12432.d(56): Error: cannot infer argument types, expected 2 arguments, not 3
+fail_compilation/diag12432.d(57): Error: cannot infer argument types, expected 1 argument, not 2
+fail_compilation/diag12432.d(58): Error: cannot infer argument types, expected 1 argument, not 2
+fail_compilation/diag12432.d(59): Error: cannot infer argument types, expected 2 arguments, not 3
+fail_compilation/diag12432.d(60): Error: cannot infer argument types, expected 2 arguments, not 3
+---
+*/
+
+struct R1
+{
+    @property int front() { return 0; }
+    enum bool empty = false;
+    void popFront() { }
+}
+
+struct Tuple(T...)
+{
+    T t;
+    alias t this;
+}
+
+struct R2
+{
+    @property Tuple!(int, float) front() { return typeof(return).init; }
+    enum bool empty = false;
+    void popFront() { }
+}
+
+struct OpApply1Func
+{
+    int opApply(int function(int)) { return 0; }
+}
+
+struct OpApply1Deleg
+{
+    int opApply(int delegate(int)) { return 0; }
+}
+
+struct OpApply2Func
+{
+    int opApply(int function(int, float)) { return 0; }
+}
+
+struct OpApply2Deleg
+{
+    int opApply(int delegate(int, float)) { return 0; }
+}
+
+void main()
+{
+    foreach (a, b; R1()) { }
+    foreach (a, b, c; R2()) { }
+    foreach (a, b; OpApply1Func()) { }
+    foreach (a, b; OpApply1Deleg()) { }
+    foreach (a, b, c; OpApply2Func()) { }
+    foreach (a, b, c; OpApply2Deleg()) { }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12480.d b/gcc/testsuite/gdc.test/fail_compilation/diag12480.d
new file mode 100644
index 00000000000..25ebf5c71b7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12480.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -m32
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12480.d(12): Error: static assert  (2u == 3u) is false
+---
+*/
+
+module diag12480;
+
+static immutable arr = ["a", "b"];
+static assert(arr.length == 3);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12487.d b/gcc/testsuite/gdc.test/fail_compilation/diag12487.d
new file mode 100644
index 00000000000..b9193231e8a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12487.d
@@ -0,0 +1,28 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12487.d(15): Error: recursive expansion of template instance 'diag12487.recTemplate!int'
+fail_compilation/diag12487.d(25): Error: template instance diag12487.recTemplate!int error instantiating
+fail_compilation/diag12487.d(18): Error: function diag12487.recFunction CTFE recursion limit exceeded
+fail_compilation/diag12487.d(20):        called from here: recFunction(i)
+fail_compilation/diag12487.d(18):        1000 recursive calls to function recFunction
+fail_compilation/diag12487.d(27):        called from here: recFunction(0)
+---
+*/
+
+template recTemplate(T)
+{
+    enum bool recTemplate = recTemplate!T;
+}
+
+bool recFunction(int i)
+{
+    return recFunction(i);
+}
+
+void main()
+{
+    enum bool value1 = recTemplate!int;
+
+    enum bool value2 = recFunction(0);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12598.d b/gcc/testsuite/gdc.test/fail_compilation/diag12598.d
new file mode 100644
index 00000000000..236692d3866
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12598.d
@@ -0,0 +1,22 @@
+/*
+REQUIRED_ARGS: -transition=import
+TEST_OUTPUT:
+---
+fail_compilation/diag12598.d(14): Error: struct 'lines' is a type, not an lvalue
+---
+*/
+
+class C
+{
+    void f()
+    {
+        import imports.diag12598a;
+        lines ~= "";
+    }
+
+    string[] lines;
+}
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12640.d b/gcc/testsuite/gdc.test/fail_compilation/diag12640.d
new file mode 100644
index 00000000000..7b63e139a15
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12640.d
@@ -0,0 +1,30 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12640.d(14): Error: undefined identifier 'asdf'
+fail_compilation/diag12640.d(23): Error: undefined identifier 'asdf'
+---
+*/
+
+void main()
+{
+    switch (1)
+    {
+        case 0:
+            asdf;
+            break;
+
+        default:
+    }
+
+    switch (1)
+    {
+        default:
+            asdf;
+            break;
+
+        case 0:
+    }
+
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12678.d b/gcc/testsuite/gdc.test/fail_compilation/diag12678.d
new file mode 100644
index 00000000000..afe56fb51b3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12678.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12678.d(19): Error: const field 'cf1' initialized multiple times
+fail_compilation/diag12678.d(22): Error: immutable field 'if1' initialized multiple times
+fail_compilation/diag12678.d(25): Error: const field 'cf2' initialization is not allowed in loops or after labels
+---
+*/
+
+struct S
+{
+    const int cf1;
+    const int cf2;
+    immutable int if1;
+
+    this(int x)
+    {
+        cf1 = x;
+        cf1 = x;
+
+        if1 = x;
+        if1 = x;
+
+        foreach (i; 0 .. 5)
+            cf2 = x;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12777.d b/gcc/testsuite/gdc.test/fail_compilation/diag12777.d
new file mode 100644
index 00000000000..95ce80f5a53
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12777.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12777.d(14): Error: cannot modify const expression this.v
+fail_compilation/diag12777.d(15): Error: cannot modify immutable expression this.v
+fail_compilation/diag12777.d(21): Error: cannot modify const expression this.v
+fail_compilation/diag12777.d(22): Error: cannot modify immutable expression this.v
+---
+*/
+
+struct S
+{
+    int v;
+    void fun() const     { v++; }
+    void gun() immutable { v++; }
+}
+
+class C
+{
+    int v;
+    void fun() const     { v++; }
+    void gun() immutable { v++; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12829.d b/gcc/testsuite/gdc.test/fail_compilation/diag12829.d
new file mode 100644
index 00000000000..dcaa9f04b82
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag12829.d
@@ -0,0 +1,37 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag12829.d(12): Error: function diag12829.test1 is @nogc yet allocates closures with the GC
+fail_compilation/diag12829.d(15):        diag12829.test1.__lambda1 closes over variable x at fail_compilation/diag12829.d(14)
+fail_compilation/diag12829.d(19):        diag12829.test1.bar closes over variable x at fail_compilation/diag12829.d(14)
+fail_compilation/diag12829.d(26): Error: function diag12829.test2 is @nogc yet allocates closures with the GC
+fail_compilation/diag12829.d(31):        diag12829.test2.S.foo closes over variable x at fail_compilation/diag12829.d(28)
+---
+*/
+
+auto test1() @nogc
+{
+    int x;
+    void delegate() @nogc foo = () {
+        int y = x;
+    };
+
+    void bar()
+    {
+        int y = x;
+    }
+    auto dg = &bar;
+}
+
+auto test2() @nogc
+{
+    int x;
+    struct S
+    {
+        void foo()
+        {
+            int y = x;
+        }
+    }
+    return S();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13028.d b/gcc/testsuite/gdc.test/fail_compilation/diag13028.d
new file mode 100644
index 00000000000..2889941fec6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13028.d
@@ -0,0 +1,30 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13028.d(15): Error: variable dg cannot be read at compile time
+fail_compilation/diag13028.d(22): Error: variable a cannot be read at compile time
+fail_compilation/diag13028.d(28): Error: CTFE failed because of previous errors in foo
+fail_compilation/diag13028.d(28):        while evaluating: static assert(foo(() => 1) == 1)
+fail_compilation/diag13028.d(29): Error: CTFE failed because of previous errors in bar
+fail_compilation/diag13028.d(29):        while evaluating: static assert(bar(delegate int() => 1) == 1)
+---
+*/
+
+int foo(int delegate() dg)
+{
+    enum b = dg();
+    return b;
+}
+
+
+int bar(lazy int a)
+{
+    enum b = a;
+    return a;
+}
+
+void main()
+{
+    static assert(foo(() => 1) == 1);
+    static assert(bar(1) == 1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13082.d b/gcc/testsuite/gdc.test/fail_compilation/diag13082.d
new file mode 100644
index 00000000000..13259cef004
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13082.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13082.d(22): Error: constructor diag13082.C.this (int a) is not callable using argument types (string)
+fail_compilation/diag13082.d(23): Error: constructor diag13082.S.this (int a) is not callable using argument types (string)
+---
+*/
+
+class C
+{
+    this(int a) {}
+}
+
+struct S
+{
+    this(int a) {}
+}
+
+void main()
+{
+    string b;
+    auto c = new C(b);
+    auto s = new S(b);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13142.d b/gcc/testsuite/gdc.test/fail_compilation/diag13142.d
new file mode 100644
index 00000000000..abcf1b401fc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13142.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13142.d(25): Error: cannot implicitly convert expression (3) of type int to TYPE
+---
+*/
+
+class Button
+{
+    enum TYPE // button type
+    {
+        COMMAND,
+        CHECK,
+        OPTION,
+    }
+}
+
+class Toolbar
+{
+    enum ButtonTYPE // button type
+    {
+        COMMAND   = Button.TYPE.COMMAND,
+        CHECK     = Button.TYPE.CHECK,
+        OPTION    = Button.TYPE.OPTION,
+        DELIMETER = Button.TYPE.max + 1
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13281.d b/gcc/testsuite/gdc.test/fail_compilation/diag13281.d
new file mode 100644
index 00000000000..49d6cbff6ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13281.d
@@ -0,0 +1,32 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13281.d(20): Error: cannot implicitly convert expression (123) of type int to string
+fail_compilation/diag13281.d(21): Error: cannot implicitly convert expression (123u) of type uint to string
+fail_compilation/diag13281.d(22): Error: cannot implicitly convert expression (123L) of type long to string
+fail_compilation/diag13281.d(23): Error: cannot implicitly convert expression (123LU) of type ulong to string
+fail_compilation/diag13281.d(24): Error: cannot implicitly convert expression (123.4) of type double to int
+fail_compilation/diag13281.d(25): Error: cannot implicitly convert expression (123.4F) of type float to int
+fail_compilation/diag13281.d(26): Error: cannot implicitly convert expression (123.4L) of type real to int
+fail_compilation/diag13281.d(27): Error: cannot implicitly convert expression (123.4i) of type idouble to int
+fail_compilation/diag13281.d(28): Error: cannot implicitly convert expression (123.4Fi) of type ifloat to int
+fail_compilation/diag13281.d(29): Error: cannot implicitly convert expression (123.4Li) of type ireal to int
+fail_compilation/diag13281.d(30): Error: cannot implicitly convert expression ((123.4+5.6i)) of type cdouble to int
+fail_compilation/diag13281.d(31): Error: cannot implicitly convert expression ((123.4F+5.6Fi)) of type cfloat to int
+fail_compilation/diag13281.d(32): Error: cannot implicitly convert expression ((123.4L+5.6Li)) of type creal to int
+---
+*/
+
+string x1 = 123;
+string x2 = 123u;
+string x3 = 123L;
+string x4 = 123uL;
+int y1 = 123.4;
+int y2 = 123.4f;
+int y3 = 123.4L;
+int y4 = 123.4i;
+int y5 = 123.4fi;
+int y6 = 123.4Li;
+int y7 = 123.4 +5.6i;
+int y8 = 123.4f+5.6fi;
+int y9 = 123.4L+5.6Li;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13320.d b/gcc/testsuite/gdc.test/fail_compilation/diag13320.d
new file mode 100644
index 00000000000..46a00320aaa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13320.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13320.d(13): Error: 'f += 1' is not a scalar, it is a Foo
+---
+*/
+
+struct Foo {}
+
+void main()
+{
+    Foo f;
+    ++f;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13333.d b/gcc/testsuite/gdc.test/fail_compilation/diag13333.d
new file mode 100644
index 00000000000..f318a31ae72
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13333.d
@@ -0,0 +1,40 @@
+/*
+TEST_OUTPUT*
+---
+fail_compilation/diag13333.d(29): Error: template instance VariantN!(maxSize!(S), T) recursive template expansion
+fail_compilation/diag13333.d(29): Error: template instance diag13333.maxSize!(S) error instantiating
+fail_compilation/diag13333.d(34):        instantiated from here: Algebraic!(S)
+---
+*/
+
+template maxSize(T...)
+{
+    static if (T.length == 1)
+    {
+        enum size_t maxSize = T[0].sizeof;
+    }
+    else
+    {
+        enum size_t maxSize = T[0].sizeof >= maxSize!(T[1 .. $])
+            ? T[0].sizeof : maxSize!(T[1 .. $]);
+    }
+}
+
+struct VariantN(size_t maxDataSize, AllowedTypesX...)
+{
+}
+
+template Algebraic(T...)
+{
+    alias Algebraic = VariantN!(maxSize!T, T);
+}
+
+struct DummyScope
+{
+    alias A = Algebraic!S;
+
+    static struct S     // <- class
+    {
+        A entity;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13528.d b/gcc/testsuite/gdc.test/fail_compilation/diag13528.d
new file mode 100644
index 00000000000..493cbc7fff3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13528.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13528.d(13): Error: value of 'this' is not known at compile time
+fail_compilation/diag13528.d(13):        while evaluating pragma(msg, __traits(getMember, A, "foo"))
+---
+*/
+
+mixin template MyTemplate()
+{
+    void foo()
+    {
+        pragma(msg, __traits(getMember, typeof(this), "foo"));
+    }
+}
+
+class A
+{
+    mixin MyTemplate;
+}
+
+void main()
+{
+    auto a = new A();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13609a.d b/gcc/testsuite/gdc.test/fail_compilation/diag13609a.d
new file mode 100644
index 00000000000..de37630aff4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13609a.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13609a.d(11): Error: } expected following members in class declaration at fail_compilation/diag13609a.d(8)
+---
+*/
+
+class C
+{
+    void foo() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13609b.d b/gcc/testsuite/gdc.test/fail_compilation/diag13609b.d
new file mode 100644
index 00000000000..b92374e13e7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13609b.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13609b.d(9): Error: { } expected following struct declaration
+fail_compilation/diag13609b.d(9): Error: declaration expected, not ':'
+---
+*/
+
+struct S :
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13787.d b/gcc/testsuite/gdc.test/fail_compilation/diag13787.d
new file mode 100644
index 00000000000..99162edc144
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13787.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13787.d(12): Error: cannot slice function pointer & main
+fail_compilation/diag13787.d(13): Error: cannot index function pointer & main
+---
+*/
+
+void main()
+{
+    auto a = (&main)[0..1];
+    auto x = (&main)[0];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13884.d b/gcc/testsuite/gdc.test/fail_compilation/diag13884.d
new file mode 100644
index 00000000000..71909e28869
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13884.d
@@ -0,0 +1,34 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13884.d(14): Error: functions cannot return a tuple
+fail_compilation/diag13884.d(21):        instantiated from here: MapResult!((t) => t.tupleof, Foo[])
+fail_compilation/diag13884.d(14):        instantiated from here: map!(Foo[])
+---
+*/
+
+struct Foo { int x; }
+
+void main()
+{
+    [Foo(1)].map!(t => t.tupleof);
+}
+
+template map(fun...)
+{
+    auto map(Range)(Range r)
+    {
+        return MapResult!(fun, Range)(r);
+    }
+}
+
+struct MapResult(alias fun, R)
+{
+    R _input;
+
+    @property auto ref front()
+    {
+        return fun(_input[0]);
+    }
+
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13942.d b/gcc/testsuite/gdc.test/fail_compilation/diag13942.d
new file mode 100644
index 00000000000..6ad99c65b67
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag13942.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag13942.d(18): Error: template instance isRawStaticArray!() does not match template declaration isRawStaticArray(T, A...)
+fail_compilation/diag13942.d(26): Error: template diag13942.to cannot deduce function from argument types !(double)(), candidates are:
+fail_compilation/diag13942.d(15):        diag13942.to(T)
+---
+*/
+
+template isRawStaticArray(T, A...)
+{
+    enum isRawStaticArray = false;
+}
+
+template to(T)
+{
+    T to(A...)(A args)
+        if (!isRawStaticArray!A)
+    {
+        return 0;
+    }
+}
+
+void main(string[] args)
+{
+    auto t = to!double();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag14102.d b/gcc/testsuite/gdc.test/fail_compilation/diag14102.d
new file mode 100644
index 00000000000..c142b9727f5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag14102.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag14102.d(14): Error: -x is not an lvalue
+fail_compilation/diag14102.d(15): Error: -(x -= 1) is not an lvalue
+fail_compilation/diag14102.d(16): Error: -(x -= 1 -= 1) is not an lvalue
+fail_compilation/diag14102.d(17): Error: -(x -= 1 -= 1 -= 1) is not an lvalue
+---
+*/
+
+int main()
+{
+    int x;
+    return -- -x;           // error: -x is not an lvalue
+    return -- - --x;        // error: -(x -= 1) is not an lvalue
+    return -- - -- --x;     // error: -((x -= 1 , x) -= 1) is not an lvalue
+    return -- - -- -- --x;  // error: -((ref int __assignop1 = x -= 1 , __assignop1 = x; , __assignop1 -= 1 , __assignop1) -= 1) is not an lvalue
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag14163.d b/gcc/testsuite/gdc.test/fail_compilation/diag14163.d
new file mode 100644
index 00000000000..8fe63433eb6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag14163.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag14163.d(16): Error: constructor diag14163.Bar.this cannot call super() implicitly because it is annotated with @disable
+---
+*/
+
+class Foo
+{
+    @disable this();
+}
+
+class Bar : Foo
+{
+    @disable this();
+    this(int i) {}
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag14235.d b/gcc/testsuite/gdc.test/fail_compilation/diag14235.d
new file mode 100644
index 00000000000..4880bdf3e05
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag14235.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag14235.d(11): Error: template identifier 'Undefined' is not a member of module 'imports.a14235'
+fail_compilation/diag14235.d(12): Error: template identifier 'Something' is not a member of module 'imports.a14235', did you mean struct 'SomeThing(T...)'?
+fail_compilation/diag14235.d(13): Error: imports.a14235.SomeClass is not a template, it is a class
+---
+*/
+
+import imports.a14235;
+imports.a14235.Undefined!Object a;
+imports.a14235.Something!Object b;
+imports.a14235.SomeClass!Object c;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag14818.d b/gcc/testsuite/gdc.test/fail_compilation/diag14818.d
new file mode 100644
index 00000000000..4eef7487692
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag14818.d
@@ -0,0 +1,37 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag14818.d(34): Error: none of the overloads of 'func' are callable using argument types (string), candidates are:
+fail_compilation/diag14818.d(12):        diag14818.foo(int _param_0)
+fail_compilation/diag14818.d(13):        diag14818.bar(double _param_0)
+fail_compilation/diag14818.d(35): Error: overload alias diag14818.X does not match any template declaration
+fail_compilation/diag14818.d(36): Error: overloadset diag14818.M does not match any template declaration
+---
+*/
+
+void foo(int) {}
+void bar(double) {}
+alias func = foo;
+alias func = bar;
+// in here, func is a FuncAliasDeclaration;
+
+template Foo(T) if (is(T == int)) {}
+template Bar(T) if (is(T == double)) {}
+
+alias X = Foo;
+alias X = Bar;
+// in here, X is an OverDeclaration
+
+template Mix1() { alias M = Foo; }
+template Mix2() { alias M = Bar; }
+mixin Mix1;
+mixin Mix2;
+alias Y = M;
+// in here, Y is an OverloadSet
+
+void main()
+{
+    func("abc");
+    alias x = X!string;
+    alias y = Y!string;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag14875.d b/gcc/testsuite/gdc.test/fail_compilation/diag14875.d
new file mode 100644
index 00000000000..6a6ef988fb3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag14875.d
@@ -0,0 +1,76 @@
+// REQUIRED_ARGS: -o-
+
+deprecated class Dep { }
+deprecated immutable int depVar = 10;
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag14875.d(16): Deprecation: class diag14875.Dep is deprecated
+1: Dep
+2: Dep
+3: Dep
+---
+*/
+
+alias X = Foo!Dep;              // deprecation
+
+template Foo(T)
+{
+    pragma(msg, "1: ", T);      // no message
+    enum Foo = cast(void*)Bar!T;
+}
+template Bar(T)
+{
+    pragma(msg, "2: ", T);      // no message
+    enum Bar = &Baz!T;
+}
+template Baz(T)
+{
+    pragma(msg, "3: ", T);      // no message
+    immutable Baz = 1234;
+}
+
+// ---
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag14875.d(47): Deprecation: class diag14875.Dep is deprecated
+fail_compilation/diag14875.d(51): Deprecation: variable diag14875.depVar is deprecated
+4: Dep
+fail_compilation/diag14875.d(58): Deprecation: variable diag14875.depVar is deprecated
+fail_compilation/diag14875.d(59): Deprecation: variable diag14875.Vaz!(Dep).Vaz is deprecated
+---
+*/
+
+alias Y = Voo!Dep;              // deprecation
+
+template Voo(T)
+{
+    enum n = depVar;            // deprecation
+    struct A { alias B = T; }   // no message
+    pragma(msg, "4: ", A.B);    // B is not deprecated
+    enum Voo = cast(void*)Var!T;
+}
+template Var(T)
+{
+    enum n = depVar;            // deprecation
+    enum Var = &Vaz!T;          // deprecation
+}
+deprecated template Vaz(T)
+{
+    enum n = depVar;            // no message
+    immutable Vaz = 1234;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag14875.d(75): Error: static assert  (0) is false
+---
+*/
+void main()
+{
+    static assert(0);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag14876.d b/gcc/testsuite/gdc.test/fail_compilation/diag14876.d
new file mode 100644
index 00000000000..dcc440f003b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag14876.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag14876.d(17): Deprecation: class diag14876.Dep is deprecated
+fail_compilation/diag14876.d(18): Deprecation: class diag14876.Dep is deprecated
+fail_compilation/diag14876.d(19): Deprecation: class diag14876.Dep is deprecated
+fail_compilation/diag14876.d(20): Deprecation: class diag14876.Dep is deprecated
+fail_compilation/diag14876.d(21): Deprecation: class diag14876.Dep is deprecated
+fail_compilation/diag14876.d(22): Deprecation: class diag14876.Dep is deprecated
+fail_compilation/diag14876.d(23): Deprecation: class diag14876.Dep is deprecated
+fail_compilation/diag14876.d(23): Error: can only slice tuple types, not diag14876.Dep
+---
+*/
+
+deprecated class Dep { class Mem {} }
+
+alias X1 = Foo!(Dep[]);
+alias X2 = Foo!(Dep[1]);
+alias X3 = Foo!(Dep[int]);
+alias X4 = Foo!(int[Dep]);
+alias X5 = Foo!(Dep*);
+alias X6 = Foo!(Dep.Mem);
+alias X7 = Foo!(Dep[3..4]);
+
+template Foo(T) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag15209.d b/gcc/testsuite/gdc.test/fail_compilation/diag15209.d
new file mode 100644
index 00000000000..341e02653b3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag15209.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag15209.d(18): Error: need 'this' for 'x' of type 'int'
+fail_compilation/diag15209.d(21): Error: need 'this' for 'x' of type 'int'
+---
+*/
+
+class C1 { int x; }
+struct S1 { alias y = C1.x; }
+
+struct S2 { int x; }
+class C2 { alias y = S2.x; }
+
+void main()
+{
+    S1 s1;
+    s1.y = 10;  // invalid field variable access
+
+    auto c2 = new C2();
+    c2.y = 10;  // invalid field variable access
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag15340.d b/gcc/testsuite/gdc.test/fail_compilation/diag15340.d
new file mode 100644
index 00000000000..624246dc411
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag15340.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag15340.d(11): Error: undefined identifier 'undef1'
+fail_compilation/diag15340.d(12): Error: undefined identifier 'undef2'
+---
+*/
+
+class C
+{
+    auto a = undef1;
+    auto b = undef2;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag15411.d b/gcc/testsuite/gdc.test/fail_compilation/diag15411.d
new file mode 100644
index 00000000000..bc77d81a8ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag15411.d
@@ -0,0 +1,15 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag15411.d(13): Error: function diag15411.test15411.__funcliteral1 cannot access frame of function diag15411.test15411
+fail_compilation/diag15411.d(14): Error: function diag15411.test15411.__funcliteral2 cannot access frame of function diag15411.test15411
+---
+*/
+
+void test15411()
+{
+    auto i = 0;
+    auto j = (function() { return i; })();
+    auto f =  function() { return i; };
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag1566.d b/gcc/testsuite/gdc.test/fail_compilation/diag1566.d
new file mode 100644
index 00000000000..28ffc8d48d5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag1566.d
@@ -0,0 +1,30 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag1566.d(23): Error: multiple ! arguments are not allowed
+fail_compilation/diag1566.d(24): Error: multiple ! arguments are not allowed
+fail_compilation/diag1566.d(25): Error: multiple ! arguments are not allowed
+fail_compilation/diag1566.d(26): Error: multiple ! arguments are not allowed
+fail_compilation/diag1566.d(28): Error: multiple ! arguments are not allowed
+fail_compilation/diag1566.d(29): Error: multiple ! arguments are not allowed
+---
+*/
+
+template T(int n)
+{
+    template T(char c)
+    {
+        alias long T;
+    }
+}
+
+void main()
+{
+    static assert(is(long == T!(3)!('b')));
+    static assert(is(long == T! 3 ! 'b' ));
+    static assert(is(long == T!(3)! 'b' ));
+    static assert(is(long == T! 3 !('b')));
+
+    static assert(is(long == T!(3)! 'b' !"s"));
+    static assert(is(long == T! 3 !('b')!"s"));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag15713.d b/gcc/testsuite/gdc.test/fail_compilation/diag15713.d
new file mode 100644
index 00000000000..14f2d8432b4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag15713.d
@@ -0,0 +1,49 @@
+/*
+---
+fail_compilation/diag15713.d(18): Error: no property 'widthSign' for type 'Data'
+fail_compilation/diag15713.d(38): Error: template instance test.conwritefImpl!("parse-int", "width", "\x0a", Data()) error instantiating
+fail_compilation/diag15713.d(43):        instantiated from here: conwritefImpl!("main", "\x0a", Data())
+fail_compilation/diag15713.d(48):        instantiated from here: fdwritef!()
+---
+*/
+
+void wrWriteWidthChar() {}
+
+auto WrData(int , int )
+{
+    struct Data
+    {
+        auto initInt(string name)()
+        {
+            __traits(getMember, this, name ~ "Sign");
+        }
+    }
+    return Data();
+}
+
+template conwritefImpl(string state, string field, string fmt, alias data, AA...)
+if (state == "parse-int")
+{
+    enum conwritefImpl = data.initInt!field;
+}
+
+template baz(string state, string fmt, alias data, AA...) {}
+template bar(string state, string fmt, alias data, AA...) {}
+
+    enum a = "parse-format";
+
+template conwritefImpl(string state, string fmt, alias data, AA...)
+if (state == "main")
+{
+    enum conwritefImpl = conwritefImpl!("parse-int", "width", fmt, data);
+}
+
+void fdwritef()()
+{
+    conwritefImpl!("main", "\n", WrData(0, 0));
+}
+
+void conwriteln()
+{
+    fdwritef();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag1730.d b/gcc/testsuite/gdc.test/fail_compilation/diag1730.d
new file mode 100644
index 00000000000..697cd5af294
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag1730.d
@@ -0,0 +1,90 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag1730.d(38): Error: mutable method diag1730.S.func is not callable using a inout object
+fail_compilation/diag1730.d(40): Error: immutable method diag1730.S.iFunc is not callable using a inout object
+fail_compilation/diag1730.d(41): Error: shared mutable method diag1730.S.sFunc is not callable using a non-shared inout object
+fail_compilation/diag1730.d(42): Error: shared const method diag1730.S.scFunc is not callable using a non-shared inout object
+fail_compilation/diag1730.d(57): Error: immutable method diag1730.S.iFunc is not callable using a mutable object
+fail_compilation/diag1730.d(58): Error: shared method diag1730.S.sFunc is not callable using a non-shared object
+fail_compilation/diag1730.d(59): Error: shared const method diag1730.S.scFunc is not callable using a non-shared mutable object
+fail_compilation/diag1730.d(62): Error: mutable method diag1730.S.func is not callable using a const object
+fail_compilation/diag1730.d(64): Error: immutable method diag1730.S.iFunc is not callable using a const object
+fail_compilation/diag1730.d(65): Error: shared mutable method diag1730.S.sFunc is not callable using a non-shared const object
+fail_compilation/diag1730.d(66): Error: shared const method diag1730.S.scFunc is not callable using a non-shared const object
+fail_compilation/diag1730.d(69): Error: mutable method diag1730.S.func is not callable using a immutable object
+fail_compilation/diag1730.d(72): Error: shared mutable method diag1730.S.sFunc is not callable using a immutable object
+fail_compilation/diag1730.d(76): Error: non-shared method diag1730.S.func is not callable using a shared object
+fail_compilation/diag1730.d(77): Error: non-shared const method diag1730.S.cFunc is not callable using a shared mutable object
+fail_compilation/diag1730.d(78): Error: immutable method diag1730.S.iFunc is not callable using a shared mutable object
+fail_compilation/diag1730.d(81): Error: non-shared inout method diag1730.S.wFunc is not callable using a shared mutable object
+fail_compilation/diag1730.d(83): Error: non-shared mutable method diag1730.S.func is not callable using a shared const object
+fail_compilation/diag1730.d(84): Error: non-shared const method diag1730.S.cFunc is not callable using a shared const object
+fail_compilation/diag1730.d(85): Error: immutable method diag1730.S.iFunc is not callable using a shared const object
+fail_compilation/diag1730.d(86): Error: shared mutable method diag1730.S.sFunc is not callable using a shared const object
+fail_compilation/diag1730.d(88): Error: non-shared inout method diag1730.S.wFunc is not callable using a shared const object
+---
+*/
+struct S
+{
+    void func() { }
+    void cFunc() const { }
+    void iFunc() immutable { }
+    void sFunc() shared { }
+    void scFunc() shared const { }
+    void wFunc() inout { }
+    static void test(inout(S) s)
+    {
+        s.func();   // ng
+        s.cFunc();
+        s.iFunc();  // ng
+        s.sFunc();  // ng
+        s.scFunc(); // ng
+        s.wFunc();
+    }
+}
+
+void main()
+{
+    S obj;
+    const(S) cObj;
+    immutable(S) iObj;
+    shared(S) sObj;
+    shared(const(S)) scObj;
+
+    obj.func();
+    obj.cFunc();
+    obj.iFunc();   // ng
+    obj.sFunc();   // ng
+    obj.scFunc();  // ng
+    obj.wFunc();
+
+    cObj.func();   // ng
+    cObj.cFunc();
+    cObj.iFunc();  // ng
+    cObj.sFunc();  // ng
+    cObj.scFunc(); // ng
+    cObj.wFunc();
+
+    iObj.func();   // ng
+    iObj.cFunc();
+    iObj.iFunc();
+    iObj.sFunc();  // ng
+    iObj.scFunc();
+    iObj.wFunc();
+
+    sObj.func();   // ng
+    sObj.cFunc();  // ng
+    sObj.iFunc();  // ng
+    sObj.sFunc();
+    sObj.scFunc();
+    sObj.wFunc();  // ng
+
+    scObj.func();  // ng
+    scObj.cFunc(); // ng
+    scObj.iFunc(); // ng
+    scObj.sFunc(); // ng
+    scObj.scFunc();
+    scObj.wFunc(); // ng
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag2452.d b/gcc/testsuite/gdc.test/fail_compilation/diag2452.d
new file mode 100644
index 00000000000..0c12e801531
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag2452.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag2452.d(14): Error: class diag2452.C interface function 'void f(float p)' is not implemented
+---
+*/
+
+interface I
+{
+    void f(int p);
+    void f(float p);
+}
+
+class C : I
+{
+    void f(int p) { }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag3013.d b/gcc/testsuite/gdc.test/fail_compilation/diag3013.d
new file mode 100644
index 00000000000..c57b4b9c84b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag3013.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag3013.d(11): Error: cannot pass type string as a function argument
+---
+*/
+
+int format(string, string, string);
+
+void main() {
+    int s = string.format("abc", "def");
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag3438.d b/gcc/testsuite/gdc.test/fail_compilation/diag3438.d
new file mode 100644
index 00000000000..813560ee118
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag3438.d
@@ -0,0 +1,21 @@
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag3438.d(16): Deprecation: constructor diag3438.F1.this all parameters have default arguments, but structs cannot have default constructors.
+fail_compilation/diag3438.d(17): Deprecation: constructor diag3438.F2.this all parameters have default arguments, but structs cannot have default constructors.
+fail_compilation/diag3438.d(20): Deprecation: constructor diag3438.F5.this @disable'd constructor cannot have default arguments for all parameters.
+fail_compilation/diag3438.d(20): Deprecation: Use @disable this(); if you want to disable default initialization.
+fail_compilation/diag3438.d(21): Deprecation: constructor diag3438.F6.this @disable'd constructor cannot have default arguments for all parameters.
+fail_compilation/diag3438.d(21): Deprecation: Use @disable this(); if you want to disable default initialization.
+---
+*/
+
+import core.vararg;
+
+struct F1 { this(int x = 1) { } }
+struct F2 { this(int x = 1, ...) { } }
+struct F3 { this(...) { } } // ok
+struct F4 { this(int[] x...) { } }  // ok
+struct F5 { @disable this(int x = 1); }
+struct F6 { @disable this(int x = 1) { } }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag3438b.d b/gcc/testsuite/gdc.test/fail_compilation/diag3438b.d
new file mode 100644
index 00000000000..98dae44584c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag3438b.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag3438b.d(9): Error: default argument expected for y
+---
+*/
+
+// Make sure the deprecation doesn't interfere w/ the check for default arguments
+struct S { this(int x = 1, int y) { } }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag3672.d b/gcc/testsuite/gdc.test/fail_compilation/diag3672.d
new file mode 100644
index 00000000000..ab3c2248c94
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag3672.d
@@ -0,0 +1,57 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag3672.d(36): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(x, 1) instead.
+fail_compilation/diag3672.d(37): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(x, 1) instead.
+fail_compilation/diag3672.d(38): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"-="(x, 1) instead.
+fail_compilation/diag3672.d(39): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"-="(x, 1) instead.
+fail_compilation/diag3672.d(40): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(x, 1) instead.
+fail_compilation/diag3672.d(41): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(x, 2) instead.
+fail_compilation/diag3672.d(42): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"-="(x, 3) instead.
+fail_compilation/diag3672.d(43): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"|="(x, y) instead.
+fail_compilation/diag3672.d(44): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"*="(x, y) instead.
+fail_compilation/diag3672.d(45): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"/="(x, y) instead.
+fail_compilation/diag3672.d(46): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"%="(x, y) instead.
+fail_compilation/diag3672.d(47): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"&="(x, y) instead.
+fail_compilation/diag3672.d(48): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"^="(x, y) instead.
+fail_compilation/diag3672.d(49): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"<<="(x, y) instead.
+fail_compilation/diag3672.d(50): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!">>="(x, y) instead.
+fail_compilation/diag3672.d(51): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!">>>="(x, y) instead.
+fail_compilation/diag3672.d(52): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"^^="(x, y) instead.
+fail_compilation/diag3672.d(53): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(ptr, 1) instead.
+fail_compilation/diag3672.d(54): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(ptr, 1) instead.
+fail_compilation/diag3672.d(55): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"-="(ptr, 1) instead.
+fail_compilation/diag3672.d(56): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"-="(ptr, 1) instead.
+---
+*/
+shared int x;
+shared int y;
+shared int* ptr;
+shared static this() { ptr = new int; } // silence null-dereference errors
+
+void main()
+{
+    ++x;
+    x++;
+    --x;
+    x--;
+    x += 1;
+    x += 2;
+    x -= 3;
+    x |= y;
+    x *= y;
+    x /= y;
+    x %= y;
+    x &= y;
+    x ^= y;
+    x <<= y;
+    x >>= y;
+    x >>>= y;
+    x ^^= y;
+    ++ptr;
+    ptr++;
+    --ptr;
+    ptr--;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag3672a.d b/gcc/testsuite/gdc.test/fail_compilation/diag3672a.d
new file mode 100644
index 00000000000..6c9f701c9b2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag3672a.d
@@ -0,0 +1,34 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag3672a.d(16): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(ns.x, 1) instead.
+fail_compilation/diag3672a.d(18): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(s.sx, 1) instead.
+---
+*/
+class NS { shared int x; }
+shared class S { int sx; }
+
+void main()
+{
+    NS ns = new NS;
+    ns.x++;
+    S s = new S;
+    s.sx++;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag3672a.d(32): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(s.var, 1) instead.
+fail_compilation/diag3672a.d(33): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"-="(s.var, 2) instead.
+---
+*/
+void test13003()
+{
+    struct S { int var; }
+    shared S s;
+    s.var++;
+    s.var -= 2;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag3673.d b/gcc/testsuite/gdc.test/fail_compilation/diag3673.d
new file mode 100644
index 00000000000..ead542d6f1b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag3673.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag3673.d(9): Error: members expected
+---
+*/
+
+class A {}
+class B(T) if(false) : A if (true) { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag3869.d b/gcc/testsuite/gdc.test/fail_compilation/diag3869.d
new file mode 100644
index 00000000000..62e8993fc48
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag3869.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag3869.d(10): Error: template instance diag3869.sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!(sum!int)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) recursive expansion
+---
+*/
+
+struct sum(A)
+{
+    auto blah(int a) { return .sum!(sum)(); }
+}
+
+sum!(int) z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag3913.d b/gcc/testsuite/gdc.test/fail_compilation/diag3913.d
new file mode 100644
index 00000000000..e176e9dc207
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag3913.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag3913.d(12): Error: no property 'foobardoo' for type 'Foo'
+fail_compilation/diag3913.d(13): Error: no property 'secon' for type 'Foo'. Did you mean 'Foo.second' ?
+---
+*/
+
+void main()
+{
+    enum Foo { first, second }
+    auto a = Foo.foobardoo;
+    auto b = Foo.secon;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag4479.d b/gcc/testsuite/gdc.test/fail_compilation/diag4479.d
new file mode 100644
index 00000000000..553f9efdd87
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag4479.d
@@ -0,0 +1,11 @@
+// EXTRA_SOURCES: imports/fail4479.d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag4479.d(10): Error: module imports.fail4479mod from file fail_compilation/imports/fail4479.d must be imported with 'import imports.fail4479mod;'
+---
+*/
+
+module diag4479;
+import imports.fail4479;
+void main() { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag4528.d b/gcc/testsuite/gdc.test/fail_compilation/diag4528.d
new file mode 100644
index 00000000000..accadbcad88
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag4528.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag4528.d(14): Error: function diag4528.Foo.pva private functions cannot be abstract
+fail_compilation/diag4528.d(15): Error: function diag4528.Foo.pka package functions cannot be abstract
+fail_compilation/diag4528.d(16): Error: function diag4528.Foo.pvsa static functions cannot be abstract
+fail_compilation/diag4528.d(17): Error: function diag4528.Foo.pksa static functions cannot be abstract
+fail_compilation/diag4528.d(18): Error: function diag4528.Foo.pbsa static functions cannot be abstract
+---
+*/
+
+class Foo
+{
+    private abstract void pva();
+    package abstract void pka();
+    private static abstract void pvsa();
+    package static abstract void pksa();
+    public static abstract void pbsa();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag4540.d b/gcc/testsuite/gdc.test/fail_compilation/diag4540.d
new file mode 100644
index 00000000000..bcdd639e654
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag4540.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag4540.d(4): Error: 'x' must be of integral or string type, it is a float
+---
+*/
+
+#line 1
+void main()
+{
+    float x;
+    switch (x)
+    {
+        default:
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag4596.d b/gcc/testsuite/gdc.test/fail_compilation/diag4596.d
new file mode 100644
index 00000000000..368f67ec439
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag4596.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag4596.d(15): Error: this is not an lvalue
+fail_compilation/diag4596.d(16): Error: 1 ? this : this is not an lvalue
+fail_compilation/diag4596.d(18): Error: super is not an lvalue
+fail_compilation/diag4596.d(19): Error: 1 ? super : super is not an lvalue
+---
+*/
+
+class NoGo4596
+{
+    void fun()
+    {
+        this = new NoGo4596;
+        (1?this:this) = new NoGo4596;
+
+        super = new Object;
+        (1?super:super) = new Object;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag5385.d b/gcc/testsuite/gdc.test/fail_compilation/diag5385.d
new file mode 100644
index 00000000000..4dce28c7f5d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag5385.d
@@ -0,0 +1,36 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag5385.d(3): Deprecation: imports.fail5385.C.privX is not visible from module diag5385
+fail_compilation/diag5385.d(3): Error: class imports.fail5385.C member privX is not accessible
+fail_compilation/diag5385.d(4): Deprecation: imports.fail5385.C.packX is not visible from module diag5385
+fail_compilation/diag5385.d(4): Error: class imports.fail5385.C member packX is not accessible
+fail_compilation/diag5385.d(5): Deprecation: imports.fail5385.C.privX2 is not visible from module diag5385
+fail_compilation/diag5385.d(5): Error: class imports.fail5385.C member privX2 is not accessible
+fail_compilation/diag5385.d(6): Deprecation: imports.fail5385.C.packX2 is not visible from module diag5385
+fail_compilation/diag5385.d(6): Error: class imports.fail5385.C member packX2 is not accessible
+fail_compilation/diag5385.d(7): Deprecation: imports.fail5385.S.privX is not visible from module diag5385
+fail_compilation/diag5385.d(7): Error: struct imports.fail5385.S member privX is not accessible
+fail_compilation/diag5385.d(8): Deprecation: imports.fail5385.S.packX is not visible from module diag5385
+fail_compilation/diag5385.d(8): Error: struct imports.fail5385.S member packX is not accessible
+fail_compilation/diag5385.d(9): Deprecation: imports.fail5385.S.privX2 is not visible from module diag5385
+fail_compilation/diag5385.d(9): Error: struct imports.fail5385.S member privX2 is not accessible
+fail_compilation/diag5385.d(10): Deprecation: imports.fail5385.S.packX2 is not visible from module diag5385
+fail_compilation/diag5385.d(10): Error: struct imports.fail5385.S member packX2 is not accessible
+---
+*/
+
+import imports.fail5385;
+
+#line 1
+void main()
+{
+    C.privX = 1;
+    C.packX = 1;
+    C.privX2 = 1;
+    C.packX2 = 1;
+    S.privX = 1;
+    S.packX = 1;
+    S.privX2 = 1;
+    S.packX2 = 1;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag5450.d b/gcc/testsuite/gdc.test/fail_compilation/diag5450.d
new file mode 100644
index 00000000000..495fea9c955
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag5450.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag5450.d(18): Error: class diag5450.C cannot implicitly generate a default ctor when base class diag5450.B is missing a default ctor
+---
+*/
+
+class A
+{
+    this() { }
+}
+
+class B : A
+{
+    this(int f) {}
+}
+
+class C : B
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag6373.d b/gcc/testsuite/gdc.test/fail_compilation/diag6373.d
new file mode 100644
index 00000000000..7a316fa59ac
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag6373.d
@@ -0,0 +1,21 @@
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/diag6373.d(7): Error: class diag6373.Bar use of diag6373.Foo.method(double x) is hidden by Bar; use 'alias method = Foo.method;' to introduce base class overload set
+---
+*/
+
+#line 1
+class Foo
+{
+    void method(int x) { }
+    void method(double x) { }
+}
+
+class Bar : Foo
+{
+    override void method(int x) { }
+}
+
+void main() { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag6539.d b/gcc/testsuite/gdc.test/fail_compilation/diag6539.d
new file mode 100644
index 00000000000..eddb5d2ef83
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag6539.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag6539.d(21): Error: overloadset diag6539.Rectangle is used as a type
+---
+*/
+
+mixin template foo()
+{
+    struct Rectangle(T) {}
+}
+
+mixin template bar()
+{
+    bool Rectangle(bool, int, int, int, int) {}
+}
+
+mixin foo;
+mixin bar;
+
+void test(Rectangle rect)
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag6677.d b/gcc/testsuite/gdc.test/fail_compilation/diag6677.d
new file mode 100644
index 00000000000..7dd0d74ae8d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag6677.d
@@ -0,0 +1,28 @@
+// REQUIRED_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag6677.d(18): Error: static constructor cannot be const
+fail_compilation/diag6677.d(19): Error: static constructor cannot be inout
+fail_compilation/diag6677.d(20): Error: static constructor cannot be immutable
+fail_compilation/diag6677.d(21): Error: use 'shared static this()' to declare a shared static constructor
+fail_compilation/diag6677.d(22): Error: use 'shared static this()' to declare a shared static constructor
+fail_compilation/diag6677.d(24): Error: shared static constructor cannot be const
+fail_compilation/diag6677.d(25): Error: shared static constructor cannot be inout
+fail_compilation/diag6677.d(26): Error: shared static constructor cannot be immutable
+fail_compilation/diag6677.d(27): Error: redundant attribute 'shared'
+fail_compilation/diag6677.d(28): Error: redundant attribute 'shared'
+---
+*/
+
+static this() const { }
+static this() inout { }
+static this() immutable { }
+static this() shared { }
+static this() const shared { }
+
+shared static this() const { }
+shared static this() inout { }
+shared static this() immutable { }
+shared static this() shared { }
+shared static this() const shared { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag6699.d b/gcc/testsuite/gdc.test/fail_compilation/diag6699.d
new file mode 100644
index 00000000000..dc1efefeae7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag6699.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag6699.d(8): Error: no property 'x' for type 'int'
+---
+*/
+alias int b6699;
+alias b6699.x b6699a;
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag6699.d(18): Error: undefined identifier 'junk1'
+fail_compilation/diag6699.d(18): Error: undefined identifier 'junk2'
+fail_compilation/diag6699.d(19): Error: undefined identifier 'junk3'
+---
+*/
+class X : junk1, junk2 {}
+interface X2 : junk3 {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag6707.d b/gcc/testsuite/gdc.test/fail_compilation/diag6707.d
new file mode 100644
index 00000000000..a5262d39d0e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag6707.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag6707.d(9): Error: mutable method diag6707.Foo.value is not callable using a const object
+---
+*/
+
+#line 1
+module diag6707;
+
+struct Foo
+{
+    @property bool value() { return true; }
+
+    void test() const
+    {
+        auto x = value;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag6717.d b/gcc/testsuite/gdc.test/fail_compilation/diag6717.d
new file mode 100644
index 00000000000..fe30f898293
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag6717.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag6717.d(12): Error: end of instruction expected, not 'h'
+---
+*/
+
+void main()
+{
+    asm
+    {
+        mov AX, 12h ;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag6796.d b/gcc/testsuite/gdc.test/fail_compilation/diag6796.d
new file mode 100644
index 00000000000..d40b89f404c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag6796.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag6796.d(11): Error: cannot implicitly convert expression (0) of type int to int[]
+fail_compilation/diag6796.d(11): Error: cannot implicitly convert expression (1) of type int to int[]
+---
+*/
+
+void main()
+{
+    enum int[][] array = [0, 1];
+    array[0] *= 10;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag7050a.d b/gcc/testsuite/gdc.test/fail_compilation/diag7050a.d
new file mode 100644
index 00000000000..4a6269d7e0b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag7050a.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag7050a.d(14): Error: @safe function 'diag7050a.foo' cannot call @system constructor 'diag7050a.Foo.this'
+---
+*/
+
+#line 1
+struct Foo {
+  this (int a) {}
+}
+@safe void foo() {
+  auto f = Foo(3);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag7050b.d b/gcc/testsuite/gdc.test/fail_compilation/diag7050b.d
new file mode 100644
index 00000000000..48b7fb8cfe7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag7050b.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag7050b.d(5): Error: pure function 'diag7050b.f.g' cannot call impure function 'diag7050b.f'
+---
+*/
+
+#line 1
+void f()
+{
+    pure void g()
+    {
+        f();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag7050c.d b/gcc/testsuite/gdc.test/fail_compilation/diag7050c.d
new file mode 100644
index 00000000000..0880fca731f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag7050c.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag7050c.d(13): Error: @safe destructor 'diag7050c.B.~this' cannot call @system destructor 'diag7050c.A.~this'
+---
+*/
+
+#line 1
+struct A
+{
+    ~this(){}
+}
+
+@safe struct B
+{
+    A a;
+}
+
+@safe void f()
+{
+    auto x = B.init;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag7420.d b/gcc/testsuite/gdc.test/fail_compilation/diag7420.d
new file mode 100644
index 00000000000..a5240d8f377
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag7420.d
@@ -0,0 +1,25 @@
+// REQUIRED_ARGS: -m32
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag7420.d(3): Error: static variable x cannot be read at compile time
+fail_compilation/diag7420.d(3):        while evaluating: static assert(x < 4)
+fail_compilation/diag7420.d(4): Error: static variable y cannot be read at compile time
+fail_compilation/diag7420.d(4):        while evaluating: static assert(y == "abc")
+fail_compilation/diag7420.d(5): Error: static variable y cannot be read at compile time
+fail_compilation/diag7420.d(5):        while evaluating: static assert(cast(ubyte[])y != null)
+fail_compilation/diag7420.d(6): Error: static variable y cannot be read at compile time
+fail_compilation/diag7420.d(6):        while evaluating: static assert(cast(int)y[0] == 1)
+fail_compilation/diag7420.d(7): Error: static variable y cannot be read at compile time
+fail_compilation/diag7420.d(7):        while evaluating: static assert(y[0..1].length == 1u)
+---
+*/
+
+#line 1
+int x = 2;
+char[] y = "abc".dup;
+static assert(x < 4);
+static assert(y == "abc");
+static assert(cast(ubyte[])y != null);
+static assert(y[0] == 1);
+static assert(y[0..1].length == 1);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag7477.d b/gcc/testsuite/gdc.test/fail_compilation/diag7477.d
new file mode 100644
index 00000000000..3c92b241d5c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag7477.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag7477.d(13): Error: cannot implicitly convert expression (0) of type int to Foo
+fail_compilation/diag7477.d(20): Error: cannot implicitly convert expression (0) of type int to string
+---
+*/
+
+struct Foo { int x; }
+
+enum Bar : Foo
+{
+    a,
+    b,
+    c
+}
+
+enum Baz : string
+{
+    a,
+    b,
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag7747.d b/gcc/testsuite/gdc.test/fail_compilation/diag7747.d
new file mode 100644
index 00000000000..0756911cab3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag7747.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag7747.d(8): Error: forward reference to inferred return type of function call 'fact(n - 1)'
+---
+*/
+
+auto fact(int n) { return n > 1 ? fact(n - 1) : 0; }
+
+void main()
+{
+    fact(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag7998.d b/gcc/testsuite/gdc.test/fail_compilation/diag7998.d
new file mode 100644
index 00000000000..2b3cb26f948
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag7998.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag7998.d(3): Error: static assert  "abcxe"
+---
+*/
+
+#line 1
+module diag7998;
+
+static assert(false, "abc" ~['x'] ~ "e");
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8101.d b/gcc/testsuite/gdc.test/fail_compilation/diag8101.d
new file mode 100644
index 00000000000..6fc38099048
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8101.d
@@ -0,0 +1,63 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8101.d(56): Error: function diag8101.f_0 (int) is not callable using argument types ()
+fail_compilation/diag8101.d(57): Error: none of the overloads of 'f_1' are callable using argument types (), candidates are:
+fail_compilation/diag8101.d(32):        diag8101.f_1(int)
+fail_compilation/diag8101.d(33):        diag8101.f_1(int, int)
+fail_compilation/diag8101.d(58): Error: none of the overloads of 'f_2' are callable using argument types (), candidates are:
+fail_compilation/diag8101.d(35):        diag8101.f_2(int)
+fail_compilation/diag8101.d(36):        diag8101.f_2(int, int)
+fail_compilation/diag8101.d(37):        diag8101.f_2(int, int, int)
+fail_compilation/diag8101.d(38):        diag8101.f_2(int, int, int, int)
+fail_compilation/diag8101.d(39):        diag8101.f_2(int, int, int, int, int)
+fail_compilation/diag8101.d(58):        ... (1 more, -v to show) ...
+fail_compilation/diag8101.d(60): Error: template diag8101.t_0 cannot deduce function from argument types !()(), candidates are:
+fail_compilation/diag8101.d(42):        diag8101.t_0(T1)()
+fail_compilation/diag8101.d(61): Error: template diag8101.t_1 cannot deduce function from argument types !()(), candidates are:
+fail_compilation/diag8101.d(44):        diag8101.t_1(T1)()
+fail_compilation/diag8101.d(45):        diag8101.t_1(T1, T2)()
+fail_compilation/diag8101.d(62): Error: template diag8101.t_2 cannot deduce function from argument types !()(), candidates are:
+fail_compilation/diag8101.d(47):        diag8101.t_2(T1)()
+fail_compilation/diag8101.d(48):        diag8101.t_2(T1, T2)()
+fail_compilation/diag8101.d(49):        diag8101.t_2(T1, T2, T3)()
+fail_compilation/diag8101.d(50):        diag8101.t_2(T1, T2, T3, T4)()
+fail_compilation/diag8101.d(51):        diag8101.t_2(T1, T2, T3, T4, T5)()
+fail_compilation/diag8101.d(62):        ... (1 more, -v to show) ...
+---
+*/
+
+void f_0(int);
+
+void f_1(int);
+void f_1(int, int);
+
+void f_2(int);
+void f_2(int, int);
+void f_2(int, int, int);
+void f_2(int, int, int, int);
+void f_2(int, int, int, int, int);
+void f_2(int, int, int, int, int, int);
+
+void t_0(T1)();
+
+void t_1(T1)();
+void t_1(T1, T2)();
+
+void t_2(T1)();
+void t_2(T1, T2)();
+void t_2(T1, T2, T3)();
+void t_2(T1, T2, T3, T4)();
+void t_2(T1, T2, T3, T4, T5)();
+void t_2(T1, T2, T3, T4, T5, T6)();
+
+void main()
+{
+    f_0();
+    f_1();
+    f_2();
+
+    t_0();
+    t_1();
+    t_2();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d b/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d
new file mode 100644
index 00000000000..a3baa272fae
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d
@@ -0,0 +1,34 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8101b.d(26): Error: none of the overloads of 'foo' are callable using argument types (double), candidates are:
+fail_compilation/diag8101b.d(17):        diag8101b.S.foo(int _param_0)
+fail_compilation/diag8101b.d(18):        diag8101b.S.foo(int _param_0, int _param_1)
+fail_compilation/diag8101b.d(28): Error: function diag8101b.S.bar (int _param_0) is not callable using argument types (double)
+fail_compilation/diag8101b.d(31): Error: none of the overloads of 'foo' are callable using a const object, candidates are:
+fail_compilation/diag8101b.d(17):        diag8101b.S.foo(int _param_0)
+fail_compilation/diag8101b.d(18):        diag8101b.S.foo(int _param_0, int _param_1)
+fail_compilation/diag8101b.d(33): Error: mutable method diag8101b.S.bar is not callable using a const object
+---
+*/
+
+struct S
+{
+    void foo(int) { }
+    void foo(int, int) { }
+
+    void bar(int) { }
+}
+
+void main()
+{
+    S s;
+    s.foo(1.0);
+
+    s.bar(1.0);
+
+    const(S) cs;
+    cs.foo(1);
+
+    cs.bar(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8178.d b/gcc/testsuite/gdc.test/fail_compilation/diag8178.d
new file mode 100644
index 00000000000..491a6255742
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8178.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8178.d(14): Error: cannot modify manifest constant 's'
+---
+*/
+
+struct Foo
+{
+    enum string s = "";
+}
+void main()
+{
+    Foo.s = "";
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8318.d b/gcc/testsuite/gdc.test/fail_compilation/diag8318.d
new file mode 100644
index 00000000000..d319532fd5c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8318.d
@@ -0,0 +1,51 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8318.d(13): Error: function diag8318.Bar8318.foo return type inference is not supported if may override base class function
+---
+*/
+class Foo8318
+{
+    auto foo() { return "Foo.foo"; }
+}
+class Bar8318 : Foo8318
+{
+    override auto foo() { return "Bar.foo"; }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8318.d(24): Error: function diag8318.C10021.makeI return type inference is not supported if may override base class function
+---
+*/
+interface I10021 { I10021 makeI(); }
+class D10021 : I10021 { D10021 makeI() { return this; } }
+class C10021 : I10021 { auto   makeI() { return this; } }
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8318.d(38): Error: function diag8318.Bar10195.baz return type inference is not supported if may override base class function
+---
+*/
+interface Foo10195
+{
+    int baz();
+}
+class Bar10195 : Foo10195
+{
+    override auto baz() { return 1; }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8318.d(50): Error: function diag8318.B14173.foo does not override any function
+---
+*/
+class A14173 {}
+class B14173 : A14173
+{
+    override foo() {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8425.d b/gcc/testsuite/gdc.test/fail_compilation/diag8425.d
new file mode 100644
index 00000000000..14dbb1cf1ad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8425.d
@@ -0,0 +1,16 @@
+/*
+REQUIRED_ARGS: -m64 -o-
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/diag8425.d(13): Error: T in __vector(T) must be a static array, not void
+fail_compilation/diag8425.d(14): Error: 1 byte vector type __vector(void[1]) is not supported on this platform
+fail_compilation/diag8425.d(15): Error: 99 byte vector type __vector(void[99]) is not supported on this platform
+fail_compilation/diag8425.d(16): Error: vector type __vector(void*[4]) is not supported on this platform
+---
+*/
+
+alias a = __vector(void); // not static array
+alias b = __vector(void[1]); // wrong size
+alias c = __vector(void[99]); // wrong size
+alias d = __vector(void*[4]); // wrong base type
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8510.d b/gcc/testsuite/gdc.test/fail_compilation/diag8510.d
new file mode 100644
index 00000000000..d1a897a40c6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8510.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8510.d(10): Error: alias diag8510.a conflicts with alias diag8510.a at fail_compilation/diag8510.d(9)
+fail_compilation/diag8510.d(15): Error: alias diag8510.S.a conflicts with alias diag8510.S.a at fail_compilation/diag8510.d(14)
+---
+*/
+
+alias int a;
+alias int a;
+
+int g;
+struct S {
+    alias g a;
+    alias g a;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8559.d b/gcc/testsuite/gdc.test/fail_compilation/diag8559.d
new file mode 100644
index 00000000000..61e0af156ef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8559.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8559.d(4): Error: void does not have a default initializer
+fail_compilation/diag8559.d(5): Error: function does not have a default initializer
+---
+*/
+
+#line 1
+void foo(){}
+void main()
+{
+    auto x = void.init;
+    auto y = typeof(foo).init;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8648.d b/gcc/testsuite/gdc.test/fail_compilation/diag8648.d
new file mode 100644
index 00000000000..fdcb6cc4e5b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8648.d
@@ -0,0 +1,33 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8648.d(18): Error: undefined identifier 'X'
+fail_compilation/diag8648.d(29): Error: template diag8648.foo cannot deduce function from argument types !()(Foo!(int, 1)), candidates are:
+fail_compilation/diag8648.d(18):        diag8648.foo(T, n)(X!(T, n))
+fail_compilation/diag8648.d(20): Error: undefined identifier 'a'
+fail_compilation/diag8648.d(31): Error: template diag8648.bar cannot deduce function from argument types !()(Foo!(int, 1)), candidates are:
+fail_compilation/diag8648.d(20):        diag8648.bar(T)(Foo!(T, a))
+fail_compilation/diag8648.d(20): Error: undefined identifier 'a'
+fail_compilation/diag8648.d(32): Error: template diag8648.bar cannot deduce function from argument types !()(Foo!(int, f)), candidates are:
+fail_compilation/diag8648.d(20):        diag8648.bar(T)(Foo!(T, a))
+---
+*/
+
+struct Foo(T, alias a) {}
+
+void foo(T, n)(X!(T, n) ) {}    // undefined identifier 'X'
+
+void bar(T)(Foo!(T, a) ) {}     // undefined identifier 'a'
+
+void main()
+{
+    template f() {}
+
+    Foo!(int, 1) x;
+    Foo!(int, f) y;
+
+    foo(x);
+
+    bar(x); // expression '1' vs undefined Type 'a'
+    bar(y); // symbol 'f' vs undefined Type 'a'
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8697.d b/gcc/testsuite/gdc.test/fail_compilation/diag8697.d
new file mode 100644
index 00000000000..b1a10089997
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8697.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8697.d(10): Error: no property 'Invalid' for type 'diag8697.Base'
+---
+*/
+interface InterBase : InterRoot { }
+class Base : InterBase { }
+
+void test(Base.Invalid) { }
+
+interface InterRoot { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8714.d b/gcc/testsuite/gdc.test/fail_compilation/diag8714.d
new file mode 100644
index 00000000000..eb348f6c90d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8714.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8714.d(1): Error: function diag8714.foo circular dependency. Functions cannot be interpreted while being compiled
+fail_compilation/diag8714.d(7):        called from here: foo("somestring")
+---
+*/
+
+#line 1
+string foo(string f)
+{
+    if (f == "somestring")
+    {
+        return "got somestring";
+    }
+    return bar!(foo("somestring"));
+}
+
+template bar(string s)
+{
+    enum bar = s;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8777.d b/gcc/testsuite/gdc.test/fail_compilation/diag8777.d
new file mode 100644
index 00000000000..f289da92a85
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8777.d
@@ -0,0 +1,44 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8777.d(12): Error: constructor diag8777.Foo1.this missing initializer for immutable field x
+fail_compilation/diag8777.d(12): Error: constructor diag8777.Foo1.this missing initializer for const field y
+---
+*/
+class Foo1
+{
+    immutable int[5] x;
+    const int[5] y;
+    this() {}
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8777.d(25): Error: cannot modify immutable expression x
+fail_compilation/diag8777.d(28): Error: cannot modify const expression y
+---
+*/
+void test2()
+{
+    immutable int x;
+    x = 1;
+
+    const int y;
+    y = 1;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8777.d(42): Error: cannot remove key from immutable associative array hashx
+fail_compilation/diag8777.d(43): Error: cannot remove key from const associative array hashy
+---
+*/
+immutable(int[int]) hashx;
+const(int[int]) hashy;
+void test3()
+{
+    hashx.remove(1);
+    hashy.remove(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8787.d b/gcc/testsuite/gdc.test/fail_compilation/diag8787.d
new file mode 100644
index 00000000000..30d79e832ed
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8787.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8787.d(3): Error: function diag8787.I.f function body only allowed in final functions in interface I
+---
+*/
+
+#line 1
+interface I
+{
+    void f() { }
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8825.d b/gcc/testsuite/gdc.test/fail_compilation/diag8825.d
new file mode 100644
index 00000000000..e858c6ab83c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8825.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8825.d(13): Error: undefined identifier 'foo'
+---
+*/
+
+template t(alias a){
+    alias int t;
+}
+
+void main(){
+    t!(foo // line 13
+
+
+
+
+
+    ) i; // line 19
+    return;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8892.d b/gcc/testsuite/gdc.test/fail_compilation/diag8892.d
new file mode 100644
index 00000000000..27915688140
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8892.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8892.d(14): Error: cannot implicitly convert expression (['A']) of type char[] to char[2]
+---
+*/
+struct Foo
+{
+    char[2] data;
+}
+
+void main()
+{
+    auto f = Foo(['A']);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8894.d b/gcc/testsuite/gdc.test/fail_compilation/diag8894.d
new file mode 100644
index 00000000000..6d3b9cdec46
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8894.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8894.d(6): Error: no property 'x' for type 'Foo'
+fail_compilation/diag8894.d(7): Error: no property 'y' for type 'Foo'
+fail_compilation/diag8894.d(8): Error: no property 'x' for type 'Foo'
+fail_compilation/diag8894.d(9): Error: no property 'x' for type 'Foo'
+---
+*/
+
+#line 1
+struct Foo { }
+
+void main()
+{
+    Foo f;
+    f.x;           // UFCS getter1
+    f.y!int;       // UFCS getter2
+    f.x     = 10;  // UFCS setter1
+    f.x!int = 10;  // UFCS setter2
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8928.d b/gcc/testsuite/gdc.test/fail_compilation/diag8928.d
new file mode 100644
index 00000000000..bdd1ae8b61e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag8928.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag8928.d(18): Error: class diag8928.Z cannot implicitly generate a default ctor when base class diag8928.X is missing a default ctor
+---
+*/
+
+class X
+{
+    this(int n) {}
+}
+
+class Y : X
+{
+    this() {}
+}
+
+class Z : X
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9004.d b/gcc/testsuite/gdc.test/fail_compilation/diag9004.d
new file mode 100644
index 00000000000..19852758252
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9004.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9004.d(21): Error: template diag9004.bar cannot deduce function from argument types !()(Foo!int, int), candidates are:
+fail_compilation/diag9004.d(14):        diag9004.bar(FooT)(FooT foo, FooT.T x)
+---
+*/
+
+struct Foo(_T)
+{
+    alias _T T;
+}
+
+void bar(FooT)(FooT foo, FooT.T x)
+{
+}
+
+void main()
+{
+    Foo!int foo;
+    bar(foo, 1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9148.d b/gcc/testsuite/gdc.test/fail_compilation/diag9148.d
new file mode 100644
index 00000000000..74d00b4f3b6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9148.d
@@ -0,0 +1,55 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9148.d(19): Error: pure function 'diag9148.test9148a.foo' cannot access mutable static data 'g'
+fail_compilation/diag9148.d(23): Error: pure function 'diag9148.test9148a.bar' cannot access mutable static data 'g'
+fail_compilation/diag9148.d(24): Error: pure immutable function 'diag9148.test9148a.bar' cannot access mutable data 'x'
+fail_compilation/diag9148.d(31): Error: pure function 'diag9148.test9148a.S.foo' cannot access mutable static data 'g'
+fail_compilation/diag9148.d(35): Error: pure function 'diag9148.test9148a.S.bar' cannot access mutable static data 'g'
+fail_compilation/diag9148.d(36): Error: pure immutable function 'diag9148.test9148a.S.bar' cannot access mutable data 'x'
+---
+*/
+void test9148a() pure
+{
+    static int g;
+    int x;
+
+    void foo() /+pure+/
+    {
+        g++;
+    }
+    void bar() immutable /+pure+/
+    {
+        g++;
+        x++;
+    }
+
+    struct S
+    {
+        void foo() /+pure+/
+        {
+            g++;
+        }
+        void bar() immutable /+pure+/
+        {
+            g++;
+            x++;
+        }
+    }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9148.d(53): Error: static function diag9148.test9148b.foo cannot access frame of function diag9148.test9148b
+---
+*/
+
+void test9148b()
+{
+    int x;
+    static void foo() pure
+    {
+        int y = x;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9191.d b/gcc/testsuite/gdc.test/fail_compilation/diag9191.d
new file mode 100644
index 00000000000..50e5445d3e0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9191.d
@@ -0,0 +1,41 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9191.d(16): Error: function diag9191.C1.aaa does not override any function, did you mean to override 'diag9191.B1.aa'?
+fail_compilation/diag9191.d(21): Error: function diag9191.C2.aaa does not override any function
+fail_compilation/diag9191.d(31): Error: function diag9191.C3.foo does not override any function, did you mean to override 'diag9191.B2._foo'?
+fail_compilation/diag9191.d(36): Error: function diag9191.C4.toStringa does not override any function, did you mean to override 'object.Object.toString'?
+---
+*/
+
+interface I1 { void a(); }
+class B1 { void aa(); }
+
+class C1 : B1, I1
+{
+    override void aaa();
+}
+
+class C2 : I1
+{
+    override void aaa();
+}
+
+class B2
+{
+    void _foo(){}
+}
+
+class C3 : B2
+{
+    override void foo(){}
+}
+
+class C4
+{
+    override void toStringa(){}
+}
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9210a.d b/gcc/testsuite/gdc.test/fail_compilation/diag9210a.d
new file mode 100644
index 00000000000..1fd01d64f5d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9210a.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/diag9210b.d(6): Error: undefined identifier 'A'
+---
+*/
+
+import imports.diag9210b;
+interface A {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9247.d b/gcc/testsuite/gdc.test/fail_compilation/diag9247.d
new file mode 100644
index 00000000000..e22634559cb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9247.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9247.d(11): Error: functions cannot return opaque type S by value
+fail_compilation/diag9247.d(12): Error: functions cannot return opaque type S by value
+---
+*/
+
+struct S;
+
+S foo();
+S function() bar;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9250.d b/gcc/testsuite/gdc.test/fail_compilation/diag9250.d
new file mode 100644
index 00000000000..22b5edadcbd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9250.d
@@ -0,0 +1,24 @@
+// REQUIRED_ARGS: -m32
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9250.d(19): Error: cannot implicitly convert expression (10u) of type uint to Foo
+fail_compilation/diag9250.d(22): Error: cannot implicitly convert expression (10u) of type uint to void*
+---
+*/
+
+struct Foo
+{
+    ubyte u;
+}
+
+void main()
+{
+    uint[10] bar;
+
+    Foo x = bar.length;  // error here
+
+    void* y = bar.length ?
+              bar.length :  // error here
+              bar.length;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9312.d b/gcc/testsuite/gdc.test/fail_compilation/diag9312.d
new file mode 100644
index 00000000000..daa3c302e28
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9312.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9312.d(10): Error: with expressions must be aggregate types or pointers to them, not 'int'
+---
+*/
+
+void main()
+{
+    with (1)
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9357.d b/gcc/testsuite/gdc.test/fail_compilation/diag9357.d
new file mode 100644
index 00000000000..c39e20c3ccc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9357.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9357.d(14): Error: cannot implicitly convert expression (1.00000) of type double to int
+fail_compilation/diag9357.d(15): Error: cannot implicitly convert expression (10.0000) of type double to int
+fail_compilation/diag9357.d(16): Error: cannot implicitly convert expression (11.0000) of type double to int
+fail_compilation/diag9357.d(17): Error: cannot implicitly convert expression (99.0000) of type double to int
+fail_compilation/diag9357.d(18): Error: cannot implicitly convert expression (1.04858e+06L) of type real to int
+fail_compilation/diag9357.d(19): Error: cannot implicitly convert expression (1.04858e+06L) of type real to int
+---
+*/
+void main()
+{
+    { int x = 1.0; }
+    { int x = 10.0; }
+    { int x = 11.0; }
+    { int x = 99.0; }
+    { int x = 1048575.0L; }
+    { int x = 1048576.0L; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9358.d b/gcc/testsuite/gdc.test/fail_compilation/diag9358.d
new file mode 100644
index 00000000000..4335f7c8c78
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9358.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9358.d(12): Error: 'x' must be of integral or string type, it is a double
+fail_compilation/diag9358.d(14): Error: case must be a string or an integral constant, not 1.1
+fail_compilation/diag9358.d(15): Error: case must be a string or an integral constant, not 2.1
+---
+*/
+void main()
+{
+    double x;
+    switch (x)
+    {
+        case 1.1: break;
+        case 2.1: break;
+        default:
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9398.d b/gcc/testsuite/gdc.test/fail_compilation/diag9398.d
new file mode 100644
index 00000000000..67900c9bc6c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9398.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9398.d(11): Error: incompatible types for ((f) : (s)): 'float' and 'string'
+---
+*/
+void main()
+{
+    float f;
+    string s;
+    auto a = (true ? f : s);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9420.d b/gcc/testsuite/gdc.test/fail_compilation/diag9420.d
new file mode 100644
index 00000000000..dfaf7c84a09
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9420.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT
+---
+fail_compilation/diag9420.d(20): Error: function diag9420.S.t3!().tx () is not callable using argument types (int)
+---
+*/
+
+mixin template Mixin() { }
+struct S
+{
+    template t3(T...)
+    {
+        void tx(T){}
+        alias t3 = tx;
+    }
+}
+void main()
+{
+    S s1;
+    s1.t3!()(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9451.d b/gcc/testsuite/gdc.test/fail_compilation/diag9451.d
new file mode 100644
index 00000000000..a9121fc338f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9451.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9451.d(26): Error: cannot create instance of abstract class C2
+fail_compilation/diag9451.d(26):        function 'void f1()' is not implemented
+fail_compilation/diag9451.d(26):        function 'void f2(int)' is not implemented
+fail_compilation/diag9451.d(26):        function 'void f2(float) const' is not implemented
+fail_compilation/diag9451.d(26):        function 'int f2(float) pure' is not implemented
+---
+*/
+
+class C1
+{
+    abstract void f1();
+    abstract void f2(int);
+    abstract void f2(float) const;
+    abstract int f2(float) pure;
+}
+
+class C2 : C1
+{
+}
+
+void main()
+{
+    auto c2 = new C2;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9479.d b/gcc/testsuite/gdc.test/fail_compilation/diag9479.d
new file mode 100644
index 00000000000..4902d7fba63
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9479.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9479.d(10): Error: undefined identifier 'something_undefined'
+---
+*/
+
+int delegate() bug9479()
+{
+    return { return something_undefined; };
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9574.d b/gcc/testsuite/gdc.test/fail_compilation/diag9574.d
new file mode 100644
index 00000000000..2fcccaec906
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9574.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9574.d(12): Error: cannot use syntax 'alias this = x', use 'alias x this' instead
+fail_compilation/diag9574.d(18): Error: cannot use syntax 'alias this = x', use 'alias x this' instead
+---
+*/
+
+struct S
+{
+    int x;
+    alias this = x;
+}
+
+class C
+{
+    int x;
+    alias this = x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9620.d b/gcc/testsuite/gdc.test/fail_compilation/diag9620.d
new file mode 100644
index 00000000000..5d50cb8c7ac
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9620.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9620.d(18): Error: pure function 'diag9620.main.bar' cannot call impure function 'diag9620.foo1'
+fail_compilation/diag9620.d(19): Error: pure function 'diag9620.main.bar' cannot call impure function 'diag9620.foo2!().foo2'
+---
+*/
+
+int x;
+
+void foo1() { x = 3; }
+void foo2()() { x = 3; }
+
+void main() pure
+{
+    void bar()
+    {
+        foo1();
+        foo2();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9635.d b/gcc/testsuite/gdc.test/fail_compilation/diag9635.d
new file mode 100644
index 00000000000..0e15aa2b9a5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9635.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -m32
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9635.d(17): Error: need 'this' for 'i' of type 'int'
+fail_compilation/diag9635.d(18): Error: need 'this' for 'foo' of type 'pure nothrow @nogc @safe void()'
+---
+*/
+
+struct Foo
+{
+    int i;
+    void foo()() { }
+
+    static void bar()
+    {
+        i = 4;
+        foo();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9679.d b/gcc/testsuite/gdc.test/fail_compilation/diag9679.d
new file mode 100644
index 00000000000..a19d99debd0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9679.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9679.d(11): Error: variable diag9679.main.n only parameters or foreach declarations can be ref
+fail_compilation/diag9679.d(12): Error: variable diag9679.main.n storage class 'auto' has no effect if type is not inferred, did you mean 'scope'?
+---
+*/
+
+void main()
+{
+    if (ref n = 1) {}
+    if (auto int n = 1) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9765.d b/gcc/testsuite/gdc.test/fail_compilation/diag9765.d
new file mode 100644
index 00000000000..999982b3350
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9765.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9765.d(9): Error: cannot implicitly convert expression ('x') of type char to char[]
+---
+*/
+
+struct S9765 { char[] x; }
+const S9765 s9765 = S9765('x');
+const char s9765b = s9765.x;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9831.d b/gcc/testsuite/gdc.test/fail_compilation/diag9831.d
new file mode 100644
index 00000000000..8882f66efc8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9831.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9831.d(12): Error: function diag9831.main.__lambda1 cannot access frame of function D main
+---
+*/
+
+void main()
+{
+    immutable int c;
+    int function(int x) func;
+    func = x => c;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9861.d b/gcc/testsuite/gdc.test/fail_compilation/diag9861.d
new file mode 100644
index 00000000000..6c7d89f8cc1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9861.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9861.d(8): Error: no property 'epsilon' for type 'int'
+fail_compilation/diag9861.d(9):        while looking for match for Foo!int
+---
+*/
+struct Foo(T, real x = T.epsilon) {}
+Foo!(int) q;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9880.d b/gcc/testsuite/gdc.test/fail_compilation/diag9880.d
new file mode 100644
index 00000000000..9d893b8d5de
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9880.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9880.d(9): Error: template instance diag9880.foo!string does not match template declaration foo(T)(int) if (is(T == int))
+---
+*/
+
+void foo(T)(int) if (is(T == int)) {}
+void main() { alias f = foo!string; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9961.d b/gcc/testsuite/gdc.test/fail_compilation/diag9961.d
new file mode 100644
index 00000000000..0e0b253cbb5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag9961.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag9961.d(11): Error: cannot implicitly convert expression ("") of type string to int
+fail_compilation/diag9961.d(14): Error: template instance diag9961.foo!int error instantiating
+fail_compilation/diag9961.d(11): Error: cannot implicitly convert expression ("") of type string to int
+fail_compilation/diag9961.d(15): Error: template instance diag9961.foo!char error instantiating
+---
+*/
+
+void foo(T)(T) { int x = ""; }
+void main()
+{
+    100.foo();
+    'a'.foo;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag_cstyle.d b/gcc/testsuite/gdc.test/fail_compilation/diag_cstyle.d
new file mode 100644
index 00000000000..09c5f54ceba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag_cstyle.d
@@ -0,0 +1,21 @@
+// REQUIRED_ARGS: -w
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag_cstyle.d(14): Error: instead of C-style syntax, use D-style 'int function(int) fp1'
+fail_compilation/diag_cstyle.d(15): Error: instead of C-style syntax, use D-style 'int function(int)* fp3'
+fail_compilation/diag_cstyle.d(17): Error: instead of C-style syntax, use D-style 'int function(int) FP'
+fail_compilation/diag_cstyle.d(19): Error: instead of C-style syntax, use D-style 'int function() fp'
+fail_compilation/diag_cstyle.d(19): Warning: instead of C-style syntax, use D-style syntax 'int[] arr'
+fail_compilation/diag_cstyle.d(21): Warning: instead of C-style syntax, use D-style syntax 'string[] result'
+---
+*/
+
+int (*fp1)(int);
+int (*(*fp3))(int);
+
+alias int(*FP)(int);
+
+void foo(int(*fp)(), int arr[]) {}
+
+string result[]() = "abc";
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag_err1.d b/gcc/testsuite/gdc.test/fail_compilation/diag_err1.d
new file mode 100644
index 00000000000..8af4b487fb6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag_err1.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag_err1.d(21): Error: undefined identifier 'x'
+fail_compilation/diag_err1.d(21):        while evaluating pragma(msg, [1, 2, x].length)
+fail_compilation/diag_err1.d(22): Error: undefined identifier 'x'
+fail_compilation/diag_err1.d(22): Error: undefined identifier 'y'
+fail_compilation/diag_err1.d(22):        while evaluating pragma(msg, (x + y).sizeof)
+fail_compilation/diag_err1.d(23): Error: undefined identifier 'x'
+fail_compilation/diag_err1.d(23):        while evaluating pragma(msg, (n += x).sizeof)
+fail_compilation/diag_err1.d(24): Error: incompatible types for ((s) ~ (n)): 'string' and 'int'
+fail_compilation/diag_err1.d(24):        while evaluating pragma(msg, (s ~ n).sizeof)
+---
+*/
+
+void main()
+{
+    int n;
+    string s;
+
+    pragma(msg, [1,2,x].length);
+    pragma(msg, (x + y).sizeof);
+    pragma(msg, (n += x).sizeof);
+    pragma(msg, (s ~ n).sizeof);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22a.d b/gcc/testsuite/gdc.test/fail_compilation/dip22a.d
new file mode 100644
index 00000000000..24574c71c78
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/dip22a.d
@@ -0,0 +1,26 @@
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/dip22a.d(21): Deprecation: imports.dip22a.Klass.bar is not visible from module dip22a
+fail_compilation/dip22a.d(21): Error: class imports.dip22a.Klass member bar is not accessible
+fail_compilation/dip22a.d(22): Deprecation: imports.dip22a.Struct.bar is not visible from module dip22a
+fail_compilation/dip22a.d(22): Error: struct imports.dip22a.Struct member bar is not accessible
+fail_compilation/dip22a.d(23): Error: imports.dip22a.bar is not visible from module dip22a
+fail_compilation/dip22a.d(23): Error: function imports.dip22a.bar is not accessible from module dip22a
+fail_compilation/dip22a.d(24): Error: imports.dip22a.Template!int.bar is not visible from module dip22a
+fail_compilation/dip22a.d(24): Error: function imports.dip22a.Template!int.bar is not accessible from module dip22a
+fail_compilation/dip22a.d(25): Deprecation: imports.dip22a.bar is not visible from module dip22a
+fail_compilation/dip22a.d(25): Error: function imports.dip22a.bar is not accessible from module dip22a
+---
+*/
+import imports.dip22a;
+
+void test()
+{
+    new Klass().bar();
+    Struct().bar();
+    imports.dip22a.bar();
+    Template!int.bar();
+    12.bar();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22b.d b/gcc/testsuite/gdc.test/fail_compilation/dip22b.d
new file mode 100644
index 00000000000..7aca88c09cb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/dip22b.d
@@ -0,0 +1,12 @@
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/dip22b.d(12): Deprecation: pkg.dip22c.Foo is not visible from module dip22
+---
+*/
+module pkg.dip22;
+
+import imports.dip22b;
+
+Foo foo;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22d.d b/gcc/testsuite/gdc.test/fail_compilation/dip22d.d
new file mode 100644
index 00000000000..dd1b8ef31ce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/dip22d.d
@@ -0,0 +1,12 @@
+/*
+REQUIRED_ARGS: -transition=import
+TEST_OUTPUT:
+---
+fail_compilation/dip22d.d(12): Error: imports.dip22d.Foo at fail_compilation/imports/dip22d.d(3) conflicts with imports.dip22e.Foo at fail_compilation/imports/dip22e.d(3)
+fail_compilation/dip22d.d(12): Error: module dip22d struct imports.dip22d.Foo is private
+---
+*/
+import imports.dip22d;
+import imports.dip22e;
+
+Foo foo;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22e.d b/gcc/testsuite/gdc.test/fail_compilation/dip22e.d
new file mode 100644
index 00000000000..5fffe72e485
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/dip22e.d
@@ -0,0 +1,18 @@
+/*
+REQUIRED_ARGS: -transition=checkimports -de
+TEST_OUTPUT:
+---
+fail_compilation/dip22e.d(16): Deprecation: imports.dip22d.foo is not visible from module dip22e
+fail_compilation/dip22e.d(16): Error: function imports.dip22d.foo is not accessible from module dip22e
+fail_compilation/dip22e.d(17): Deprecation: local import search method found overloadset dip22e.bar (2 overloads) instead of function imports.dip22e.bar
+---
+*/
+
+import imports.dip22d;
+import imports.dip22e;
+
+void test()
+{
+    foo();
+    bar(12);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/disable.d b/gcc/testsuite/gdc.test/fail_compilation/disable.d
new file mode 100644
index 00000000000..517fddd9940
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/disable.d
@@ -0,0 +1,77 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/disable.d(50): Error: function disable.DisabledOpAssign.opAssign is not callable because it is annotated with @disable
+fail_compilation/disable.d(53): Error: function disable.DisabledPostblit.opAssign is not callable because it is annotated with @disable
+fail_compilation/disable.d(56): Error: function disable.HasDtor.opAssign is not callable because it is annotated with @disable
+fail_compilation/disable.d(60): Error: generated function disable.Nested!(DisabledOpAssign).Nested.opAssign is not callable because it is annotated with @disable
+fail_compilation/disable.d(63): Error: generated function disable.Nested!(DisabledPostblit).Nested.opAssign is not callable because it is annotated with @disable
+fail_compilation/disable.d(66): Error: generated function disable.Nested!(HasDtor).Nested.opAssign is not callable because it is annotated with @disable
+fail_compilation/disable.d(70): Error: generated function disable.NestedDtor!(DisabledOpAssign).NestedDtor.opAssign is not callable because it is annotated with @disable
+fail_compilation/disable.d(73): Error: generated function disable.NestedDtor!(DisabledPostblit).NestedDtor.opAssign is not callable because it is annotated with @disable
+fail_compilation/disable.d(76): Error: generated function disable.NestedDtor!(HasDtor).NestedDtor.opAssign is not callable because it is annotated with @disable
+---
+ */
+struct DisabledOpAssign {
+    int x;
+    @disable void opAssign(const DisabledOpAssign);
+}
+
+struct DisabledPostblit {
+    int x;
+    @disable void opAssign(const DisabledPostblit);
+    // Doesn't require opAssign
+    @disable this(this);
+}
+
+struct HasDtor {
+    int x;
+    @disable void opAssign(const HasDtor);
+    ~this() {} // Makes opAssign mandatory
+}
+
+
+struct Nested (T)
+{
+    T b;
+}
+
+struct NestedDtor (T)
+{
+    T b;
+
+    // Requires an identity opAssign
+    ~this() {}
+}
+
+void main ()
+{
+    DisabledOpAssign o;
+    o = DisabledOpAssign();
+
+    DisabledPostblit p;
+    p = DisabledPostblit();
+
+    HasDtor d;
+    d = HasDtor();
+
+
+    Nested!(DisabledOpAssign) no;
+    no = Nested!(DisabledOpAssign)();
+
+    Nested!(DisabledPostblit) np;
+    np = Nested!(DisabledPostblit)();
+
+    Nested!(HasDtor) nd;
+    nd = Nested!(HasDtor)();
+
+
+    NestedDtor!(DisabledOpAssign) ndo;
+    ndo = NestedDtor!(DisabledOpAssign)();
+
+    NestedDtor!(DisabledPostblit) ndp;
+    ndp = NestedDtor!(DisabledPostblit)();
+
+    NestedDtor!(HasDtor) ndd;
+    ndd = NestedDtor!(HasDtor)();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/enum9921.d b/gcc/testsuite/gdc.test/fail_compilation/enum9921.d
new file mode 100644
index 00000000000..5a81ed01044
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/enum9921.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/enum9921.d(1): Error: enum enum9921.X base type must not be void
+fail_compilation/enum9921.d(3): Error: enum enum9921.Z base type must not be void
+---
+*/
+
+#line 1
+enum X : void;
+
+enum Z : void { Y };
diff --git a/gcc/testsuite/gdc.test/fail_compilation/extra-files/a14446.d b/gcc/testsuite/gdc.test/fail_compilation/extra-files/a14446.d
new file mode 100644
index 00000000000..5e19c1e7501
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/extra-files/a14446.d
@@ -0,0 +1,6 @@
+module a14446;
+
+struct CDBMaker
+{
+    import ice14446;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/extra-files/bar11453.d b/gcc/testsuite/gdc.test/fail_compilation/extra-files/bar11453.d
new file mode 100644
index 00000000000..126e0f9c7ef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/extra-files/bar11453.d
@@ -0,0 +1 @@
+module foo11453.bar11453;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/extra-files/foo11453.d b/gcc/testsuite/gdc.test/fail_compilation/extra-files/foo11453.d
new file mode 100644
index 00000000000..c97e3e1ed30
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/extra-files/foo11453.d
@@ -0,0 +1 @@
+module foo11453;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10.d b/gcc/testsuite/gdc.test/fail_compilation/fail10.d
new file mode 100644
index 00000000000..9d73537216d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10.d(18): Error: mixin Foo!y cannot resolve forward reference
+---
+*/
+
+template Foo(alias b)
+{
+    int a()
+    {
+        return b;
+    }
+}
+
+void test()
+{
+    mixin Foo!(y) y;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail100.d b/gcc/testsuite/gdc.test/fail_compilation/fail100.d
new file mode 100644
index 00000000000..f545c761740
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail100.d
@@ -0,0 +1,38 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail100.d(24): Error: cannot implicitly convert expression (f) of type Class[] to I[]
+---
+*/
+
+// Issue 85 - Array of classes doesn't function as array of interfaces
+
+interface I
+{
+    I[] foo();
+    uint x();
+}
+
+class Class : I
+{
+    I[] foo()
+    {
+        // changing this to I[] f = new Class[1] fixes the bug
+        Class[] f = new Class[1];
+        //I[] f = new Class[1];
+        f[0] = new Class;
+        return f;
+    }
+
+    uint x()
+    {
+        return 0;
+    }
+}
+
+void main()
+{
+    Class c = new Class();
+    assert(c.x == 0);
+    assert(c.foo[0].x == 0);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10082.d b/gcc/testsuite/gdc.test/fail_compilation/fail10082.d
new file mode 100644
index 00000000000..fd3080109d4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10082.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10082.d(24): Error: cannot infer type from overloaded function symbol &foo
+---
+*/
+
+mixin template T()
+{
+    int foo()
+    {
+        return 0;
+    }
+}
+
+class A
+{
+    mixin T;
+    mixin T;
+}
+
+void main()
+{
+    auto x = &A.foo;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail101.d b/gcc/testsuite/gdc.test/fail_compilation/fail101.d
new file mode 100644
index 00000000000..29b3860d6f1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail101.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail101.d(8): Error: cannot implicitly convert expression (1) of type int to creal
+---
+*/
+
+creal c = 1;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10102.d b/gcc/testsuite/gdc.test/fail_compilation/fail10102.d
new file mode 100644
index 00000000000..1c0922e79db
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10102.d
@@ -0,0 +1,52 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10102.d(48): Error: variable fail10102.main.m default construction is disabled for type NotNull!(int*)
+fail_compilation/fail10102.d(49): Error: variable fail10102.main.a default construction is disabled for type NotNull!(int*)[3]
+fail_compilation/fail10102.d(50): Error: default construction is disabled for type NotNull!(int*)
+fail_compilation/fail10102.d(51): Error: field S.m must be initialized because it has no default constructor
+---
+*/
+
+struct NotNull(T)
+{
+    T p;
+
+    alias p this;
+
+    this(T p)
+    {
+        assert(p != null, "pointer is null");
+        this.p = p;
+    }
+
+    @disable this();
+
+    NotNull opAssign(T p)
+    {
+        assert(p != null, "assigning null to NotNull");
+        this.p = p;
+        return this;
+    }
+}
+
+void main()
+{
+    struct S
+    {
+        NotNull!(int *) m;
+        // should fail: an explicit constructor must be required for S
+    }
+
+    int i;
+    NotNull!(int*) n = &i;
+    *n = 3;
+    assert(i == 3);
+    n = &i;
+    n += 1;
+
+    NotNull!(int*) m;               // should fail
+    NotNull!(int*)[3] a;            // should fail
+    auto b = new NotNull!(int*)[3]; // should fail
+    S s = S();                      // should fail
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10115.d b/gcc/testsuite/gdc.test/fail_compilation/fail10115.d
new file mode 100644
index 00000000000..e94ae876e8e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10115.d
@@ -0,0 +1,48 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10115.d(35): Error: cannot have out parameter of type S because the default construction is disabled
+fail_compilation/fail10115.d(35): Error: cannot have out parameter of type E because the default construction is disabled
+fail_compilation/fail10115.d(35): Error: cannot have out parameter of type U because the default construction is disabled
+fail_compilation/fail10115.d(40): Error: struct fail10115.S default construction is disabled
+fail_compilation/fail10115.d(41): Error: struct fail10115.S default construction is disabled
+fail_compilation/fail10115.d(42): Error: union fail10115.U default construction is disabled
+---
+*/
+
+struct S
+{
+    int a;
+    @disable this();
+    //this(int) { a = 1; }
+    //~this() { assert(a !is 0); }
+}
+
+enum E : S
+{
+    A = S.init
+}
+
+union U
+{
+    S s;
+    //this(this) { assert (s.a !is 0); }
+    //~this() { assert (s.a !is 0); }
+}
+
+void main()
+{
+    void foo(out S s, out E e, out U u) { }
+
+    S[] a;
+    E[] e;
+    U[] u;
+    a.length = 5;   // compiles -> NG
+    e.length = 5;   // compiles -> NG
+    u.length = 5;   // compiles -> NG
+
+    S[1] x = (S[1]).init;
+    foo(a[0],       // compiles -> NG
+        e[0],       // compiles -> NG
+        u[0]);      // compiles -> NG
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10207.d b/gcc/testsuite/gdc.test/fail_compilation/fail10207.d
new file mode 100644
index 00000000000..bf3003d68cc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10207.d
@@ -0,0 +1,7 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10207.d(7): Error: user defined attributes not allowed for alias declarations
+---
+*/
+alias @Safe int __externC;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10254.d b/gcc/testsuite/gdc.test/fail_compilation/fail10254.d
new file mode 100644
index 00000000000..0d402e12b85
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10254.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10254.d(18): Error: pure function 'fail10254.foo' cannot call impure constructor 'fail10254.C.this'
+fail_compilation/fail10254.d(18): Error: @safe function 'fail10254.foo' cannot call @system constructor 'fail10254.C.this'
+fail_compilation/fail10254.d(19): Error: pure function 'fail10254.foo' cannot call impure constructor 'fail10254.S.this'
+fail_compilation/fail10254.d(19): Error: @safe function 'fail10254.foo' cannot call @system constructor 'fail10254.S.this'
+---
+*/
+
+int a;
+
+class C { this() { a = 2; } }
+struct S { this(int) { a = 2; } }
+
+void foo() pure @safe
+{
+    auto c = new C; // This line should be a compilation error.
+    auto s = new S(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10277.d b/gcc/testsuite/gdc.test/fail_compilation/fail10277.d
new file mode 100644
index 00000000000..6173d37c2e7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10277.d
@@ -0,0 +1,29 @@
+module fail10227;
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/fail10277.d(3): Error: class TypeInfo only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(4): Error: class TypeInfo_Class only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(5): Error: class TypeInfo_Interface only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(6): Error: class TypeInfo_Struct only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(8): Error: class TypeInfo_Pointer only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(9): Error: class TypeInfo_Array only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(10): Error: class TypeInfo_AssociativeArray only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(11): Error: class TypeInfo_Enum only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(12): Error: class TypeInfo_Function only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(13): Error: class TypeInfo_Delegate only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(14): Error: class TypeInfo_Tuple only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(15): Error: class TypeInfo_Const only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(16): Error: class TypeInfo_Invariant only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(17): Error: class TypeInfo_Shared only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(18): Error: class TypeInfo_Inout only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(19): Error: class TypeInfo_Vector only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(20): Error: class Object only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(21): Error: class Throwable only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(22): Error: class Exception only object.d can define this reserved class name
+fail_compilation/imports/fail10277.d(23): Error: class Error only object.d can define this reserved class name
+---
+*/
+
+import imports.fail10277;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10285.d b/gcc/testsuite/gdc.test/fail_compilation/fail10285.d
new file mode 100644
index 00000000000..c94ed72eb83
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10285.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10285.d(9): Error: no identifier for declarator int
+---
+*/
+enum
+{
+    int = 5
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10299.d b/gcc/testsuite/gdc.test/fail_compilation/fail10299.d
new file mode 100644
index 00000000000..29475aa849a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10299.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10299.d(11): Error: foo!string is not an lvalue
+---
+*/
+
+template foo(T)
+{
+}
+auto fp = &foo!string;    // ICE
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10346.d b/gcc/testsuite/gdc.test/fail_compilation/fail10346.d
new file mode 100644
index 00000000000..e9d3eab9194
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10346.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10346.d(9): Error: undefined identifier 'T'
+---
+*/
+
+struct Foo(T) {}
+void bar(T x, T)(Foo!T) {}
+void main()
+{
+    Foo!int spam;
+    bar!10(spam);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail104.d b/gcc/testsuite/gdc.test/fail_compilation/fail104.d
new file mode 100644
index 00000000000..7e455f37532
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail104.d
@@ -0,0 +1,25 @@
+// Issue 76 - Using a non-template struct as a template
+// Compiling leads to "Assertion failure: 's->parent' on line 1694 in file
+// 'template.c'"
+
+struct S
+{
+    template T()
+    {
+        void x(int i)
+        {
+        }
+    }
+}
+
+class C(P)
+{
+    mixin P!().T!();
+}
+
+int main(char[][] args)
+{
+    auto c = new C!(S);
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10439.d b/gcc/testsuite/gdc.test/fail_compilation/fail10439.d
new file mode 100644
index 00000000000..662593d33fc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10439.d
@@ -0,0 +1,29 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10439.d(18): Error: use .min_normal property instead of .min
+fail_compilation/fail10439.d(19): Error: use .min_normal property instead of .min
+fail_compilation/fail10439.d(20): Error: use .min_normal property instead of .min
+fail_compilation/fail10439.d(22): Error: use .min_normal property instead of .min
+fail_compilation/fail10439.d(23): Error: use .min_normal property instead of .min
+fail_compilation/fail10439.d(24): Error: use .min_normal property instead of .min
+fail_compilation/fail10439.d(26): Error: use .min_normal property instead of .min
+fail_compilation/fail10439.d(27): Error: use .min_normal property instead of .min
+fail_compilation/fail10439.d(28): Error: use .min_normal property instead of .min
+---
+*/
+
+void main()
+{
+    auto a = float.min;
+    auto b = double.min;
+    auto c = real.min;
+
+    auto d = ifloat.min;
+    auto e = idouble.min;
+    auto f = ireal.min;
+
+    auto g = cfloat.min;
+    auto h = cdouble.min;
+    auto i = creal.min;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10481.d b/gcc/testsuite/gdc.test/fail_compilation/fail10481.d
new file mode 100644
index 00000000000..d487c76f29a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10481.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10481.d(11): Error: undefined identifier 'T1', did you mean alias 'T0'?
+fail_compilation/fail10481.d(15): Error: cannot resolve type for get!(A)
+---
+*/
+
+struct A {}
+
+void get(T0 = T1.Req, Params...)(Params , T1) {}
+
+void main()
+{
+    auto xxx = get!A;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail105.d b/gcc/testsuite/gdc.test/fail_compilation/fail105.d
new file mode 100644
index 00000000000..8702cac2f12
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail105.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail105.d(11): Error: cannot cast "bar" to int at compile time
+---
+*/
+
+//int foo = "foo";
+
+// just Access Violation happens.
+int bar = cast(int)cast(char*)"bar";
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10528.d b/gcc/testsuite/gdc.test/fail_compilation/fail10528.d
new file mode 100644
index 00000000000..52f27474193
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10528.d
@@ -0,0 +1,35 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10528.d(5): Error: module fail10528 variable a10528.a is private
+fail_compilation/fail10528.d(5): Deprecation: a10528.a is not visible from module fail10528
+fail_compilation/fail10528.d(6): Error: a10528.a is not visible from module fail10528
+fail_compilation/fail10528.d(8): Error: module fail10528 enum member a10528.b is private
+fail_compilation/fail10528.d(8): Deprecation: a10528.b is not visible from module fail10528
+fail_compilation/fail10528.d(9): Error: a10528.b is not visible from module fail10528
+fail_compilation/fail10528.d(11): Deprecation: a10528.S.c is not visible from module fail10528
+fail_compilation/fail10528.d(11): Error: variable a10528.S.c is not accessible from module fail10528
+fail_compilation/fail10528.d(12): Error: variable a10528.S.c is not accessible from module fail10528
+fail_compilation/fail10528.d(14): Deprecation: a10528.C.d is not visible from module fail10528
+fail_compilation/fail10528.d(14): Error: variable a10528.C.d is not accessible from module fail10528
+fail_compilation/fail10528.d(15): Error: variable a10528.C.d is not accessible from module fail10528
+---
+*/
+
+#line 1
+import imports.a10528;
+
+void main()
+{
+    auto a1 = a;
+    auto a2 = imports.a10528.a;
+
+    auto b1 = b;
+    auto b2 = imports.a10528.b;
+
+    auto c1 = S.c;
+    with (S) auto c2 = c;
+
+    auto d1 = C.d;
+    with (C) auto d2 = d;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10534.d b/gcc/testsuite/gdc.test/fail_compilation/fail10534.d
new file mode 100644
index 00000000000..2516135089e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10534.d
@@ -0,0 +1,41 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10534.d(28): Error: 'a' is not of arithmetic type, it is a int delegate()
+fail_compilation/fail10534.d(28): Error: 'b' is not of arithmetic type, it is a int delegate()
+fail_compilation/fail10534.d(29): Error: 'a' is not of arithmetic type, it is a int delegate()
+fail_compilation/fail10534.d(29): Error: 'b' is not of arithmetic type, it is a int delegate()
+fail_compilation/fail10534.d(30): Error: 'a' is not of arithmetic type, it is a int delegate()
+fail_compilation/fail10534.d(30): Error: 'b' is not of arithmetic type, it is a int delegate()
+fail_compilation/fail10534.d(31): Error: 'a' is not of arithmetic type, it is a int delegate()
+fail_compilation/fail10534.d(31): Error: 'b' is not of arithmetic type, it is a int delegate()
+fail_compilation/fail10534.d(36): Error: 'a' is not of arithmetic type, it is a int function()
+fail_compilation/fail10534.d(36): Error: 'b' is not of arithmetic type, it is a int function()
+fail_compilation/fail10534.d(37): Error: 'a' is not of arithmetic type, it is a int function()
+fail_compilation/fail10534.d(37): Error: 'b' is not of arithmetic type, it is a int function()
+fail_compilation/fail10534.d(38): Error: 'a' is not of arithmetic type, it is a int function()
+fail_compilation/fail10534.d(38): Error: 'b' is not of arithmetic type, it is a int function()
+fail_compilation/fail10534.d(39): Error: 'a' is not of arithmetic type, it is a int function()
+fail_compilation/fail10534.d(39): Error: 'b' is not of arithmetic type, it is a int function()
+---
+*/
+
+void main()
+{
+    {
+        int delegate() a = ()=>5;
+        int delegate() b = ()=>5;
+        auto c1 = a + b;  // passes (and will crash if c1() called)
+        auto c2 = a - b;  // passes (and will crash if c2() called)
+        auto c3 = a / b;  // a & b not of arithmetic type
+        auto c4 = a * b;  // a & b not of arithmetic type
+    }
+    {
+        int function() a = ()=>5;
+        int function() b = ()=>5;
+        auto c1 = a + b;
+        auto c2 = a - b;
+        auto c3 = a / b;
+        auto c4 = a * b;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail106.d b/gcc/testsuite/gdc.test/fail_compilation/fail106.d
new file mode 100644
index 00000000000..f6dc2eaadd6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail106.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail106.d(12): Error: cannot modify immutable expression 'C'
+---
+*/
+
+// Issue 239 - Internal error: changing string literal elements
+
+void main()
+{
+    "ABC"[2] = 's';
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10630.d b/gcc/testsuite/gdc.test/fail_compilation/fail10630.d
new file mode 100644
index 00000000000..738bdd14e34
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10630.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10630.d(12): Error: cannot have out parameter of type S because the default construction is disabled
+---
+*/
+
+struct S
+{
+    @disable this();
+}
+void foo(out S) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10666.d b/gcc/testsuite/gdc.test/fail_compilation/fail10666.d
new file mode 100644
index 00000000000..2e1747d4d2b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10666.d
@@ -0,0 +1,22 @@
+// REQUIRED_ARGS: -c
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10666.d(16): Error: variable fail10666.foo10666.s1 has scoped destruction, cannot build closure
+---
+*/
+
+
+struct S10666
+{
+    int val;
+    ~this() {}
+}
+
+void foo10666(S10666 s1)
+{
+    auto f1 = (){ return () => s1.val; }(); // NG
+
+    S10666 s2;
+    auto f2 = (){ return () => s2.val; }(); // (should be NG)
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail109.d b/gcc/testsuite/gdc.test/fail_compilation/fail109.d
new file mode 100644
index 00000000000..129062df84d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail109.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail109.d(12): Error: enum member fail109.Bool.Unknown initialization with (Bool.True + 1) causes overflow for type 'bool'
+---
+*/
+
+enum Bool : bool
+{
+    False,
+    True,
+    Unknown
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10905.d b/gcc/testsuite/gdc.test/fail_compilation/fail10905.d
new file mode 100644
index 00000000000..2028648d308
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10905.d
@@ -0,0 +1,16 @@
+
+struct Foo
+{
+    enum __vector(long[2]) y = 1;
+}
+
+struct Bar
+{
+    __vector(long[2]) x;
+
+    bool spam() const
+    {
+        return x == Foo.y;
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10947.d b/gcc/testsuite/gdc.test/fail_compilation/fail10947.d
new file mode 100644
index 00000000000..da847809a22
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10947.d
@@ -0,0 +1,31 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10947.d(21): Error: cannot have immutable out parameter of type immutable(S)
+fail_compilation/fail10947.d(22): Error: cannot have immutable out parameter of type immutable(S)
+fail_compilation/fail10947.d(23): Error: cannot have immutable out parameter of type immutable(S)
+fail_compilation/fail10947.d(25): Error: cannot have const out parameter of type const(S)
+fail_compilation/fail10947.d(26): Error: cannot have const out parameter of type const(S)
+fail_compilation/fail10947.d(27): Error: cannot have const out parameter of type const(S)
+fail_compilation/fail10947.d(29): Error: cannot have inout out parameter of type inout(S)
+fail_compilation/fail10947.d(30): Error: cannot have inout out parameter of type inout(S)
+fail_compilation/fail10947.d(31): Error: cannot have inout out parameter of type inout(S)
+---
+*/
+
+struct S {}
+alias SI = immutable S;
+alias SC = const S;
+alias SW = inout S;
+
+void fooi1(out SI) {}
+void fooi2(out immutable(S)) {}
+void fooi3(out immutable S) {}
+
+void fooc1(out SC) {}
+void fooc2(out const(S)) {}
+void fooc3(out const S) {}
+
+void foow1(out SW) {}
+void foow2(out inout(S)) {}
+void foow3(out inout S) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10964.d b/gcc/testsuite/gdc.test/fail_compilation/fail10964.d
new file mode 100644
index 00000000000..c7f8067fc50
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10964.d
@@ -0,0 +1,36 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10964.d(28): Error: function 'fail10964.S.__postblit' is not nothrow
+fail_compilation/fail10964.d(29): Error: function 'fail10964.S.__postblit' is not nothrow
+fail_compilation/fail10964.d(30): Error: function 'fail10964.S.__postblit' is not nothrow
+fail_compilation/fail10964.d(33): Error: function 'fail10964.S.__postblit' is not nothrow
+fail_compilation/fail10964.d(34): Error: function 'fail10964.S.__postblit' is not nothrow
+fail_compilation/fail10964.d(35): Error: function 'fail10964.S.__postblit' is not nothrow
+fail_compilation/fail10964.d(22): Error: nothrow function 'fail10964.foo' may throw
+---
+*/
+
+struct S
+{
+    this(this)
+    {
+        throw new Exception("BOOM!");
+    }
+}
+
+void foo() nothrow
+{
+    S    ss;
+    S[1] sa;
+
+    // TOKassign
+    ss = ss;
+    sa = ss;
+    sa = sa;
+
+    // TOKconstruct
+    S    ss2 = ss;
+    S[1] sa2 = ss;
+    S[1] sa3 = sa;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10968.d b/gcc/testsuite/gdc.test/fail_compilation/fail10968.d
new file mode 100644
index 00000000000..ef75f910180
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10968.d
@@ -0,0 +1,74 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10968.d(33): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(33): Error: @safe function 'fail10968.bar' cannot call @system function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(34): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(34): Error: @safe function 'fail10968.bar' cannot call @system function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(35): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(35): Error: @safe function 'fail10968.bar' cannot call @system function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(38): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(38): Error: @safe function 'fail10968.bar' cannot call @system function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(39): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(39): Error: @safe function 'fail10968.bar' cannot call @system function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(40): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__postblit'
+fail_compilation/fail10968.d(40): Error: @safe function 'fail10968.bar' cannot call @system function 'fail10968.SA.__postblit'
+---
+*/
+
+struct SA
+{
+    this(this)
+    {
+        throw new Exception("BOOM!");
+    }
+}
+
+void bar() pure @safe
+{
+    SA    ss;
+    SA[1] sa;
+
+    // TOKassign
+    ss = ss;
+    sa = ss;
+    sa = sa;
+
+    // TOKconstruct
+    SA    ss2 = ss;
+    SA[1] sa2 = ss;
+    SA[1] sa3 = sa;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10968.d(66): Error: struct fail10968.SD is not copyable because it is annotated with @disable
+fail_compilation/fail10968.d(67): Error: struct fail10968.SD is not copyable because it is annotated with @disable
+fail_compilation/fail10968.d(68): Error: struct fail10968.SD is not copyable because it is annotated with @disable
+fail_compilation/fail10968.d(71): Error: struct fail10968.SD is not copyable because it is annotated with @disable
+fail_compilation/fail10968.d(72): Error: struct fail10968.SD is not copyable because it is annotated with @disable
+fail_compilation/fail10968.d(73): Error: struct fail10968.SD is not copyable because it is annotated with @disable
+---
+*/
+
+struct SD
+{
+    this(this) @disable;
+}
+
+void baz()
+{
+    SD    ss;
+    SD[1] sa;
+
+    // TOKassign
+    ss = ss;
+    sa = ss;
+    sa = sa;
+
+    // TOKconstruct
+    SD    ss2 = ss;
+    SD[1] sa2 = ss;
+    SD[1] sa3 = sa;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10980.d b/gcc/testsuite/gdc.test/fail_compilation/fail10980.d
new file mode 100644
index 00000000000..eb50de34ebe
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail10980.d
@@ -0,0 +1,44 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail10980.d(22): Error: variable fail10980.s1b of type struct immutable(S1) uses this(this), which is not allowed in static initialization
+fail_compilation/fail10980.d(28): Error: variable fail10980.s1d of type struct immutable(S1) uses this(this), which is not allowed in static initialization
+fail_compilation/fail10980.d(27): Error: static variable s1x cannot be read at compile time
+fail_compilation/fail10980.d(28):        called from here: bar1()
+fail_compilation/fail10980.d(38): Error: variable fail10980.s2b of type struct immutable(S2) uses this(this), which is not allowed in static initialization
+fail_compilation/fail10980.d(44): Error: variable fail10980.s2d of type struct immutable(S2) uses this(this), which is not allowed in static initialization
+fail_compilation/fail10980.d(43): Error: static variable s2x cannot be read at compile time
+fail_compilation/fail10980.d(44):        called from here: bar2()
+---
+*/
+
+struct S1
+{
+    this(int) immutable {}
+    this(this) {}
+}
+alias immutable(S1) IS1;
+static immutable S1 s1a = IS1(1);   // OK
+static immutable S1 s1b = s1a;      // NG
+
+S1 foo1() { S1 s1x; S1 s1y = s1x; return s1y; }
+static immutable S1 s1c = foo1();   // OK
+
+ref S1 bar1() { static S1 s1x; return s1x; }
+static immutable S1 s1d = bar1();   // NG
+
+
+struct S2
+{
+    int val;
+    this(this) {}
+}
+alias immutable(S2) IS2;
+static immutable S2 s2a = IS2(1);   // OK
+static immutable S2 s2b = s2a;      // NG
+
+S2 foo2() { S2 s2x; S2 s2y = s2x; return s2y; }
+static immutable S2 s2c = foo2();   // OK
+
+ref S2 bar2() { static S2 s2x; return s2x; }
+static immutable S2 s2d = bar2();   // NG
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11.d b/gcc/testsuite/gdc.test/fail_compilation/fail11.d
new file mode 100644
index 00000000000..6a6a3da7aa9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11.d(12): Error: type has no effect in expression (int*)
+---
+*/
+
+// http://forum.dlang.org/thread/c738o9$1p7i$1@digitaldaemon.com
+
+void main()
+{
+    TFoo!(int).t; // should produce a "no identifier" error.
+}
+template TFoo(T) { alias T* t; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail110.d b/gcc/testsuite/gdc.test/fail_compilation/fail110.d
new file mode 100644
index 00000000000..3e9beb02121
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail110.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail110.d(16): Error: variable i is shadowing variable fail110.main.i
+fail_compilation/fail110.d(17): Error: variable i is shadowing variable fail110.main.i
+fail_compilation/fail110.d(18): Error: variable i is shadowing variable fail110.main.i
+---
+*/
+
+// Issue 297 - Shadowing declarations allowed in foreach type lists
+
+void main()
+{
+    int i;
+    int[] a;
+    foreach (i; a) {}
+    foreach (int i, n; a) {}
+    for (int i;;) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11042.d b/gcc/testsuite/gdc.test/fail_compilation/fail11042.d
new file mode 100644
index 00000000000..cf3a84540cc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11042.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11042.d(8): Error: undefined identifier 'error', did you mean class 'Error'?
+fail_compilation/fail11042.d(9): Error: undefined identifier 'error', did you mean class 'Error'?
+---
+*/
+static if ({ return true  || error; }()) {} // NG
+static if ({ return false && error; }()) {} // NG
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail111.d b/gcc/testsuite/gdc.test/fail_compilation/fail111.d
new file mode 100644
index 00000000000..3a5fed4b06f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail111.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail111.d(12): Error: can't have array of int(int)
+---
+*/
+
+// Issue 289 - Compiler allows (and crashes on) dynamic arrays of typedefs of "immediate"-function types
+
+alias int ft(int);
+
+ft[] x;  // is allowed
+
+void test()
+{
+    x.length = 2;  // crashes DMD
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11125.d b/gcc/testsuite/gdc.test/fail_compilation/fail11125.d
new file mode 100644
index 00000000000..60315e54983
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11125.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11125.d(22): Error: template fail11125.filter cannot deduce function from argument types !(function (int a) => a + 1)(int[]), candidates are:
+fail_compilation/fail11125.d(13):        fail11125.filter(alias predfun) if (is(ReturnType!predfun == bool))
+fail_compilation/fail11125.d(23): Error: template fail11125.filter cannot deduce function from argument types !(function (int a) => a + 1)(int[]), candidates are:
+fail_compilation/fail11125.d(13):        fail11125.filter(alias predfun) if (is(ReturnType!predfun == bool))
+---
+*/
+
+template ReturnType(alias fun) { alias int ReturnType; }
+
+template filter(alias predfun)
+    if (is(ReturnType!predfun == bool))
+{
+    static assert(is(ReturnType!predfun == bool));
+    auto filter(Range)(Range r) { }
+}
+
+void main()
+{
+    filter!((int a) => a + 1)([1]);  // fails in constraint
+    [1].filter!((int a) => a + 1);   // fails internally in static assert!
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11151.d b/gcc/testsuite/gdc.test/fail_compilation/fail11151.d
new file mode 100644
index 00000000000..61843174c57
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11151.d
@@ -0,0 +1,36 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11151.d(30): Error: overlapping initialization for field a and y
+---
+*/
+
+//extern(C) int printf(const char*, ...);
+
+union U
+{
+    struct
+    {
+        align(1) long a;
+        align(1) int b;
+    }
+    struct
+    {
+        align(1) int x;
+        align(1) long y;
+    }
+}
+void main()
+{
+    static assert(U.a.offsetof == 0);
+    static assert(U.b.offsetof == 8);
+    static assert(U.x.offsetof == 0);
+    static assert(U.y.offsetof == 4);
+
+    U u = {a:1, y:2};   // overlapped initializing U.a and U.y
+
+    //printf("u.a = %lld\n", u.a);    // 8589934593 , Wrong!
+    //printf("u.b = %d\n",   u.b);    // 0
+    //printf("u.x = %d\n",   u.x);    // 1
+    //printf("u.y = %lld\n", u.y);    // 2
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11163.d b/gcc/testsuite/gdc.test/fail_compilation/fail11163.d
new file mode 100644
index 00000000000..1bad7b51d28
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11163.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11163.d(12): Error: cannot implicitly convert expression (foo()) of type int[] to immutable(int[])
+fail_compilation/fail11163.d(13):        while evaluating pragma(msg, a)
+---
+*/
+int[] foo() {
+    return [1];
+}
+void main() {
+    immutable a = foo();
+    pragma(msg, a);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11169.d b/gcc/testsuite/gdc.test/fail_compilation/fail11169.d
new file mode 100644
index 00000000000..e6ab4a64886
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11169.d
@@ -0,0 +1,28 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11169.d(16): Error: error evaluating static if expression
+---
+*/
+
+class A
+{
+    abstract void foo();
+}
+
+class B : A
+{
+    // __traits(isAbstractClass) is not usable in static if condition.
+    static if (__traits(isAbstractClass, typeof(this)))
+    {
+    }
+
+    override void foo()
+    {
+    }
+}
+
+void main()
+{
+    B b = new B();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail113.d b/gcc/testsuite/gdc.test/fail_compilation/fail113.d
new file mode 100644
index 00000000000..8271b025d40
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail113.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail113.d(10): Error: forward reference to 'test'
+---
+*/
+
+// Issue 370 - Compiler stack overflow on recursive typeof in function declaration.
+
+void test(typeof(test) p) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11355.d b/gcc/testsuite/gdc.test/fail_compilation/fail11355.d
new file mode 100644
index 00000000000..474d376794f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11355.d
@@ -0,0 +1,29 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11355.d(28): Error: struct fail11355.A is not copyable because it is annotated with @disable
+---
+*/
+
+T move(T)(ref T source)
+{
+    return T.init;          // Dummy rvalue
+}
+
+struct A
+{
+    ~this() {}
+    @disable this(this);    // Prevent copying
+}
+
+struct B
+{
+    A a;
+    alias a this;
+}
+
+void main()
+{
+    B b;
+    A a = move(b);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11375.d b/gcc/testsuite/gdc.test/fail_compilation/fail11375.d
new file mode 100644
index 00000000000..0d1e6584772
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11375.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11375.d(17): Error: constructor 'fail11375.D!().D.this' is not nothrow
+fail_compilation/fail11375.d(15): Error: nothrow function 'D main' may throw
+---
+*/
+
+class B {
+    this() {}
+}
+
+class D() : B {}
+
+void main() nothrow
+{
+    auto d = new D!()();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail114.d b/gcc/testsuite/gdc.test/fail_compilation/fail114.d
new file mode 100644
index 00000000000..5bb9cec8a81
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail114.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail114.d(12): Error: forward reference to 'funcA'
+---
+*/
+
+// Issue 371 - ICE on mutual recursive typeof in function declarations
+
+void funcA(typeof(&funcB) p) {}
+
+void funcB(typeof(&funcA) p) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11426.d b/gcc/testsuite/gdc.test/fail_compilation/fail11426.d
new file mode 100644
index 00000000000..64aa43c57fa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11426.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11426.d(15): Error: cannot implicitly convert expression (udarr) of type uint[] to int[]
+fail_compilation/fail11426.d(16): Error: cannot implicitly convert expression (usarr) of type uint[1] to int[]
+fail_compilation/fail11426.d(18): Error: cannot implicitly convert expression (udarr) of type uint[] to int[]
+fail_compilation/fail11426.d(19): Error: cannot implicitly convert expression (usarr) of type uint[1] to int[]
+---
+*/
+void main()
+{
+    uint[]  udarr;
+    uint[1] usarr;
+
+    int[1] arr1; arr1 = udarr;  // Error, OK
+    int[1] arr2; arr2 = usarr;  // Error, OK
+
+    int[1] arr3 = udarr;    // accepted, BAD!
+    int[1] arr4 = usarr;    // accepted, BAD!
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11445.d b/gcc/testsuite/gdc.test/fail_compilation/fail11445.d
new file mode 100644
index 00000000000..a3cfc11ed19
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11445.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11445.d(11): Error: incompatible types for ((a) + (b)): 'double[string]' and 'double[string]'
+---
+*/
+
+void main() {
+  double[string] a = [ "foo" : 22.2 ];
+  double[string] b = [ "bar" : 22.2 ];
+  auto c = a + b;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11453a.d b/gcc/testsuite/gdc.test/fail_compilation/fail11453a.d
new file mode 100644
index 00000000000..488bc6e0ff9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11453a.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -Ifail_compilation/extra-files
+// EXTRA_SOURCES: extra-files/foo11453.d extra-files/bar11453.d
+/*
+TEST_OUTPUT
+---
+fail_compilation/extra-files/bar11453.d(1): Error: package name 'foo11453' conflicts with usage as a module name in file fail_compilation/extra-files/foo11453.d
+---
+*/
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11453b.d b/gcc/testsuite/gdc.test/fail_compilation/fail11453b.d
new file mode 100644
index 00000000000..c7bdce5ef83
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11453b.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -Ifail_compilation/extra-files
+// EXTRA_SOURCES: extra-files/bar11453.d extra-files/foo11453.d
+/*
+TEST_OUTPUT
+---
+fail_compilation/extra-files/foo11453.d(1): Error: module foo11453 from file fail_compilation/extra-files/foo11453.d conflicts with package name foo11453
+---
+*/
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail115.d b/gcc/testsuite/gdc.test/fail_compilation/fail115.d
new file mode 100644
index 00000000000..e9d5a67d293
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail115.d
@@ -0,0 +1,11 @@
+// Issue 402 - compiler crash with mixin and forward reference
+
+template Foo(alias b)
+{
+    int a() { return b; }
+}
+
+void main()
+{
+    mixin Foo!(y) y;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11503a.d b/gcc/testsuite/gdc.test/fail_compilation/fail11503a.d
new file mode 100644
index 00000000000..28f7befdf91
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11503a.d
@@ -0,0 +1,21 @@
+struct S
+{
+    immutable(S)* s;
+    this(int) immutable pure
+    {
+        s = &this;
+    }
+    int data;
+}
+
+immutable(S)* makes() pure
+{
+    return new immutable S(0);
+}
+
+void main()
+{
+    S* s = makes(); // s is mutable and contains an immutable reference to itself
+    //s.s.data = 7; // this is immutable
+    s.data = 3; // but this is not!!!
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11503b.d b/gcc/testsuite/gdc.test/fail_compilation/fail11503b.d
new file mode 100644
index 00000000000..80549de8e6c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11503b.d
@@ -0,0 +1,13 @@
+immutable int[] x = [1, 2, 3];
+
+auto makes() pure
+{
+    return x;
+}
+
+int main()
+{
+    auto a = x;
+    int[] b = makes();
+    return b[1];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11503c.d b/gcc/testsuite/gdc.test/fail_compilation/fail11503c.d
new file mode 100644
index 00000000000..dc45eefc093
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11503c.d
@@ -0,0 +1,15 @@
+struct Data
+{
+    char[256] buffer;
+    @property const(char)[] filename() const pure nothrow
+    {
+        return buffer[];
+    }
+}
+
+void main()
+{
+    Data d;
+    string f = d.filename;
+    d.buffer[0] = 'a';
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11503d.d b/gcc/testsuite/gdc.test/fail_compilation/fail11503d.d
new file mode 100644
index 00000000000..d96e2a8b249
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11503d.d
@@ -0,0 +1,22 @@
+struct Data2
+{
+    char buffer;
+}
+
+@property const(char)[] filename(const ref Data2 d) pure nothrow
+{
+    return (&d.buffer)[0 .. 1];
+}
+
+@property const(char)[] filename2(const Data2* d) pure nothrow
+{
+    return (&d.buffer)[0 .. 1];
+}
+
+void main()
+{
+    Data2 d;
+    string f = d.filename;
+    string g = (&d).filename2;
+    d.buffer = 'a';
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11510.d b/gcc/testsuite/gdc.test/fail_compilation/fail11510.d
new file mode 100644
index 00000000000..13913a0a46d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11510.d
@@ -0,0 +1,40 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11510.d(25): Error: reinterpretation through overlapped field y is not allowed in CTFE
+fail_compilation/fail11510.d(29):        called from here: test11510a()
+fail_compilation/fail11510.d(36): Error: reinterpretation through overlapped field y is not allowed in CTFE
+fail_compilation/fail11510.d(40):        called from here: test11510b()
+---
+*/
+
+struct S11510
+{
+    union
+    {
+        size_t x;
+        int* y; // pointer field
+    }
+}
+
+bool test11510a()
+{
+    S11510 s;
+
+    s.y = [1,2,3].ptr;
+    auto x = s.x;   // reinterpretation
+
+    return true;
+}
+enum a = test11510a();
+
+bool test11510b()
+{
+    S11510 s;
+
+    s.x = 10;
+    auto y = s.y;   // reinterpretation
+
+    return true;
+}
+enum b = test11510b();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11532.d b/gcc/testsuite/gdc.test/fail_compilation/fail11532.d
new file mode 100644
index 00000000000..7f4c770527e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11532.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11532.d(17): Error: cannot pass static arrays to extern(C) vararg functions
+fail_compilation/fail11532.d(18): Error: cannot pass dynamic arrays to extern(C) vararg functions
+fail_compilation/fail11532.d(19): Error: cannot pass static arrays to extern(C++) vararg functions
+fail_compilation/fail11532.d(20): Error: cannot pass dynamic arrays to extern(C++) vararg functions
+---
+*/
+
+extern(C) void cvararg(int, ...);
+extern(C++) void cppvararg(int, ...);
+
+void main()
+{
+    int[2] arr = [0x99999999, 0x88888888];
+    cvararg(0, arr);
+    cvararg(0, arr[]);
+    cppvararg(0, arr);
+    cppvararg(0, arr[]);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11542.d b/gcc/testsuite/gdc.test/fail_compilation/fail11542.d
new file mode 100644
index 00000000000..ca620f05194
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11542.d
@@ -0,0 +1,73 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11542.d(16): Error: object.Exception is thrown but not caught
+fail_compilation/fail11542.d(13): Error: nothrow function 'fail11542.test_success1' may throw
+fail_compilation/fail11542.d(26): Error: object.Exception is thrown but not caught
+fail_compilation/fail11542.d(23): Error: nothrow function 'fail11542.test_success3' may throw
+---
+*/
+void test_success1() nothrow
+{
+    scope(success) {}
+    throw new Exception("");    // error
+}
+void test_success2() nothrow
+{
+    scope(success) {}
+    throw new Error("");        // no error
+}
+void test_success3() nothrow
+{
+    scope(success) assert(0);
+    throw new Exception("");    // error
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11542.d(39): Error: object.Exception is thrown but not caught
+fail_compilation/fail11542.d(36): Error: nothrow function 'fail11542.test_failure1' may throw
+---
+*/
+void test_failure1() nothrow
+{
+    scope(failure) {}
+    throw new Exception("");    // error
+}
+void test_failure2() nothrow
+{
+    scope(failure) {}
+    throw new Error("");        // no error
+}
+void est_failure3() nothrow
+{
+    scope(failure) assert(0);
+    throw new Exception("");    // no error
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11542.d(62): Error: object.Exception is thrown but not caught
+fail_compilation/fail11542.d(59): Error: nothrow function 'fail11542.test_exit1' may throw
+---
+*/
+void test_exit1() nothrow
+{
+    scope(exit) {}
+    throw new Exception("");    // error
+}
+void test_exit2() nothrow
+{
+    scope(exit) {}
+    throw new Error("");        // no error
+}
+void test_exit3() nothrow
+{
+    scope(exit) assert(0);
+    throw new Exception("");    // no error
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11545.d b/gcc/testsuite/gdc.test/fail_compilation/fail11545.d
new file mode 100644
index 00000000000..514cb87854a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11545.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11545.d(14): Error: need 'this' for 'x' of type 'int'
+fail_compilation/fail11545.d(18): Error: need 'this' for 'x' of type 'int'
+---
+*/
+
+class C
+{
+    int x = 42;
+
+    int function() f1 = function() {
+        return x;
+    };
+
+    int function() f2 = {
+        return x;
+    };
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11552.d b/gcc/testsuite/gdc.test/fail_compilation/fail11552.d
new file mode 100644
index 00000000000..3f47bfbf4c5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11552.d
@@ -0,0 +1,13 @@
+/*
+REQUIRED_ARGS: -o-
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/fail11552.d(12): Error: label 'label' is undefined
+---
+*/
+
+void main()
+{
+    goto label;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11562.d b/gcc/testsuite/gdc.test/fail_compilation/fail11562.d
new file mode 100644
index 00000000000..4e4271fb2f0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11562.d
@@ -0,0 +1,67 @@
+/*
+REQUIRED_ARGS: -o-
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/fail11562.d(16): Error: cannot goto in or out of finally block
+fail_compilation/fail11562.d(37): Error: cannot goto in or out of finally block
+fail_compilation/fail11562.d(49): Error: cannot goto in or out of finally block
+fail_compilation/fail11562.d(64): Error: cannot goto in or out of finally block
+---
+*/
+
+// Goto into finally block (forwards)
+int w(bool b)
+{
+    if (b) goto label;
+    try
+    {
+    }
+    finally
+    {
+    label: {}
+    }
+    return 1;
+}
+
+// // Goto into finally block (backwards)
+int x(bool b)
+{
+    try
+    {
+    }
+    finally
+    {
+    label: {}
+    }
+    if (b) goto label;
+    return 1;
+}
+
+// Goto out of finally block (forwards)
+int y(bool b)
+{
+    try
+    {
+    }
+    finally
+    {
+    if (b) goto label;
+    }
+    label: {}
+    return 1;
+}
+
+// // Goto out of finally block (backwards)
+int z(bool b)
+{
+    label: {}
+    try
+    {
+    }
+    finally
+    {
+    if (b) goto label;
+    }
+    return 1;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11591b.d b/gcc/testsuite/gdc.test/fail_compilation/fail11591b.d
new file mode 100644
index 00000000000..42e89c96459
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11591b.d
@@ -0,0 +1,34 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11591b.d(16): Error: AA key type S11591 does not have 'bool opEquals(ref const S11591) const'
+---
+*/
+
+struct S11591
+{
+    bool opEquals(int i) { return false; }
+    Object o; // needed to suppress compiler generated opEquals
+}
+
+void test11591()
+{
+    int[S11591] aa;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11591b.d(30): Error: AA key type S12307a does not have 'bool opEquals(ref const S12307a) const'
+fail_compilation/fail11591b.d(31): Error: AA key type S12307b does not have 'bool opEquals(ref const S12307b) const'
+---
+*/
+struct S12307a { bool opEquals(T : typeof(this))(T) { return false; } }
+
+void test12307()
+{
+    int[S12307a] aa1;    // a
+    int[S12307b] aa2;    // b
+}
+
+struct S12307b { bool opEquals(T : typeof(this))(T) { return false; } }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail116.d b/gcc/testsuite/gdc.test/fail_compilation/fail116.d
new file mode 100644
index 00000000000..87e451bcf09
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail116.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail116.d(11): Error: circular typeof definition
+fail_compilation/fail116.d(16): Error: template instance square!1.2 does not match template declaration square(_error_ x)
+---
+*/
+
+// Issue 405 - typeof in TemplateParameterList causes compiletime segmentfault
+
+template square(typeof(x) x)
+{
+    const square = x * x;
+}
+
+const b = square!(1.2);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11653.d b/gcc/testsuite/gdc.test/fail_compilation/fail11653.d
new file mode 100644
index 00000000000..fa69edb573e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11653.d
@@ -0,0 +1,27 @@
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11653.d(19): Deprecation: switch case fallthrough - use 'goto case;' if intended
+fail_compilation/fail11653.d(24): Deprecation: switch case fallthrough - use 'goto default;' if intended
+---
+*/
+
+void main()
+{
+    int test = 12412;
+    int output = 0;
+    switch(test)
+    {
+        case 1:
+            output = 1;
+            //break; //Oops..
+        case 2: .. case 3:
+            output = 2;
+            break;
+        case 4:
+            output = 3;
+        default:
+            output = 4;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail117.d b/gcc/testsuite/gdc.test/fail_compilation/fail117.d
new file mode 100644
index 00000000000..f39a48db67c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail117.d
@@ -0,0 +1,37 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail117.d(35): Error: expression has no value
+fail_compilation/fail117.d(36): Error: expression has no value
+---
+*/
+
+// Issue 420 - mixin make dmd break
+
+//import std.stdio;
+
+template MGettor(alias Fld)
+{
+    typeof(Fld) opCall()
+    {
+        //writefln("getter");
+        return Fld;
+    }
+}
+
+class Foo
+{
+    int a = 1,
+        b = 2;
+
+    mixin MGettor!(a) geta;
+    mixin MGettor!(b) getb;
+}
+
+void main()
+{
+    auto foo = new Foo;
+
+    int a = foo.geta;
+    int b = foo.getb;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11717.d b/gcc/testsuite/gdc.test/fail_compilation/fail11717.d
new file mode 100644
index 00000000000..c6d505ca02d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11717.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11717.d(13): Error: cannot interpret array literal expression [1, 2, 3, 4] + [1, 2, 3, 4] at compile time
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=11717
+
+enum int[4] A = [1,2,3,4];
+enum int[4] B = [1,2,3,4];
+// Internal Compiler Error: non-constant value [1, 2, 3, 4]
+enum int[4] C = A[] + B[];
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11720.d b/gcc/testsuite/gdc.test/fail_compilation/fail11720.d
new file mode 100644
index 00000000000..8ad1d862d6b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11720.d
@@ -0,0 +1,33 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11720.d(23): Error: declaration fail11720.foo!().foo.temp is already defined in another scope in foo
+fail_compilation/fail11720.d(13): Error: template instance fail11720.foo!() error instantiating
+fail_compilation/fail11720.d(31): Error: declaration fail11720.bar.temp is already defined in another scope in bar
+---
+*/
+
+void main()
+{
+    foo();
+    bar();
+}
+
+alias TypeTuple(T...) = T;
+
+void foo()()
+{
+    foreach (T; TypeTuple!(int, double))
+    {
+        static temp = T.stringof;
+    }
+}
+
+void bar()
+{
+    foreach (T; TypeTuple!(int, double))
+    {
+        static temp = T.stringof;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11746.d b/gcc/testsuite/gdc.test/fail_compilation/fail11746.d
new file mode 100644
index 00000000000..625718e737f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11746.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11746.d(18): Error: cannot implicitly convert expression (1) of type int to string
+fail_compilation/fail11746.d(25): Error: cannot implicitly convert expression (1) of type int to string
+fail_compilation/fail11746.d(26): Error: cannot implicitly convert expression (2) of type int to string
+---
+*/
+
+string bb(T, U)(T x, U y)
+{
+    return "3";
+}
+
+enum E1
+{
+    foo = bb(bar, baz),
+    bar = 1,
+    baz = "2",
+}
+
+enum E2
+{
+    foo = bb(bar, baz),
+    bar = 1,
+    baz = 2
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11748.d b/gcc/testsuite/gdc.test/fail_compilation/fail11748.d
new file mode 100644
index 00000000000..95b78fa0340
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11748.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11748.d(12): Error: expression my_function(0) is void and has no value
+---
+*/
+
+void main()
+{
+    enum my_template(alias T) = T.stringof;
+    void my_function(int i) { }
+    my_template!(my_function(0));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11751.d b/gcc/testsuite/gdc.test/fail_compilation/fail11751.d
new file mode 100644
index 00000000000..b482f5f2a16
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail11751.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail11751.d(10): Error: missing exponent
+fail_compilation/fail11751.d(10): Error: semicolon expected following auto declaration, not 'ABC'
+fail_compilation/fail11751.d(10): Error: no identifier for declarator ABC
+---
+*/
+
+auto x = 0x1.FFFFFFFFFFFFFpABC;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail118.d b/gcc/testsuite/gdc.test/fail_compilation/fail118.d
new file mode 100644
index 00000000000..56df66973c3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail118.d
@@ -0,0 +1,28 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail118.d(26): Error: invalid foreach aggregate Iter, define opApply(), range primitives, or use .tupleof
+fail_compilation/fail118.d(27): Error: invalid foreach aggregate Iter, define opApply(), range primitives, or use .tupleof
+---
+*/
+
+// Issue 441 - Crash on foreach of mixed-in aggregate.
+
+template opHackedApply()
+{
+    struct Iter
+    {
+    }
+}
+
+class Foo
+{
+    mixin opHackedApply!() oldIterMix;
+}
+
+void main()
+{
+    Foo f = new Foo;
+    foreach (int i; f.oldIterMix.Iter) {}
+    foreach (    i; f.oldIterMix.Iter) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12.d b/gcc/testsuite/gdc.test/fail_compilation/fail12.d
new file mode 100644
index 00000000000..ad38cd790b8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12.d
@@ -0,0 +1,13 @@
+template Foo(alias b)
+{
+    int abc() { return b; }
+}
+
+void main()
+{
+    int y = 8;
+    mixin Foo!(y);
+    mixin Foo!(y);
+    assert(abc() == 8);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail120.d b/gcc/testsuite/gdc.test/fail_compilation/fail120.d
new file mode 100644
index 00000000000..ae0f5b1093b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail120.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail120.d(12): Error: need 'this' for 'nodes' of type 'int[2]'
+fail_compilation/fail120.d(13): Error: need 'this' for 'nodes' of type 'int[2]'
+---
+*/
+
+class Foo
+{
+    int[2] nodes;
+    auto left = (){ return nodes[0]; };
+    auto right = (){ return nodes[1]; };
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12047.d b/gcc/testsuite/gdc.test/fail_compilation/fail12047.d
new file mode 100644
index 00000000000..2835aadecad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12047.d
@@ -0,0 +1,21 @@
+// REQUIRED_ARGS: -d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12047.d(15): Error: undefined identifier 'asdf'
+fail_compilation/fail12047.d(16): Error: undefined identifier 'asdf'
+fail_compilation/fail12047.d(17): Error: undefined identifier 'asdf'
+fail_compilation/fail12047.d(18): Error: undefined identifier 'asdf'
+fail_compilation/fail12047.d(19): Error: undefined identifier 'asdf'
+fail_compilation/fail12047.d(20): Error: undefined identifier 'asdf'
+fail_compilation/fail12047.d(21): Error: undefined identifier 'asdf'
+---
+*/
+
+@asdf void func() { }
+@asdf int var = 1;
+@asdf enum E : int { a }
+@asdf struct S {}
+@asdf class C {}
+@asdf interface I {}
+@asdf alias int myint;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail121.d b/gcc/testsuite/gdc.test/fail_compilation/fail121.d
new file mode 100644
index 00000000000..4bc8179d282
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail121.d
@@ -0,0 +1,17 @@
+// PERMUTE_ARGS: -d -dw
+// segfault on DMD0.150, never failed if use typeid() instead.
+
+struct myobject
+{
+    TypeInfo objecttype;
+    void* offset;
+}
+
+myobject[] list;
+
+void foo()
+{
+    int i;
+
+    list[1].typeinfo = i.typeinfo;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail122.d b/gcc/testsuite/gdc.test/fail_compilation/fail122.d
new file mode 100644
index 00000000000..c84156d51a0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail122.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail122.d(12): Error: undefined identifier 'y'
+---
+*/
+
+// Issue 228 - Crash on inferring function literal return type after prior errors
+
+void main()
+{
+    y = 2;
+    auto x = function(){};
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12236.d b/gcc/testsuite/gdc.test/fail_compilation/fail12236.d
new file mode 100644
index 00000000000..ea950667976
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12236.d
@@ -0,0 +1,33 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12236.d(16): Error: forward reference to inferred return type of function 'f1'
+fail_compilation/fail12236.d(16):        while evaluating pragma(msg, f1.mangleof)
+fail_compilation/fail12236.d(21): Error: forward reference to inferred return type of function 'f2'
+fail_compilation/fail12236.d(21):        while evaluating pragma(msg, f2(T)(T).mangleof)
+fail_compilation/fail12236.d(27): Error: template instance fail12236.f2!int error instantiating
+fail_compilation/fail12236.d(31): Error: forward reference to inferred return type of function '__lambda1'
+fail_compilation/fail12236.d(31):        while evaluating pragma(msg, __lambda1.mangleof)
+---
+*/
+
+auto f1(int)
+{
+    pragma(msg, f1.mangleof);  // forward reference error
+}
+
+auto f2(T)(T)
+{
+    pragma(msg, f2.mangleof);  // error <- weird output: "v"
+}
+
+void main()
+{
+    f1(1);
+    f2(1);
+
+    (a) {
+        int x;
+        pragma(msg, __traits(parent, x).mangleof);
+    } (1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12255.d b/gcc/testsuite/gdc.test/fail_compilation/fail12255.d
new file mode 100644
index 00000000000..4531e86e8c0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12255.d
@@ -0,0 +1,139 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12255.d(29): Error: AA key type SC1 does not have 'bool opEquals(ref const SC1) const'
+fail_compilation/fail12255.d(30): Error: AA key type SC2 does not support const equality
+fail_compilation/fail12255.d(35): Error: AA key type SD1 should have 'size_t toHash() const nothrow @safe' if opEquals defined
+fail_compilation/fail12255.d(36): Error: AA key type SD2 supports const equality but doesn't support const hashing
+fail_compilation/fail12255.d(40): Error: AA key type SE1 should have 'size_t toHash() const nothrow @safe' if opEquals defined
+fail_compilation/fail12255.d(41): Error: AA key type SE2 supports const equality but doesn't support const hashing
+---
+*/
+
+void main()
+{
+    /* Key comparison and hashing are based on object bit representation,
+     * and they fully supported in runtime (TypeInfo.equals and TypeInfo.getHash)
+     */
+    int[SA1] a1;    // OK
+    int[SA2] a2;    // OK
+
+    /* If only toHash is defined, AA assumes that is customized object hashing.
+     */
+    int[SB1] b1;    // OK
+    int[SB2] b2;    // OK
+
+    /* If key does not support const equality,
+     * it is disallowed, because TypeInfo.equals will throw Error.
+     */
+    int[SC1] c1;    // NG
+    int[SC2] c2;    // NG
+
+    /* If opEquals defined for const equality, corresponding toHash method
+     * is required to guarantee (a != b || a.toHash() == b.toHash()).
+     */
+    int[SD1] d1;    // NG
+    int[SD2] d2;    // NG
+
+    /* same as SD cases
+     */
+    int[SE1] e1;    // NG
+    int[SE2] e2;    // NG
+}
+
+struct SA1 { int val; }
+struct SA2 { SA1 s; }
+
+struct SB1
+{
+    // AA assumes this is specialized hashing (?)
+    size_t toHash() const nothrow @safe { return 0; }
+}
+struct SB2
+{
+    SB1 s;
+    // implicit generated toHash() calls s.toHash().
+}
+
+struct SC1
+{
+    // does not support const equality
+    bool opEquals(typeof(this)) /*const*/ { return true; }
+}
+struct SC2
+{
+    SC1 s;
+}
+
+struct SD1
+{
+    // Supports const equality, but
+    // does not have corresponding toHash()
+    bool opEquals(typeof(this)) const { return true; }
+}
+struct SD2
+{
+    SD1 s;
+}
+
+struct SE1
+{
+    // Supports const equality, but
+    // does not have corresponding valid toHash()
+    bool opEquals(typeof(this)) const { return true; }
+    size_t toHash() @system { return 0; }
+}
+struct SE2
+{
+    SE1 s;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12255.d(108): Error: bottom of AA key type SC1 does not have 'bool opEquals(ref const SC1) const'
+fail_compilation/fail12255.d(109): Error: bottom of AA key type SC2 does not support const equality
+fail_compilation/fail12255.d(110): Error: bottom of AA key type SD1 should have 'size_t toHash() const nothrow @safe' if opEquals defined
+fail_compilation/fail12255.d(111): Error: bottom of AA key type SD2 supports const equality but doesn't support const hashing
+fail_compilation/fail12255.d(112): Error: bottom of AA key type SE1 should have 'size_t toHash() const nothrow @safe' if opEquals defined
+fail_compilation/fail12255.d(113): Error: bottom of AA key type SE2 supports const equality but doesn't support const hashing
+---
+*/
+void testSArray()
+{
+    int[SA1[1]] a1;    // OK
+    int[SA2[1]] a2;    // OK
+    int[SB1[1]] b1;    // OK
+    int[SB2[1]] b2;    // OK
+    int[SC1[1]] c1;    // NG
+    int[SC2[1]] c2;    // NG
+    int[SD1[1]] d1;    // NG
+    int[SD2[1]] d2;    // NG
+    int[SE1[1]] e1;    // NG
+    int[SE2[1]] e2;    // NG
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12255.d(133): Error: bottom of AA key type SC1 does not have 'bool opEquals(ref const SC1) const'
+fail_compilation/fail12255.d(134): Error: bottom of AA key type SC2 does not support const equality
+fail_compilation/fail12255.d(135): Error: bottom of AA key type SD1 should have 'size_t toHash() const nothrow @safe' if opEquals defined
+fail_compilation/fail12255.d(136): Error: bottom of AA key type SD2 supports const equality but doesn't support const hashing
+fail_compilation/fail12255.d(137): Error: bottom of AA key type SE1 should have 'size_t toHash() const nothrow @safe' if opEquals defined
+fail_compilation/fail12255.d(138): Error: bottom of AA key type SE2 supports const equality but doesn't support const hashing
+---
+*/
+void testDArray()
+{
+    int[SA1[]] a1;    // OK
+    int[SA2[]] a2;    // OK
+    int[SB1[]] b1;    // OK
+    int[SB2[]] b2;    // OK
+    int[SC1[]] c1;    // NG
+    int[SC2[]] c2;    // NG
+    int[SD1[]] d1;    // NG
+    int[SD2[]] d2;    // NG
+    int[SE1[]] e1;    // NG
+    int[SE2[]] e2;    // NG
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail123.d b/gcc/testsuite/gdc.test/fail_compilation/fail123.d
new file mode 100644
index 00000000000..ded5be00914
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail123.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail123.d(11): Error: undefined identifier 'type'
+fail_compilation/fail123.d(17): Error: enum fail123.foo2 base type must not be void
+---
+*/
+
+// Issue 355 - ICE from enum : nonexistent type
+
+enum foo : type
+{
+    blah1,
+    blah2
+}
+
+enum foo2 : void { a, b }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12378.d b/gcc/testsuite/gdc.test/fail_compilation/fail12378.d
new file mode 100644
index 00000000000..c6da694703a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12378.d
@@ -0,0 +1,145 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12378.d(18): Error: undefined identifier 'ANYTHING'
+fail_compilation/fail12378.d(18): Error: undefined identifier 'GOES'
+fail_compilation/fail12378.d(91):        instantiated from here: MapResultS!((x0) => ANYTHING - GOES, Result)
+fail_compilation/fail12378.d(17):        instantiated from here: mapS!(Result)
+fail_compilation/fail12378.d(100):        instantiated from here: __lambda1!int
+fail_compilation/fail12378.d(91):        instantiated from here: MapResultS!((y0) => iota(2).mapS!((x0) => ANYTHING - GOES), Result)
+fail_compilation/fail12378.d(16):        instantiated from here: mapS!(Result)
+---
+*/
+void testS()
+{
+    auto r =
+    iota(1).mapS!(y0 =>
+        iota(2).mapS!(x0 =>
+            ANYTHING-GOES
+        )
+    );
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12378.d(40): Error: undefined identifier 'ANYTHING'
+fail_compilation/fail12378.d(40): Error: undefined identifier 'GOES'
+fail_compilation/fail12378.d(112):        instantiated from here: MapResultC!((x0) => ANYTHING - GOES, Result)
+fail_compilation/fail12378.d(39):        instantiated from here: mapC!(Result)
+fail_compilation/fail12378.d(123):        instantiated from here: __lambda1!int
+fail_compilation/fail12378.d(112):        instantiated from here: MapResultC!((y0) => iota(2).mapC!((x0) => ANYTHING - GOES), Result)
+fail_compilation/fail12378.d(38):        instantiated from here: mapC!(Result)
+---
+*/
+void testC()
+{
+    auto r =
+    iota(1).mapC!(y0 =>
+        iota(2).mapC!(x0 =>
+            ANYTHING-GOES
+        )
+    );
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12378.d(64): Error: undefined identifier 'ANYTHING'
+fail_compilation/fail12378.d(64): Error: undefined identifier 'GOES'
+fail_compilation/fail12378.d(135):        instantiated from here: MapResultI!((x0) => ANYTHING - GOES, Result)
+fail_compilation/fail12378.d(63):        instantiated from here: mapI!(Result)
+fail_compilation/fail12378.d(143):        instantiated from here: __lambda1!int
+fail_compilation/fail12378.d(135):        instantiated from here: MapResultI!((y0) => iota(2).mapI!((x0) => ANYTHING - GOES), Result)
+fail_compilation/fail12378.d(62):        instantiated from here: mapI!(Result)
+---
+*/
+
+
+void testI()
+{
+    auto r =
+    iota(1).mapI!(y0 =>
+        iota(2).mapI!(x0 =>
+            ANYTHING-GOES
+        )
+    );
+}
+
+auto iota(E)(E end)
+{
+    alias Value = E;
+
+    static struct Result
+    {
+        private Value current, pastLast;
+
+        @property inout(Value) front() inout { return current; }
+    }
+
+    return Result(0, end);
+}
+
+template mapS(fun...)
+{
+    auto mapS(R)(R r)
+    {
+        alias AppliedReturnType(alias f) = typeof(f(r.front));
+        static assert(!is(AppliedReturnType!fun == void),
+            "Mapping function must not return void.");
+
+        return MapResultS!(fun, R)(r);
+    }
+}
+struct MapResultS(alias fun, R)
+{
+    R _input;
+
+    @property auto ref front()
+    {
+        return fun(_input.front);
+    }
+}
+
+template mapC(fun...)
+{
+    auto mapC(R)(R r)
+    {
+        alias AppliedReturnType(alias f) = typeof(f(r.front));
+        static assert(!is(AppliedReturnType!fun == void),
+            "Mapping function must not return void.");
+
+        return new MapResultC!(fun, R)(r);
+    }
+}
+class MapResultC(alias fun, R)
+{
+    R _input;
+
+    this(R r) { _input = r; }
+
+    @property auto ref front()
+    {
+        return fun(_input.front);
+    }
+}
+
+template mapI(fun...)
+{
+    auto mapI(R)(R r)
+    {
+        alias AppliedReturnType(alias f) = typeof(f(r.front));
+        static assert(!is(AppliedReturnType!fun == void),
+            "Mapping function must not return void.");
+
+        return MapResultI!(fun, R).init;
+    }
+}
+interface MapResultI(alias fun, R)
+{
+    static @property auto ref front()
+    {
+        R _input;
+        return fun(_input.front);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12390.d b/gcc/testsuite/gdc.test/fail_compilation/fail12390.d
new file mode 100644
index 00000000000..f0479b9bec5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12390.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12390.d(14): Error: == has no effect in expression (fun().i == 4)
+---
+*/
+
+struct S { int i; }
+
+S fun() { return S(42); }
+
+void main()
+{
+    fun().i == 4;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail124.d b/gcc/testsuite/gdc.test/fail_compilation/fail124.d
new file mode 100644
index 00000000000..62b5894f68e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail124.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail124.d(15): Error: class fail124.CC inherits from duplicate interface C
+---
+*/
+
+//import std.stdio;
+
+interface C
+{
+    void f();
+}
+
+class CC : C, C
+{
+    void f() { /*writefln("hello");*/ }
+}
+
+void main()
+{
+    CC cc = new CC();
+    cc.f();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12436.d b/gcc/testsuite/gdc.test/fail_compilation/fail12436.d
new file mode 100644
index 00000000000..605ab054e9e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12436.d
@@ -0,0 +1,77 @@
+alias void FuncType();
+
+struct Opaque;
+
+template Tuple(T...) { alias T Tuple; }
+alias Tuple!(int, int) TupleType;
+
+/******************************************/
+// return type
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12436.d(18): Error: functions cannot return a function
+fail_compilation/fail12436.d(19): Error: functions cannot return a tuple
+---
+*/
+FuncType test1();
+TupleType test2();
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12436.d(28): Error: functions cannot return opaque type Opaque by value
+fail_compilation/fail12436.d(29): Error: functions cannot return opaque type Opaque[1] by value
+---
+*/
+Opaque    ret12436a();  // error
+Opaque[1] ret12436b();  // error
+Opaque*   ret12436c();  // no error
+Opaque[]  ret12436d();  // no error
+Opaque[]* ret12436e();  // no error
+
+ref Opaque    ret12436f();  // no error
+ref Opaque[1] ret12436g();  // no error
+
+/******************************************/
+// parameter type
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12436.d(46): Error: cannot have parameter of function type void()
+---
+*/
+void test3(FuncType) {}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12436.d(55): Error: cannot have parameter of opaque type Opaque by value
+fail_compilation/fail12436.d(56): Error: cannot have parameter of opaque type Opaque[1] by value
+---
+*/
+void param12436a(Opaque);     // error
+void param12436b(Opaque[1]);  // error
+void param12436c(Opaque*);    // no error
+void param12436d(Opaque[]);   // no error
+void param12436e(Opaque[]*);  // no error
+
+void param12436f(ref Opaque);     // no error
+void param12436g(ref Opaque[1]);  // no error
+void param12436h(out Opaque);     // no error
+void param12436i(out Opaque[1]);  // no error
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12436.d(75): Error: cannot have parameter of opaque type A14906 by value
+fail_compilation/fail12436.d(76): Error: cannot have parameter of opaque type A14906[3] by value
+fail_compilation/fail12436.d(77): Error: cannot have parameter of opaque type A14906[3][3] by value
+---
+*/
+enum A14906;
+void f14906a(A14906) {}
+void f14906b(A14906[3]) {}
+void f14906c(A14906[3][3]) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12485.d b/gcc/testsuite/gdc.test/fail_compilation/fail12485.d
new file mode 100644
index 00000000000..71f8698db99
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12485.d
@@ -0,0 +1,11 @@
+void dorecursive()
+{
+    recursive([0]);
+}
+
+void recursive(R)(R r)
+{
+    import std.algorithm;
+    recursive( r.filter!(e=>true) );
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail125.d b/gcc/testsuite/gdc.test/fail_compilation/fail125.d
new file mode 100644
index 00000000000..0e0f5ea8a7e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail125.d
@@ -0,0 +1,26 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail125.d(15): Error: array index [2] is outside array bounds [0 .. 2]
+fail_compilation/fail125.d(18): Error: template instance fail125.main.recMove!(1, a, b) error instantiating
+fail_compilation/fail125.d(25):        instantiated from here: recMove!(0, a, b)
+---
+*/
+
+
+template recMove(int i, X...)
+{
+    void recMove()
+    {
+        X[i] = X[i+1];
+        // I know the code is logically wrong, should test (i+2 < X.length)
+        static if (i+1 < X.length)
+            recMove!(i+1, X);
+    }
+}
+
+void main()
+{
+    int a, b;
+    recMove!(0, a, b);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12567.d b/gcc/testsuite/gdc.test/fail_compilation/fail12567.d
new file mode 100644
index 00000000000..e1ecd19fee1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12567.d
@@ -0,0 +1,8 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12567.d(8): Error: string expected, not '"a" ~ "b"'
+---
+*/
+deprecated("a" ~ "b") module fail12567;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail126.d b/gcc/testsuite/gdc.test/fail_compilation/fail126.d
new file mode 100644
index 00000000000..280fde90aaa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail126.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail126.d(8): Error: forward reference to 'test'
+---
+*/
+
+void test(typeof(test) p)
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12604.d b/gcc/testsuite/gdc.test/fail_compilation/fail12604.d
new file mode 100644
index 00000000000..af25db688b9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12604.d
@@ -0,0 +1,79 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12604.d(14): Error: mismatched array lengths, 1 and 3
+fail_compilation/fail12604.d(15): Error: mismatched array lengths, 1 and 3
+fail_compilation/fail12604.d(17): Error: mismatched array lengths, 1 and 3
+fail_compilation/fail12604.d(18): Error: mismatched array lengths, 1 and 3
+fail_compilation/fail12604.d(20): Error: cannot implicitly convert expression ([65536]) of type int[] to short[]
+fail_compilation/fail12604.d(21): Error: cannot implicitly convert expression ([65536, 2, 3]) of type int[] to short[]
+---
+*/
+void main()
+{
+      int[1] a1 = [1,2,3];
+    short[1] a2 = [1,2,3];
+
+      int[1] b1; b1 = [1,2,3];
+    short[1] b2; b2 = [1,2,3];
+
+    short[1] c = [65536];
+    short[1] d = [65536,2,3];
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12604.d(39): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail12604.d(40): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail12604.d(41): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail12604.d(42): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail12604.d(43): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail12604.d(44): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail12604.d(45): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail12604.d(46): Error: mismatched array lengths, 2 and 3
+---
+*/
+void test12606a()   // AssignExp::semantic
+{
+      uint[2] a1 = [1, 2, 3][];
+    ushort[2] a2 = [1, 2, 3][];
+      uint[2] a3 = [1, 2, 3][0 .. 3];
+    ushort[2] a4 = [1, 2, 3][0 .. 3];
+    a1 = [1, 2, 3][];
+    a2 = [1, 2, 3][];
+    a3 = [1, 2, 3][0 .. 3];
+    a4 = [1, 2, 3][0 .. 3];
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12604.d(60): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail12604.d(61): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail12604.d(62): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail12604.d(63): Error: mismatched array lengths, 2 and 3
+---
+*/
+void test12606b()   // ExpInitializer::semantic
+{
+    static   uint[2] a1 = [1, 2, 3][];
+    static   uint[2] a2 = [1, 2, 3][0 .. 3];
+    static ushort[2] a3 = [1, 2, 3][];
+    static ushort[2] a4 = [1, 2, 3][0 .. 3];
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12604.d(77): Error: mismatched array lengths, 4 and 3
+fail_compilation/fail12604.d(78): Error: mismatched array lengths, 4 and 3
+---
+*/
+void testc()
+{
+    int[4] sa1;
+    int[3] sa2;
+    sa1[0..4] = [1,2,3];
+    sa1[0..4] = sa2;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12622.d b/gcc/testsuite/gdc.test/fail_compilation/fail12622.d
new file mode 100644
index 00000000000..04bb8d6c020
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12622.d
@@ -0,0 +1,30 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12622.d(25): Error: pure function 'fail12622.foo' cannot call impure function pointer 'fp'
+fail_compilation/fail12622.d(25): Error: @nogc function 'fail12622.foo' cannot call non-@nogc function pointer 'fp'
+fail_compilation/fail12622.d(25): Error: @safe function 'fail12622.foo' cannot call @system function pointer 'fp'
+fail_compilation/fail12622.d(27): Error: pure function 'fail12622.foo' cannot call impure function pointer 'fp'
+fail_compilation/fail12622.d(27): Error: @nogc function 'fail12622.foo' cannot call non-@nogc function pointer 'fp'
+fail_compilation/fail12622.d(27): Error: @safe function 'fail12622.foo' cannot call @system function pointer 'fp'
+fail_compilation/fail12622.d(29): Error: pure function 'fail12622.foo' cannot call impure function 'fail12622.bar'
+fail_compilation/fail12622.d(29): Error: @safe function 'fail12622.foo' cannot call @system function 'fail12622.bar'
+fail_compilation/fail12622.d(29): Error: @nogc function 'fail12622.foo' cannot call non-@nogc function 'fail12622.bar'
+---
+*/
+// Note that, today nothrow violation errors are accidentally hidden.
+
+
+
+void bar();
+
+pure nothrow @nogc @safe void foo()
+{
+    auto fp = &bar;
+
+    (*fp)();
+
+    fp();
+
+    bar();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12635.d b/gcc/testsuite/gdc.test/fail_compilation/fail12635.d
new file mode 100644
index 00000000000..b00cc47b300
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12635.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12635.d(19): Error: Cannot generate a segment prefix for a branching instruction
+---
+*/
+
+void foo()
+{
+    enum NOP = 0x9090_9090_9090_9090;
+
+    asm
+    {
+    L1:
+        dq NOP,NOP,NOP,NOP;    //  32
+        dq NOP,NOP,NOP,NOP;    //  64
+        dq NOP,NOP,NOP,NOP;    //  96
+        dq NOP,NOP,NOP,NOP;    // 128
+        jmp DS:L1;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12636.d b/gcc/testsuite/gdc.test/fail_compilation/fail12636.d
new file mode 100644
index 00000000000..9a243a5c716
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12636.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12636.d(13): Error: C++ class 'fail12636.C' cannot implement D interface 'fail12636.D'
+---
+*/
+
+interface D
+{
+    void foo();
+}
+
+extern(C++) class C : D
+{
+    extern(D) override void foo() { }
+}
+
+void main()
+{
+    auto c = new C;
+    c.foo(); // works
+    D d = c;
+    d.foo(); // segfault
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail127.d b/gcc/testsuite/gdc.test/fail_compilation/fail127.d
new file mode 100644
index 00000000000..449dbc5de68
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail127.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail127.d(9): Error: a struct is not a valid initializer for a char[][]
+fail_compilation/fail127.d(10): Error: a struct is not a valid initializer for a string[]
+---
+*/
+
+char[][] Level2Text1 = {"LOW", "MEDIUM", "HIGH"};
+string[] Level2Text2 = {"LOW", "MEDIUM", "HIGH"};    // for D2
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12749.d b/gcc/testsuite/gdc.test/fail_compilation/fail12749.d
new file mode 100644
index 00000000000..149d1209829
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12749.d
@@ -0,0 +1,62 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12749.d(19): Error: immutable field 'inum' initialization is not allowed in foreach loop
+fail_compilation/fail12749.d(20): Error: const field 'cnum' initialization is not allowed in foreach loop
+fail_compilation/fail12749.d(25): Error: immutable field 'inum' initialization is not allowed in nested function 'set'
+fail_compilation/fail12749.d(26): Error: const field 'cnum' initialization is not allowed in nested function 'set'
+---
+*/
+struct S
+{
+    immutable int inum;
+    const     int cnum;
+
+    this(int i)
+    {
+        foreach (n; Aggr())
+        {
+            inum = i;
+            cnum = i;
+        }
+
+        void set(int i)
+        {
+            inum = i;
+            cnum = i;
+        }
+    }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12749.d(48): Error: immutable variable 'inum' initialization is not allowed in foreach loop
+fail_compilation/fail12749.d(49): Error: const variable 'cnum' initialization is not allowed in foreach loop
+fail_compilation/fail12749.d(54): Error: immutable variable 'inum' initialization is not allowed in nested function 'set'
+fail_compilation/fail12749.d(55): Error: const variable 'cnum' initialization is not allowed in nested function 'set'
+---
+*/
+immutable int inum;
+const     int cnum;
+static this()
+{
+    int i = 10;
+
+    foreach (n; Aggr())
+    {
+        inum = i;
+        cnum = i;
+    }
+
+    void set(int i)
+    {
+        inum = i;
+        cnum = i;
+    }
+}
+
+struct Aggr
+{
+    int opApply(int delegate(int) dg) { return dg(1); }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12809.d b/gcc/testsuite/gdc.test/fail_compilation/fail12809.d
new file mode 100644
index 00000000000..5d1aa2388fc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12809.d
@@ -0,0 +1,80 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+bool cond;
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12809.d(19): Error: object.Exception is thrown but not caught
+fail_compilation/fail12809.d(16): Error: nothrow function 'fail12809.test_finally1' may throw
+fail_compilation/fail12809.d(35): Error: object.Exception is thrown but not caught
+fail_compilation/fail12809.d(39): Error: object.Exception is thrown but not caught
+fail_compilation/fail12809.d(32): Error: nothrow function 'fail12809.test_finally3' may throw
+---
+*/
+void test_finally1() nothrow
+{
+    try
+        throw new Exception("");        // error
+    finally
+    {}
+}
+
+void test_finally2() nothrow
+{
+    try
+        throw new Exception("");        // no error
+    finally
+        assert(0);  // unconditional halt
+}
+
+void test_finally3() nothrow
+{
+    try
+        throw new Exception("");        // error
+    finally
+    {
+        if (cond)
+            throw new Exception("");    // error
+        assert(0);  // conditional halt
+    }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12809.d(59): Error: object.Exception is thrown but not caught
+fail_compilation/fail12809.d(54): Error: nothrow function 'fail12809.test_finally4' may throw
+fail_compilation/fail12809.d(75): Error: object.Exception is thrown but not caught
+fail_compilation/fail12809.d(79): Error: object.Exception is thrown but not caught
+fail_compilation/fail12809.d(70): Error: nothrow function 'fail12809.test_finally6' may throw
+---
+*/
+void test_finally4() nothrow
+{
+    try
+    {}
+    finally
+        throw new Exception("");        // error
+}
+
+void test_finally5() nothrow
+{
+    try
+        assert(0);  // unconditional halt
+    finally
+        throw new Exception("");        // no error
+}
+
+void test_finally6() nothrow
+{
+    try
+    {
+        if (cond)
+            throw new Exception("");    // error
+        assert(0);  // conditional halt
+    }
+    finally
+        throw new Exception("");        // error
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12901.d b/gcc/testsuite/gdc.test/fail_compilation/fail12901.d
new file mode 100644
index 00000000000..8d62c3e04ca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12901.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12901.d(11): Error: constructor fail12901.S.this in and out contracts require function body
+---
+*/
+
+struct S
+{
+    int a;
+    this(int n)
+    in { a = n; }
+    // no body
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12908.d b/gcc/testsuite/gdc.test/fail_compilation/fail12908.d
new file mode 100644
index 00000000000..c238028309e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12908.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12908.d(14): Error: pure delegate 'fail12908.main.__foreachbody1' cannot call impure function 'fail12908.g'
+---
+*/
+
+void g() {}
+
+void main() pure
+{
+    foreach (k, v; ["": ""])
+    {
+        g();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12932.d b/gcc/testsuite/gdc.test/fail_compilation/fail12932.d
new file mode 100644
index 00000000000..871abfea02c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail12932.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail12932.d(11): Error: array literal in @nogc function 'fail12932.foo' may cause GC allocation
+fail_compilation/fail12932.d(15): Error: array literal in @nogc function 'fail12932.foo' may cause GC allocation
+---
+*/
+
+int* foo() @nogc
+{
+    foreach (ref e; [1,2,3])
+    {
+    }
+
+    foreach (ref e; [1,2,3])
+    {
+        return &e;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13064.d b/gcc/testsuite/gdc.test/fail_compilation/fail13064.d
new file mode 100644
index 00000000000..be434600510
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13064.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13064.d(8): Error: function fail13064.f storage class 'auto' has no effect if return type is not inferred
+---
+*/
+
+auto void f() { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail131.d b/gcc/testsuite/gdc.test/fail_compilation/fail131.d
new file mode 100644
index 00000000000..e0f568fcf64
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail131.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail131.d(8): Error: function D main parameters must be main() or main(string[] args)
+---
+*/
+
+int main(lazy char[][] args)
+{
+    return args.length;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13116.d b/gcc/testsuite/gdc.test/fail_compilation/fail13116.d
new file mode 100644
index 00000000000..fe1180caff2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13116.d
@@ -0,0 +1,29 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13116.d(13): Error: this is not an lvalue
+---
+*/
+struct S
+{
+    ref S notEvil() { return this; } // this should be accepted
+}
+class C
+{
+    ref C evil() { return this; } // this should be rejected
+}
+void main()
+{
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13116.d(28): Error: super is not an lvalue
+---
+*/
+class Base { }
+class Derived : Base
+{
+    ref Base evil() { return super; } // should be rejected
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13120.d b/gcc/testsuite/gdc.test/fail_compilation/fail13120.d
new file mode 100644
index 00000000000..1acda7b2db1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13120.d
@@ -0,0 +1,35 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13120.d(13): Error: pure delegate 'fail13120.g1.__foreachbody2' cannot call impure function 'fail13120.f1'
+fail_compilation/fail13120.d(13): Error: @nogc delegate 'fail13120.g1.__foreachbody2' cannot call non-@nogc function 'fail13120.f1'
+---
+*/
+void f1() {}
+
+void g1(char[] s) pure @nogc
+{
+    foreach (dchar dc; s)
+        f1();
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13120.d(34): Error: pure function 'fail13120.h2' cannot call impure function 'fail13120.g2!().g2'
+fail_compilation/fail13120.d(34): Error: @safe function 'fail13120.h2' cannot call @system function 'fail13120.g2!().g2'
+fail_compilation/fail13120.d(34): Error: @nogc function 'fail13120.h2' cannot call non-@nogc function 'fail13120.g2!().g2'
+---
+*/
+void f2() {}
+
+void g2()(char[] s)
+{
+    foreach (dchar dc; s)
+        f2();
+}
+
+void h2() @safe pure @nogc
+{
+    g2(null);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13187.d b/gcc/testsuite/gdc.test/fail_compilation/fail13187.d
new file mode 100644
index 00000000000..3799d7711e4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13187.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13187.d(12): Error: pure function 'fail13187.test' cannot access mutable static data 'my_func_ptr'
+---
+*/
+
+int function(int) pure my_func_ptr;
+
+void test() pure
+{
+    my_func_ptr(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail132.d b/gcc/testsuite/gdc.test/fail_compilation/fail132.d
new file mode 100644
index 00000000000..34631840b23
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail132.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail132.d(19): Error: outer class A 'this' needed to 'new' nested class B
+---
+*/
+
+//import std.stdio;
+
+class A
+{
+    class B
+    {
+    }
+}
+
+void main()
+{
+    A.B c = new A.B;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13203.d b/gcc/testsuite/gdc.test/fail_compilation/fail13203.d
new file mode 100644
index 00000000000..86d30a4b093
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13203.d
@@ -0,0 +1,45 @@
+int v1, v2;
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13203.d(15): Error: alias fail13203.FA1!1.T conflicts with alias fail13203.FA1!1.T at fail_compilation/fail13203.d(14)
+fail_compilation/fail13203.d(22): Error: template instance fail13203.FA1!1 error instantiating
+fail_compilation/fail13203.d(20): Error: alias fail13203.FA2!1.T conflicts with alias fail13203.FA2!1.T at fail_compilation/fail13203.d(19)
+fail_compilation/fail13203.d(23): Error: template instance fail13203.FA2!1 error instantiating
+---
+*/
+template FA1(int b)
+{
+    alias T = int;
+    static if (b) alias T = uint;
+}
+template FA2(int b)
+{
+    alias T = v1;
+    static if (b) alias T = v2;
+}
+alias A1 = FA1!1;   // type is not overloadable
+alias A2 = FA2!1;   // variable symbol is not overloadable
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13203.d(36): Error: alias fail13203.FB1!1.T conflicts with alias fail13203.FB1!1.T at fail_compilation/fail13203.d(37)
+fail_compilation/fail13203.d(44): Error: template instance fail13203.FB1!1 error instantiating
+fail_compilation/fail13203.d(41): Error: alias fail13203.FB2!1.T conflicts with alias fail13203.FB2!1.T at fail_compilation/fail13203.d(42)
+fail_compilation/fail13203.d(45): Error: template instance fail13203.FB2!1 error instantiating
+---
+*/
+template FB1(int b)
+{
+    static if (b) alias T = uint;
+    alias T = int;
+}
+template FB2(int b)
+{
+    static if (b) alias T = v2;
+    alias T = v1;
+}
+alias B1 = FB1!1;
+alias B2 = FB2!1;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail133.d b/gcc/testsuite/gdc.test/fail_compilation/fail133.d
new file mode 100644
index 00000000000..e189ad5a8c0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail133.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail133.d(13): Error: function D main circular dependency. Functions cannot be interpreted while being compiled
+fail_compilation/fail133.d(15):        called from here: main()
+---
+*/
+
+template t(int t)
+{
+}
+
+int main()
+{
+    return t!(main() + 8);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13336a.d b/gcc/testsuite/gdc.test/fail_compilation/fail13336a.d
new file mode 100644
index 00000000000..5ab7e6c56f1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13336a.d
@@ -0,0 +1,29 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13336a.d(28): Error: choose(true) is not an lvalue
+---
+*/
+
+class Animal {}
+class Cat : Animal {}
+class Dog : Animal {}
+
+Animal animal;
+Cat cat;
+
+auto ref choose(bool f)
+{
+    if (f)
+        return cat;
+    else
+        return animal;
+}
+
+void main()
+{
+    //pragma(msg, typeof(&choose));
+    static assert(is(typeof(&choose) == Animal function(bool) nothrow @nogc @safe));    // pass
+
+    choose(true) = new Dog();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13336b.d b/gcc/testsuite/gdc.test/fail_compilation/fail13336b.d
new file mode 100644
index 00000000000..9d30d2c9f30
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13336b.d
@@ -0,0 +1,31 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+int sx;
+double sy;
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13336b.d(16): Error: cast(double)sx is not an lvalue
+---
+*/
+ref f1(bool f)
+{
+    if (f)
+        return sx;
+    return sy;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13336b.d(30): Error: cast(double)sx is not an lvalue
+---
+*/
+ref f2(bool f)
+{
+    if (f)
+        return sy;
+    return sx;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail134.d b/gcc/testsuite/gdc.test/fail_compilation/fail134.d
new file mode 100644
index 00000000000..d7b4a36ffc8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail134.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail134.d(13): Error: template instance foo!(f) does not match template declaration foo(T)
+fail_compilation/fail134.d(14): Error: template instance fail134.bar!(f) error instantiating
+---
+*/
+
+// Issue 651 - Assertion failure: 'global.errors' on line 2622 in file 'template.c'
+
+void f() {}
+template foo(T) {}
+template bar(T...) { alias foo!(T) buz; }
+alias bar!(f) a;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13424.d b/gcc/testsuite/gdc.test/fail_compilation/fail13424.d
new file mode 100644
index 00000000000..31bed563ded
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13424.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13424.d(12): Error: delegate fail13424.S.__lambda2 cannot be struct members
+fail_compilation/fail13424.d(17): Error: delegate fail13424.U.__lambda2 cannot be union members
+fail_compilation/fail13424.d(22): Error: delegate fail13424.C.__lambda2 cannot be class members
+---
+*/
+
+struct S
+{
+    void delegate(dchar) onChar = (dchar) {};
+}
+
+union U
+{
+    void delegate(dchar) onChar = (dchar) {};
+}
+
+class C
+{
+    void delegate(dchar) onChar = (dchar) {};
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13434_m32.d b/gcc/testsuite/gdc.test/fail_compilation/fail13434_m32.d
new file mode 100644
index 00000000000..985bbcca9e6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13434_m32.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -m32
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13434_m32.d(13): Error: cannot implicitly convert expression (()) of type () to uint
+---
+*/
+
+alias tuple(A...) = A;
+void main()
+{
+    float[] arr;
+    arr[tuple!()] = 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13434_m64.d b/gcc/testsuite/gdc.test/fail_compilation/fail13434_m64.d
new file mode 100644
index 00000000000..5ba417725f0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13434_m64.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -m64
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13434_m64.d(13): Error: cannot implicitly convert expression (()) of type () to ulong
+---
+*/
+
+alias tuple(A...) = A;
+void main()
+{
+    float[] arr;
+    arr[tuple!()] = 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13498.d b/gcc/testsuite/gdc.test/fail_compilation/fail13498.d
new file mode 100644
index 00000000000..5a82823f046
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13498.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13498.d(11): Error: cannot implicitly convert expression ("foo") of type string to int
+fail_compilation/fail13498.d(16): Error: template instance fail13498.foo!() error instantiating
+---
+*/
+
+int foo()()
+{
+    return "foo"; // should fail as well
+}
+
+void main()
+{
+    foo();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13574.d b/gcc/testsuite/gdc.test/fail_compilation/fail13574.d
new file mode 100644
index 00000000000..081f8b57b6b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13574.d
@@ -0,0 +1,29 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13574.d(21): Error: '$' is not an lvalue
+fail_compilation/fail13574.d(27): Error: '$' is not an lvalue
+---
+*/
+
+struct Foo
+{
+    void opSlice(size_t a, size_t b) {  }
+    alias opDollar = length;
+    size_t length;
+}
+
+void main()
+{
+    Foo foo;
+    foo[0 .. foo.length = 1];
+    assert(foo.length == 1);
+    foo[0 .. $ = 2]; // assigns to the temporary dollar variable
+    //assert(foo.length == 2);
+
+    int[] arr = [1,2,3];
+    auto x = arr[0 .. arr.length = 1];
+    assert(arr.length == 1);
+    auto y = arr[0 .. $ = 2]; // should also be disallowed
+    //assert(arr.length == 2);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail136.d b/gcc/testsuite/gdc.test/fail_compilation/fail136.d
new file mode 100644
index 00000000000..139e480b4f4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail136.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail136.d(10): Error: string has no effect in expression ("\xef\xbb\xbf")
+---
+*/
+
+void main()
+{
+    x"EF BB BF";
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13601.d b/gcc/testsuite/gdc.test/fail_compilation/fail13601.d
new file mode 100644
index 00000000000..4831dd31199
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13601.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13601.d(13): Error: variable __ctfe cannot be read at compile time
+fail_compilation/fail13601.d(14): Error: variable __ctfe cannot be read at compile time
+fail_compilation/fail13601.d(15): Error: variable __ctfe cannot be read at compile time
+fail_compilation/fail13601.d(16): Error: variable __ctfe cannot be read at compile time
+---
+*/
+
+void test()
+{
+    static if (__ctfe) {}
+    enum a = __ctfe ? "a" : "b";
+    static int b = __ctfe * 2;
+    int[__ctfe] sarr;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail137.d b/gcc/testsuite/gdc.test/fail_compilation/fail137.d
new file mode 100644
index 00000000000..80a2a25a51a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail137.d
@@ -0,0 +1,23 @@
+// 751 Compiler segfault on template expansion
+
+    template TypeTuple( TList... )
+    {
+        alias TList TypeTuple;
+    }
+
+    template IndexOf( T, TList... )
+    {
+        static if( TList.length == 0 )
+            const size_t IndexOf = 1;
+        else static if( is( T == typeof( TList[0] ) ) )
+            const size_t IndexOf = 0;
+        else
+            const size_t IndexOf = 1 + IndexOf!( T, (TList[1 .. $]) );
+    }
+
+    void main()
+    {
+        TypeTuple!(int, long) T;
+        printf( "%u\n", IndexOf!(long, T) );
+    }
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13701.d b/gcc/testsuite/gdc.test/fail_compilation/fail13701.d
new file mode 100644
index 00000000000..c0bdfccb3ea
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13701.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13701.d(16): Error: cannot modify immutable expression this.aa[10]
+fail_compilation/fail13701.d(23): Error: cannot modify immutable expression aa[10]
+fail_compilation/fail13701.d(24): Error: cannot modify immutable expression aa[10]
+---
+*/
+
+struct S
+{
+    immutable(int)[int] aa;
+    this(int n)
+    {
+        aa[10] = 20;    // initializing
+        aa[10] = 30;    // assignment
+    }
+}
+
+void main()
+{
+    immutable(int)[int] aa;
+    aa[10] = 20;
+    aa[10]++;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13756.d b/gcc/testsuite/gdc.test/fail_compilation/fail13756.d
new file mode 100644
index 00000000000..9e0ffbe84d2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13756.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13756.d(11): Error: foreach: index must be type const(int), not int
+---
+*/
+
+void maiin()
+{
+    int[int] aa = [1:2];
+    foreach (ref int k, v; aa)
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13775.d b/gcc/testsuite/gdc.test/fail_compilation/fail13775.d
new file mode 100644
index 00000000000..c933c886595
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13775.d
@@ -0,0 +1,21 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13775.d(17): Error: cannot cast expression ubytes[0..2] of type ubyte[2] to ubyte[1]
+fail_compilation/fail13775.d(18): Error: cannot cast expression ubytes[0..2] of type ubyte[2] to ubyte[3]
+fail_compilation/fail13775.d(19): Error: cannot cast expression ubytes[0..2] of type ubyte[2] to byte[1]
+fail_compilation/fail13775.d(20): Error: cannot cast expression ubytes[0..2] of type ubyte[2] to byte[3]
+---
+*/
+
+void main()
+{
+    ubyte[4] ubytes = [1,2,3,4];
+
+    // CT-known slicing succeeds but sizes cannot match
+    auto ng1 = cast(ubyte[1]) ubytes[0 .. 2];   // ubyte[2] to ubyte[1]
+    auto ng2 = cast(ubyte[3]) ubytes[0 .. 2];   // ubyte[2] to ubyte[3]
+    auto ng3 = cast( byte[1]) ubytes[0 .. 2];   // ubyte[2] to  byte[1]
+    auto ng4 = cast( byte[3]) ubytes[0 .. 2];   // ubyte[2] to  byte[3]
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail139.d b/gcc/testsuite/gdc.test/fail_compilation/fail139.d
new file mode 100644
index 00000000000..22fc616c87c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail139.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail139.d(8): Error: forward reference to 'test'
+---
+*/
+
+void test(typeof(&test) p)
+{
+}
+
+void main()
+{
+    test(null);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13902.d b/gcc/testsuite/gdc.test/fail_compilation/fail13902.d
new file mode 100644
index 00000000000..a0e823816ce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13902.d
@@ -0,0 +1,337 @@
+// REQUIRED_ARGS: -o- -d
+
+struct S1 { int v; }
+struct S2 { int* p; }
+class C { int v; }
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13902.d(32): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(33): Error: escaping reference to local variable s1
+fail_compilation/fail13902.d(38): Error: escaping reference to local variable sa1
+fail_compilation/fail13902.d(39): Error: escaping reference to local variable sa2
+fail_compilation/fail13902.d(40): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(41): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(42): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(45): Error: escaping reference to local variable y
+---
+*/
+int* testEscape1()
+{
+    int x, y;
+    int[] da1;
+    int[][] da2;
+    int[1] sa1;
+    int[1][1] sa2;
+    int* ptr;
+    S1 s1;
+    S2 s2;
+    C  c;
+
+    if (0) return &x;               // VarExp
+    if (0) return &s1.v;            // DotVarExp
+    if (0) return s2.p;             // no error
+    if (0) return &c.v;             // no error
+    if (0) return &da1[0];          // no error
+    if (0) return &da2[0][0];       // no error
+    if (0) return &sa1[0];          // IndexExp
+    if (0) return &sa2[0][0];       // IndexExp
+    if (0) return &x;
+    if (0) return &x + 1;           // optimized to SymOffExp == (& x+4)
+    if (0) return &x + x;
+  //if (0) return ptr += &x + 1;    // semantic error
+    if (0)        ptr -= &x - &y;   // no error
+    if (0) return (&x, &y);         // CommaExp
+
+    return null;    // ok
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13902.d(75): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(76): Error: escaping reference to local variable s1
+fail_compilation/fail13902.d(81): Error: escaping reference to local variable sa1
+fail_compilation/fail13902.d(82): Error: escaping reference to local variable sa2
+fail_compilation/fail13902.d(83): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(84): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(85): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(88): Error: escaping reference to local variable y
+---
+*/
+int* testEscape2(
+    int x, int y,
+    int[] da1,
+    int[][] da2,
+    int[1] sa1,
+    int[1][1] sa2,
+    int* ptr,
+    S1 s1,
+    S2 s2,
+    C  c,
+)
+{
+    if (0) return &x;               // VarExp
+    if (0) return &s1.v;            // DotVarExp
+    if (0) return s2.p;             // no error
+    if (0) return &c.v;             // no error
+    if (0) return &da1[0];          // no error
+    if (0) return &da2[0][0];       // no error
+    if (0) return &sa1[0];          // IndexExp
+    if (0) return &sa2[0][0];       // IndexExp
+    if (0) return &x;
+    if (0) return &x + 1;           // optimized to SymOffExp == (& x+4)
+    if (0) return  &x + x;
+  //if (0) return ptr += &x + 1;    // semantic error
+    if (0)        ptr -= &x - &y;   // no error
+    if (0) return (&x, &y);         // CommaExp
+
+    return null;    // ok
+}
+
+/*
+TEST_OUTPUT:
+---
+---
+*/
+int* testEscape3(
+    ref int x, ref int y,
+    ref int[] da1,
+    ref int[][] da2,
+    ref int[1] sa1,
+    ref int[1][1] sa2,
+    ref int* ptr,
+    ref S1 s1,
+    ref S2 s2,
+    ref C  c,
+)
+{
+    if (0) return &x;               // VarExp
+    if (0) return &s1.v;            // DotVarExp
+    if (0) return s2.p;             // no error
+    if (0) return &c.v;             // no error
+    if (0) return &da1[0];          // no error
+    if (0) return &da2[0][0];       // no error
+    if (0) return &sa1[0];          // IndexExp
+    if (0) return &sa2[0][0];       // IndexExp
+    if (0) return ptr = &x;
+    if (0) return ptr = &x + 1;     // optimized to SymOffExp == (& x+4)
+    if (0) return ptr = &x + x;
+  //if (0) return ptr += &x + 1;    // semantic error
+    if (0) return ptr -= &x - &y;   // no error
+    if (0) return (&x, &y);         // CommaExp
+
+    return null;    // ok
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13902.d(150): Error: escaping reference to local variable sa1
+fail_compilation/fail13902.d(151): Error: escaping reference to local variable sa1
+fail_compilation/fail13902.d(152): Error: escaping reference to local variable sa1
+fail_compilation/fail13902.d(155): Error: escaping reference to local variable sa2
+fail_compilation/fail13902.d(156): Error: escaping reference to local variable sa2
+fail_compilation/fail13902.d(157): Error: escaping reference to local variable sa2
+fail_compilation/fail13902.d(161): Error: escaping reference to local variable s
+fail_compilation/fail13902.d(162): Error: escaping reference to local variable s
+fail_compilation/fail13902.d(163): Error: escaping reference to local variable s
+fail_compilation/fail13902.d(166): Error: escaping reference to stack allocated value returned by makeSA()
+fail_compilation/fail13902.d(167): Error: escaping reference to stack allocated value returned by makeSA()
+fail_compilation/fail13902.d(168): Error: escaping reference to stack allocated value returned by makeSA()
+fail_compilation/fail13902.d(171): Error: escaping reference to stack allocated value returned by makeS()
+fail_compilation/fail13902.d(172): Error: escaping reference to stack allocated value returned by makeS()
+fail_compilation/fail13902.d(173): Error: escaping reference to stack allocated value returned by makeS()
+---
+*/
+int[] testEscape4(int[3] sa1)       // Bugzilla 9279
+{
+    if (0) return sa1;                      // error <- no error
+    if (0) return cast(int[])sa1;           // error <- no error
+    if (0) return sa1[];                    // error
+
+    int[3] sa2;
+    if (0) return sa2;                      // error
+    if (0) return cast(int[])sa2;           // error
+    if (0) return sa2[];                    // error
+
+    struct S { int[3] sa; }
+    S s;
+    if (0) return s.sa;                     // error <- no error
+    if (0) return cast(int[])s.sa;          // error <- no error
+    if (0) return s.sa[];                   // error
+
+    int[3] makeSA() { int[3] ret; return ret; }
+    if (0) return makeSA();                 // error <- no error
+    if (0) return cast(int[])makeSA();      // error <- no error
+    if (0) return makeSA()[];               // error <- no error
+
+    S makeS() { S s; return s; }
+    if (0) return makeS().sa;               // error <- no error
+    if (0) return cast(int[])makeS().sa;    // error <- no error
+    if (0) return makeS().sa[];             // error <- no error
+
+    return null;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13902.d(201): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(202): Error: escaping reference to local variable s1
+fail_compilation/fail13902.d(206): Error: escaping reference to local variable sa1
+fail_compilation/fail13902.d(207): Error: escaping reference to local variable sa2
+fail_compilation/fail13902.d(208): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(209): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(210): Error: escaping reference to local variable s1
+fail_compilation/fail13902.d(211): Error: escaping reference to local variable s1
+---
+*/
+ref int testEscapeRef1()
+{
+    int x;
+    int[] da1;
+    int[][] da2;
+    int[1] sa1;
+    int[1][1] sa2;
+    S1 s1;
+    C  c;
+
+    if (0) return x;            // VarExp
+    if (0) return s1.v;         // DotVarExp
+    if (0) return c.v;          // no error
+    if (0) return da1[0];       // no error
+    if (0) return da2[0][0];    // no error
+    if (0) return sa1[0];       // IndexExp
+    if (0) return sa2[0][0];    // IndexExp
+    if (0) return x = 1;        // AssignExp
+    if (0) return x += 1;       // BinAssignExp
+    if (0) return s1.v = 1;     // AssignExp (e1 is DotVarExp)
+    if (0) return s1.v += 1;    // BinAssignExp (e1 is DotVarExp)
+
+    static int g;
+    return g;       // ok
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13902.d(240): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(241): Error: escaping reference to local variable s1
+fail_compilation/fail13902.d(245): Error: escaping reference to local variable sa1
+fail_compilation/fail13902.d(246): Error: escaping reference to local variable sa2
+fail_compilation/fail13902.d(247): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(248): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(249): Error: escaping reference to local variable s1
+fail_compilation/fail13902.d(250): Error: escaping reference to local variable s1
+---
+*/
+ref int testEscapeRef2(
+    int x,
+    int[] da1,
+    int[][] da2,
+    int[1] sa1,
+    int[1][1] sa2,
+    S1 s1,
+    C  c,
+)
+{
+    if (0) return x;            // VarExp
+    if (0) return s1.v;         // DotVarExp
+    if (0) return c.v;          // no error
+    if (0) return da1[0];       // no error
+    if (0) return da2[0][0];    // no error
+    if (0) return sa1[0];       // IndexExp
+    if (0) return sa2[0][0];    // IndexExp
+    if (0) return x = 1;        // AssignExp
+    if (0) return x += 1;       // BinAssignExp
+    if (0) return s1.v = 1;     // AssignExp (e1 is DotVarExp)
+    if (0) return s1.v += 1;    // BinAssignExp (e1 is DotVarExp)
+
+    static int g;
+    return g;       // ok
+}
+
+/*
+TEST_OUTPUT:
+---
+---
+*/
+ref int testEscapeRef2(
+    ref int x,
+    ref int[] da1,
+    ref int[][] da2,
+    ref int[1] sa1,
+    ref int[1][1] sa2,
+    ref S1 s1,
+    ref C  c,
+)
+{
+    if (0) return x;            // VarExp
+    if (0) return s1.v;         // DotVarExp
+    if (0) return c.v;          // no error
+    if (0) return da1[0];       // no error
+    if (0) return da2[0][0];    // no error
+    if (0) return sa1[0];       // IndexExp
+    if (0) return sa2[0][0];    // IndexExp
+    if (0) return x = 1;        // AssignExp
+    if (0) return x += 1;       // BinAssignExp
+    if (0) return s1.v = 1;     // AssignExp (e1 is DotVarExp)
+    if (0) return s1.v += 1;    // BinAssignExp (e1 is DotVarExp)
+
+    static int g;
+    return g;       // ok
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13902.d(294): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(295): Error: escaping reference to local variable x
+---
+*/
+int*[]  testArrayLiteral1() { int x; return [&x]; }
+int*[1] testArrayLiteral2() { int x; return [&x]; }
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13902.d(304): Error: escaping reference to local variable x
+fail_compilation/fail13902.d(305): Error: escaping reference to local variable x
+---
+*/
+S2  testStructLiteral1() { int x; return     S2(&x); }
+S2* testStructLiteral2() { int x; return new S2(&x); }
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13902.d(314): Error: escaping reference to local variable sa
+fail_compilation/fail13902.d(315): Error: escaping reference to local variable sa
+---
+*/
+int[] testSlice1() { int[3] sa; return sa[]; }
+int[] testSlice2() { int[3] sa; int n; return sa[n..2][1..2]; }
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13902.d(324): Error: escaping reference to local variable vda
+fail_compilation/fail13902.d(325): Error: escaping reference to variadic parameter vda
+---
+*/
+ref int testDynamicArrayVariadic1(int[] vda...) { return vda[0]; }
+int[]   testDynamicArrayVariadic2(int[] vda...) { return vda[]; }
+int[3]  testDynamicArrayVariadic3(int[] vda...) { return vda[0..3]; }   // no error
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13902.d(335): Error: escaping reference to local variable vsa
+fail_compilation/fail13902.d(336): Error: escaping reference to variadic parameter vsa
+---
+*/
+ref int testStaticArrayVariadic1(int[3] vsa...) { return vsa[0]; }
+int[]   testStaticArrayVariadic2(int[3] vsa...) { return vsa[]; }
+int[3]  testStaticArrayVariadic3(int[3] vsa...) { return vsa[0..3]; }   // no error
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13938.d b/gcc/testsuite/gdc.test/fail_compilation/fail13938.d
new file mode 100644
index 00000000000..bd18ef2808f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13938.d
@@ -0,0 +1,16 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13938.d(14): Error: cannot directly load TLS variable 'val'
+---
+*/
+
+void test1()
+{
+    static int val;
+    asm
+    {
+        mov EAX, val;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13939.d b/gcc/testsuite/gdc.test/fail_compilation/fail13939.d
new file mode 100644
index 00000000000..76ec1ec1cbf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail13939.d
@@ -0,0 +1,16 @@
+// REQUIRED_ARGS: -o- -fPIC
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail13939.d(14): Error: cannot directly load global variable 'val' with PIC code
+---
+*/
+version(Windows) static assert(0);
+void test1()
+{
+    __gshared int val;
+    asm
+    {
+        mov EAX, val;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14.d b/gcc/testsuite/gdc.test/fail_compilation/fail14.d
new file mode 100644
index 00000000000..0da6dc4b134
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14.d
@@ -0,0 +1,11 @@
+
+class A(T)
+{
+    .A!(A) x;
+
+}
+
+void main()
+{
+	A!(int);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14009.d b/gcc/testsuite/gdc.test/fail_compilation/fail14009.d
new file mode 100644
index 00000000000..829aeb47b5f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14009.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14009.d(12): Error: end of instruction expected, not ':'
+---
+*/
+
+void main()
+{
+    asm {
+      mov EAX, FS: 1 ? 2 : 3;     // accepted
+      mov EAX, FS: 1 ? 2 : : 3;   // rejected
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14089.d b/gcc/testsuite/gdc.test/fail_compilation/fail14089.d
new file mode 100644
index 00000000000..4d23c554512
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14089.d
@@ -0,0 +1,46 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14089.d(41): Error: long has no effect in expression (1)
+fail_compilation/fail14089.d(41): Error: long has no effect in expression (1)
+fail_compilation/fail14089.d(42): Error: long has no effect in expression (1)
+fail_compilation/fail14089.d(42): Error: var has no effect in expression (n)
+fail_compilation/fail14089.d(43): Error: long has no effect in expression (1)
+fail_compilation/fail14089.d(43): Error: dotvar has no effect in expression (s.val)
+fail_compilation/fail14089.d(44): Error: var has no effect in expression (n)
+fail_compilation/fail14089.d(44): Error: long has no effect in expression (1)
+fail_compilation/fail14089.d(45): Error: dotvar has no effect in expression (s.val)
+fail_compilation/fail14089.d(45): Error: long has no effect in expression (1)
+---
+*/
+
+bool cond;
+
+void main()
+{
+    int foo() { return 0; }
+    int n;
+    struct S { int val; }
+    S s;
+
+    // The whole of each CondExps has side effects, So no error.
+    cond ? foo() : n;
+    cond ? foo() : s.val;
+    cond ? 1     : foo();
+    cond ? n     : foo();
+    cond ? s.val : foo();
+
+    cond ? (n = 1) : 1;
+    cond ? (n = 1) : n;
+    cond ? (n = 1) : s.val;
+    cond ? 1       : (n = 1);
+    cond ? n       : (n = 1);
+    cond ? s.val   : (n = 1);
+
+    // errors
+    cond ? 1     : 1;
+    cond ? 1     : n;
+    cond ? 1     : s.val;
+    cond ? n     : 1;
+    cond ? s.val : 1;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail142.d b/gcc/testsuite/gdc.test/fail_compilation/fail142.d
new file mode 100644
index 00000000000..e89b576adb4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail142.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail142.d(20): Error: cannot create instance of abstract class B
+fail_compilation/fail142.d(20):        function 'void test()' is not implemented
+---
+*/
+
+class A
+{
+    abstract void test() {}
+}
+
+class B : A
+{
+}
+
+void main()
+{
+    B b = new B();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14249.d b/gcc/testsuite/gdc.test/fail_compilation/fail14249.d
new file mode 100644
index 00000000000..84292243bba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14249.d
@@ -0,0 +1,40 @@
+/*
+REQUIRED_ARGS: -unittest
+TEST_OUTPUT:
+---
+fail_compilation/fail14249.d(23): Error: shared static constructor can only be member of module/aggregate/template, not function main
+fail_compilation/fail14249.d(24): Error: shared static destructor can only be member of module/aggregate/template, not function main
+fail_compilation/fail14249.d(25): Error: static constructor can only be member of module/aggregate/template, not function main
+fail_compilation/fail14249.d(26): Error: static destructor can only be member of module/aggregate/template, not function main
+fail_compilation/fail14249.d(27): Error: unittest can only be a member of module/aggregate/template, not function main
+fail_compilation/fail14249.d(28): Error: invariant can only be a member of aggregate, not function main
+fail_compilation/fail14249.d(29): Error: alias this can only be a member of aggregate, not function main
+fail_compilation/fail14249.d(30): Error: allocator can only be a member of aggregate, not function main
+fail_compilation/fail14249.d(31): Error: deallocator can only be a member of aggregate, not function main
+fail_compilation/fail14249.d(32): Error: constructor can only be a member of aggregate, not function main
+fail_compilation/fail14249.d(33): Error: destructor can only be a member of aggregate, not function main
+fail_compilation/fail14249.d(34): Error: postblit can only be a member of struct/union, not function main
+fail_compilation/fail14249.d(35): Error: anonymous union can only be a part of an aggregate, not function main
+fail_compilation/fail14249.d(39): Error: mixin fail14249.main.Mix!() error instantiating
+---
+*/
+mixin template Mix()
+{
+    shared static this() {}
+    shared static ~this() {}
+    static this() {}    // from fail197.d, 1510 ICE: Assertion failure: 'ad' on line 925 in file 'func.c'
+    static ~this() {}
+    unittest {}
+    invariant {}
+    alias a this;
+    new(size_t sz) { return null; }
+    delete(void* p) { }
+    this() {}           // from fail268.d
+    ~this() {}          // from fail268.d
+    this(this) {}
+    union { int x; double y; }
+}
+void main()
+{
+    mixin Mix!();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail143.d b/gcc/testsuite/gdc.test/fail_compilation/fail143.d
new file mode 100644
index 00000000000..0a0986ac996
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail143.d
@@ -0,0 +1,36 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail143.d(23): Error: need 'this' for 'next' of type 'uint()'
+fail_compilation/fail143.d(30): Error: template instance fail143.Foo!int error instantiating
+---
+*/
+
+class Quux
+{
+    uint x;
+
+    final uint next()
+    {
+        return x;
+    }
+}
+
+template Foo(T)
+{
+    void bar()
+    {
+        int r = Quux.next;
+    }
+}
+
+int main(char[][] args)
+{
+    auto prng = new Quux();
+    alias Foo!(int).bar baz;
+
+    int x = prng.next;
+    baz();
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14304.d b/gcc/testsuite/gdc.test/fail_compilation/fail14304.d
new file mode 100644
index 00000000000..472b33d1543
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14304.d
@@ -0,0 +1,70 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14304.d(26): Error: cannot modify read-only constant S14304(1)
+fail_compilation/fail14304.d(58):        called from here: sle14304.modify()
+fail_compilation/fail14304.d(35): Error: cannot modify read-only constant [1:1, 2:2]
+fail_compilation/fail14304.d(61):        called from here: modify14304(aae14304)
+fail_compilation/fail14304.d(41): Error: cannot modify read-only constant [1, 2, 3]
+fail_compilation/fail14304.d(64):        called from here: modify14304(cast(const(int)[])index14304)
+fail_compilation/fail14304.d(47): Error: cannot modify read-only constant [1.414, 1.732, 2.00000]
+fail_compilation/fail14304.d(67):        called from here: modify14304(cast(const(double)[])slice14304)
+fail_compilation/fail14304.d(53): Error: cannot modify read-only string literal "abc"
+fail_compilation/fail14304.d(70):        called from here: modify14304(cast(const(char)[])str14304)
+---
+*/
+
+struct S14304
+{
+    int x;
+
+    int modify() const
+    {
+        assert(x == 1);
+
+        // This force modification must not affect to ghe s14304 value.
+        (cast(S14304*)&this).x = 10;
+
+        assert(x == 10);
+        return x;
+    }
+}
+int modify14304(immutable int[int] aa)
+{
+    auto p = cast(int*)&aa[1];
+    *p = 10;
+    return aa[1];
+}
+int modify14304(const(int)[] arr)
+{
+    auto a = cast(int[])arr;
+    a[0] = 10;
+    return arr[0];
+}
+int modify14304(const(double)[] arr)
+{
+    auto a = cast(double[])arr;
+    a[] = 3.14;
+    return cast(int)arr[0];
+}
+int modify14304(const(char)[] str)
+{
+    auto s = cast(char[])str;
+    s[0] = 'z';
+    return str[0];
+}
+
+static immutable sle14304 = immutable S14304(1);
+static immutable v14304 = sle14304.modify();
+
+static immutable aae14304 = [1:1, 2:2];
+static immutable w14304 = modify14304(aae14304);
+
+static immutable index14304 = [1, 2, 3];
+static immutable x14304 = modify14304(index14304);
+
+static immutable slice14304 = [1.414, 1.732, 2];
+static immutable y14304 = modify14304(slice14304);
+
+static immutable str14304 = "abc";
+static immutable z14304 = modify14304(str14304);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail144.d b/gcc/testsuite/gdc.test/fail_compilation/fail144.d
new file mode 100644
index 00000000000..574d1675049
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail144.d
@@ -0,0 +1,30 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail144.d(13): Error: "message"
+fail_compilation/fail144.d(26):        called from here: bar(7)
+---
+*/
+
+//import core.stdc.stdio : printf;
+
+int bar(int i)
+{
+    assert(i < 0, "message");
+    foreach_reverse (k, v; "hello")
+    {
+        i <<= 1;
+        if (k == 2)
+            break;
+        i += v;
+    }
+    return i;
+}
+
+void main()
+{
+    static b = bar(7);
+    auto c = bar(7);
+    //printf("b = %d, %d\n", b, c);
+    assert(b == 674);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14406.d b/gcc/testsuite/gdc.test/fail_compilation/fail14406.d
new file mode 100644
index 00000000000..09f481691e9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14406.d
@@ -0,0 +1,26 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14406.d-mixin-20(20): Error: variable fail14406.CFrop.bar_obj cannot be further field because it will change the determined CFrop size
+fail_compilation/fail14406.d-mixin-25(25): Error: variable fail14406.IFrop.bar_obj field not allowed in interface
+---
+*/
+
+class Foo {}
+
+string strMixin(T)()
+{
+    static if (T.tupleof.length) {}
+    return "Bar bar_obj;
+    static class Bar {  Foo foo; }";
+}
+
+class CFrop
+{
+    mixin(strMixin!(typeof(this)));
+}
+
+interface IFrop
+{
+    mixin(strMixin!(typeof(this)));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14407.d b/gcc/testsuite/gdc.test/fail_compilation/fail14407.d
new file mode 100644
index 00000000000..e878959f7c2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14407.d
@@ -0,0 +1,47 @@
+import imports.a14407;
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14407.d(23): Deprecation: class imports.a14407.C is deprecated
+fail_compilation/fail14407.d(23): Deprecation: allocator imports.a14407.C.new is deprecated
+fail_compilation/fail14407.d(23): Error: pure function 'fail14407.testC' cannot call impure allocator 'imports.a14407.C.new'
+fail_compilation/fail14407.d(23): Error: @safe function 'fail14407.testC' cannot call @system allocator 'imports.a14407.C.new'
+fail_compilation/fail14407.d(23): Error: @nogc function 'fail14407.testC' cannot call non-@nogc allocator 'imports.a14407.C.new'
+fail_compilation/fail14407.d(23): Error: class imports.a14407.C member new is not accessible
+fail_compilation/fail14407.d(23): Error: pure function 'fail14407.testC' cannot call impure constructor 'imports.a14407.C.this'
+fail_compilation/fail14407.d(23): Error: @safe function 'fail14407.testC' cannot call @system constructor 'imports.a14407.C.this'
+fail_compilation/fail14407.d(23): Error: @nogc function 'fail14407.testC' cannot call non-@nogc constructor 'imports.a14407.C.this'
+fail_compilation/fail14407.d(23): Error: class imports.a14407.C member this is not accessible
+fail_compilation/fail14407.d(23): Error: allocator 'imports.a14407.C.new' is not nothrow
+fail_compilation/fail14407.d(23): Error: constructor 'imports.a14407.C.this' is not nothrow
+fail_compilation/fail14407.d(21): Error: nothrow function 'fail14407.testC' may throw
+---
+*/
+void testC() pure nothrow @safe @nogc
+{
+    new("arg") C(0);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14407.d(46): Deprecation: struct imports.a14407.S is deprecated
+fail_compilation/fail14407.d(46): Deprecation: allocator imports.a14407.S.new is deprecated
+fail_compilation/fail14407.d(46): Error: pure function 'fail14407.testS' cannot call impure allocator 'imports.a14407.S.new'
+fail_compilation/fail14407.d(46): Error: @safe function 'fail14407.testS' cannot call @system allocator 'imports.a14407.S.new'
+fail_compilation/fail14407.d(46): Error: @nogc function 'fail14407.testS' cannot call non-@nogc allocator 'imports.a14407.S.new'
+fail_compilation/fail14407.d(46): Error: struct imports.a14407.S member new is not accessible
+fail_compilation/fail14407.d(46): Error: pure function 'fail14407.testS' cannot call impure constructor 'imports.a14407.S.this'
+fail_compilation/fail14407.d(46): Error: @safe function 'fail14407.testS' cannot call @system constructor 'imports.a14407.S.this'
+fail_compilation/fail14407.d(46): Error: @nogc function 'fail14407.testS' cannot call non-@nogc constructor 'imports.a14407.S.this'
+fail_compilation/fail14407.d(46): Error: struct imports.a14407.S member this is not accessible
+fail_compilation/fail14407.d(46): Error: allocator 'imports.a14407.S.new' is not nothrow
+fail_compilation/fail14407.d(46): Error: constructor 'imports.a14407.S.this' is not nothrow
+fail_compilation/fail14407.d(21): Error: nothrow function 'fail14407.testC' may throw
+---
+*/
+void testS() pure nothrow @safe @nogc
+{
+    new("arg") S(0);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14416.d b/gcc/testsuite/gdc.test/fail_compilation/fail14416.d
new file mode 100644
index 00000000000..b0518c85e75
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14416.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14416.d(13): Error: template S(T) does not have property 'sizeof'
+---
+*/
+
+struct S(T)
+{
+    int x;
+}
+
+enum n = S.sizeof;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14486.d b/gcc/testsuite/gdc.test/fail_compilation/fail14486.d
new file mode 100644
index 00000000000..fae723eb64f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14486.d
@@ -0,0 +1,148 @@
+// REQUIRED_ARGS: -o-
+
+class  C0a { }
+class  C1a {                  ~this() {} }
+class  C2a {                  ~this() {}  @nogc pure @safe delete(void* p) {} }
+class  C3a { @nogc pure @safe ~this() {}                   delete(void* p) {} }
+class  C4a { @nogc pure @safe ~this() {}  @nogc pure @safe delete(void* p) {} }
+
+class  C0b { }
+class  C1b {                  ~this() {} }
+class  C2b {                  ~this() {}           nothrow delete(void* p) {} }
+class  C3b {          nothrow ~this() {}                   delete(void* p) {} }
+class  C4b {          nothrow ~this() {}           nothrow delete(void* p) {} }
+
+struct S0a { }
+struct S1a {                  ~this() {} }
+struct S2a {                  ~this() {}  @nogc pure @safe delete(void* p) {} }
+struct S3a { @nogc pure @safe ~this() {}                   delete(void* p) {} }
+struct S4a { @nogc pure @safe ~this() {}  @nogc pure @safe delete(void* p) {} }
+
+struct S0b { }
+struct S1b {                  ~this() {} }
+struct S2b {                  ~this() {}           nothrow delete(void* p) {} }
+struct S3b {          nothrow ~this() {}                   delete(void* p) {} }
+struct S4b {          nothrow ~this() {}           nothrow delete(void* p) {} }
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14486.d(44): Error: cannot use 'delete' in @nogc function 'fail14486.test1a'
+fail_compilation/fail14486.d(45): Error: pure function 'fail14486.test1a' cannot call impure destructor 'fail14486.C1a.~this'
+fail_compilation/fail14486.d(45): Error: @safe function 'fail14486.test1a' cannot call @system destructor 'fail14486.C1a.~this'
+fail_compilation/fail14486.d(45): Error: @nogc function 'fail14486.test1a' cannot call non-@nogc destructor 'fail14486.C1a.~this'
+fail_compilation/fail14486.d(46): Error: pure function 'fail14486.test1a' cannot call impure destructor 'fail14486.C2a.~this'
+fail_compilation/fail14486.d(46): Error: @safe function 'fail14486.test1a' cannot call @system destructor 'fail14486.C2a.~this'
+fail_compilation/fail14486.d(46): Error: @nogc function 'fail14486.test1a' cannot call non-@nogc destructor 'fail14486.C2a.~this'
+fail_compilation/fail14486.d(47): Error: pure function 'fail14486.test1a' cannot call impure deallocator 'fail14486.C3a.delete'
+fail_compilation/fail14486.d(47): Error: @safe function 'fail14486.test1a' cannot call @system deallocator 'fail14486.C3a.delete'
+fail_compilation/fail14486.d(47): Error: @nogc function 'fail14486.test1a' cannot call non-@nogc deallocator 'fail14486.C3a.delete'
+---*/
+void test1a() @nogc pure @safe
+{
+    C0a   c0;  delete c0;   // error
+    C1a   c1;  delete c1;   // error
+    C2a   c2;  delete c2;   // error
+    C3a   c3;  delete c3;   // error
+    C4a   c4;  delete c4;   // no error
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14486.d(63): Error: destructor 'fail14486.C1b.~this' is not nothrow
+fail_compilation/fail14486.d(64): Error: destructor 'fail14486.C2b.~this' is not nothrow
+fail_compilation/fail14486.d(65): Error: deallocator 'fail14486.C3b.delete' is not nothrow
+fail_compilation/fail14486.d(60): Error: nothrow function 'fail14486.test1b' may throw
+---
+*/
+void test1b() nothrow
+{
+    C0b   c0;  delete c0;    // no error
+    C1b   c1;  delete c1;    // error
+    C2b   c2;  delete c2;    // error
+    C3b   c3;  delete c3;    // error
+    C4b   c4;  delete c4;    // no error
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14486.d(86): Error: cannot use 'delete' in @nogc function 'fail14486.test2a'
+fail_compilation/fail14486.d(87): Error: pure function 'fail14486.test2a' cannot call impure destructor 'fail14486.S1a.~this'
+fail_compilation/fail14486.d(87): Error: @safe function 'fail14486.test2a' cannot call @system destructor 'fail14486.S1a.~this'
+fail_compilation/fail14486.d(87): Error: @nogc function 'fail14486.test2a' cannot call non-@nogc destructor 'fail14486.S1a.~this'
+fail_compilation/fail14486.d(88): Error: pure function 'fail14486.test2a' cannot call impure destructor 'fail14486.S2a.~this'
+fail_compilation/fail14486.d(88): Error: @safe function 'fail14486.test2a' cannot call @system destructor 'fail14486.S2a.~this'
+fail_compilation/fail14486.d(88): Error: @nogc function 'fail14486.test2a' cannot call non-@nogc destructor 'fail14486.S2a.~this'
+fail_compilation/fail14486.d(89): Error: pure function 'fail14486.test2a' cannot call impure deallocator 'fail14486.S3a.delete'
+fail_compilation/fail14486.d(89): Error: @safe function 'fail14486.test2a' cannot call @system deallocator 'fail14486.S3a.delete'
+fail_compilation/fail14486.d(89): Error: @nogc function 'fail14486.test2a' cannot call non-@nogc deallocator 'fail14486.S3a.delete'
+---
+*/
+void test2a() @nogc pure @safe
+{
+    S0a*  s0;  delete s0;   // error
+    S1a*  s1;  delete s1;   // error
+    S2a*  s2;  delete s2;   // error
+    S3a*  s3;  delete s3;   // error
+    S4a*  s4;  delete s4;   // no error
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14486.d(105): Error: destructor 'fail14486.S1b.~this' is not nothrow
+fail_compilation/fail14486.d(106): Error: destructor 'fail14486.S2b.~this' is not nothrow
+fail_compilation/fail14486.d(107): Error: deallocator 'fail14486.S3b.delete' is not nothrow
+fail_compilation/fail14486.d(102): Error: nothrow function 'fail14486.test2b' may throw
+---
+*/
+void test2b() nothrow
+{
+    S0b*  s0;  delete s0;    // no error
+    S1b*  s1;  delete s1;    // error
+    S2b*  s2;  delete s2;    // error
+    S3b*  s3;  delete s3;    // error
+    S4b*  s4;  delete s4;    // no error
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14486.d(127): Error: cannot use 'delete' in @nogc function 'fail14486.test3a'
+fail_compilation/fail14486.d(128): Error: pure function 'fail14486.test3a' cannot call impure destructor 'fail14486.S1a.~this'
+fail_compilation/fail14486.d(128): Error: @safe function 'fail14486.test3a' cannot call @system destructor 'fail14486.S1a.~this'
+fail_compilation/fail14486.d(128): Error: @nogc function 'fail14486.test3a' cannot call non-@nogc destructor 'fail14486.S1a.~this'
+fail_compilation/fail14486.d(129): Error: pure function 'fail14486.test3a' cannot call impure destructor 'fail14486.S2a.~this'
+fail_compilation/fail14486.d(129): Error: @safe function 'fail14486.test3a' cannot call @system destructor 'fail14486.S2a.~this'
+fail_compilation/fail14486.d(129): Error: @nogc function 'fail14486.test3a' cannot call non-@nogc destructor 'fail14486.S2a.~this'
+fail_compilation/fail14486.d(130): Error: cannot use 'delete' in @nogc function 'fail14486.test3a'
+fail_compilation/fail14486.d(131): Error: cannot use 'delete' in @nogc function 'fail14486.test3a'
+---
+*/
+void test3a() @nogc pure @safe
+{
+    S0a[] a0;  delete a0;   // error
+    S1a[] a1;  delete a1;   // error
+    S2a[] a2;  delete a2;   // error
+    S3a[] a3;  delete a3;   // error
+    S4a[] a4;  delete a4;   // error
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14486.d(145): Error: destructor 'fail14486.S1b.~this' is not nothrow
+fail_compilation/fail14486.d(146): Error: destructor 'fail14486.S2b.~this' is not nothrow
+fail_compilation/fail14486.d(142): Error: nothrow function 'fail14486.test3b' may throw
+---
+*/
+void test3b() nothrow
+{
+    S0b[] a0;  delete a0;    // no error
+    S1b[] a1;  delete a1;    // error
+    S2b[] a2;  delete a2;    // error
+    S3b[] a3;  delete a3;    // no error
+    S4b[] a4;  delete a4;    // no error
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail145.d b/gcc/testsuite/gdc.test/fail_compilation/fail145.d
new file mode 100644
index 00000000000..9d285dc1525
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail145.d
@@ -0,0 +1,30 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail145.d(13): Error: assert(i < 0) failed
+fail_compilation/fail145.d(26):        called from here: bar(7)
+---
+*/
+
+//import core.stdc.stdio : printf;
+
+int bar(int i)
+{
+    assert(i < 0);
+    foreach_reverse (k, v; "hello")
+    {
+        i <<= 1;
+        if (k == 2)
+            break;
+        i += v;
+    }
+    return i;
+}
+
+void main()
+{
+    static b = bar(7);
+    auto c = bar(7);
+    //printf("b = %d, %d\n", b, c);
+    assert(b == 674);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14554.d b/gcc/testsuite/gdc.test/fail_compilation/fail14554.d
new file mode 100644
index 00000000000..5d4e96cdc64
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14554.d
@@ -0,0 +1,30 @@
+// REQUIRED_ARGS: -o-
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14554.d(28): Error: fail14554.issue14554_1.foo called with argument types (int) matches both:
+fail_compilation/fail14554.d(17):     fail14554.issue14554_1.foo!bool.foo(int j)
+and:
+fail_compilation/fail14554.d(18):     fail14554.issue14554_1.foo!bool.foo(int j)
+fail_compilation/fail14554.d(29): Error: fail14554.issue14554_2.foo called with argument types (int) matches both:
+fail_compilation/fail14554.d(22):     fail14554.issue14554_2.foo!bool.foo(int j)
+and:
+fail_compilation/fail14554.d(23):     fail14554.issue14554_2.foo!bool.foo(int j)
+---
+*/
+struct issue14554_1 {
+     void foo(T)(int j) {}
+     static void foo(T)(int j) {}
+}
+
+struct issue14554_2 {
+     static void foo(T)(int j) {}
+     void foo(T)(int j) {}
+}
+
+void test14554()
+{
+     issue14554_1.foo!bool(1);    
+     issue14554_2.foo!bool(1);    
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14669.d b/gcc/testsuite/gdc.test/fail_compilation/fail14669.d
new file mode 100644
index 00000000000..89840010eb4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14669.d
@@ -0,0 +1,43 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14669.d(11): Error: 'auto' can only be used as part of 'auto ref' for template function parameters
+fail_compilation/fail14669.d(16): Error: template instance fail14669.foo1!() error instantiating
+fail_compilation/fail14669.d(12): Error: 'auto' can only be used as part of 'auto ref' for template function parameters
+fail_compilation/fail14669.d(17): Error: template fail14669.foo2 cannot deduce function from argument types !()(int), candidates are:
+fail_compilation/fail14669.d(12):        fail14669.foo2()(auto int a)
+---
+*/
+void foo1()(auto int a) {}
+void foo2()(auto int a) {}
+
+void test1()
+{
+    alias f1 = foo1!();
+    foo2(1);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14669.d(29): Error: 'auto' can only be used as part of 'auto ref' for template function parameters
+fail_compilation/fail14669.d(38): Error: template instance fail14669.bar1!int error instantiating
+fail_compilation/fail14669.d(30): Error: 'auto' can only be used as part of 'auto ref' for template function parameters
+fail_compilation/fail14669.d(40): Error: template instance fail14669.bar2!int error instantiating
+---
+*/
+void bar1(T)(auto ref T x) {}
+void bar2(T)(auto ref T x) {}
+
+void test2()
+{
+    int n;
+
+    bar1(1);
+    bar1(n);
+    alias b1 = bar1!(int);
+
+    alias b2 = bar2!(int);
+    bar2(n);
+    bar2(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14965.d b/gcc/testsuite/gdc.test/fail_compilation/fail14965.d
new file mode 100644
index 00000000000..f1a1ec152e1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail14965.d
@@ -0,0 +1,38 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail14965.d(19): Error: forward reference to inferred return type of function 'foo1'
+fail_compilation/fail14965.d(20): Error: forward reference to inferred return type of function 'foo2'
+fail_compilation/fail14965.d(22): Error: forward reference to inferred return type of function 'bar1'
+fail_compilation/fail14965.d(23): Error: forward reference to inferred return type of function 'bar2'
+fail_compilation/fail14965.d(25): Error: forward reference to inferred return type of function 'baz1'
+fail_compilation/fail14965.d(26): Error: forward reference to inferred return type of function 'baz2'
+fail_compilation/fail14965.d(30): Error: forward reference to inferred return type of function 'foo1'
+fail_compilation/fail14965.d(31): Error: forward reference to inferred return type of function 'foo2'
+fail_compilation/fail14965.d(33): Error: forward reference to inferred return type of function 'bar1'
+fail_compilation/fail14965.d(34): Error: forward reference to inferred return type of function 'bar2'
+fail_compilation/fail14965.d(36): Error: forward reference to inferred return type of function 'baz1'
+fail_compilation/fail14965.d(37): Error: forward reference to inferred return type of function 'baz2'
+---
+*/
+
+auto foo1() { alias F = typeof(foo1); }     // TypeTypeof
+auto foo2() { alias FP = typeof(&foo2); }   // TypeTypeof
+
+auto bar1() { auto fp = &bar1; }            // ExpInitializer
+auto bar2() { auto fp = cast(void function())&bar2; }   // castTo
+
+auto baz1() { return &baz1; }               // ReturnStatement
+auto baz2() { (&baz2); }                    // ExpStatement
+
+class C
+{
+    auto foo1() { alias F = typeof(this.foo1); }
+    auto foo2() { alias FP = typeof(&this.foo2); }
+
+    auto bar1() { auto fp = &this.bar1; }
+    auto bar2() { auto dg = cast(void delegate())&this.bar2; }
+
+    auto baz1() { return &baz1; }
+    auto baz2() { (&baz2); }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15.d b/gcc/testsuite/gdc.test/fail_compilation/fail15.d
new file mode 100644
index 00000000000..564ddda7eec
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail15.d
@@ -0,0 +1,21 @@
+/*
+Segfault on DMD 0.095
+http://www.digitalmars.com/d/archives/digitalmars/D/bugs/926.html
+*/
+module test;
+
+template Test()
+{
+    bool opIndex(bool x)
+    {
+        return !x;
+    }
+}
+
+void main()
+{
+    mixin Test!() xs;
+    bool x = xs[false];
+}
+
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail150.d b/gcc/testsuite/gdc.test/fail_compilation/fail150.d
new file mode 100644
index 00000000000..4a53053af66
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail150.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail150.d(22): Error: e.new is only for allocating nested classes
+---
+*/
+
+//import std.stdio;
+
+class Class1
+{
+}
+
+class Foo
+{
+}
+
+int main(char[][] argv)
+{
+    Class1 myclass = new Class1;
+
+    myclass.new Foo();
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15044.d b/gcc/testsuite/gdc.test/fail_compilation/fail15044.d
new file mode 100644
index 00000000000..8674b8d08c6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail15044.d
@@ -0,0 +1,32 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail15044.d(30): Error: generated function fail15044.V.opAssign is not callable because it is annotated with @disable
+---
+*/
+
+struct S
+{
+    void opAssign(S) {}
+}
+
+struct V
+{
+    // `s` has opAssign, so struct V needs to generate member-wise opAssign.
+    // But S.opAssign is not callable on const object, so V.opAssign should be
+    // @disable.
+    const S s;
+
+    // Here, the initializer of x is evaluated in V.semantic2. But
+    // V.opAssign.semantic3 is not yet invoked, so its attribute should be
+    // lazily inferred in functionSemantic even though it's non-instantiated function.
+    enum int x = ()
+    {
+        // Here, the initializer of x is evaluated in V.semantic2, and
+        // V.opAssign.semantic3 is not yet invoked in this time.
+        // Therefore its @disable attribute needs to be inferred by
+        // functionSemantic, even though it's non-instantiated function.
+        V v;
+        v = v;
+    }();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail152.d b/gcc/testsuite/gdc.test/fail_compilation/fail152.d
new file mode 100644
index 00000000000..60cf4ce2782
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail152.d
@@ -0,0 +1,29 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail152.d(15): Error: cannot use type double as an operand
+---
+*/
+
+// 1028 Segfault using tuple inside asm code.
+
+void a(X...)(X expr)
+{
+    alias X[0] var1;
+    version(GNU)
+    {
+        version(X86) asm {"fstpd %0;" : "=m" (var1) : : ;}
+        else version(X86_64) asm {"fstpd %0;" : "=m" (var1) : : ;}
+        else static assert(false, "ASM code not implemented for this architecture");
+    }
+    else asm {
+        //fld double ptr X[0];   // (1) segfaults
+        fstp double ptr var1;    // (2) ICE
+    }
+}
+
+void main()
+{
+   a(3.6);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15292.d b/gcc/testsuite/gdc.test/fail_compilation/fail15292.d
new file mode 100644
index 00000000000..3b3602fc502
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail15292.d
@@ -0,0 +1,28 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail15292.d(27): Error: cannot compare S15292 because its auto generated member-wise equality has recursive definition
+---
+*/
+
+struct NullableRef15292(T)
+{
+    inout(T) get() inout
+    {
+        assert(false);
+    }
+
+    alias get this;
+}
+
+struct S15292
+{
+    NullableRef15292!S15292 n;
+}
+
+void main()
+{
+    S15292 s;
+    assert(s == s);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail153.d b/gcc/testsuite/gdc.test/fail_compilation/fail153.d
new file mode 100644
index 00000000000..8e397e3d10c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail153.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail153.d(10): Error: class fail153.Bar cannot inherit from final class Foo
+---
+*/
+
+final class Foo { }
+
+class Bar : Foo { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail154.d b/gcc/testsuite/gdc.test/fail_compilation/fail154.d
new file mode 100644
index 00000000000..8b5fefc3820
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail154.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail154.d(18): Error: template instance X!(MYP!int) does not match template declaration X(T : Policy!T, alias Policy)
+---
+*/
+
+class X(T:Policy!(T), alias Policy)
+{
+    mixin Policy!(T);
+}
+
+template MYP(T)
+{
+    void foo(T);
+}
+
+X!(MYP!(int)) x;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail155.d b/gcc/testsuite/gdc.test/fail_compilation/fail155.d
new file mode 100644
index 00000000000..cc1e03c3a5c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail155.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail155.d(19): Error: overlapping initialization for y
+---
+*/
+
+struct S
+{
+    int i;
+    union
+    {
+        int x;
+        int y;
+    }
+    int j;
+}
+
+S s = S( 1, 2, 3, 4 );
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15550.d b/gcc/testsuite/gdc.test/fail_compilation/fail15550.d
new file mode 100644
index 00000000000..e20a7f294f6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail15550.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail15550.d(25): Error: partial template instance foo!int has no type
+fail_compilation/fail15550.d(26): Error: partial template instance opDispatch!"_isMatrix" has no type
+fail_compilation/fail15550.d(27): Error: partial template instance baz!"_isMatrix" has no type
+---
+*/
+
+T foo(T, T2)(T2)
+{
+}
+
+struct Vector
+{
+    void opDispatch(string, U)(U)
+    {
+    }
+
+    void baz(string, U)(U)
+    {
+    }
+}
+
+alias T1 = typeof(foo!int);
+alias T2 = typeof(Vector._isMatrix);
+alias T3 = typeof(Vector.baz!"_isMatrix");
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail156.d b/gcc/testsuite/gdc.test/fail_compilation/fail156.d
new file mode 100644
index 00000000000..cfd5b83a01b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail156.d
@@ -0,0 +1,46 @@
+// REQUIRED_ARGS: -d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail156.d(33): Error: overlapping initialization for y
+fail_compilation/fail156.d(40): Error: overlapping initialization for y
+---
+*/
+
+alias int myint;
+
+struct S
+{
+    int i;
+    union
+    {
+        int x = 2;
+        int y;
+    }
+    int j = 3;
+    myint k = 4;
+}
+
+void main()
+{
+    S s = S( 1, 5 );
+    assert(s.i == 1);
+    assert(s.x == 5);
+    assert(s.y == 5);
+    assert(s.j == 3);
+    assert(s.k == 4);
+
+    static S t = S( 1, 6, 6 );
+    assert(t.i == 1);
+    assert(t.x == 6);
+    assert(t.y == 6);
+    assert(t.j == 3);
+    assert(t.k == 4);
+
+    S u = S( 1, 5, 6 );
+    assert(u.i == 1);
+    assert(u.x == 5);
+    assert(u.y == 5);
+    assert(u.j == 3);
+    assert(u.k == 4);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15626.d b/gcc/testsuite/gdc.test/fail_compilation/fail15626.d
new file mode 100644
index 00000000000..3b7020539c3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail15626.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail15626.d(12): Error: class fail15626.D C++ base class C needs at least one virtual function
+---
+*/
+
+extern (C++)
+{
+    class C { }
+    interface I { void f(); }
+    class D : C, I
+    {
+        void f() { }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15667.d b/gcc/testsuite/gdc.test/fail_compilation/fail15667.d
new file mode 100644
index 00000000000..f3342ea5eaa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail15667.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/a15667.d(16): Error: basic type expected, not ;
+fail_compilation/imports/a15667.d(19): Error: declaration expected following attribute, not EOF
+---
+*/
+
+void main()
+{
+    import imports.a15667;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail158.d b/gcc/testsuite/gdc.test/fail_compilation/fail158.d
new file mode 100644
index 00000000000..353874f598b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail158.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail158.d(17): Error: more initializers than fields (2) of S
+---
+*/
+
+struct S
+{
+    int i;
+    int j = 3;
+}
+
+
+void main()
+{
+    S s = S( 1, 5, 6 );
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail159.d b/gcc/testsuite/gdc.test/fail_compilation/fail159.d
new file mode 100644
index 00000000000..b378375bddc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail159.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail159.d(24): Error: static assert  (foo(S(1, 5), S(1, 4)) == 0) is false
+---
+*/
+
+struct S
+{
+    int i;
+    int j = 3;
+
+    int opEquals(S e2) { return 1; }
+}
+
+int foo(S s1, S s2)
+{
+    return s1 == s2;
+}
+
+void main()
+{
+    static assert(foo( S(1,5), S(1,5) ) == 1);
+    static assert(foo( S(1,5), S(1,4) ) == 0);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail16.d b/gcc/testsuite/gdc.test/fail_compilation/fail16.d
new file mode 100644
index 00000000000..c9af9d30088
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail16.d
@@ -0,0 +1,20 @@
+// ICE(template.c) in DMD0.080
+
+int i;
+
+template bar(T)
+{
+  void bar(int x) {}
+}
+
+template foo(alias X)
+{
+  bar!(typeof(X))(X);
+}
+
+
+void main()
+{
+  foo!(i);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail160.d b/gcc/testsuite/gdc.test/fail_compilation/fail160.d
new file mode 100644
index 00000000000..1e2414cf74b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail160.d
@@ -0,0 +1,26 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail160.d(22): Error: typeid(fail160.Foo).vtbl is not yet implemented at compile time
+---
+*/
+
+interface Foo
+{
+    void work();
+}
+template Wrapper(B, alias Func, int func)
+{
+    alias typeof(&Func) FuncPtr;
+
+    private static FuncPtr get_funcptr() { return func; }
+} 
+
+
+int main(char[][] args)
+{
+    auto x = new Wrapper!(Foo, Foo.work, cast(int)(Foo.classinfo.vtbl[0]))();
+
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail161.d b/gcc/testsuite/gdc.test/fail_compilation/fail161.d
new file mode 100644
index 00000000000..d0aa940c043
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail161.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail161.d(15): Error: template instance MetaString!"2 == 1" does not match template declaration MetaString(String)
+---
+*/
+
+template MetaString(String)
+{
+    alias String Value;
+}
+
+void main()
+{
+    alias MetaString!("2 == 1") S;
+    assert(mixin(S.Value));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail162.d b/gcc/testsuite/gdc.test/fail_compilation/fail162.d
new file mode 100644
index 00000000000..f49fbac6497
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail162.d
@@ -0,0 +1,32 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail162.d(25): Error: template fail162.testHelper cannot deduce function from argument types !()(string, string), candidates are:
+fail_compilation/fail162.d(10):        fail162.testHelper(A...)()
+fail_compilation/fail162.d(30): Error: template instance fail162.test!("hello", "world") error instantiating
+---
+*/
+
+template testHelper(A ...)
+{
+    char[] testHelper()
+    {
+        char[] result;
+        foreach (t; a)
+        {
+            result ~= "int " ~ t ~ ";\r\n";
+        }
+        return result;
+    }
+}
+
+template test(A...)
+{
+    const char[] test = testHelper(A);
+}
+
+int main(char[][] args)
+{
+    mixin(test!("hello", "world"));
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail163.d b/gcc/testsuite/gdc.test/fail_compilation/fail163.d
new file mode 100644
index 00000000000..71f75d41030
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail163.d
@@ -0,0 +1,90 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail163.d(11): Error: cannot implicitly convert expression (q) of type const(char)[] to char[]
+---
+*/
+void test1()
+{
+    char[] p;
+    const(char)[] q;
+    p = q;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail163.d(24): Error: cannot implicitly convert expression (p) of type const(int***) to const(int)***
+---
+*/
+void test2()
+{
+    const int*** p;
+    const(int)*** cp;
+    cp = p;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail163.d(37): Error: cannot modify const expression p
+---
+*/
+void test3()
+{
+    const(uint***) p;
+    const(int)*** cp;
+    p = cp;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail163.d(50): Error: cannot implicitly convert expression (cp) of type const(int)***[] to const(uint***)[]
+---
+*/
+void test4()
+{
+    const(uint***)[] p;
+    const(int)***[] cp;
+    p = cp;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail163.d(63): Error: cannot modify const expression *p
+---
+*/
+void test5()
+{
+    int x;
+    const(int)* p = &x;
+    *p = 3;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail163.d(76): Error: cannot implicitly convert expression (& x) of type int* to immutable(int)*
+fail_compilation/fail163.d(77): Error: cannot modify immutable expression *p
+---
+*/
+void test6()
+{
+    int x;
+    immutable(int)* p = &x;
+    *p = 3;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail163.d(89): Error: cannot implicitly convert expression (& x) of type const(int)* to int*
+---
+*/
+void test7()
+{
+    const(int) x = 3;
+    int* p = &x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail16600.d b/gcc/testsuite/gdc.test/fail_compilation/fail16600.d
new file mode 100644
index 00000000000..a7f30d9187c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail16600.d
@@ -0,0 +1,26 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/fail16600.d(22): Error: fail16600.S.__ctor called with argument types (string) const matches both:
+fail_compilation/fail16600.d(16):     fail16600.S.this(string _param_0)
+and:
+fail_compilation/fail16600.d(17):     fail16600.S.this(string _param_0) immutable
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=16600
+
+struct S
+{
+    int i;
+
+    this(string) { i = 1; }
+    this(string) immutable { i = 2; }
+}
+
+void main()
+{
+    auto a = const(S)("abc");
+    assert(a.i == 2);
+}
+
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail169.d b/gcc/testsuite/gdc.test/fail_compilation/fail169.d
new file mode 100644
index 00000000000..bd1da0bf6b2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail169.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail169.d(8): Error: cannot have const out parameter of type const(int)
+---
+*/
+
+void foo(const out int x) { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17.d b/gcc/testsuite/gdc.test/fail_compilation/fail17.d
new file mode 100644
index 00000000000..fa3b4888c12
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17.d
@@ -0,0 +1,8 @@
+struct A(T)
+{
+    mixin B!(T, A!(T));
+}
+
+A!(int) x;
+
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail170.d b/gcc/testsuite/gdc.test/fail_compilation/fail170.d
new file mode 100644
index 00000000000..a78fc035dde
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail170.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail170.d(8): Error: variable fail170.foo.x cannot be final, perhaps you meant const?
+---
+*/
+
+void foo(final out int x) { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail172.d b/gcc/testsuite/gdc.test/fail_compilation/fail172.d
new file mode 100644
index 00000000000..c7ccdc16b8d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail172.d
@@ -0,0 +1,32 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail172.d(25): Error: cannot modify const expression c1.x
+fail_compilation/fail172.d(26): Error: cannot modify const expression c2.x
+fail_compilation/fail172.d(30): Error: cannot modify const expression s1.x
+fail_compilation/fail172.d(31): Error: cannot modify const expression s2.x
+---
+*/
+
+class C
+{
+    int x;
+}
+
+struct S
+{
+    int x;
+}
+
+void main()
+{
+    const(C) c1 = new C();
+    const C  c2 = new C();
+    c1.x = 3;
+    c2.x = 3;
+
+    const(S) s1;
+    const S  s2;
+    s1.x = 3;
+    s2.x = 3;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17275.d b/gcc/testsuite/gdc.test/fail_compilation/fail17275.d
new file mode 100644
index 00000000000..c73fd3d394b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17275.d
@@ -0,0 +1,19 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/fail17275.d(12): Error: undefined identifier `ModuleGroup`, did you mean function `moduleGroup`?
+fail_compilation/fail17275.d(12): Error: inout on return means inout must be on a parameter as well for inout(ModuleGroup)()
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=17275
+
+struct DSO
+{
+    inout(ModuleGroup) moduleGroup() { }
+}
+
+struct ThreadDSO
+{
+    DSO* _pdso;
+    void[] _tlsRange;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17354.d b/gcc/testsuite/gdc.test/fail_compilation/fail17354.d
new file mode 100644
index 00000000000..e09f1e57914
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17354.d
@@ -0,0 +1,19 @@
+/* REQUIRED_ARGS: -de
+ * TEST_OUTPUT:
+---
+fail_compilation/fail17354.d(13): Deprecation: cannot implicitly override base class method `object.Object.opEquals` with `fail17354.Foo.opEquals`; add `override` attribute
+fail_compilation/fail17354.d(18): Deprecation: cannot implicitly override base class method `object.Object.opEquals` with `fail17354.Bar.opEquals`; add `override` attribute
+---
+ */
+
+// https://issues.dlang.org/show_bug.cgi?id=17354
+
+final class Foo
+{
+    bool opEquals(const Object) const {return true;}
+}
+
+class Bar
+{
+    bool opEquals(const Object) const {return true;}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17419.d b/gcc/testsuite/gdc.test/fail_compilation/fail17419.d
new file mode 100644
index 00000000000..82d416026e5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17419.d
@@ -0,0 +1,12 @@
+
+// https://issues.dlang.org/show_bug.cgi?id=17419
+/* TEST_OUTPUT:
+---
+fail_compilation/fail17419.d(10): Error: argument to `__traits(getLinkage, 64)` is not a declaration
+fail_compilation/fail17419.d(11): Error: expected 1 arguments for `getLinkage` but had 2
+---
+*/
+
+enum s = __traits(getLinkage, 8 * 8);
+enum t = __traits(getLinkage, 8, 8);
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17421.d b/gcc/testsuite/gdc.test/fail_compilation/fail17421.d
new file mode 100644
index 00000000000..c308ad5f150
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17421.d
@@ -0,0 +1,16 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/fail17421.d(14): Error: argument to `__traits(getFunctionVariadicStyle, 1)` is not a function
+fail_compilation/fail17421.d(14):        while evaluating: `static assert(__traits(getFunctionVariadicStyle, 1) == "none")`
+fail_compilation/fail17421.d(15): Error: argument to `__traits(getFunctionVariadicStyle, int*)` is not a function
+fail_compilation/fail17421.d(15):        while evaluating: `static assert(__traits(getFunctionVariadicStyle, int*) == "none")`
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=17421
+
+alias int* x;
+
+static assert(__traits(getFunctionVariadicStyle, 1) == "none");
+static assert(__traits(getFunctionVariadicStyle, x) == "none");
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17491.d b/gcc/testsuite/gdc.test/fail_compilation/fail17491.d
new file mode 100644
index 00000000000..4902392cf0f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17491.d
@@ -0,0 +1,41 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/fail17491.d(24): Error: (S17491).init is not an lvalue
+fail_compilation/fail17491.d(25): Error: S17491(0) is not an lvalue
+fail_compilation/fail17491.d(27): Error: constant S17491(0).field is not an lvalue
+fail_compilation/fail17491.d(28): Error: constant *&S17491(0).field is not an lvalue
+fail_compilation/fail17491.d(33): Error: S17491(0) is not an lvalue
+fail_compilation/fail17491.d(34): Error: S17491(0) is not an lvalue
+fail_compilation/fail17491.d(36): Error: constant S17491(0).field is not an lvalue
+fail_compilation/fail17491.d(37): Error: constant *&S17491(0).field is not an lvalue
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=17491
+
+struct S17491
+{
+    int field;
+    static int var;
+}
+
+void test17491()
+{
+    S17491.init = S17491(42);       // NG
+    *&S17491.init = S17491(42);     // NG
+
+    S17491.init.field = 42;         // NG
+    *&S17491.init.field = 42;       // Should be NG
+
+    S17491.init.var = 42;           // OK
+    *&S17491.init.var = 42;         // OK
+
+    S17491(0) = S17491(42);         // NG
+    *&S17491(0) = S17491(42);       // NG
+
+    S17491(0).field = 42;           // NG
+    *&S17491(0).field = 42;         // Should be NG
+
+    S17491(0).var = 42;             // OK
+    *&S17491(0).var = 42;           // OK
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17492.d b/gcc/testsuite/gdc.test/fail_compilation/fail17492.d
new file mode 100644
index 00000000000..e45c2e59359
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17492.d
@@ -0,0 +1,23 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/fail17492.d(19): Error: class fail17492.C.testE.I already exists at fail_compilation/fail17492.d(12). Perhaps in another function with the same name?
+---
+https://issues.dlang.org/show_bug.cgi?id=17492
+*/
+
+class C
+{
+    void testE()
+    {
+        class I
+        {
+        }
+    }
+
+    void testE()
+    {
+        class I
+        {
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17502.d b/gcc/testsuite/gdc.test/fail_compilation/fail17502.d
new file mode 100644
index 00000000000..8202b1e9380
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17502.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail17502.d(12): Error: function fail17502.Foo.foo void functions have no result
+fail_compilation/fail17502.d(13): Error: cannot have parameter of type const(void)
+fail_compilation/fail17502.d(16): Error: function fail17502.Foo.bar void functions have no result
+fail_compilation/fail17502.d(17): Error: cannot have parameter of type const(void)
+---
+*/
+class Foo
+{
+    void foo()
+    out (res) { assert(res > 5); }
+    body {}
+
+    auto bar()
+    out (res) { assert (res > 5); }
+    body { return; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail176.d b/gcc/testsuite/gdc.test/fail_compilation/fail176.d
new file mode 100644
index 00000000000..908d08cd3aa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail176.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail176.d(13): Error: cannot modify immutable expression a[1]
+fail_compilation/fail176.d(16): Error: cannot modify immutable expression b[1]
+fail_compilation/fail176.d(19): Error: cannot modify const expression c[1]
+---
+*/
+
+void foo()
+{
+    auto a = "abc";
+    a[1] = 'd';
+
+    immutable char[3] b = "abc";
+    b[1] = 'd';
+
+    const char[3] c = "abc";
+    c[1] = 'd';
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17612.d b/gcc/testsuite/gdc.test/fail_compilation/fail17612.d
new file mode 100644
index 00000000000..4ae1e0ad616
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17612.d
@@ -0,0 +1,17 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/fail17612.d(14): Error: undefined identifier `string`
+fail_compilation/fail17612.d(17): Error: class object.TypeInfo missing or corrupt object.d
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=17612
+
+module object;
+
+class Object
+{
+    string toString();
+}
+
+class TypeInfo {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail177.d b/gcc/testsuite/gdc.test/fail_compilation/fail177.d
new file mode 100644
index 00000000000..1e1207732a0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail177.d
@@ -0,0 +1,31 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail177.d(22): Error: cannot modify immutable expression j
+fail_compilation/fail177.d(24): Error: cannot modify const expression i
+fail_compilation/fail177.d(26): Error: cannot modify const expression s1.x
+fail_compilation/fail177.d(27): Error: cannot modify const expression *s1.p
+fail_compilation/fail177.d(29): Error: cannot modify const expression s2.x
+fail_compilation/fail177.d(30): Error: cannot modify const expression *s2.p
+---
+*/
+
+struct S
+{
+    int x;
+    int* p;
+}
+
+void test(const(S) s1, const S s2, const(int) i)
+{
+    immutable int j = 3;
+    j = 4;
+
+    i = 4;
+
+    s1.x = 3;
+    *s1.p = 4;
+
+    s2.x = 3;
+    *s2.p = 4;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17722a.d b/gcc/testsuite/gdc.test/fail_compilation/fail17722a.d
new file mode 100644
index 00000000000..b6ede294a03
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17722a.d
@@ -0,0 +1,13 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/fail17722a.d(12): Error: static assert  `__traits(compiles, a1 && a2)` is false
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=17722
+
+void fail17722a()
+{
+    byte[16] a1, a2;
+    static assert(__traits(compiles, a1 && a2));  // diagnostic was (__error) && (__error)
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17722b.d b/gcc/testsuite/gdc.test/fail_compilation/fail17722b.d
new file mode 100644
index 00000000000..d5253d907ff
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail17722b.d
@@ -0,0 +1,13 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/fail17722a.d(12): Error: static assert  `__traits(compiles, a1 || a2)` is false
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=17722
+
+void fail17722b()
+{
+    byte[16] a1, a2;
+    static assert(__traits(compiles, a1 || a2));  // diagnostic was (__error) || (__error)
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail179.d b/gcc/testsuite/gdc.test/fail_compilation/fail179.d
new file mode 100644
index 00000000000..bd0e1557246
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail179.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail179.d(11): Error: variable fail179.main.px cannot be final, perhaps you meant const?
+---
+*/
+
+void main()
+{
+    int x = 3;
+    final px = &x;
+    *px = 4;
+    auto ppx = &px;
+    **ppx = 5;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail18.d b/gcc/testsuite/gdc.test/fail_compilation/fail18.d
new file mode 100644
index 00000000000..55a4af1f45d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail18.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail18.d(14): Error: need upper and lower bound to slice pointer
+---
+*/
+
+// 7/25
+// Internal error: ..\ztc\cgcod.c 1464
+
+void main ()
+{
+    int x = 3;
+    int[] a = (&x)[];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail180.d b/gcc/testsuite/gdc.test/fail_compilation/fail180.d
new file mode 100644
index 00000000000..e54c0e00040
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail180.d
@@ -0,0 +1,65 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail180.d(23): Error: cannot modify const expression this.x
+fail_compilation/fail180.d(24): Error: cannot modify const expression this.x
+fail_compilation/fail180.d(38): Error: cannot modify const expression this.x
+fail_compilation/fail180.d(39): Error: cannot modify const expression this.x
+fail_compilation/fail180.d(50): Error: variable fail180.main.t cannot be final, perhaps you meant const?
+fail_compilation/fail180.d(62): Error: variable fail180.test.d cannot be final, perhaps you meant const?
+---
+*/
+
+struct S59
+{
+    int x;
+
+    void foo()
+    {
+        x = 3;
+    }
+    const void bar()
+    {
+        x = 4;
+        this.x = 5;
+    }
+}
+
+class C
+{
+    int x;
+
+    void foo()
+    {
+        x = 3;
+    }
+    const void bar()
+    {
+        x = 4;
+        this.x = 5;
+    }
+}
+
+void main()
+{
+    S59 s;
+
+    s.foo();
+    s.bar();
+
+    final S59 t;
+    t.foo();
+    t.bar();
+}
+
+void test()
+{
+    C c = new C;
+
+    c.foo();
+    c.bar();
+
+    final C d = new C;
+    d.foo();
+    d.bar();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail183.d b/gcc/testsuite/gdc.test/fail_compilation/fail183.d
new file mode 100644
index 00000000000..b0a00ba83af
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail183.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail183.d(10): Error: redundant attribute 'const'
+fail_compilation/fail183.d(10): Error: redundant attribute 'scope'
+fail_compilation/fail183.d(11): Error: redundant attribute 'in'
+---
+*/
+
+void f(in final const scope int x) {}
+void g(final const scope in int x) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail184.d b/gcc/testsuite/gdc.test/fail_compilation/fail184.d
new file mode 100644
index 00000000000..dc31bdeacd3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail184.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail184.d(8): Error: redundant attribute 'final'
+---
+*/
+
+final final int x;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail185.d b/gcc/testsuite/gdc.test/fail_compilation/fail185.d
new file mode 100644
index 00000000000..7197531d8e5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail185.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail185.d(10): Error: static assert  "An error message
+	that spans multiple lines, and also contains such characters as a tab,
+\ and "."
+---
+*/
+
+static assert (false,
+"An error message
+\tthat spans multiple lines, and also contains such characters as a tab,
+\\ and \".");
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail187.d b/gcc/testsuite/gdc.test/fail_compilation/fail187.d
new file mode 100644
index 00000000000..b985493d5fd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail187.d
@@ -0,0 +1,28 @@
+// REQUIRED_ARGS: -d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail187.d(16): Error: catch at fail_compilation/fail187.d(20) hides catch at fail_compilation/fail187.d(24)
+---
+*/
+
+// On DMD 2.000 bug only with typedef, not alias
+
+alias Exception A;
+alias Exception B;
+
+void main()
+{
+    try
+    {
+        throw new A("test");
+    }
+    catch (B)
+    {
+        // this shouldn't happen, but does
+    }
+    catch (A)
+    {
+        // this ought to happen?
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail188.d b/gcc/testsuite/gdc.test/fail_compilation/fail188.d
new file mode 100644
index 00000000000..cd201d025bc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail188.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail188.d(15): Error: function fail188.Derived.foo cannot override final function fail188.Base.foo
+---
+*/
+
+class Base
+{
+    final void foo() {}
+}
+
+class Derived : Base
+{
+    void foo() {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail189.d b/gcc/testsuite/gdc.test/fail_compilation/fail189.d
new file mode 100644
index 00000000000..dda8b50391d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail189.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail189.d(10): Error: undefined identifier 'foo'
+---
+*/
+
+void bar()
+{
+    foo(); // should fail
+}
+
+version(none):
+void foo() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail190.d b/gcc/testsuite/gdc.test/fail_compilation/fail190.d
new file mode 100644
index 00000000000..6f4046a4eec
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail190.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail190.d(9): Error: can't have pointer to (int, int, int)
+fail_compilation/fail190.d(16): Error: template instance fail190.f!(int, int, int) error instantiating
+---
+*/
+
+T* f(T...)(T x)
+{
+    return null;
+}
+
+void main()
+{
+    auto x = f(2,3,4);
+    *x = *x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail1900.d b/gcc/testsuite/gdc.test/fail_compilation/fail1900.d
new file mode 100644
index 00000000000..cabfbdff8dc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail1900.d
@@ -0,0 +1,66 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail1900.d(26): Error: template fail1900.Mix1a!().Foo matches more than one template declaration:
+fail_compilation/fail1900.d(13):     Foo(ubyte x)
+and
+fail_compilation/fail1900.d(14):     Foo(byte x)
+---
+*/
+
+template Mix1a()
+{
+    template Foo(ubyte x) {}
+    template Foo(byte x) {}
+}
+template Mix1b()
+{
+    template Foo(int x) {}
+}
+
+mixin Mix1a;
+mixin Mix1b;
+
+void test1900a()
+{
+    alias x = Foo!1;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail1900.d(41): Error: imports.fail1900b.Bar(short n) at fail_compilation/imports/fail1900b.d(2) conflicts with imports.fail1900a.Bar(int n) at fail_compilation/imports/fail1900a.d(2)
+---
+*/
+
+import imports.fail1900a;
+import imports.fail1900b;
+
+void test1900b()
+{
+    enum x = Bar!1;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail1900.d(65): Error: fail1900.Mix2b!().Baz(int x) at fail_compilation/fail1900.d(57) conflicts with fail1900.Mix2a!().Baz(byte x) at fail_compilation/fail1900.d(53)
+---
+*/
+
+template Mix2a()
+{
+    template Baz(byte x) {}
+}
+template Mix2b()
+{
+    template Baz(int x) {}
+}
+
+mixin Mix2a;
+mixin Mix2b;
+
+void test1900c()
+{
+    alias x = Baz!1;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail192.d b/gcc/testsuite/gdc.test/fail_compilation/fail192.d
new file mode 100644
index 00000000000..3c485e6948e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail192.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail192.d(15): Error: outer function context of fail192.foo is needed to 'new' nested class fail192.foo.DummyClass
+fail_compilation/fail192.d(26): Error: template instance fail192.X!(DummyClass) error instantiating
+---
+*/
+
+// 1336 Internal error when trying to construct a class declared within a unittest from a templated class.
+
+class X(T)
+{
+    void bar()
+    {
+        auto t = new T;
+    }
+}
+
+void foo()
+{
+    class DummyClass
+    {
+    }
+
+    //auto x = new X!(DummyClass);
+    X!(DummyClass) x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail193.d b/gcc/testsuite/gdc.test/fail_compilation/fail193.d
new file mode 100644
index 00000000000..c3093c74bac
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail193.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail193.d(14): Error: cannot infer type from overloaded function symbol & foo
+---
+*/
+
+void foo() { }
+void foo(int) { }
+
+void main()
+{
+    //void function(int) fp = &foo;
+    auto fp = &foo;
+    fp(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail194.d b/gcc/testsuite/gdc.test/fail_compilation/fail194.d
new file mode 100644
index 00000000000..2ce4ab86881
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail194.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail194.d(18): Error: function & foo is overloaded
+---
+*/
+
+import core.vararg;
+
+void bar(int i, ...) { }
+
+void foo() { }
+void foo(int) { }
+
+void main()
+{
+    //bar(1, cast(void function())&foo);
+    bar(1, &foo);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail195.d b/gcc/testsuite/gdc.test/fail_compilation/fail195.d
new file mode 100644
index 00000000000..57a6bdc2918
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail195.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail195.d(22): Error: struct Foo does not overload ()
+---
+*/
+
+// 1384 Compiler segfaults when using struct variable like a function with no opCall member.
+
+struct Foo
+{
+    union
+    {
+        int a;
+        int b;
+    }
+}
+
+void bla()
+{
+    Foo next;
+    next(); // Error: structliteral has no effect in expression (Foo(0))
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail196.d b/gcc/testsuite/gdc.test/fail_compilation/fail196.d
new file mode 100644
index 00000000000..2a2812bb479
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail196.d
@@ -0,0 +1,21 @@
+
+void main()
+{
+    string s = q"(foo(xxx)) ";
+    assert(s == "foo(xxx)");
+
+    s = q"[foo[xxx]]";
+    assert(s == "foo[xxx]");
+
+    s = q"{foo{xxx}}";
+    assert(s == "foo{xxx}");
+
+    s = q"<foo<xxx>>";
+    assert(s == "foo<xxx>");
+
+    s = q"[foo(]";
+    assert(s == "foo(");
+
+    s = q"/foo]/";
+    assert(s == "foo]");
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail198.d b/gcc/testsuite/gdc.test/fail_compilation/fail198.d
new file mode 100644
index 00000000000..4cb63b4870e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail198.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail198.d(8): Error: template instance test!42 template 'test' is not defined
+---
+*/
+
+int x = test!(42);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail199.d b/gcc/testsuite/gdc.test/fail_compilation/fail199.d
new file mode 100644
index 00000000000..e293aa1c92c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail199.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -de
+
+//import std.stdio;
+
+deprecated class DepClass
+{
+    void test()
+    {
+        //writefln("Accessing what's deprecated!");
+    }
+}
+
+class Derived : DepClass {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20.d b/gcc/testsuite/gdc.test/fail_compilation/fail20.d
new file mode 100644
index 00000000000..821cc843e07
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail20.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail20.d(16): Error: need member function opCmp() for struct FOO to compare
+---
+*/
+
+// ICE(cod3) DMD0.080
+
+struct FOO{}
+
+void main()
+{
+    FOO one;
+    FOO two;
+    if (one < two){} // This should tell me that there
+                     // is no opCmp() defined instead 
+                     // of crashing.
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail200.d b/gcc/testsuite/gdc.test/fail_compilation/fail200.d
new file mode 100644
index 00000000000..c0ba46ca96f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail200.d
@@ -0,0 +1,16 @@
+// REQUIRED_ARGS: -de
+
+//import std.stdio;
+
+deprecated interface DepClass
+{
+    void test();
+}
+
+class Derived : DepClass
+{
+    void test()
+    {
+        //writefln("Accessing what's deprecated!");
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail201.d b/gcc/testsuite/gdc.test/fail_compilation/fail201.d
new file mode 100644
index 00000000000..d9655b3bc27
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail201.d
@@ -0,0 +1,5 @@
+void main() {
+        int c;
+        c = c >>> 33;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail202.d b/gcc/testsuite/gdc.test/fail_compilation/fail202.d
new file mode 100644
index 00000000000..78cf21a9e84
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail202.d
@@ -0,0 +1,5 @@
+void main() {
+        int c;
+        c = c >> 33;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail203.d b/gcc/testsuite/gdc.test/fail_compilation/fail203.d
new file mode 100644
index 00000000000..3d96e0cba1f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail203.d
@@ -0,0 +1,5 @@
+void main() {
+        int c;
+        c = c << 33;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail204.d b/gcc/testsuite/gdc.test/fail_compilation/fail204.d
new file mode 100644
index 00000000000..41b7c297fb3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail204.d
@@ -0,0 +1,5 @@
+void main() {
+        long c;
+        c >>= 65;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail205.d b/gcc/testsuite/gdc.test/fail_compilation/fail205.d
new file mode 100644
index 00000000000..04ef95ead00
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail205.d
@@ -0,0 +1,5 @@
+void main() {
+        long c;
+        c <<= 65;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail206.d b/gcc/testsuite/gdc.test/fail_compilation/fail206.d
new file mode 100644
index 00000000000..6c0bf4630af
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail206.d
@@ -0,0 +1,5 @@
+void main() {
+        long c;
+        c >>>= 65;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail207.d b/gcc/testsuite/gdc.test/fail_compilation/fail207.d
new file mode 100644
index 00000000000..593f9896cd8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail207.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail207.d(10): Error: found EOF instead of initializer
+fail_compilation/fail207.d(10): Error: semicolon expected, not 'EOF'
+---
+*/
+
+int x = {
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail208.d b/gcc/testsuite/gdc.test/fail_compilation/fail208.d
new file mode 100644
index 00000000000..8abcc3e4af3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail208.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail208.d(18): Error: return expression expected
+fail_compilation/fail208.d(21):        called from here: MakeA()
+---
+*/
+
+
+// Issue 1593 - ICE compiler crash empty return statement in function
+
+struct A
+{
+}
+
+A MakeA()
+{
+    return ;
+}
+
+static const A aInstance = MakeA();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail209.d b/gcc/testsuite/gdc.test/fail_compilation/fail209.d
new file mode 100644
index 00000000000..a0211aaf4b4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail209.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail209.d(20): Error: incompatible types for ((a) -= (x)): 'float' and 'fail209.X'
+---
+*/
+
+// Issue 725 - expression.c:6516: virtual Expression* MinAssignExp::semantic(Scope*): Assertion `e2->type->isfloating()' failed
+
+class X
+{
+    float a;
+}
+
+void main()
+{
+    X x;
+    float a;
+
+    a -= x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail212.d b/gcc/testsuite/gdc.test/fail_compilation/fail212.d
new file mode 100644
index 00000000000..63c573eb63d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail212.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail212.d(14): Error: function fail212.S.bar without 'this' cannot be const
+---
+*/
+
+struct S
+{
+    void foo() const
+    {
+    }
+
+    static void bar() const
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail213.d b/gcc/testsuite/gdc.test/fail_compilation/fail213.d
new file mode 100644
index 00000000000..d00238273a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail213.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail213.d(18): Error: template instance Foo!int does not match template declaration Foo(T : immutable(T))
+fail_compilation/fail213.d(25): Error: template instance Foo!(const(int)) does not match template declaration Foo(T : immutable(T))
+---
+*/
+
+template Foo(T:immutable(T))
+{
+    alias T Foo;
+}
+
+void main()
+{
+  {
+    int x;
+    alias Foo!(typeof(x)) f;
+    //printf("%s\n", typeid(f).toString().ptr);
+    assert(is(typeof(x) == int));
+    assert(is(f == int));
+  }
+  {
+    const int x;
+    alias Foo!(typeof(x)) f;
+  }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail215.d b/gcc/testsuite/gdc.test/fail_compilation/fail215.d
new file mode 100644
index 00000000000..f9427230751
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail215.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail215.d(10): Error: function fail215.b.k cannot be both final and abstract
+---
+*/
+
+class b
+{
+    final abstract void k();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail216.d b/gcc/testsuite/gdc.test/fail_compilation/fail216.d
new file mode 100644
index 00000000000..98dcbb8dcfb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail216.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail216.d(16): Error: expression foo() is void and has no value
+fail_compilation/fail216.d(14): Error: function fail216.bar has no return statement, but is expected to return a value of type int
+fail_compilation/fail216.d(19):        called from here: bar()
+---
+*/
+
+// Issue 1744 - CTFE: crash on assigning void-returning function to variable
+
+void foo() {}
+
+int bar()
+{
+    int x = foo();
+}
+
+const y = bar();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail217.d b/gcc/testsuite/gdc.test/fail_compilation/fail217.d
new file mode 100644
index 00000000000..67c28cd8f40
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail217.d
@@ -0,0 +1,18 @@
+
+class Message
+  {
+    public int notifier;
+
+    this( int notifier_object )
+      {
+        notifier = notifier_object;
+      }
+  }
+
+void
+main()
+  {
+    auto m2 = new immutable(Message)(2);
+    m2.notifier = 3;
+  }
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail218.d b/gcc/testsuite/gdc.test/fail_compilation/fail218.d
new file mode 100644
index 00000000000..e180e77c7ec
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail218.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail218.d(15): Error: cannot modify string literal ", "
+---
+*/
+
+// Issue 1788 - dmd segfaults without info
+
+void main()
+{
+    string a = "abc";
+    double b = 7.5;
+
+    a ~= ", " ~= b;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22.d b/gcc/testsuite/gdc.test/fail_compilation/fail22.d
new file mode 100644
index 00000000000..6264bdbee2b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail22.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail22.d(13): Error: no identifier for declarator char
+---
+*/
+
+// infinite loop on DMD0.080
+
+void main()
+{
+    char[] bug = "Crash";
+    foreach(char ; bug) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail220.d b/gcc/testsuite/gdc.test/fail_compilation/fail220.d
new file mode 100644
index 00000000000..5e2f1305eb1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail220.d
@@ -0,0 +1,8 @@
+template types (T) {
+    static if (is (T V : V[K], K == class)) {
+        static assert (false, "assoc");
+    }
+    static const int types = 4;
+}
+
+int i = types!(int);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail221.d b/gcc/testsuite/gdc.test/fail_compilation/fail221.d
new file mode 100644
index 00000000000..9bada5b95cc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail221.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail221.d(11): Error: expression cast(void)0 is void and has no value
+---
+*/
+
+void main()
+{
+    void[] data;
+    data ~= cast(void) 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail222.d b/gcc/testsuite/gdc.test/fail_compilation/fail222.d
new file mode 100644
index 00000000000..c377239fe96
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail222.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail222.d(10): Error: template fail222.getMixin(TArg..., int i = 0)() template tuple parameter must be last one
+fail_compilation/fail222.d(17): Error: template instance getMixin!() does not match template declaration getMixin(TArg..., int i = 0)()
+fail_compilation/fail222.d(20): Error: template instance fail222.Thing!() error instantiating
+---
+*/
+
+string getMixin(TArg..., int i = 0)()
+{
+    return ``;
+}
+
+class Thing(TArg...)
+{
+    mixin(getMixin!(TArg)());
+}
+
+public Thing!() stuff;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail223.d b/gcc/testsuite/gdc.test/fail_compilation/fail223.d
new file mode 100644
index 00000000000..611e7a49b44
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail223.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail223.d(14): Error: cannot modify const expression this.x
+---
+*/
+
+//import std.stdio;
+
+class A
+{
+public:
+    int x = 0;
+    void setX(int nx) const { x = nx; }
+}
+
+void foo(const A a) { a.setX(1); }
+
+int main(char[][] args)
+{
+    A a = new A;
+    foo(a);
+    //writefln(a.x);
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail224.d b/gcc/testsuite/gdc.test/fail_compilation/fail224.d
new file mode 100644
index 00000000000..4bde3700482
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail224.d
@@ -0,0 +1,36 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail224.d(22): Error: need 'this' of type A to access member x from static function f
+---
+*/
+
+int gi;
+
+class A
+{
+    int x = 42;
+
+    void am()
+    {
+        static void f()
+        {
+            class B
+            {
+                void bm()
+                {
+                    gi = x;
+                }
+            }
+
+            (new B).bm();
+        }
+
+        f();
+    }
+}
+
+void main()
+{
+    (new A).am();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail225.d b/gcc/testsuite/gdc.test/fail_compilation/fail225.d
new file mode 100644
index 00000000000..6cf59f3556c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail225.d
@@ -0,0 +1,10 @@
+struct Struct { 
+        char* chptr; 
+}
+
+void main()
+{
+        char ch = 'd';
+        immutable Struct iStruct = {1, &ch};
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail228.d b/gcc/testsuite/gdc.test/fail_compilation/fail228.d
new file mode 100644
index 00000000000..3d450f32a6b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail228.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail228.d(22): Error: undefined identifier 'localVariable'
+---
+*/
+
+//import core.stdc.stdio : printf;
+
+int ToTypeString(T : int)()
+{
+    return 1;
+}
+
+int ToTypeString(T : string)()
+{
+    return 2;
+}
+
+void main()
+{
+    auto x = ToTypeString!(typeof(localVariable))();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail229.d b/gcc/testsuite/gdc.test/fail_compilation/fail229.d
new file mode 100644
index 00000000000..6cf8676cc99
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail229.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail229.d(11): Error: array index 18446744073709551615 overflow
+fail_compilation/fail229.d(11): Error: array dimension overflow
+---
+*/
+
+// Issue 1936 - Error with no line number (array dimension overflow)
+
+static int[] x = [-1: 1];
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail23.d b/gcc/testsuite/gdc.test/fail_compilation/fail23.d
new file mode 100644
index 00000000000..91517aaa04a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail23.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail23.d(14): Error: break is not inside a loop or switch
+---
+*/
+
+// ICE(s2ir.c) DMD0.100
+
+void main()
+{
+    try
+    {
+        break;
+    }
+    catch
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail231.d b/gcc/testsuite/gdc.test/fail_compilation/fail231.d
new file mode 100644
index 00000000000..95f25eea3c3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail231.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail231.d(15): Error: class fail231.Derived cannot implicitly generate a default ctor when base class fail231.Base is missing a default ctor
+---
+*/
+
+// Issue 951 - Missing line number: no constructor provided for a class derived from a class with no default constructor
+
+class Base
+{
+    this(int x) {}
+}
+
+class Derived : Base
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail232.d b/gcc/testsuite/gdc.test/fail_compilation/fail232.d
new file mode 100644
index 00000000000..ee2f4312097
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail232.d
@@ -0,0 +1,7 @@
+void bug1601() {
+    int i;
+
+    i = i >> 33;
+    i = i << 33;
+    i = i >>> 33;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail233.d b/gcc/testsuite/gdc.test/fail_compilation/fail233.d
new file mode 100644
index 00000000000..e2274abf172
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail233.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail233.d(11): Error: variable fail233.bug1176.v void[1] does not have a default initializer
+---
+*/
+
+void bug1176()
+{
+    void[1] v;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail235.d b/gcc/testsuite/gdc.test/fail_compilation/fail235.d
new file mode 100644
index 00000000000..d0d9deb1d4f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail235.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail235.d(12): Error: expression typeid(char) is not a valid template value argument
+---
+*/
+template Tuple(TPL...)
+{
+    alias TPL Tuple;
+}
+
+auto K = Tuple!(typeid(char));
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail235.d(24): Error: expression typeid(char) is not a valid template value argument
+---
+*/
+template Alias(alias A)
+{
+    alias A Alias;
+}
+auto A = Alias!(typeid(char));
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail2350.d b/gcc/testsuite/gdc.test/fail_compilation/fail2350.d
new file mode 100644
index 00000000000..deb0ceb6a32
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail2350.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail2350.d(8): Error: function fail2350.test2350 naked assembly functions with contracts are not supported
+---
+*/
+
+void test2350()
+in
+{
+}
+body
+{
+	asm { naked; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail236.d b/gcc/testsuite/gdc.test/fail_compilation/fail236.d
new file mode 100644
index 00000000000..969feabbc61
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail236.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail236.d(14): Error: undefined identifier 'x'
+fail_compilation/fail236.d(22): Error: template fail236.Templ2 cannot deduce function from argument types !()(int), candidates are:
+fail_compilation/fail236.d(12):        fail236.Templ2(alias a)(x)
+---
+*/
+
+// Issue 870 - contradictory error messages for templates
+
+template Templ2(alias a)
+{
+    void Templ2(x)
+    {
+    }
+}
+
+void main()
+{
+    int i;
+    Templ2(i);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail2361.d b/gcc/testsuite/gdc.test/fail_compilation/fail2361.d
new file mode 100644
index 00000000000..7cc402ee84b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail2361.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail2361.d(13): Error: cannot modify immutable expression c
+---
+*/
+
+class C {}
+
+void main()
+{
+    immutable c = new immutable(C);
+    delete c;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail237.d b/gcc/testsuite/gdc.test/fail_compilation/fail237.d
new file mode 100644
index 00000000000..cefcafd2185
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail237.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail237.d(11): Error: undefined identifier 'a' in module 'fail237'
+fail_compilation/fail237.d(11):        while evaluating: static assert(module fail237.a!().b)
+---
+*/
+
+// Issue 581 - Error message w/o line number in dot-instantiated template
+
+static assert(.a!().b);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d b/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d
new file mode 100644
index 00000000000..987b5f64885
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d
@@ -0,0 +1,36 @@
+// REQUIRED_ARGS: -m32
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail238_m32.d(21): Error: cannot implicitly convert expression ("a") of type string to uint
+fail_compilation/fail238_m32.d(24): Error: cannot interpret X!() at compile time
+fail_compilation/fail238_m32.d(29): Error: template instance fail238_m32.A!"a" error instantiating
+fail_compilation/fail238_m32.d(35):        instantiated from here: M!(q)
+fail_compilation/fail238_m32.d(35):        while evaluating pragma(msg, M!(q))
+---
+*/
+
+// Issue 581 - Error message w/o line number in dot-instantiated template
+
+template X(){}
+
+template D(string str){}
+
+template A(string str)
+{
+    static if (D!(str[str]))
+    {}
+    else
+        const string A = .X!();
+}
+
+template M(alias B)
+{
+    const string M = A!("a");
+}
+
+void main()
+{
+    int q = 3;
+    pragma(msg, M!(q));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d b/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d
new file mode 100644
index 00000000000..8deaa787801
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail238_m64.d
@@ -0,0 +1,36 @@
+// REQUIRED_ARGS: -m64
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail238_m64.d(21): Error: cannot implicitly convert expression ("a") of type string to ulong
+fail_compilation/fail238_m64.d(24): Error: cannot interpret X!() at compile time
+fail_compilation/fail238_m64.d(29): Error: template instance fail238_m64.A!"a" error instantiating
+fail_compilation/fail238_m64.d(35):        instantiated from here: M!(q)
+fail_compilation/fail238_m64.d(35):        while evaluating pragma(msg, M!(q))
+---
+*/
+
+// Issue 581 - Error message w/o line number in dot-instantiated template
+
+template X(){}
+
+template D(string str){}
+
+template A(string str)
+{
+    static if (D!(str[str]))
+    {}
+    else
+        const string A = .X!();
+}
+
+template M(alias B)
+{
+    const string M = A!("a");
+}
+
+void main()
+{
+    int q = 3;
+    pragma(msg, M!(q));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail239.d b/gcc/testsuite/gdc.test/fail_compilation/fail239.d
new file mode 100644
index 00000000000..81fbca2bfd4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail239.d
@@ -0,0 +1,2 @@
+class F { int x; }
+alias typeof(F).x b;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail24.d b/gcc/testsuite/gdc.test/fail_compilation/fail24.d
new file mode 100644
index 00000000000..84cf8e1814b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail24.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail24.d(11): Error: alias fail24.strtype conflicts with alias fail24.strtype at fail_compilation/fail24.d(10)
+fail_compilation/fail24.d(12): Error: alias fail24.strtype conflicts with alias fail24.strtype at fail_compilation/fail24.d(11)
+fail_compilation/fail24.d(13): Error: alias fail24.strtype conflicts with alias fail24.strtype at fail_compilation/fail24.d(12)
+---
+*/
+
+alias char[]  strtype;
+alias char[64] strtype;
+alias char[128] strtype;
+alias char[256] strtype;
+
+int main()
+{
+    printf("%u", strtype.sizeof);
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail240.d b/gcc/testsuite/gdc.test/fail_compilation/fail240.d
new file mode 100644
index 00000000000..8a06b43401c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail240.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail240.d(9): Error: type F is not an expression
+---
+*/
+
+class F { int x; }
+alias typeof(typeof(F).x) b;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail241.d b/gcc/testsuite/gdc.test/fail_compilation/fail241.d
new file mode 100644
index 00000000000..97cad211e2b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail241.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail241.d(16): Error: mutable method fail241.Foo.f is not callable using a const object
+fail_compilation/fail241.d(17): Error: mutable method fail241.Foo.g is not callable using a const object
+---
+*/
+
+class Foo
+{
+    public void f() { }
+    private void g() { }
+
+    invariant()
+    {
+        f();  // error, cannot call public member function from invariant
+        g();  // ok, g() is not public
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail243.d b/gcc/testsuite/gdc.test/fail_compilation/fail243.d
new file mode 100644
index 00000000000..c8970ba915d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail243.d
@@ -0,0 +1,28 @@
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail243.d(23): Deprecation: class fail243.DepClass is deprecated
+fail_compilation/fail243.d(24): Deprecation: struct fail243.DepStruct is deprecated
+fail_compilation/fail243.d(25): Deprecation: union fail243.DepUnion is deprecated
+fail_compilation/fail243.d(26): Deprecation: enum fail243.DepEnum is deprecated
+fail_compilation/fail243.d(27): Deprecation: alias fail243.DepAlias is deprecated
+---
+*/
+
+deprecated
+{
+    class DepClass {}
+    struct DepStruct {}
+    union DepUnion {}
+    enum DepEnum { A }
+    alias int DepAlias;
+    //typedef int DepTypedef;
+}
+
+void func(DepClass obj) {}
+void func(DepStruct obj) {}
+void func(DepUnion obj) {}
+void func(DepEnum obj) {}
+void func(DepAlias obj) {}
+//void func(DepTypedef obj) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail244.d b/gcc/testsuite/gdc.test/fail_compilation/fail244.d
new file mode 100644
index 00000000000..d688e9ad2d0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail244.d
@@ -0,0 +1,39 @@
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail244.d(27): Deprecation: variable fail244.StructWithDeps.value is deprecated
+fail_compilation/fail244.d(28): Deprecation: variable fail244.StructWithDeps.value is deprecated
+fail_compilation/fail244.d(29): Deprecation: variable fail244.StructWithDeps.value is deprecated
+fail_compilation/fail244.d(30): Deprecation: variable fail244.StructWithDeps.value is deprecated
+fail_compilation/fail244.d(32): Deprecation: variable fail244.StructWithDeps.staticValue is deprecated
+fail_compilation/fail244.d(33): Deprecation: variable fail244.StructWithDeps.staticValue is deprecated
+fail_compilation/fail244.d(34): Deprecation: variable fail244.StructWithDeps.staticValue is deprecated
+fail_compilation/fail244.d(35): Deprecation: variable fail244.StructWithDeps.staticValue is deprecated
+fail_compilation/fail244.d(36): Deprecation: variable fail244.StructWithDeps.staticValue is deprecated
+fail_compilation/fail244.d(37): Deprecation: variable fail244.StructWithDeps.staticValue is deprecated
+---
+*/
+
+//import std.stdio;
+
+struct StructWithDeps
+{
+    deprecated int value;
+    deprecated static int staticValue;
+
+    void test(StructWithDeps obj)
+    {
+        obj.value = 666;
+        this.value = 666;
+        auto n1 = obj.value;
+        auto n2 = this.value;
+
+        obj.staticValue = 102;
+        this.staticValue = 103;
+        StructWithDeps.staticValue = 104;
+        auto n3 = obj.staticValue;
+        auto n4 = this.staticValue;
+        auto n5 = StructWithDeps.staticValue;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail245.d b/gcc/testsuite/gdc.test/fail_compilation/fail245.d
new file mode 100644
index 00000000000..79e663dab1e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail245.d
@@ -0,0 +1,39 @@
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail245.d(27): Deprecation: variable fail245.ClassWithDeps.value is deprecated
+fail_compilation/fail245.d(28): Deprecation: variable fail245.ClassWithDeps.value is deprecated
+fail_compilation/fail245.d(29): Deprecation: variable fail245.ClassWithDeps.value is deprecated
+fail_compilation/fail245.d(30): Deprecation: variable fail245.ClassWithDeps.value is deprecated
+fail_compilation/fail245.d(32): Deprecation: variable fail245.ClassWithDeps.staticValue is deprecated
+fail_compilation/fail245.d(33): Deprecation: variable fail245.ClassWithDeps.staticValue is deprecated
+fail_compilation/fail245.d(34): Deprecation: variable fail245.ClassWithDeps.staticValue is deprecated
+fail_compilation/fail245.d(35): Deprecation: variable fail245.ClassWithDeps.staticValue is deprecated
+fail_compilation/fail245.d(36): Deprecation: variable fail245.ClassWithDeps.staticValue is deprecated
+fail_compilation/fail245.d(37): Deprecation: variable fail245.ClassWithDeps.staticValue is deprecated
+---
+*/
+
+//import std.stdio;
+
+class ClassWithDeps
+{
+    deprecated int value;
+    deprecated static int staticValue;
+
+    void test(ClassWithDeps obj)
+    {
+        obj.value = 666;
+        this.value = 666;
+        auto n1 = obj.value;
+        auto n2 = this.value;
+
+        obj.staticValue = 102;
+        this.staticValue = 103;
+        ClassWithDeps.staticValue = 104;
+        auto n3 = obj.staticValue;
+        auto n4 = this.staticValue;
+        auto n5 = ClassWithDeps.staticValue;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail246.d b/gcc/testsuite/gdc.test/fail_compilation/fail246.d
new file mode 100644
index 00000000000..56f5f693e53
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail246.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail246.d-mixin-11(11): Error: identifier expected, not EOF
+fail_compilation/fail246.d-mixin-11(11): Error: ';' expected after mixin
+---
+*/
+
+void a()
+{
+    mixin(`mixin`);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail247.d b/gcc/testsuite/gdc.test/fail_compilation/fail247.d
new file mode 100644
index 00000000000..b958516e047
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail247.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail247.d-mixin-9(9): Error: identifier expected, not EOF
+fail_compilation/fail247.d-mixin-9(9): Error: ';' expected after mixin
+---
+*/
+
+mixin(`mixin`);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail248.d b/gcc/testsuite/gdc.test/fail_compilation/fail248.d
new file mode 100644
index 00000000000..185de133ec0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail248.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail248.d(9): Error: type int is not an expression
+---
+*/
+
+alias int foo;
+typeof(foo) a; // ok
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail249.d b/gcc/testsuite/gdc.test/fail_compilation/fail249.d
new file mode 100644
index 00000000000..7317707d74d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail249.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail249.d(16): Error: invalid foreach aggregate bar()
+---
+*/
+
+module main;
+
+public void bar()
+{
+}
+
+void main()
+{
+    foreach (Object o; bar())
+    {
+        debug Object foo = null; //error
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail25.d b/gcc/testsuite/gdc.test/fail_compilation/fail25.d
new file mode 100644
index 00000000000..7393a6c4a67
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail25.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail25.d(14): Error: need 'this' for 'yuiop' of type 'int'
+---
+*/
+
+class Qwert
+{
+    int yuiop;
+
+    static int asdfg()
+    {
+        return Qwert.yuiop + 105;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail250.d b/gcc/testsuite/gdc.test/fail_compilation/fail250.d
new file mode 100644
index 00000000000..c3fd7631aec
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail250.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail250.d(10): Error: constructor fail250.A.this default constructor for structs only allowed with @disable, no body, and no parameters
+---
+*/
+
+struct A
+{
+    this() {}
+}
+
+void main()
+{
+    auto a = A();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail251.d b/gcc/testsuite/gdc.test/fail_compilation/fail251.d
new file mode 100644
index 00000000000..ca8f0ffc43b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail251.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail251.d(12): Error: undefined identifier 'xs'
+fail_compilation/fail251.d(16):        called from here: foo()
+fail_compilation/fail251.d(16):        while evaluating: static assert(foo())
+---
+*/
+
+bool foo()
+{
+    foreach (x; xs) {}
+    return true;
+}
+
+static assert(foo());
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail252.d b/gcc/testsuite/gdc.test/fail_compilation/fail252.d
new file mode 100644
index 00000000000..3d2db651076
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail252.d
@@ -0,0 +1,10 @@
+class Timer {
+    abstract class Task {
+        public abstract void run();
+    }
+    private Task IDLE = new class() Task {
+        int d;
+        public void run(){
+        }
+    };
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail253.d b/gcc/testsuite/gdc.test/fail_compilation/fail253.d
new file mode 100644
index 00000000000..14e88581870
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail253.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail253.d(13): Error: variable fail253.main.x inout variables can only be declared inside inout functions
+fail_compilation/fail253.d(16): Error: cannot modify inout expression x
+---
+*/
+
+void main()
+{
+    foreach (i; 0 .. 2)
+    {
+        foreach (inout char x; "hola")
+        {
+            //printf("%c", x);
+            x = '?';
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail254.d b/gcc/testsuite/gdc.test/fail_compilation/fail254.d
new file mode 100644
index 00000000000..b29b5907be4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail254.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail254.d(12): Error: integer overflow
+fail_compilation/fail254.d(13): Error: integer overflow
+fail_compilation/fail254.d(14): Error: integer overflow
+fail_compilation/fail254.d(15): Error: integer overflow
+fail_compilation/fail254.d(16): Error: integer overflow
+---
+*/
+
+ulong v1 = 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF;
+ulong v2 = 0x1_0000_0000_0000_0000;
+ulong v3 = 0x1_FFFF_FFFF_FFFF_FFFF;
+ulong v4 = 0x7_FFFF_FFFF_FFFF_FFFF;
+ulong v5 = 0x1_0000_FFFF_FFFF_FFFF;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail256.d b/gcc/testsuite/gdc.test/fail_compilation/fail256.d
new file mode 100644
index 00000000000..87120e2644f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail256.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail256.d(8): Error: incompatible types for (("foo"d) ~ ("bar"c)): 'dstring' and 'string'
+---
+*/
+
+auto s = "foo"d ~ "bar"c;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail257.d b/gcc/testsuite/gdc.test/fail_compilation/fail257.d
new file mode 100644
index 00000000000..249a5240244
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail257.d
@@ -0,0 +1 @@
+pragma(msg, "foo"d == "bar"c ? "A" : "B");
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail258.d b/gcc/testsuite/gdc.test/fail_compilation/fail258.d
new file mode 100644
index 00000000000..97381a66394
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail258.d
@@ -0,0 +1,5 @@
+q"
+X
+
+X"
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail259.d b/gcc/testsuite/gdc.test/fail_compilation/fail259.d
new file mode 100644
index 00000000000..802e037ae0c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail259.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail259.d(11): Error: function fail259.C.foo does not override any function
+---
+*/
+
+class C
+{
+    final
+        override void foo(){}
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail261.d b/gcc/testsuite/gdc.test/fail_compilation/fail261.d
new file mode 100644
index 00000000000..787b56501bc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail261.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail261.d(18): Error: invalid foreach aggregate range, define opApply(), range primitives, or use .tupleof
+---
+*/
+
+//import std.stdio;
+
+struct MyRange
+{
+}
+
+void main()
+{
+    MyRange range;
+
+    foreach (r; range)
+    {
+        //writefln("%s", r.toString());
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail262.d b/gcc/testsuite/gdc.test/fail_compilation/fail262.d
new file mode 100644
index 00000000000..93e6af086ff
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail262.d
@@ -0,0 +1,34 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail262.d(23): Error: function fail262.B.f does not override any function
+---
+*/
+
+// Issue 1645 - can override base class' const method with non-const method
+
+import core.stdc.stdio;
+
+class A
+{
+    int x;
+    shared const void f()
+    {
+        printf("A\n");
+    }
+}
+
+class B : A
+{
+    override const void f()
+    {
+        //x = 2;
+        printf("B\n");
+    }
+}
+
+void main()
+{
+    A y = new B;
+    y.f;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail263.d b/gcc/testsuite/gdc.test/fail_compilation/fail263.d
new file mode 100644
index 00000000000..f7dfe21e336
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail263.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail263.d(18): Error: function fail263.f (byte* p) is not callable using argument types (const(byte)*)
+---
+*/
+
+// Issue 2766 - DMD hangs with 0%cpu
+
+const byte[] A = [ cast(byte)0 ];
+
+void f(byte* p)
+{
+}
+
+void func()
+{
+    f(A.ptr);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail264.d b/gcc/testsuite/gdc.test/fail_compilation/fail264.d
new file mode 100644
index 00000000000..77383d99c9a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail264.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail264.d(10): Error: undefined identifier 'undef'
+---
+*/
+
+void main()
+{
+    foreach (element; undef)
+    {
+        fn(element);
+    }
+}
+
+void fn(int i) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail265.d b/gcc/testsuite/gdc.test/fail_compilation/fail265.d
new file mode 100644
index 00000000000..d8885bf801a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail265.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail265.d-mixin-10(10): Error: found 'EOF' instead of statement
+---
+*/
+
+void main()
+{
+    mixin(`for(;;)`);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail2656.d b/gcc/testsuite/gdc.test/fail_compilation/fail2656.d
new file mode 100644
index 00000000000..fac131dfd3f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail2656.d
@@ -0,0 +1,34 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail2656.d(21): Error: octal literals 0123 are no longer supported, use std.conv.octal!123 instead
+fail_compilation/fail2656.d(22): Error: octal literals 01000000000000000000000 are no longer supported, use std.conv.octal!1000000000000000000000 instead
+fail_compilation/fail2656.d(23): Error: octal literals 0100000L are no longer supported, use std.conv.octal!100000L instead
+fail_compilation/fail2656.d(24): Error: octal literals 01777777777777777777777u are no longer supported, use std.conv.octal!1777777777777777777777u instead
+fail_compilation/fail2656.d(25): Error: octal literals 017777777777uL are no longer supported, use std.conv.octal!17777777777uL instead
+fail_compilation/fail2656.d(26): Error: octal literals 0177777 are no longer supported, use std.conv.octal!177777 instead
+fail_compilation/fail2656.d(27): Error: octal literals 020000000000L are no longer supported, use std.conv.octal!20000000000L instead
+fail_compilation/fail2656.d(28): Error: octal literals 0200000u are no longer supported, use std.conv.octal!200000u instead
+fail_compilation/fail2656.d(29): Error: octal literals 037777777777uL are no longer supported, use std.conv.octal!37777777777uL instead
+fail_compilation/fail2656.d(30): Error: octal literals 040000000000 are no longer supported, use std.conv.octal!40000000000 instead
+fail_compilation/fail2656.d(31): Error: octal literals 0777777777777777777777L are no longer supported, use std.conv.octal!777777777777777777777L instead
+fail_compilation/fail2656.d(32): Error: octal literals 077777u are no longer supported, use std.conv.octal!77777u instead
+fail_compilation/fail2656.d(33): Error: octal literals 077777uL are no longer supported, use std.conv.octal!77777uL instead
+fail_compilation/fail2656.d(34): Error: octal literals 077777uL are no longer supported, use std.conv.octal!77777uL instead
+---
+*/
+
+auto a = 0123;
+auto b = 01000000000000000000000;
+auto c = 0100000L;
+auto d = 01777777777777777777777u;
+auto e = 017777777777uL;
+auto f = 0177777;
+auto g = 020000000000L;
+auto h = 0200000u;
+auto i = 037777777777uL;
+auto j = 040000000000;
+auto k = 0777777777777777777777L;
+auto l = 077777u;
+auto m = 077777uL;
+auto n = 0_7_7_7_7_7uL;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail267.d b/gcc/testsuite/gdc.test/fail_compilation/fail267.d
new file mode 100644
index 00000000000..396b188bf9a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail267.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail267.d(15): Error: no property 'foo' for type 'void'
+---
+*/
+
+class C
+{
+    template Bar()
+    {
+    }
+}
+
+typeof(C.Bar.foo) quux;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail27.d b/gcc/testsuite/gdc.test/fail_compilation/fail27.d
new file mode 100644
index 00000000000..1ad730678c0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail27.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail27.d(15): Error: cannot implicitly convert expression (-32769) of type int to short
+fail_compilation/fail27.d(16): Error: cannot implicitly convert expression (-129) of type int to byte
+fail_compilation/fail27.d(17): Error: cannot implicitly convert expression (-1) of type int to char
+fail_compilation/fail27.d(18): Error: cannot implicitly convert expression (65536) of type int to wchar
+fail_compilation/fail27.d(19): Error: cannot implicitly convert expression (-1) of type int to wchar
+fail_compilation/fail27.d(21): Error: cannot implicitly convert expression (-1) of type int to dchar
+---
+*/
+
+void main()
+{
+    short a = -32769; // short.min-1
+    byte  b = -129; // byte.min-1
+    char  c = -1; // char.min-1
+    wchar D = 65536; // wchar.max+1
+    wchar d = -1; // wchar.min-1
+    dchar E = 1114111; // dchar.max+1
+    dchar e = -1; // dchar.min-1
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail270.d b/gcc/testsuite/gdc.test/fail_compilation/fail270.d
new file mode 100644
index 00000000000..e57d5328a88
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail270.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail270.d(12): Error: string slice [1 .. 0] is out of bounds
+fail_compilation/fail270.d(12): Error: mixin fail270.Tuple!int.Tuple.Tuple!() error instantiating
+fail_compilation/fail270.d(14): Error: mixin fail270.Tuple!int error instantiating
+---
+*/
+
+struct Tuple(TList...)
+{
+    mixin .Tuple!((TList[1 .. $])) tail;
+}
+mixin Tuple!(int);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail272.d b/gcc/testsuite/gdc.test/fail_compilation/fail272.d
new file mode 100644
index 00000000000..15325ad187f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail272.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail272.d(9): Error: circular reference to variable 'fail272.Ins!(Ins).Ins'
+fail_compilation/fail272.d(10): Error: template instance fail272.Ins!(Ins) error instantiating
+---
+*/
+
+template Ins(alias x) { const Ins = Ins!(Ins); }
+alias Ins!(Ins) x;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail273.d b/gcc/testsuite/gdc.test/fail_compilation/fail273.d
new file mode 100644
index 00000000000..9393c85df32
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail273.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail273.d(10): Error: alias fail273.b recursive alias declaration
+---
+*/
+
+// Issue 1054 - regression: circular aliases cause compiler stack overflow
+
+alias a b;
+alias b a;
+b x;  // ICE #1
+a y;  // ICE #2
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail274.d b/gcc/testsuite/gdc.test/fail_compilation/fail274.d
new file mode 100644
index 00000000000..936413f939e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail274.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail274.d(10): Error: ] expected instead of ';'
+---
+*/
+
+void main()
+{
+    asm { inc [; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail2740.d b/gcc/testsuite/gdc.test/fail_compilation/fail2740.d
new file mode 100644
index 00000000000..af7334fa71b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail2740.d
@@ -0,0 +1,15 @@
+interface IFoo
+{
+	int foo();
+}
+
+mixin template MFoo(int N)
+{
+	int foo() { return N; }
+}
+
+class Foo : IFoo
+{
+	mixin MFoo!(1) t1;
+	mixin MFoo!(2) t2;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail275.d b/gcc/testsuite/gdc.test/fail_compilation/fail275.d
new file mode 100644
index 00000000000..df3eca158f0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail275.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail275.d(10): Error: circular reference to variable 'fail275.C.x'
+---
+*/
+// REQUIRED_ARGS: -d
+struct C
+{
+    const x = C.x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail276.d b/gcc/testsuite/gdc.test/fail_compilation/fail276.d
new file mode 100644
index 00000000000..052558ce0d8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail276.d
@@ -0,0 +1,19 @@
+
+class C
+{
+    this()
+    {
+        auto i = new class()
+        {
+            auto k = new class()
+            {
+                void func()
+                {
+                    this.outer.outer;
+                }
+            };
+        };
+    }
+    int i;
+}
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail278.d b/gcc/testsuite/gdc.test/fail_compilation/fail278.d
new file mode 100644
index 00000000000..8437acd6424
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail278.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail278.d(11): Error: template instance NONEXISTENT!() template 'NONEXISTENT' is not defined
+fail_compilation/fail278.d(12): Error: template instance fail278.F!() error instantiating
+fail_compilation/fail278.d(13):        instantiated from here: Bar!(Foo)
+---
+*/
+
+template Id(xs...) { const Id = xs[0]; }
+template Foo() { mixin Id!(NONEXISTENT!()); }
+template Bar(alias F) { const int Bar = F!(); }
+alias Bar!(Foo) x;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail279.d b/gcc/testsuite/gdc.test/fail_compilation/fail279.d
new file mode 100644
index 00000000000..22d795e9e0c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail279.d
@@ -0,0 +1,8 @@
+// Issue 2920 - recursive templates blow compiler stack
+// template_16
+
+template Template(int i)
+{
+    mixin Template!(i + 1);
+}
+mixin Template!(0);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail280.d b/gcc/testsuite/gdc.test/fail_compilation/fail280.d
new file mode 100644
index 00000000000..796d171f716
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail280.d
@@ -0,0 +1,12 @@
+// Issue 2920 - recursive templates blow compiler stack
+// template_17_A.
+
+template t(int i)
+{
+    const int x = t!(i + 1).x;
+}
+
+void main()
+{
+    int i = t!(0).x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail281.d b/gcc/testsuite/gdc.test/fail_compilation/fail281.d
new file mode 100644
index 00000000000..daa9385b69c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail281.d
@@ -0,0 +1,18 @@
+// Issue 2920 - recursive templates blow compiler stack
+// template_29_B.
+
+template foo(uint i)
+{
+    static if (i > 0)
+    {
+        const uint bar = foo!(i - 1).bar;
+    }
+    else
+    {
+        const uint bar = 1;
+    }
+}
+int main()
+{
+    return foo!(uint.max).bar;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail282.d b/gcc/testsuite/gdc.test/fail_compilation/fail282.d
new file mode 100644
index 00000000000..0b1391bbd52
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail282.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail282.d(13): Error: template instance fail282.Template!500 recursive expansion
+---
+*/
+
+// Issue 2920 - recursive templates blow compiler stack
+// template_class_09.
+
+template Template(int i)
+{
+    class Class : Template!(i + 1).Class
+    {
+    }
+}
+
+alias Template!(0).Class Class0;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail284.d b/gcc/testsuite/gdc.test/fail_compilation/fail284.d
new file mode 100644
index 00000000000..a33f2c597fb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail284.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail284.d(19): Error: pure function 'fail284.foo' cannot call impure function pointer 'a'
+---
+*/
+
+static int nasty;
+
+int impure_evil_function(int x)
+{
+    nasty++;
+    return nasty;
+}
+
+pure int foo(int x)
+{
+    int function(int) a = &impure_evil_function;
+    return a(x);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail285.d b/gcc/testsuite/gdc.test/fail_compilation/fail285.d
new file mode 100644
index 00000000000..ccde34e99df
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail285.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail285.d(19): Error: with symbol fail285.S.x is shadowing local symbol fail285.main.x
+---
+*/
+
+struct S
+{
+    int x;
+}
+
+void main()
+{
+    int x;
+    S s;
+    with (s)
+    {
+        x++;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail286.d b/gcc/testsuite/gdc.test/fail_compilation/fail286.d
new file mode 100644
index 00000000000..d4183d5ac2e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail286.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail286.d(16): Error: enum member B not represented in final switch
+---
+*/
+
+enum E
+{
+    A,B,C
+}
+
+void main()
+{
+    E e;
+    final switch (e)
+    {
+        case E.A:
+//      case E.B:
+        case E.C:
+            ;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail287.d b/gcc/testsuite/gdc.test/fail_compilation/fail287.d
new file mode 100644
index 00000000000..7ed8f134c97
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail287.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail287.d(14): Error: had 299 cases which is more than 256 cases in case range
+---
+*/
+
+
+void main()
+{
+    int i = 2;
+    switch (i)
+    {
+        case 1: .. case 300:
+            i = 5;
+            break;
+    }
+    if (i != 5)
+        assert(0);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail288.d b/gcc/testsuite/gdc.test/fail_compilation/fail288.d
new file mode 100644
index 00000000000..d6b68c995a4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail288.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail288.d(14): Error: case ranges not allowed in final switch
+---
+*/
+
+void main()
+{
+    enum E { a, b }
+    E i = E.a;
+    final switch (i)
+    {
+        case E.a: .. case E.b:
+            break;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail289.d b/gcc/testsuite/gdc.test/fail_compilation/fail289.d
new file mode 100644
index 00000000000..b1d0882edca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail289.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail289.d(12): Error: cannot cast from function pointer to delegate
+---
+*/
+
+alias void delegate() Dg;
+void fun() {}
+void gun()
+{
+    Dg d = cast(void delegate())&fun;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail290.d b/gcc/testsuite/gdc.test/fail_compilation/fail290.d
new file mode 100644
index 00000000000..fdc699e700d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail290.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail290.d(15): Error: no 'this' to create delegate for foo
+---
+*/
+
+struct Foo
+{
+    void foo(int x) {}
+}
+
+void main()
+{
+    void delegate (int) a = &Foo.foo;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail291.d b/gcc/testsuite/gdc.test/fail_compilation/fail291.d
new file mode 100644
index 00000000000..79ff2b0bdce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail291.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail291.d(9): Error: variable fail291.X cannot be declared to be a function
+---
+*/
+
+auto a() { return 0; }
+typeof(a) X;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail296.d b/gcc/testsuite/gdc.test/fail_compilation/fail296.d
new file mode 100644
index 00000000000..3f1e5d3f679
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail296.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail296.d(10): Error: can only * a pointer, not a 'int'
+---
+*/
+
+// Issue 3117 - dmd crash by *1
+
+void main(){ *1; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail2962.d b/gcc/testsuite/gdc.test/fail_compilation/fail2962.d
new file mode 100644
index 00000000000..06caadce3b1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail2962.d
@@ -0,0 +1,41 @@
+// EXTRA_SOURCES: imports/fail2962a.d
+
+// comment 6
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail2962.d(14): Error: variable y cannot be read at compile time
+fail_compilation/fail2962.d(14):        while looking for match for baz6!(int, y)
+fail_compilation/fail2962.d(22): Error: template instance fail2962.bar6!int error instantiating
+---
+*/
+T bar6(T)(T y)
+{
+    return baz6!(T, y)();
+}
+T baz6(T, T z)()
+{
+    return z * z;
+}
+void test6()
+{
+    assert(bar6(4) != 0);
+}
+
+// comment 4
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail2962.d(36): Error: variable x cannot be read at compile time
+fail_compilation/fail2962.d(36):        while looking for match for baz4!(int, x)
+fail_compilation/imports/fail2962a.d(6): Error: template instance fail2962.bar4!int error instantiating
+---
+*/
+T bar4(T)(T x)
+{
+    return baz4!(T, x)();
+}
+T baz4(T, T x)()
+{
+    return x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail297.d b/gcc/testsuite/gdc.test/fail_compilation/fail297.d
new file mode 100644
index 00000000000..fd2249db2ca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail297.d
@@ -0,0 +1,31 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail297.d(30): Error: incompatible types for ((Bar()) + (baz())): 'Bar' and 'const(Bar)'
+---
+*/
+
+// Issue 1969 - ICE(cod1.c) using undefined operator with one const operand
+
+// 1969  ICE or wrong-code. D2 only. Internal error: backend\cod1.c 1673
+/* Root cause: BinExp::typeCombine() is checking for an _exact_ match, but
+typeMerge() will return success.
+
+PATCH: cast.c BinExp::typeCombine().
+Compare the immutable versions of the types, instead of the types themselves.
+
+    if (op == TOKmin || op == TOKadd)
+    {
+        if (t1->ito == t2->ito && (t1->ty == Tstruct || t1->ty == Tclass))
+            goto Lerror;
+    }
+*/
+
+struct Bar {}
+
+const(Bar) baz() { return Bar(); }
+
+void foo()
+{
+    Bar result = Bar() + baz();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail298.d b/gcc/testsuite/gdc.test/fail_compilation/fail298.d
new file mode 100644
index 00000000000..49220d60aff
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail298.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail298.d(12): Error: cannot implicitly convert expression (num1 / cast(ulong)num2) of type ulong to int
+---
+*/
+
+void main()
+{
+    ulong num1 = 100;
+    int num2 = 10;
+    int result = num1 / num2;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail299.d b/gcc/testsuite/gdc.test/fail_compilation/fail299.d
new file mode 100644
index 00000000000..1bfdd82a4a2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail299.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail299.d(14): Error: more initializers than fields (0) of Foo
+---
+*/
+
+struct Foo {}
+
+void foo (Foo b, void delegate ()) {}
+
+void main ()
+{
+    foo(Foo(1), (){});
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3.d b/gcc/testsuite/gdc.test/fail_compilation/fail3.d
new file mode 100644
index 00000000000..332e561cd0c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3.d
@@ -0,0 +1,43 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail3.d(40): Error: incompatible types for ((a) + (b)): 'vec2' and 'vec2'
+---
+*/
+
+// DMD 0.79 linux: Internal error: ../ztc/cgcod.c 1459
+
+template vector(T)
+{
+    struct vec2
+    {
+        T x, y;
+    }
+
+    vec2 opAdd(vec2 a, vec2 b)
+    {
+        vec2 r;
+        r.x = a.x + b.x;
+        r.y = a.y + b.y;
+        return r;
+    }
+
+    vec2 make2(T x, T y)
+    {
+        vec2 a;
+        a.x = x;
+        a.y = y;
+        return a;
+    }
+}
+
+alias vector!(float).vec2 vec2f;
+
+int main()
+{
+    vec2f a, b;
+    b.x = 3;
+    a = a + b;
+    //printf("%f\n", a.x);
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail301.d b/gcc/testsuite/gdc.test/fail_compilation/fail301.d
new file mode 100644
index 00000000000..b012fc8c0f6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail301.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail301.d(11): Error: need 'this' for 'guard' of type 'int'
+fail_compilation/fail301.d(22): Error: template instance fail301.bug3305!0 error instantiating
+---
+*/
+
+struct bug3305(alias X = 0)
+{
+    auto guard = bug3305b!(0).guard;
+}
+
+struct bug3305b(alias X = 0)
+{
+    bug3305!(X) goo;
+    auto guard = 0;
+}
+
+void test()
+{
+    bug3305!(0) a;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail302.d b/gcc/testsuite/gdc.test/fail_compilation/fail302.d
new file mode 100644
index 00000000000..11054ef78c3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail302.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail302.d(21): Error: cannot implicitly convert expression (1) of type int to Bar
+---
+*/
+
+struct Bar
+{
+    uint num;
+
+    Bar opAssign(uint otherNum)
+    {
+        num = otherNum;
+        return this;
+    }
+}
+
+void main()
+{
+    Bar bar = 1;	// disallow because construction is not assignment
+    auto x = bar.num;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail303.d b/gcc/testsuite/gdc.test/fail_compilation/fail303.d
new file mode 100644
index 00000000000..98223fa3b17
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail303.d
@@ -0,0 +1,26 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail303.d(19): Error: double /= cdouble is undefined. Did you mean double /= cdouble.re ?
+fail_compilation/fail303.d(20): Error: ireal *= ireal is an undefined operation
+fail_compilation/fail303.d(21): Error: ireal *= creal is undefined. Did you mean ireal *= creal.im ?
+fail_compilation/fail303.d(22): Error: ireal %= creal is undefined. Did you mean ireal %= creal.im ?
+fail_compilation/fail303.d(23): Error: ireal += real is undefined (result is complex)
+fail_compilation/fail303.d(24): Error: ireal -= creal is undefined (result is complex)
+fail_compilation/fail303.d(25): Error: double -= idouble is undefined (result is complex)
+---
+*/
+
+
+void main()
+{
+    ireal x = 3.0i;
+    double y = 3;
+    y /= 2.0 + 6i;
+    x *= 7.0i;
+    x *= 3.0i + 2;
+    x %= (2 + 6.0i);
+    x += 2.0;
+    x -= 1 + 4i;
+    y -= 3.0i;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail304.d b/gcc/testsuite/gdc.test/fail_compilation/fail304.d
new file mode 100644
index 00000000000..03eb623bfe6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail304.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail304.d(15): Error: cannot cast expression foo() of type Small to Large because of different sizes
+---
+*/
+
+struct Small { uint x; }
+struct Large { uint x, y, z; }
+Small foo() { return Small(); }
+void main()
+{
+    Large l;
+    Small s;
+    l = cast(Large)foo();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail305.d b/gcc/testsuite/gdc.test/fail_compilation/fail305.d
new file mode 100644
index 00000000000..3c9dc76854c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail305.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail305.d(10): Error: cannot return non-void from void function
+---
+*/
+
+void main()
+{
+    return "a";
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail306.d b/gcc/testsuite/gdc.test/fail_compilation/fail306.d
new file mode 100644
index 00000000000..9f917629eed
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail306.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail306.d(11): Error: cannot perform array operations on void[] arrays
+---
+*/
+
+void bar()
+{
+    void [] x;
+    x[] = -x[];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail307.d b/gcc/testsuite/gdc.test/fail_compilation/fail307.d
new file mode 100644
index 00000000000..ed19223772c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail307.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail307.d(11): Error: cannot implicitly convert expression (cast(int)(cast(double)cast(int)b + 6.1)) of type int to short
+---
+*/
+
+void main()
+{
+    ubyte b = 6;
+    short c5 = cast(int)(b + 6.1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail308.d b/gcc/testsuite/gdc.test/fail_compilation/fail308.d
new file mode 100644
index 00000000000..d283da0e0a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail308.d
@@ -0,0 +1,15 @@
+// REQUIRED_ARGS: -unittest
+
+void main()
+{
+    MinHeap!(int) foo = new MinHeap!(int)();
+}
+
+class MinHeap(NodeType)
+{
+    unittest
+    {
+        struct TestType {}
+        MinHeap!(TestType) foo = new MinHeap!(TestType)();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail309.d b/gcc/testsuite/gdc.test/fail_compilation/fail309.d
new file mode 100644
index 00000000000..e1c9bfab889
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail309.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail309.d(10): Error: circular reference to variable 'fail309.S.x'
+---
+*/
+// REQUIRED_ARGS: -d
+struct S
+{
+    const x = S.x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail310.d b/gcc/testsuite/gdc.test/fail_compilation/fail310.d
new file mode 100644
index 00000000000..72def67d2ae
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail310.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail310.d(10): Error: undefined identifier 'Foo', did you mean function 'foo'?
+fail_compilation/fail310.d(14): Error: template instance fail310.foo!(1, 2) error instantiating
+fail_compilation/fail310.d(14):        while evaluating: static assert(foo!(1, 2)())
+---
+*/
+
+Foo foo(A...)()
+{
+}
+
+static assert(foo!(1, 2)());
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail311.d b/gcc/testsuite/gdc.test/fail_compilation/fail311.d
new file mode 100644
index 00000000000..42280fe1cc2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail311.d
@@ -0,0 +1,26 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail311.d(16): Error: undefined identifier 'undefined'
+fail_compilation/fail311.d(25): Error: template instance fail311.foo!() error instantiating
+---
+*/
+
+template Tuple(T...)
+{
+    alias T Tuple;
+}
+
+void foo()()
+{
+    undefined x;
+    foreach (i; Tuple!(2))
+    {
+        static assert(true);
+    }
+}
+
+void main()
+{
+    foo!()();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail312.d b/gcc/testsuite/gdc.test/fail_compilation/fail312.d
new file mode 100644
index 00000000000..3823ee414c5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail312.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail312.d(13): Error: incompatible types for ((a[]) == (b)): 'int[]' and 'short'
+fail_compilation/fail312.d(14): Error: incompatible types for ((a[]) <= (b)): 'int[]' and 'short'
+---
+*/
+
+void main()
+{
+    int[1] a = 1;
+    short b = 1;
+    assert(a[] == b);
+    assert(a[] <= b);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail313.d b/gcc/testsuite/gdc.test/fail_compilation/fail313.d
new file mode 100644
index 00000000000..6ee7714313e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail313.d
@@ -0,0 +1,32 @@
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/fail313.d(5): Deprecation: module imports.b313 is not accessible here, perhaps add 'static import imports.b313;'
+fail_compilation/fail313.d(12): Deprecation: imports.a313.core is not visible from module test313
+fail_compilation/fail313.d(12): Deprecation: package core.stdc is not accessible here
+fail_compilation/fail313.d(12): Deprecation: module core.stdc.stdio is not accessible here, perhaps add 'static import core.stdc.stdio;'
+fail_compilation/fail313.d(17): Deprecation: package imports.pkg313 is not accessible here, perhaps add 'static import imports.pkg313;'
+---
+*/
+module test313;
+
+#line 1
+import imports.a313;
+
+void test1()
+{
+    imports.b313.bug();
+    import imports.b313;
+    imports.b313.bug();
+}
+
+void test2()
+{
+    core.stdc.stdio.printf("");
+}
+
+void test3()
+{
+    imports.pkg313.bug();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail314.d b/gcc/testsuite/gdc.test/fail_compilation/fail314.d
new file mode 100644
index 00000000000..cfbb0308f23
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail314.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail314.d(11): Error: declaration T is already defined
+---
+*/
+
+struct foo
+{
+    static if (is(int T == int)) {}
+    static if (is(int T == int)) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3144.d b/gcc/testsuite/gdc.test/fail_compilation/fail3144.d
new file mode 100644
index 00000000000..04e808fc72d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3144.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail3144.d(12): Error: break is not inside a loop or switch
+fail_compilation/fail3144.d(15): Error: break is not inside a loop or switch
+---
+*/
+
+void main()
+{
+    switch (1)
+        default: {} break;
+
+    final switch (1)
+        case 1: {} break;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail315.d b/gcc/testsuite/gdc.test/fail_compilation/fail315.d
new file mode 100644
index 00000000000..da9e8851734
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail315.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail315.d-mixin-16(16): Error: found ';' when expecting ','
+fail_compilation/fail315.d-mixin-16(16): Error: expression expected, not '}'
+fail_compilation/fail315.d-mixin-16(16): Error: found 'EOF' when expecting ','
+fail_compilation/fail315.d-mixin-16(16): Error: found 'EOF' when expecting ']'
+fail_compilation/fail315.d-mixin-16(16): Error: found 'EOF' when expecting ';' following return statement
+fail_compilation/fail315.d-mixin-16(16): Error: found 'EOF' when expecting '}' following compound statement
+fail_compilation/fail315.d(21): Error: template instance fail315.foo!() error instantiating
+---
+*/
+
+void foo(S...)(S u)
+{
+    alias typeof(mixin("{ return a[1;}()")) z;
+}
+
+void main()
+{
+    foo!()(0);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3150.d b/gcc/testsuite/gdc.test/fail_compilation/fail3150.d
new file mode 100644
index 00000000000..3382badb193
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3150.d
@@ -0,0 +1,5 @@
+// REQUIRED_ARGS: -de
+
+void main() {
+    ulong u = cast(ulong)[1,2];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail316.d b/gcc/testsuite/gdc.test/fail_compilation/fail316.d
new file mode 100644
index 00000000000..21788d629d3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail316.d
@@ -0,0 +1,17 @@
+template BadImpl(T, alias thename)
+{
+  void a_bad_idea(T t)
+  {
+    thename.a_bad_idea(t);
+  }
+}
+
+class foo
+{
+  mixin BadImpl!(uint,Mix1) Mix1;
+}
+
+int main()
+{
+  return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail317.d b/gcc/testsuite/gdc.test/fail_compilation/fail317.d
new file mode 100644
index 00000000000..05e7edb0598
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail317.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail317.d(10): Error: function fail317.I.f has no function body with return type inference
+---
+*/
+
+interface I
+{
+    auto f()
+    in {}
+    out {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail318.d b/gcc/testsuite/gdc.test/fail_compilation/fail318.d
new file mode 100644
index 00000000000..dd93803eacf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail318.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail318.d(8): Error: function D main must return int or void
+---
+*/
+
+auto main() { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail319.d b/gcc/testsuite/gdc.test/fail_compilation/fail319.d
new file mode 100644
index 00000000000..3c4459a89bd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail319.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail319.d(13): Error: template instance fail319.f!(int, int) does not match template declaration f(T...)() if (T.length > 20)
+---
+*/
+
+void f(T...)() if (T.length > 20)
+{}
+
+void main()
+{
+    f!(int, int)();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail320.d b/gcc/testsuite/gdc.test/fail_compilation/fail320.d
new file mode 100644
index 00000000000..3a80dd55ce3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail320.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail320.d(10): Error: no overload matches for foo
+---
+*/
+
+import imports.fail320a;
+import imports.fail320b;
+void main() { foo(); }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail322.d b/gcc/testsuite/gdc.test/fail_compilation/fail322.d
new file mode 100644
index 00000000000..0ffa15a4875
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail322.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail322.d(10): Error: function fail322.digestToString2 (ref char[16] digest) is not callable using argument types (string)
+---
+*/
+
+void main()
+{
+    digestToString2("1234567890123456");
+}
+
+void digestToString2(ref char[16] digest)
+{
+    assert(digest[0] == 0xc3);
+    assert(digest[15] == 0x3b);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail324.d b/gcc/testsuite/gdc.test/fail_compilation/fail324.d
new file mode 100644
index 00000000000..9963c8b3457
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail324.d
@@ -0,0 +1,17 @@
+/*
+test_output:
+---
+fail_compilation/fail324.d(16): Error: template instance doStuff!((i){ return i; }) cannot use local '__lambda1' as parameter to non-global template doStuff(alias fun)()
+---
+*/
+
+struct Foo
+{
+    void doStuff(alias fun)() {}
+}
+
+void main()
+{
+    Foo foo;
+    foo.doStuff!( (i) { return i; })();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail325.d b/gcc/testsuite/gdc.test/fail_compilation/fail325.d
new file mode 100644
index 00000000000..e75a1c1326c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail325.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail325.d(12): Error: template fun(T = int)(int w, int z) has no type
+---
+*/
+
+void fun(T = int)(int w, int z) {}
+
+void main()
+{
+    auto x = cast(void function(int, int))fun;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail327.d b/gcc/testsuite/gdc.test/fail_compilation/fail327.d
new file mode 100644
index 00000000000..ab872357bac
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail327.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail327.d(10): Error: asm statement is assumed to be @system - mark it with '@trusted' if it is not
+---
+*/
+
+@safe void foo()
+{
+    version(GNU)
+    {
+        version(X86) asm {"xor %%EAX,%%EAX" : : : ;}
+        else version(X86_64) asm {"xor %%EAX,%%EAX" : : : ;}
+        else static assert(false, "ASM code not implemented for this architecture");
+    }
+    else asm { xor EAX,EAX; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail328.d b/gcc/testsuite/gdc.test/fail_compilation/fail328.d
new file mode 100644
index 00000000000..7e9791339ac
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail328.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail328.d(12): Error: @safe function 'fail328.foo' cannot call @system function 'fail328.bar'
+---
+*/
+
+void bar();
+
+@safe void foo()
+{
+    bar();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail329.d b/gcc/testsuite/gdc.test/fail_compilation/fail329.d
new file mode 100644
index 00000000000..f28304e35da
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail329.d
@@ -0,0 +1,63 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail329.d(28): Error: variable fail329.A.foo.__ensure.result cannot modify result 'result' in contract
+---
+*/
+
+//import core.stdc.stdio;
+
+/*******************************************/
+
+class A
+{
+    int x = 7;
+
+    int foo(int i)
+    in
+    {
+        //printf("A.foo.in %d\n", i);
+        assert(i == 2);
+        assert(x == 7);
+        //printf("A.foo.in pass\n");
+    }
+    out (result)
+    {
+        assert(result & 1);
+        assert(x == 7);
+        result++;
+    }
+    body
+    {
+        return i;
+    }
+}
+
+class B : A
+{
+    override int foo(int i)
+    in
+    {
+        float f;
+        //printf("B.foo.in %d\n", i);
+        assert(i == 4);
+        assert(x == 7);
+        f = f + i;
+    }
+    out (result)
+    {
+        assert(result < 8);
+        assert(x == 7);
+    }
+    body
+    {
+        return i - 1;
+    }
+}
+
+void test1()
+{
+    auto b = new B();
+    b.foo(2);
+    b.foo(4);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3290.d b/gcc/testsuite/gdc.test/fail_compilation/fail3290.d
new file mode 100644
index 00000000000..f398fc95a7d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3290.d
@@ -0,0 +1,9 @@
+// 3290
+
+void main()
+{
+    const(int)[] array;
+    foreach (ref int i; array) {
+        //i = 42;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail330.d b/gcc/testsuite/gdc.test/fail_compilation/fail330.d
new file mode 100644
index 00000000000..a3409db5d1a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail330.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail330.d(9): Error: variable fail330.fun.result cannot modify result 'result' in contract
+---
+*/
+
+int fun()
+out(result) { result = 2; }
+body { return 1; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail331.d b/gcc/testsuite/gdc.test/fail_compilation/fail331.d
new file mode 100644
index 00000000000..8b79ea2a2c5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail331.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail331.d(10): Error: cannot use typeof(return) inside function foo with inferred return type
+---
+*/
+
+auto foo()
+{
+    typeof(return) result;
+    return result;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail332.d b/gcc/testsuite/gdc.test/fail_compilation/fail332.d
new file mode 100644
index 00000000000..03f3706d696
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail332.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail332.d(14): Error: function fail332.foo (int _param_0, ...) is not callable using argument types ()
+---
+*/
+
+import core.vararg;
+
+void foo(int, ...) {}
+
+void bar()
+{
+    foo();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail333.d b/gcc/testsuite/gdc.test/fail_compilation/fail333.d
new file mode 100644
index 00000000000..717de24e608
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail333.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail333.d(8): Error: forward reference to 'test'
+---
+*/
+
+void test(typeof(test) p) { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail334.d b/gcc/testsuite/gdc.test/fail_compilation/fail334.d
new file mode 100644
index 00000000000..4cab7d3b56c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail334.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail334.d(10): Error: properties can only have zero, one, or two parameter
+---
+*/
+
+struct S
+{
+    @property int foo(int a, int b, int c) { return 1; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail335.d b/gcc/testsuite/gdc.test/fail_compilation/fail335.d
new file mode 100644
index 00000000000..1800cd065b7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail335.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail335.d(9): Error: cannot overload both property and non-property functions
+---
+*/
+
+void foo();
+@property void foo(int);
+
+void main()
+{
+    foo(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3354.d b/gcc/testsuite/gdc.test/fail_compilation/fail3354.d
new file mode 100644
index 00000000000..bcf6368c421
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3354.d
@@ -0,0 +1,12 @@
+
+void main()
+{
+    version(D_InlineAsm_X86) {}
+    else version(D_InlineAsm_X64) {}
+    else static assert(0);
+
+    asm {
+        fldz ST(0), ST(1), ST(2), ST(3);
+        fld ST(0), ST(1), ST(2), ST(3);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail336.d b/gcc/testsuite/gdc.test/fail_compilation/fail336.d
new file mode 100644
index 00000000000..2a6be957052
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail336.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail336.d(16): Error: struct S has constructors, cannot use { initializers }, use S( initializers ) instead
+---
+*/
+
+// Issue 3476 - C-style initializer for structs must be disallowed for structs with a constructor
+
+struct S
+{
+    int a;
+    this(int) {}
+}
+
+S s = { 1 };
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail337.d b/gcc/testsuite/gdc.test/fail_compilation/fail337.d
new file mode 100644
index 00000000000..ea7bcdd73aa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail337.d
@@ -0,0 +1,42 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail337.d(13): Error: static assert  (0) is false
+fail_compilation/fail337.d(26):        instantiated from here: bar!()
+fail_compilation/fail337.d(33):        100 recursive instantiations from here: foo!196
+fail_compilation/fail337.d(41):        253 recursive instantiations from here: baz!300
+---
+*/
+
+template bar()
+{
+    static assert(0);
+}
+
+template foo(int N)
+{
+    static if (N > 0)
+    {
+        static if (N & 1)
+            alias foo!(N - 3) foo;
+        else
+            alias foo!(N - 1) foo;
+    }
+    else
+        alias bar!() foo;
+}
+
+template baz(int M)
+{
+    static if (M < 50)
+    {
+        alias foo!(M * 4) baz;
+    }
+    else
+        alias baz!(M - 1) baz;
+}
+
+void main()
+{
+    int x = baz!(300);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail34.d b/gcc/testsuite/gdc.test/fail_compilation/fail34.d
new file mode 100644
index 00000000000..f84be7a6f95
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail34.d
@@ -0,0 +1,42 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail34.d(31): Error: duplicate case "123" in switch statement
+---
+*/
+
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Thomas Kuehne <thomas-dloop@kuehne.thisisspam.cn>
+// @date@	2004-11-17
+// @uri@	news:u1gr62-kjv.ln1@kuehne.cn
+// @url@	nntp://digitalmars.com/digitalmars.D.bugs/2288
+
+// duplicate case "123" in switch statement
+
+module switch_12;
+
+int main()
+{
+    string array = "123";
+    switch(array)
+    {
+        case "123":
+        {
+            assert(0);
+            break;
+        }
+        case "123":
+        {
+            assert(1);
+            break;
+        }
+        default:
+        {
+            return -1; // dummy
+        }
+    }
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail340.d b/gcc/testsuite/gdc.test/fail_compilation/fail340.d
new file mode 100644
index 00000000000..03eab14322f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail340.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail340.d(18): Error: variable fail340.w of type struct const(CopyTest) uses this(this), which is not allowed in static initialization
+fail_compilation/fail340.d(19):        while evaluating: static assert(w.x == 55.0000)
+---
+*/
+
+struct CopyTest
+{
+    double x;
+    this(double a) { x = a * 10.0;}
+    this(this) { x += 2.0; }
+}
+
+const CopyTest z = CopyTest(5.3);
+
+const CopyTest w = z;
+static assert(w.x == 55.0);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail341.d b/gcc/testsuite/gdc.test/fail_compilation/fail341.d
new file mode 100644
index 00000000000..af78e8145b9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail341.d
@@ -0,0 +1,28 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail341.d(26): Error: struct fail341.S is not copyable because it is annotated with @disable
+fail_compilation/fail341.d(27): Error: function fail341.foo is not callable because it is annotated with @disable
+---
+*/
+
+struct T
+{
+    @disable this(this)
+    {
+    }
+}
+
+struct S
+{
+    T t;
+}
+
+@disable void foo() { }
+
+void main()
+{
+    S s;
+    auto t = s;
+    foo();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail343.d b/gcc/testsuite/gdc.test/fail_compilation/fail343.d
new file mode 100644
index 00000000000..2b354cfdd7b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail343.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+0500-classes.tex(2484): Error: function fail343.TimedApp.run cannot override final function I.fail343.Timer.run
+0500-classes.tex(2484): Error: function fail343.TimedApp.run cannot override final function Application.fail343.Application.run
+---
+*/
+
+#line 2471 "0500-classes.tex"
+interface Timer
+{
+   final void run() { }
+}
+
+interface I : Timer { }
+interface Application
+{
+   final void run() { }
+}
+class TimedApp : I, Application
+{
+   // cannot define run()
+   void run() { }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail344.d b/gcc/testsuite/gdc.test/fail_compilation/fail344.d
new file mode 100644
index 00000000000..9173740abf2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail344.d
@@ -0,0 +1,17 @@
+// 3737
+
+int crayon;
+
+struct SIB(alias junk)
+{
+    template Alike(V) {
+        enum bool Alike = Q == V.garbage;
+    }
+    void opDispatch(string s)() {
+        static assert(Alike!(SIB!(crayon)));
+    }
+}
+
+void main() {
+      SIB!(SIB!(crayon).E)(3.0);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail346.d b/gcc/testsuite/gdc.test/fail_compilation/fail346.d
new file mode 100644
index 00000000000..532f0bfd213
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail346.d
@@ -0,0 +1,15 @@
+
+struct S {
+    int x;
+
+    template T(int val) {
+        const P T = { val }; // the P here is an error it should be S
+    }
+}
+
+template V(R,int val){
+    const R V=R.T!(val);
+}
+
+const S x = V!(S,0);
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail347.d b/gcc/testsuite/gdc.test/fail_compilation/fail347.d
new file mode 100644
index 00000000000..a9ddcba376d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail347.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail347.d(21): Error: undefined identifier 'bbr', did you mean variable 'bar'?
+fail_compilation/fail347.d(22): Error: no property 'ofo' for type 'S', did you mean 'foo'?
+fail_compilation/fail347.d(23): Error: undefined identifier 'strlenx', did you mean function 'strlen'?
+---
+*/
+
+//import core.stdc.string;
+import imports.fail347a;
+
+struct S
+{
+    int foo;
+}
+
+void main()
+{
+    S bar;
+    bbr.foo = 3;
+    bar.ofo = 4;
+    auto s = strlenx("hello");
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail349.d b/gcc/testsuite/gdc.test/fail_compilation/fail349.d
new file mode 100644
index 00000000000..1dac6b52cbd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail349.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail349.d(15): Error: function 'fail349.bug6109throwing' is not nothrow
+fail_compilation/fail349.d(13): Error: nothrow function 'fail349.bug6109noThrow' may throw
+---
+*/
+
+int bug6109throwing()
+{
+    throw new Exception("throws");
+}
+int bug6109noThrow() nothrow
+{
+    auto g = [4][0 .. bug6109throwing()];
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail35.d b/gcc/testsuite/gdc.test/fail_compilation/fail35.d
new file mode 100644
index 00000000000..c56f2781d4c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail35.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail35.d(15): Error: variable t cannot be read at compile time
+---
+*/
+
+// http://www.digitalmars.com/d/archives/digitalmars/D/bugs/2372.html
+// allegedly crashes, but cannot reproduce
+
+void main()
+{
+    for (int t = 0; t < 33; t++)
+    {
+        size_t n = (bool[t]).sizeof;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail351.d b/gcc/testsuite/gdc.test/fail_compilation/fail351.d
new file mode 100644
index 00000000000..04f21b2e9be
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail351.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail351.d(14): Error: cast(uint)this.num[index] is not an lvalue
+---
+*/
+
+// 2780
+
+struct Immutable {
+    immutable uint[2] num;
+
+    ref uint opIndex(size_t index) immutable {
+        return num[index];
+    }
+}
+
+void main() {
+    immutable Immutable foo;
+    //foo[0]++;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail352.d b/gcc/testsuite/gdc.test/fail_compilation/fail352.d
new file mode 100644
index 00000000000..757dd5e282c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail352.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail352.d(18): Error: cannot infer argument types, expected 1 argument, not 2
+---
+*/
+
+struct Range
+{
+    bool empty;
+    int front() { return 0; }
+    void popFront() { empty = true; }
+}
+
+void main()
+{
+    // no index for range foreach
+    foreach(i, v; Range()) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail353.d b/gcc/testsuite/gdc.test/fail_compilation/fail353.d
new file mode 100644
index 00000000000..56cda779d9f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail353.d
@@ -0,0 +1,42 @@
+/*
+TEST_OUTPUT:
+---
+block displacement of -130 exceeds the maximum offset of -128 to 127.
+---
+*/
+
+void foo()
+{
+    enum NOP = 0x9090_9090_9090_9090;
+
+    version(GNU)
+    {
+        version(X86) asm {
+            "L1:"
+            "dq %0,%0,%0,%0;"
+            "dq %0,%0,%0,%0;"
+            "dq %0,%0,%0,%0;"
+            "dq %0,%0,%0,%0;"
+            "loop L1;" : "n" (NOP) : : ;
+        }
+        else version(X86_64) asm {
+            "L1:"
+            "dq %0,%0,%0,%0;"
+            "dq %0,%0,%0,%0;"
+            "dq %0,%0,%0,%0;"
+            "dq %0,%0,%0,%0;"
+            "loop L1;" : "n" (NOP) : : ;
+        }
+        else static assert(false, "ASM code not implemented for this architecture");
+    }
+    else asm
+    {
+    L1:
+        dq NOP,NOP,NOP,NOP;    //  32
+        dq NOP,NOP,NOP,NOP;    //  64
+        dq NOP,NOP,NOP,NOP;    //  96
+        dq NOP,NOP,NOP,NOP;    // 128
+        // unnoticed signed underflow of rel8 with DMD2.056
+        loop L1;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail354.d b/gcc/testsuite/gdc.test/fail_compilation/fail354.d
new file mode 100644
index 00000000000..55dbf52953b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail354.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail354.d(11): Error: template instance T!N template 'T' is not defined
+fail_compilation/fail354.d(13): Error: template instance fail354.S!1 error instantiating
+---
+*/
+
+struct S(int N)
+{
+    this(T!N) { }
+}
+alias S!1 M; 
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail355.d b/gcc/testsuite/gdc.test/fail_compilation/fail355.d
new file mode 100644
index 00000000000..d342d12df0f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail355.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail355.d(8): Error: module imports.fail355 import 'nonexistent' not found
+---
+*/
+
+import imports.fail355 : nonexistent;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail356a.d b/gcc/testsuite/gdc.test/fail_compilation/fail356a.d
new file mode 100644
index 00000000000..4981f72a9a6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail356a.d
@@ -0,0 +1,2 @@
+import imports.fail356;
+int imports; // collides with package name
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail356b.d b/gcc/testsuite/gdc.test/fail_compilation/fail356b.d
new file mode 100644
index 00000000000..18f60858b4b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail356b.d
@@ -0,0 +1,2 @@
+import imports.fail356 : bar;
+int bar; // collides with selective import
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail356c.d b/gcc/testsuite/gdc.test/fail_compilation/fail356c.d
new file mode 100644
index 00000000000..ab12c904085
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail356c.d
@@ -0,0 +1,2 @@
+import foo = imports.fail356;
+int foo; // collides with renamed import
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3581a.d b/gcc/testsuite/gdc.test/fail_compilation/fail3581a.d
new file mode 100644
index 00000000000..5c448668167
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3581a.d
@@ -0,0 +1,5 @@
+
+class A { void f() {} }
+class B : A { static override void f() {}; }
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3581b.d b/gcc/testsuite/gdc.test/fail_compilation/fail3581b.d
new file mode 100644
index 00000000000..38be3225dcc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3581b.d
@@ -0,0 +1,5 @@
+
+class A { void f() {} }
+class B : A { private override void f() {}; }
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail359.d b/gcc/testsuite/gdc.test/fail_compilation/fail359.d
new file mode 100644
index 00000000000..aae36c894d7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail359.d
@@ -0,0 +1,3 @@
+#line 5 _BOOM
+void main() { }
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail36.d b/gcc/testsuite/gdc.test/fail_compilation/fail36.d
new file mode 100644
index 00000000000..47fb88477ea
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail36.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail36.d(13): Error: template t(int L) does not have property 'a'
+fail_compilation/fail36.d(18): Error: mixin fail36.func.t!10 error instantiating
+---
+*/
+
+template t(int L)
+{
+    int a;
+    // void foo(int b = t!(L).a) {} // correct
+    void foo(int b = t.a) {} // wrong
+}
+
+void func()
+{
+    mixin t!(10);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3672.d b/gcc/testsuite/gdc.test/fail_compilation/fail3672.d
new file mode 100644
index 00000000000..1622bd212e1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3672.d
@@ -0,0 +1,38 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail3672.d(28): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(*p, 1) instead.
+fail_compilation/fail3672.d(32): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(*sfp, 1) instead.
+fail_compilation/fail3672.d(32): Error: '*sfp += 1' is not a scalar, it is a shared(SF)
+---
+*/
+
+struct SF  // should fail
+{
+    void opOpAssign(string op, T)(T rhs)
+    {
+    }
+}
+
+struct SK  // ok
+{
+    void opOpAssign(string op, T)(T rhs) shared
+    {
+    }
+}
+
+void main()
+{
+    shared int x;
+    auto p = &x;
+    *p += 1;  // fail
+
+    shared SF sf;
+    auto sfp = &sf;
+    *sfp += 1;  // fail
+
+    shared SK sk;
+    auto skp = &sk;
+    sk += 1;  // ok
+    *skp += 1;  // ok
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3673a.d b/gcc/testsuite/gdc.test/fail_compilation/fail3673a.d
new file mode 100644
index 00000000000..92c23f01309
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3673a.d
@@ -0,0 +1,2 @@
+class A {}
+class B : A if(false) { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3673b.d b/gcc/testsuite/gdc.test/fail_compilation/fail3673b.d
new file mode 100644
index 00000000000..264b4aed35b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3673b.d
@@ -0,0 +1,2 @@
+class A {}
+class B : if(false) A { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3703.d b/gcc/testsuite/gdc.test/fail_compilation/fail3703.d
new file mode 100644
index 00000000000..0b4e260dccd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3703.d
@@ -0,0 +1,27 @@
+// Issue 3703 - static array assignment
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail3703.d(18): Error: mismatched array lengths, 2 and 1
+fail_compilation/fail3703.d(20): Error: mismatched array lengths, 2 and 1
+fail_compilation/fail3703.d(22): Error: mismatched array lengths, 3 and 2
+fail_compilation/fail3703.d(23): Error: mismatched array lengths, 2 and 3
+fail_compilation/fail3703.d(25): Error: mismatched array lengths, 3 and 2
+fail_compilation/fail3703.d(26): Error: mismatched array lengths, 2 and 3
+---
+*/
+
+void main()
+{
+    int[1] a = [1];
+    int[2] b = a;   // should make compile error
+
+    b = a;  // should make compile error
+
+    int[3] sa3 = [1,2][];
+    int[2] sa2 = sa3[][];
+
+    sa3 = [1,2][];
+    sa2 = sa3[][];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3731.d b/gcc/testsuite/gdc.test/fail_compilation/fail3731.d
new file mode 100644
index 00000000000..377fd4919d3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3731.d
@@ -0,0 +1,8 @@
+
+void main()
+{
+    class C {}
+    class D : C {}
+    auto x = new immutable(D);
+    C y = x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail37_m32.d b/gcc/testsuite/gdc.test/fail_compilation/fail37_m32.d
new file mode 100644
index 00000000000..996f98fcdf7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail37_m32.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -m32
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail37_m32.d(9): Error: 'cast(float)4u / cast(float)8u - cast(float)2147483647' is not of integral type, it is a float
+---
+*/
+
+ulong[cast(uint)((cast(float)int.sizeof/ulong.sizeof)-int.max>>2)+int.max>>2] hexarray;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail37_m64.d b/gcc/testsuite/gdc.test/fail_compilation/fail37_m64.d
new file mode 100644
index 00000000000..2e979e78c67
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail37_m64.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -m64
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail37_m64.d(9): Error: 'cast(float)4LU / cast(float)8LU - cast(float)2147483647' is not of integral type, it is a float
+---
+*/
+
+ulong[cast(uint)((cast(float)int.sizeof/ulong.sizeof)-int.max>>2)+int.max>>2] hexarray;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail38.d b/gcc/testsuite/gdc.test/fail_compilation/fail38.d
new file mode 100644
index 00000000000..0f2cd5f3570
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail38.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail38.d(12): Error: 'super' is only allowed in non-static class member functions
+---
+*/
+
+int x;
+
+void test()
+{
+    super.x = 2;
+}
+
+int main()
+{
+    test();
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3882.d b/gcc/testsuite/gdc.test/fail_compilation/fail3882.d
new file mode 100644
index 00000000000..b7d8a9789a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3882.d
@@ -0,0 +1,48 @@
+// REQUIRED_ARGS: -w
+// PERMUTE_ARGS: -debug
+
+/******************************************/
+// 3882
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail3882.d(23): Warning: calling fail3882.strictlyPure!int.strictlyPure without side effects discards return value of type int, prepend a cast(void) if intentional
+fail_compilation/fail3882.d(27): Warning: calling fp without side effects discards return value of type int, prepend a cast(void) if intentional
+---
+*/
+
+@safe pure nothrow T strictlyPure(T)(T x)
+{
+    return x*x;
+}
+
+void main()
+{
+    int x = 3;
+    strictlyPure(x);
+
+    // 12649
+    auto fp = &strictlyPure!int;
+    fp(x);
+}
+
+/******************************************/
+// bugfix in TypeFunction::purityLevel
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail3882.d(46): Warning: calling fail3882.f1 without side effects discards return value of type int, prepend a cast(void) if intentional
+fail_compilation/fail3882.d(47): Warning: calling fail3882.f2 without side effects discards return value of type int, prepend a cast(void) if intentional
+---
+*/
+
+nothrow pure int f1(immutable(int)[] a) { return 0; }
+nothrow pure int f2(immutable(int)*  p) { return 0; }
+
+void test_bug()
+{
+    f1([]);
+    f2(null);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3895.d b/gcc/testsuite/gdc.test/fail_compilation/fail3895.d
new file mode 100644
index 00000000000..9921f2a6b36
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3895.d
@@ -0,0 +1,9 @@
+import std.stdio;
+
+void main() {
+    double[] stuff = [1.,2.,3.,4.,5.];
+    float[] otherStuff;
+    otherStuff ~= stuff;
+    writeln(otherStuff);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail39.d b/gcc/testsuite/gdc.test/fail_compilation/fail39.d
new file mode 100644
index 00000000000..65472cf614e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail39.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail39.d(11): Error: function fail39.main.__funcliteral2 cannot access frame of function D main
+---
+*/
+
+void main()
+{
+    void foo() {}
+    void function() bar = function void() { foo(); };
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3990.d b/gcc/testsuite/gdc.test/fail_compilation/fail3990.d
new file mode 100644
index 00000000000..6d17a7dea0e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail3990.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail3990.d(12): Error: using * on an array is no longer supported; use *(arr1).ptr instead
+fail_compilation/fail3990.d(14): Error: using * on an array is no longer supported; use *(arr2).ptr instead
+---
+*/
+
+void main()
+{
+    int[] arr1 = [1, 2, 3];
+    assert(*arr1 == 1);
+    int[3] arr2 = [1, 2, 3];
+    assert(*arr2 == 1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail40.d b/gcc/testsuite/gdc.test/fail_compilation/fail40.d
new file mode 100644
index 00000000000..aa15db319b1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail40.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail40.d(11): Error: variable yuiop cannot be read at compile time
+---
+*/
+
+struct Qwert
+{
+    int[20] yuiop;
+    int* asdfg = yuiop.ptr;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4082.d b/gcc/testsuite/gdc.test/fail_compilation/fail4082.d
new file mode 100644
index 00000000000..93e4ae778e0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4082.d
@@ -0,0 +1,34 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail4082.d(14): Error: destructor 'fail4082.Foo.~this' is not nothrow
+fail_compilation/fail4082.d(12): Error: nothrow function 'fail4082.test1' may throw
+---
+*/
+struct Foo
+{
+    ~this() { throw new Exception(""); }
+}
+nothrow void test1()
+{
+    Foo f;
+
+    goto NEXT;
+NEXT:
+    ;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail4082.d(32): Error: destructor 'fail4082.Bar.~this' is not nothrow
+fail_compilation/fail4082.d(32): Error: nothrow function 'fail4082.test2' may throw
+---
+*/
+struct Bar
+{
+    ~this() { throw new Exception(""); }
+}
+nothrow void test2(Bar t)
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail41.d b/gcc/testsuite/gdc.test/fail_compilation/fail41.d
new file mode 100644
index 00000000000..fa0e0c3cdcf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail41.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail41.d(17): Error: cannot return non-void from void function
+---
+*/
+
+class MyClass
+{
+}
+
+MyClass[char[]] myarray;
+
+void fn()
+{
+    foreach (MyClass mc; myarray)
+        return mc;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail42.d b/gcc/testsuite/gdc.test/fail_compilation/fail42.d
new file mode 100644
index 00000000000..5ec61831c29
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail42.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail42.d(20): Error: struct fail42.Qwert no size yet for forward reference
+---
+*/
+
+/+
+struct Qwert
+{
+    Qwert asdfg;
+}
++/
+
+struct Qwert
+{
+    Yuiop asdfg;
+}
+
+struct Yuiop
+{
+    Qwert hjkl;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4206.d b/gcc/testsuite/gdc.test/fail_compilation/fail4206.d
new file mode 100644
index 00000000000..409158a400a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4206.d
@@ -0,0 +1,5 @@
+
+struct s {}
+enum var = s;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269a.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269a.d
new file mode 100644
index 00000000000..7794c462cc0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269a.d
@@ -0,0 +1,7 @@
+enum bool WWW = is(typeof(A.x));
+
+interface A {
+    B blah;
+    void foo(B b){} 
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269b.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269b.d
new file mode 100644
index 00000000000..2234cb846a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269b.d
@@ -0,0 +1,7 @@
+enum bool WWW = is(typeof(A.x));
+
+struct A {
+    B blah;
+    void foo(B b){} 
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269c.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269c.d
new file mode 100644
index 00000000000..b00ec1be963
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269c.d
@@ -0,0 +1,7 @@
+enum bool WWW = is(typeof(A.x));
+
+class A {
+    B blah;
+    void foo(B b){} 
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269d.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269d.d
new file mode 100644
index 00000000000..b9d2afc7bee
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269d.d
@@ -0,0 +1,5 @@
+
+static if(is(typeof(X6.init))) {}
+alias Y X6;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269e.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269e.d
new file mode 100644
index 00000000000..d7b2f23308b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269e.d
@@ -0,0 +1,5 @@
+
+static if(is(typeof(X5.init))) {}
+typedef Y X5;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269f.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269f.d
new file mode 100644
index 00000000000..4033447426b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269f.d
@@ -0,0 +1,5 @@
+
+static if(is(typeof(X16))) {}
+alias X16 X16;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4269g.d b/gcc/testsuite/gdc.test/fail_compilation/fail4269g.d
new file mode 100644
index 00000000000..9241e481de4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4269g.d
@@ -0,0 +1,6 @@
+
+int[2] d;
+static if(is(typeof(Xg.init))) {}
+alias d[1] Xg;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4374.d b/gcc/testsuite/gdc.test/fail_compilation/fail4374.d
new file mode 100644
index 00000000000..fa17a1636df
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4374.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail4374.d(11): Error: terminating ';' required after do-while statement
+---
+*/
+
+void main()
+{
+    do {} while(0)
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375a.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375a.d
new file mode 100644
index 00000000000..030b4858b7e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375a.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+	if (true)
+		if (false)
+			assert(3);
+    else
+        assert(4);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375b.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375b.d
new file mode 100644
index 00000000000..6ac5b71b0a7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375b.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    // disallowed
+	if (true)
+		foreach (i; 0 .. 5)
+			if (true)
+				assert(5);
+    else
+        assert(6);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375c.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375c.d
new file mode 100644
index 00000000000..697c99f0fc8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375c.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    if (true)
+        if (false) {
+            assert(6.1);
+        }
+    else {
+        assert(6.2);
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375d.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375d.d
new file mode 100644
index 00000000000..329907eec40
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375d.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    if (true)
+label2:
+        if (true)
+            assert(15);
+    else 
+        assert(16);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375e.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375e.d
new file mode 100644
index 00000000000..14b96d72a7f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375e.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    version (A)
+        if (true)
+            assert(24);
+    else
+        assert(25);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375f.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375f.d
new file mode 100644
index 00000000000..c715ee6c7fc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375f.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    version (A)
+        version (B)
+            assert(25.1);
+    else
+        assert(25.2);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375g.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375g.d
new file mode 100644
index 00000000000..f555651c4c8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375g.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    static if (true)
+        static if (true)
+            assert(33);
+    else
+        assert(34);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375h.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375h.d
new file mode 100644
index 00000000000..793e42ba93b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375h.d
@@ -0,0 +1,15 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    switch (4) {
+        default:
+            if (true)   // disallowed
+                if (false)
+                    assert(48);
+            else
+                assert(49);
+            break;
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375i.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375i.d
new file mode 100644
index 00000000000..da3e67c93d1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375i.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    if (true)
+        switch (1)  // o_O
+            default:
+                if (false)
+                    assert(115);
+    else
+        assert(116);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375j.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375j.d
new file mode 100644
index 00000000000..cd289a08fe3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375j.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    if (true)
+        final switch (1)    // o_O
+            case 1:
+                if (false)
+                    assert(119);
+    else
+        assert(120);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375k.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375k.d
new file mode 100644
index 00000000000..f372406d4a8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375k.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    mixin(q{
+        if(true)
+            if(true)
+                assert(54);
+        else
+            assert(55);
+    });
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375l.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375l.d
new file mode 100644
index 00000000000..fea1d82d0ef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375l.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    if (true)
+        while (false)
+            if (true)
+                assert(70);
+    else
+        assert(71);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375m.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375m.d
new file mode 100644
index 00000000000..fdde1a11b3d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375m.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    do
+        if (true)
+            if (true)
+                assert(76);
+        else
+            assert(77);
+    while (false);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375o.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375o.d
new file mode 100644
index 00000000000..6c3d3e15e4e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375o.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    if (true)
+        for (; false;)
+            if (true)
+                assert(82);
+    else
+        assert(83);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375p.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375p.d
new file mode 100644
index 00000000000..82f7cabd28b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375p.d
@@ -0,0 +1,15 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    if (true)
+        while (false)
+            for (;;)
+                scope (exit)
+                    synchronized (x)
+                        if (true)
+                            assert(90);
+    else
+        assert(89);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375q.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375q.d
new file mode 100644
index 00000000000..7d11c46f347
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375q.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    auto x = 1;
+    if (true)
+        with (x)
+            if (false)
+                assert(90);
+    else
+        assert(91);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375r.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375r.d
new file mode 100644
index 00000000000..49b2f8a8a3c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375r.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    if (true)
+        try
+            assert(103);
+        finally
+            if (true)
+                assert(104);
+    else
+        assert(105);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375s.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375s.d
new file mode 100644
index 00000000000..ed1b7256906
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375s.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+void main() {
+    if (true)
+        try
+            assert(106);
+        catch(Exception e)
+            if (true)
+                assert(107);
+    else
+        assert(108);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375t.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375t.d
new file mode 100644
index 00000000000..197563654f3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375t.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -w -unittest
+// 4375: Dangling else
+
+unittest {  // disallowed
+    if (true)
+        if (false)
+            assert(52);
+    else
+        assert(53);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375u.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375u.d
new file mode 100644
index 00000000000..cb06823a028
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375u.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+static if (true)
+    static if (false)
+        struct G1 {}
+else
+    struct G2 {}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375v.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375v.d
new file mode 100644
index 00000000000..1510c8dc935
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375v.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+version (A)
+    version (B)
+        struct G3 {}
+else
+    struct G4 {}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375w.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375w.d
new file mode 100644
index 00000000000..cd3c3bdf245
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375w.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+static if (true)
+    version (B)
+        struct G1 {}
+else
+    struct G2 {}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375x.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375x.d
new file mode 100644
index 00000000000..b6ae64fd187
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375x.d
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+static if (true)
+abstract:
+    static if (false)
+        class G5 {}
+else
+    class G6 {}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4375y.d b/gcc/testsuite/gdc.test/fail_compilation/fail4375y.d
new file mode 100644
index 00000000000..b3713e38f12
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4375y.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -w
+// 4375: Dangling else
+
+static if (true)
+    align(1)
+        extern(C)
+            pure
+                static if (false)
+                    void G10(){}
+else
+    void G11(){}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail44.d b/gcc/testsuite/gdc.test/fail_compilation/fail44.d
new file mode 100644
index 00000000000..b8916a00991
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail44.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail44.d(18): Error: expression bar[i] is void and has no value
+---
+*/
+
+void Foo()
+{
+  void[] bar;
+  void[] foo;
+
+  bar.length = 50;
+  foo.length = 50;
+
+  for(size_t i=0; i<50; i++)
+  {
+    foo[i] = bar[i];
+  }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4421.d b/gcc/testsuite/gdc.test/fail_compilation/fail4421.d
new file mode 100644
index 00000000000..e38cfabb46f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4421.d
@@ -0,0 +1,40 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail4421.d(16): Error: function fail4421.U1.__postblit destructors, postblits and invariants are not allowed in union U1
+fail_compilation/fail4421.d(17): Error: destructor fail4421.U1.~this destructors, postblits and invariants are not allowed in union U1
+fail_compilation/fail4421.d(18): Error: function fail4421.U1.__invariant1 destructors, postblits and invariants are not allowed in union U1
+---
+*/
+
+
+
+
+
+union U1
+{
+    this(this);
+    ~this();
+    invariant() { }
+}
+
+struct S1
+{
+    this(this);
+    ~this();
+    invariant() { }
+}
+
+union U2
+{
+    S1 s1;
+}
+
+struct S2
+{
+    union
+    {
+        S1 s1;
+        int j;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4448.d b/gcc/testsuite/gdc.test/fail_compilation/fail4448.d
new file mode 100644
index 00000000000..923f0b291a3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4448.d
@@ -0,0 +1,26 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail4448.d(19): Error: label 'L1' has no break
+fail_compilation/fail4448.d(26):        called from here: bug4448()
+fail_compilation/fail4448.d(26):        while evaluating: static assert(bug4448() == 3)
+---
+*/
+
+int bug4448()
+{
+    int n=2;
+    L1:{ switch(n)
+    {
+       case 5:
+        return 7;
+       default:
+       n = 5;
+       break L1;
+    }
+    int w = 7;
+    }
+    return 3;
+}
+
+static assert(bug4448()==3);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail45.d b/gcc/testsuite/gdc.test/fail_compilation/fail45.d
new file mode 100644
index 00000000000..3380fe4fd5d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail45.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail45.d(10): Error: variable fail45.main.O cannot be declared to be a function
+---
+*/
+
+void main()
+{
+    typeof(main) O = 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4510.d b/gcc/testsuite/gdc.test/fail_compilation/fail4510.d
new file mode 100644
index 00000000000..d10100070e1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4510.d
@@ -0,0 +1,9 @@
+// 4510
+
+void main()
+{
+    float[] arr = [1.0, 2.5, 4.0];
+    foreach (ref double elem; arr) {
+        //elem /= 2;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4511.d b/gcc/testsuite/gdc.test/fail_compilation/fail4511.d
new file mode 100644
index 00000000000..f4d8a1c73e1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4511.d
@@ -0,0 +1,16 @@
+void test72()
+{
+    class A {}
+    class B : A {}
+
+    class X
+    {
+        abstract A func();
+    }
+    class Y : X
+    {
+        B func() { return new A(); }
+    }
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4517.d b/gcc/testsuite/gdc.test/fail_compilation/fail4517.d
new file mode 100644
index 00000000000..a55b0f5f927
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4517.d
@@ -0,0 +1,15 @@
+
+enum E : ushort
+{
+    A, B
+}
+
+void main()
+{
+    E e;
+    final switch(e)
+    {
+        case E.A:
+            break;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail46.d b/gcc/testsuite/gdc.test/fail_compilation/fail46.d
new file mode 100644
index 00000000000..a62d1631678
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail46.d
@@ -0,0 +1,21 @@
+// PERMUTE_ARGS: -inline
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail46.d(19): Error: need 'this' for 'bug' of type 'int()'
+---
+*/
+
+struct MyStruct
+{
+    int bug()
+    {
+        return 3;
+    }
+}
+
+int main()
+{
+    assert(MyStruct.bug() == 3);
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4611.d b/gcc/testsuite/gdc.test/fail_compilation/fail4611.d
new file mode 100644
index 00000000000..f1547ba12c5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4611.d
@@ -0,0 +1,15 @@
+/*
+---
+fail_compilation/fail4611.d(15): Error: Vec[2147483647] size 4 * 2147483647 exceeds 0x7fffffff size limit for static array
+---
+*/
+
+struct Vec
+{
+    int x;
+}
+
+void main()
+{
+    Vec[ptrdiff_t.max] a;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail47.d b/gcc/testsuite/gdc.test/fail_compilation/fail47.d
new file mode 100644
index 00000000000..d320fdafc8b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail47.d
@@ -0,0 +1,9 @@
+void foo() {}
+int _foo;
+alias _foo foo;
+
+void main()
+{
+    foo = 1;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4958.d b/gcc/testsuite/gdc.test/fail_compilation/fail4958.d
new file mode 100644
index 00000000000..b72347662e1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4958.d
@@ -0,0 +1,2 @@
+
+enum FloatEnum : float { A = float.max/2, B, C }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail50.d b/gcc/testsuite/gdc.test/fail_compilation/fail50.d
new file mode 100644
index 00000000000..9cd29833877
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail50.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail50.d(12): Error: need 'this' for address of a
+fail_compilation/fail50.d(12): Error: variable a cannot be read at compile time
+---
+*/
+
+struct Marko
+{
+    int a;
+    int* m = &a;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail51.d b/gcc/testsuite/gdc.test/fail_compilation/fail51.d
new file mode 100644
index 00000000000..41a27ca7a22
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail51.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail51.d(11): Error: interface fail51.B circular inheritance of interface
+---
+*/
+
+// interface A { void f(); }
+
+interface A : B { void f(); }
+interface B : A { void g(); }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail52.d b/gcc/testsuite/gdc.test/fail_compilation/fail52.d
new file mode 100644
index 00000000000..9b662de1348
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail52.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail52.d(10): Error: class fail52.C circular inheritance
+---
+*/
+
+class A : B { void f(); }
+class B : C { override void g(); }
+class C : A { void g(); }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5299.d b/gcc/testsuite/gdc.test/fail_compilation/fail5299.d
new file mode 100644
index 00000000000..d5e8752f2fd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail5299.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail5299.d(12): Error: use of base class protection is no longer supported
+---
+*/
+
+class A
+{
+}
+
+class B : private A
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail53.d b/gcc/testsuite/gdc.test/fail_compilation/fail53.d
new file mode 100644
index 00000000000..2570dd8939c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail53.d
@@ -0,0 +1,30 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail53.d(25): Error: function object.Object.opEquals (Object o) is not callable using argument types (int)
+---
+*/
+
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Thomas Kuehne <thomas-dloop@kuehne.thisisspam.cn>
+// @date@	2005-01-22
+// @uri@	news:csvvet$2g4$1@digitaldaemon.com
+// @url@	nntp://news.digitalmars.com/digitalmars.D.bugs/2741
+
+// __DSTRESS_ELINE__ 17
+
+module dstress.nocompile.bug_mtype_507_A;
+
+int main()
+{
+    Object o;
+    int i;
+    if (i == o)
+    {
+        return -1;
+    }
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail54.d b/gcc/testsuite/gdc.test/fail_compilation/fail54.d
new file mode 100644
index 00000000000..aa95b1d15d6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail54.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail54.d(22): Error: incompatible types for ((0) == (Exception)): cannot use '==' with types
+---
+*/
+
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	zwang <nehzgnaw@gmail.com>
+// @date@	2005-02-03
+// @uri@	news:ctthp6$25b$1@digitaldaemon.com
+
+// __DSTRESS_ELINE__ 14
+
+module dstress.nocompile.bug_mtype_507_C;
+
+void test()
+{
+    0 == Exception;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5435.d b/gcc/testsuite/gdc.test/fail_compilation/fail5435.d
new file mode 100644
index 00000000000..2c610a86d66
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail5435.d
@@ -0,0 +1,13 @@
+// 5435
+
+template Tuple5435(E...) { alias E Tuple5435; }
+enum Enum5435 { A, B, C };
+
+void main()
+{
+    alias Tuple5435!(Enum5435.A, Enum5435.B, Enum5435.C, "foo", 3.0) tup;
+
+    foreach (Enum5435 foo; tup) pragma(msg, foo);
+    foreach (  string foo; tup) pragma(msg, foo);
+    foreach (     int foo; tup) pragma(msg, foo);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail55.d b/gcc/testsuite/gdc.test/fail_compilation/fail55.d
new file mode 100644
index 00000000000..57117d86ee4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail55.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail55.d(22): Error: function object.Object.opCmp (Object o) is not callable using argument types (int)
+---
+*/
+
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@ zwang <nehzgnaw@gmail.com>
+// @date@   2005-02-03
+// @uri@    news:cttjjg$4i0$2@digitaldaemon.com
+
+// __DSTRESS_ELINE__ 14
+
+module dstress.nocompile.bug_mtype_507_D;
+
+void test()
+{
+    0 < Exception;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail56.d b/gcc/testsuite/gdc.test/fail_compilation/fail56.d
new file mode 100644
index 00000000000..579401fb703
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail56.d
@@ -0,0 +1,21 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Regan Heath <regan@netwin.co.nz>
+// @date@	2005-03-30
+// @uri@	news:opsof4hwgy23k2f5@nrage.netwin.co.nz
+
+// __DSTRESS_ELINE__ 14
+
+module dstress.nocompile.bug_20050330_A;
+
+template Blah(int a, alias B){
+	mixin Blah!(a, B) Foo;
+}
+
+int main(){
+	int a;
+	mixin Blah!(5,a);
+	return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5634.d b/gcc/testsuite/gdc.test/fail_compilation/fail5634.d
new file mode 100644
index 00000000000..0044adf8df2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail5634.d
@@ -0,0 +1,3 @@
+void main() { }
+void main() { }
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail57.d b/gcc/testsuite/gdc.test/fail_compilation/fail57.d
new file mode 100644
index 00000000000..ded3a6ea582
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail57.d
@@ -0,0 +1,6 @@
+
+int main()
+{
+    int x = 1 / 0;
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5733.d b/gcc/testsuite/gdc.test/fail_compilation/fail5733.d
new file mode 100644
index 00000000000..2292716bc9c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail5733.d
@@ -0,0 +1,6 @@
+struct Test
+{
+    struct opDispatch(string dummy)
+    { enum opDispatch = 1; }
+}
+auto temp = Test().foo!(int);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail58.d b/gcc/testsuite/gdc.test/fail_compilation/fail58.d
new file mode 100644
index 00000000000..ad6f8da3e30
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail58.d
@@ -0,0 +1,27 @@
+debug(1) import std.stdio;
+const int anything = -1000; // Line #2
+dchar[] SomeFunc( dchar[] pText, out int pStopPosn)
+{
+    if (pText.length == 0)
+        pStopPosn = 0;
+    else
+        pStopPosn = -1;
+    debug(1) writefln("DEBUG: using '%s' we get %d", pText, pStopPosn);
+    return pText.dup;
+}
+
+int main(char[][] pArgs)
+{
+    int sp;
+
+    SomeFunc("123", sp);
+    debug(1) writefln("DEBUG: got %d", sp);
+    assert(sp == -1);
+
+    SomeFunc("", sp);
+//    if (sp != 0){} // Line #22
+    debug(1) writefln("DEBUG: got %d", sp);
+    assert(sp == -1);
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5851.d b/gcc/testsuite/gdc.test/fail_compilation/fail5851.d
new file mode 100644
index 00000000000..c422c1436d1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail5851.d
@@ -0,0 +1,10 @@
+
+class Foo
+{
+    Object o;
+    alias o this;
+}
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail59.d b/gcc/testsuite/gdc.test/fail_compilation/fail59.d
new file mode 100644
index 00000000000..63fab5e0879
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail59.d
@@ -0,0 +1,51 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail59.d(50): Error: outer class C1 'this' needed to 'new' nested class C2
+---
+*/
+
+class C1
+{
+    int c1;
+
+    this()
+    {
+        c1 = 2;
+    }
+
+    class C2
+    {
+        class C3
+        {
+            int c3;
+
+            this(int n)
+            {
+                c3 = n + c1 + c2;
+            }
+        }
+
+        int c2;
+
+        C3 foo()
+        {
+            return new C3(8);
+        }
+
+        this(int k)
+        {
+            c2 = k + 7;
+        }
+    }
+
+    C2 bar()
+    {
+        return new C2(17);
+    }
+}
+
+void main()
+{
+    C1.C2 q = new C1.C2(3);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5953a1.d b/gcc/testsuite/gdc.test/fail_compilation/fail5953a1.d
new file mode 100644
index 00000000000..f977c5822bb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail5953a1.d
@@ -0,0 +1,4 @@
+void main()
+{
+    auto a2 = [,];    // invalid, but compiles
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5953a2.d b/gcc/testsuite/gdc.test/fail_compilation/fail5953a2.d
new file mode 100644
index 00000000000..a1e6c75cb3a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail5953a2.d
@@ -0,0 +1,4 @@
+void main()
+{
+    auto a3 = [,,,];    // invalid, but compiles
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5953s1.d b/gcc/testsuite/gdc.test/fail_compilation/fail5953s1.d
new file mode 100644
index 00000000000..c64601b003c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail5953s1.d
@@ -0,0 +1,5 @@
+void main()
+{
+    struct S{}
+    S s2 = {,};   // invalid, but compiles
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail5953s2.d b/gcc/testsuite/gdc.test/fail_compilation/fail5953s2.d
new file mode 100644
index 00000000000..3f1ac9c42d4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail5953s2.d
@@ -0,0 +1,5 @@
+void main()
+{
+    struct S{}
+    S s3 = {,,,}; // invalid, but compiles
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail60.d b/gcc/testsuite/gdc.test/fail_compilation/fail60.d
new file mode 100644
index 00000000000..3d660252be8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail60.d
@@ -0,0 +1,10 @@
+class A
+{
+ class B
+ {
+
+ }
+
+ B b=new B;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6029.d b/gcc/testsuite/gdc.test/fail_compilation/fail6029.d
new file mode 100644
index 00000000000..e5199db6628
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6029.d
@@ -0,0 +1,15 @@
+struct A
+{
+    static A a;
+    alias a this;
+}
+
+void foo(A a)
+{
+}
+
+void main()
+{
+//  foo(A);    // Error: type A is not an expression
+    int s = A; // Error: type A has no value + stack overflow
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail61.d b/gcc/testsuite/gdc.test/fail_compilation/fail61.d
new file mode 100644
index 00000000000..e9daa6163b9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail61.d
@@ -0,0 +1,43 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail61.d(22): Error: no property 'B' for type 'fail61.A.B'
+fail_compilation/fail61.d(23): Error: no property 'B' for type 'fail61.A.B'
+fail_compilation/fail61.d(32): Error: no property 'A2' for type 'fail61.B2'
+fail_compilation/fail61.d(41): Error: this for foo needs to be type B3 not type fail61.C3
+---
+*/
+
+class A
+{
+    class B : A
+    {
+        static const int C = 5;
+    }
+}
+
+void main()
+{
+    int n1 = A.B.C;
+    int n2 = A.B.B.C;       // Line22
+    int n3 = A.B.B.B.C;     // Line23
+}
+
+class A2 { void foo(){ assert(0);} }
+class B2 : A2 { override void foo(){} }
+class C2 : B2
+{
+    void bar()
+    {
+        B2.A2.foo();        // Line32
+    }
+}
+
+class B3 { void foo(){ assert(0); } }
+class C3
+{
+    void bar()
+    {
+        B3.foo();           // Line41
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6107.d b/gcc/testsuite/gdc.test/fail_compilation/fail6107.d
new file mode 100644
index 00000000000..4d79b0c2590
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6107.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail6107.d(10): Error: variable fail6107.Foo.__ctor is not a constructor; identifiers starting with __ are reserved for the implementation
+fail_compilation/fail6107.d(14): Error: variable fail6107.Bar.__ctor is not a constructor; identifiers starting with __ are reserved for the implementation
+---
+*/
+struct Foo
+{
+    enum __ctor = 4;
+}
+class Bar
+{
+    int __ctor = 4;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail62.d b/gcc/testsuite/gdc.test/fail_compilation/fail62.d
new file mode 100644
index 00000000000..caa784300ed
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail62.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail62.d(11): Error: version Foo defined after use
+---
+*/
+
+version (Foo)
+    int x;
+
+version = Foo;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6242.d b/gcc/testsuite/gdc.test/fail_compilation/fail6242.d
new file mode 100644
index 00000000000..92df7700563
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6242.d
@@ -0,0 +1,3 @@
+class A { void fun(int) {} }
+
+class B : A { void fun(int x) in { assert(x > 0); } body {} }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail63.d b/gcc/testsuite/gdc.test/fail_compilation/fail63.d
new file mode 100644
index 00000000000..4af83ec0a09
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail63.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail63.d(11): Error: debug Foo defined after use
+---
+*/
+
+debug (Foo)
+    int x;
+
+debug = Foo;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6334.d b/gcc/testsuite/gdc.test/fail_compilation/fail6334.d
new file mode 100644
index 00000000000..c532f81e845
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6334.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail6334.d(12): Error: static assert  (0) is false
+---
+*/
+
+mixin template T1()
+{
+    mixin T2;                       //compiles if these lines
+    mixin T2!(a, bb, ccc, dddd);    //are before T2 declaration
+    mixin template T2() { static assert(0); }
+}
+
+void main()
+{
+    mixin T1;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6451.d b/gcc/testsuite/gdc.test/fail_compilation/fail6451.d
new file mode 100644
index 00000000000..54c628ac075
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6451.d
@@ -0,0 +1,18 @@
+
+version(GNU)
+{
+    static assert(0);
+}
+version(Win64)
+{
+    static assert(0);
+}
+else version(X86_64)
+{
+    void error(...){}
+}
+else
+{
+    static assert(0);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6453.d b/gcc/testsuite/gdc.test/fail_compilation/fail6453.d
new file mode 100644
index 00000000000..e1db9f4d5f6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6453.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail6453.d(13): Error: struct fail6453.S6453x mixing invariants with shared/synchronized differene is not supported
+fail_compilation/fail6453.d(18): Error: class fail6453.C6453y mixing invariants with shared/synchronized differene is not supported
+fail_compilation/fail6453.d(23): Error: class fail6453.C6453z mixing invariants with shared/synchronized differene is not supported
+---
+*/
+
+struct S6453x
+{
+           invariant() {}
+    shared invariant() {}
+}
+class C6453y
+{
+           invariant() {}
+    synchronized invariant() {}
+}
+class C6453z
+{
+          shared invariant() {}
+    synchronized invariant() {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6458.d b/gcc/testsuite/gdc.test/fail_compilation/fail6458.d
new file mode 100644
index 00000000000..52b97a3b0d0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6458.d
@@ -0,0 +1,5 @@
+
+void main()
+{
+    char d = '�';
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6497.d b/gcc/testsuite/gdc.test/fail_compilation/fail6497.d
new file mode 100644
index 00000000000..d985cb45553
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6497.d
@@ -0,0 +1,6 @@
+
+void main() @safe
+{
+    int n;
+    auto b = &(0 ? n : n);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6561.d b/gcc/testsuite/gdc.test/fail_compilation/fail6561.d
new file mode 100644
index 00000000000..8a9da8ba2e8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6561.d
@@ -0,0 +1,8 @@
+struct S
+{
+    alias x this;   // should cause undefined identifier error
+}
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail66.d b/gcc/testsuite/gdc.test/fail_compilation/fail66.d
new file mode 100644
index 00000000000..5c352a52093
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail66.d
@@ -0,0 +1,91 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail66.d(11): Error: constructor fail66.C1.this missing initializer for const field y
+---
+*/
+
+class C1
+{
+    const int y;
+    this() {}
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail66.d(28): Error: cannot modify const expression c.y
+---
+*/
+class C2
+{
+    const int y;
+    this() { y = 7; }
+}
+void test2()
+{
+    C2 c = new C2();
+    c.y = 3;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail66.d(43): Error: cannot modify const expression this.y
+---
+*/
+class C3
+{
+    const int y;
+    this() { y = 7; }
+    void foo()
+    {
+        y = 6;
+    }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail66.d(59): Error: cannot modify const expression x
+---
+*/
+class C4
+{
+    static const int x;
+    static this() { x = 5; }
+    void foo()
+    {
+        x = 4;
+    }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail66.d(73): Error: cannot modify const expression z5
+---
+*/
+const int z5;
+static this() { z5 = 3; }
+void test5()
+{
+    z5 = 4;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail66.d(89): Error: cannot modify const expression c.y
+---
+*/
+class C6
+{
+    const int y;
+    this()
+    {
+        C6 c = this;
+        y = 7;
+        c.y = 8;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6611.d b/gcc/testsuite/gdc.test/fail_compilation/fail6611.d
new file mode 100644
index 00000000000..781688978d1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6611.d
@@ -0,0 +1,6 @@
+
+void main()
+{
+    auto x = new int[](10);
+    x[]++;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6652.d b/gcc/testsuite/gdc.test/fail_compilation/fail6652.d
new file mode 100644
index 00000000000..45a3f5a3fec
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6652.d
@@ -0,0 +1,37 @@
+// PERMUTE_ARGS: -w -dw -de -d
+
+/******************************************/
+// 6652
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail6652.d(20): Error: cannot modify const expression i
+fail_compilation/fail6652.d(25): Error: cannot modify const expression i
+fail_compilation/fail6652.d(30): Error: cannot modify const expression i
+fail_compilation/fail6652.d(35): Error: cannot modify const expression i
+---
+*/
+
+void main()
+{
+    foreach (const i; 0..2)
+    {
+        ++i;
+    }
+
+    foreach (ref const i; 0..2)
+    {
+        ++i;
+    }
+
+    foreach (const i, e; [1,2,3,4,5])
+    {
+        ++i;
+    }
+
+    foreach (ref const i, e; [1,2,3,4,5])
+    {
+        ++i;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6781.d b/gcc/testsuite/gdc.test/fail_compilation/fail6781.d
new file mode 100644
index 00000000000..ef1c77f073a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6781.d
@@ -0,0 +1,9 @@
+void bug6781(alias xxx)() {
+    some_error;
+}
+struct C6781 {
+    void makeSortedIndices() {
+        int greater;
+        bug6781!greater();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6795.d b/gcc/testsuite/gdc.test/fail_compilation/fail6795.d
new file mode 100644
index 00000000000..d714f2035a1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6795.d
@@ -0,0 +1,34 @@
+// 6795
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail6795.d(12): Error: constant 0 is not an lvalue
+fail_compilation/fail6795.d(13): Error: constant 0 is not an lvalue
+---
+*/
+
+void main() {
+    enum int[] array = [0];
+    array[0]++;
+    array[0] += 3;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail6795.d(31): Error: constant 0 is not an lvalue
+fail_compilation/fail6795.d(32): Error: constant 0 is not an lvalue
+fail_compilation/fail6795.d(33): Error: constant 0 is not an lvalue
+---
+*/
+
+void test_wrong_line_num()
+{
+    enum int[] da = [0];
+    enum int[1] sa = [0];
+    enum int[int] aa = [0:0];
+
+    da[0] += 3;
+    sa[0] += 3;
+    aa[0] += 3;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6889.d b/gcc/testsuite/gdc.test/fail_compilation/fail6889.d
new file mode 100644
index 00000000000..feb6e4f7b89
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6889.d
@@ -0,0 +1,130 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail6889.d(16): Error: cannot goto out of scope(success) block
+fail_compilation/fail6889.d(17): Error: cannot goto in to scope(success) block
+fail_compilation/fail6889.d(19): Error: return statements cannot be in scope(success) bodies
+fail_compilation/fail6889.d(23): Error: continue is not inside scope(success) bodies
+fail_compilation/fail6889.d(24): Error: break is not inside scope(success) bodies
+fail_compilation/fail6889.d(29): Error: continue is not inside scope(success) bodies
+fail_compilation/fail6889.d(30): Error: break is not inside scope(success) bodies
+---
+*/
+void test_success()
+{
+L1:
+    scope(success) { L2: goto L1; } // NG
+    goto L2;                        // NG
+
+    scope(success) { return; }      // NG (from fail102.d)
+
+    foreach (i; 0..1)
+    {
+        scope(success) continue;    // NG
+        scope(success) break;       // NG
+    }
+
+    foreach (i; Aggr())
+    {
+        scope(success) continue;    // NG
+        scope(success) break;       // NG
+    }
+  /+
+    // is equivalent with:
+    switch (
+      Aggr().opApply((int i){
+        scope(success) return 0;    // NG
+        scope(success) return 1;    // NG
+        return 0;
+      }))
+    {
+        default: break;
+    }
+  +/
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail6889.d(56): Error: cannot goto in to scope(failure) block
+---
+*/
+void test_failure()
+{
+L1:
+    scope(failure) { L2: goto L1; } // OK
+    goto L2;                        // NG
+
+    scope(failure) { return; }      // OK
+
+    foreach (i; 0..1)
+    {
+        scope(failure) continue;    // OK
+        scope(failure) break;       // OK
+    }
+
+    foreach (i; Aggr())
+    {
+        scope(failure) continue;    // OK
+        scope(failure) break;       // OK
+    }
+  /+
+    // is equivalent with:
+    switch (
+      Aggr().opApply((int i){
+        scope(failure) return 0;    // OK
+        scope(failure) return 1;    // OK
+        return 0;
+      }))
+    {
+        default: break;
+    }
+  +/
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail6889.d(100): Error: cannot goto out of scope(exit) block
+fail_compilation/fail6889.d(101): Error: cannot goto in to scope(exit) block
+fail_compilation/fail6889.d(103): Error: return statements cannot be in scope(exit) bodies
+fail_compilation/fail6889.d(107): Error: continue is not inside scope(exit) bodies
+fail_compilation/fail6889.d(108): Error: break is not inside scope(exit) bodies
+fail_compilation/fail6889.d(113): Error: continue is not inside scope(exit) bodies
+fail_compilation/fail6889.d(114): Error: break is not inside scope(exit) bodies
+---
+*/
+void test_exit()
+{
+L1:
+    scope(exit) { L2: goto L1; }    // NG
+    goto L2;                        // NG
+
+    scope(exit) { return; }         // NG (from fail102.d)
+
+    foreach (i; 0..1)
+    {
+        scope(exit) continue;       // NG
+        scope(exit) break;          // NG
+    }
+
+    foreach (i; Aggr())
+    {
+        scope(exit) continue;       // NG
+        scope(exit) break;          // NG
+    }
+  /+
+    // is equivalent with:
+    switch (
+      Aggr().opApply((int i){
+        scope(exit) return 0;       // NG
+        scope(exit) return 1;       // NG
+        return 0;
+      }))
+    {
+        default: break;
+    }
+  +/
+}
+
+struct Aggr { int opApply(int delegate(int) dg) { return dg(0); } }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6968.d b/gcc/testsuite/gdc.test/fail_compilation/fail6968.d
new file mode 100644
index 00000000000..69f63b9cbce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail6968.d
@@ -0,0 +1,22 @@
+// 6968
+
+template Pred(A, B)
+{
+    static if(is(B == int))
+        enum bool Pred = true;
+    else
+        enum bool Pred = false;
+}
+
+template PredAny(A, B...)
+{
+    static if(B.length == 0)
+        enum bool PredAny = false;
+    else
+        enum bool PredAny = Pred(A, B[0]) || PredAny(A, B[1..$]);
+}
+
+void main()
+{
+    pragma(msg, PredAny!(int, long, float));
+} 
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7077.d b/gcc/testsuite/gdc.test/fail_compilation/fail7077.d
new file mode 100644
index 00000000000..5caae9098ca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7077.d
@@ -0,0 +1,6 @@
+
+void main()
+{
+    if(0) mixin("auto x = 2;");
+    assert(x == 2);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7173.d b/gcc/testsuite/gdc.test/fail_compilation/fail7173.d
new file mode 100644
index 00000000000..2f6c748f7c0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7173.d
@@ -0,0 +1,18 @@
+struct A{
+
+  A opBinary(string op)(A a){ A rt; return rt; }
+
+  void fun(){ }
+}
+
+struct B{
+
+  A _a;
+  alias _a this;
+}
+
+
+void main(){
+
+  B b1, b2, b3; b3 = (b1 - b2).fun();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7178.d b/gcc/testsuite/gdc.test/fail_compilation/fail7178.d
new file mode 100644
index 00000000000..04a1018d8c5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7178.d
@@ -0,0 +1,6 @@
+template populate(overloads...)
+{
+    mixin populate!(.contents);
+}
+public mixin populate!int;
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail72.d b/gcc/testsuite/gdc.test/fail_compilation/fail72.d
new file mode 100644
index 00000000000..db4a0196d8e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail72.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail72.d(10): Error: undefined identifier 'foo'
+---
+*/
+
+void main()
+{
+    synchronized( foo )
+    {
+
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7234.d b/gcc/testsuite/gdc.test/fail_compilation/fail7234.d
new file mode 100644
index 00000000000..e8ddd4e438c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7234.d
@@ -0,0 +1,10 @@
+
+struct Contract {
+    void opDispatch()(){}
+}
+
+void foo()
+{
+    Contract* r; if (r.empty) {}
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail73.d b/gcc/testsuite/gdc.test/fail_compilation/fail73.d
new file mode 100644
index 00000000000..dc83e5d3228
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail73.d
@@ -0,0 +1,29 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail73.d(20): Error: case not in switch statement
+---
+*/
+
+// segfault DMD 0.120
+// http://www.digitalmars.com/d/archives/digitalmars/D/bugs/4634.html
+
+void main()
+{
+    int u=2;
+
+    switch(u)
+    {
+        case 1:
+            void j()
+            {
+                case 2:
+                    u++;
+            }
+            break;
+
+        default:
+            break;
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7369.d b/gcc/testsuite/gdc.test/fail_compilation/fail7369.d
new file mode 100644
index 00000000000..b54757d96e3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7369.d
@@ -0,0 +1,5 @@
+struct S7369 {
+    int a;
+    invariant() { a += 5; }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail74.d b/gcc/testsuite/gdc.test/fail_compilation/fail74.d
new file mode 100644
index 00000000000..c038b20a5c1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail74.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail74.d(13): Error: cannot append type C[1] to type C[1]
+---
+*/
+
+class C
+{
+    C[1] c;
+    this()
+    {
+        c ~= c;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d
new file mode 100644
index 00000000000..d358b60c7db
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424b.d
@@ -0,0 +1,5 @@
+struct S7424b
+{
+    @property int g()() { return 0; }
+    void test() const { int f = g; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d
new file mode 100644
index 00000000000..c0671786ce5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424c.d
@@ -0,0 +1,6 @@
+struct S7424c
+{
+    @property int g()() { return 0; }
+    void test() immutable { int f = g; }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d
new file mode 100644
index 00000000000..a981be6a39c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424d.d
@@ -0,0 +1,6 @@
+struct S7424d
+{
+    @property int g()() immutable { return 0; }
+    void test() const { int f = g; }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d
new file mode 100644
index 00000000000..4dfda623e3b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424e.d
@@ -0,0 +1,6 @@
+struct S7424e
+{
+    @property int g()() immutable { return 0; }
+    void test() { int f = g; }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d
new file mode 100644
index 00000000000..e72a05b5649
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424f.d
@@ -0,0 +1,6 @@
+struct S7424f
+{
+    @property int g()() shared { return 0; }
+    void test() { int f = g; }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d
new file mode 100644
index 00000000000..059f586a480
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424g.d
@@ -0,0 +1,6 @@
+struct S7424g
+{
+    @property int g()() { return 0; }
+    void test() shared { int f = g; }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d
new file mode 100644
index 00000000000..fd22b2efde0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424h.d
@@ -0,0 +1,6 @@
+struct S7424g
+{
+    @property int g()() { return 0; }
+    void test() inout { int f = g; }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d b/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d
new file mode 100644
index 00000000000..2871e932140
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7424i.d
@@ -0,0 +1,6 @@
+struct S7424g
+{
+    @property int g()() immutable { return 0; }
+    void test() inout { int f = g; }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail75.d b/gcc/testsuite/gdc.test/fail_compilation/fail75.d
new file mode 100644
index 00000000000..1059e36bd62
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail75.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail75.d(13): Error: cannot append type fail75.C to type C[1]
+---
+*/
+
+class C
+{
+    C[1] c;
+    this()
+    {
+        c ~= this;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7524a.d b/gcc/testsuite/gdc.test/fail_compilation/fail7524a.d
new file mode 100644
index 00000000000..6f1ebefb27f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7524a.d
@@ -0,0 +1,4 @@
+
+// 7524
+
+#line 47 __DATE__
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7524b.d b/gcc/testsuite/gdc.test/fail_compilation/fail7524b.d
new file mode 100644
index 00000000000..042baf5d1d6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7524b.d
@@ -0,0 +1,3 @@
+// 7524
+
+#line 47 __VERSION__
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail76.d b/gcc/testsuite/gdc.test/fail_compilation/fail76.d
new file mode 100644
index 00000000000..c2b7e59064f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail76.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail76.d(9): Error: alias fail76.a conflicts with alias fail76.a at fail_compilation/fail76.d(8)
+---
+*/
+
+alias main a;
+alias void a;
+
+void main()
+{
+    a;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7603a.d b/gcc/testsuite/gdc.test/fail_compilation/fail7603a.d
new file mode 100644
index 00000000000..e1d28eaf742
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7603a.d
@@ -0,0 +1 @@
+void test(ref bool val = true) { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7603b.d b/gcc/testsuite/gdc.test/fail_compilation/fail7603b.d
new file mode 100644
index 00000000000..5317072296e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7603b.d
@@ -0,0 +1 @@
+void test(out bool val = true) { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7603c.d b/gcc/testsuite/gdc.test/fail_compilation/fail7603c.d
new file mode 100644
index 00000000000..f5f6e18caf2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7603c.d
@@ -0,0 +1,2 @@
+enum x = 3;
+void test(ref int val = x) { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail77.d b/gcc/testsuite/gdc.test/fail_compilation/fail77.d
new file mode 100644
index 00000000000..79ada7063ea
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail77.d
@@ -0,0 +1,8 @@
+void test()
+{
+    int i;
+    ubyte[4] ub;
+    ub[] = cast(ubyte[4]) &i;
+    //ub[] = (cast(ubyte*) &i)[0..4];
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7702.d b/gcc/testsuite/gdc.test/fail_compilation/fail7702.d
new file mode 100644
index 00000000000..8b7ae21cb89
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7702.d
@@ -0,0 +1,9 @@
+struct S
+{
+   template opDispatch (string name) {}
+}
+void main()
+{
+    S s;
+    s.x!int;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7751.d b/gcc/testsuite/gdc.test/fail_compilation/fail7751.d
new file mode 100644
index 00000000000..e367d0e3b37
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7751.d
@@ -0,0 +1,17 @@
+class Foo(T)
+{
+    T x;
+    Foo y;
+}
+auto foo(T)(T x, Foo!T y=null)
+{
+    return new Foo!T(x, y);
+}
+void bar(U)(U foo, U[] spam=[])
+{
+    spam ~= [];
+}
+void main()
+{
+    bar(foo(0));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail78.d b/gcc/testsuite/gdc.test/fail_compilation/fail78.d
new file mode 100644
index 00000000000..1a6e5cd82b1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail78.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail78.d(9): Error: undefined identifier 'inch'
+---
+*/
+
+auto yd = ft * 3;
+auto ft = inch * 12;
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7815.d b/gcc/testsuite/gdc.test/fail_compilation/fail7815.d
new file mode 100644
index 00000000000..ceb5923edb6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7815.d
@@ -0,0 +1,65 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+X: tuple("x")
+fail_compilation/fail7815.d(47): Error: no property 'flags' for type 'Move'
+---
+*/
+
+mixin template Helpers()
+{
+    static if (is(Flags!Move))
+    {
+        Flags!Move flags;
+    }
+    else
+    {
+        pragma(msg, "X: ", __traits(derivedMembers, Flags!Move));
+    }
+}
+
+template Flags(T)
+{
+    mixin({
+        int defs = 1;
+        foreach (name; __traits(derivedMembers, Move))
+        {
+            defs++;
+        }
+        if (defs)
+        {
+            return "struct Flags { bool x; }";
+        }
+        else
+        {
+            return "";
+        }
+    }());
+}
+
+struct Move
+{
+    int a;
+    mixin Helpers!();
+}
+
+enum a7815 = Move.init.flags;
+
+/+
+This is an invalid case.
+When the Move struct member is analyzed:
+1. mixin Helpers!() is instantiated.
+2. In Helpers!(), static if and its condition is(Flags!Move)) evaluated.
+3. In Flags!Move, string mixin evaluates and CTFE lambda.
+4. __traits(derivedMembers, Move) tries to see the member of Move.
+   4a. mixin Helpers!() member is analyzed.
+   4b. `static if (is(Flags!Move))` in Helpers!() is evaluated
+   4c. The Flags!Move instantiation is already in progress, so it cannot be resolved.
+   4d. `static if` fails because Flags!Move cannot be determined as a type.
+5. __traits(derivedMembers, Move) returns a 1-length tuple("a").
+6. The lambda in Flags!Move returns a string "struct Flags {...}", then
+   Flags!Move is instantiated to a new struct Flags.
+7. Finally Move struct does not have flags member, then the `enum a7815`
+   definition will fail in its initializer.
++/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7848.d b/gcc/testsuite/gdc.test/fail_compilation/fail7848.d
new file mode 100644
index 00000000000..4b987979572
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7848.d
@@ -0,0 +1,53 @@
+// REQUIRED_ARGS: -unittest
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail7848.d(35): Error: pure function 'fail7848.C.__unittestL33_$n$' cannot call impure function 'fail7848.func'
+fail_compilation/fail7848.d(35): Error: @safe function 'fail7848.C.__unittestL33_$n$' cannot call @system function 'fail7848.func'
+fail_compilation/fail7848.d(35): Error: @nogc function 'fail7848.C.__unittestL33_$n$' cannot call non-@nogc function 'fail7848.func'
+fail_compilation/fail7848.d(35): Error: function 'fail7848.func' is not nothrow
+fail_compilation/fail7848.d(33): Error: nothrow function 'fail7848.C.__unittestL33_$n$' may throw
+fail_compilation/fail7848.d(40): Error: pure function 'fail7848.C.__invariant2' cannot call impure function 'fail7848.func'
+fail_compilation/fail7848.d(40): Error: @safe function 'fail7848.C.__invariant2' cannot call @system function 'fail7848.func'
+fail_compilation/fail7848.d(40): Error: @nogc function 'fail7848.C.__invariant2' cannot call non-@nogc function 'fail7848.func'
+fail_compilation/fail7848.d(40): Error: function 'fail7848.func' is not nothrow
+fail_compilation/fail7848.d(38): Error: nothrow function 'fail7848.C.__invariant2' may throw
+fail_compilation/fail7848.d(45): Error: pure allocator 'fail7848.C.new' cannot call impure function 'fail7848.func'
+fail_compilation/fail7848.d(45): Error: @safe allocator 'fail7848.C.new' cannot call @system function 'fail7848.func'
+fail_compilation/fail7848.d(45): Error: @nogc allocator 'fail7848.C.new' cannot call non-@nogc function 'fail7848.func'
+fail_compilation/fail7848.d(45): Error: function 'fail7848.func' is not nothrow
+fail_compilation/fail7848.d(43): Error: nothrow allocator 'fail7848.C.new' may throw
+fail_compilation/fail7848.d(51): Error: pure deallocator 'fail7848.C.delete' cannot call impure function 'fail7848.func'
+fail_compilation/fail7848.d(51): Error: @safe deallocator 'fail7848.C.delete' cannot call @system function 'fail7848.func'
+fail_compilation/fail7848.d(51): Error: @nogc deallocator 'fail7848.C.delete' cannot call non-@nogc function 'fail7848.func'
+fail_compilation/fail7848.d(51): Error: function 'fail7848.func' is not nothrow
+fail_compilation/fail7848.d(49): Error: nothrow deallocator 'fail7848.C.delete' may throw
+---
+*/
+
+void func() {}
+
+class C
+{
+    @safe pure nothrow @nogc unittest
+    {
+        func();
+    }
+
+    @safe pure nothrow @nogc invariant
+    {
+        func();
+    }
+
+    @safe pure nothrow @nogc new (size_t sz)
+    {
+        func();
+        return null;
+    }
+
+    @safe pure nothrow @nogc delete (void* p)
+    {
+        func();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7851.d b/gcc/testsuite/gdc.test/fail_compilation/fail7851.d
new file mode 100644
index 00000000000..7ede41f3728
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7851.d
@@ -0,0 +1,33 @@
+// 7851
+
+
+template TypeTuple(TList...)
+{
+    alias TList TypeTuple;
+}
+
+struct Tuple(Specs...)
+{
+    TypeTuple!(int, long, float) mem;
+
+    alias Identity!(mem[0]) _0;
+    alias Identity!(mem[1]) _1;
+    alias Identity!(mem[2]) _2;
+
+    alias mem this;
+
+    enum length = mem.length;
+}
+
+private template Identity(alias T)
+{
+    alias T Identity;
+}
+
+
+void main() {
+  alias Tuple!(int, long, float) TL;
+  foreach (i; TL)
+  { }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7859.d b/gcc/testsuite/gdc.test/fail_compilation/fail7859.d
new file mode 100644
index 00000000000..436d3a363b4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7859.d
@@ -0,0 +1,8 @@
+template A(alias B) {}
+
+mixin template C(alias B = cast(NonExistent)null) {
+  alias A!B D;
+}
+
+mixin C!();
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7861.d b/gcc/testsuite/gdc.test/fail_compilation/fail7861.d
new file mode 100644
index 00000000000..ce59e8edee2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7861.d
@@ -0,0 +1,12 @@
+module test;
+
+mixin template A() {
+import test;
+}
+
+struct B {
+mixin A!();
+}
+
+enum C = B.nonexistent;
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7862.d b/gcc/testsuite/gdc.test/fail_compilation/fail7862.d
new file mode 100644
index 00000000000..a81bc650b85
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7862.d
@@ -0,0 +1,30 @@
+/*
+TEST_OUTPUT:
+---
+A: false
+A: false
+fail_compilation/fail7862.d(26): Error: template instance nonExistent!() template 'nonExistent' is not defined
+fail_compilation/fail7862.d(25): Error: template instance fail7862.B!(A) error instantiating
+---
+*/
+
+// 7862
+
+template B(T) {
+  mixin(
+    {
+      foreach (name; __traits(derivedMembers, T)) {}
+      return "struct B {}";
+    }()
+  );
+}
+
+struct A {
+  pragma(msg, "A: " ~ (__traits(compiles, B!A) ? "true" : "false"));
+  pragma(msg, "A: " ~ (__traits(compiles, B!A) ? "true" : "false"));
+  B!A c;
+  static if (nonExistent!()) {}
+}
+
+auto d = A.init.c;
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7886.d b/gcc/testsuite/gdc.test/fail_compilation/fail7886.d
new file mode 100644
index 00000000000..b939aad1495
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7886.d
@@ -0,0 +1,5 @@
+// 7886
+
+struct A {
+  static if (__traits(derivedMembers, A).length) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail79.d b/gcc/testsuite/gdc.test/fail_compilation/fail79.d
new file mode 100644
index 00000000000..46581d9d43c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail79.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail79.d(13): Error: incompatible types for ((& a) + (& b)): 'int*' and 'int*'
+---
+*/
+
+void main()
+{
+    int a, b;
+    int* p;
+
+    p = &a + &b;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail7903.d b/gcc/testsuite/gdc.test/fail_compilation/fail7903.d
new file mode 100644
index 00000000000..7759f1ada17
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail7903.d
@@ -0,0 +1,28 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail7903.d(21): Error: variable fail7903.F1.x Field members of a synchronized class cannot be public
+fail_compilation/fail7903.d(22): Error: variable fail7903.F1.y Field members of a synchronized class cannot be export
+fail_compilation/fail7903.d(27): Error: variable fail7903.F2.x Field members of a synchronized class cannot be public
+---
+*/
+synchronized class K1
+{
+    public struct S { }
+}
+
+synchronized class K2
+{
+    struct S { }
+}
+
+synchronized class F1
+{
+    public int x;
+    export int y;
+}
+
+synchronized class F2
+{
+    int x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8009.d b/gcc/testsuite/gdc.test/fail_compilation/fail8009.d
new file mode 100644
index 00000000000..1af7e2c279b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail8009.d
@@ -0,0 +1,3 @@
+void filter(R)(scope bool delegate(ref BAD!R) func) { }
+void main() { filter(r => r); }
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8032.d b/gcc/testsuite/gdc.test/fail_compilation/fail8032.d
new file mode 100644
index 00000000000..a328181c20a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail8032.d
@@ -0,0 +1,17 @@
+mixin template T()
+{
+    void f() { }
+}
+
+class A {
+    mixin T;
+    mixin T;
+}
+
+class B : A
+{
+    override void f() { }
+    // raises "cannot determine overridden function" error.
+}
+
+void main(){}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail80_m32.d b/gcc/testsuite/gdc.test/fail_compilation/fail80_m32.d
new file mode 100644
index 00000000000..ec6f0c25686
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail80_m32.d
@@ -0,0 +1,31 @@
+// REQUIRED_ARGS: -m32
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail80_m32.d(28): Error: cannot implicitly convert expression ("progress_rem") of type string to uint
+fail_compilation/fail80_m32.d(29): Error: cannot implicitly convert expression ("redo") of type string to uint
+---
+*/
+
+module paintshop;
+
+class Image{}
+
+class ResourceManager
+{
+    Image getImage(char[] name) { return null; }
+}
+
+class Test
+{
+    import std.file;
+    import std.path;
+
+    static Image[] images;
+
+    static void initIcons() 
+    {
+        images["progress_rem"]  = ResourceManager.getImage("progress_rem.gif"); // delete_obj_dis
+        images["redo"]          = ResourceManager.getImage("redo.gif");
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail80_m64.d b/gcc/testsuite/gdc.test/fail_compilation/fail80_m64.d
new file mode 100644
index 00000000000..20cfb21586e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail80_m64.d
@@ -0,0 +1,31 @@
+// REQUIRED_ARGS: -m64
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail80_m64.d(28): Error: cannot implicitly convert expression ("progress_rem") of type string to ulong
+fail_compilation/fail80_m64.d(29): Error: cannot implicitly convert expression ("redo") of type string to ulong
+---
+*/
+
+module paintshop;
+
+class Image{}
+
+class ResourceManager
+{
+    Image getImage(char[] name) { return null; }
+}
+
+class Test
+{
+    import std.file;
+    import std.path;
+
+    static Image[] images;
+
+    static void initIcons() 
+    {
+        images["progress_rem"]  = ResourceManager.getImage("progress_rem.gif"); // delete_obj_dis
+        images["redo"]          = ResourceManager.getImage("redo.gif");
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8168.d b/gcc/testsuite/gdc.test/fail_compilation/fail8168.d
new file mode 100644
index 00000000000..58033ab39d0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail8168.d
@@ -0,0 +1,9 @@
+void main() {
+    version(GNU) asm {
+        "unknown;" : : : ; // wrong opcode
+    }
+    else asm {
+        unknown; // wrong opcode
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8179b.d b/gcc/testsuite/gdc.test/fail_compilation/fail8179b.d
new file mode 100644
index 00000000000..e5917907713
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail8179b.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail8179b.d(10): Error: cannot cast expression [1, 2] of type int[] to int[2][1]
+---
+*/
+void foo(int[2][1]) {}
+void main() {
+    foo(cast(int[2][1])[1, 2]);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8217.d b/gcc/testsuite/gdc.test/fail_compilation/fail8217.d
new file mode 100644
index 00000000000..e74b7c35f2f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail8217.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail8217.d(22): Error: this for foo needs to be type D not type fail8217.D.C
+---
+*/
+
+class D
+{
+    int x;
+    template bar()
+    {
+        int foo()
+        {
+            return x;
+        }
+    }
+    static class C
+    {
+        int foo()
+        {
+            return bar!().foo();
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8313.d b/gcc/testsuite/gdc.test/fail_compilation/fail8313.d
new file mode 100644
index 00000000000..9dec1bdb289
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail8313.d
@@ -0,0 +1,3 @@
+auto bar()(int x){return x;}
+auto bar()(int x = bar()){return x;}
+static assert(bar(1));
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8373.d b/gcc/testsuite/gdc.test/fail_compilation/fail8373.d
new file mode 100644
index 00000000000..d9217078bd6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail8373.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail8373.d(21): Error: fail8373.fun1 called with argument types (int) matches both:
+fail_compilation/fail8373.d(15):     fail8373.fun1!().fun1!int.fun1(int)
+and:
+fail_compilation/fail8373.d(16):     fail8373.fun1!int.fun1(int)
+fail_compilation/fail8373.d(22): Error: fail8373.fun2 called with argument types (int) matches both:
+fail_compilation/fail8373.d(18):     fail8373.fun2!int.fun2(int)
+and:
+fail_compilation/fail8373.d(19):     fail8373.fun2!().fun2!int.fun2(int)
+---
+*/
+
+template fun1(a...) { auto fun1(T...)(T args){ return 1; } }
+                      auto fun1(T...)(T args){ return 2; }
+
+                      auto fun2(T...)(T args){ return 2; }
+template fun2(a...) { auto fun2(T...)(T args){ return 1; } }
+
+enum x1 = fun1(0);
+enum x2 = fun2(0);
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail86.d b/gcc/testsuite/gdc.test/fail_compilation/fail86.d
new file mode 100644
index 00000000000..a0ccb7c2718
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail86.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail86.d(12): Error: alias Foo recursive alias declaration
+---
+*/
+
+template Foo(TYPE) {}
+
+void main()
+{
+    alias Foo!(int) Foo;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8631.d b/gcc/testsuite/gdc.test/fail_compilation/fail8631.d
new file mode 100644
index 00000000000..3aada74c42a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail8631.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail8631.d(14): Error: function fail8631.D.foo does not override any function, did you mean to override 'fail8631.B.foo'?
+---
+*/
+
+class B {
+    int foo() immutable { return 2; }
+    int foo() const { return 2; }
+}
+class D : B {
+    override int foo() immutable { return 2; }
+    override int foo() const shared { return 2; }   // doesn't override any
+    override int foo() const { return 2; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8691.d b/gcc/testsuite/gdc.test/fail_compilation/fail8691.d
new file mode 100644
index 00000000000..e1979bb2ce8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail8691.d
@@ -0,0 +1,4 @@
+struct Foo
+{
+    Foo[1] f;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8724.d b/gcc/testsuite/gdc.test/fail_compilation/fail8724.d
new file mode 100644
index 00000000000..4ec5724b06f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail8724.d
@@ -0,0 +1,16 @@
+// REQUIRED_ARGS: -w
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail8724.d(14): Error: object.Exception is thrown but not caught
+fail_compilation/fail8724.d(12): Error: nothrow constructor 'fail8724.Foo.this' may throw
+---
+*/
+
+struct Foo
+{
+    this(int) nothrow
+    {
+        throw new Exception("something");
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9.d b/gcc/testsuite/gdc.test/fail_compilation/fail9.d
new file mode 100644
index 00000000000..6253774c823
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9.d(23): Error: no property 'Vector' for type 'fail9.Vector!int'
+---
+*/
+
+template Vector(T)
+{
+    int x;
+
+    class Vector
+    {
+    }
+}
+
+struct Sorter
+{
+}
+
+void Vector_test_int()
+{
+    alias Vector!(int).Vector vector_t;
+    vector_t v;
+    Sorter sorter;
+    v.sort_with!(int)(sorter);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9063.d b/gcc/testsuite/gdc.test/fail_compilation/fail9063.d
new file mode 100644
index 00000000000..962fb04ab2a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9063.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9063.d(9): Error: static assert  "msg"
+---
+*/
+
+@property string bar() { return "msg"; }
+static assert(false, bar);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9081.d b/gcc/testsuite/gdc.test/fail_compilation/fail9081.d
new file mode 100644
index 00000000000..86c888742ce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9081.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9081.d(12): Error: package core has no type
+fail_compilation/fail9081.d(13): Error: package stdc has no type
+fail_compilation/fail9081.d(14): Error: module stdio has no type
+---
+*/
+
+import core.stdc.stdio;
+
+typeof(core) a;
+typeof(core.stdc) b;
+typeof(core.stdc.stdio) c;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail91.d b/gcc/testsuite/gdc.test/fail_compilation/fail91.d
new file mode 100644
index 00000000000..59f80fd891d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail91.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail91.d(12): Error: struct fail91.S unknown size
+---
+*/
+
+struct S;
+
+void main()
+{
+    S* s = new S();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9199.d b/gcc/testsuite/gdc.test/fail_compilation/fail9199.d
new file mode 100644
index 00000000000..00a87c39907
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9199.d
@@ -0,0 +1,40 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9199.d(13): Error: function fail9199.fc without 'this' cannot be const
+fail_compilation/fail9199.d(14): Error: function fail9199.fi without 'this' cannot be immutable
+fail_compilation/fail9199.d(15): Error: function fail9199.fw without 'this' cannot be inout
+fail_compilation/fail9199.d(16): Error: function fail9199.fs without 'this' cannot be shared
+fail_compilation/fail9199.d(17): Error: function fail9199.fsc without 'this' cannot be shared const
+fail_compilation/fail9199.d(18): Error: function fail9199.fsw without 'this' cannot be shared inout
+---
+*/
+void fc() const {}
+void fi() immutable {}
+void fw() inout {}
+void fs() shared {}
+void fsc() shared const {}
+void fsw() shared inout {}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9199.d(33): Error: function fail9199.C.fc without 'this' cannot be const
+fail_compilation/fail9199.d(34): Error: function fail9199.C.fi without 'this' cannot be immutable
+fail_compilation/fail9199.d(35): Error: function fail9199.C.fw without 'this' cannot be inout
+fail_compilation/fail9199.d(36): Error: function fail9199.C.fs without 'this' cannot be shared
+fail_compilation/fail9199.d(37): Error: function fail9199.C.fsc without 'this' cannot be shared const
+fail_compilation/fail9199.d(38): Error: function fail9199.C.fsw without 'this' cannot be shared inout
+---
+*/
+class C
+{
+    static void fc() const {}
+    static void fi() immutable {}
+    static void fw() inout {}
+    static void fs() shared {}
+    static void fsc() shared const {}
+    static void fsw() shared inout {}
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail92.d b/gcc/testsuite/gdc.test/fail_compilation/fail92.d
new file mode 100644
index 00000000000..d9dea3463ad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail92.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail92.d(15): Error: invalid foreach aggregate t
+fail_compilation/fail92.d(23): Error: template instance fail92.crash!(typeof(null)) error instantiating
+---
+*/
+
+// [25]
+
+template crash(T)
+{
+    void crash(T t)
+    {
+        foreach (u; t)
+        {
+        }
+    }
+}
+
+void main()
+{
+    crash(null);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9279.d b/gcc/testsuite/gdc.test/fail_compilation/fail9279.d
new file mode 100644
index 00000000000..792891e4476
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9279.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9279.d(10): Error: escaping reference to stack allocated value returned by b()
+fail_compilation/fail9279.d(13): Error: escaping reference to stack allocated value returned by getArr()
+---
+*/
+
+char[2] b()() { char[2] ret; return ret; }
+string a() { return b(); }
+
+char[12] getArr() { return "Hello World!"; }
+string getString() { return getArr(); }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail93.d b/gcc/testsuite/gdc.test/fail_compilation/fail93.d
new file mode 100644
index 00000000000..4784038e0c4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail93.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail93.d(13): Error: variable i is shadowing variable fail93.main.i
+---
+*/
+
+// accepts-valid with DMD0.120. volatile as well as synchronized
+
+void main()
+{
+    int i = 1;
+    synchronized int i = 2; // should fail to compile
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9301.d b/gcc/testsuite/gdc.test/fail_compilation/fail9301.d
new file mode 100644
index 00000000000..bd7e95283f4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9301.d
@@ -0,0 +1,9 @@
+/*
+REQUIRED_ARGS: -o-
+PERMUTE_ARGS:
+*/
+
+void main()
+{
+    __vector(void[16]) x = 0x0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9346.d b/gcc/testsuite/gdc.test/fail_compilation/fail9346.d
new file mode 100644
index 00000000000..d3c7a593db2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9346.d
@@ -0,0 +1,28 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9346.d(26): Error: struct fail9346.S is not copyable because it is annotated with @disable
+fail_compilation/fail9346.d(27): Error: struct fail9346.S is not copyable because it is annotated with @disable
+---
+*/
+
+struct S
+{
+    @disable this(this);
+}
+struct SS1
+{
+    S s;
+}
+struct SS2
+{
+    S s;
+    this(this){}
+}
+
+void main()
+{
+    S s;
+    SS1 ss1 = SS1(s);
+    SS2 ss2 = SS2(s);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9368.d b/gcc/testsuite/gdc.test/fail_compilation/fail9368.d
new file mode 100644
index 00000000000..f2272c1a91e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9368.d
@@ -0,0 +1,24 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9368.d(20): Error: enum member b not represented in final switch
+---
+*/
+
+enum E
+{
+    a,
+    b
+}
+
+void main()
+{
+    alias E F;
+    F f;
+    final switch (f)
+    {
+        case F.a:
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail94.d b/gcc/testsuite/gdc.test/fail_compilation/fail94.d
new file mode 100644
index 00000000000..23fef9357cb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail94.d
@@ -0,0 +1,56 @@
+interface I
+{
+    int foo();
+}
+
+class IA : I
+{
+    int foo() { return 1; }
+}
+
+class A
+{
+    I i;
+
+    I clone() { return i; }
+}
+
+class B : A
+{
+    IA ia;
+
+    IA clone()
+    out (result)
+    {
+	printf("B.clone()\n");
+    }
+    body { return ia; }
+}
+
+void main()
+{
+    IA ia = new IA;
+    assert(ia.foo() == 1);
+
+    I i = ia;
+    assert(i.foo() == 1);
+
+    A a = new A;
+    a.i = i;
+    assert(a.clone().foo() == 1);
+
+    B b = new B;
+    b.ia = ia;
+    assert(b.clone().foo() == 1);
+
+    a = b;
+    assert(a.clone().foo() == 1);
+
+    bar(&b.clone);
+}
+
+
+void bar(IA delegate() dg)
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9413.d b/gcc/testsuite/gdc.test/fail_compilation/fail9413.d
new file mode 100644
index 00000000000..617c9950409
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9413.d
@@ -0,0 +1,85 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9413.d(45): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9413.d(32): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9413.d(33): Error: variable fail9413.foo.bar.y cannot modify parameter 'y' in contract
+fail_compilation/fail9413.d(38): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9413.d(39): Error: variable fail9413.foo.bar.y cannot modify parameter 'y' in contract
+fail_compilation/fail9413.d(40): Error: variable fail9413.foo.bar.s cannot modify result 's' in contract
+fail_compilation/fail9413.d(50): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9413.d(73): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9413.d(74): Error: variable fail9413.foo.r cannot modify result 'r' in contract
+fail_compilation/fail9413.d(58): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9413.d(59): Error: variable fail9413.foo.r cannot modify result 'r' in contract
+fail_compilation/fail9413.d(60): Error: variable fail9413.foo.baz.y cannot modify parameter 'y' in contract
+fail_compilation/fail9413.d(65): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9413.d(66): Error: variable fail9413.foo.r cannot modify result 'r' in contract
+fail_compilation/fail9413.d(67): Error: variable fail9413.foo.baz.y cannot modify parameter 'y' in contract
+fail_compilation/fail9413.d(68): Error: variable fail9413.foo.baz.s cannot modify result 's' in contract
+fail_compilation/fail9413.d(79): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9413.d(80): Error: variable fail9413.foo.r cannot modify result 'r' in contract
+---
+*/
+
+int foo(int x)
+in
+{
+    int a;
+    int bar(int y)
+    in
+    {
+        x = 10; // err
+        y = 10; // err
+        a = 1;  // OK
+    }
+    out(s)
+    {
+        x = 10; // err
+        y = 10; // err
+        s = 10; // err
+        a = 1;  // OK
+    }
+    body
+    {
+        x = 10; // err
+        y = 1;  // OK
+        a = 1;  // OK
+        return 2;
+    }
+    x = 10; // err
+}
+out(r)
+{
+    int a;
+    int baz(int y)
+    in
+    {
+        x = 10; // err
+        r = 10; // err
+        y = 10; // err
+        a = 1;  // OK
+    }
+    out(s)
+    {
+        x = 10; // err
+        r = 10; // err
+        y = 10; // err
+        s = 10; // err
+        a = 1;  // OK
+    }
+    body
+    {
+        x = 10; // err
+        r = 10; // err
+        y = 1;  // OK
+        a = 1;  // OK
+        return 2;
+    }
+    x = 10; // err
+    r = 10; // err
+}
+body
+{
+    return 1;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9414a.d b/gcc/testsuite/gdc.test/fail_compilation/fail9414a.d
new file mode 100644
index 00000000000..4fd98d3cc55
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9414a.d
@@ -0,0 +1,88 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9414a.d(47): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414a.d(34): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414a.d(35): Error: variable fail9414a.C.foo.__require.bar.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414a.d(40): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414a.d(41): Error: variable fail9414a.C.foo.__require.bar.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414a.d(42): Error: variable fail9414a.C.foo.__require.bar.s cannot modify result 's' in contract
+fail_compilation/fail9414a.d(52): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414a.d(75): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414a.d(76): Error: variable fail9414a.C.foo.__ensure.r cannot modify result 'r' in contract
+fail_compilation/fail9414a.d(60): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414a.d(61): Error: variable fail9414a.C.foo.__ensure.r cannot modify result 'r' in contract
+fail_compilation/fail9414a.d(62): Error: variable fail9414a.C.foo.__ensure.baz.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414a.d(67): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414a.d(68): Error: variable fail9414a.C.foo.__ensure.r cannot modify result 'r' in contract
+fail_compilation/fail9414a.d(69): Error: variable fail9414a.C.foo.__ensure.baz.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414a.d(70): Error: variable fail9414a.C.foo.__ensure.baz.s cannot modify result 's' in contract
+fail_compilation/fail9414a.d(81): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414a.d(82): Error: variable fail9414a.C.foo.__ensure.r cannot modify result 'r' in contract
+---
+*/
+
+class C
+{
+    int foo(int x)
+    in
+    {
+        int a;
+        int bar(int y)
+        in
+        {
+            x = 10; // err
+            y = 10; // err
+            a = 1;  // OK
+        }
+        out(s)
+        {
+            x = 10; // err
+            y = 10; // err
+            s = 10; // err
+            a = 1;  // OK
+        }
+        body
+        {
+            x = 10; // err
+            y = 1;  // OK
+            a = 1;  // OK
+            return 2;
+        }
+        x = 10; // err
+    }
+    out(r)
+    {
+        int a;
+        int baz(int y)
+        in
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 10; // err
+            a = 1;  // OK
+        }
+        out(s)
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 10; // err
+            s = 10; // err
+            a = 1;  // OK
+        }
+        body
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 1;  // OK
+            a = 1;  // OK
+            return 2;
+        }
+        x = 10; // err
+        r = 10; // err
+    }
+    body
+    {
+        return 1;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9414b.d b/gcc/testsuite/gdc.test/fail_compilation/fail9414b.d
new file mode 100644
index 00000000000..37bd12fc429
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9414b.d
@@ -0,0 +1,88 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9414b.d(47): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414b.d(34): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414b.d(35): Error: variable fail9414b.C.foo.__require.bar.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414b.d(40): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414b.d(41): Error: variable fail9414b.C.foo.__require.bar.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414b.d(42): Error: variable fail9414b.C.foo.__require.bar.s cannot modify result 's' in contract
+fail_compilation/fail9414b.d(52): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414b.d(75): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414b.d(76): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract
+fail_compilation/fail9414b.d(60): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414b.d(61): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract
+fail_compilation/fail9414b.d(62): Error: variable fail9414b.C.foo.__ensure.baz.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414b.d(67): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414b.d(68): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract
+fail_compilation/fail9414b.d(69): Error: variable fail9414b.C.foo.__ensure.baz.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414b.d(70): Error: variable fail9414b.C.foo.__ensure.baz.s cannot modify result 's' in contract
+fail_compilation/fail9414b.d(81): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414b.d(82): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract
+---
+*/
+
+class C
+{
+    final int foo(int x)
+    in
+    {
+        int a;
+        int bar(int y)
+        in
+        {
+            x = 10; // err
+            y = 10; // err
+            a = 1;  // OK
+        }
+        out(s)
+        {
+            x = 10; // err
+            y = 10; // err
+            s = 10; // err
+            a = 1;  // OK
+        }
+        body
+        {
+            x = 10; // err
+            y = 1;  // OK
+            a = 1;  // OK
+            return 2;
+        }
+        x = 10; // err
+    }
+    out(r)
+    {
+        int a;
+        int baz(int y)
+        in
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 10; // err
+            a = 1;  // OK
+        }
+        out(s)
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 10; // err
+            s = 10; // err
+            a = 1;  // OK
+        }
+        body
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 1;  // OK
+            a = 1;  // OK
+            return 2;
+        }
+        x = 10; // err
+        r = 10; // err
+    }
+    body
+    {
+        return 1;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9414c.d b/gcc/testsuite/gdc.test/fail_compilation/fail9414c.d
new file mode 100644
index 00000000000..efbff9c42f6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9414c.d
@@ -0,0 +1,88 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9414c.d(47): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414c.d(34): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414c.d(35): Error: variable fail9414c.C.foo.bar.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414c.d(40): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414c.d(41): Error: variable fail9414c.C.foo.bar.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414c.d(42): Error: variable fail9414c.C.foo.bar.s cannot modify result 's' in contract
+fail_compilation/fail9414c.d(52): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414c.d(75): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414c.d(76): Error: variable fail9414c.C.foo.r cannot modify result 'r' in contract
+fail_compilation/fail9414c.d(60): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414c.d(61): Error: variable fail9414c.C.foo.r cannot modify result 'r' in contract
+fail_compilation/fail9414c.d(62): Error: variable fail9414c.C.foo.baz.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414c.d(67): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414c.d(68): Error: variable fail9414c.C.foo.r cannot modify result 'r' in contract
+fail_compilation/fail9414c.d(69): Error: variable fail9414c.C.foo.baz.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414c.d(70): Error: variable fail9414c.C.foo.baz.s cannot modify result 's' in contract
+fail_compilation/fail9414c.d(81): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414c.d(82): Error: variable fail9414c.C.foo.r cannot modify result 'r' in contract
+---
+*/
+
+class C
+{
+    private int foo(int x)
+    in
+    {
+        int a;
+        int bar(int y)
+        in
+        {
+            x = 10; // err
+            y = 10; // err
+            a = 1;  // OK
+        }
+        out(s)
+        {
+            x = 10; // err
+            y = 10; // err
+            s = 10; // err
+            a = 1;  // OK
+        }
+        body
+        {
+            x = 10; // err
+            y = 1;  // OK
+            a = 1;  // OK
+            return 2;
+        }
+        x = 10; // err
+    }
+    out(r)
+    {
+        int a;
+        int baz(int y)
+        in
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 10; // err
+            a = 1;  // OK
+        }
+        out(s)
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 10; // err
+            s = 10; // err
+            a = 1;  // OK
+        }
+        body
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 1;  // OK
+            a = 1;  // OK
+            return 2;
+        }
+        x = 10; // err
+        r = 10; // err
+    }
+    body
+    {
+        return 1;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9414d.d b/gcc/testsuite/gdc.test/fail_compilation/fail9414d.d
new file mode 100644
index 00000000000..60b588678f6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9414d.d
@@ -0,0 +1,88 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9414d.d(47): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414d.d(34): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414d.d(35): Error: variable fail9414d.C.foo.bar.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414d.d(40): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414d.d(41): Error: variable fail9414d.C.foo.bar.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414d.d(42): Error: variable fail9414d.C.foo.bar.s cannot modify result 's' in contract
+fail_compilation/fail9414d.d(52): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414d.d(75): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414d.d(76): Error: variable fail9414d.C.foo.r cannot modify result 'r' in contract
+fail_compilation/fail9414d.d(60): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414d.d(61): Error: variable fail9414d.C.foo.r cannot modify result 'r' in contract
+fail_compilation/fail9414d.d(62): Error: variable fail9414d.C.foo.baz.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414d.d(67): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414d.d(68): Error: variable fail9414d.C.foo.r cannot modify result 'r' in contract
+fail_compilation/fail9414d.d(69): Error: variable fail9414d.C.foo.baz.y cannot modify parameter 'y' in contract
+fail_compilation/fail9414d.d(70): Error: variable fail9414d.C.foo.baz.s cannot modify result 's' in contract
+fail_compilation/fail9414d.d(81): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract
+fail_compilation/fail9414d.d(82): Error: variable fail9414d.C.foo.r cannot modify result 'r' in contract
+---
+*/
+
+class C
+{
+    static int foo(int x)
+    in
+    {
+        int a;
+        int bar(int y)
+        in
+        {
+            x = 10; // err
+            y = 10; // err
+            a = 1;  // OK
+        }
+        out(s)
+        {
+            x = 10; // err
+            y = 10; // err
+            s = 10; // err
+            a = 1;  // OK
+        }
+        body
+        {
+            x = 10; // err
+            y = 1;  // OK
+            a = 1;  // OK
+            return 2;
+        }
+        x = 10; // err
+    }
+    out(r)
+    {
+        int a;
+        int baz(int y)
+        in
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 10; // err
+            a = 1;  // OK
+        }
+        out(s)
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 10; // err
+            s = 10; // err
+            a = 1;  // OK
+        }
+        body
+        {
+            x = 10; // err
+            r = 10; // err
+            y = 1;  // OK
+            a = 1;  // OK
+            return 2;
+        }
+        x = 10; // err
+        r = 10; // err
+    }
+    body
+    {
+        return 1;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail95.d b/gcc/testsuite/gdc.test/fail_compilation/fail95.d
new file mode 100644
index 00000000000..439e55d8b1f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail95.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail95.d(19): Error: template fail95.A cannot deduce function from argument types !()(int), candidates are:
+fail_compilation/fail95.d(11):        fail95.A(alias T)(T)
+---
+*/
+
+// Issue 142 - Assertion failure: '0' on line 610 in file 'template.c'
+
+template A(alias T)
+{
+    void A(T) { T = 2; }
+}
+
+void main()
+{
+    int i;
+    A(i);
+    assert(i == 2);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9537.d b/gcc/testsuite/gdc.test/fail_compilation/fail9537.d
new file mode 100644
index 00000000000..bf6e4db60b6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9537.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9537.d(26): Error: foo(tuple(1, 2)) is not an lvalue
+---
+*/
+
+struct Tuple(T...)
+{
+    T field;
+    alias field this;
+}
+
+Tuple!T tuple(T...)(T args)
+{
+    return Tuple!T(args);
+}
+
+auto ref foo(T)(auto ref T t)
+{
+    return t[0];    // t[0] is deduced to non-ref
+}
+
+void main()
+{
+    int* p = &foo(tuple(1, 2));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9562.d b/gcc/testsuite/gdc.test/fail_compilation/fail9562.d
new file mode 100644
index 00000000000..46aafee6094
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9562.d
@@ -0,0 +1,22 @@
+/*
+REQUIRED_ARGS: -o-
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/fail9562.d(17): Error: int[] is not an expression
+fail_compilation/fail9562.d(18): Error: no property 'reverse' for type 'int[]'
+fail_compilation/fail9562.d(19): Error: no property 'sort' for type 'int[]'
+fail_compilation/fail9562.d(20): Error: no property 'dup' for type 'int[]'
+fail_compilation/fail9562.d(21): Error: no property 'idup' for type 'int[]'
+---
+*/
+
+void main()
+{
+    alias A = int[];
+    auto len  = A.length;
+    auto rev  = A.reverse;
+    auto sort = A.sort;
+    auto dup  = A.dup;
+    auto idup = A.idup;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9572.d b/gcc/testsuite/gdc.test/fail_compilation/fail9572.d
new file mode 100644
index 00000000000..a5602ff23f3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9572.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9572.d(10): Error: index type 'ubyte' cannot cover index range 0..300
+---
+*/
+
+void main() {
+    int[300] data;
+    foreach (ubyte i, x; data) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail96.d b/gcc/testsuite/gdc.test/fail_compilation/fail96.d
new file mode 100644
index 00000000000..1bdc8417b6f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail96.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail96.d(21): Error: template instance foo!long foo is not a template declaration, it is a function alias
+---
+*/
+
+// 153
+
+template bar(T)
+{
+    void foo() {}
+}
+
+alias bar!(long).foo foo;
+alias bar!(char).foo foo;
+
+
+void main()
+{
+    foo!(long);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9613.d b/gcc/testsuite/gdc.test/fail_compilation/fail9613.d
new file mode 100644
index 00000000000..18a18cc3d85
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9613.d
@@ -0,0 +1,6 @@
+// PREMUTE_ARGS:
+
+void main()
+{
+    auto x = const byte.init;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9665a.d b/gcc/testsuite/gdc.test/fail_compilation/fail9665a.d
new file mode 100644
index 00000000000..27eb8d8b1f4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9665a.d
@@ -0,0 +1,166 @@
+// REQUIRED_ARGS:
+// PERMUTE_ARGS:
+
+/***************************************************/
+// immutable field
+
+/+
+TEST_OUTPUT:
+---
+fail_compilation/fail9665a.d(19): Error: immutable field 'v' initialized multiple times
+---
++/
+struct S1A
+{
+    immutable int v;
+    this(int)
+    {
+        v = 1;
+        v = 2;  // multiple initialization
+    }
+}
+
+/+
+TEST_OUTPUT:
+---
+fail_compilation/fail9665a.d(37): Error: immutable field 'v' initialized multiple times
+fail_compilation/fail9665a.d(42): Error: immutable field 'v' initialized multiple times
+fail_compilation/fail9665a.d(47): Error: immutable field 'v' initialized multiple times
+---
++/
+struct S1B
+{
+    immutable int v;
+    this(int)
+    {
+        if (true) v = 1; else v = 2;
+        v = 3;  // multiple initialization
+    }
+    this(long)
+    {
+        if (true) v = 1;
+        v = 3;  // multiple initialization
+    }
+    this(string)
+    {
+        if (true) {} else v = 2;
+        v = 3;  // multiple initialization
+    }
+}
+
+/+
+TEST_OUTPUT:
+---
+fail_compilation/fail9665a.d(65): Error: immutable field 'v' initialized multiple times
+fail_compilation/fail9665a.d(70): Error: immutable field 'v' initialized multiple times
+fail_compilation/fail9665a.d(75): Error: immutable field 'v' initialized multiple times
+---
++/
+struct S1C
+{
+    immutable int v;
+    this(int)
+    {
+        true ? (v = 1) : (v = 2);
+        v = 3;  // multiple initialization
+    }
+    this(long)
+    {
+        auto x = true ? (v = 1) : 2;
+        v = 3;  // multiple initialization
+    }
+    this(string)
+    {
+        auto x = true ? 1 : (v = 2);
+        v = 3;  // multiple initialization
+    }
+}
+
+/***************************************************/
+// with control flow
+
+/+
+TEST_OUTPUT:
+---
+fail_compilation/fail9665a.d(98): Error: immutable field 'v' initialization is not allowed in loops or after labels
+fail_compilation/fail9665a.d(103): Error: immutable field 'v' initialization is not allowed in loops or after labels
+fail_compilation/fail9665a.d(108): Error: immutable field 'v' initialized multiple times
+fail_compilation/fail9665a.d(113): Error: immutable field 'v' initialized multiple times
+fail_compilation/fail9665a.d(118): Error: immutable field 'v' initialized multiple times
+---
++/
+struct S2
+{
+    immutable int v;
+    this(int)
+    {
+    L:
+        v = 1;  // after labels
+    }
+    this(long)
+    {
+        foreach (i; 0..1)
+            v = 1;  // in loops
+    }
+    this(string)
+    {
+        v = 1;  // initialization
+    L:  v = 2;  // assignment after labels
+    }
+    this(wstring)
+    {
+        v = 1;  // initialization
+        foreach (i; 0..1) v = 2;  // assignment in loops
+    }
+    this(dstring)
+    {
+        v = 1; return;
+        v = 2;  // multiple initialization
+    }
+}
+
+/***************************************************/
+// with immutable constructor
+
+/+
+TEST_OUTPUT:
+---
+fail_compilation/fail9665a.d(139): Error: immutable field 'v' initialized multiple times
+fail_compilation/fail9665a.d(143): Error: immutable field 'w' initialized multiple times
+---
++/
+struct S3
+{
+    int v;
+    int w;
+    this(int) immutable
+    {
+        v = 1;
+        v = 2;  // multiple initialization
+
+        if (true)
+            w = 1;
+        w = 2;  // multiple initialization
+    }
+}
+
+/***************************************************/
+// in __traits(compiles)
+
+/+
+TEST_OUTPUT:
+---
+fail_compilation/fail9665a.d(163): Error: static assert  (__traits(compiles, this.v = 1)) is false
+---
++/
+struct S4
+{
+    immutable int v;
+    this(int)
+    {
+        static assert(__traits(compiles, v = 1));
+        v = 1;
+        static assert(__traits(compiles, v = 1)); // multiple initialization
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9665b.d b/gcc/testsuite/gdc.test/fail_compilation/fail9665b.d
new file mode 100644
index 00000000000..0fcc1d25fc1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9665b.d
@@ -0,0 +1,77 @@
+/***************************************************/
+// with disable this() struct
+
+struct X
+{
+    @disable this();
+
+    this(int) {}
+}
+
+/+
+TEST_OUTPUT:
+---
+fail_compilation/fail9665b.d(32): Error: one path skips field x2
+fail_compilation/fail9665b.d(33): Error: one path skips field x3
+fail_compilation/fail9665b.d(35): Error: one path skips field x5
+fail_compilation/fail9665b.d(36): Error: one path skips field x6
+fail_compilation/fail9665b.d(30): Error: field x1 must be initialized in constructor
+fail_compilation/fail9665b.d(30): Error: field x4 must be initialized in constructor
+---
++/
+struct S1
+{
+    X x1;
+    X x2;
+    X x3;
+    X[2] x4;
+    X[2] x5;
+    X[2] x6;
+    this(int)
+    {
+        if (true) x2 = X(1);
+        auto n = true ? (x3 = X(1), 1) : 2;
+
+        if (true) x5 = X(1);
+        auto m = true ? (x6 = X(1), 1) : 2;
+    }
+}
+
+/***************************************************/
+// with nested struct
+
+/+
+TEST_OUTPUT:
+---
+fail_compilation/fail9665b.d(65): Error: one path skips field x2
+fail_compilation/fail9665b.d(66): Error: one path skips field x3
+fail_compilation/fail9665b.d(68): Error: one path skips field x5
+fail_compilation/fail9665b.d(69): Error: one path skips field x6
+fail_compilation/fail9665b.d(63): Error: field x1 must be initialized in constructor, because it is nested struct
+fail_compilation/fail9665b.d(63): Error: field x4 must be initialized in constructor, because it is nested struct
+fail_compilation/fail9665b.d(76): Error: template instance fail9665b.S2!(X) error instantiating
+---
++/
+struct S2(X)
+{
+    X x1;
+    X x2;
+    X x3;
+    X[2] x4;
+    X[2] x5;
+    X[2] x6;
+    this(X x)
+    {
+        if (true) x2 = x;
+        auto a = true ? (x3 = x, 1) : 2;
+
+        if (true) x5 = x;
+        auto b = true ? (x6 = x, 1) : 2;
+    }
+}
+void test2()
+{
+    struct X { this(int) {} }
+    static assert(X.tupleof.length == 1);
+    S2!(X) s = X(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail97.d b/gcc/testsuite/gdc.test/fail_compilation/fail97.d
new file mode 100644
index 00000000000..b79ad3d67aa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail97.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail97.d(11): Error: pragma lib pragma is missing closing ';'
+---
+*/
+
+// 151
+
+import std.stdio;
+pragma(lib,"ws2_32.lib")//;
+class bla{}
+void main(){}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9710.d b/gcc/testsuite/gdc.test/fail_compilation/fail9710.d
new file mode 100644
index 00000000000..98306b26cac
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9710.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9710.d(9): Error: static variable e cannot be read at compile time
+---
+*/
+
+int* e;
+enum v = e[1];
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9735.d b/gcc/testsuite/gdc.test/fail_compilation/fail9735.d
new file mode 100644
index 00000000000..42dbfdce30f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9735.d
@@ -0,0 +1,12 @@
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/fail9735.d(10): Deprecation: casting from void delegate() to void* is deprecated
+---
+*/
+
+void* dg2ptr(void delegate() dg) {
+    return cast(void*) dg;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9773.d b/gcc/testsuite/gdc.test/fail_compilation/fail9773.d
new file mode 100644
index 00000000000..18da406beaa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9773.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9773.d(7): Error: "" is not an lvalue
+---
+*/
+void f(ref string a = "")
+{
+    a = "crash and burn";
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9790.d b/gcc/testsuite/gdc.test/fail_compilation/fail9790.d
new file mode 100644
index 00000000000..081cf2ccee4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9790.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9790.d(13): Error: undefined identifier '_Unused_'
+fail_compilation/fail9790.d(20): Error: template instance fail9790.foo!() error instantiating
+fail_compilation/fail9790.d(18): Error: undefined identifier '_Unused_'
+fail_compilation/fail9790.d(21): Error: template instance fail9790.bar!() error instantiating
+---
+*/
+
+template foo()
+{
+    enum bool _foo = _Unused_._unused_;
+    enum bool foo = _foo;
+}
+template bar()
+{
+    enum bool bar = _Unused_._unused_;
+}
+alias Foo = foo!();
+alias Bar = bar!();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail98.d b/gcc/testsuite/gdc.test/fail_compilation/fail98.d
new file mode 100644
index 00000000000..1e6b1476805
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail98.d
@@ -0,0 +1,36 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail98.d(17): Error: cannot implicitly convert expression (256) of type int to E
+---
+*/
+
+// 139
+
+E foo(int index)
+{
+    return index + 256;
+}
+
+enum : E
+{
+    D3DTS_WORLD = 256,
+    D3DTS_WORLD1,
+    D3DTS_WORLD2,
+    D3DTS_WORLD3
+}
+
+enum E
+{
+    D3DTS_VIEW         =  2,
+    D3DTS_PROJECTION,
+    D3DTS_TEXTURE0     = 16,
+    D3DTS_TEXTURE1,
+    D3DTS_TEXTURE2,
+    D3DTS_TEXTURE3,
+    D3DTS_TEXTURE4,
+    D3DTS_TEXTURE5,
+    D3DTS_TEXTURE6,
+    D3DTS_TEXTURE7, // = 23
+    D3DTS_FORCE_DWORD  = 0xffffffff
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9891.d b/gcc/testsuite/gdc.test/fail_compilation/fail9891.d
new file mode 100644
index 00000000000..99d5f11f019
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9891.d
@@ -0,0 +1,26 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9891.d(13): Error: cast(int)i is not an lvalue
+fail_compilation/fail9891.d(18): Error: cast(int)i is not an lvalue
+fail_compilation/fail9891.d(23): Error: prop() is not an lvalue
+---
+*/
+
+immutable int i;
+int prop() { return 0; }
+
+void f1(ref int n = i)
+{
+    ++n;
+}
+
+void f2(out int n = i)
+{
+    ++n;
+}
+
+void f3(ref int n = prop)
+{
+    ++n;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9892.d b/gcc/testsuite/gdc.test/fail_compilation/fail9892.d
new file mode 100644
index 00000000000..32eef128d20
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9892.d
@@ -0,0 +1,13 @@
+// 9892
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9892.d(11): Error: enum member fail9892.a circular reference to enum member
+---
+*/
+
+enum
+{
+    a = b, //Segfault!
+    b
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail99.d b/gcc/testsuite/gdc.test/fail_compilation/fail99.d
new file mode 100644
index 00000000000..da87ed66acb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail99.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail99.d(12): Error: delegate dg (int) is not callable using argument types ()
+---
+*/
+
+//import std.stdio;
+
+void foo(void delegate(int) dg)
+{
+    dg();
+    //writefln("%s", dg(3));
+}
+
+void main()
+{
+    foo(delegate(int i)
+        {
+            //writefln("i = %d\n", i);
+        }
+       );
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail9936.d b/gcc/testsuite/gdc.test/fail_compilation/fail9936.d
new file mode 100644
index 00000000000..36178f48c21
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail9936.d
@@ -0,0 +1,31 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail9936.d(25): Error: S().opBinary isn't a template
+fail_compilation/fail9936.d(26): Error: S().opBinaryRight isn't a template
+fail_compilation/fail9936.d(27): Error: S().opOpAssign isn't a template
+fail_compilation/fail9936.d(29): Error: S().opIndexUnary isn't a template
+fail_compilation/fail9936.d(30): Error: S().opUnary isn't a template
+---
+*/
+struct S
+{
+    auto opBinary(S s) { return 1; }
+    auto opBinaryRight(int n) { return 1; }
+    auto opOpAssign(S s) { return 1; }
+
+    auto opIndexUnary(S s) { return 1; }
+    auto opUnary(S s) { return 1; }
+}
+void main()
+{
+    static assert(!is(typeof( S() + S() )));
+    static assert(!is(typeof( 100 + S() )));
+    static assert(!is(typeof( S() += S() )));
+    S() + S();
+    100 + S();
+    S() += S();
+
+    +S()[0];
+    +S();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_arrayop1.d b/gcc/testsuite/gdc.test/fail_compilation/fail_arrayop1.d
new file mode 100644
index 00000000000..5aedbd14d41
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail_arrayop1.d
@@ -0,0 +1,150 @@
+// REQUIRED_ARGS: -o-
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop1.d(11): Error: invalid array operation a + a (possible missing [])
+---
+*/
+void test2199(int[] a)  // Issue 2199 - Segfault using array operation in function call (from fail266.d)
+{
+    test2199(a + a);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop1.d(29): Error: invalid array operation -a (possible missing [])
+---
+*/
+void fail323()      // from fail323.d, maybe was a part of issue 3471 fix?
+{
+    void foo(double[]) {}
+
+    auto a = new double[10],
+         b = a.dup,
+         c = a.dup,
+         d = a.dup;
+
+    foo(-a);
+    // a[] = -(b[] * (c[] + 4)) + 5 * d[]; // / 3;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop1.d(54): Error: invalid array operation -a (possible missing [])
+fail_compilation/fail_arrayop1.d(55): Error: invalid array operation ~a (possible missing [])
+fail_compilation/fail_arrayop1.d(56): Error: invalid array operation a + a (possible missing [])
+fail_compilation/fail_arrayop1.d(57): Error: invalid array operation a - a (possible missing [])
+fail_compilation/fail_arrayop1.d(58): Error: invalid array operation a * a (possible missing [])
+fail_compilation/fail_arrayop1.d(59): Error: invalid array operation a / a (possible missing [])
+fail_compilation/fail_arrayop1.d(60): Error: invalid array operation a % a (possible missing [])
+fail_compilation/fail_arrayop1.d(61): Error: invalid array operation a ^^ a (possible missing [])
+fail_compilation/fail_arrayop1.d(62): Error: invalid array operation a & a (possible missing [])
+fail_compilation/fail_arrayop1.d(63): Error: invalid array operation a | a (possible missing [])
+fail_compilation/fail_arrayop1.d(64): Error: invalid array operation a ^ a (possible missing [])
+---
+*/
+void test3903()
+{
+    int[] a = [1, 2];
+    int[] r;
+
+    r = -a;
+    r = ~a;
+    r = a + a;
+    r = a - a;
+    r = a * a;
+    r = a / a;
+    r = a % a;
+    r = a ^^ a;
+    r = a & a;
+    r = a | a;
+    r = a ^ a;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop1.d(85): Error: invalid array operation a += a[] (possible missing [])
+fail_compilation/fail_arrayop1.d(86): Error: invalid array operation a -= a[] (possible missing [])
+fail_compilation/fail_arrayop1.d(87): Error: invalid array operation a *= a[] (possible missing [])
+fail_compilation/fail_arrayop1.d(88): Error: invalid array operation a /= a[] (possible missing [])
+fail_compilation/fail_arrayop1.d(89): Error: invalid array operation a %= a[] (possible missing [])
+fail_compilation/fail_arrayop1.d(90): Error: invalid array operation a ^= a[] (possible missing [])
+fail_compilation/fail_arrayop1.d(91): Error: invalid array operation a &= a[] (possible missing [])
+fail_compilation/fail_arrayop1.d(92): Error: invalid array operation a |= a[] (possible missing [])
+fail_compilation/fail_arrayop1.d(93): Error: invalid array operation a ^^= a[] (possible missing [])
+---
+*/
+void test9459()
+{
+    int[] a = [1, 2, 3];
+
+    a += a[];
+    a -= a[];
+    a *= a[];
+    a /= a[];
+    a %= a[];
+    a ^= a[];
+    a &= a[];
+    a |= a[];
+    a ^^= a[];
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop1.d(111): Error: invalid array operation 'x1[] = x2[] * x3[]' because X doesn't support necessary arithmetic operations
+fail_compilation/fail_arrayop1.d(115): Error: invalid array operation 's2[] += s1[]' because string is not a scalar type
+fail_compilation/fail_arrayop1.d(119): Error: invalid array operation 'pa1[] *= pa2[]' for element type int*
+---
+*/
+void test11376()
+{
+    struct X { }
+
+    auto x1 = [X()];
+    auto x2 = [X()];
+    auto x3 = [X()];
+    x1[] = x2[] * x3[];
+
+    string[] s1;
+    string[] s2;
+    s2[] += s1[];
+
+    int*[] pa1;
+    int*[] pa2;
+    pa1[] *= pa2[];
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop1.d(131): Error: invalid array operation a[] <<= 1 (possible missing [])
+---
+*/
+void test11566()
+{
+    int[] a;
+    a[] <<= 1;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop1.d(147): Error: invalid array operation a + b (possible missing [])
+fail_compilation/fail_arrayop1.d(148): Error: invalid array operation x + y (possible missing [])
+fail_compilation/fail_arrayop1.d(149): Error: invalid array operation "hel" + "lo." (possible missing [])
+---
+*/
+void test14649()
+{
+    char[] a, b, r;
+    string x, y;
+
+    r[] = a + b;
+    r[] = x + y;
+    r[] = "hel" + "lo.";
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_arrayop2.d b/gcc/testsuite/gdc.test/fail_compilation/fail_arrayop2.d
new file mode 100644
index 00000000000..a13f0cac8c9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail_arrayop2.d
@@ -0,0 +1,356 @@
+// REQUIRED_ARGS: -o-
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop2.d(12): Error: array operation [1, 2, 3] - [1, 2, 3] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(15): Error: invalid array operation "a" - "b" (possible missing [])
+---
+*/
+void test2603() // Issue 2603 - ICE(cgcs.c) on subtracting string literals
+{
+    auto c1 = [1,2,3] - [1,2,3];
+
+    // this variation is wrong code on D2, ICE ..\ztc\cgcs.c 358 on D1.
+    string c2 = "a" - "b";
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop2.d(37): Error: array operation -a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(38): Error: array operation ~a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(40): Error: array operation a[] + a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(41): Error: array operation a[] - a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(42): Error: array operation a[] * a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(43): Error: array operation a[] / a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(44): Error: array operation a[] % a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(45): Error: array operation a[] ^ a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(46): Error: array operation a[] & a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(47): Error: array operation a[] | a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(48): Error: array operation a[] ^^ a[] without destination memory not allowed (possible missing [])
+---
+*/
+void test9459()
+{
+    int[] a = [1, 2, 3];
+    a = -a[];
+    a = ~a[];
+
+    a = a[] + a[];
+    a = a[] - a[];
+    a = a[] * a[];
+    a = a[] / a[];
+    a = a[] % a[];
+    a = a[] ^ a[];
+    a = a[] & a[];
+    a = a[] | a[];
+    a = a[] ^^ a[];
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop2.d(74): Error: array operation a[] + a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(75): Error: array operation a[] - a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(76): Error: array operation a[] * a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(77): Error: array operation a[] / a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(78): Error: array operation a[] % a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(79): Error: array operation a[] ^ a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(80): Error: array operation a[] & a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(81): Error: array operation a[] | a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(82): Error: array operation a[] ^^ 10 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(83): Error: array operation -a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(84): Error: array operation ~a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(89): Error: array operation [1] + a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(90): Error: array operation [1] + a[] without destination memory not allowed
+---
+*/
+void test12179()
+{
+    void foo(int[]) {}
+    int[1] a;
+
+    foo(a[] + a[]);
+    foo(a[] - a[]);
+    foo(a[] * a[]);
+    foo(a[] / a[]);
+    foo(a[] % a[]);
+    foo(a[] ^ a[]);
+    foo(a[] & a[]);
+    foo(a[] | a[]);
+    foo(a[] ^^ 10);
+    foo(-a[]);
+    foo(~a[]);
+
+    // from issue 11992
+    int[]   arr1;
+    int[][] arr2;
+    arr1 ~= [1] + a[];         // NG
+    arr2 ~= [1] + a[];         // NG
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop2.d(104): Error: array operation h * y[] without destination memory not allowed
+---
+*/
+void test12381()
+{
+    double[2] y;
+    double h;
+
+    double[2] temp1 = cast(double[2])(h * y[]);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop2.d(117): Error: array operation -a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(119): Error: array operation (-a[])[0..4] without destination memory not allowed
+---
+*/
+float[] test12769(float[] a)
+{
+    if (a.length < 4)
+        return -a[];
+    else
+        return (-a[])[0..4];
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop2.d(136): Error: array operation a[] - a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(138): Error: array operation a[] - a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(139): Error: array operation a[] - a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(142): Error: array operation a[] - a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(144): Error: array operation a[] - a[] without destination memory not allowed
+---
+*/
+void test13208()
+{
+    int[] a;
+
+    auto arr = [a[] - a[]][0];
+
+    auto aa1 = [1 : a[] - a[]];
+    auto aa2 = [a[] - a[] : 1];
+
+    struct S { int[] a; }
+    auto s = S(a[] - a[]);
+
+    auto n = int(a[] - a[]);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop2.d(159): Error: array operation a[] * a[] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(160): Error: array operation (a[] * a[])[0..1] without destination memory not allowed
+fail_compilation/fail_arrayop2.d(163): Error: array operation a[] * a[] without destination memory not allowed (possible missing [])
+fail_compilation/fail_arrayop2.d(164): Error: array operation (a[] * a[])[0..1] without destination memory not allowed (possible missing [])
+---
+*/
+void test13497()
+{
+    int[1] a;
+    auto b1 = (a[] * a[])[];
+    auto b2 = (a[] * a[])[0..1];
+
+    int[] c;
+    c = (a[] * a[])[];
+    c = (a[] * a[])[0..1];
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop2.d(180): Error: array operation data[segmentId][28..29] & cast(ubyte)(1 << 0) without destination memory not allowed
+---
+*/
+void test13910()
+{
+    ubyte[][] data;
+    size_t segmentId;
+
+    bool isGroup()
+    {
+        return !!((data[segmentId][28..29]) & (1 << 0));
+    }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop2.d(245): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(246): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(247): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(252): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(255): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(264): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(267): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(268): Error: array operation "abc"[] + '\x01' without destination memory not allowed
+fail_compilation/fail_arrayop2.d(271): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(274): Error: ([1] * 6)[0..2] is not an lvalue
+fail_compilation/fail_arrayop2.d(277): Error: can only * a pointer, not a 'int[]'
+fail_compilation/fail_arrayop2.d(280): Error: [1] * 6 is not an lvalue
+fail_compilation/fail_arrayop2.d(283): Error: array operation da[] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(286): Error: array operation da[] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(289): Error: [1] * 6 is not an lvalue
+fail_compilation/fail_arrayop2.d(290): Error: invalid array operation '[1] * 6 -= 1' for element type int
+fail_compilation/fail_arrayop2.d(293): Error: [1] * 6 is not an lvalue
+fail_compilation/fail_arrayop2.d(294): Error: ([1] * 6)[] is not an lvalue
+fail_compilation/fail_arrayop2.d(297): Error: invalid array operation '[1] * 6 += 1' for element type int
+fail_compilation/fail_arrayop2.d(298): Error: invalid array operation '[1] * 6 *= 2' for element type int
+fail_compilation/fail_arrayop2.d(299): Error: invalid array operation '[1] * 6 ^^= 3' for element type int
+fail_compilation/fail_arrayop2.d(302): Error: [1] * 6 is not an lvalue
+fail_compilation/fail_arrayop2.d(303): Error: [1] * 6 is not an lvalue
+fail_compilation/fail_arrayop2.d(306): Error: '[1] * 6' is not of integral type, it is a int[]
+fail_compilation/fail_arrayop2.d(307): Error: '[1] * 6' is not of integral type, it is a int[]
+fail_compilation/fail_arrayop2.d(308): Error: '[1] * 6' is not of integral type, it is a int[]
+fail_compilation/fail_arrayop2.d(311): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(312): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(315): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(316): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(317): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(320): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(320): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(320): Error: array operation [1] * 6 without destination memory not allowed
+---
+*/
+// Test all expressions, which can take arrays as their operands but cannot be a part of array operation.
+void test15407exp()
+{
+    struct S { int[] a; }
+    void f(int[] a) {}
+
+    int[] da;
+    int[6] sa;
+
+    { auto r = [[1] * 6]; }     // ArrayLiteralExp
+    { auto r = [[1] * 6 :
+                [1] * 6]; }     // AssocArrayLiteralExp
+
+    //TupleExp
+
+    // StructLiteralExp.elements <- preFunctionParameters in CallExp
+    { auto r = S([1] * 6); }
+
+    // NewExp.newargs/arguments <- preFunctionParameters
+    { auto r = new S([1] * 6); }
+
+    // TODO: TypeidExp
+    //auto ti = typeid([1] * 6);
+    //auto foo(T)(T t) {}
+    //foo(typeid([1] * 6));
+    //auto a = [typeid([1] * 6)];
+
+    // CommaExp.e1
+    { auto r = ([1] * 6, 1); }
+
+    // AssertExp
+    assert([1] * 6,
+           cast(char)1 + "abc"[]);
+
+    // CallExp.arguments <- preFunctionParameters
+    f([1] * 6);
+
+    // AddrExp, if a CT-known length slice can become an TypeSarray lvalue in the future.
+    { auto r = &(([1] * 6)[0..2]); }
+
+    // PtrExp, *([1] * 6).ptr is also invalid -> show better diagnostic
+    { auto r = *([1] * 6); }
+
+    // DeleteExp - e1
+    delete ([1] * 6);
+
+    // TypeDArray.dotExp, cannot check in ArrayLengthExp.semantic()
+    { auto r = (6 * da[]).length; }
+
+    // IndexExp - e1
+    { auto x1 = (da[] * 6)[1]; }
+
+    // Pre, PostExp - e1
+    ([1] * 6)++;
+    --([1] * 6);
+
+    // AssignExp e1
+    ([1] * 6) = 10;
+    ([1] * 6)[] = 10;
+
+    // BinAssignExp e1
+    ([1] * 6) += 1;
+    ([1] * 6)[] *= 2;
+    ([1] * 6)[] ^^= 3;
+
+    // CatExp e1
+    ([1] * 6) ~= 1;
+    ([1] * 6)[] ~= 2;
+
+    // Shl, Shr, UshrExp - e1, e2 --> checkIntegralBin
+    { auto r = ([1] * 6) << 1; }
+    { auto r = ([1] * 6) >> 1; }
+    { auto r = ([1] * 6) >>> 1; }
+
+    // AndAnd, OrOrExp - e1, e2
+    { auto r = sa[0..5] && [1] * 6; }
+    { auto r = sa[0..5] || [1] * 6; }
+
+    // Cmp, Equal, IdentityExp - e1, e2
+    { auto r = sa[0..5] <= [1] * 6; }
+    { auto r = sa[0..5] == [1] * 6; }
+    { auto r = sa[0..5] is [1] * 6; }
+
+    // CondExp - econd, e1, e2
+    { auto r = [1] * 6 ? [1] * 6 : [1] * 6; }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_arrayop2.d(341): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(344): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(347): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(348): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(349): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(352): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(355): Error: array operation [1] * 6 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(358): Error: array operation "str"[] + cast(immutable(char))1 without destination memory not allowed
+fail_compilation/fail_arrayop2.d(366): Error: CTFE internal error: non-constant value "uvt"[]
+---
+*/
+// Test all statements, which can take arrays as their operands.
+void test15407stmt()
+{
+    // ExpStatement - exp
+    [1] * 6;
+
+    // DoStatement - condition
+    do {} while ([1] * 6);
+
+    // ForStatement - condition, increment
+    for ([1] * 6;       // init == ExpStatement
+         [1] * 6;
+         [1] * 6) {}
+
+    // ForeachStatement - aggr -> lowered to ForStatement
+    foreach (e; [1] * 6) {}
+
+    // IfStatement condition
+    if ([1] * 6) {}
+
+    // SwitchStatement - condition
+    switch ("str"[] + 1)
+    {
+        case "tus":         break;
+        default:            break;
+    }
+    // CaseStatement - exp
+    switch ("tus")
+    {
+        case "uvt"[] - 1:   break;
+        default:            break;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_casting.d b/gcc/testsuite/gdc.test/fail_compilation/fail_casting.d
new file mode 100644
index 00000000000..2459b635e0b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail_casting.d
@@ -0,0 +1,223 @@
+// REQUIRED_ARGS: -o-
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(12): Error: cannot cast expression x of type short[2] to int[2] because of different sizes
+---
+*/
+void test3133()
+{
+    short[2] x = [1, 2];
+    auto y = cast(int[2])x;     // error
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(28): Error: cannot cast expression null of type typeof(null) to S1
+fail_compilation/fail_casting.d(29): Error: cannot cast expression null of type typeof(null) to S2
+fail_compilation/fail_casting.d(30): Error: cannot cast expression s1 of type S1 to typeof(null)
+fail_compilation/fail_casting.d(31): Error: cannot cast expression s2 of type S2 to typeof(null)
+---
+*/
+void test9904()
+{
+    static struct S1 { size_t m; }
+    static struct S2 { size_t m; byte b; }
+    { auto x = cast(S1)null; }
+    { auto x = cast(S2)null; }
+    { S1 s1; auto x = cast(typeof(null))s1; }
+    { S2 s2; auto x = cast(typeof(null))s2; }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(46): Error: cannot cast expression x of type Object[] to object.Object
+fail_compilation/fail_casting.d(47): Error: cannot cast expression x of type Object[2] to object.Object
+fail_compilation/fail_casting.d(49): Error: cannot cast expression x of type object.Object to Object[]
+fail_compilation/fail_casting.d(50): Error: cannot cast expression x of type object.Object to Object[2]
+---
+*/
+void test10646()
+{
+    // T[] or T[n] --> Tclass
+    { Object[]  x; auto y = cast(Object)x; }
+    { Object[2] x; auto y = cast(Object)x; }
+    // T[] or T[n] <-- Tclass
+    { Object x; auto y = cast(Object[] )x; }
+    { Object x; auto y = cast(Object[2])x; }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(69): Error: cannot cast expression x of type int[1] to int
+fail_compilation/fail_casting.d(70): Error: cannot cast expression x of type int to int[1]
+fail_compilation/fail_casting.d(71): Error: cannot cast expression x of type float[1] to int
+fail_compilation/fail_casting.d(72): Error: cannot cast expression x of type int to float[1]
+fail_compilation/fail_casting.d(75): Error: cannot cast expression x of type int[] to int
+fail_compilation/fail_casting.d(76): Error: cannot cast expression x of type int to int[]
+fail_compilation/fail_casting.d(77): Error: cannot cast expression x of type float[] to int
+fail_compilation/fail_casting.d(78): Error: cannot cast expression x of type int to float[]
+---
+*/
+void test11484()
+{
+    // Tsarray <--> integer
+    { int[1]   x; auto y = cast(int     ) x; }
+    { int      x; auto y = cast(int[1]  ) x; }
+    { float[1] x; auto y = cast(int     ) x; }
+    { int      x; auto y = cast(float[1]) x; }
+
+    // Tarray <--> integer
+    { int[]   x; auto y = cast(int    ) x; }
+    { int     x; auto y = cast(int[]  ) x; }
+    { float[] x; auto y = cast(int    ) x; }
+    { int     x; auto y = cast(float[]) x; }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(97): Error: cannot cast expression x of type int to fail_casting.test11485.C
+fail_compilation/fail_casting.d(98): Error: cannot cast expression x of type int to fail_casting.test11485.I
+fail_compilation/fail_casting.d(101): Error: cannot cast expression x of type fail_casting.test11485.C to int
+fail_compilation/fail_casting.d(102): Error: cannot cast expression x of type fail_casting.test11485.I to int
+---
+*/
+
+void test11485()
+{
+    class C {}
+    interface I {}
+
+    // 11485 TypeBasic --> Tclass
+    { int x; auto y = cast(C)x; }
+    { int x; auto y = cast(I)x; }
+
+    //  7472 TypeBasic <-- Tclass
+    { C x; auto y = cast(int)x; }
+    { I x; auto y = cast(int)x; }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(114): Error: cannot cast expression x of type typeof(null) to int[2]
+fail_compilation/fail_casting.d(115): Error: cannot cast expression x of type int[2] to typeof(null)
+---
+*/
+void test8179()
+{
+    { typeof(null) x; auto y = cast(int[2])x; }
+    { int[2] x;       auto y = cast(typeof(null))x; }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(128): Error: cannot cast expression x of type S to int*
+fail_compilation/fail_casting.d(130): Error: cannot cast expression x of type void* to S
+---
+*/
+void test13959()
+{
+    struct S { int* p; }
+    { S     x; auto y = cast(int*)x; }
+    { int*  x; auto y = cast(S)x; }     // no error so it's rewritten as: S(x)
+    { void* x; auto y = cast(S)x; }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(144): Error: cannot cast expression mi.x of type int to MyUbyte14154
+---
+*/
+struct MyUbyte14154 { ubyte x; alias x this; }
+struct MyInt14154   {   int x; alias x this; }
+void test14154()
+{
+    MyInt14154 mi;
+    ubyte t = cast(MyUbyte14154)mi;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(179): Error: cannot cast expression __tup$n$.__expand_field_0 of type int to object.Object
+fail_compilation/fail_casting.d(179): Error: cannot cast expression __tup$n$.__expand_field_1 of type int to object.Object
+---
+*/
+alias TypeTuple14093(T...) = T;
+struct Tuple14093(T...)
+{
+    static if (T.length == 4)
+    {
+        alias Types = TypeTuple14093!(T[0], T[2]);
+
+        Types expand;
+
+        @property ref inout(Tuple14093!Types) _Tuple_super() inout @trusted
+        {
+            return *cast(typeof(return)*) &(expand[0]);
+        }
+        alias _Tuple_super this;
+    }
+    else
+    {
+        alias Types = T;
+        Types expand;
+        alias expand this;
+    }
+}
+void test14093()
+{
+    Tuple14093!(int, "x", int, "y") point;
+    auto newPoint = cast(Object)(point);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(192): Error: cannot cast expression p of type void* to char[]
+fail_compilation/fail_casting.d(193): Error: cannot cast expression p of type void* to char[2]
+---
+*/
+void test14596()
+{
+    void* p = null;
+    auto arr = cast(char[])p;
+    char[2] sarr = cast(char[2])p;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting.d(217): Error: cannot cast expression c of type fail_casting.test14629.C to typeof(null)
+fail_compilation/fail_casting.d(218): Error: cannot cast expression p of type int* to typeof(null)
+fail_compilation/fail_casting.d(219): Error: cannot cast expression da of type int[] to typeof(null)
+fail_compilation/fail_casting.d(220): Error: cannot cast expression aa of type int[int] to typeof(null)
+fail_compilation/fail_casting.d(221): Error: cannot cast expression fp of type int function() to typeof(null)
+fail_compilation/fail_casting.d(222): Error: cannot cast expression dg of type int delegate() to typeof(null)
+---
+*/
+void test14629()
+{
+    alias P = int*;             P p;
+    alias DA = int[];           DA da;
+    alias AA = int[int];        AA aa;
+    alias FP = int function();  FP fp;
+    alias DG = int delegate();  DG dg;
+    class C {}                  C c;
+    alias N = typeof(null);
+
+    { auto x = cast(N)c;  }
+    { auto x = cast(N)p;  }
+    { auto x = cast(N)da; }
+    { auto x = cast(N)aa; }
+    { auto x = cast(N)fp; }
+    { auto x = cast(N)dg; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_casting1.d b/gcc/testsuite/gdc.test/fail_compilation/fail_casting1.d
new file mode 100644
index 00000000000..b93b81afeca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail_casting1.d
@@ -0,0 +1,259 @@
+// REQUIRED_SRGS: -o-
+
+
+// references
+alias P = int*;             P p;
+alias FP = int function();  FP fp;
+alias DG = int delegate();  DG dg;
+alias DA = int[];           DA da;
+alias AA = int[int];        AA aa;
+class C {}                  C c;
+alias N = typeof(null);     N n;
+
+// values
+alias SA = int[1];          SA sa;
+struct S {}                 S s;
+                            int i;
+                            double f;
+
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting1.d(39): Error: cannot cast expression p of type int* to int[1]
+fail_compilation/fail_casting1.d(40): Error: cannot cast expression fp of type int function() to int[1]
+fail_compilation/fail_casting1.d(41): Error: cannot cast expression dg of type int delegate() to int[1]
+fail_compilation/fail_casting1.d(42): Error: cannot cast expression da of type int[] to int[1]
+fail_compilation/fail_casting1.d(43): Error: cannot cast expression aa of type int[int] to int[1]
+fail_compilation/fail_casting1.d(44): Error: cannot cast expression c of type fail_casting1.C to int[1]
+fail_compilation/fail_casting1.d(45): Error: cannot cast expression n of type typeof(null) to int[1]
+fail_compilation/fail_casting1.d(49): Error: cannot cast expression sa of type int[1] to int delegate()
+fail_compilation/fail_casting1.d(51): Error: cannot cast expression sa of type int[1] to double[] since sizes don't line up
+fail_compilation/fail_casting1.d(52): Error: cannot cast expression sa of type int[1] to int[int]
+fail_compilation/fail_casting1.d(53): Error: cannot cast expression sa of type int[1] to fail_casting1.C
+fail_compilation/fail_casting1.d(54): Error: cannot cast expression sa of type int[1] to typeof(null)
+---
+*/
+void test1()
+{
+    { auto x = cast(SA) p; }        // Reject (Bugzilla 14596)
+    { auto x = cast(SA)fp; }        // Reject (Bugzilla 14596) (FP is Tpointer)
+    { auto x = cast(SA)dg; }        // Reject (from e2ir)
+    { auto x = cast(SA)da; }        // Reject (from e2ir)
+    { auto x = cast(SA)aa; }        // Reject (from e2ir)
+    { auto x = cast(SA) c; }        // Reject (Bugzilla 10646)
+    { auto x = cast(SA) n; }        // Reject (Bugzilla 8179)
+    { auto x = cast( P)sa; }        // Accept (equivalent with: cast(int*)sa.ptr;)
+    { auto x = cast(double*)sa; }   // Accept (equivalent with: cast(double*)sa.ptr;)
+    { auto x = cast(FP)sa; }        // Accept (equivalent with: cast(FP)sa.ptr;)
+    { auto x = cast(DG)sa; }        // Reject (from e2ir)
+    { auto x = cast(DA)sa; }        // Accept (equivalent with: cast(int[])sa[];)
+    { auto x = cast(double[])sa; }  // Reject (from e2ir)
+    { auto x = cast(AA)sa; }        // Reject (from e2ir)
+    { auto x = cast( C)sa; }        // Reject (Bugzilla 10646)
+    { auto x = cast( N)sa; }        // Reject (Bugzilla 8179)
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting1.d(78): Error: cannot cast expression p of type int* to S
+fail_compilation/fail_casting1.d(79): Error: cannot cast expression fp of type int function() to S
+fail_compilation/fail_casting1.d(80): Error: cannot cast expression dg of type int delegate() to S
+fail_compilation/fail_casting1.d(81): Error: cannot cast expression da of type int[] to S
+fail_compilation/fail_casting1.d(82): Error: cannot cast expression aa of type int[int] to S
+fail_compilation/fail_casting1.d(83): Error: cannot cast expression c of type fail_casting1.C to S
+fail_compilation/fail_casting1.d(84): Error: cannot cast expression n of type typeof(null) to S
+fail_compilation/fail_casting1.d(85): Error: cannot cast expression s of type S to int*
+fail_compilation/fail_casting1.d(86): Error: cannot cast expression s of type S to int function()
+fail_compilation/fail_casting1.d(87): Error: cannot cast expression s of type S to int delegate()
+fail_compilation/fail_casting1.d(88): Error: cannot cast expression s of type S to int[]
+fail_compilation/fail_casting1.d(89): Error: cannot cast expression s of type S to int[int]
+fail_compilation/fail_casting1.d(90): Error: cannot cast expression s of type S to fail_casting1.C
+fail_compilation/fail_casting1.d(91): Error: cannot cast expression s of type S to typeof(null)
+---
+*/
+void test2()
+{
+    { auto x = cast( S) p; }        // Reject (Bugzilla 13959)
+    { auto x = cast( S)fp; }        // Reject (Bugzilla 13959) (FP is Tpointer)
+    { auto x = cast( S)dg; }        // Reject (from e2ir)
+    { auto x = cast( S)da; }        // Reject (from e2ir)
+    { auto x = cast( S)aa; }        // Reject (from e2ir)
+    { auto x = cast( S) c; }        // Reject (from e2ir)
+    { auto x = cast( S) n; }        // Reject (Bugzilla 9904)
+    { auto x = cast( P) s; }        // Reject (Bugzilla 13959)
+    { auto x = cast(FP) s; }        // Reject (Bugzilla 13959) (FP is Tpointer)
+    { auto x = cast(DG) s; }        // Reject (from e2ir)
+    { auto x = cast(DA) s; }        // Reject (from e2ir)
+    { auto x = cast(AA) s; }        // Reject (from e2ir)
+    { auto x = cast( C) s; }        // Reject (from e2ir)
+    { auto x = cast( N) s; }        // Reject (Bugzilla 9904)
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting1.d(125): Error: cannot cast expression p of type int* to int delegate()
+fail_compilation/fail_casting1.d(126): Error: cannot cast expression p of type int* to int[]
+fail_compilation/fail_casting1.d(129): Error: cannot cast expression p of type int* to typeof(null)
+fail_compilation/fail_casting1.d(133): Error: cannot cast expression fp of type int function() to int delegate()
+fail_compilation/fail_casting1.d(134): Error: cannot cast expression fp of type int function() to int[]
+fail_compilation/fail_casting1.d(137): Error: cannot cast expression fp of type int function() to typeof(null)
+fail_compilation/fail_casting1.d(139): Deprecation: casting from int delegate() to int* is deprecated
+fail_compilation/fail_casting1.d(140): Deprecation: casting from int delegate() to int function() is deprecated
+fail_compilation/fail_casting1.d(142): Error: cannot cast expression dg of type int delegate() to int[]
+fail_compilation/fail_casting1.d(143): Error: cannot cast expression dg of type int delegate() to int[int]
+fail_compilation/fail_casting1.d(144): Error: cannot cast expression dg of type int delegate() to fail_casting1.C
+fail_compilation/fail_casting1.d(145): Error: cannot cast expression dg of type int delegate() to typeof(null)
+fail_compilation/fail_casting1.d(157): Error: cannot cast expression da of type int[] to int delegate()
+fail_compilation/fail_casting1.d(159): Error: cannot cast expression da of type int[] to int[int]
+fail_compilation/fail_casting1.d(160): Error: cannot cast expression da of type int[] to fail_casting1.C
+fail_compilation/fail_casting1.d(161): Error: cannot cast expression da of type int[] to typeof(null)
+fail_compilation/fail_casting1.d(165): Error: cannot cast expression aa of type int[int] to int delegate()
+fail_compilation/fail_casting1.d(166): Error: cannot cast expression aa of type int[int] to int[]
+fail_compilation/fail_casting1.d(169): Error: cannot cast expression aa of type int[int] to typeof(null)
+fail_compilation/fail_casting1.d(173): Error: cannot cast expression c of type fail_casting1.C to int delegate()
+fail_compilation/fail_casting1.d(174): Error: cannot cast expression c of type fail_casting1.C to int[]
+fail_compilation/fail_casting1.d(177): Error: cannot cast expression c of type fail_casting1.C to typeof(null)
+---
+*/
+void test3()    // between reference types
+{
+    { auto x = cast( P) p; }    // Accept
+    { auto x = cast(FP) p; }    // Accept (FP is Tpointer)
+    { auto x = cast(DG) p; }    // Reject (from e2ir)
+    { auto x = cast(DA) p; }    // Reject (Bugzilla 14596)
+    { auto x = cast(AA) p; }    // Accept (because of size match)
+    { auto x = cast( C) p; }    // Accept (because of size match)
+    { auto x = cast( N) p; }    // Reject (Bugzilla 14629)
+
+    { auto x = cast( P)fp; }    // Accept (FP is Tpointer)
+    { auto x = cast(FP)fp; }    // Accept
+    { auto x = cast(DG)fp; }    // Reject (from e2ir)
+    { auto x = cast(DA)fp; }    // Reject (Bugzilla 14596)
+    { auto x = cast(AA)fp; }    // Accept (because of size match)
+    { auto x = cast( C)fp; }    // Accept (because of size match)
+    { auto x = cast( N)fp; }    // Reject (Bugzilla 14629)
+
+    { auto x = cast( P)dg; }    // Deprecated (equivalent with: cast( P)dg.ptr;)
+    { auto x = cast(FP)dg; }    // Deprecated (equivalent with: cast(FP)dg.ptr;)
+    { auto x = cast(DG)dg; }    // Accept
+    { auto x = cast(DA)dg; }    // Reject (from e2ir)
+    { auto x = cast(AA)dg; }    // Reject (from e2ir)
+    { auto x = cast( C)dg; }    // Reject (from e2ir)
+    { auto x = cast( N)dg; }    // Reject (Bugzilla 14629)
+
+    { auto x = cast( P) n; }    // Accept
+    { auto x = cast(FP) n; }    // Accept
+    { auto x = cast(DG) n; }    // Accept
+    { auto x = cast(DA) n; }    // Accept
+    { auto x = cast(AA) n; }    // Accept
+    { auto x = cast( C) n; }    // Accept
+    { auto x = cast( N) n; }    // Accept
+
+    { auto x = cast( P)da; }    // Accept (equivalent with: cast(P)da.ptr;)
+    { auto x = cast(FP)da; }    // Accept (FP is Tpointer)
+    { auto x = cast(DG)da; }    // Reject (from e2ir)
+    { auto x = cast(DA)da; }    // Accept
+    { auto x = cast(AA)da; }    // Reject (from e2ir)
+    { auto x = cast( C)da; }    // Reject (Bugzilla 10646)
+    { auto x = cast( N)da; }    // Reject (Bugzilla 14629)
+
+    { auto x = cast( P)aa; }    // Accept (because of size match)
+    { auto x = cast(FP)aa; }    // Accept (FP is Tpointer)
+    { auto x = cast(DG)aa; }    // Reject (from e2ir)
+    { auto x = cast(DA)aa; }    // Reject (from e2ir)
+    { auto x = cast(AA)aa; }    // Accept
+    { auto x = cast( C)aa; }    // Accept (because of size match)
+    { auto x = cast( N)aa; }    // Reject (Bugzilla 14629)
+
+    { auto x = cast( P) c; }    // Accept
+    { auto x = cast(FP) c; }    // Accept (FP is Tpointer)
+    { auto x = cast(DG) c; }    // Reject (from e2ir)
+    { auto x = cast(DA) c; }    // Reject (Bugzilla 10646)
+    { auto x = cast(AA) c; }    // Accept (because of size match)
+    { auto x = cast( C) c; }    // Accept
+    { auto x = cast( N) c; }    // Reject (Bugzilla 14629)
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting1.d(206): Error: cannot cast expression 0 of type int to int delegate()
+fail_compilation/fail_casting1.d(207): Error: cannot cast expression 0 of type int to int[]
+fail_compilation/fail_casting1.d(208): Error: cannot cast expression 0 of type int to int[1]
+fail_compilation/fail_casting1.d(209): Error: cannot cast expression 0 of type int to int[int]
+fail_compilation/fail_casting1.d(210): Error: cannot cast expression 0 of type int to fail_casting1.C
+fail_compilation/fail_casting1.d(211): Error: cannot cast expression 0 of type int to typeof(null)
+fail_compilation/fail_casting1.d(215): Error: cannot cast expression i of type int to int delegate()
+fail_compilation/fail_casting1.d(216): Error: cannot cast expression i of type int to int[]
+fail_compilation/fail_casting1.d(217): Error: cannot cast expression i of type int to int[1]
+fail_compilation/fail_casting1.d(218): Error: cannot cast expression i of type int to int[int]
+fail_compilation/fail_casting1.d(219): Error: cannot cast expression i of type int to fail_casting1.C
+fail_compilation/fail_casting1.d(220): Error: cannot cast expression i of type int to typeof(null)
+fail_compilation/fail_casting1.d(224): Error: cannot cast expression dg of type int delegate() to int
+fail_compilation/fail_casting1.d(225): Error: cannot cast expression da of type int[] to int
+fail_compilation/fail_casting1.d(226): Error: cannot cast expression sa of type int[1] to int
+fail_compilation/fail_casting1.d(227): Error: cannot cast expression aa of type int[int] to int
+fail_compilation/fail_casting1.d(228): Error: cannot cast expression c of type fail_casting1.C to int
+---
+*/
+void test4()
+{
+    { auto x = cast( P) 0; }    // Accept
+    { auto x = cast(FP) 0; }    // Accept
+    { auto x = cast(DG) 0; }    // Reject (from constfold)
+    { auto x = cast(DA) 0; }    // Reject (Bugzilla 11484)
+    { auto x = cast(SA) 0; }    // Reject (Bugzilla 11484)
+    { auto x = cast(AA) 0; }    // Reject (from constfold)
+    { auto x = cast( C) 0; }    // Reject (Bugzilla 11485)
+    { auto x = cast( N) 0; }    // Reject (from constfold)
+
+    { auto x = cast( P) i; }    // Accept
+    { auto x = cast(FP) i; }    // Accept
+    { auto x = cast(DG) i; }    // Reject (from e2ir)
+    { auto x = cast(DA) i; }    // Reject (Bugzilla 11484)
+    { auto x = cast(SA) i; }    // Reject (Bugzilla 11484)
+    { auto x = cast(AA) i; }    // Reject (from e2ir)
+    { auto x = cast( C) i; }    // Reject (Bugzilla 11485)
+    { auto x = cast( N) i; }    // Reject (from e2ir)
+
+    { auto x = cast(int) p; }   // Accept
+    { auto x = cast(int)fp; }   // Accept
+    { auto x = cast(int)dg; }   // Reject (from e2ir)
+    { auto x = cast(int)da; }   // Reject (Bugzilla 11484)
+    { auto x = cast(int)sa; }   // Reject (Bugzilla 11484)
+    { auto x = cast(int)aa; }   // Reject (from e2ir)
+    { auto x = cast(int) c; }   // Reject (Bugzilla 7472)
+    { auto x = cast(int) n; }   // Accept
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting1.d(249): Error: cannot cast expression 0 of type int to int[1]
+fail_compilation/fail_casting1.d(250): Error: cannot cast expression 0 of type int to S
+fail_compilation/fail_casting1.d(251): Error: cannot cast expression i of type int to int[1]
+fail_compilation/fail_casting1.d(252): Error: cannot cast expression i of type int to S
+fail_compilation/fail_casting1.d(253): Error: cannot cast expression f of type double to int[1]
+fail_compilation/fail_casting1.d(254): Error: cannot cast expression f of type double to S
+fail_compilation/fail_casting1.d(255): Error: cannot cast expression sa of type int[1] to int
+fail_compilation/fail_casting1.d(256): Error: cannot cast expression s of type S to int
+fail_compilation/fail_casting1.d(257): Error: cannot cast expression sa of type int[1] to double
+fail_compilation/fail_casting1.d(258): Error: cannot cast expression s of type S to double
+---
+*/
+void test5()
+{
+    { auto x = cast(SA) 0; }        // Reject (Bugzilla 14154)
+    { auto x = cast( S) 0; }        // Reject (Bugzilla 14154)
+    { auto x = cast(SA) i; }        // Reject (Bugzilla 14154)
+    { auto x = cast( S) i; }        // Reject (Bugzilla 14154)
+    { auto x = cast(SA) f; }        // Reject (Bugzilla 14154)
+    { auto x = cast( S) f; }        // Reject (Bugzilla 14154)
+    { auto x = cast(int)sa; }       // Reject (Bugzilla 14154)
+    { auto x = cast(int) s; }       // Reject (Bugzilla 14154)
+    { auto x = cast(double)sa; }    // Reject (Bugzilla 14154)
+    { auto x = cast(double) s; }    // Reject (Bugzilla 14154)
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_casting2.d b/gcc/testsuite/gdc.test/fail_compilation/fail_casting2.d
new file mode 100644
index 00000000000..a45d6d30bae
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail_casting2.d
@@ -0,0 +1,21 @@
+// REQUIRED_ARGS: -o-
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_casting2.d(15): Error: type int is not an expression
+fail_compilation/fail_casting2.d(17): Error: template lambda has no type
+fail_compilation/fail_casting2.d(20): Error: template Templ() has no type
+---
+*/
+
+void test15214()
+{
+    alias Type = int;
+    cast(void)(Type);
+
+    cast(void)(x => mixin(x)("mixin(x);"));
+
+    template Templ() {}
+    cast(void)(Templ);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_circular.d b/gcc/testsuite/gdc.test/fail_compilation/fail_circular.d
new file mode 100644
index 00000000000..3f4b2762d7a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail_circular.d
@@ -0,0 +1,127 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_circular.d(16): Error: circular reference to variable 'fail_circular.a1'
+fail_compilation/fail_circular.d(17): Error: circular reference to variable 'fail_circular.a2'
+fail_compilation/fail_circular.d(19): Error: circular reference to variable 'fail_circular.b1'
+fail_compilation/fail_circular.d(20): Error: circular reference to variable 'fail_circular.b2'
+fail_compilation/fail_circular.d(22): Error: circular reference to variable 'fail_circular.c1'
+fail_compilation/fail_circular.d(23): Error: circular reference to variable 'fail_circular.c2'
+fail_compilation/fail_circular.d(25): Error: circular initialization of variable 'fail_circular.d1'
+fail_compilation/fail_circular.d(26): Error: circular initialization of variable 'fail_circular.d2'
+fail_compilation/fail_circular.d(28): Error: circular initialization of variable 'fail_circular.e1'
+fail_compilation/fail_circular.d(29): Error: circular initialization of variable 'fail_circular.e2'
+---
+*/
+auto a1 =  a1;          // semantic error (cannot determine expression type)
+auto a2 = .a2;          // semantic error
+
+const b1 =  b1;         // semantic error
+const b2 = .b2;         // semantic error
+
+enum c1 =  c1;          // semantic error
+enum c2 = .c2;          // semantic error
+
+const int d1 =  d1;     // CTFE error (expression type is determined to int)
+const int d2 = .d2;     // CTFE error
+
+enum int e1 =  e1;      // CTFE error
+enum int e2 = .e2;      // CTFE error
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_circular.d(47): Error: circular reference to variable 'fail_circular.a1a'
+fail_compilation/fail_circular.d(49): Error: circular reference to variable 'fail_circular.a2a'
+fail_compilation/fail_circular.d(52): Error: circular reference to variable 'fail_circular.b1a'
+fail_compilation/fail_circular.d(54): Error: circular reference to variable 'fail_circular.b2a'
+fail_compilation/fail_circular.d(57): Error: circular reference to variable 'fail_circular.c1a'
+fail_compilation/fail_circular.d(59): Error: circular reference to variable 'fail_circular.c2a'
+fail_compilation/fail_circular.d(62): Error: circular initialization of variable 'fail_circular.d1a'
+fail_compilation/fail_circular.d(64): Error: circular initialization of variable 'fail_circular.d2a'
+fail_compilation/fail_circular.d(67): Error: circular initialization of variable 'fail_circular.e1a'
+fail_compilation/fail_circular.d(69): Error: circular initialization of variable 'fail_circular.e2a'
+---
+*/
+auto a1a =  a1b;
+auto a1b =  a1a;        // semantic error
+auto a2a =  a2b;
+auto a2b = .a2a;        // semantic error
+
+const b1a =  b1b;
+const b1b =  b1a;       // semantic error
+const b2a =  b2b;
+const b2b = .b2a;       // semantic error
+
+enum c1a =  c1b;
+enum c1b =  c1a;        // semantic error
+enum c2a =  c2b;
+enum c2b = .c2a;        // semantic error
+
+const int d1a =  d1b;
+const int d1b =  d1a;   // CTFE error
+const int d2a =  d2b;
+const int d2b = .d2a;   // CTFE error
+
+enum int e1a =  e1b;
+enum int e1b =  e1a;    // CTFE error
+enum int e2a =  e2b;
+enum int e2b = .e2a;    // CTFE error
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_circular.d(84): Error: circular reference to variable 'fail_circular.S.a1'
+fail_compilation/fail_circular.d(86): Error: circular reference to variable 'fail_circular.S.b1'
+fail_compilation/fail_circular.d(88): Error: circular reference to variable 'fail_circular.S.c1'
+fail_compilation/fail_circular.d(91): Error: circular reference to variable 'fail_circular.S.a1a'
+fail_compilation/fail_circular.d(94): Error: circular reference to variable 'fail_circular.S.b1a'
+fail_compilation/fail_circular.d(97): Error: circular reference to variable 'fail_circular.S.c1a'
+---
+*/
+struct S
+{
+    static a1 = S.a1;           // semantic error
+
+    static const b1 = S.b1;     // semantic error
+
+    enum c1 = S.c1;             // semantic error
+
+    static a1a = S.a1b;
+    static a1b = S.a1a;         // semantic error
+
+    static const b1a = S.b1b;
+    static const b1b = S.b1a;   // semantic error
+
+    enum c1a = S.c1b;
+    enum c1b = S.c1a;           // semantic error
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_circular.d(113): Error: circular reference to variable 'fail_circular.C.a1'
+fail_compilation/fail_circular.d(115): Error: circular reference to variable 'fail_circular.C.b1'
+fail_compilation/fail_circular.d(117): Error: circular reference to variable 'fail_circular.C.c1'
+fail_compilation/fail_circular.d(120): Error: circular reference to variable 'fail_circular.C.a1a'
+fail_compilation/fail_circular.d(123): Error: circular reference to variable 'fail_circular.C.b1a'
+fail_compilation/fail_circular.d(126): Error: circular reference to variable 'fail_circular.C.c1a'
+---
+*/
+class C
+{
+    static a1 = C.a1;           // semantic error
+
+    static const b1 = C.b1;     // semantic error
+
+    enum c1 = C.c1;             // semantic error
+
+    static a1a = C.a1b;
+    static a1b = C.a1a;         // semantic error
+
+    static const b1a = C.b1b;
+    static const b1b = C.b1a;   // semantic error
+
+    enum c1a = C.c1b;
+    enum c1b = C.c1a;           // semantic error
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_circular2.d b/gcc/testsuite/gdc.test/fail_compilation/fail_circular2.d
new file mode 100644
index 00000000000..f04d272563a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail_circular2.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_circular2.d(10): Error: circular initialization of variable 'fail_circular2.S.d1'
+fail_compilation/fail_circular2.d(12): Error: circular initialization of variable 'fail_circular2.S.e1'
+---
+*/
+struct S
+{
+    static const int d1 = S.d1;     // CTFE error (expression type is determined to int)
+
+    enum int e1 = S.e1;             // CTFE error
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_circular2.d(24): Error: circular initialization of variable 'fail_circular2.C.d1'
+fail_compilation/fail_circular2.d(26): Error: circular initialization of variable 'fail_circular2.C.e1'
+---
+*/
+class C
+{
+    static const int d1 = C.d1;     // CTFE error
+
+    enum int e1 = C.e1;             // CTFE error
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_opover.d b/gcc/testsuite/gdc.test/fail_compilation/fail_opover.d
new file mode 100644
index 00000000000..ba930f01a02
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail_opover.d
@@ -0,0 +1,58 @@
+// REQUIRED_ARGS: -o-
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_opover.d(13): Error: no [] operator overload for type object.Object
+fail_compilation/fail_opover.d(17): Error: no [] operator overload for type TestS
+---
+*/
+void test1()
+{
+    Object m;
+    m[] = error;
+
+    struct TestS {}
+    TestS s;
+    s[] = error;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail_opover.d(46): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(47): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(48): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(49): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(50): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(51): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(52): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(53): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(54): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(55): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(56): Error: no [] operator overload for type S
+fail_compilation/fail_opover.d(57): Error: no [] operator overload for type S
+---
+*/
+void test2()
+{
+    struct S
+    {
+        void func(int) {}
+        alias func this;
+    }
+    S s;
+    // The errors failing aliasthis access need to be gagged for better error messages.
+    s[];            // in ArrayExp::op_overload()
+    s[1];           // ditto
+    s[1..2];        // ditto
+    +s[];           // in UnaExp::op_overload()
+    +s[1];          // ditto
+    +s[1..2];       // ditto
+    s[] = 3;        // in AssignExp::semantic()
+    s[1] = 3;       // ditto
+    s[1..2] = 3;    // ditto
+    s[] += 3;       // in BinAssignExp::op_overload()
+    s[1] += 3;      // ditto
+    s[1..2] += 3;   // ditto
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d b/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d
new file mode 100644
index 00000000000..e95773e7927
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d
@@ -0,0 +1,141 @@
+/*
+PERMUTE_ARGS:
+REQUIRED_ARGS: -dip25
+TEST_OUTPUT:
+---
+fail_compilation/fail_scope.d(45): Error: escaping reference to local variable string
+fail_compilation/fail_scope.d(63): Error: escaping reference to local variable s
+fail_compilation/fail_scope.d(82): Error: escaping reference to local variable string
+fail_compilation/fail_scope.d(92): Error: escaping reference to local variable a
+fail_compilation/fail_scope.d(100): Error: escaping reference to local variable a
+fail_compilation/fail_scope.d(108): Error: escaping reference to outer local variable x
+fail_compilation/fail_scope.d(127): Error: escaping reference to local variable s
+fail_compilation/fail_scope.d(137): Error: escaping reference to local variable i
+---
+//fail_compilation/fail_scope.d(30): Error: scope variable da may not be returned
+//fail_compilation/fail_scope.d(32): Error: scope variable o may not be returned
+//fail_compilation/fail_scope.d(33): Error: scope variable dg may not be returned
+//fail_compilation/fail_scope.d(35): Error: scope variable da may not be returned
+//fail_compilation/fail_scope.d(37): Error: scope variable o may not be returned
+//fail_compilation/fail_scope.d(38): Error: scope variable dg may not be returned
+//fail_compilation/fail_scope.d(40): Error: scope variable p may not be returned
+*/
+
+alias int delegate() dg_t;
+
+int[]  checkEscapeScope1(scope int[]  da) { return da; }
+int[3] checkEscapeScope2(scope int[3] sa) { return sa; }
+Object checkEscapeScope3(scope Object o)  { return o;  }
+dg_t   checkEscapeScope4(scope dg_t   dg) { return dg; }
+
+int[]  checkEscapeScope1() { scope int[]  da = [];           return da; }
+int[3] checkEscapeScope2() { scope int[3] sa = [1,2,3];      return sa; }
+Object checkEscapeScope3() { scope Object  o = new Object;   return o;  }   // same with fail7294.d
+dg_t   checkEscapeScope4() { scope dg_t   dg = () => 1;      return dg; }
+
+int* test(scope int* p) @safe { return p; }
+
+char[] foo140()
+{
+    char[4] string = "abcd";
+    return string;
+}
+
+/************/
+
+struct S
+{
+    int x;
+
+    ref int bar() return
+    {
+        return x;
+    }
+}
+
+ref int test()
+{
+    S s;
+    return s.bar();
+}
+
+/************/
+
+ref int foo8(ref int x);
+ref int foo8(return ref int x);
+
+void testover()
+{
+    int x;
+    foo8(x);
+}
+
+/************/
+
+char* fail141()
+{
+    char[4] string = "abcd";
+    return string.ptr;
+}
+
+/************/
+
+int[] test1313b()
+out{}
+body
+{
+    int[2] a;
+    return a;
+}
+
+int[] test1313a()
+//out{}
+body
+{
+    int[2] a;
+    return a;
+}
+
+/******************/
+// https://issues.dlang.org/show_bug.cgi?id=15192
+
+ref int fun15192(ref int x) @safe
+{
+    ref int bar(){ return x; }
+    return bar();
+}
+
+ref int fun15192_2(return ref int x) @safe
+{
+    ref int bar(){ return x; }
+    return bar();
+}
+
+/**************************/
+// https://issues.dlang.org/show_bug.cgi?id=15193
+
+ref int foo15193()@safe{
+    struct S{
+        int x;
+        ref int bar() { return x; }
+    }
+    S s;
+    return s.bar();
+}
+
+
+/*****************************/
+// https://issues.dlang.org/show_bug.cgi?id=16226
+
+ref int test16226() @safe
+{
+    int i;
+    return foo16226(i);
+}
+
+
+ref foo16226(ref int bar) @safe
+{
+    return bar;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failattr.d b/gcc/testsuite/gdc.test/fail_compilation/failattr.d
new file mode 100644
index 00000000000..e0b4562bcad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failattr.d
@@ -0,0 +1,34 @@
+// REQUIRED_ARGS: -o-
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/failattr.d(16): Error: variable failattr.C2901.v1 cannot be synchronized
+fail_compilation/failattr.d(17): Error: variable failattr.C2901.v2 cannot be override
+fail_compilation/failattr.d(18): Error: variable failattr.C2901.v3 cannot be abstract
+fail_compilation/failattr.d(19): Error: variable failattr.C2901.v4 cannot be final, perhaps you meant const?
+fail_compilation/failattr.d(31): Error: variable failattr.C2901.v13 cannot be final abstract synchronized override
+fail_compilation/failattr.d(33): Error: variable failattr.C2901.v14 cannot be final, perhaps you meant const?
+---
+*/
+class C2901
+{
+    synchronized    int v1;         // error
+    override        int v2;         // error
+    abstract        int v3;         // error
+    final           int v4;         // error
+
+    synchronized    { int v5; }     // no error
+    override        { int v6; }     // no error
+    abstract        { int v7; }     // no error
+    final           { int v8; }     // no error
+
+    synchronized:   int v9;         // no error
+    override:       int v10;        // no error
+    abstract:       int v11;        // no error
+    final:          int v12;        // no error
+
+    synchronized override abstract final int v13;   // one line error
+
+    static final int v14;           // error, even if static is applied at the same time
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/faildeleteaa.d b/gcc/testsuite/gdc.test/fail_compilation/faildeleteaa.d
new file mode 100644
index 00000000000..f190141aabe
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/faildeleteaa.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/faildeleteaa.d(11): Error: cannot delete type int
+---
+*/
+
+void main()
+{
+    int[int] aa = [1 : 2];
+    delete aa[1];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/faildottypeinfo.d b/gcc/testsuite/gdc.test/fail_compilation/faildottypeinfo.d
new file mode 100644
index 00000000000..af238f71dcf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/faildottypeinfo.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/faildottypeinfo.d(11): Error: no property 'typeinfo' for type 'int'
+fail_compilation/faildottypeinfo.d(12): Error: no property 'typeinfo' for type 'object.Object'
+---
+*/
+
+void main()
+{
+    auto x = 0.typeinfo;
+    auto y = Object.typeinfo;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failescape.d b/gcc/testsuite/gdc.test/fail_compilation/failescape.d
new file mode 100644
index 00000000000..8376893e580
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failescape.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/failescape.d(8): Error: character '\' is not a valid token
+---
+*/
+
+string x = \n;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failinout1.d b/gcc/testsuite/gdc.test/fail_compilation/failinout1.d
new file mode 100644
index 00000000000..fc3d7913246
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failinout1.d
@@ -0,0 +1,5 @@
+inout(int) foo(inout(int) x)
+{
+    x = 5;  // cannot modify inout
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failinout2.d b/gcc/testsuite/gdc.test/fail_compilation/failinout2.d
new file mode 100644
index 00000000000..12a9c44f84a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failinout2.d
@@ -0,0 +1 @@
+inout int x;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failinout3748a.d b/gcc/testsuite/gdc.test/fail_compilation/failinout3748a.d
new file mode 100644
index 00000000000..bb2cd55aaf5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failinout3748a.d
@@ -0,0 +1,4 @@
+struct S3748
+{
+    inout(int) err8;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failinout3748b.d b/gcc/testsuite/gdc.test/fail_compilation/failinout3748b.d
new file mode 100644
index 00000000000..741e44fa0a5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failinout3748b.d
@@ -0,0 +1,4 @@
+void main()
+{
+    inout(int)* err11;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failmemalloc.d b/gcc/testsuite/gdc.test/fail_compilation/failmemalloc.d
new file mode 100644
index 00000000000..713c180ec9e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failmemalloc.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/failmemalloc.d(13): Error: member allocators not supported by CTFE
+---
+*/
+
+struct S
+{
+    new(size_t sz) { return null; }
+}
+
+S* s = new S();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failoffset.d b/gcc/testsuite/gdc.test/fail_compilation/failoffset.d
new file mode 100644
index 00000000000..4cc87406015
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failoffset.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/failoffset.d(12): Error: no property 'offset' for type 'int'
+fail_compilation/failoffset.d(12):        while evaluating: static assert(b.offset == 4)
+---
+*/
+
+void main()
+{
+    struct S { int a, b; }
+    static assert(S.b.offset == 4);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failsafea.d b/gcc/testsuite/gdc.test/fail_compilation/failsafea.d
new file mode 100644
index 00000000000..b2a3f227b0d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failsafea.d
@@ -0,0 +1,8 @@
+
+void systemfunc() @system {}
+
+@safe
+void callingsystem()
+{
+    systemfunc();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failsafeb.d b/gcc/testsuite/gdc.test/fail_compilation/failsafeb.d
new file mode 100644
index 00000000000..c04d9ee5dc7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failsafeb.d
@@ -0,0 +1,8 @@
+
+void function() @system sysfuncptr;
+
+@safe
+void callingsystem()
+{
+    sysfuncptr();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/failsafec.d b/gcc/testsuite/gdc.test/fail_compilation/failsafec.d
new file mode 100644
index 00000000000..8bcda913720
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/failsafec.d
@@ -0,0 +1,9 @@
+
+void delegate() @system sysdelegate;
+
+@safe
+void callingsystem()
+{
+    sysdelegate();
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fix350a.d b/gcc/testsuite/gdc.test/fail_compilation/fix350a.d
new file mode 100644
index 00000000000..8c3563c2c03
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fix350a.d
@@ -0,0 +1,7 @@
+struct S1
+{
+    int a, b, c;
+
+    static immutable S1 C1 = { 1 2 3 }; // no commas here, compiles
+    static immutable S1 C2 = { 1, 2, 3 }; // compiles as well
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fix350b.d b/gcc/testsuite/gdc.test/fail_compilation/fix350b.d
new file mode 100644
index 00000000000..6c1a0bc949e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fix350b.d
@@ -0,0 +1,10 @@
+int foo() { return 3; }
+
+struct S2
+{
+    int a, b, c;
+
+    static immutable S2 C1 = { foo() 2 3 }; // compiles (and works)
+    static immutable S2 C2 = { foo() 2, 3 }; // compiles (and works)
+    //static immutable S2 C3 = { 2 foo() 3 }; // does not compile: comma expected separating field initializers
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/gag4269a.d b/gcc/testsuite/gdc.test/fail_compilation/gag4269a.d
new file mode 100644
index 00000000000..709e0d66efe
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/gag4269a.d
@@ -0,0 +1,13 @@
+﻿// REQUIRED_ARGS: -c -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/gag4269a.d(12): Error: undefined identifier 'B'
+---
+*/
+
+static if(is(typeof(A4269.sizeof))) {}
+class A4269
+{
+    void foo(B b);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/gag4269b.d b/gcc/testsuite/gdc.test/fail_compilation/gag4269b.d
new file mode 100644
index 00000000000..eb2e868ea7c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/gag4269b.d
@@ -0,0 +1,10 @@
+﻿// REQUIRED_ARGS: -c -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/gag4269b.d(10): Error: undefined identifier 'Y'
+---
+*/
+
+static if(is(typeof(X2.init))) {}
+struct X2 { Y y; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/gag4269c.d b/gcc/testsuite/gdc.test/fail_compilation/gag4269c.d
new file mode 100644
index 00000000000..7e6fa9bc222
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/gag4269c.d
@@ -0,0 +1,10 @@
+﻿// REQUIRED_ARGS: -c -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/gag4269c.d(10): Error: undefined identifier 'T3', did you mean function 'X3'?
+---
+*/
+
+static if(is(typeof(X3.init))) {}
+void X3(T3) { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/gag4269d.d b/gcc/testsuite/gdc.test/fail_compilation/gag4269d.d
new file mode 100644
index 00000000000..9b316ea0328
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/gag4269d.d
@@ -0,0 +1,10 @@
+﻿// REQUIRED_ARGS: -c -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/gag4269d.d(10): Error: undefined identifier 'Y4', did you mean function 'X4'?
+---
+*/
+
+static if(is(typeof(X4.init))) {}
+Y4 X4() { return typeof(return).init; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/gag4269e.d b/gcc/testsuite/gdc.test/fail_compilation/gag4269e.d
new file mode 100644
index 00000000000..05b5d3bc4f2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/gag4269e.d
@@ -0,0 +1,10 @@
+﻿// REQUIRED_ARGS: -c -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/gag4269e.d(10): Error: undefined identifier 'Y8', did you mean class 'X8'?
+---
+*/
+
+static if(is(typeof(X8.init))) {}
+class X8 : Y8 {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/gag4269f.d b/gcc/testsuite/gdc.test/fail_compilation/gag4269f.d
new file mode 100644
index 00000000000..1a7a06dff0c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/gag4269f.d
@@ -0,0 +1,11 @@
+﻿// REQUIRED_ARGS: -c -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/gag4269f.d(11): Error: undefined identifier 'Y9', did you mean interface 'X9'?
+fail_compilation/gag4269f.d(11): Error: variable gag4269f.X9.y field not allowed in interface
+---
+*/
+
+static if(is(typeof(X9.init))) {}
+interface X9 { Y9 y; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/gag4269g.d b/gcc/testsuite/gdc.test/fail_compilation/gag4269g.d
new file mode 100644
index 00000000000..dade9704989
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/gag4269g.d
@@ -0,0 +1,10 @@
+﻿// REQUIRED_ARGS: -c -o-
+/*
+TEST_OUTPUT:
+---
+fail_compilation/gag4269g.d(10): Error: undefined identifier 'Y13', did you mean template 'X13(Y13 y)'?
+---
+*/
+
+static if(is(typeof(X13!(0).init))) {}
+template X13(Y13 y) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10016.d b/gcc/testsuite/gdc.test/fail_compilation/ice10016.d
new file mode 100644
index 00000000000..3db2aeaf726
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10016.d
@@ -0,0 +1,48 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10016.d(33): Error: undefined identifier 'unknownIdentifier'
+fail_compilation/ice10016.d(47): Error: template instance ice10016.RefCounted!(S) error instantiating
+---
+*/
+
+struct RefCounted(T)
+{
+    struct RefCountedStore
+    {
+        struct Impl
+        {
+            T _payload;
+        }
+        Impl* _store;
+    }
+    RefCountedStore _refCounted;
+
+    void opAssign(typeof(this)) { }
+    void opAssign(T) { }
+
+    @property refCountedPayload()
+    {
+        return _refCounted._store._payload;
+    }
+    alias refCountedPayload this;
+}
+
+struct S
+{
+    int i = unknownIdentifier;
+}
+
+class C {}
+
+class N
+{
+    this(C) {}
+    C c() { return null; }
+}
+
+class D : N
+{
+    this() { super(c); }
+    RefCounted!S _s;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10076.d b/gcc/testsuite/gdc.test/fail_compilation/ice10076.d
new file mode 100644
index 00000000000..8337d7f459e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10076.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10076.d(18): Error: template instance getMembersAndAttributesWhere!() template 'getMembersAndAttributesWhere' is not defined
+fail_compilation/ice10076.d(23): Error: template instance ice10076.getValidaterAttrs!string error instantiating
+fail_compilation/ice10076.d(13):        instantiated from here: validate!string
+---
+*/
+
+void main()
+{
+    string s;
+    validate(s);
+}
+
+template getValidaterAttrs(T)
+{
+    alias getMembersAndAttributesWhere!().Elements getValidaterAttrs;
+}
+
+void validate(T)(T)
+{
+    alias getValidaterAttrs!T memberAttrs;
+    auto x = memberAttrs.length;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10212.d b/gcc/testsuite/gdc.test/fail_compilation/ice10212.d
new file mode 100644
index 00000000000..6c4f1c5f26f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10212.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10212.d(12): Error: mismatched function return type inference of int function() pure nothrow @nogc @safe and int
+---
+*/
+
+int delegate() foo()
+{
+    // returns "int function() pure nothrow @safe function() pure nothrow @safe"
+    // and it mismatches to "int delegate()"
+    return () => {
+        return 1;
+    };
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10259.d b/gcc/testsuite/gdc.test/fail_compilation/ice10259.d
new file mode 100644
index 00000000000..e12df7dd5e5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10259.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10259.d(11): Error: circular reference to 'ice10259.D.d'
+fail_compilation/ice10259.d(11):        called from here: (*function () => x)()
+---
+*/
+class D
+{
+    int x;
+    D d = { auto x = new D(); return x; }();
+}
+enum x = new D;
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10259.d(25): Error: circular reference to 'ice10259.D2.d'
+fail_compilation/ice10259.d(25):        called from here: (*function () => x)()
+---
+*/
+class D2
+{
+    int x;
+    D2 d = function { auto x = new D2(); return x; }();
+}
+enum x2 = new D2;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10273.d b/gcc/testsuite/gdc.test/fail_compilation/ice10273.d
new file mode 100644
index 00000000000..b7983bbc482
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10273.d
@@ -0,0 +1,12 @@
+// 10273 - ICE in CTFE
+
+struct Bug10273 {
+    int val = 3.45;
+}
+int bug10273()
+{
+    Bug10273 p;
+    return 1;
+}
+
+static assert(bug10273());
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10283.d b/gcc/testsuite/gdc.test/fail_compilation/ice10283.d
new file mode 100644
index 00000000000..347ac3557b5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10283.d
@@ -0,0 +1,10 @@
+// 10283
+
+S10283 blah(S10283 xxx) { return xxx; }
+S10283 repy = blah(S10283());
+
+struct S10283
+{
+    string source = 7;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10341.d b/gcc/testsuite/gdc.test/fail_compilation/ice10341.d
new file mode 100644
index 00000000000..ed6b6cbc48c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10341.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10341.d(10): Error: case range not in switch statement
+---
+*/
+
+void main()
+{
+    case 1: .. case 2:
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10382.d b/gcc/testsuite/gdc.test/fail_compilation/ice10382.d
new file mode 100644
index 00000000000..038c102b76c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10382.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10382.d(14): Error: can only catch class objects, not 'int'
+---
+*/
+
+void main ()
+{
+    try
+    {
+        int b = 3;
+    }
+    catch (int a) { }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10419.d b/gcc/testsuite/gdc.test/fail_compilation/ice10419.d
new file mode 100644
index 00000000000..47d1f733548
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10419.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10419.d(12): Error: arr().length is not an lvalue
+---
+*/
+
+int[] arr() { return []; }
+
+void main()
+{
+    arr().length = 1;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10599.d b/gcc/testsuite/gdc.test/fail_compilation/ice10599.d
new file mode 100644
index 00000000000..b8be25ade0f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10599.d
@@ -0,0 +1,12 @@
+﻿// 10599 ICE(interpret.c) 
+
+struct Bug {
+    int val = 3.45;
+}
+int bug10599()
+{
+    Bug p = Bug();
+    return 1;
+}
+
+static assert(bug10599());
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10600.d b/gcc/testsuite/gdc.test/fail_compilation/ice10600.d
new file mode 100644
index 00000000000..b1ee9067b9b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10600.d
@@ -0,0 +1,32 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10600.d(30): Error: template instance to!(int, double) does not match template declaration to(T)
+---
+*/
+
+import imports.ice10600a;
+import imports.ice10600b;
+
+template Tuple(Specs...)
+{
+    struct Tuple
+    {
+        string toString()
+        {
+            Appender!string w;  // issue!
+            return "";
+        }
+    }
+}
+Tuple!T tuple(T...)(T args)
+{
+    return typeof(return)();
+}
+
+void main()
+{
+    auto a = to!int("");
+    auto b = to!(int, double)("");
+    tuple(1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10616.d b/gcc/testsuite/gdc.test/fail_compilation/ice10616.d
new file mode 100644
index 00000000000..6ccd1c31b60
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10616.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10616.d(8): Error: class ice10616.A is forward referenced when looking for 'B'
+---
+*/
+
+class A : A.B
+{
+    interface B {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10624.d b/gcc/testsuite/gdc.test/fail_compilation/ice10624.d
new file mode 100644
index 00000000000..1e8633de439
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10624.d
@@ -0,0 +1,51 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10624.d(38): Error: need member function opCmp() for struct Tuple!(Msg) to compare
+fail_compilation/ice10624.d(48): Error: template instance ice10624.Variant.handler!(Tuple!(Msg)) error instantiating
+fail_compilation/ice10624.d(21):        instantiated from here: opAssign!(Tuple!(Msg))
+---
+*/
+
+struct Msg {}
+
+struct Tuple(Specs...)
+{
+    Specs expand;
+    alias expand this;
+}
+
+void main()
+{
+    Variant data;
+    data = Tuple!Msg();
+
+}
+
+struct Variant
+{
+    ptrdiff_t function() fptr = &handler!(void);
+
+    static ptrdiff_t handler(A : void)()
+    {
+        return 0;
+    }
+    static ptrdiff_t handler(A)()
+    {
+        A* zis;
+        A* rhsPA;
+        {
+            return *zis < *rhsPA ? -1 : 1;
+            // Tupple!(Msg) < Tupple!(Msg)
+            // Tupple!(Msg).expand < Tupple!(Msg).expand
+            // -> should be error
+        }
+        return 0;
+    }
+
+    Variant opAssign(T)(T rhs)
+    {
+        fptr = &handler!(T);
+        return this;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10651.d b/gcc/testsuite/gdc.test/fail_compilation/ice10651.d
new file mode 100644
index 00000000000..6f7becf615e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10651.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10651.d(11): Error: can only throw class objects derived from Throwable, not type int*
+---
+*/
+
+void main()
+{
+    alias T = int;
+    throw new T();  // ICE
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10713.d b/gcc/testsuite/gdc.test/fail_compilation/ice10713.d
new file mode 100644
index 00000000000..9ef07b34027
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10713.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10713.d(10): Error: no property 'nonExistingField' for type 'S'
+---
+*/
+
+struct S
+{
+    void f(typeof(this.nonExistingField) a) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10727a.d b/gcc/testsuite/gdc.test/fail_compilation/ice10727a.d
new file mode 100644
index 00000000000..2b1f71debce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10727a.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -c
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/foo10727a.d(34): Error: undefined identifier 'Frop'
+---
+*/
+
+import imports.foo10727a;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10727b.d b/gcc/testsuite/gdc.test/fail_compilation/ice10727b.d
new file mode 100644
index 00000000000..27a7f1407a7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10727b.d
@@ -0,0 +1,9 @@
+// REQUIRED_ARGS: -c
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/foo10727b.d(25): Error: undefined identifier 'Frop'
+---
+*/
+
+import imports.foo10727b;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10770.d b/gcc/testsuite/gdc.test/fail_compilation/ice10770.d
new file mode 100644
index 00000000000..fe423d8a8eb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10770.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10770.d(13): Error: enum ice10770.E2 is forward referenced looking for base type
+fail_compilation/ice10770.d(13):        while evaluating: static assert(is(E2 e == enum))
+---
+*/
+
+enum E1 : int;
+static assert(is(E1 e == enum) && is(e == int));
+
+enum E2;
+static assert(is(E2 e == enum));
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10922.d b/gcc/testsuite/gdc.test/fail_compilation/ice10922.d
new file mode 100644
index 00000000000..1ddad18eba5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10922.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10922.d(9): Error: function ice10922.__lambda4 (const(uint) n) is not callable using argument types ()
+---
+*/
+
+auto fib = (in uint n) pure nothrow {
+    enum self = __traits(parent, {});
+    return (n < 2) ? n : self(n - 1) + self(n - 2);
+};
+
+void main()
+{
+    auto n = fib(39);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10938.d b/gcc/testsuite/gdc.test/fail_compilation/ice10938.d
new file mode 100644
index 00000000000..2b3eab52ea3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10938.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10938.d(12): Error: no property 'opts' for type 'ice10938.C'
+---
+*/
+
+class C
+{
+    this()
+    {
+        this.opts["opts"] = 1;
+    }
+
+    auto opDispatch(string field : "opts")()
+    {
+        return this.opts;  // ICE -> compile time error
+    }
+}
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10949.d b/gcc/testsuite/gdc.test/fail_compilation/ice10949.d
new file mode 100644
index 00000000000..90d5434a397
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice10949.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice10949.d(12): Deprecation: Using the result of a comma expression is deprecated
+fail_compilation/ice10949.d(12): Error: array index 3 is out of bounds [5, 5][0 .. 2]
+fail_compilation/ice10949.d(12): Error: array index 17 is out of bounds [2, 3][0 .. 2]
+fail_compilation/ice10949.d(12): Error: array index 9 is out of bounds [3, 3, 3][0 .. 3]
+fail_compilation/ice10949.d(12):        while evaluating: static assert((__error) || (__error))
+---
+*/
+int global;
+static assert((((((([5,5][3] + global - global)*global/global%global)>>global) &global|global)^global) == 9, [2,3][17]) || ([3,3,3][9] is 4) && ([[1,2,3]][4]).length);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11086.d b/gcc/testsuite/gdc.test/fail_compilation/ice11086.d
new file mode 100644
index 00000000000..0b2ee3060e3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11086.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11086.d(10): Error: template instance foo!A template 'foo' is not defined
+---
+*/
+
+struct A
+{
+    foo!(A) l1,l2;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11136.d b/gcc/testsuite/gdc.test/fail_compilation/ice11136.d
new file mode 100644
index 00000000000..84defb938e7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11136.d
@@ -0,0 +1,9 @@
+// EXTRA_SOURCES: imports/bar11136.d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/bar11136.d(1): Error: package name 'ice11136' conflicts with usage as a module name in file fail_compilation/ice11136.d
+---
+*/
+
+module ice11136;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11153.d b/gcc/testsuite/gdc.test/fail_compilation/ice11153.d
new file mode 100644
index 00000000000..2d6bb9457a0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11153.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11153.d(11): Error: function declaration without return type. (Note that constructors are always named 'this')
+fail_compilation/ice11153.d(11): Error: no identifier for declarator foo()
+---
+*/
+
+struct S
+{
+    foo(T)() {}
+    // Parser creates a TemplateDeclaration object with ident == NULL
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11404.d b/gcc/testsuite/gdc.test/fail_compilation/ice11404.d
new file mode 100644
index 00000000000..c3f1ce608bc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11404.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11404.d(10): Error: can't have associative array of (int, int)
+---
+*/
+template TypeTuple(TL...) { alias TL TypeTuple; }
+void main()
+{
+    TypeTuple!(int, int)[string] my_map;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice1144.d b/gcc/testsuite/gdc.test/fail_compilation/ice1144.d
new file mode 100644
index 00000000000..25ed8445089
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice1144.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice1144.d(14): Error: undefined identifier 'a'
+fail_compilation/ice1144.d(23): Error: template instance ice1144.testHelper!("hello", "world") error instantiating
+---
+*/
+
+// Issue 1144 - ICE(template.c) template mixin causes DMD crash
+
+char[] testHelper(A ...)()
+{
+    char[] result;
+    foreach (t; a)
+    {
+        result ~= "int " ~ t ~ ";\n";
+    }
+    return result;
+}
+
+void main()
+{
+    mixin(testHelper!("hello", "world")());
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11472.d b/gcc/testsuite/gdc.test/fail_compilation/ice11472.d
new file mode 100644
index 00000000000..f5b767f2a25
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11472.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11472.d(13): Error: template instance fun2!fun fun2 is not a template declaration, it is a function
+fail_compilation/ice11472.d(18): Error: template instance ice11472.fun1!(fun3) error instantiating
+---
+*/
+
+void fun3() {}
+void fun2(string a) {}
+void fun1(alias fun=fun3)()
+{
+    "a".fun2!fun;
+}
+
+void main()
+{
+    fun1;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11513a.d b/gcc/testsuite/gdc.test/fail_compilation/ice11513a.d
new file mode 100644
index 00000000000..576c84550cf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11513a.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/ice11513x.d(1): Error: package name 'ice11513a' conflicts with usage as a module name in file fail_compilation/ice11513a.d
+---
+*/
+
+module ice11513a;
+
+import imports.ice11513x;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11513b.d b/gcc/testsuite/gdc.test/fail_compilation/ice11513b.d
new file mode 100644
index 00000000000..dab09b87e87
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11513b.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/ice11513y.d(1): Error: package name 'ice11513b' conflicts with usage as a module name in file fail_compilation/ice11513b.d
+---
+*/
+
+module ice11513b;
+
+import imports.ice11513y;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11518.d b/gcc/testsuite/gdc.test/fail_compilation/ice11518.d
new file mode 100644
index 00000000000..cfceb64ed6b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11518.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11518.d(17): Error: class ice11518.B matches more than one template declaration:
+fail_compilation/ice11518.d(12):     B(T : A!T)
+and
+fail_compilation/ice11518.d(13):     B(T : A!T)
+---
+*/
+
+class A(T) {}
+class B(T : A!T) {}
+class B(T : A!T) {}
+
+void main()
+{
+    new B!(A!void);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11552.d b/gcc/testsuite/gdc.test/fail_compilation/ice11552.d
new file mode 100644
index 00000000000..88f3cbf8af9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11552.d
@@ -0,0 +1,17 @@
+/*
+REQUIRED_ARGS: -o-
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/ice11552.d(14): Error: label 'label' is undefined
+fail_compilation/ice11552.d(17):        called from here: test11552()
+fail_compilation/ice11552.d(17):        while evaluating: static assert(test11552())
+---
+*/
+
+int test11552()
+{
+    goto label;
+    return 1;
+}
+static assert(test11552());
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11553.d b/gcc/testsuite/gdc.test/fail_compilation/ice11553.d
new file mode 100644
index 00000000000..cbff9d761a0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11553.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11553.d(22): Error: recursive template expansion while looking for A!().A()
+---
+*/
+
+template A(alias T)
+{
+    template A()
+    {
+        alias A = T!();
+    }
+}
+
+template B()
+{
+    alias B = A!(.B);
+}
+
+static if (A!B) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11626.d b/gcc/testsuite/gdc.test/fail_compilation/ice11626.d
new file mode 100644
index 00000000000..abf7fd03e42
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11626.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11626.d(8): Error: undefined identifier 'Bar'
+---
+*/
+
+void foo(in ref Bar) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11726.d b/gcc/testsuite/gdc.test/fail_compilation/ice11726.d
new file mode 100644
index 00000000000..2d3f70abaec
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11726.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11726.d(16): Error: undefined identifier 'x'
+---
+*/
+
+struct S
+{
+    auto opDispatch(string fn, Args...)(Args args)
+    {
+    }
+}
+
+void main() {
+    S().reserve(x.foo());
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11755.d b/gcc/testsuite/gdc.test/fail_compilation/ice11755.d
new file mode 100644
index 00000000000..86ce6f69979
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11755.d
@@ -0,0 +1,30 @@
+// REQUIRED_ARGS: -w
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11755.d(20): Error: '!<>=' is not defined for array comparisons
+fail_compilation/ice11755.d(21): Error: use '==' for non-floating comparisons rather than floating point operator '!<>'
+fail_compilation/ice11755.d(22): Error: use '!=' for non-floating comparisons rather than floating point operator '<>'
+fail_compilation/ice11755.d(23): Error: '<>=' is not defined for array comparisons
+fail_compilation/ice11755.d(24): Error: use '<=' for non-floating comparisons rather than floating point operator '!>'
+fail_compilation/ice11755.d(25): Error: use '<' for non-floating comparisons rather than floating point operator '!>='
+fail_compilation/ice11755.d(26): Error: use '>=' for non-floating comparisons rather than floating point operator '!<'
+fail_compilation/ice11755.d(27): Error: use '>' for non-floating comparisons rather than floating point operator '!<='
+fail_compilation/ice11755.d(28): Error: floating point operator '<>=' always returns true for non-floating comparisons
+fail_compilation/ice11755.d(29): Error: floating point operator '!<>=' always returns false for non-floating comparisons
+---
+*/
+void main()
+{
+    int[] a, b;
+    auto r4 = a !<>= b; // TOKunord
+    auto r2 = a !<>  b; // TOKue
+    auto r1 = a  <>  b; // TOKlg
+    auto r3 = a  <>= b; // TOKleg
+    auto r8 = a !>   b; // TOKule
+    auto r7 = a !>=  b; // TOKul
+    auto r6 = a !<   b; // TOKuge
+    auto r5 = a !<=  b; // TOKug
+    assert((5 <>= 3) == 1);
+    assert((5 !<>= 3) == 0);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11790.d b/gcc/testsuite/gdc.test/fail_compilation/ice11790.d
new file mode 100644
index 00000000000..34b2002d950
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11790.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11790.d(8): Error: cannot pass type string as a function argument
+---
+*/
+
+string[string] crash = new string[string];
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11793.d b/gcc/testsuite/gdc.test/fail_compilation/ice11793.d
new file mode 100644
index 00000000000..e9453a30b44
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11793.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11793.d(11): Error: circular reference to 'ice11793.Outer.outer'
+---
+*/
+
+class Outer
+{
+    int foo;
+    Outer outer = new Outer();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11822.d b/gcc/testsuite/gdc.test/fail_compilation/ice11822.d
new file mode 100644
index 00000000000..4ec46c3a2f5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11822.d
@@ -0,0 +1,33 @@
+
+
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11822.d(32): Deprecation: function ice11822.d is deprecated
+fail_compilation/ice11822.d(21):        instantiated from here: S!(__lambda1)
+fail_compilation/ice11822.d(32):        instantiated from here: g!((n) => d(i))
+---
+*/
+
+struct S(alias pred)
+{
+    this(int) { pred(1); }
+    void f()  { pred(2); }
+}
+
+auto g(alias pred)()
+{
+    return S!pred(3);
+}
+
+deprecated bool d(int)
+{
+    return true;
+}
+
+auto h()
+{
+    int i;
+    return g!(n => d(i))();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11849a.d b/gcc/testsuite/gdc.test/fail_compilation/ice11849a.d
new file mode 100644
index 00000000000..51260a115fd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11849a.d
@@ -0,0 +1,40 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11849a.d(20): Error: enum ice11849a.RegValueType1a recursive definition of .max property
+fail_compilation/ice11849a.d(27): Error: enum ice11849a.RegValueType1b recursive definition of .max property
+fail_compilation/ice11849a.d(32): Error: enum ice11849a.RegValueType2a recursive definition of .min property
+fail_compilation/ice11849a.d(39): Error: enum ice11849a.RegValueType2b recursive definition of .min property
+---
+*/
+
+alias DWORD = uint;
+
+enum : DWORD
+{
+    REG_DWORD = 4
+}
+
+enum RegValueType1a : DWORD
+{
+    Unknown = DWORD.max,
+    DWORD = REG_DWORD,
+}
+
+enum RegValueType1b : DWORD
+{
+    DWORD = REG_DWORD,
+    Unknown = DWORD.max,
+}
+
+enum RegValueType2a : DWORD
+{
+    Unknown = DWORD.min,
+    DWORD = REG_DWORD,
+}
+
+enum RegValueType2b : DWORD
+{
+    DWORD = REG_DWORD,
+    Unknown = DWORD.min,
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11849b.d b/gcc/testsuite/gdc.test/fail_compilation/ice11849b.d
new file mode 100644
index 00000000000..395c34867a7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11849b.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11849b.d(11): Error: circular reference to enum base type DWORD1
+fail_compilation/ice11849b.d(11): Error: DWORD1 is used as a type
+fail_compilation/ice11849b.d(16): Error: circular reference to enum base type typeof(DWORD2)
+---
+*/
+enum REG_DWORD = 1;
+
+enum : DWORD1
+{
+    DWORD1 = REG_DWORD
+}
+
+enum : typeof(DWORD2)
+{
+    DWORD2 = REG_DWORD
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11850.d b/gcc/testsuite/gdc.test/fail_compilation/ice11850.d
new file mode 100644
index 00000000000..9d1f172a50e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11850.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11850.d(14): Error: incompatible types for ((a) < ([0])): 'uint[]' and 'int[]'
+fail_compilation/imports/a11850.d(9):        instantiated from here: FilterResult!(__lambda1, uint[][])
+fail_compilation/ice11850.d(14):        instantiated from here: filter!(uint[][])
+---
+*/
+
+import imports.a11850 : filter;
+
+void main()
+{
+    filter!(a => a < [0])([[0u]]);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11919.d b/gcc/testsuite/gdc.test/fail_compilation/ice11919.d
new file mode 100644
index 00000000000..700561043d4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11919.d
@@ -0,0 +1,26 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11919.d(17): Error: cannot interpret foo at compile time
+fail_compilation/imports/a11919.d(4): Error: template instance a11919.doBar!(Foo).doBar.zoo!(t) error instantiating
+fail_compilation/imports/a11919.d(11):        instantiated from here: doBar!(Foo)
+fail_compilation/ice11919.d(25):        instantiated from here: doBar!(Bar)
+---
+*/
+
+import imports.a11919;
+
+enum foo;
+
+class Foo
+{
+    @foo bool _foo;
+}
+
+class Bar : Foo {}
+
+void main()
+{
+    auto bar = new Bar();
+    bar.doBar;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11922.d b/gcc/testsuite/gdc.test/fail_compilation/ice11922.d
new file mode 100644
index 00000000000..3fccb78d28c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11922.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11922.d(11): Error: undefined identifier 'a'
+fail_compilation/ice11922.d(17): Error: template instance ice11922.S.f!int error instantiating
+---
+*/
+
+struct S
+{
+    auto f(B)(B) { return a; }
+}
+
+void main()
+{
+    S s;
+    s.f(5);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11926.d b/gcc/testsuite/gdc.test/fail_compilation/ice11926.d
new file mode 100644
index 00000000000..ccd6e12fc3e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11926.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11926.d(11): Error: no identifier for declarator const(a)
+fail_compilation/ice11926.d(12): Error: no identifier for declarator const(b)
+---
+*/
+
+enum
+{
+    const a = 1,
+    const b = 2
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11944.d b/gcc/testsuite/gdc.test/fail_compilation/ice11944.d
new file mode 100644
index 00000000000..c72d9f0de5c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11944.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11944.d(12): Error: template instance doCommand!(func) does not match template declaration doCommand(f, T)(f, T arg)
+---
+*/
+
+void func(int var) {}
+
+void doCommand(f, T)(f, T arg) {}
+
+auto var = &doCommand!func;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11963.d b/gcc/testsuite/gdc.test/fail_compilation/ice11963.d
new file mode 100644
index 00000000000..9046f093512
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11963.d
@@ -0,0 +1 @@
+A("")=
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11965.d b/gcc/testsuite/gdc.test/fail_compilation/ice11965.d
new file mode 100644
index 00000000000..8c036ee9690
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11965.d
@@ -0,0 +1 @@
+u[{b*A,
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11967.d b/gcc/testsuite/gdc.test/fail_compilation/ice11967.d
new file mode 100644
index 00000000000..93b81309020
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11967.d
@@ -0,0 +1 @@
+[F(%g{@
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11968.d b/gcc/testsuite/gdc.test/fail_compilation/ice11968.d
new file mode 100644
index 00000000000..ce0d9fcf97f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11968.d
@@ -0,0 +1 @@
+void main() {  delete __FILE__  ; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11969.d b/gcc/testsuite/gdc.test/fail_compilation/ice11969.d
new file mode 100644
index 00000000000..3e9d2858e9d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11969.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice11969.d(9): Error: undefined identifier 'index'
+fail_compilation/ice11969.d(10): Error: undefined identifier 'cond'
+fail_compilation/ice11969.d(11): Error: undefined identifier 'msg'
+---
+*/
+void test1() { mixin ([index]); }
+void test2() { mixin (assert(cond)); }
+void test3() { mixin (assert(0, msg)); }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11974.d b/gcc/testsuite/gdc.test/fail_compilation/ice11974.d
new file mode 100644
index 00000000000..d9f2f3007e0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11974.d
@@ -0,0 +1 @@
+void main() {  0 = __LINE__ ^^ [ 0 ] ; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice11982.d b/gcc/testsuite/gdc.test/fail_compilation/ice11982.d
new file mode 100644
index 00000000000..251dada4bc3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice11982.d
@@ -0,0 +1 @@
+void main() { new scope ( funk ) function }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12040.d b/gcc/testsuite/gdc.test/fail_compilation/ice12040.d
new file mode 100644
index 00000000000..2307e9422aa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12040.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12040.d(8): Error: circular reference to 'ice12040.lol'
+---
+*/
+
+bool[lol.length] lol;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12158.d b/gcc/testsuite/gdc.test/fail_compilation/ice12158.d
new file mode 100644
index 00000000000..7b8d38d4cec
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12158.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12158.d(7): Error: module object import 'nonexisting' not found
+---
+*/
+import object : nonexisting;
+auto x = nonexisting.init;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12174.d b/gcc/testsuite/gdc.test/fail_compilation/ice12174.d
new file mode 100644
index 00000000000..81fef2d7f57
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12174.d
@@ -0,0 +1,51 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12174.d(12): Error: no property 'sum' for type 'int[]'
+fail_compilation/ice12174.d(20): Error: CTFE failed because of previous errors in this
+fail_compilation/ice12174.d(13):        called from here: filter([1, 2, 3])
+---
+*/
+
+void main()
+{
+    enum foo3 = (int n) => [1,2,3].sum;
+    enum bar3 = [1,2,3].filter!(n => n % foo3(n) == 0);
+}
+
+template filter(alias pred)
+{
+    auto filter(Range)(Range rs)
+    {
+        return FilterResult!(pred, Range)(rs);
+    }
+}
+
+private struct FilterResult(alias pred, R)
+{
+    R _input;
+
+    this(R r)
+    {
+        _input = r;
+        while (_input.length && !pred(_input[0]))
+        {
+            _input = _input[1..$];
+        }
+    }
+
+    @property bool empty() { return _input.length == 0; }
+
+    @property auto ref front()
+    {
+        return _input[0];
+    }
+
+    void popFront()
+    {
+        do
+        {
+            _input = _input[1..$];
+        } while (_input.length && !pred(_input[0]));
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12235.d b/gcc/testsuite/gdc.test/fail_compilation/ice12235.d
new file mode 100644
index 00000000000..1bf55b90ac3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12235.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12235.d(14): Error: forward reference to inferred return type of function '__lambda1'
+fail_compilation/ice12235.d(15): Error: forward reference to inferred return type of function '__lambda1'
+fail_compilation/ice12235.d(15):        while evaluating pragma(msg, __lambda1.mangleof)
+---
+*/
+
+void main()
+{
+    (){
+        int x;
+        enum s = __traits(parent, x).mangleof;
+        pragma(msg, __traits(parent, x).mangleof);
+    }();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12350.d b/gcc/testsuite/gdc.test/fail_compilation/ice12350.d
new file mode 100644
index 00000000000..3ac3751d2c2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12350.d
@@ -0,0 +1,31 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12350.d(15): Error: type MyUDC has no value
+fail_compilation/ice12350.d(30): Error: template instance ice12350.testAttrs!(MyStruct) error instantiating
+---
+*/
+
+
+enum MyUDC;
+
+struct MyStruct
+{
+    int a;
+    @MyUDC int b;
+}
+
+void testAttrs(T)(const ref T t)
+if (is(T == struct))
+{
+    foreach (name; __traits(allMembers, T))
+    {
+        auto tr = __traits(getAttributes, __traits(getMember, t, name));
+    }
+}
+
+void main()
+{
+    MyStruct s;
+    testAttrs(s);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12362.d b/gcc/testsuite/gdc.test/fail_compilation/ice12362.d
new file mode 100644
index 00000000000..2c662c050d2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12362.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12362.d(12): Error: cannot interpret foo at compile time
+---
+*/
+
+enum foo;
+
+void main()
+{
+    enum bar = foo;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12397.d b/gcc/testsuite/gdc.test/fail_compilation/ice12397.d
new file mode 100644
index 00000000000..61b0ddd1ea4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12397.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12397.d(12): Error: undefined identifier 'tokenLookup'
+---
+*/
+
+struct DSplitter
+{
+    enum Token : int
+    {
+        max = tokenLookup.length
+    }
+
+    immutable string[Token.max] tokenText;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12497.d b/gcc/testsuite/gdc.test/fail_compilation/ice12497.d
new file mode 100644
index 00000000000..f18cafb21ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12497.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12497.d(15): Error: argument to mixin must be a string, not (foo()) of type void
+fail_compilation/ice12497.d(17): Error: argument to mixin must be a string, not (foo()) of type void
+---
+*/
+
+void foo() {}
+
+void main()
+{
+    struct S
+    {
+        mixin(foo());   // MixinDeclaration
+    }
+    mixin(foo());       // MixinStatement
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12501.d b/gcc/testsuite/gdc.test/fail_compilation/ice12501.d
new file mode 100644
index 00000000000..f57980d7bc3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12501.d
@@ -0,0 +1,44 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12501.d(29): Error: function ice12501.foo (int value) is not callable using argument types (int, int)
+fail_compilation/ice12501.d(29): Error: function ice12501.foo (int value) is not callable using argument types (int, int)
+fail_compilation/ice12501.d(43): Error: template instance ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[]) error instantiating
+---
+*/
+
+struct Tuple(T...)
+{
+    alias Types = T;
+    T field;
+    alias field this;
+}
+Tuple!A tuple(A...)(A args) { return typeof(return)(args); }
+
+template reduce(fun...)
+{
+    auto reduce(Args...)(Args args)
+    {
+        alias seed = args[0];
+        alias r    = args[1];
+        Args[0] result = seed;
+        for (; r.length != 0; r = r[1..$])
+        {
+            foreach (i, Unused; Args[0].Types)
+            {
+                result[i] = fun[i](result[i], r[0]);
+            }
+        }
+        return result;
+    }
+}
+
+int foo(int value)
+{
+    return value;
+}
+
+void main()
+{
+    reduce!(foo, foo)(tuple(0, 0), [ 1 ]);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12534.d b/gcc/testsuite/gdc.test/fail_compilation/ice12534.d
new file mode 100644
index 00000000000..7548925ac6c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12534.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12534.d(14): Error: static assert  (is(exprs[0 .. 0])) is false
+---
+*/
+
+alias TypeTuple(T...) = T;
+
+void main()
+{
+    int x, y;
+    alias exprs = TypeTuple!(x, y);
+    static assert(is(exprs[0..0]));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12539.d b/gcc/testsuite/gdc.test/fail_compilation/ice12539.d
new file mode 100644
index 00000000000..e1ad9941b1d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12539.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12539.d(15): Error: array index [0] is outside array bounds [0 .. 0]
+---
+*/
+
+alias TypeTuple(E...) = E;
+
+void main ()
+{
+    int[string] map;
+
+    alias Foo = TypeTuple!();
+    auto a = map[Foo[0]];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12574.d b/gcc/testsuite/gdc.test/fail_compilation/ice12574.d
new file mode 100644
index 00000000000..362c359de59
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12574.d
@@ -0,0 +1,54 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12574.d(40): Error: tuple index 2 exceeds length 2
+fail_compilation/ice12574.d(53): Error: template instance ice12574.reduce!("a", "a").reduce!(Tuple!(int, int, int)) error instantiating
+---
+*/
+
+struct Tuple(T...)
+{
+    alias Types = T;
+    T field;
+    alias field this;
+}
+Tuple!A tuple(A...)(A args) { return typeof(return)(args); }
+
+template binaryFun(alias fun)
+{
+    static if (is(typeof(fun) : string))
+    {
+        auto binaryFun(ElementType1, ElementType2)(auto ref ElementType1 __a, auto ref ElementType2 __b)
+        {
+            mixin("alias "~"a"~" = __a ;");
+            mixin("alias "~"b"~" = __b ;");
+            return mixin(fun);
+        }
+    }
+    else
+    {
+        alias binaryFun = fun;
+    }
+}
+
+template reduce(fun...)
+{
+    auto reduce(Seed)(Seed result)
+    {
+        foreach (i, Unused; Seed.Types)
+        {
+           result[i] = binaryFun!(fun[i])(1, 1); // here
+        }
+        return result;
+    }
+}
+
+int foo(int value)
+{
+    return value;
+}
+
+void main()
+{
+    reduce!("a", "a")(tuple(1, 1, 1));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12581.d b/gcc/testsuite/gdc.test/fail_compilation/ice12581.d
new file mode 100644
index 00000000000..62f9dc5cac8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12581.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12581.d(21): Error: undefined identifier 'undef'
+---
+*/
+
+struct S
+{
+    int[3] a;
+    alias a this;
+}
+struct T
+{
+    S s;
+    alias s this;
+}
+void main()
+{
+    T x;
+    x[] = (undef = 1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12673.d b/gcc/testsuite/gdc.test/fail_compilation/ice12673.d
new file mode 100644
index 00000000000..57f0ec00c25
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12673.d
@@ -0,0 +1,4 @@
+void main()
+{
+    static assert(__traits(compiles, { abcd(); }));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12727.d b/gcc/testsuite/gdc.test/fail_compilation/ice12727.d
new file mode 100644
index 00000000000..027894c51e9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12727.d
@@ -0,0 +1,28 @@
+/*
+TEST_OUTPUT:
+----
+fail_compilation/ice12727.d(16): Error: alias ice12727.IndexTuple!(1, 0).IndexTuple recursive alias declaration
+fail_compilation/ice12727.d(23): Error: template instance ice12727.IndexTuple!(1, 0) error instantiating
+fail_compilation/ice12727.d(27):        instantiated from here: Matrix!(float, 3)
+fail_compilation/ice12727.d(28):        instantiated from here: Vector!(float, 3)
+----
+*/
+
+template IndexTuple(int e, int s = 0, T...)
+{
+    static if (s == e)
+        alias IndexTuple = T;
+    else
+        alias IndexTuple = IndexTuple!(e);
+}
+
+struct Matrix(T, int N = M)
+{
+    pure decomposeLUP()
+    {
+        foreach (j; IndexTuple!(1)) {}
+    }
+}
+
+alias Vector(T, int M) = Matrix!(T, M);
+alias Vector3 = Vector!(float, 3);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12827.d b/gcc/testsuite/gdc.test/fail_compilation/ice12827.d
new file mode 100644
index 00000000000..8270c1fe85b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12827.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12827.d(10): Error: circular initialization of variable 'ice12827.Test.i'
+---
+*/
+
+struct Test
+{
+	immutable int i = i;
+}
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12836.d b/gcc/testsuite/gdc.test/fail_compilation/ice12836.d
new file mode 100644
index 00000000000..f7058895f7c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12836.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12836.d(9): Error: undefined identifier 'C'
+fail_compilation/ice12836.d(9): Error: undefined identifier 'K'
+---
+*/
+
+immutable C L = 1 << K;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12838.d b/gcc/testsuite/gdc.test/fail_compilation/ice12838.d
new file mode 100644
index 00000000000..04072280d03
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12838.d
@@ -0,0 +1,28 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12838.d(27): Error: cannot implicitly convert expression (1) of type int to string
+---
+*/
+
+struct Tuple(T...)
+{
+    T field;
+    alias field this;
+}
+
+struct Data
+{
+    string a;
+}
+
+template toTuple(T)
+{
+    mixin(`alias toTuple = Tuple!(string);`);
+}
+
+void main()
+{
+    toTuple!Data a;
+    a[0] = 1;   // ICE!
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12841.d b/gcc/testsuite/gdc.test/fail_compilation/ice12841.d
new file mode 100644
index 00000000000..f1670deac12
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12841.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12841.d(23): Error: taskPool().amap!"a.result()" is not an lvalue
+fail_compilation/ice12841.d(24): Error: amap!"a.result()" is not an lvalue
+---
+*/
+
+@property TaskPool taskPool() @trusted { return new TaskPool; }
+
+final class TaskPool
+{
+    template amap(functions...)
+    {
+        auto amap(Args...)(Args args)
+        {
+        }
+    }
+}
+
+void main()
+{
+    auto dg = &(taskPool.amap!"a.result()");
+    auto fp = &(TaskPool.amap!"a.result()");
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12850.d b/gcc/testsuite/gdc.test/fail_compilation/ice12850.d
new file mode 100644
index 00000000000..9e1cb0e1685
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12850.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12850.d(12): Error: cannot implicitly convert expression (0) of type int to string
+---
+*/
+alias TypeTuple(TL...) = TL;
+
+void main()
+{
+    int[string] arr;
+    alias staticZip = TypeTuple!(arr[0]);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12902.d b/gcc/testsuite/gdc.test/fail_compilation/ice12902.d
new file mode 100644
index 00000000000..e5ada0947de
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12902.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12902.d(20): Error: variable ice12902.main.__dollar type void is inferred from initializer s.opDollar(), and variables cannot be of type void
+fail_compilation/ice12902.d(20): Error: expression s.opDollar() is void and has no value
+---
+*/
+
+struct S
+{
+    void opDollar() { }
+    void opIndex() { }
+    void opIndexAssign() { }
+    void opSliceAssign() { }
+}
+
+void main()
+{
+    S s;
+    s[] = s[$];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12907.d b/gcc/testsuite/gdc.test/fail_compilation/ice12907.d
new file mode 100644
index 00000000000..9f758dbaefe
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice12907.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice12907.d(10): Error: template lambda has no type
+---
+*/
+
+auto f(void function() g)
+{
+    return x => (*g)();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13024.d b/gcc/testsuite/gdc.test/fail_compilation/ice13024.d
new file mode 100644
index 00000000000..f86da69cb7d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13024.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13024.d(15): Error: cannot implicitly convert expression (t.x) of type A to B
+---
+*/
+
+enum A { a }
+enum B { b }
+struct T { A x; B y; }
+void main()
+{
+    T t;
+    auto r1 = [cast(int)(t.x), cast(int)(t.y)]; // OK
+    auto r3 = [t.x, t.y]; // crash
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13027.d b/gcc/testsuite/gdc.test/fail_compilation/ice13027.d
new file mode 100644
index 00000000000..04ccdf3e4f7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13027.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13027.d(9): Error: template instance b!"c" template 'b' is not defined
+---
+*/
+void main()
+{
+    scope a = b!"c";
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13081.d b/gcc/testsuite/gdc.test/fail_compilation/ice13081.d
new file mode 100644
index 00000000000..64c0cde9bb3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13081.d
@@ -0,0 +1,29 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13081.d(17): Error: undefined identifier 'node'
+fail_compilation/ice13081.d(17): Error: undefined identifier 'data'
+fail_compilation/ice13081.d(17): Error: undefined identifier 'node'
+fail_compilation/ice13081.d(28): Error: template instance ice13081.Cube!(SparseDataStore) error instantiating
+---
+*/
+
+struct Cube(StorageT)
+{
+    StorageT datastore;
+    alias datastore this;
+    auto seed()
+    {
+        this[] = node.data ? data : node.data;
+    }
+}
+
+class SparseDataStore
+{
+    auto opSlice() {}
+}
+
+void main()
+{
+    Cube!SparseDataStore c;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13131.d b/gcc/testsuite/gdc.test/fail_compilation/ice13131.d
new file mode 100644
index 00000000000..13b5aff9d5b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13131.d
@@ -0,0 +1,20 @@
+// EXTRA_SOURCES: imports/a13131parameters.d imports/a13131elec.d
+/*
+TEST_OUTPUT:
+---
++A
++B
+fail_compilation/imports/a13131elec.d(10): Error: template instance elecConnOf!gconn template 'elecConnOf' is not defined
+-B
+-A
+---
+*/
+
+void main()
+{
+    struct Connectivity {}
+    auto L = Connectivity();
+
+    import imports.a13131elec;          // [1] import
+    L.initElec;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13220.d b/gcc/testsuite/gdc.test/fail_compilation/ice13220.d
new file mode 100644
index 00000000000..3affd54858f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13220.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13220.d(22): Error: template instance test!0 does not match template declaration test(T)()
+---
+*/
+
+struct Tuple(T...)
+{
+    T field;
+    alias field this;
+}
+
+template test(T)
+{
+    bool test() { return false; };
+}
+
+void main()
+{
+    Tuple!bool t;
+    t[0] = test!0();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13221.d b/gcc/testsuite/gdc.test/fail_compilation/ice13221.d
new file mode 100644
index 00000000000..b00169e4098
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13221.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13221.d(20): Error: variable r cannot be read at compile time
+---
+*/
+
+struct Tuple(T...)
+{
+    T field;
+    alias field this;
+}
+
+template test(T) {}
+
+void main()
+{
+    foreach (r; 0 .. 0)
+    {
+        enum i = r;
+        test!(Tuple!bool[i]);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13225.d b/gcc/testsuite/gdc.test/fail_compilation/ice13225.d
new file mode 100644
index 00000000000..6f523e9eb89
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13225.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13225.d(12): Error: mixin ice13225.S.M!(function (S _param_0) => 0) does not match template declaration M(T)
+fail_compilation/ice13225.d(13): Error: undefined identifier 'undefined'
+---
+*/
+mixin template M(T) {}
+
+struct S
+{
+    mixin M!((typeof(this)) => 0);
+    mixin M!(() => undefined);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13259.d b/gcc/testsuite/gdc.test/fail_compilation/ice13259.d
new file mode 100644
index 00000000000..d6885842e97
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13259.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13259.d(8): Error: non-constant nested delegate literal expression __dgliteral3
+---
+*/
+
+auto dg = delegate {};
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13311.d b/gcc/testsuite/gdc.test/fail_compilation/ice13311.d
new file mode 100644
index 00000000000..c26d1a459da
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13311.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/a13311.d(8): Error: undefined identifier 'PieceTree'
+---
+*/
+module ice13311;
+
+struct TextPiece
+{
+    import imports.a13311;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13356.d b/gcc/testsuite/gdc.test/fail_compilation/ice13356.d
new file mode 100644
index 00000000000..9225d55147f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13356.d
@@ -0,0 +1,41 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13356.d(32): Error: template instance Algebraic!(Tuple!(List)) recursive template expansion
+fail_compilation/ice13356.d(15): Error: template instance ice13356.isPrintable!(List) error instantiating
+fail_compilation/ice13356.d(33):        instantiated from here: Tuple!(List)
+---
+*/
+
+struct Tuple(Types...)
+{
+    Types expand;
+    alias expand this;
+
+    static if (isPrintable!(Types[0]))
+    {
+    }
+}
+
+// T == Tuple!List, and accessing its .init will cause unresolved forward reference
+enum bool isPrintable(T) = is(typeof({ T t; }));
+
+struct Algebraic(AllowedTypesX...)
+{
+    alias AllowedTypes = AllowedTypesX;
+
+    double x;   // dummy for the syntax Payload(d)
+}
+
+struct List
+{
+    alias Payload = Algebraic!(
+        Tuple!(List)
+    );
+
+    Payload payload;
+
+    this(double d) { payload = Payload(d); }
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13382.d b/gcc/testsuite/gdc.test/fail_compilation/ice13382.d
new file mode 100644
index 00000000000..e5f1ac0f3f9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13382.d
@@ -0,0 +1,26 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13382.d(18): Error: incompatible types for ((a) == (0)): 'int[]' and 'int'
+fail_compilation/ice13382.d(19): Error: incompatible types for ((a) >= (0)): 'int[]' and 'int'
+fail_compilation/ice13382.d(20): Error: incompatible types for ((0) == (a)): 'int' and 'int[]'
+fail_compilation/ice13382.d(21): Error: incompatible types for ((0) >= (a)): 'int' and 'int[]'
+fail_compilation/ice13382.d(22): Error: incompatible types for ((a) is (0)): 'int[]' and 'int'
+fail_compilation/ice13382.d(23): Error: incompatible types for ((a) !is (0)): 'int[]' and 'int'
+fail_compilation/ice13382.d(24): Error: incompatible types for ((0) is (a)): 'int' and 'int[]'
+fail_compilation/ice13382.d(25): Error: incompatible types for ((0) !is (a)): 'int' and 'int[]'
+---
+*/
+
+void main ()
+{
+    int[] a;
+    if (a == 0) {}
+    if (a >= 0) {}
+    if (0 == a) {}
+    if (0 >= a) {}
+    if (a  is 0) {}
+    if (a !is 0) {}
+    if (0  is a) {}
+    if (0 !is a) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13385.d b/gcc/testsuite/gdc.test/fail_compilation/ice13385.d
new file mode 100644
index 00000000000..fcd862440a6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13385.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13385.d(9): Error: protection attribute 'package(a)' does not bind to one of ancestor packages of module 'ice13385'
+---
+*/
+module ice13385;
+
+package(a) void foo() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13459.d b/gcc/testsuite/gdc.test/fail_compilation/ice13459.d
new file mode 100644
index 00000000000..d4bb11f2a20
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13459.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13459.d(12): Error: undefined identifier 'B'
+fail_compilation/ice13459.d(18): Error: none of the overloads of 'opSlice' are callable using argument types (int, int), candidates are:
+fail_compilation/ice13459.d(11):        ice13459.A.opSlice()
+---
+*/
+struct A
+{
+    auto opSlice() {}
+    auto opSlice() { return B; }
+}
+
+void main()
+{
+    auto df = A();
+    foreach (fi; df[0..0]) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13465a.d b/gcc/testsuite/gdc.test/fail_compilation/ice13465a.d
new file mode 100644
index 00000000000..23f73b78ce5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13465a.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -o-
+// EXTRA_SOURCES: imports/a13465.d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/a13465.d(10): Error: cannot infer type from template instance isMaskField!()
+fail_compilation/ice13465a.d(17): Error: template instance imports.a13465.isMatchingMaskField!() error instantiating
+---
+*/
+
+module ice13465a;
+
+import imports.a13465;
+
+auto createCheckpointMixins()
+{
+    enum b = isMatchingMaskField!();
+}
+
+immutable checkpointMixins = createCheckpointMixins;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13465b.d b/gcc/testsuite/gdc.test/fail_compilation/ice13465b.d
new file mode 100644
index 00000000000..db0cce1a56a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13465b.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -o-
+// EXTRA_SOURCES: imports/b13465.d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/b13465.d(10): Error: cannot infer type from template instance isMaskField!()
+fail_compilation/ice13465b.d(17): Error: template instance imports.b13465.isMatchingMaskField!() error instantiating
+---
+*/
+
+module ice13465b;
+
+import imports.b13465;
+
+auto createCheckpointMixins()
+{
+    enum b = isMatchingMaskField!();
+}
+
+immutable checkpointMixins = createCheckpointMixins;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13563.d b/gcc/testsuite/gdc.test/fail_compilation/ice13563.d
new file mode 100644
index 00000000000..261bac78ca1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13563.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13563.d(23): Error: undefined identifier 'z' in module 'ice13563'
+---
+*/
+
+struct Payload
+{
+    void opIndex(K)(K i) {}
+    void opIndexAssign(T, N)(T value, N i) {}
+}
+
+struct Value
+{
+    Payload payload;
+    alias payload this;
+}
+
+void main()
+{
+    Value v;
+    v["name"] = .z();           // ICE
+  //v["name"] = z();            // OK
+  //v.opIndex("name") = .z();   // OK
+  //v.payload["name"] = .z();   // OK
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice1358.d b/gcc/testsuite/gdc.test/fail_compilation/ice1358.d
new file mode 100644
index 00000000000..ee71f8cb345
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice1358.d
@@ -0,0 +1,29 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice1358.d(29): Error: invalid UTF character \U80000000
+---
+*/
+
+// Issue 1358 - ICE(root.c) on Unicode codepoints greater than 0x7FFFFFFF
+
+/* 1358. Assertion failure: '0' on line 1548 in file '..\root\root.c'
+This one is trivial.
+PATCH(lexer.c, Lexer::escapeSequence()).
+--- lexer.c (revision 24)
++++ lexer.c (working copy)
+@@ -1281,8 +1281,10 @@
+                            break;
+                        }
+                     }
+-                    if (ndigits != 2 && !utf_isValidDchar(v))
++                        if (ndigits != 2 && !utf_isValidDchar(v)) {
+                         error("invalid UTF character \\U%08x", v);
++                        v = 0; // prevent ICE
++                        }
+                     c = v;
+                 }
+                 else
+
+*/
+auto bla = "\U80000000";
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13644.d b/gcc/testsuite/gdc.test/fail_compilation/ice13644.d
new file mode 100644
index 00000000000..87e56e428fb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13644.d
@@ -0,0 +1,19 @@
+
+struct Tuple(T...)
+{
+    T field;
+    alias field this;
+}
+
+Tuple!(string, string)[] foo()
+{
+    Tuple!(string, string)[] res;
+    return res;
+}
+
+void main()
+{
+    foreach (string k2, string v2; foo())
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13788.d b/gcc/testsuite/gdc.test/fail_compilation/ice13788.d
new file mode 100644
index 00000000000..cf437f95f17
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13788.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13788.d(11): Error: pragma mangle string expected for mangled name
+fail_compilation/ice13788.d(12): Error: pragma mangle string expected for mangled name, not '1'
+fail_compilation/ice13788.d(13): Error: pragma mangle zero-length string not allowed for mangled name
+fail_compilation/ice13788.d(14): Error: pragma mangle mangled name characters can only be of type char
+---
+*/
+
+pragma(mangle) void f1();
+pragma(mangle, 1) void f2();
+pragma(mangle, "") void f3();
+pragma(mangle, "a"w) void f4();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13816.d b/gcc/testsuite/gdc.test/fail_compilation/ice13816.d
new file mode 100644
index 00000000000..6745d7b68e7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13816.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13816.d(15): Error: alias ice13816.ItemProperty!().ItemProperty recursive alias declaration
+fail_compilation/ice13816.d(20): Error: template instance ice13816.ItemProperty!() error instantiating
+---
+*/
+
+alias TypeTuple(T...) = T;
+
+template ItemProperty()
+{
+    static if (true)
+    {
+        alias ItemProperty = TypeTuple!(ItemProperty!());
+    }
+}
+void main()
+{
+    alias items = ItemProperty!();
+
+    enum num = items.length;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13835.d b/gcc/testsuite/gdc.test/fail_compilation/ice13835.d
new file mode 100644
index 00000000000..d07d7add459
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13835.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUPUT:
+---
+fail_compilation/ice13835.d(15): Error: value of 'this' is not known at compile time
+fail_compilation/ice13835.d(21): Error: template instance ice13835.Foo!int error instantiating
+---
+*/
+
+class Foo(T)
+{
+    private T* _data;
+
+    final private void siftUp(int position) nothrow
+    {
+        static T crash = *(this._data + position);
+    }
+}
+
+void main()
+{
+    auto heap = new Foo!(int);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13921.d b/gcc/testsuite/gdc.test/fail_compilation/ice13921.d
new file mode 100644
index 00000000000..f652417ab91
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13921.d
@@ -0,0 +1,27 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13921.d(13): Error: undefined identifier 'undefined_identifier'
+fail_compilation/ice13921.d(25): Error: template instance ice13921.S!string error instantiating
+---
+*/
+
+struct S(N)
+{
+    void fun()
+    {
+        undefined_identifier;
+        // or anything that makes the instantiation fail
+    }
+
+}
+
+void test(T)(S!T)
+{
+}
+
+void main()
+{
+    S!string g;
+    test(g);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice13987.d b/gcc/testsuite/gdc.test/fail_compilation/ice13987.d
new file mode 100644
index 00000000000..26d3d300a89
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice13987.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice13987.d(9): Error: cannot use array to initialize S
+---
+*/
+
+struct S {}
+S s = [{}];
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14055.d b/gcc/testsuite/gdc.test/fail_compilation/ice14055.d
new file mode 100644
index 00000000000..5e60e88cdf8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14055.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14055.d(16): Error: uninitialized variable 'foo' cannot be returned from CTFE
+---
+*/
+
+struct S
+{
+    static returnsFoo()
+    {
+        uint[1] foo = void;
+        return foo;
+    }
+
+    static enum fooEnum = returnsFoo();
+    static uint[1] fooArray = fooEnum[];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14096.d b/gcc/testsuite/gdc.test/fail_compilation/ice14096.d
new file mode 100644
index 00000000000..654cfcc7989
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14096.d
@@ -0,0 +1,41 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14096.d(29): Error: cannot access frame pointer of ice14096.main.Baz!((i) => i).Baz
+fail_compilation/ice14096.d(23): Error: template instance ice14096.foo!(Tuple!(Baz!((i) => i))).foo.bar!(t) error instantiating
+fail_compilation/ice14096.d(40):        instantiated from here: foo!(Tuple!(Baz!((i) => i)))
+---
+*/
+
+struct Tuple(Types...)
+{
+    Types expand;
+    alias expand this;
+    alias field = expand;
+}
+Tuple!T tuple(T...)(T args)
+{
+    return typeof(return)(args);
+}
+
+auto foo(T)(T t)
+{
+    bar!t();
+}
+
+auto bar(alias s)()
+{
+    // default construction is not possible for: Tuple!(Baz!(i => i))
+    typeof(s) p;
+}
+
+struct Baz(alias f)
+{
+    void g() {}
+}
+
+void main()
+{
+    auto t = tuple(Baz!(i => i)());
+    foo(t);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14116.d b/gcc/testsuite/gdc.test/fail_compilation/ice14116.d
new file mode 100644
index 00000000000..52cd8ce5a10
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14116.d
@@ -0,0 +1,11 @@
+// EXTRA_SOURCES: imports/a14116.d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/a14116.d(3): Error: module ice14116.ice14116 from file fail_compilation/ice14116.d must be imported with 'import ice14116.ice14116;'
+---
+*/
+
+module ice14116.ice14116;
+
+void foo() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14130.d b/gcc/testsuite/gdc.test/fail_compilation/ice14130.d
new file mode 100644
index 00000000000..4e50c2d3778
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14130.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14130.d(10): Error: undefined identifier 'Undef'
+fail_compilation/ice14130.d(14): Error: template ice14130.foo cannot deduce function from argument types !()(int), candidates are:
+fail_compilation/ice14130.d(10):        ice14130.foo(R, F = Undef)(R r, F s = 0)
+---
+*/
+
+F foo(R, F = Undef)(R r, F s = 0) {}
+
+void main()
+{
+    0.foo;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14146.d b/gcc/testsuite/gdc.test/fail_compilation/ice14146.d
new file mode 100644
index 00000000000..1e4f9a976e5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14146.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14146.d(15): Error: constructor ice14146.Array.this default constructor for structs only allowed with @disable, no body, and no parameters
+---
+*/
+
+struct RangeT(A)
+{
+    A[1] XXXouter;
+}
+
+struct Array
+{
+    this()
+    {
+    }
+
+    alias Range = RangeT!Array;
+
+    bool opEquals(Array)
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14177.d b/gcc/testsuite/gdc.test/fail_compilation/ice14177.d
new file mode 100644
index 00000000000..b487c2b347e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14177.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+----
+fail_compilation/ice14177.d(8): Error: alias ice14177.Primitive recursive alias declaration
+----
+*/
+
+alias Primitive = Atom*;
+alias Atom = Primitive;
+
+void main()
+{
+    Atom atom;
+    atom;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14185.d b/gcc/testsuite/gdc.test/fail_compilation/ice14185.d
new file mode 100644
index 00000000000..e2e058003ef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14185.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14185.d(12): Error: cannot implicitly convert expression (this) of type Mutexed to Mutexed*
+---
+*/
+
+struct Mutexed
+{
+	auto acquire ()
+	{
+		return Lock (this);
+	}
+	alias acquire this;
+
+	struct Lock
+	{
+		Mutexed* source;
+	}
+}
+void main ()
+{
+	Mutexed x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14272.d b/gcc/testsuite/gdc.test/fail_compilation/ice14272.d
new file mode 100644
index 00000000000..d9f642dd3cc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14272.d
@@ -0,0 +1,14 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14272.d(11): Error: circular initialization of variable 'ice14272.A14272!1.A14272.tag'
+fail_compilation/ice14272.d(14): Error: template instance ice14272.A14272!1 error instantiating
+---
+*/
+
+struct A14272(int tag)
+{
+    enum int tag = tag;
+}
+
+alias a14272 = A14272!1;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14424.d b/gcc/testsuite/gdc.test/fail_compilation/ice14424.d
new file mode 100644
index 00000000000..cace1d575fe
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14424.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -o- -unittest
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14424.d(12): Error: tuple has no effect in expression (tuple(__unittestL3_$n$))
+---
+*/
+
+void main()
+{
+    import imports.a14424;
+    __traits(getUnitTests, imports.a14424);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14446.d b/gcc/testsuite/gdc.test/fail_compilation/ice14446.d
new file mode 100644
index 00000000000..ee0bfc450b2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14446.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: extra-files/a14446.d
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/extra-files/a14446.d(5): Error: module x14446 from file fail_compilation/ice14446.d must be imported with 'import x14446;'
+---
+*/
+
+module x14446;
+
+struct CDB {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14621.d b/gcc/testsuite/gdc.test/fail_compilation/ice14621.d
new file mode 100644
index 00000000000..c48f856aa6b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14621.d
@@ -0,0 +1,30 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14621.d(22): Error: static assert  (false) is false
+fail_compilation/ice14621.d(28):        instantiated from here: erroneousTemplateInstantiation!()
+---
+*/
+
+void main()
+{
+    S s;
+    s.foo();
+}
+
+struct S
+{
+    float[] array;
+    alias array this;
+
+    template erroneousTemplateInstantiation()
+    {
+        static assert(false);
+    }
+
+    void foo()
+    {
+        S ret;
+        ret[] = erroneousTemplateInstantiation!();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14642.d b/gcc/testsuite/gdc.test/fail_compilation/ice14642.d
new file mode 100644
index 00000000000..b4ab3e118c4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14642.d
@@ -0,0 +1,52 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14642.d(47): Error: undefined identifier 'errorValue'
+fail_compilation/ice14642.d(23): Error: template instance ice14642.X.NA!() error instantiating
+---
+*/
+
+alias TypeTuple(T...) = T;
+
+struct X
+{
+    static struct NA()
+    {
+        X x;
+
+        void check()
+        {
+            x.func();
+        }
+    }
+
+    alias na = NA!();
+
+    auto func()
+    {
+        Y* p;
+        p.func();
+    }
+}
+
+struct Y
+{
+    mixin Mix;
+}
+
+template Mix()
+{
+    void func()
+    {
+        auto z = Z(null);
+    }
+}
+
+struct Type(size_t v) {}
+
+enum errVal = errorValue;
+
+struct Z
+{
+    Type!errVal v;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14844.d b/gcc/testsuite/gdc.test/fail_compilation/ice14844.d
new file mode 100644
index 00000000000..ad3af953547
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14844.d
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14844.d(20): Error: template opDispatch(string name) has no members
+---
+*/
+
+struct Typedef
+{
+    template opDispatch(string name)
+    {
+        static if (true)
+        {
+        }
+    }
+}
+
+void runUnitTestsImpl()
+{
+    foreach (x; __traits(allMembers, Typedef.opDispatch))
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14923.d b/gcc/testsuite/gdc.test/fail_compilation/ice14923.d
new file mode 100644
index 00000000000..86e3b2a2071
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14923.d
@@ -0,0 +1,28 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14923.d(21): Error: function ice14923.parse (C a) is not callable using argument types (A)
+fail_compilation/ice14923.d(21):        instantiated from here: bar!((b) => parse(b))
+---
+*/
+
+auto bar(alias fun)()
+{
+    size_t counter;
+    scope(exit) counter++;
+
+    Object a2;
+    if (auto ai = cast(A)a2) return fun(ai);
+    if (auto ai = cast(B)a2) return fun(ai);
+}
+
+void parse(C a)
+{
+    bar!(b => parse(b))();
+}
+
+class A {}
+
+class C {}
+
+class B : C {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14929.d b/gcc/testsuite/gdc.test/fail_compilation/ice14929.d
new file mode 100644
index 00000000000..68721c87cd9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice14929.d
@@ -0,0 +1,96 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice14929.d(45): Error: cast(Node)(*this.current).items[this.index] is not an lvalue
+fail_compilation/ice14929.d(88): Error: template instance ice14929.HashMap!(ulong, int).HashMap.opBinaryRight!"in" error instantiating
+fail_compilation/ice14929.d(92):        instantiated from here: HashmapComponentStorage!int
+fail_compilation/ice14929.d(92): Error: template instance ice14929.isComponentStorage!(HashmapComponentStorage!int, int) error instantiating
+fail_compilation/ice14929.d(92):        while evaluating: static assert(isComponentStorage!(HashmapComponentStorage!int, int))
+---
+*/
+
+struct HashMap(K, V)
+{
+    V* opBinaryRight(string op)(K key) const if (op == "in")
+    {
+        size_t index;
+        foreach (ref node; buckets[index].range)
+        {
+            return &(node.value);
+        }
+        return null;
+    }
+
+    struct Node
+    {
+        K key;
+        V value;
+    }
+
+    alias Bucket = UnrolledList!(Node);
+    Bucket[] buckets;
+}
+
+struct UnrolledList(T)
+{
+    Range range() const pure
+    {
+        return Range(_front);
+    }
+
+    static struct Range
+    {
+        ref T front() const @property
+        {
+            return cast(T) current.items[index];
+        }
+        void popFront() pure
+        {
+        }
+        bool empty() const pure @property
+        {
+            return true;
+        }
+        const(Node)* current;
+        size_t index;
+    }
+
+    Node* _front;
+
+    static struct Node
+    {
+        ContainerStorageType!T[10] items;
+    }
+}
+
+template ContainerStorageType(T)
+{
+    alias ContainerStorageType = T;
+}
+
+template isComponentStorage(CS, C)
+{
+    enum bool isComponentStorage = is(typeof(
+    (inout int = 0)
+    {
+        CS cs = CS.init;
+        ulong eid;
+        cs.add(eid, c);
+    }));
+}
+
+struct HashmapComponentStorage(ComponentType)
+{
+    private HashMap!(ulong, ComponentType) components;
+
+    void add(ulong eid, ComponentType component)
+    {
+        assert(eid !in components);
+    }
+}
+
+static assert(isComponentStorage!(HashmapComponentStorage!int, int));
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice15002.d b/gcc/testsuite/gdc.test/fail_compilation/ice15002.d
new file mode 100644
index 00000000000..139c05313eb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice15002.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice15002.d(10): Error: array index 5 is out of bounds x[0 .. 3]
+fail_compilation/ice15002.d(10): Error: array index 5 is out of bounds x[0 .. 3]
+---
+*/
+
+int[][3] x = [];
+int* p = &x[5][0];
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice15092.d b/gcc/testsuite/gdc.test/fail_compilation/ice15092.d
new file mode 100644
index 00000000000..0064ae37d97
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice15092.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice15092.d(13): Error: struct ice15092.A.S conflicts with struct ice15092.A.S at fail_compilation/ice15092.d(12)
+fail_compilation/ice15092.d(16): Error: class ice15092.A.C conflicts with class ice15092.A.C at fail_compilation/ice15092.d(15)
+fail_compilation/ice15092.d(19): Error: interface ice15092.A.I conflicts with interface ice15092.A.I at fail_compilation/ice15092.d(18)
+---
+*/
+
+class A
+{
+    struct S {}
+    struct S {}
+
+    class C {}
+    class C {}
+
+    interface I {}
+    interface I {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice15172.d b/gcc/testsuite/gdc.test/fail_compilation/ice15172.d
new file mode 100644
index 00000000000..dc8ae9444fa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice15172.d
@@ -0,0 +1,33 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice15172.d(14): Error: constructor ice15172.ThreadError.this no match for implicit super() call in constructor
+---
+*/
+
+// 1. ClassDeclaration.semantic
+class ThreadError : Error
+{
+    // 2. FuncDeclaration.semantic
+    // 4. FuncDeclaration.semantic3
+    //    --> error happens
+    this(string)
+    {
+    }
+}
+
+// 3. FuncDeclaration.semantic
+// 5. FuncDeclaration.semantic3
+void onThreadError()
+{
+    // 6. NewExp.semantic
+    //    --> cd.members.errors == false, cd.members.semantic3Errors == true
+    //    BUT, The ThreadError class constructor is not a template function, so
+    //    the errors inside its function body won't be associated with the validness of this NewExp.
+    //    Therefore, converting the semantic3Error to ErrorExp is not correct.
+    // 7. ctfeInterpret
+    //    Finally, FuncDeclaration::interpret may encounter a function which is semantic3Errors == true. So
+    //    7a. functionSemantic3() should return false if semantic3Errors is true.
+    //    7b. the function body errors may not happen during ctfeInterpret call and global.errors could be unincremented.
+    __gshared auto ThreadError = new ThreadError(null);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice15332.d b/gcc/testsuite/gdc.test/fail_compilation/ice15332.d
new file mode 100644
index 00000000000..41411782bf4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice15332.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice15332.d(16): Error: need 'this' for 'fun' of type 'int()'
+fail_compilation/ice15332.d(17): Error: need 'this' for 'var' of type 'int'
+---
+*/
+
+class C
+{
+    int fun() { return 5; }
+    int var;
+
+    void test()
+    {
+        int a1 = function() { return fun; }();
+        int a2 = function() { return var; }();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice15788.d b/gcc/testsuite/gdc.test/fail_compilation/ice15788.d
new file mode 100644
index 00000000000..e81f25bd8b4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice15788.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice15788.d(17): Error: none of the overloads of 'iota' are callable using argument types !()(S, S)
+---
+*/
+
+import imports.range15788 : iota;
+
+void iota() {}
+
+struct S {}
+
+void main()
+{
+    S s;
+    iota(s, s);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice15816.d b/gcc/testsuite/gdc.test/fail_compilation/ice15816.d
new file mode 100644
index 00000000000..b9e1e475b69
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice15816.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/a15816.d(3): Error: anonymous classes not allowed
+---
+*/
+
+class A
+{
+    import imports.a15816;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice17074.d b/gcc/testsuite/gdc.test/fail_compilation/ice17074.d
new file mode 100644
index 00000000000..0cef7aa6a20
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice17074.d
@@ -0,0 +1,39 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice17074.d(9): Error: identifier expected for C++ namespace
+fail_compilation/ice17074.d(9): Error: found 'cast' when expecting ')'
+fail_compilation/ice17074.d(9): Error: declaration expected, not ')'
+---
+*/
+extern(C++, cast) void ice_keyword();
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice17074.d(19): Error: identifier expected for C++ namespace
+fail_compilation/ice17074.d(19): Error: found '__overloadset' when expecting ')'
+fail_compilation/ice17074.d(19): Error: declaration expected, not ')'
+---
+*/
+extern(C++, std.__overloadset) void ice_std_keyword();
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice17074.d(29): Error: identifier expected for C++ namespace
+fail_compilation/ice17074.d(29): Error: found '...' when expecting ')'
+fail_compilation/ice17074.d(29): Error: declaration expected, not ')'
+---
+*/
+extern(C++, ...) void ice_token();
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice17074.d(39): Error: identifier expected for C++ namespace
+fail_compilation/ice17074.d(39): Error: found '*' when expecting ')'
+fail_compilation/ice17074.d(39): Error: declaration expected, not ')'
+---
+*/
+extern(C++, std.*) void ice_std_token();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice17690.d b/gcc/testsuite/gdc.test/fail_compilation/ice17690.d
new file mode 100644
index 00000000000..853b7952a79
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice17690.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice17690.d(9): Error: undefined identifier `x`
+---
+*/
+void main(){
+    scope(exit) int x=3;
+    assert(x==3);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice17831.d b/gcc/testsuite/gdc.test/fail_compilation/ice17831.d
new file mode 100644
index 00000000000..15b8502172b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice17831.d
@@ -0,0 +1,78 @@
+// REQUIRED_ARGS: -d
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice17831.d(19): Error: case variable `i` declared at fail_compilation/ice17831.d(17) cannot be declared in switch body
+fail_compilation/ice17831.d(33): Error: case variable `i` declared at fail_compilation/ice17831.d(31) cannot be declared in switch body
+fail_compilation/ice17831.d(48): Error: case variable `i` declared at fail_compilation/ice17831.d(45) cannot be declared in switch body
+fail_compilation/ice17831.d(61): Error: case variable `i` declared at fail_compilation/ice17831.d(60) cannot be declared in switch body
+fail_compilation/ice17831.d(73): Error: case variable `i` declared at fail_compilation/ice17831.d(72) cannot be declared in switch body
+---
+ */
+
+void test17831a()
+{
+    switch (0)
+    {
+        foreach (i; 0 .. 5)
+        {
+            case i:
+                break;
+        }
+        default:
+            break;
+    }
+}
+
+void test17831b()
+{
+    switch (0)
+    {
+        for (int i = 0; i < 5; i++)
+        {
+            case i:
+                break;
+        }
+        default:
+            break;
+    }
+}
+
+void test17831c()
+{
+    switch (0)
+    {
+        int i = 0;
+        while (i++ < 5)
+        {
+            case i:
+                break;
+        }
+        default:
+            break;
+    }
+}
+
+void test17831d()
+{
+    switch (0)
+    {
+        int i = 0;
+        case i:
+            break;
+        default:
+            break;
+    }
+}
+
+void test17831e()
+{
+    switch (0)
+    {
+        static int i = 0;
+        case i:
+            break;
+        default:
+            break;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice2843.d b/gcc/testsuite/gdc.test/fail_compilation/ice2843.d
new file mode 100644
index 00000000000..4747aecb4ed
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice2843.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice2843.d(22): Error: incompatible types for ((1) is (typeid(int))): 'int' and 'object.TypeInfo'
+---
+*/
+
+// Issue 2843 - ICE(constfold.c) with is-expression with invalid dot-expression in is-expression involving typeid expression
+
+/* 2843 Assertion failure: '0' on line 863 in file 'constfold.c'
+PATCH: constfold.c, line 861:
+OLD:
+        }else
+        assert(0);
+NEW:
+        }else if (e1->isConst() && e2->isConst()) {
+        // Comparing a SymExp with a literal, eg typeid(int) is 7.1;
+           cmp=0; // An error has already occured. Prevent an ICE.
+        }else
+        assert(0);
+*/
+bool b = 1 is typeid(int);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice4094.d b/gcc/testsuite/gdc.test/fail_compilation/ice4094.d
new file mode 100644
index 00000000000..cd41e651121
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice4094.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice4094.d(11): Error: circular reference to variable 'ice4094.Zug!0.Zug.bahn'
+fail_compilation/ice4094.d(19): Error: template instance ice4094.Zug!0 error instantiating
+---
+*/
+// REQUIRED_ARGS: -d
+struct Zug(int Z)
+{
+    const bahn = Bug4094!(0).hof.bahn;
+}
+
+struct Bug4094(int Q)
+{
+    Zug!(0) hof;
+}
+
+const a = Zug!(0).bahn;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice4983.d b/gcc/testsuite/gdc.test/fail_compilation/ice4983.d
new file mode 100644
index 00000000000..1925c174dd9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice4983.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice4983.d(14): Error: circular reference to 'ice4983.Foo.dg'
+---
+*/
+
+struct Foo
+{
+    void bar()
+    {
+    }
+
+    void delegate() dg = &Foo.init.bar;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice5996.d b/gcc/testsuite/gdc.test/fail_compilation/ice5996.d
new file mode 100644
index 00000000000..10e5b6d99c7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice5996.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice5996.d(8): Error: undefined identifier 'anyOldGarbage'
+---
+*/
+auto bug5996() {
+    if (anyOldGarbage) {}
+    return 2;
+}
+enum uint h5996 = bug5996();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice6538.d b/gcc/testsuite/gdc.test/fail_compilation/ice6538.d
new file mode 100644
index 00000000000..dad6491c5e9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice6538.d
@@ -0,0 +1,30 @@
+
+
+/**************************************/
+// 9361
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice6538.d(23): Error: expression super is not a valid template value argument
+fail_compilation/ice6538.d(28): Error: template ice6538.D.foo cannot deduce function from argument types !()(), candidates are:
+fail_compilation/ice6538.d(23):        ice6538.D.foo()() if (Sym!(super))
+---
+*/
+
+template Sym(alias A)
+{
+    enum Sym = true;
+}
+
+class C {}
+class D : C
+{
+    void foo()() if (Sym!(super)) {}
+}
+void test9361b()
+{
+    auto d = new D();
+    d.foo();
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice7645.d b/gcc/testsuite/gdc.test/fail_compilation/ice7645.d
new file mode 100644
index 00000000000..1aa3fad67a0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice7645.d
@@ -0,0 +1,32 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice7645.d(28): Error: need 'this' for 't' of type 'char'
+fail_compilation/ice7645.d(31): Error: need 'this' for 'fn' of type 'pure nothrow @nogc @safe void()'
+---
+*/
+
+class C
+{
+    class C2()
+    {
+        char t;
+    }
+}
+
+struct S
+{
+    struct S2(T)
+    {
+        void fn() {}
+    }
+}
+
+void main()
+{
+    C c;
+    auto v = c.C2!().t;
+
+    S s;
+    s.S2!int.fn();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice7782.d b/gcc/testsuite/gdc.test/fail_compilation/ice7782.d
new file mode 100644
index 00000000000..161995abb79
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice7782.d
@@ -0,0 +1,4 @@
+import imports.ice7782algorithm;
+import imports.ice7782range. imports.ice7782math;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8100.d b/gcc/testsuite/gdc.test/fail_compilation/ice8100.d
new file mode 100644
index 00000000000..1e7d56ba94f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8100.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice8100.d(10): Error: no property 'Q' for type 'ice8100.Bar!bool'
+fail_compilation/ice8100.d(11): Error: template instance ice8100.Foo!(Bar!bool) error instantiating
+fail_compilation/ice8100.d(12):        instantiated from here: Bar!bool
+---
+*/
+
+class Foo(T1) { T1.Q r; }
+class Bar(T2) : Foo!(Bar!T2) {}
+Bar!bool b;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8255.d b/gcc/testsuite/gdc.test/fail_compilation/ice8255.d
new file mode 100644
index 00000000000..d98e38ad9a4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8255.d
@@ -0,0 +1,10 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice8255.d(10): Error: function ice8255.F!(G).F.f (ref G _param_0) is not callable using argument types (G)
+fail_compilation/ice8255.d(10):        while evaluating pragma(msg, F().f(G()))
+---
+*/
+struct G {}
+struct F(T) { void f(ref T) {} }
+pragma(msg, F!G().f(G.init));
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8309.d b/gcc/testsuite/gdc.test/fail_compilation/ice8309.d
new file mode 100644
index 00000000000..5d5bb83298d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8309.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice8309.d(10): Error: incompatible types for ((__lambda1) : (__lambda2)): 'double function() pure nothrow @nogc @safe' and 'int function() pure nothrow @nogc @safe'
+---
+*/
+
+void main()
+{
+    auto x = [()=>1.0, ()=>1];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8499.d b/gcc/testsuite/gdc.test/fail_compilation/ice8499.d
new file mode 100644
index 00000000000..cb53246e4a0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8499.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice8499.d(18): Error: undefined identifier 'i'
+---
+*/
+
+struct Variant
+{
+    @property T get(T)()
+    {
+        struct X {}   // necessary
+    }
+}
+
+void main()
+{
+    (Variant()).get!(typeof(() => i));
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8511.d b/gcc/testsuite/gdc.test/fail_compilation/ice8511.d
new file mode 100644
index 00000000000..873f8965ec2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8511.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice8511.d(11): Error: enum ice8511.hypot.SQRTMAX is forward referenced looking for base type
+fail_compilation/ice8511.d(12): Error: incompatible types for ((SQRTMAX) / (2)): cannot use '/' with types
+---
+*/
+
+real hypot()
+{
+    enum SQRTMAX;
+    SQRTMAX/2;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8604.d b/gcc/testsuite/gdc.test/fail_compilation/ice8604.d
new file mode 100644
index 00000000000..a734c2f24e1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8604.d
@@ -0,0 +1,7 @@
+struct StructFoo
+{
+    static if(i) { }
+    else enum z = "";
+}
+
+void main() { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8630.d b/gcc/testsuite/gdc.test/fail_compilation/ice8630.d
new file mode 100644
index 00000000000..ef733dc864f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8630.d
@@ -0,0 +1,3 @@
+auto map(alias func, R)(R r) { return r; }
+typeof(v) foo(R)(R v) { return map!(p=>p)(v); }
+void main() { foo([1]); }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8711.d b/gcc/testsuite/gdc.test/fail_compilation/ice8711.d
new file mode 100644
index 00000000000..c1439297f09
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8711.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice8711.d(8): Error: cannot use array to initialize int function(int)
+---
+*/
+
+int function(int) foos = [x => 0];
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8742.d b/gcc/testsuite/gdc.test/fail_compilation/ice8742.d
new file mode 100644
index 00000000000..480a2d7357a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8742.d
@@ -0,0 +1,11 @@
+// PERMUTE_ARGS:
+class C
+{
+    class D { }
+}
+
+void main ( )
+{
+    auto c = new C;
+    auto d = c.new class C.D { };
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8795.d b/gcc/testsuite/gdc.test/fail_compilation/ice8795.d
new file mode 100644
index 00000000000..1e10dde1eeb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8795.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice8795.d-mixin-13(13): Error: found 'EOF' when expecting '('
+fail_compilation/ice8795.d-mixin-13(13): Error: expression expected, not 'EOF'
+fail_compilation/ice8795.d-mixin-13(13): Error: found 'EOF' when expecting ')'
+fail_compilation/ice8795.d-mixin-13(13): Error: found 'EOF' instead of statement
+fail_compilation/ice8795.d-mixin-14(14): Error: anonymous classes not allowed
+---
+*/
+void main()
+{
+    mixin("switch");
+    mixin("interface;");
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8795b.d b/gcc/testsuite/gdc.test/fail_compilation/ice8795b.d
new file mode 100644
index 00000000000..4dc94efe546
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice8795b.d
@@ -0,0 +1,7 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice8795b.d-mixin-7(7): Error: anonymous classes not allowed
+---
+*/
+mixin("interface;");
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9013.d b/gcc/testsuite/gdc.test/fail_compilation/ice9013.d
new file mode 100644
index 00000000000..116729fa55f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9013.d
@@ -0,0 +1,5 @@
+void main()
+{
+    foreach (i; 0 .. missing)
+        int[] foo = cast(int[])[i];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9254a.d b/gcc/testsuite/gdc.test/fail_compilation/ice9254a.d
new file mode 100644
index 00000000000..594b5ce54fa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9254a.d
@@ -0,0 +1,12 @@
+
+void main()
+{
+    foreach (divisor; !(2, 3, 4, 8, 7, 9))
+    {
+        // ice in ForeachRangeStatement::blockExit()
+        foreach (v; 0..uint.max) {}
+
+        // ice in WhileStatement::blockExit()
+        while (1) {}
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9254b.d b/gcc/testsuite/gdc.test/fail_compilation/ice9254b.d
new file mode 100644
index 00000000000..c5a9944adb3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9254b.d
@@ -0,0 +1,15 @@
+
+class C
+{
+    synchronized void foo()
+    {
+        foreach(divisor; !(2, 3, 4, 8, 7, 9))
+        {
+            // ice in ForeachRangeStatement::usesEH()
+            foreach (v; 0..uint.max) {}
+
+            // ice in WhileStatement::usesEH()
+            while (1) {}
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9254c.d b/gcc/testsuite/gdc.test/fail_compilation/ice9254c.d
new file mode 100644
index 00000000000..d816bbfc117
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9254c.d
@@ -0,0 +1,14 @@
+
+void main()
+{
+    foreach(divisor; !(2, 3, 4, 8, 7, 9))
+    {
+        assert(0);
+
+        // ice in ForeachRangeStatement::comeFrom()
+        foreach (v; 0..uint.max) {}
+
+        // ice in WhileStatement::comeFrom()
+        while (1) {}
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9273a.d b/gcc/testsuite/gdc.test/fail_compilation/ice9273a.d
new file mode 100644
index 00000000000..91f22d42f35
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9273a.d
@@ -0,0 +1,24 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9273a.d(19): Error: constructor ice9273a.C.__ctor!().this no match for implicit super() call in constructor
+fail_compilation/ice9273a.d(23): Error: template instance ice9273a.C.__ctor!() error instantiating
+---
+*/
+
+template CtorMixin()
+{
+    this(T)() {}
+}
+class B
+{
+    mixin CtorMixin!();
+}
+class C : B
+{
+    this()() {}
+}
+void main()
+{
+    auto c = new C();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9273b.d b/gcc/testsuite/gdc.test/fail_compilation/ice9273b.d
new file mode 100644
index 00000000000..1a779facbbf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9273b.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9273b.d(14): Error: constructor ice9273b.B.this no match for implicit super() call in constructor
+---
+*/
+
+class A
+{
+    this(T)() {}
+}
+class B : A
+{
+    this() {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9284.d b/gcc/testsuite/gdc.test/fail_compilation/ice9284.d
new file mode 100644
index 00000000000..0c95bd87257
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9284.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9284.d(14): Error: template ice9284.C.__ctor cannot deduce function from argument types !()(int), candidates are:
+fail_compilation/ice9284.d(12):        ice9284.C.__ctor()(string)
+fail_compilation/ice9284.d(20): Error: template instance ice9284.C.__ctor!() error instantiating
+---
+*/
+
+class C
+{
+    this()(string)
+    {
+        this(10);
+        // delegating to a constructor which not exists.
+    }
+}
+void main()
+{
+    new C("hello");
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9291.d b/gcc/testsuite/gdc.test/fail_compilation/ice9291.d
new file mode 100644
index 00000000000..f5735287a1b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9291.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9291.d(10): Error: undefined identifier 'F'
+---
+*/
+
+void main() nothrow
+{
+    throw new F();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9338.d b/gcc/testsuite/gdc.test/fail_compilation/ice9338.d
new file mode 100644
index 00000000000..292c05964fd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9338.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9338.d(13): Error: value of 'this' is not known at compile time
+fail_compilation/ice9338.d(14): Error: value of 'this' is not known at compile time
+---
+*/
+
+class Foo
+{
+    void test()
+    {
+        enum members1 = makeArray();
+        enum members2 = this.makeArray();
+    }
+
+    string[] makeArray()
+    {
+        return ["a"];
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9406.d b/gcc/testsuite/gdc.test/fail_compilation/ice9406.d
new file mode 100644
index 00000000000..d8c0837699a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9406.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9406.d(21): Error: expression has no value
+---
+*/
+
+mixin template Mixin() { }
+
+struct S
+{
+    template t1()
+    {
+        mixin Mixin t1;
+    }
+}
+
+void main()
+{
+    S s1;
+    s1.t1!();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9439.d b/gcc/testsuite/gdc.test/fail_compilation/ice9439.d
new file mode 100644
index 00000000000..0e6fbf0a03b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9439.d
@@ -0,0 +1,21 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9439.d(12): Error: this for foo needs to be type Derived not type ice9439.Base
+fail_compilation/ice9439.d(12):        while evaluating: static assert((__error).foo())
+fail_compilation/ice9439.d(19): Error: template instance ice9439.Base.boo!(foo) error instantiating
+---
+*/
+
+class Base {
+    void boo(alias F)() {
+        static assert(F());
+    }
+}
+
+class Derived : Base {
+    int foo() { return 1; }
+    void bug() {
+        boo!(foo)();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9494.d b/gcc/testsuite/gdc.test/fail_compilation/ice9494.d
new file mode 100644
index 00000000000..b2743e5a3d9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9494.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9494.d(10): Error: circular reference to variable 'ice9494.test'
+fail_compilation/ice9494.d(14): Error: circular reference to variable 'ice9494.Foo.test'
+fail_compilation/ice9494.d(19): Error: circular reference to variable 'ice9494.Bar.test'
+---
+*/
+
+int[test] test;  // stack overflow
+
+class Foo
+{
+    int[this.test] test;  // stack overflow
+}
+
+struct Bar
+{
+    int[this.test] test;  // stack overflow
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9540.d b/gcc/testsuite/gdc.test/fail_compilation/ice9540.d
new file mode 100644
index 00000000000..d6c9cdae0f3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9540.d
@@ -0,0 +1,37 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9540.d(34): Error: function ice9540.A.test.AddFront!(this, f).AddFront.dg (int _param_0) is not callable using argument types ()
+fail_compilation/ice9540.d(25): Error: template instance ice9540.A.test.AddFront!(this, f) error instantiating
+---
+*/
+
+template Tuple(E...) { alias E Tuple; }
+alias Tuple!(int) Args;
+
+void main() {
+    (new A).test ();
+}
+
+void test1 (int delegate (int) f) { f (-2); }
+
+class A
+{
+    int f (int a) {
+        return a;
+    }
+
+    void test () {
+        test1 (&AddFront!(this, f));
+    }
+}
+
+template AddFront (alias ctx, alias fun)  {
+    auto AddFront(Args args) {
+        auto dg (Args dgArgs) {
+            return fun (dgArgs);
+        }
+        dg.ptr = ctx;
+        return dg(args);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9545.d b/gcc/testsuite/gdc.test/fail_compilation/ice9545.d
new file mode 100644
index 00000000000..846975afd3b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9545.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -o-
+/*
+TEST_OUTPUT:
+----
+fail_compilation/ice9545.d(13): Error: type int has no value
+----
+*/
+
+struct S { template T(X) { alias T = X; } }
+
+void main()
+{
+    auto x1 = S.init.T!int; // ICE
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9759.d b/gcc/testsuite/gdc.test/fail_compilation/ice9759.d
new file mode 100644
index 00000000000..300540cfeed
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9759.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9759.d(24): Error: mutable method ice9759.Json.opAssign is not callable using a const object
+---
+*/
+
+struct Json
+{
+    union
+    {
+        Json[] m_array;
+        Json[string] m_object;
+    }
+
+    void opAssign(Json v)
+    {
+    }
+}
+
+void bug()
+{
+    const(Json) r;
+    r = r.init;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9806.d b/gcc/testsuite/gdc.test/fail_compilation/ice9806.d
new file mode 100644
index 00000000000..2aca46b265b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9806.d
@@ -0,0 +1,49 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9806.d(12): Error: undefined identifier 'undefined_expr'
+fail_compilation/ice9806.d(17): Error: template instance ice9806.S1!() error instantiating
+fail_compilation/ice9806.d(13): Error: undefined identifier 'undefined_expr'
+fail_compilation/ice9806.d(19): Error: template instance ice9806.C1!() error instantiating
+fail_compilation/ice9806.d(14): Error: undefined identifier 'undefined_expr'
+fail_compilation/ice9806.d(21): Error: template instance ice9806.I1!() error instantiating
+---
+*/
+struct S1() { enum x = undefined_expr; }
+class  C1() { enum x = undefined_expr; }
+class  I1() { enum x = undefined_expr; }
+void test1() {
+    static assert(!is(typeof(S1!().x)));
+    auto sx = S1!().x;
+    static assert(!is(typeof(C1!().x)));
+    auto cx = C1!().x;
+    static assert(!is(typeof(I1!().x)));
+    auto ix = I1!().x;
+}
+
+// --------
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9806.d(36): Error: undefined identifier 'undefined_expr'
+fail_compilation/ice9806.d(44): Error: template instance ice9806.S2!() error instantiating
+fail_compilation/ice9806.d(37): Error: undefined identifier 'undefined_expr'
+fail_compilation/ice9806.d(46): Error: template instance ice9806.C2!() error instantiating
+fail_compilation/ice9806.d(38): Error: undefined identifier 'undefined_expr'
+fail_compilation/ice9806.d(48): Error: template instance ice9806.I2!() error instantiating
+---
+*/
+int foo2()() { return undefined_expr; }
+int bar2()() { return undefined_expr; }
+int baz2()() { return undefined_expr; }
+struct S2() { enum x = foo2(); }
+class  C2() { enum x = bar2(); }
+class  I2() { enum x = baz2(); }
+void test2() {
+    static assert(!is(typeof(S2!().x)));
+    auto sx = S2!().x;
+    static assert(!is(typeof(C2!().x)));
+    auto cx = C2!().x;
+    static assert(!is(typeof(I2!().x)));
+    auto ix = I2!().x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9865.d b/gcc/testsuite/gdc.test/fail_compilation/ice9865.d
new file mode 100644
index 00000000000..846ba2e5914
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/ice9865.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9865.d(8): Error: alias ice9865.Baz recursive alias declaration
+---
+*/
+
+public import imports.ice9865b : Baz;
+struct Foo { Baz f; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a10169.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a10169.d
new file mode 100644
index 00000000000..91ec888fe06
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a10169.d
@@ -0,0 +1,6 @@
+module imports.a10169;
+
+struct B
+{
+    private int x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a10528.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a10528.d
new file mode 100644
index 00000000000..8d2e1dbaa77
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a10528.d
@@ -0,0 +1,6 @@
+private enum string a = "asdfgh";
+private enum { b = "asdfgh" }
+
+struct S { private enum string c = "qwerty"; }
+class  C { private enum string d = "qwerty"; }
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a11850.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a11850.d
new file mode 100644
index 00000000000..c9a76821c83
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a11850.d
@@ -0,0 +1,51 @@
+//import std.array, std.range;
+module imports.a11850;
+
+
+template filter(alias pred)
+{
+    auto filter(Range)(Range rs)
+    {
+        return FilterResult!(pred, Range)(rs);
+    }
+}
+
+
+private struct FilterResult(alias pred, Range)
+{
+    alias Range R;
+    R _input;
+
+
+    this(R r)
+    {
+        _input = r;
+        while (_input.length != 0 && !pred(_input[0]))
+        {
+            _input = _input[1..$];
+        }
+    }
+
+
+    auto opSlice() { return this; }
+
+
+    @property bool empty() { return _input.length == 0; }
+
+
+    void popFront()
+    {
+        do
+        {
+            _input = _input[1..$];
+        } while (_input.length != 0 && !pred(_input[0]));
+    }
+
+
+    @property auto ref front()
+    {
+        return _input[0];
+    }
+}
+
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a11919.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a11919.d
new file mode 100644
index 00000000000..983147dee6d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a11919.d
@@ -0,0 +1,17 @@
+void doBar(T)(T t)
+{
+    static if (t.tupleof.length)
+        if (zoo!t.length == 0) {}
+    static if (is(T B == super)
+            && is(B[0] == class)
+            && is(B[])
+            )
+    {
+        B[0] b = t;
+        doBar(b);
+    }
+}
+template zoo(alias t)
+{
+    enum zoo = __traits(getAttributes, t.tupleof);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a13131checkpoint.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a13131checkpoint.d
new file mode 100644
index 00000000000..7c9a2b0ecda
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a13131checkpoint.d
@@ -0,0 +1,18 @@
+module imports.a13131checkpoint;
+
+mixin(createGlobalsMixins);             // [3] mixin
+
+auto createGlobalsMixins()              // [4] semantic3
+{
+    pragma(msg, "+A");
+    enum fullModuleName = "imports.a13131parameters";  // necessary
+    mixin("import "~fullModuleName~";");
+    foreach (e ; __traits(derivedMembers, mixin(fullModuleName)))
+    {
+        // [5] see imports.parameters (it's listed in command line)
+        static if ( __traits(compiles, mixin(`__traits(getAttributes, `~fullModuleName~`.`~e~`)`))) {}
+    }
+    pragma(msg, "-A");
+
+    return "";
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a13131elec.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a13131elec.d
new file mode 100644
index 00000000000..658dbb531bd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a13131elec.d
@@ -0,0 +1,10 @@
+module imports.a13131elec;
+
+import imports.a13131checkpoint;        // [2] import
+
+void initElec(T)(T L)
+{
+    immutable cv = econn.velocities;    // econn is invalid so generates ErrorExp
+}
+
+alias econn = elecConnOf!gconn; // invalid declaration
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a13131parameters.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a13131parameters.d
new file mode 100644
index 00000000000..4508d2fad14
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a13131parameters.d
@@ -0,0 +1,14 @@
+module imports.a13131parameters;
+
+auto createParameterMixins()    // auto is necessary to invoke semantic3 to calculate full signature
+{
+    pragma(msg, "+B");
+    enum fullModuleName = "imports.a13131elec";  // necessary
+    mixin("import "~fullModuleName~";");
+    foreach (e ; __traits(derivedMembers, mixin(fullModuleName)))
+    {
+        // will access yet-not semantic analyzed invalid symbol 'econn' in imports.elec
+        static if ( __traits(compiles, mixin(`__traits(getAttributes, `~fullModuleName~`.`~e~`)`))) {}
+    }
+    pragma(msg, "-B");
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a13311.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a13311.d
new file mode 100644
index 00000000000..b4f78a0a699
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a13311.d
@@ -0,0 +1,9 @@
+module imports.a13311;
+
+import ice13311;
+
+class Z
+{
+    TextPiece piece;
+    this(PieceTree owner) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a13465.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a13465.d
new file mode 100644
index 00000000000..684c3e11c99
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a13465.d
@@ -0,0 +1,22 @@
+module imports.a13465;
+
+template isMaskField()
+{
+    import imports.a13465;
+}
+
+template isMatchingMaskField()
+{
+    enum isMatchingMaskField = isMaskField!();
+
+    /* Semantic analysis journey came from isMatchingMaskField!()
+     *
+     * TemplateInstance('isMaskField!T')->semantic()
+     *  TemplateInstance('isMaskField!T')->semantic2() <---
+     *          TemplateInstance::semantic() will run its semantic2() always.
+     *   Import('import imports.ice1365a;')->semantic2()
+     *    Module('imports.ice1365a')->semantic2()
+     *     VarDeclaration('imports.ice1365a.isMatchingMaskField!().isMatchingMaskField')->semantic2() <---
+     *          The type field is yet NULL during type inference, then ICE happens.
+     */
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a14116.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a14116.d
new file mode 100644
index 00000000000..42fc89d3fcc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a14116.d
@@ -0,0 +1,5 @@
+module ice14116.a14116;
+
+import ice14116;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a14235.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a14235.d
new file mode 100644
index 00000000000..d2b6cb9fd1b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a14235.d
@@ -0,0 +1,7 @@
+module imports.a14235;
+
+struct SomeThing(T...)
+{
+}
+
+class SomeClass {}
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a14407.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a14407.d
new file mode 100644
index 00000000000..d906bc74404
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a14407.d
@@ -0,0 +1,19 @@
+module imports.a14407;
+
+deprecated class C
+{
+    private deprecated new (size_t, string)
+    {
+        return null;
+    }
+    private this(int) {}
+}
+
+deprecated struct S
+{
+    private deprecated new (size_t, string)
+    {
+        return null;
+    }
+    private this(int) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a14424.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a14424.d
new file mode 100644
index 00000000000..57312136d75
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a14424.d
@@ -0,0 +1,3 @@
+module imports.a14424;
+
+unittest { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a15667.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a15667.d
new file mode 100644
index 00000000000..bec79b65817
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a15667.d
@@ -0,0 +1,18 @@
+module imports.a15667;
+
+template staticIndexOf(T)
+{
+    enum staticIndexOf = genericIndexOf!T;
+}
+
+template genericIndexOf(args...)
+{
+    alias e     = args;
+    alias tuple = args;
+    alias tail = tuple;
+    enum next  = genericIndexOf!(e, tail);
+}
+
+alias X = ;
+
+static if (staticIndexOf!X)
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a15816.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a15816.d
new file mode 100644
index 00000000000..49316e21df2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a15816.d
@@ -0,0 +1,5 @@
+module imports.a15816;
+
+class
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a313.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a313.d
new file mode 100644
index 00000000000..6d5ed8eec27
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a313.d
@@ -0,0 +1,11 @@
+module imports.a313;
+
+private import imports.b313;
+private static import imports.b313;
+private static import b313 = imports.b313;
+
+private import imports.pkg313;
+
+private import imports.pkg313;
+
+private import core.stdc.stdio;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a314.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a314.d
new file mode 100644
index 00000000000..fcf3157e9ad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a314.d
@@ -0,0 +1,5 @@
+module imports.a314;
+
+static import imports.c314;
+import renamed = imports.c314;
+import imports.c314 : bug;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/b13465.d b/gcc/testsuite/gdc.test/fail_compilation/imports/b13465.d
new file mode 100644
index 00000000000..9700a9eac91
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/b13465.d
@@ -0,0 +1,22 @@
+module imports.b13465;
+
+template isMaskField()
+{
+    import imports.b13465;
+}
+
+template isMatchingMaskField()
+{
+    enum isMatchingMaskField = { enum n = isMaskField!(); return n; }();
+
+    /* Semantic analysis journey came from isMatchingMaskField!()
+     *
+     * TemplateInstance('isMaskField!T')->semantic()
+     *  TemplateInstance('isMaskField!T')->semantic2() <---
+     *          TemplateInstance::semantic() should run its semantic2() in function body.
+     *   Import('import imports.ice1365a;')->semantic2()
+     *    Module('imports.ice1365a')->semantic2()
+     *     VarDeclaration('imports.ice1365a.isMatchingMaskField!().isMatchingMaskField')->semantic2() <---
+     *          Cannot avoid this visiting, so we need to add a fix in VarDeclaration::semantic2().
+     */
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/b313.d b/gcc/testsuite/gdc.test/fail_compilation/imports/b313.d
new file mode 100644
index 00000000000..1834c997229
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/b313.d
@@ -0,0 +1,4 @@
+module imports.b313;
+
+void bug()
+{}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/b314.d b/gcc/testsuite/gdc.test/fail_compilation/imports/b314.d
new file mode 100644
index 00000000000..89b62c3e983
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/b314.d
@@ -0,0 +1,4 @@
+module imports.b314;
+
+package import renamedpkg = imports.c314;
+package import imports.c314 : bugpkg=bug;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/bar11136.d b/gcc/testsuite/gdc.test/fail_compilation/imports/bar11136.d
new file mode 100644
index 00000000000..1cb541bfedc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/bar11136.d
@@ -0,0 +1 @@
+module ice11136.bar11136;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/c314.d b/gcc/testsuite/gdc.test/fail_compilation/imports/c314.d
new file mode 100644
index 00000000000..5c43c8608e4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/c314.d
@@ -0,0 +1,4 @@
+module imports.c314;
+
+void bug(string s)
+{}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3a.d
new file mode 100644
index 00000000000..85e6cd8c390
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3a.d
@@ -0,0 +1 @@
+void foo() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3b.d
new file mode 100644
index 00000000000..37ea7ae0387
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3b.d
@@ -0,0 +1 @@
+private void foo(int) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3c.d b/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3c.d
new file mode 100644
index 00000000000..93b4ac5fe12
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3c.d
@@ -0,0 +1 @@
+void foo(string) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag10089a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/diag10089a.d
new file mode 100644
index 00000000000..857c5ed8000
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/diag10089a.d
@@ -0,0 +1,8 @@
+module imports.diag10089a;
+
+struct chunks
+{
+    this(size_t size)
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag10089b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/diag10089b.d
new file mode 100644
index 00000000000..0e3c2ea5964
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/diag10089b.d
@@ -0,0 +1,5 @@
+module imports.diag10089b;
+
+void chunks(Source)(Source source, size_t chunkSize)
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag10141a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/diag10141a.d
new file mode 100644
index 00000000000..df775858ca4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/diag10141a.d
@@ -0,0 +1,26 @@
+module imports.diag10141a;
+
+import imports.diag10141b;
+
+string format()
+{
+    auto w = Appender!string();
+    char[] digits = ['0'];
+    put(w, digits);
+    return null;
+}
+
+template Tuple(Specs...)
+{
+    struct Tuple
+    {
+        Specs expand;
+
+        enum x = format();  // in injectNameFields()
+    }
+}
+
+private template Identity(alias T)
+{
+    alias T Identity;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag10141b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/diag10141b.d
new file mode 100644
index 00000000000..72ebce73196
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/diag10141b.d
@@ -0,0 +1,55 @@
+module imports.diag10141b;
+
+template isSomeChar(T) {
+    enum isSomeChar =
+        is(immutable T == immutable  char) ||
+        is(immutable T == immutable wchar) ||
+        is(immutable T == immutable dchar);
+}
+
+struct Appender(A : T[], T)
+{
+    private template canPutItem(U)
+    {
+        enum bool canPutItem =
+            //isImplicitlyConvertible!(U, T) ||
+            isSomeChar!T && isSomeChar!U;
+    }
+    private template canPutRange(Range)
+    {
+        enum bool canPutRange =
+            //isInputRange!Range &&
+            is(typeof(Appender.init.put("a"d[0])));
+    }
+
+    /**
+     * Appends one item to the managed array.
+     */
+    void put(U)(U item) if (canPutItem!U)
+    {
+        char[T.sizeof == 1 ? 4 : 2] encoded;
+        auto len = 1;
+        put(encoded[0 .. len]); // !
+    }
+
+    /**
+     * Appends an entire range to the managed array.
+     */
+    void put(Range)(Range items) if (canPutRange!Range)
+    {
+    }
+}
+
+void put(R, E)(ref R r, E e)
+{
+    static if (is(typeof(r.put(e))))
+    {
+        r.put(e);
+    }
+    else
+    {
+        static assert(false,
+                "Cannot put a "~E.stringof~" into a "~R.stringof);
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag12598a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/diag12598a.d
new file mode 100644
index 00000000000..dee00545254
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/diag12598a.d
@@ -0,0 +1,3 @@
+module imports.diag12598a;
+
+struct lines { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210b.d
new file mode 100644
index 00000000000..f83d122d844
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210b.d
@@ -0,0 +1,6 @@
+module imports.diag9210b;
+
+import imports.diag9210c;
+import imports.diag9210stdcomplex;
+
+interface B : A {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210c.d b/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210c.d
new file mode 100644
index 00000000000..9c3f78956fe
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210c.d
@@ -0,0 +1,4 @@
+module imports.diag9210c;
+
+import diag9210a;
+interface C : A {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210stdcomplex.d b/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210stdcomplex.d
new file mode 100644
index 00000000000..58aa99a740f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210stdcomplex.d
@@ -0,0 +1,17 @@
+module imports.diag9210stdcomplex;
+
+import imports.diag9210stdtraits;
+
+struct Complex(T) if (isFloatingPoint!T)
+{
+    T re;
+    T im;
+}
+
+// Bugzilla 9210: Complex!real instantiation is incomplete in here,
+// because its completion is deferred by an "undefined identifier" error in imports.diag9210b.
+Complex!real expi(real y)
+{
+    return Complex!real(0, 0);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210stdtraits.d b/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210stdtraits.d
new file mode 100644
index 00000000000..f978047765f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/diag9210stdtraits.d
@@ -0,0 +1,33 @@
+module imports.diag9210stdtraits;
+
+template FloatingPointTypeOf(T)// if (!is(T == enum))
+{
+           inout( float) idx(        inout( float) );
+           inout(double) idx(        inout(double) );
+           inout(  real) idx(        inout(  real) );
+    shared(inout  float) idx( shared(inout  float) );
+    shared(inout double) idx( shared(inout double) );
+    shared(inout   real) idx( shared(inout   real) );
+
+       immutable( float) idy(   immutable( float) );
+       immutable(double) idy(   immutable(double) );
+       immutable(  real) idy(   immutable(  real) );
+
+    static if (is(typeof(idx(T.init)) X))
+    {
+        alias X FloatingPointTypeOf;
+    }
+    else static if (is(typeof(idy(T.init)) X))
+    {
+        alias X FloatingPointTypeOf;
+    }
+    else
+    {
+        static assert(0, T.stringof~" is not a floating point type");
+    }
+}
+
+template isFloatingPoint(T)
+{
+    enum bool isFloatingPoint = is(FloatingPointTypeOf!T);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/dip22a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/dip22a.d
new file mode 100644
index 00000000000..53a24e975c3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/dip22a.d
@@ -0,0 +1,20 @@
+module imports.dip22a;
+
+class Klass
+{
+    private void bar() {}
+}
+
+struct Struct
+{
+    private void bar() {}
+}
+
+private void bar() {}
+
+template Template(T)
+{
+    private void bar() {}
+}
+
+private void bar(int) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/dip22b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/dip22b.d
new file mode 100644
index 00000000000..1e0e526ca88
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/dip22b.d
@@ -0,0 +1,3 @@
+module imports.dip22b;
+// this public import only exports symbols that are visible within this module
+public import imports.dip22c;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/dip22c.d b/gcc/testsuite/gdc.test/fail_compilation/imports/dip22c.d
new file mode 100644
index 00000000000..c735543f917
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/dip22c.d
@@ -0,0 +1,3 @@
+module pkg.dip22c;
+
+package(pkg) struct Foo {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/dip22d.d b/gcc/testsuite/gdc.test/fail_compilation/imports/dip22d.d
new file mode 100644
index 00000000000..9f80442e4b4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/dip22d.d
@@ -0,0 +1,5 @@
+module imports.dip22d;
+
+private struct Foo {}
+private void foo() {}
+private void bar() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/dip22e.d b/gcc/testsuite/gdc.test/fail_compilation/imports/dip22e.d
new file mode 100644
index 00000000000..3464e605d5d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/dip22e.d
@@ -0,0 +1,4 @@
+module imports.dip22e;
+
+public struct Foo {}
+public void bar(int) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail10277.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail10277.d
new file mode 100644
index 00000000000..b15461bc5d4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail10277.d
@@ -0,0 +1,23 @@
+module imports.fail10277;
+
+class TypeInfo { }
+class TypeInfo_Class { }
+class TypeInfo_Interface { }
+class TypeInfo_Struct { }
+class TypeInfo_Typedef { }
+class TypeInfo_Pointer { }
+class TypeInfo_Array { }
+class TypeInfo_AssociativeArray { }
+class TypeInfo_Enum { }
+class TypeInfo_Function { }
+class TypeInfo_Delegate { }
+class TypeInfo_Tuple { }
+class TypeInfo_Const { }
+class TypeInfo_Invariant { }
+class TypeInfo_Shared { }
+class TypeInfo_Inout { }
+class TypeInfo_Vector { }
+class Object { }
+class Throwable { }
+class Exception { }
+class Error { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail1900a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail1900a.d
new file mode 100644
index 00000000000..9ae04eed00a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail1900a.d
@@ -0,0 +1,2 @@
+module imports.fail1900a;
+template Bar(int n) { enum Bar = n; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail1900b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail1900b.d
new file mode 100644
index 00000000000..b36fc87f964
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail1900b.d
@@ -0,0 +1,2 @@
+module imports.fail1900b;
+template Bar(short n) { enum Bar = n; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail2962a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail2962a.d
new file mode 100644
index 00000000000..bd6e2bf22fb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail2962a.d
@@ -0,0 +1,7 @@
+import fail2962;
+
+// comment 4
+int foo4()
+{
+    return bar4(0);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail320a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail320a.d
new file mode 100644
index 00000000000..91972ed6546
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail320a.d
@@ -0,0 +1 @@
+void foo(int) { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail320b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail320b.d
new file mode 100644
index 00000000000..9efc51c420c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail320b.d
@@ -0,0 +1 @@
+void foo(T)(){}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail347a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail347a.d
new file mode 100644
index 00000000000..2c2b1f6d6b1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail347a.d
@@ -0,0 +1,3 @@
+module imports.fail347a;
+
+pure size_t strlen(in char* s);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail355.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail355.d
new file mode 100644
index 00000000000..9c1fd8ddb57
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail355.d
@@ -0,0 +1 @@
+module imports.fail355;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail356.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail356.d
new file mode 100644
index 00000000000..875cdeef325
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail356.d
@@ -0,0 +1,2 @@
+module imports.fail356;
+int bar;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail4479.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail4479.d
new file mode 100644
index 00000000000..236de1d243a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail4479.d
@@ -0,0 +1 @@
+module imports.fail4479mod;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail5385.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail5385.d
new file mode 100644
index 00000000000..a07411ac7d2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail5385.d
@@ -0,0 +1,17 @@
+module imports.fail5385;
+
+class C
+{
+    static private int privX;
+    static package int packX;
+    __gshared private int privX2;
+    __gshared package int packX2;
+}
+
+struct S
+{
+    static private int privX;
+    static package int packX;
+    __gshared private int privX2;
+    __gshared package int packX2;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/foo10727a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/foo10727a.d
new file mode 100644
index 00000000000..af0f1006cc8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/foo10727a.d
@@ -0,0 +1,34 @@
+struct CirBuff(T)
+{
+    import imports.stdtraits10727 : isArray;
+    CirBuff!T opAssign(R)(R) if (isArray!R)
+    {}
+
+    struct Range(U, S)
+    {
+        Range!(U, S) save() { return U; }
+    }
+
+    T[] toArray()
+    {
+        T[] ret = new T[this.length];
+        return ret;
+    }
+
+    alias toArray this;
+
+    Range!(T, T) range() {}
+
+}
+
+class Bar(T = int)
+{
+    CirBuff!T _bar;
+}
+
+class Once
+{
+    Bar!Foo _foobar;
+}
+
+class Foo : Frop {} // Frop is not defined
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/foo10727b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/foo10727b.d
new file mode 100644
index 00000000000..4c51cac7b94
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/foo10727b.d
@@ -0,0 +1,25 @@
+struct CirBuff(T)
+{
+    import imports.stdtraits10727 : isArray;
+    CirBuff!T opAssign(R)(R) if (isArray!R)
+    {}
+
+    T[] toArray()
+    {
+        T[] ret = new T[this.length];
+        return ret;
+    }
+    alias toArray this;
+}
+
+class Bar(T = int)
+{
+    CirBuff!T _bar;
+}
+
+class Once
+{
+    Bar!Foo _foobar;
+}
+
+class Foo : Frop {} // Frop is not defined
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/ice10600a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10600a.d
new file mode 100644
index 00000000000..9488afddf79
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10600a.d
@@ -0,0 +1,11 @@
+module imports.ice10600a;
+
+struct Appender(A : T[], T)
+{
+    this(T[]) {}
+}
+
+Appender!(E[]) appender(A : E[], E)()
+{
+    return Appender!(E[])(null);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/ice10600b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10600b.d
new file mode 100644
index 00000000000..f8a788dd729
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10600b.d
@@ -0,0 +1,36 @@
+module imports.ice10600b;
+
+import imports.ice10600a;
+
+template to(T)
+{
+    T to(A...)(A args)
+    {
+        return toImpl!T(args);
+    }
+}
+
+
+T toImpl(T, S)(S value)
+if (is(S : T))
+{
+    return value;
+}
+
+
+T toImpl(T, S)(S value)
+if (!is(S : T) &&
+     is(T == string))
+{
+    auto w = appender!T();
+    //Appender!T w;
+    return null;
+}
+
+T toImpl(T, S)(S value)
+if ( is(S == string) &&
+    !is(T == string) && is(typeof(to!string(value[0])))
+   )
+{
+    return T.init;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/ice11513x.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice11513x.d
new file mode 100644
index 00000000000..c24df566db4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice11513x.d
@@ -0,0 +1 @@
+module ice11513a.imports;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/ice11513y.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice11513y.d
new file mode 100644
index 00000000000..73d6feef69f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice11513y.d
@@ -0,0 +1 @@
+module ice11513b.imports.ice11513y;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/ice7782algorithm.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice7782algorithm.d
new file mode 100644
index 00000000000..4c14a2114f1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice7782algorithm.d
@@ -0,0 +1,3 @@
+module imports.ice7782algorithm;
+
+import imports.ice7782range;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/ice7782range.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice7782range.d
new file mode 100644
index 00000000000..b9b5ca6a520
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice7782range.d
@@ -0,0 +1,3 @@
+module imports.ice7782range;
+
+import imports.ice7782algorithm;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/ice9865b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice9865b.d
new file mode 100644
index 00000000000..2d30dd1f23f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice9865b.d
@@ -0,0 +1,2 @@
+public import ice9865;
+class Bar { Foo foo; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/imp1.d b/gcc/testsuite/gdc.test/fail_compilation/imports/imp1.d
new file mode 100644
index 00000000000..9db9b45f7ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/imp1.d
@@ -0,0 +1,5 @@
+module imports.imp1;
+
+enum X = 1;
+enum Y = 1;
+enum Z = 1;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/imp2.d b/gcc/testsuite/gdc.test/fail_compilation/imports/imp2.d
new file mode 100644
index 00000000000..9dd5ff6bdd5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/imp2.d
@@ -0,0 +1,5 @@
+module imports.imp2;
+
+enum X = 2;
+enum Y = 2;
+enum Z = 2;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/pkg313/package.d b/gcc/testsuite/gdc.test/fail_compilation/imports/pkg313/package.d
new file mode 100644
index 00000000000..369a5aac753
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/pkg313/package.d
@@ -0,0 +1,4 @@
+module imports.pkg313;
+
+void bug()
+{}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/range15788.d b/gcc/testsuite/gdc.test/fail_compilation/imports/range15788.d
new file mode 100644
index 00000000000..86026e9c450
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/range15788.d
@@ -0,0 +1,5 @@
+module imports.range15788;
+
+auto iota(B, E, S)(B, E, S)
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/spell9644a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/spell9644a.d
new file mode 100644
index 00000000000..b148ff71895
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/spell9644a.d
@@ -0,0 +1,7 @@
+module imports.spell9644a;
+
+public import imports.spell9644b;
+
+int cora;
+int pub;
+private int priv;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/spell9644b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/spell9644b.d
new file mode 100644
index 00000000000..aa6ff76da88
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/spell9644b.d
@@ -0,0 +1,3 @@
+module imports.spell9644b;
+
+private int prib;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/stdtraits10727.d b/gcc/testsuite/gdc.test/fail_compilation/imports/stdtraits10727.d
new file mode 100644
index 00000000000..7c56120fc1a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/stdtraits10727.d
@@ -0,0 +1,46 @@
+template StaticArrayTypeOf(T)
+{
+    inout(U[n]) idx(U, size_t n)( inout(U[n]) );
+
+    /+static if (is(T == enum))
+        alias .StaticArrayTypeOf!(OriginalType!T) StaticArrayTypeOf;
+    else +/static if (is(typeof(idx(T.init/+defaultInit!T+/)) X))
+        alias X StaticArrayTypeOf;
+    else
+        static assert(0, T.stringof~" is not a static array type");
+}
+
+template DynamicArrayTypeOf(T)
+{
+    inout(U[]) idx(U)( inout(U[]) );
+
+    /+static if (is(T == enum))
+        alias .DynamicArrayTypeOf!(OriginalType!T) DynamicArrayTypeOf;
+    else +/static if (!is(StaticArrayTypeOf!T) &&
+                     is(typeof(idx(T.init/+defaultInit!T+/)) X))
+    {
+        alias typeof(T.init[0]/+defaultInit!T[0]+/) E;
+
+                     E[]  idy(              E[]  );
+               const(E[]) idy(        const(E[]) );
+               inout(E[]) idy(        inout(E[]) );
+        shared(      E[]) idy( shared(      E[]) );
+        shared(const E[]) idy( shared(const E[]) );
+        shared(inout E[]) idy( shared(inout E[]) );
+           immutable(E[]) idy(    immutable(E[]) );
+
+        alias typeof(idy(T.init/+defaultInit!T+/)) DynamicArrayTypeOf;
+    }
+    else
+        static assert(0, T.stringof~" is not a dynamic array");
+}
+
+template isDynamicArray(T)
+{
+    enum isDynamicArray = is(DynamicArrayTypeOf!T)/+ && !isAggregateType!T+/;
+}
+
+template isArray(T)
+{
+    enum bool isArray = /+isStaticArray!T || +/isDynamicArray!T;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test10327/empty.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test10327/empty.d
new file mode 100644
index 00000000000..ba3877b9c18
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test10327/empty.d
@@ -0,0 +1 @@
+module empty;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152a.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152a.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152b.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152b.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152c.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152c.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152c.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152d.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152d.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152d.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152e.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152e.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152e.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152f.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152f.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152f.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152g.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152g.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152g.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152h.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152h.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152h.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152i.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152i.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152i.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152j.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152j.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152j.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152k.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152k.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152k.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152l.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152l.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152l.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152m.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152m.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152m.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152n.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152n.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152n.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152o.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152o.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152o.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152p.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152p.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152p.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152q.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152q.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152q.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152r.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152r.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152r.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152s.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152s.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152s.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152t.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152t.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152t.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152u.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152u.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152u.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152v.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152v.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152v.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152w.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152w.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152w.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152x.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152x.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152x.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152y.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152y.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152y.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test13152z.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152z.d
new file mode 100644
index 00000000000..a91ff0df785
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test13152z.d
@@ -0,0 +1,26 @@
+public import imports.test13152a;
+public import imports.test13152b;
+public import imports.test13152c;
+public import imports.test13152d;
+public import imports.test13152e;
+public import imports.test13152f;
+public import imports.test13152g;
+public import imports.test13152h;
+public import imports.test13152i;
+public import imports.test13152j;
+public import imports.test13152k;
+public import imports.test13152l;
+public import imports.test13152m;
+public import imports.test13152n;
+public import imports.test13152o;
+public import imports.test13152p;
+public import imports.test13152q;
+public import imports.test13152r;
+public import imports.test13152s;
+public import imports.test13152t;
+public import imports.test13152u;
+public import imports.test13152v;
+public import imports.test13152w;
+public import imports.test13152x;
+public import imports.test13152y;
+public import imports.test13152z;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test143.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test143.d
new file mode 100644
index 00000000000..2dbae1a93bf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test143.d
@@ -0,0 +1,3 @@
+module imports.test143;
+
+package int x = 5;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test15785.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test15785.d
new file mode 100644
index 00000000000..a97b0884276
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test15785.d
@@ -0,0 +1,13 @@
+module imports.test15785;
+
+class Base
+{
+    private void foo() {}
+    private void bar() {}
+    private alias T = int;
+}
+
+interface IBase2
+{
+    private alias T = int;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test15897.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test15897.d
new file mode 100644
index 00000000000..2583ad973cd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test15897.d
@@ -0,0 +1,6 @@
+module imports.test15897;
+import test15897;
+
+class Cat : Animal
+{
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test5412a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test5412a.d
new file mode 100644
index 00000000000..a0270239978
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test5412a.d
@@ -0,0 +1 @@
+module imports.test5412a;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test5412b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test5412b.d
new file mode 100644
index 00000000000..176b3880b1f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test5412b.d
@@ -0,0 +1 @@
+module imports.test5412b;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test64a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test64a.d
new file mode 100644
index 00000000000..cb87b953325
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test64a.d
@@ -0,0 +1,4 @@
+module imports;
+
+const char[] file1 = "File1";
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/lexer1.d b/gcc/testsuite/gdc.test/fail_compilation/lexer1.d
new file mode 100644
index 00000000000..fdab28b482c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/lexer1.d
@@ -0,0 +1,52 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/lexer1.d(30): Error: declaration expected, not 'x"01 02 03"w'
+fail_compilation/lexer1.d(31): Error: declaration expected, not '2147483649U'
+fail_compilation/lexer1.d(32): Error: declaration expected, not '0.1'
+fail_compilation/lexer1.d(33): Error: declaration expected, not '0.1f'
+fail_compilation/lexer1.d(34): Error: declaration expected, not '0.1L'
+fail_compilation/lexer1.d(35): Error: declaration expected, not '0.1i'
+fail_compilation/lexer1.d(36): Error: declaration expected, not '0.1fi'
+fail_compilation/lexer1.d(37): Error: declaration expected, not '0.1Li'
+fail_compilation/lexer1.d(38): Error: declaration expected, not '32U'
+fail_compilation/lexer1.d(39): Error: declaration expected, not '55295U'
+fail_compilation/lexer1.d(40): Error: declaration expected, not '65536U'
+fail_compilation/lexer1.d(41): Error: declaration expected, not '"ab\\c\"\u1234a\U00011100a"d'
+fail_compilation/lexer1.d(43): Error: declaration expected, not 'module'
+fail_compilation/lexer1.d(45): Error: escape hex sequence has 1 hex digits instead of 2
+fail_compilation/lexer1.d(46): Error: undefined escape hex sequence \G
+fail_compilation/lexer1.d(47): Error: unnamed character entity &unnamedentity;
+fail_compilation/lexer1.d(48): Error: unterminated named entity &1;
+fail_compilation/lexer1.d(49): Error: unterminated named entity &*;
+fail_compilation/lexer1.d(50): Error: unterminated named entity &s1";
+fail_compilation/lexer1.d(51): Error: unterminated named entity &2;
+fail_compilation/lexer1.d(52): Error: escape octal sequence \400 is larger than \377
+---
+*/
+
+// https://dlang.dawg.eu/coverage/src/lexer.c.gcov.html
+
+x"01 02 03"w;
+0x80000001;
+0.1;
+0.1f;
+0.1L;
+0.1i;
+0.1fi;
+0.1Li;
+' ';
+'\uD7FF';
+'\U00010000';
+"ab\\c\"\u1234a\U00011100a\000ab"d;
+
+module x;
+
+static s1 = "\x1G";
+static s2 = "\xGG";
+static s3 = "\&unnamedentity;";
+static s4 = "\&1";
+static s5 = "\&*";
+static s6 = "\&s1";
+static s7 = "\&2;";
+static s7 = "\400;";
diff --git a/gcc/testsuite/gdc.test/fail_compilation/lexer2.d b/gcc/testsuite/gdc.test/fail_compilation/lexer2.d
new file mode 100644
index 00000000000..f348478d8f4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/lexer2.d
@@ -0,0 +1,22 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/lexer2.d(15): Error: odd number (3) of hex characters in hex string
+fail_compilation/lexer2.d(16): Error: non-hex character 'G' in hex string
+fail_compilation/lexer2.d(17): Error: identifier expected for heredoc, not 2068L
+fail_compilation/lexer2.d(19): Error: heredoc rest of line should be blank
+fail_compilation/lexer2.d(21): Error: unterminated delimited string constant starting at fail_compilation/lexer2.d(21)
+fail_compilation/lexer2.d(23): Error: semicolon expected following auto declaration, not 'EOF'
+---
+*/
+
+// https://dlang.dawg.eu/coverage/src/lexer.c.gcov.html
+
+static s1 = x"123";
+static s2 = x"123G";
+static s3 = q"__VERSION__
+ _";
+static s4 = q"here notblank
+here";
+static s5 = q"here
+";
diff --git a/gcc/testsuite/gdc.test/fail_compilation/lexer3.d b/gcc/testsuite/gdc.test/fail_compilation/lexer3.d
new file mode 100644
index 00000000000..99f2e473263
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/lexer3.d
@@ -0,0 +1,9 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/lexer3.d(9): Error: unterminated token string constant starting at fail_compilation/lexer3.d(9)
+fail_compilation/lexer3.d(10): Error: semicolon expected following auto declaration, not 'EOF'
+---
+*/
+
+static s1 = q{ asef;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/lexer4.d b/gcc/testsuite/gdc.test/fail_compilation/lexer4.d
new file mode 100644
index 00000000000..7e3f38281be
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/lexer4.d
@@ -0,0 +1,43 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/lexer4.d(22): Error: unterminated character constant
+fail_compilation/lexer4.d(24): Error: unterminated character constant
+fail_compilation/lexer4.d(25): Error: unterminated character constant
+fail_compilation/lexer4.d(26): Error: binary digit expected
+fail_compilation/lexer4.d(27): Error: radix 8 digit expected, not '8'
+fail_compilation/lexer4.d(27): Error: octal literals 0130 are no longer supported, use std.conv.octal!130 instead
+fail_compilation/lexer4.d(28): Error: radix 10 digit expected, not 'a'
+fail_compilation/lexer4.d(29): Error: unrecognized token
+fail_compilation/lexer4.d(30): Error: exponent required for hex float
+fail_compilation/lexer4.d(31): Error: lower case integer suffix 'l' is not allowed. Please use 'L' instead
+fail_compilation/lexer4.d(32): Error: use 'i' suffix instead of 'I'
+fail_compilation/lexer4.d(34): Error: line number 1234567891234567879 out of range
+fail_compilation/lexer4.d(36): Error: #line integer ["filespec"]\n expected
+fail_compilation/lexer4.d(19): Error: #line integer ["filespec"]\n expected
+fail_compilation/lexer4.d(19): Error: declaration expected, not '"file"'
+---
+*/
+
+static c1 = '
+;
+static c2 = '';
+static c3 = 'a;
+int i = 0b12;
+int j = 0128;
+int k = 12a;
+int l = 12UU;
+int f = 0x1234.0;
+int m = 12l;
+static n = 12.1I;
+
+#line 1234567891234567879
+
+#line whatever
+
+#line 18 __FILE__
+
+#line 20 "file" "file"
+
+/** asdf *//** asdf2 */
+int o;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/lookup.d b/gcc/testsuite/gdc.test/fail_compilation/lookup.d
new file mode 100644
index 00000000000..9a7e14c5ffe
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/lookup.d
@@ -0,0 +1,28 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/lookup.d(23): Error: no property 'X' for type 'lookup.B'
+fail_compilation/lookup.d(23):        while evaluating: static assert((B).X == 0)
+fail_compilation/lookup.d(24): Error: no property 'Y' for type 'lookup.B'
+fail_compilation/lookup.d(24):        while evaluating: static assert((B).Y == 2)
+---
+*/
+
+import imports.imp1;
+
+enum X = 0;
+
+class B
+{
+    import imports.imp2;
+    static assert(X == 0);
+    static assert(Y == 2);
+}
+class C : B
+{
+    static assert(B.X == 0);
+    static assert(B.Y == 2);
+
+    static assert(X == 0);
+    static assert(Y == 1);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/mangle1.d b/gcc/testsuite/gdc.test/fail_compilation/mangle1.d
new file mode 100644
index 00000000000..bc2bc3dda89
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/mangle1.d
@@ -0,0 +1,8 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/mangle1.d(8): Error: pragma mangle can only apply to a single declaration
+---
+*/
+
+pragma(mangle, "_stuff_") __gshared { int x, y; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/mangle2.d b/gcc/testsuite/gdc.test/fail_compilation/mangle2.d
new file mode 100644
index 00000000000..e68c92acebb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/mangle2.d
@@ -0,0 +1,42 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/mangle2.d(20): Error: pragma mangle char 0x20 not allowed in mangled name
+fail_compilation/mangle2.d(21): Error: pragma mangle char 0x20 not allowed in mangled name
+fail_compilation/mangle2.d(24): Error: pragma mangle char 0x0a not allowed in mangled name
+fail_compilation/mangle2.d(25): Error: pragma mangle char 0x0a not allowed in mangled name
+fail_compilation/mangle2.d(28): Error: pragma mangle char 0x07 not allowed in mangled name
+fail_compilation/mangle2.d(29): Error: pragma mangle char 0x07 not allowed in mangled name
+fail_compilation/mangle2.d(32): Error: pragma mangle char 0x01 not allowed in mangled name
+fail_compilation/mangle2.d(33): Error: pragma mangle char 0x01 not allowed in mangled name
+fail_compilation/mangle2.d(36): Error: pragma mangle char 0x00 not allowed in mangled name
+fail_compilation/mangle2.d(37): Error: pragma mangle char 0x00 not allowed in mangled name
+fail_compilation/mangle2.d(40): Error: pragma mangle Outside Unicode code space
+fail_compilation/mangle2.d(41): Error: pragma mangle Outside Unicode code space
+---
+*/
+
+//spaces
+__gshared pragma(mangle, "test 9") ubyte test9_1;
+__gshared extern pragma(mangle, "test 9") ubyte test9_1_e;
+
+//\n chars
+__gshared pragma(mangle, "test\n9") ubyte test9_2;
+__gshared extern pragma(mangle, "test\n9") ubyte test9_2_e;
+
+//\a chars
+__gshared pragma(mangle, "test\a9") ubyte test9_3;
+__gshared extern pragma(mangle, "test\a9") ubyte test9_3_e;
+
+//\x01 chars
+__gshared pragma(mangle, "test\x019") ubyte test9_4;
+__gshared extern pragma(mangle, "test\x019") ubyte test9_4_e;
+
+//\0 chars
+__gshared pragma(mangle, "test\09") ubyte test9_5;
+__gshared extern pragma(mangle, "test\09") ubyte test9_5_e;
+
+//\xff chars
+__gshared pragma(mangle, "test\xff9") ubyte test9_6;
+__gshared extern pragma(mangle, "test\xff9") ubyte test9_6_e;
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/moduleundefuda.d b/gcc/testsuite/gdc.test/fail_compilation/moduleundefuda.d
new file mode 100644
index 00000000000..86517dbe810
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/moduleundefuda.d
@@ -0,0 +1,7 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/moduleundefuda.d(7): Error: undefined identifier 'undef'
+---
+*/
+@undef module moduleundefuda;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/nogc1.d b/gcc/testsuite/gdc.test/fail_compilation/nogc1.d
new file mode 100644
index 00000000000..8a66ac3e0ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/nogc1.d
@@ -0,0 +1,85 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+/***************** NewExp *******************/
+
+struct S1 { }
+struct S2 { this(int); }
+struct S3 { this(int) @nogc; }
+struct S4 { new(size_t); }
+struct S5 { @nogc new(size_t); }
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc1.d(27): Error: cannot use 'new' in @nogc function 'nogc1.testNew'
+fail_compilation/nogc1.d(29): Error: cannot use 'new' in @nogc function 'nogc1.testNew'
+fail_compilation/nogc1.d(30): Error: cannot use 'new' in @nogc function 'nogc1.testNew'
+fail_compilation/nogc1.d(32): Error: cannot use 'new' in @nogc function 'nogc1.testNew'
+fail_compilation/nogc1.d(33): Error: @nogc function 'nogc1.testNew' cannot call non-@nogc constructor 'nogc1.S2.this'
+fail_compilation/nogc1.d(34): Error: cannot use 'new' in @nogc function 'nogc1.testNew'
+fail_compilation/nogc1.d(35): Error: @nogc function 'nogc1.testNew' cannot call non-@nogc allocator 'nogc1.S4.new'
+fail_compilation/nogc1.d(38): Error: cannot use 'new' in @nogc function 'nogc1.testNew'
+---
+*/
+@nogc void testNew()
+{
+    int* p1 = new int;
+
+    int[] a1 = new int[3];
+    int[][] a2 = new int[][](2, 3);
+
+    S1* ps1 = new S1();
+    S2* ps2 = new S2(1);
+    S3* ps3 = new S3(1);
+    S4* ps4 = new S4;
+    S5* ps5 = new S5;   // no error
+
+    Object o1 = new Object();
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc1.d(55): Error: cannot use 'new' in @nogc function 'nogc1.testNewScope'
+fail_compilation/nogc1.d(57): Error: cannot use 'new' in @nogc function 'nogc1.testNewScope'
+fail_compilation/nogc1.d(58): Error: cannot use 'new' in @nogc function 'nogc1.testNewScope'
+fail_compilation/nogc1.d(60): Error: cannot use 'new' in @nogc function 'nogc1.testNewScope'
+fail_compilation/nogc1.d(61): Error: @nogc function 'nogc1.testNewScope' cannot call non-@nogc constructor 'nogc1.S2.this'
+fail_compilation/nogc1.d(62): Error: cannot use 'new' in @nogc function 'nogc1.testNewScope'
+fail_compilation/nogc1.d(63): Error: @nogc function 'nogc1.testNewScope' cannot call non-@nogc allocator 'nogc1.S4.new'
+---
+*/
+@nogc void testNewScope()
+{
+    scope int* p1 = new int;
+
+    scope int[] a1 = new int[3];
+    scope int[][] a2 = new int[][](2, 3);
+
+    scope S1* ps1 = new S1();
+    scope S2* ps2 = new S2(1);
+    scope S3* ps3 = new S3(1);
+    scope S4* ps4 = new S4;
+    scope S5* ps5 = new S5;             // no error
+
+    scope Object o1 = new Object();     // no error
+    scope o2 = new Object();            // no error
+}
+
+/***************** DeleteExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc1.d(82): Error: cannot use 'delete' in @nogc function 'nogc1.testDelete'
+fail_compilation/nogc1.d(83): Error: cannot use 'delete' in @nogc function 'nogc1.testDelete'
+fail_compilation/nogc1.d(84): Error: cannot use 'delete' in @nogc function 'nogc1.testDelete'
+---
+*/
+@nogc void testDelete(int* p, Object o, S1* s)
+{
+    delete p;
+    delete o;
+    delete s;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/nogc2.d b/gcc/testsuite/gdc.test/fail_compilation/nogc2.d
new file mode 100644
index 00000000000..1af413ac98c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/nogc2.d
@@ -0,0 +1,104 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+/***************** CatExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc2.d(21): Error: cannot use operator ~ in @nogc function 'nogc2.testCat'
+fail_compilation/nogc2.d(22): Error: cannot use operator ~ in @nogc function 'nogc2.testCat'
+fail_compilation/nogc2.d(23): Error: cannot use operator ~ in @nogc function 'nogc2.testCat'
+fail_compilation/nogc2.d(25): Error: cannot use operator ~ in @nogc function 'nogc2.testCat'
+fail_compilation/nogc2.d(26): Error: cannot use operator ~ in @nogc function 'nogc2.testCat'
+fail_compilation/nogc2.d(27): Error: cannot use operator ~ in @nogc function 'nogc2.testCat'
+fail_compilation/nogc2.d(28): Error: cannot use operator ~ in @nogc function 'nogc2.testCat'
+fail_compilation/nogc2.d(29): Error: cannot use operator ~ in @nogc function 'nogc2.testCat'
+---
+*/
+@nogc void testCat(int[] a, string s)
+{
+    int[] a1 = a ~ a;
+    int[] a2 = a ~ 1;
+    int[] a3 = 1 ~ a;
+
+    string s1 = s ~ s;
+    string s2 = s ~ "a";
+    string s3 = "a" ~ s;
+    string s4 = s ~ 'c';
+    string s5 = 'c' ~ s;
+
+    string s6 = "a" ~ "b";      // no error
+    string s7 = "a" ~ 'c';      // no error
+    string s8 = 'c' ~ "b";      // no error
+}
+
+/***************** CatAssignExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc2.d(48): Error: cannot use operator ~= in @nogc function 'nogc2.testCatAssign'
+fail_compilation/nogc2.d(50): Error: cannot use operator ~= in @nogc function 'nogc2.testCatAssign'
+fail_compilation/nogc2.d(51): Error: cannot use operator ~= in @nogc function 'nogc2.testCatAssign'
+---
+*/
+@nogc void testCatAssign(int[] a, string s)
+{
+    a ~= 1;
+
+    s ~= "a";
+    s ~= 'c';
+}
+
+/***************** ArrayLiteralExp *******************/
+
+@nogc int* barA();
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc2.d(70): Error: array literal in @nogc function 'nogc2.testArray' may cause GC allocation
+fail_compilation/nogc2.d(71): Error: array literal in @nogc function 'nogc2.testArray' may cause GC allocation
+---
+*/
+@nogc void testArray()
+{
+    enum arrLiteral = [null, null];
+
+    int* p;
+    auto a = [p, p, barA()];
+    a = arrLiteral;
+}
+
+/***************** AssocArrayLiteralExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc2.d(87): Error: associative array literal in @nogc function 'nogc2.testAssocArray' may cause GC allocation
+fail_compilation/nogc2.d(88): Error: associative array literal in @nogc function 'nogc2.testAssocArray' may cause GC allocation
+---
+*/
+@nogc void testAssocArray()
+{
+    enum aaLiteral = [10: 100];
+
+    auto aa = [1:1, 2:3, 4:5];
+    aa = aaLiteral;
+}
+
+/***************** IndexExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc2.d(102): Error: indexing an associative array in @nogc function 'nogc2.testIndex' may cause GC allocation
+fail_compilation/nogc2.d(103): Error: indexing an associative array in @nogc function 'nogc2.testIndex' may cause GC allocation
+---
+*/
+@nogc void testIndex(int[int] aa)
+{
+    aa[1] = 0;
+    int n = aa[1];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/nogc3.d b/gcc/testsuite/gdc.test/fail_compilation/nogc3.d
new file mode 100644
index 00000000000..d899104b1a9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/nogc3.d
@@ -0,0 +1,70 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+/***************** AssignExp *******************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc3.d(16): Error: setting 'length' in @nogc function 'nogc3.testArrayLength' may cause GC allocation
+fail_compilation/nogc3.d(17): Error: setting 'length' in @nogc function 'nogc3.testArrayLength' may cause GC allocation
+fail_compilation/nogc3.d(18): Error: setting 'length' in @nogc function 'nogc3.testArrayLength' may cause GC allocation
+---
+*/
+@nogc void testArrayLength(int[] a)
+{
+    a.length = 3;
+    a.length += 1;
+    a.length -= 1;
+}
+
+/***************** CallExp *******************/
+
+void barCall();
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc3.d(35): Error: @nogc function 'nogc3.testCall' cannot call non-@nogc function pointer 'fp'
+fail_compilation/nogc3.d(36): Error: @nogc function 'nogc3.testCall' cannot call non-@nogc function 'nogc3.barCall'
+---
+*/
+@nogc void testCall()
+{
+    auto fp = &barCall;
+    (*fp)();
+    barCall();
+}
+
+/****************** Closure ***********************/
+
+@nogc void takeDelegate2(scope int delegate() dg) {}
+@nogc void takeDelegate3(      int delegate() dg) {}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/nogc3.d(53): Error: function nogc3.testClosure1 is @nogc yet allocates closures with the GC
+fail_compilation/nogc3.d(56):        nogc3.testClosure1.bar closes over variable x at fail_compilation/nogc3.d(55)
+fail_compilation/nogc3.d(65): Error: function nogc3.testClosure3 is @nogc yet allocates closures with the GC
+fail_compilation/nogc3.d(68):        nogc3.testClosure3.bar closes over variable x at fail_compilation/nogc3.d(67)
+---
+*/
+@nogc auto testClosure1()
+{
+    int x;
+    int bar() { return x; }
+    return &bar;
+}
+@nogc void testClosure2()
+{
+    int x;
+    int bar() { return x; }
+    takeDelegate2(&bar);     // no error
+}
+@nogc void testClosure3()
+{
+    int x;
+    int bar() { return x; }
+    takeDelegate3(&bar);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/parse12924.d b/gcc/testsuite/gdc.test/fail_compilation/parse12924.d
new file mode 100644
index 00000000000..dacda4720d4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/parse12924.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parse12924.d(14): Error: declaration expected following attribute, not ';'
+fail_compilation/parse12924.d(15): Error: declaration expected following attribute, not ';'
+fail_compilation/parse12924.d(16): Error: declaration expected following attribute, not ';'
+fail_compilation/parse12924.d(17): Error: declaration expected following attribute, not ';'
+fail_compilation/parse12924.d(18): Error: declaration expected following attribute, not ';'
+fail_compilation/parse12924.d(19): Error: declaration expected following attribute, not ';'
+fail_compilation/parse12924.d(20): Error: declaration expected following attribute, not ';'
+---
+*/
+
+static;         void f1() {}
+deprecated;     void f2() {}
+deprecated(""); void f3() {}
+extern(C);      void f4() {}
+public;         void f5() {}
+align(1);       void f6() {}
+@(1);           void f7() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/parse12967a.d b/gcc/testsuite/gdc.test/fail_compilation/parse12967a.d
new file mode 100644
index 00000000000..90bccb783ac
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/parse12967a.d
@@ -0,0 +1,43 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parse12967a.d(14): Error: function parse12967a.pre_i1 without 'this' cannot be immutable
+fail_compilation/parse12967a.d(15): Error: function parse12967a.pre_i2 without 'this' cannot be immutable
+fail_compilation/parse12967a.d(16): Error: function parse12967a.pre_c1 without 'this' cannot be const
+fail_compilation/parse12967a.d(17): Error: function parse12967a.pre_c2 without 'this' cannot be const
+fail_compilation/parse12967a.d(18): Error: function parse12967a.pre_w1 without 'this' cannot be inout
+fail_compilation/parse12967a.d(19): Error: function parse12967a.pre_w2 without 'this' cannot be inout
+fail_compilation/parse12967a.d(20): Error: function parse12967a.pre_s1 without 'this' cannot be shared
+fail_compilation/parse12967a.d(21): Error: function parse12967a.pre_s2 without 'this' cannot be shared
+---
+*/
+immutable      pre_i1() {}
+immutable void pre_i2() {}
+const          pre_c1() {}
+const     void pre_c2() {}
+inout          pre_w1() {}
+inout     void pre_w2() {}
+shared         pre_s1() {}
+shared    void pre_s2() {}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parse12967a.d(36): Error: function parse12967a.post_i1 without 'this' cannot be immutable
+fail_compilation/parse12967a.d(37): Error: function parse12967a.post_i2 without 'this' cannot be immutable
+fail_compilation/parse12967a.d(38): Error: function parse12967a.post_c1 without 'this' cannot be const
+fail_compilation/parse12967a.d(39): Error: function parse12967a.post_c2 without 'this' cannot be const
+fail_compilation/parse12967a.d(40): Error: function parse12967a.post_w1 without 'this' cannot be inout
+fail_compilation/parse12967a.d(41): Error: function parse12967a.post_w2 without 'this' cannot be inout
+fail_compilation/parse12967a.d(42): Error: function parse12967a.post_s1 without 'this' cannot be shared
+fail_compilation/parse12967a.d(43): Error: function parse12967a.post_s2 without 'this' cannot be shared
+---
+*/
+auto post_i1() immutable {}
+void post_i2() immutable {}
+auto post_c1() const     {}
+void post_c2() const     {}
+auto post_w1() inout     {}
+void post_w2() inout     {}
+auto post_s1() shared    {}
+void post_s2() shared    {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/parse12967b.d b/gcc/testsuite/gdc.test/fail_compilation/parse12967b.d
new file mode 100644
index 00000000000..60d9d09948b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/parse12967b.d
@@ -0,0 +1,41 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parse12967b.d(24): Error: function parse12967b.C.pre_c without 'this' cannot be const
+fail_compilation/parse12967b.d(25): Error: function parse12967b.C.pre_c without 'this' cannot be const
+fail_compilation/parse12967b.d(26): Error: function parse12967b.C.pre_i without 'this' cannot be immutable
+fail_compilation/parse12967b.d(27): Error: function parse12967b.C.pre_i without 'this' cannot be immutable
+fail_compilation/parse12967b.d(28): Error: function parse12967b.C.pre_w without 'this' cannot be inout
+fail_compilation/parse12967b.d(29): Error: function parse12967b.C.pre_w without 'this' cannot be inout
+fail_compilation/parse12967b.d(30): Error: function parse12967b.C.pre_s without 'this' cannot be shared
+fail_compilation/parse12967b.d(31): Error: function parse12967b.C.pre_s without 'this' cannot be shared
+fail_compilation/parse12967b.d(33): Error: function parse12967b.C.post_c without 'this' cannot be const
+fail_compilation/parse12967b.d(34): Error: function parse12967b.C.post_c without 'this' cannot be const
+fail_compilation/parse12967b.d(35): Error: function parse12967b.C.post_i without 'this' cannot be immutable
+fail_compilation/parse12967b.d(36): Error: function parse12967b.C.post_i without 'this' cannot be immutable
+fail_compilation/parse12967b.d(37): Error: function parse12967b.C.post_w without 'this' cannot be inout
+fail_compilation/parse12967b.d(38): Error: function parse12967b.C.post_w without 'this' cannot be inout
+fail_compilation/parse12967b.d(39): Error: function parse12967b.C.post_s without 'this' cannot be shared
+fail_compilation/parse12967b.d(40): Error: function parse12967b.C.post_s without 'this' cannot be shared
+---
+*/
+class C
+{
+    const     static      pre_c() {}
+    const     static void pre_c() {}
+    immutable static      pre_i() {}
+    immutable static void pre_i() {}
+    inout     static      pre_w() {}
+    inout     static void pre_w() {}
+    shared    static      pre_s() {}
+    shared    static void pre_s() {}
+
+    static      post_c() const     {}
+    static void post_c() const     {}
+    static      post_i() immutable {}
+    static void post_i() immutable {}
+    static      post_w() inout     {}
+    static void post_w() inout     {}
+    static      post_s() shared    {}
+    static void post_s() shared    {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/parse13361.d b/gcc/testsuite/gdc.test/fail_compilation/parse13361.d
new file mode 100644
index 00000000000..22e5fc2e0c1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/parse13361.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parse13361.d(11): Error: empty attribute list is not allowed
+fail_compilation/parse13361.d(14): Error: empty attribute list is not allowed
+fail_compilation/parse13361.d(14): Error: use @(attributes) instead of [attributes]
+---
+*/
+struct A
+{
+  @()
+    int b;
+
+  []    // deprecated style
+    int c;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/parse14285.d b/gcc/testsuite/gdc.test/fail_compilation/parse14285.d
new file mode 100644
index 00000000000..c3cd6c399d3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/parse14285.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parse14285.d(10): Error: no identifier for declarator this
+---
+*/
+
+struct S
+{
+    alias this;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/parseStc.d b/gcc/testsuite/gdc.test/fail_compilation/parseStc.d
new file mode 100644
index 00000000000..46e42949b1b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/parseStc.d
@@ -0,0 +1,38 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc.d(11): Error: found ';' when expecting ')'
+fail_compilation/parseStc.d(11): Error: found ')' when expecting ';' following statement
+fail_compilation/parseStc.d(12): Error: redundant attribute 'const'
+---
+*/
+void test1()
+{
+    if (x; 1) {}
+    if (const const auto x = 1) {}
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc.d(25): Error: redundant attribute 'const'
+fail_compilation/parseStc.d(26): Error: redundant attribute 'const'
+fail_compilation/parseStc.d(27): Error: conflicting attribute 'immutable'
+---
+*/
+void test2()
+{
+    const const x = 1;
+    foreach (const const x; [1,2,3]) {}
+    foreach (const immutable x; [1,2,3]) {}
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc.d(37): Error: redundant attribute 'const'
+fail_compilation/parseStc.d(38): Error: redundant attribute 'const'
+---
+*/
+struct S3 { const const test3() {} }
+void test4(const const int x) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/parseStc2.d b/gcc/testsuite/gdc.test/fail_compilation/parseStc2.d
new file mode 100644
index 00000000000..840024a3472
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/parseStc2.d
@@ -0,0 +1,67 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc2.d(11): Error: conflicting attribute 'const'
+fail_compilation/parseStc2.d(12): Error: conflicting attribute '@system'
+fail_compilation/parseStc2.d(13): Error: conflicting attribute '@safe'
+fail_compilation/parseStc2.d(14): Error: conflicting attribute '@trusted'
+fail_compilation/parseStc2.d(15): Error: conflicting attribute '__gshared'
+---
+*/
+immutable const void f4() {}
+@safe @system void f4() {}
+@trusted @safe void f4() {}
+@system @trusted void f4() {}
+shared __gshared f4() {}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc2.d(26): Error: redundant attribute 'static'
+fail_compilation/parseStc2.d(27): Error: redundant attribute 'pure'
+fail_compilation/parseStc2.d(28): Error: redundant attribute '@property'
+fail_compilation/parseStc2.d(29): Error: redundant attribute '@safe'
+---
+*/
+static static void f1() {}
+pure nothrow pure void f2() {}
+@property extern(C) @property void f3() {}
+deprecated("") @safe @safe void f4() {}
+@(1) @(1) void f5() {}  // OK
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc2.d(39): Error: redundant linkage extern (C)
+fail_compilation/parseStc2.d(40): Error: conflicting linkage extern (C) and extern (C++)
+---
+*/
+extern(C) extern(C) void f6() {}
+extern(C) extern(C++) void f7() {}
+extern(C++, foo) extern(C++, bar) void f8() {}  // OK
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc2.d(50): Error: redundant protection attribute 'public'
+fail_compilation/parseStc2.d(51): Error: conflicting protection attribute 'public' and 'private'
+---
+*/
+public public void f9() {}
+public private void f10() {}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc2.d(63): Error: redundant alignment attribute align
+fail_compilation/parseStc2.d(64): Error: redundant alignment attribute align(1)
+fail_compilation/parseStc2.d(65): Error: conflicting alignment attribute align and align(1)
+fail_compilation/parseStc2.d(66): Error: conflicting alignment attribute align(1) and align
+fail_compilation/parseStc2.d(67): Error: conflicting alignment attribute align(1) and align(2)
+---
+*/
+align    align    void f11() {}
+align(1) align(1) void f12() {}
+align    align(1) void f13() {}
+align(1) align    void f14() {}
+align(1) align(2) void f15() {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/parseStc3.d b/gcc/testsuite/gdc.test/fail_compilation/parseStc3.d
new file mode 100644
index 00000000000..1ee85d7a1bd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/parseStc3.d
@@ -0,0 +1,62 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc3.d(10): Deprecation: redundant attribute 'pure'
+fail_compilation/parseStc3.d(11): Deprecation: redundant attribute 'nothrow'
+fail_compilation/parseStc3.d(12): Deprecation: redundant attribute '@nogc'
+fail_compilation/parseStc3.d(13): Deprecation: redundant attribute '@property'
+---
+*/
+pure      void f1() pure      {}
+nothrow   void f2() nothrow   {}
+@nogc     void f3() @nogc     {}
+@property void f4() @property {}
+//ref     int  f5() ref       { static int g; return g; }
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc3.d(24): Deprecation: redundant attribute '@safe'
+fail_compilation/parseStc3.d(25): Deprecation: redundant attribute '@system'
+fail_compilation/parseStc3.d(26): Deprecation: redundant attribute '@trusted'
+---
+*/
+@safe     void f6() @safe    {}
+@system   void f7() @system  {}
+@trusted  void f8() @trusted {}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc3.d(39): Error: conflicting attribute '@system'
+fail_compilation/parseStc3.d(40): Error: conflicting attribute '@trusted'
+fail_compilation/parseStc3.d(41): Error: conflicting attribute '@safe'
+fail_compilation/parseStc3.d(42): Error: conflicting attribute '@trusted'
+fail_compilation/parseStc3.d(43): Error: conflicting attribute '@safe'
+fail_compilation/parseStc3.d(44): Error: conflicting attribute '@system'
+---
+*/
+@safe     void f9()  @system  {}
+@safe     void f10() @trusted {}
+@system   void f11() @safe    {}
+@system   void f12() @trusted {}
+@trusted  void f13() @safe    {}
+@trusted  void f14() @system  {}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc3.d(59): Error: conflicting attribute '@system'
+fail_compilation/parseStc3.d(59): Error: conflicting attribute '@trusted'
+fail_compilation/parseStc3.d(60): Error: conflicting attribute '@system'
+fail_compilation/parseStc3.d(60): Deprecation: redundant attribute '@system'
+fail_compilation/parseStc3.d(61): Error: conflicting attribute '@safe'
+fail_compilation/parseStc3.d(61): Deprecation: redundant attribute '@system'
+fail_compilation/parseStc3.d(62): Error: conflicting attribute '@safe'
+fail_compilation/parseStc3.d(62): Deprecation: redundant attribute '@trusted'
+---
+*/
+@safe @system  void f15() @trusted {}
+@safe @system  void f16() @system  {}
+@system @safe  void f17() @system  {}
+@trusted @safe void f18() @trusted {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/parseStc4.d b/gcc/testsuite/gdc.test/fail_compilation/parseStc4.d
new file mode 100644
index 00000000000..750f3e4d71e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/parseStc4.d
@@ -0,0 +1,42 @@
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc4.d(14): Deprecation: redundant attribute 'pure'
+fail_compilation/parseStc4.d(14): Deprecation: redundant attribute 'nothrow'
+fail_compilation/parseStc4.d(14): Error: conflicting attribute '@system'
+fail_compilation/parseStc4.d(14): Deprecation: redundant attribute '@nogc'
+fail_compilation/parseStc4.d(14): Deprecation: redundant attribute '@property'
+---
+*/
+pure nothrow @safe   @nogc @property
+int foo()
+pure nothrow @system @nogc @property
+{
+    return 0;
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc4.d(34): Deprecation: redundant attribute 'const'
+fail_compilation/parseStc4.d(35): Deprecation: redundant attribute 'const'
+fail_compilation/parseStc4.d(36): Deprecation: redundant attribute 'const'
+fail_compilation/parseStc4.d(38): Deprecation: redundant attribute 'pure'
+fail_compilation/parseStc4.d(39): Deprecation: redundant attribute '@safe'
+fail_compilation/parseStc4.d(40): Deprecation: redundant attribute 'nothrow'
+fail_compilation/parseStc4.d(41): Error: conflicting attribute '@trusted'
+---
+*/
+
+struct S
+{
+    const this(int) const {}
+    const this(this) const {}
+    const ~this() const {}
+
+    pure static this() pure {}
+    @safe static ~this() @safe {}
+    nothrow shared static this() nothrow {}
+    @system shared static ~this() @trusted {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/parseStc5.d b/gcc/testsuite/gdc.test/fail_compilation/parseStc5.d
new file mode 100644
index 00000000000..03b8e9b7552
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/parseStc5.d
@@ -0,0 +1,88 @@
+// REQUIRED_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc5.d(11): Error: constructor cannot be static
+fail_compilation/parseStc5.d(12): Error: postblit cannot be static
+---
+*/
+class C1
+{
+    static pure this(int) {}        // 'static pure' + 'this(int)'
+    static pure this(this) {}       // 'static pure' + 'this(this)'
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc5.d(28): Error: use 'shared static this()' to declare a shared static constructor
+fail_compilation/parseStc5.d(29): Error: use 'shared static this()' to declare a shared static constructor
+fail_compilation/parseStc5.d(31): Error: use 'shared static this()' to declare a shared static constructor
+fail_compilation/parseStc5.d(33): Error: use 'shared static ~this()' to declare a shared static destructor
+fail_compilation/parseStc5.d(34): Error: use 'shared static ~this()' to declare a shared static destructor
+fail_compilation/parseStc5.d(36): Error: use 'shared static ~this()' to declare a shared static destructor
+---
+*/
+class C2    // wrong combinations of 'shared', 'static', and '~?this()'
+{
+    shared pure static this() {}    // 'shared pure' + 'static this()'
+    shared static pure this() {}    // 'shared static pure' + 'this()'
+
+    static this() shared {}         // 'shared pure' + 'static this()'
+
+    shared pure static ~this() {}   // 'shared pure' + 'static ~this()'
+    shared static pure ~this() {}   // 'shared static pure' + '~this()'
+
+    static ~this() shared {}        // 'shared' + 'static ~this()'
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc5.d(48): Error: use 'static this()' to declare a static constructor
+fail_compilation/parseStc5.d(49): Error: use 'static ~this()' to declare a static destructor
+---
+*/
+class C3    // wrong combinations of 'static' and '~?this()'
+{
+    static pure this() {}           // 'static pure' + 'this()'
+    static pure ~this() {}          // 'static pure' + '~this()'
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc5.d(64): Error: redundant attribute 'shared'
+fail_compilation/parseStc5.d(65): Error: redundant attribute 'shared'
+fail_compilation/parseStc5.d(67): Error: redundant attribute 'static'
+fail_compilation/parseStc5.d(69): Error: redundant attribute 'static shared'
+fail_compilation/parseStc5.d(70): Error: redundant attribute 'static shared'
+---
+*/
+class C4    // redundancy of 'shared' and/or 'static'
+{
+    shared shared static this() {}                  // 'shared' + 'shared static this()'
+    shared static this() shared {}                  // 'shared' + 'shared static this()'
+
+    static static this() {}                         // 'static' + 'shared static this()'
+
+    shared static shared static this() {}           // shared static + 'shared static this()'
+    shared static shared static this() shared {}    // shared shared static + 'shared static this()'
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/parseStc5.d(84): Error: static constructor cannot be const
+fail_compilation/parseStc5.d(85): Error: static destructor cannot be const
+fail_compilation/parseStc5.d(86): Error: shared static constructor cannot be const
+fail_compilation/parseStc5.d(87): Error: shared static destructor cannot be const
+---
+*/
+class C5    // wrong MemberFunctionAttributes on 'shared? static (con|de)structor'
+{
+    static this() const {}
+    static ~this() const {}
+    shared static this() const {}
+    shared static ~this() const {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/pragmainline.d b/gcc/testsuite/gdc.test/fail_compilation/pragmainline.d
new file mode 100644
index 00000000000..519421da74a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/pragmainline.d
@@ -0,0 +1,11 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/pragmainline.d(9): Error: pragma inline one boolean expression expected for pragma(inline), not 3
+fail_compilation/pragmainline.d(10): Error: pragma inline pragma(inline, true or false) expected, not "string"
+---
+*/
+
+pragma(inline, 1,2,3) void bar();
+pragma(inline, "string") void baz();
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/protattr1.d b/gcc/testsuite/gdc.test/fail_compilation/protattr1.d
new file mode 100644
index 00000000000..6fca3e91b8e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/protattr1.d
@@ -0,0 +1,7 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/protection/subpkg/test1.d(3): Error: protection attribute 'package(undefined)' does not bind to one of ancestor packages of module 'protection.subpkg.test1'
+---
+*/
+import protection.subpkg.test1;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/protattr2.d b/gcc/testsuite/gdc.test/fail_compilation/protattr2.d
new file mode 100644
index 00000000000..a28f240420c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/protattr2.d
@@ -0,0 +1,7 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/protection/subpkg/test2.d(3): Error: protection attribute 'package(protection.subpkg2)' does not bind to one of ancestor packages of module 'protection.subpkg.test2'
+---
+*/
+import protection.subpkg.test2;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/protattr3.d b/gcc/testsuite/gdc.test/fail_compilation/protattr3.d
new file mode 100644
index 00000000000..480b79855ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/protattr3.d
@@ -0,0 +1,7 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/protection/subpkg/test3.d(3): Error: protection package expected as dot-separated identifiers, got '123'
+---
+*/
+import protection.subpkg.test3;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/protection/subpkg/test1.d b/gcc/testsuite/gdc.test/fail_compilation/protection/subpkg/test1.d
new file mode 100644
index 00000000000..35abb80cbe1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/protection/subpkg/test1.d
@@ -0,0 +1,3 @@
+module protection.subpkg.test1;
+
+package(undefined) void foo1();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/protection/subpkg/test2.d b/gcc/testsuite/gdc.test/fail_compilation/protection/subpkg/test2.d
new file mode 100644
index 00000000000..32aedff0b81
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/protection/subpkg/test2.d
@@ -0,0 +1,3 @@
+module protection.subpkg.test2;
+
+package(protection.subpkg2) void foo2();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/protection/subpkg/test3.d b/gcc/testsuite/gdc.test/fail_compilation/protection/subpkg/test3.d
new file mode 100644
index 00000000000..13cc08034ec
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/protection/subpkg/test3.d
@@ -0,0 +1,3 @@
+module protection.subpkg.test3;
+
+package(123) void foo3();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/retref2.d b/gcc/testsuite/gdc.test/fail_compilation/retref2.d
new file mode 100644
index 00000000000..037c258539b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/retref2.d
@@ -0,0 +1,23 @@
+
+// REQUIRED_ARGS: -dip25
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retref2.d(21): Error: function retref2.D.foo does not override any function, did you mean to override 'retref2.C.foo'?
+fail_compilation/retref2.d(22): Error: function retref2.D.bar does not override any function, did you mean to override 'retref2.C.bar'?
+---
+*/
+
+
+class C
+{
+    ref int foo(ref int);
+    ref int bar();
+}
+
+class D : C
+{
+    override ref int foo(return ref int);
+    override ref int bar() return;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope.d b/gcc/testsuite/gdc.test/fail_compilation/retscope.d
new file mode 100644
index 00000000000..01223409e82
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/retscope.d
@@ -0,0 +1,606 @@
+/*
+REQUIRED_ARGS: -dip1000
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(23): Error: scope variable p may not be returned
+fail_compilation/retscope.d(33): Error: escaping reference to local variable j
+fail_compilation/retscope.d(46): Error: scope variable p assigned to non-scope q
+fail_compilation/retscope.d(48): Error: address of variable i assigned to q with longer lifetime
+fail_compilation/retscope.d(49): Error: variadic variable a assigned to non-scope b
+fail_compilation/retscope.d(50): Error: reference to stack allocated value returned by (*fp2)() assigned to non-scope q
+---
+*/
+
+
+
+
+int* foo1(return scope int* p) { return p; } // ok
+
+int* foo2()(scope int* p) { return p; }  // ok, 'return' is inferred
+alias foo2a = foo2!();
+
+int* foo3(scope int* p) { return p; }   // error
+
+int* foo4(bool b)
+{
+    int i;
+    int j;
+
+    int* nested1(scope int* p) { return null; }
+    int* nested2(return scope int* p) { return p; }
+
+    return b ? nested1(&i) : nested2(&j);
+}
+
+/************************************************/
+
+struct S2 { int a,b,c,d; }
+
+@safe S2 function() fp2;
+
+void test2(scope int* p, int[] a ...) @safe
+{
+    static int* q;
+    static int[] b;
+    q = p;
+    int i;
+    q = &i;
+    b = a;
+    q = &fp2().d;
+}
+
+/**************************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(76): Error: function retscope.HTTP.Impl.onReceive is @nogc yet allocates closures with the GC
+fail_compilation/retscope.d(78):        retscope.HTTP.Impl.onReceive.__lambda1 closes over variable this at fail_compilation/retscope.d(76)
+---
+*/
+
+
+struct Curl
+{
+    int delegate() dg;
+}
+
+struct HTTP
+{
+    struct Impl
+    {
+        Curl curl;
+        int x;
+
+        @nogc void onReceive()
+        {
+            auto dg = ( ) { return x; };
+            curl.dg = dg;
+        }
+    }
+}
+
+/***********************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(97): Error: reference to local variable sa assigned to non-scope parameter a calling retscope.bar8
+---
+*/
+// https://issues.dlang.org/show_bug.cgi?id=8838
+
+int[] foo8() @safe
+{
+    int[5] sa;
+    return bar8(sa);
+}
+
+int[] bar8(int[] a) @safe
+{
+    return a;
+}
+
+
+/*************************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(124): Error: escaping reference to local variable tmp
+---
+*/
+
+char[] foo9(char[] a) @safe pure nothrow @nogc
+{
+    return a;
+}
+
+char[] bar9() @safe
+{
+    char[20] tmp;
+    foo9(tmp);          // ok
+    return foo9(tmp);   // error
+}
+
+/*************************************************/
+
+/*
+//
+//
+//fail_compilation/retscope.d(143): To enforce @safe compiler allocates a closure unless the opApply() uses 'scope'
+//
+*/
+
+struct S10
+{
+    static int opApply(int delegate(S10*) dg);
+}
+
+S10* test10()
+{
+    foreach (S10* m; S10)
+        return m;
+    return null;
+}
+
+/************************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(159): Error: scope variable this may not be returned
+---
+*/
+
+class C11
+{
+    @safe C11 foo() scope { return this; }
+}
+
+
+/****************************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(178): Error: address of variable i assigned to p with longer lifetime
+---
+*/
+
+
+
+void foo11() @safe
+{
+    int[] p;
+    int[3] i;
+    p = i[];
+}
+
+/************************************************/
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(198): Error: scope variable e may not be returned
+---
+*/
+
+struct Escaper
+{
+    void* DG;
+}
+
+void* escapeDg1(scope void* d) @safe
+{
+    Escaper e;
+    e.DG = d;
+    return e.DG;
+}
+
+/*************************************************/
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(213): Error: scope variable p assigned to non-scope e
+---
+*/
+struct Escaper3 { void* e; }
+
+void* escape3 (scope void* p) @safe {
+    Escaper3 e;
+    scope dg = () { return e.e; };
+    e.e = p;
+    return dg();
+}
+
+/**************************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(230): Error: scope variable ptr may not be returned
+---
+*/
+
+alias dg_t = void* delegate () return scope @safe;
+
+void* funretscope(scope dg_t ptr) @safe
+{
+    return ptr();
+}
+
+/*****************************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(249): Error: cannot implicitly convert expression (__lambda1) of type void* delegate() pure nothrow @nogc return @safe to void* delegate() @safe
+fail_compilation/retscope.d(249): Error: cannot implicitly convert expression (__lambda1) of type void* delegate() pure nothrow @nogc return @safe to void* delegate() @safe
+fail_compilation/retscope.d(250): Error: cannot implicitly convert expression (__lambda2) of type void* delegate() pure nothrow @nogc return @safe to void* delegate() @safe
+fail_compilation/retscope.d(250): Error: cannot implicitly convert expression (__lambda2) of type void* delegate() pure nothrow @nogc return @safe to void* delegate() @safe
+---
+*/
+
+void escape4() @safe
+{
+    alias FunDG = void* delegate () @safe;
+    int x = 42;
+    scope FunDG f = () return { return &x; };
+    scope FunDG g = ()        { return &x; };
+}
+
+/**************************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(267): Error: cannot take address of scope local p in @safe function escape5
+---
+*/
+
+void escape5() @safe
+{
+    int* q;
+    scope int* p;
+    scope int** pp = &q; // ok
+    pp = &p; // error
+}
+
+/***********************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(287): Error: escaping reference to local variable b
+---
+*/
+
+@safe int* foo6()(int* arg)
+{
+    return arg;
+}
+
+int* escape6() @safe
+{
+    int b;
+    return foo6(&b);
+}
+
+/***************************************************/
+
+struct S7
+{
+    int[10] a;
+    int[3] abc(int i) @safe
+    {
+        return a[0 .. 3]; // should not error
+    }
+}
+
+/***************************************************/
+
+int[3] escape8(scope int[] p) @safe { return p[0 .. 3]; } // should not error
+char*[3] escape9(scope char*[] p) @safe { return p[0 .. 3]; }
+
+/***************************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(320): Error: reference to local variable i assigned to non-scope f
+---
+*/
+
+int* escape10() @safe
+{
+    int i;
+    int* f;
+    scope int** x = &f;
+    f = &i;
+
+    return bar10(x);
+}
+
+int* bar10( scope int** ptr ) @safe
+{
+    return *ptr;
+}
+
+/******************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(343): Error: cannot take address of scope local aa in @safe function escape11
+---
+*/
+
+int* escape11() @safe
+{
+    int i;
+    int*[3] aa = [ &i, null, null ];
+    return bar11(&aa[0]);
+}
+
+int* bar11(scope int** x) @safe
+{
+    return foo11(*x);
+}
+
+int* foo11(int* x) @safe { return x; }
+
+/******************************************/
+
+void escape15() @safe
+{
+    int arg;
+    const(void)*[1] argsAddresses;
+    argsAddresses[0] = // MUST be an array assignment
+        (ref arg)@trusted{ return cast(const void*) &arg; }(arg);
+}
+
+/******************************************/
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(1003): Error: escaping reference to local variable f
+---
+*/
+
+#line 1000
+int* escape12() @safe
+{
+    Foo12 f;
+    return f.foo;
+}
+
+struct Foo12
+{
+    int* foo() return @safe;
+}
+
+/******************************************/
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(1103): scope variable f may not be returned
+---
+*/
+
+#line 1100
+int* escape13() @safe
+{
+    scope Foo13 f;
+    return f.foo;
+}
+
+class Foo13
+{
+    int* foo() return @safe;
+}
+
+/******************************************/
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(1205): Error: scope variable f14 assigned to non-scope parameter this calling retscope.Foo14.foo
+---
+*/
+
+#line 1200
+int* escape14() @safe
+{
+    int i;
+    Foo14 f14;
+    f14.v = &i;
+    return f14.foo;
+}
+
+struct Foo14
+{
+    int* v;
+    int* foo () @safe { return this.v; }
+}
+
+/*************************************************/
+
+void foo16() @nogc nothrow
+{
+    alias dg_t = string delegate(string) @nogc nothrow;
+
+    dg_t dg = (string s) => s;
+}
+
+/*************************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(1701): Error: cannot implicitly convert expression (& func) of type int* function(int* p) to int* function(scope int* p)
+fail_compilation/retscope.d(1702): Error: cannot implicitly convert expression (& func) of type int* function(int* p) to int* function(return scope int* p)
+fail_compilation/retscope.d(1703): Error: cannot implicitly convert expression (& func) of type int* function(int* p) to int* function(return scope int* p)
+fail_compilation/retscope.d(1711): Error: cannot implicitly convert expression (& funcr) of type int* function(return scope int* p) to int* function(scope int* p)
+fail_compilation/retscope.d(1716): Error: cannot implicitly convert expression (& funcrs) of type int* function(return scope int* p) to int* function(scope int* p)
+---
+*/
+
+int* func(int* p);
+int* funcs(scope int* p);
+int* funcr(return int* p);
+int* funcrs(return scope int* p);
+
+void foo17()
+{
+#line 1700
+    typeof(func)   *fp1 = &func;
+    typeof(funcs)  *fp2 = &func; // error
+    typeof(funcr)  *fp3 = &func; // error
+    typeof(funcrs) *fp4 = &func; // error
+
+    typeof(func)   *fq1 = &funcs;
+    typeof(funcs)  *fq2 = &funcs;
+    typeof(funcr)  *fq3 = &funcs;
+    typeof(funcrs) *fq4 = &funcs;
+
+    typeof(func)   *fr1 = &funcr;
+    typeof(funcs)  *fr2 = &funcr; // error
+    typeof(funcr)  *fr3 = &funcr;
+    typeof(funcrs) *fr4 = &funcr;
+
+    typeof(func)   *fs1 = &funcrs;
+    typeof(funcs)  *fs2 = &funcrs; // error
+    typeof(funcr)  *fs3 = &funcrs;
+    typeof(funcrs) *fs4 = &funcrs;
+}
+
+/*************************************************/
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(1801): Error: cannot implicitly convert expression (&c.func) of type int* delegate() to int* delegate() scope
+fail_compilation/retscope.d(1802): Error: cannot implicitly convert expression (&c.func) of type int* delegate() to int* delegate() return scope
+fail_compilation/retscope.d(1803): Error: cannot implicitly convert expression (&c.func) of type int* delegate() to int* delegate() return scope
+fail_compilation/retscope.d(1811): Error: cannot implicitly convert expression (&c.funcr) of type int* delegate() return scope to int* delegate() scope
+fail_compilation/retscope.d(1816): Error: cannot implicitly convert expression (&c.funcrs) of type int* delegate() return scope to int* delegate() scope
+---
+*/
+
+class C18
+{
+    int* func();
+    int* funcs() scope;
+    int* funcr() return;
+    int* funcrs() return scope;
+}
+
+void foo18()
+{
+    C18 c;
+
+#line 1800
+    typeof(&c.func)   fp1 = &c.func;
+    typeof(&c.funcs)  fp2 = &c.func; // error
+    typeof(&c.funcr)  fp3 = &c.func; // error
+    typeof(&c.funcrs) fp4 = &c.func; // error
+
+    typeof(&c.func)   fq1 = &c.funcs;
+    typeof(&c.funcs)  fq2 = &c.funcs;
+    typeof(&c.funcr)  fq3 = &c.funcs;
+    typeof(&c.funcrs) fq4 = &c.funcs;
+
+    typeof(&c.func)   fr1 = &c.funcr;
+    typeof(&c.funcs)  fr2 = &c.funcr; // error
+    typeof(&c.funcr)  fr3 = &c.funcr;
+    typeof(&c.funcrs) fr4 = &c.funcr;
+
+    typeof(&c.func)   fs1 = &c.funcrs;
+    typeof(&c.funcs)  fs2 = &c.funcrs; // error
+    typeof(&c.funcr)  fs3 = &c.funcrs;
+    typeof(&c.funcrs) fs4 = &c.funcrs;
+}
+
+/******************************************/
+/*
+TEST_OUTPUT:
+---
+fail_compilation/retscope.d(1311): Error: scope variable u2 assigned to ek with longer lifetime
+---
+*/
+
+#line 1300
+@safe struct U13 {
+  int* k;
+  int* get() return scope { return k; }
+  static int* sget(return scope ref U13 u) { return u.k; }
+}
+
+@safe void foo13() {
+  int* ek;
+
+  int i;
+  auto u2 = U13(&i);
+  ek = U13.sget(u2); // Error: scope variable u2 assigned to ek with longer lifetime
+
+  auto u1 = U13(new int);
+  ek = u1.get();   // ok
+  ek = U13.sget(u1); // ok
+}
+
+/********************************************/
+
+
+bool foo20(const string a) @safe pure nothrow @nogc
+{
+    return !a.length;
+}
+
+struct Result(R)
+{
+    R source;
+
+    bool empty() // infer 'scope' for 'this'
+    { return foo20(source); }
+}
+
+@safe void test20()
+{
+    scope n = Result!string("abc");
+    n.empty();
+}
+
+/************************************************/
+
+// https://issues.dlang.org/show_bug.cgi?id=17117
+
+ref int foo21(return ref int s)
+{
+        return s;
+}
+
+int fail21()
+{
+        int s;
+        return foo21(s); // Error: escaping reference to local variable s
+}
+
+int test21()
+{
+        int s;
+        s = foo21(s);
+        return s;
+}
+
+/**********************************************/
+
+@safe void foo22()(ref char[] s)
+{
+        char[] a = s;
+}
+
+@safe void test22(scope char[] s)
+{
+        foo22(s);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/skip.d b/gcc/testsuite/gdc.test/fail_compilation/skip.d
new file mode 100644
index 00000000000..c870e7e945a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/skip.d
@@ -0,0 +1,52 @@
+/*
+ * REQUIRED_ARGS: -de
+ * TEST_OUTPUT:
+---
+fail_compilation/skip.d(21): Deprecation: 'switch' skips declaration of 'with' temporary at fail_compilation/skip.d(26)
+fail_compilation/skip.d(43): Deprecation: 'switch' skips declaration of variable skip.test14532.n at fail_compilation/skip.d(45)
+---
+ */
+// https://issues.dlang.org/show_bug.cgi?id=10524
+
+struct S
+{
+    int field;
+}
+
+void test10524()
+{
+    int a = 1;
+    S struct_with_long_name;
+
+    switch( a )
+    {
+        case 0:
+            struct_with_long_name.field = 444; // ok
+            break;
+        with( struct_with_long_name )
+        {
+            case 1:
+                field = 555; // segfault
+                break;
+        }
+
+        default:
+            break;
+    }
+}
+
+// https://issues.dlang.org/show_bug.cgi?id=14532
+
+void test14532()
+{
+    char ch = '!';
+    switch (ch)
+    {
+            int n = 42;
+        case '!':
+            assert(n == 42);
+            break;
+
+      default:
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/spell9644.d b/gcc/testsuite/gdc.test/fail_compilation/spell9644.d
new file mode 100644
index 00000000000..26ec6d37399
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/spell9644.d
@@ -0,0 +1,36 @@
+// REQUIRED_ARGS: -o-
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/spell9644.d(27): Error: undefined identifier 'b'
+fail_compilation/spell9644.d(28): Error: undefined identifier 'xx'
+fail_compilation/spell9644.d(29): Error: undefined identifier 'cb', did you mean variable 'ab'?
+fail_compilation/spell9644.d(30): Error: undefined identifier 'bc', did you mean variable 'abc'?
+fail_compilation/spell9644.d(31): Error: undefined identifier 'ccc'
+fail_compilation/spell9644.d(33): Error: undefined identifier 'cor2', did you mean variable 'cor1'?
+fail_compilation/spell9644.d(34): Error: undefined identifier 'pua', did you mean variable 'pub'?
+fail_compilation/spell9644.d(35): Error: undefined identifier 'priw'
+---
+*/
+
+import imports.spell9644a;
+
+int a;
+int ab;
+int abc;
+int cor1;
+
+int main()
+{
+    cast(void)b; // max distance 0, no match
+    cast(void)xx; // max distance 1, no match
+    cast(void)cb; // max distance 1, match
+    cast(void)bc; // max distance 1, match
+    cast(void)ccc; // max distance 2, match
+
+    cast(void)cor2; // max distance 1, match "cor1", but not cora from import (bug 13736)
+    cast(void)pua;  // max distance 1, match "pub" from import
+    cast(void)priw; // max distance 1, match "priv" from import, but do not report (bug 5839)
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d b/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d
new file mode 100644
index 00000000000..8743bf1993e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d
@@ -0,0 +1,23 @@
+/*
+REQUIRED_ARGS: -m64
+PERMUTE_ARGS:
+---
+fail_compilation/staticarrayoverflow.d(21): Error: static array S[1879048192] size overflowed to 7516192768000
+fail_compilation/staticarrayoverflow.d(21): Error: variable staticarrayoverflow.y size overflow
+fail_compilation/staticarrayoverflow.d(22): Error: variable staticarrayoverflow.z size of x1000ae0 exceeds max allowed size 0x100_0000
+fail_compilation/staticarrayoverflow.d(23): Error: static array S[8070450532247928832] size overflowed to 0
+fail_compilation/staticarrayoverflow.d(23): Error: variable staticarrayoverflow.a size overflow
+---
+*/
+
+
+
+struct S
+{
+    int[1000] x;
+}
+
+S[0x7000_0000] y;
+S[0x100_0000/(4*1000 - 1)] z;
+S[0x7000_0000_0000_0000] a;
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test1.d b/gcc/testsuite/gdc.test/fail_compilation/test1.d
new file mode 100644
index 00000000000..9dae856c349
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test1.d
@@ -0,0 +1 @@
+fail
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test11047.d b/gcc/testsuite/gdc.test/fail_compilation/test11047.d
new file mode 100644
index 00000000000..ef8007d434b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test11047.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test11047.d(11): Error: value of x is not known at compile time
+fail_compilation/test11047.d(11): Error: value of x is not known at compile time
+---
+*/
+// https://issues.dlang.org/show_bug.cgi?id=11047
+
+int x;
+@(++x, ++x) void foo(){}
+
+@safe pure void test()
+{
+    __traits(getAttributes, foo);
+    __traits(getAttributes, foo)[0];
+}
+
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test12822.d b/gcc/testsuite/gdc.test/fail_compilation/test12822.d
new file mode 100644
index 00000000000..fe710981fe3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test12822.d
@@ -0,0 +1,17 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test12822.d(13): Error: cannot modify delegate pointer in @safe code dg.ptr
+fail_compilation/test12822.d(14): Error: dg.funcptr cannot be used in @safe code
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=12822
+void test2(int delegate() dg) @safe
+{
+    static int i;
+    dg.ptr = &i;
+    dg.funcptr = &func;
+}
+
+int func();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test12979.d b/gcc/testsuite/gdc.test/fail_compilation/test12979.d
new file mode 100644
index 00000000000..9bf5cf40a7e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test12979.d
@@ -0,0 +1,16 @@
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test12979.d(13): Error: const/immutable/shared/inout attributes are not allowed on asm blocks
+---
+*/
+
+void foo()
+{
+    asm const shared
+    {
+        ret;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test13152.d b/gcc/testsuite/gdc.test/fail_compilation/test13152.d
new file mode 100644
index 00000000000..531c9e9411b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test13152.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test13152.d(11): Error: undefined identifier 'x'
+---
+*/
+import imports.test13152a;
+
+void main()
+{
+    auto y = x;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test13536.d b/gcc/testsuite/gdc.test/fail_compilation/test13536.d
new file mode 100644
index 00000000000..be7898b59fa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test13536.d
@@ -0,0 +1,26 @@
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test13536.d(23): Error: field U.sysDg cannot access pointers in @safe code that overlap other fields
+fail_compilation/test13536.d(24): Error: field U.safeDg cannot access pointers in @safe code that overlap other fields
+---
+*/
+
+
+// https://issues.dlang.org/show_bug.cgi?id=13536
+
+struct S {
+    void sysMethod() @system {}
+}
+void fun() @safe {
+    union U {
+        void delegate() @system sysDg;
+        void delegate() @safe safeDg;
+    }
+    U u;
+    S s;
+    u.sysDg = &s.sysMethod;
+    u.safeDg();
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test13537.d b/gcc/testsuite/gdc.test/fail_compilation/test13537.d
new file mode 100644
index 00000000000..4da91fe76a6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test13537.d
@@ -0,0 +1,61 @@
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test13537.d(32): Error: field U.y cannot modify fields in @safe code that overlap fields with other storage classes
+fail_compilation/test13537.d(33): Error: field U.y cannot modify fields in @safe code that overlap fields with other storage classes
+fail_compilation/test13537.d(34): Error: field U.z cannot access pointers in @safe code that overlap other fields
+fail_compilation/test13537.d(35): Error: field U.y cannot modify fields in @safe code that overlap fields with other storage classes
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=13537
+
+union U
+{
+    immutable int x;
+    int y;
+    int* z;
+}
+
+union V
+{
+    immutable int x;
+    const int y;
+}
+
+void fun() @safe
+{
+    U u;
+
+    // errors
+    u.y = 1;
+    int* p = &u.y;
+    int** q = &u.z;
+    abc(u.y);
+
+    // read access is allowed
+    int a = u.x;
+    a = u.y;
+    def(u.y);
+
+    // Overlapping const/immutable is allowed
+    auto v = V(1);
+    assert(v.y == 1);
+}
+
+void gun() @system
+{
+    U u;
+
+    // allowed because system code
+    u.y = 1;
+    int* p = &u.y;
+    int** q = &u.z;
+    abc(u.y);
+}
+
+@safe:
+void abc(ref int x) { }
+void def(const ref int x) { }
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test13786.d b/gcc/testsuite/gdc.test/fail_compilation/test13786.d
new file mode 100644
index 00000000000..3b05dcc40dc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test13786.d
@@ -0,0 +1,20 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test13786.d(14): Error: debug 123 level declaration must be at module level
+fail_compilation/test13786.d(15): Error: debug abc declaration must be at module level
+fail_compilation/test13786.d(16): Error: version 123 level declaration must be at module level
+fail_compilation/test13786.d(17): Error: version abc declaration must be at module level
+fail_compilation/test13786.d(20): Error: template instance test13786.T!() error instantiating
+---
+*/
+
+template T()
+{
+    debug = 123;
+    debug = abc;
+    version = 123;
+    version = abc;
+}
+
+alias X = T!();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test13867.d b/gcc/testsuite/gdc.test/fail_compilation/test13867.d
new file mode 100644
index 00000000000..aebab2badf9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test13867.d
@@ -0,0 +1,40 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test13867.d(12): Error: function test13867.X.blah does not override any function, did you mean to override 'extern (C++) test13867.Base.blah'?
+fail_compilation/test13867.d(19): Error: function test13867.Z.blah does not override any function, did you mean to override 'extern (C++) test13867.Base.blah'?
+---
+*/
+extern (C++) class Base {
+    void blah() {}
+}
+class X : Base {
+    override void blah();//Error
+}
+extern (C++) class Y : Base {
+    override void blah(){}
+}
+class Z : Base {
+    alias blah = super.blah;
+    override void blah(){}//Error
+}
+class O : Base {
+    extern (C++) override void blah(){}
+}
+extern (C++) class OK : Base {
+    alias blah = super.blah;
+    override void blah(){}
+}
+
+void main() {
+    scope b = new Base();
+    b.blah();
+    scope x = new X();
+    x.blah();
+    scope y = new Y();
+    y.blah();
+    scope o = new O();
+    o.blah();
+    scope z = new Z();
+    z.blah();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test14238.d b/gcc/testsuite/gdc.test/fail_compilation/test14238.d
new file mode 100644
index 00000000000..dd096f32895
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test14238.d
@@ -0,0 +1,30 @@
+/* REQUIRED_ARGS: -dip25 -transition=safe
+   PERMUTE_ARGS:
+   TEST_OUTPUT:
+---
+fail_compilation/test14238.d(21): Error: scope variable fn may not be returned
+fail_compilation/test14238.d(29): Error: escaping reference to stack allocated value returned by &baz
+---
+*/
+// https://issues.dlang.org/show_bug.cgi?id=14238
+
+@safe:
+
+alias Fn = ref int delegate() return;
+
+ref int foo(return scope Fn fn)
+{
+    return fn(); // Ok
+}
+
+ref int foo2(scope Fn fn) {
+    return fn(); // Error
+}
+
+ref int bar() {
+    int x;
+    ref int baz() {
+            return x;
+    }
+    return foo(&baz);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test143.d b/gcc/testsuite/gdc.test/fail_compilation/test143.d
new file mode 100644
index 00000000000..94f614a9126
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test143.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -de
+module test143; // Bugzilla 143
+
+import imports.test143;
+
+void bar(int)
+{
+}
+
+void foo()
+{
+    bar(x);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test14496.d b/gcc/testsuite/gdc.test/fail_compilation/test14496.d
new file mode 100644
index 00000000000..6c3038555dd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test14496.d
@@ -0,0 +1,50 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test14496.d(21): Error: variable test14496.foo.f void initializers for pointers not allowed in safe functions
+fail_compilation/test14496.d(24): Error: variable test14496.foo.Bar.foo void initializers for pointers not allowed in safe functions
+fail_compilation/test14496.d(28): Error: variable test14496.foo.Baz.x void initializers for pointers not allowed in safe functions
+fail_compilation/test14496.d(48): Error: variable test14496.sinister.bar void initializers for pointers not allowed in safe functions
+fail_compilation/test14496.d(49): Error: variable test14496.sinister.baz void initializers for pointers not allowed in safe functions
+---
+*/
+// https://issues.dlang.org/show_bug.cgi?id=14496
+
+@safe void foo()
+{
+    struct Foo {
+        int* indirection1;
+        Object indirection2;
+        string[] indirection3;
+    }
+
+    Foo f = void;
+
+    struct Bar {
+        Foo foo = void;
+    }
+
+    struct Baz {
+        int* x = void;
+    }
+}
+
+
+struct Foo {
+    int* indirection1;
+    Object indirection2;
+    string[] indirection3;
+}
+
+struct Bar {
+    Foo foo = void;
+}
+
+struct Baz {
+    int* x = void;
+}
+
+@safe void sinister() {
+    Bar bar;
+    Baz baz;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test14538.d b/gcc/testsuite/gdc.test/fail_compilation/test14538.d
new file mode 100644
index 00000000000..d810a890ef4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test14538.d
@@ -0,0 +1,20 @@
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test14538.d(19): Error: cannot implicitly convert expression (x ? cast(uint)this.fCells[x].code : 32u) of type uint to Cell
+---
+*/
+
+struct Cell
+{
+    dchar code;
+    alias code this;
+}
+
+struct Row
+{
+    Cell[] fCells;
+    Cell opIndex(size_t x) { return x ? fCells[x] : ' '; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15191.d b/gcc/testsuite/gdc.test/fail_compilation/test15191.d
new file mode 100644
index 00000000000..55b09b799f2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test15191.d
@@ -0,0 +1,18 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/test15191.d(17): Error: cannot take address of ref return of foo() in @safe function bar
+---
+*/
+
+
+// https://issues.dlang.org/show_bug.cgi?id=15191
+
+ref int foo(return ref int s)@safe
+{
+    return s;
+}
+
+int* bar(return ref int s) @safe
+{
+    return &foo(s);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15399.d b/gcc/testsuite/gdc.test/fail_compilation/test15399.d
new file mode 100644
index 00000000000..8aecfdee6dc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test15399.d
@@ -0,0 +1,46 @@
+/* https://issues.dlang.org/show_bug.cgi?id=15399
+---
+fail_compilation/test15399.d(31): Error: writing to misaligned pointer in field S1.ptr is not @safe
+fail_compilation/test15399.d(32): Error: writing to misaligned pointer in field S2.ptr is not @safe
+fail_compilation/test15399.d(33): Error: taking address of misaligned pointer in field S1.ptr is not @safe
+fail_compilation/test15399.d(34): Error: taking address of misaligned pointer in field S2.ptr is not @safe
+fail_compilation/test15399.d(35): Error: 'ref' of misaligned pointer in field S1.ptr is not @safe
+fail_compilation/test15399.d(36): Error: 'ref' of misaligned pointer in field S2.ptr is not @safe
+fail_compilation/test15399.d(37): Error: 'out' of misaligned pointer in field S1.ptr is not @safe
+fail_compilation/test15399.d(38): Error: 'out' of misaligned pointer in field S2.ptr is not @safe
+---
+*/
+
+struct S1
+{
+        char c;
+    align (1)
+        int* ptr;
+}
+
+align (1)
+struct S2
+{
+    int* ptr;
+}
+
+@safe void test(S1* s1, S2* s2)
+{
+    int* p = s1.ptr;
+    p = s2.ptr;
+    s1.ptr = null;
+    s2.ptr = null;
+    int** pp = &s1.ptr;
+    pp = &s2.ptr;
+    bar(s1.ptr);
+    bar(s2.ptr);
+    sinister(s1.ptr);
+    sinister(s2.ptr);
+    cbar(s1.ptr);
+    cbar(s2.ptr);
+}
+
+@safe void bar(ref int*);
+@safe void cbar(ref const int*);
+@safe void sinister(out int*);
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15544.d b/gcc/testsuite/gdc.test/fail_compilation/test15544.d
new file mode 100644
index 00000000000..ef38a9c480b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test15544.d
@@ -0,0 +1,51 @@
+/*
+REQUIRED_ARGS: -dip1000
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/test15544.d(21): Error: reference to local this assigned to non-scope _del in @safe code
+fail_compilation/test15544.d(23): Error: reference to local this assigned to non-scope _del in @safe code
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=15544
+
+void delegate() @safe _del;
+
+struct S {
+    int x = 42;
+
+    @safe void test()
+    {
+        void foo() { assert(x == 42); }
+        _del = &foo;
+
+        _del = { assert(x == 42); };
+    }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test15544.d(47): Error: reference to local y assigned to non-scope dg in @safe code
+---
+*/
+
+int delegate() dg;
+
+void testClosure1()
+{
+    int* x;
+    int bar() { return *x; }
+    dg = &bar;
+}
+
+@safe void testClosure2()
+{
+    scope int* y;
+    int bar() { return *y; }
+    dg = &bar;               // Error
+    auto dg2 = &bar;
+}
+
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15703.d b/gcc/testsuite/gdc.test/fail_compilation/test15703.d
new file mode 100644
index 00000000000..1dfe762c214
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test15703.d
@@ -0,0 +1,31 @@
+/*
+REQUIRED_ARGS: -m32
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/test15703.d(17): Error: cast from Object[] to uint[] not allowed in safe code
+fail_compilation/test15703.d(19): Error: cast from object.Object to const(uint)* not allowed in safe code
+fail_compilation/test15703.d(22): Error: cast from uint[] to Object[] not allowed in safe code
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=15703
+
+void test() @safe
+{
+     auto objs = [ new Object() ];
+     auto longs = cast(size_t[]) objs;          // error
+     auto longc = cast(const(size_t)[]) objs;   // ok
+     auto longp = cast(const(size_t)*) objs[0]; // error
+
+     size_t[] al;
+     objs = cast(Object[]) al;                  // error
+
+     auto am = cast(int[])[];
+}
+
+void test2() @safe
+{
+    const(ubyte)[] a;
+    auto b = cast(const(uint[])) a;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15785.d b/gcc/testsuite/gdc.test/fail_compilation/test15785.d
new file mode 100644
index 00000000000..33fda200860
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test15785.d
@@ -0,0 +1,20 @@
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test15785.d(17): Deprecation: imports.test15785.Base.foo is not visible from module test15785
+fail_compilation/test15785.d(17): Error: class test15785.Derived member foo is not accessible
+fail_compilation/test15785.d(18): Deprecation: imports.test15785.Base.bar is not visible from module test15785
+fail_compilation/test15785.d(18): Error: class test15785.Derived member bar is not accessible
+---
+*/
+import imports.test15785;
+
+class Derived : Base
+{
+    void test()
+    {
+        super.foo();
+        bar();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15785b.d b/gcc/testsuite/gdc.test/fail_compilation/test15785b.d
new file mode 100644
index 00000000000..1613617bcd0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test15785b.d
@@ -0,0 +1,18 @@
+// REQUIRED_ARGS: -de
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test15785b.d(15): Deprecation: imports.test15785.Base.T is not visible from module test15785b
+fail_compilation/test15785b.d(16): Deprecation: imports.test15785.Base.T is not visible from module test15785b
+fail_compilation/test15785b.d(17): Deprecation: imports.test15785.IBase2.T is not visible from module test15785b
+---
+*/
+import imports.test15785;
+
+class Derived : Base, IBase2
+{
+    super.T t;
+    Base.T t2;
+    IBase2.T t3;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15897.d b/gcc/testsuite/gdc.test/fail_compilation/test15897.d
new file mode 100644
index 00000000000..19c65b46419
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test15897.d
@@ -0,0 +1,19 @@
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test15897.d(18): Deprecation: test15897.Animal.create is not visible from class Cat
+---
+*/
+module test15897;
+import imports.test15897;
+
+class Animal
+{
+    private void create() {}
+}
+
+void foo(Cat cat)
+{
+    cat.create();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15989.d b/gcc/testsuite/gdc.test/fail_compilation/test15989.d
new file mode 100644
index 00000000000..29eab9c38cb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test15989.d
@@ -0,0 +1,52 @@
+/*
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/test15989.d(40): Error: variable test15989.main.ctRegex : Unable to initialize enum with class or pointer to struct. Use static const variable instead.
+fail_compilation/test15989.d(49): Error: variable test15989.test.c : Unable to initialize enum with class or pointer to struct. Use static const variable instead.
+fail_compilation/test15989.d(50): Error: cannot use non-constant CTFE pointer in an initializer '&[3][0]'
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=15989
+
+import core.stdc.stdio;
+
+interface Kickstart{
+    bool foo( int );
+}
+
+class ShiftOr : Kickstart
+{
+    bool foo( int i )
+    {
+        printf("i = %d\n", i);
+        return false;
+    }
+}
+
+struct Regex
+{
+    Kickstart kickstart;
+}
+
+Regex regex()
+{
+    return Regex(new ShiftOr());
+}
+
+void main()
+{
+    enum ctRegex = regex();
+    Regex r = ctRegex;
+    r.kickstart.foo(7);
+}
+
+class C { }
+
+void test()
+{
+    enum c = new C();
+    enum pi = new int(3);
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16116.d b/gcc/testsuite/gdc.test/fail_compilation/test16116.d
new file mode 100644
index 00000000000..be6e7868960
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16116.d
@@ -0,0 +1,16 @@
+/*
+REQUIRED_ARGS: -m64
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/test16116.d(15): Error: incompatible types for ((v) * (i)): '__vector(short[8])' and 'int'
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=16116
+
+void foo() {
+    __vector(short[8]) v;
+    int i;
+    v = v * i;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16188.d b/gcc/testsuite/gdc.test/fail_compilation/test16188.d
new file mode 100644
index 00000000000..ffdb41ac467
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16188.d
@@ -0,0 +1,25 @@
+/* PERMUTE_ARGS:
+ */
+
+// https://issues.dlang.org/show_bug.cgi?id=16188
+
+/* This produces the message:
+ *   Error: no property 'name' for type 'Where'
+ * when the actual error is 'getMember is undefined'.
+ * This happens because errors are gagged when opDispatch() is compiled,
+ * I don't understand why.
+ */
+
+void where() { Where().name; }
+
+struct Where
+{
+    void opDispatch(string name)()
+    {
+        alias FieldType = typeof(getMember);
+        WhereField!FieldType;
+    }
+}
+
+struct WhereField(FieldType) {}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16193.d b/gcc/testsuite/gdc.test/fail_compilation/test16193.d
new file mode 100644
index 00000000000..de65e8a871c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16193.d
@@ -0,0 +1,45 @@
+/*
+REQUIRED_ARGS: -dip1000
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/test16193.d(39): Error: function test16193.abc is @nogc yet allocates closures with the GC
+fail_compilation/test16193.d(41):        test16193.abc.__foreachbody1 closes over variable x at fail_compilation/test16193.d(40)
+---
+*/
+//fail_compilation/test16193.d(22): To enforce @safe compiler allocates a closure unless the opApply() uses 'scope'
+//fail_compilation/test16193.d(34): To enforce @safe compiler allocates a closure unless the opApply() uses 'scope'
+//fail_compilation/test16193.d(41): To enforce @safe compiler allocates a closure unless the opApply() uses 'scope'
+
+// https://issues.dlang.org/show_bug.cgi?id=16193
+
+struct S {
+    int opApply(int delegate(int) dg) @nogc;
+}
+
+void foo() {
+    int x = 0;
+    foreach(i; S.init) {
+        x++;
+    }
+}
+
+struct T {
+    int opApply(scope int delegate(int) dg) @nogc;
+}
+
+
+void bar() @nogc {
+    int x = 0;
+    foreach(i; T.init) {
+        x++;
+    }
+}
+
+void abc() @nogc {
+    int x = 0;
+    foreach(i; S.init) {
+        x++;
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16195.d b/gcc/testsuite/gdc.test/fail_compilation/test16195.d
new file mode 100644
index 00000000000..704974ca30a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16195.d
@@ -0,0 +1,14 @@
+/*
+ * TEST_OUTPUT:
+---
+fail_compilation/test16195.d(13): Error: delete p is not @safe but is used in @safe function test
+---
+ */
+
+
+// https://issues.dlang.org/show_bug.cgi?id=16195
+
+@safe pure nothrow @nogc void test(int* p)
+{
+    delete p;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16228.d b/gcc/testsuite/gdc.test/fail_compilation/test16228.d
new file mode 100644
index 00000000000..6aa79a2db42
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16228.d
@@ -0,0 +1,24 @@
+/* REQUIRED_ARGS: -dip25
+   TEST_OUTPUT:
+---
+fail_compilation/test16228.d(22): Error: function type 'return int()' has 'return' but does not return any indirections
+fail_compilation/test16228.d(23): Error: function test16228.S.foo static member has no 'this' to which 'return' can apply
+---
+*/
+
+
+
+// https://issues.dlang.org/show_bug.cgi?id=16228
+
+int* wrap ( return ref int input )
+{
+    return &input;
+}
+
+struct S
+{
+    int x;
+
+    int foo() return { return 3; }
+    static ref int foo() return { return x; }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16365.d b/gcc/testsuite/gdc.test/fail_compilation/test16365.d
new file mode 100644
index 00000000000..860e3e79ba7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16365.d
@@ -0,0 +1,29 @@
+/* REQUIRED_ARGS:
+   PERMUTE_ARGS:
+   TEST_OUTPUT:
+---
+fail_compilation/test16365.d(21): Error: 'this' reference necessary to take address of member f1 in @safe function main
+fail_compilation/test16365.d(23): Error: cannot implicitly convert expression (&f2) of type void delegate() pure nothrow @nogc @safe to void function() @safe
+fail_compilation/test16365.d(28): Error: dg.funcptr cannot be used in @safe code
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=16365
+
+struct S
+{
+    void f1() @safe { }
+}
+
+void main() @safe
+{
+    void function() @safe f;
+    f = &S.f1;
+    void f2() @safe { }
+    f = &f2;
+
+    void delegate() @safe dg;
+    S s;
+    dg = &s.f1;
+    f = dg.funcptr;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16381.d b/gcc/testsuite/gdc.test/fail_compilation/test16381.d
new file mode 100644
index 00000000000..ed591bd31dc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16381.d
@@ -0,0 +1,18 @@
+/*
+REQUIRED_ARGS: -m64
+PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/test16381.d(16): Error: foo() is not an lvalue
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=16381
+
+__vector(float[4]) foo();
+
+void bar()
+{
+    float g = foo().ptr[0];
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16523.d b/gcc/testsuite/gdc.test/fail_compilation/test16523.d
new file mode 100644
index 00000000000..e5de7c19cb1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16523.d
@@ -0,0 +1,16 @@
+// REQUIRED_ARGS: -de
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test16523.d(13): Deprecation: case variables have to be const or immutable
+---
+*/
+
+void test(int a, int b)
+{
+    switch (a)
+    {
+    case b: return;
+    default: assert(0);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16572.d b/gcc/testsuite/gdc.test/fail_compilation/test16572.d
new file mode 100644
index 00000000000..19b5bf1c2d1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16572.d
@@ -0,0 +1,38 @@
+/*
+ * TEST_OUTPUT:
+---
+fail_compilation/test15672.d(15): Error: cast from void[] to byte[] not allowed in safe code
+fail_compilation/test15672.d(25): Error: cast from void* to byte* not allowed in safe code
+---
+*/
+// https://issues.dlang.org/show_bug.cgi?id=15672
+
+alias byte T;
+alias const(byte) CT;
+
+@safe T[] test1(void[] a)
+{
+    return cast(T[])a;
+}
+
+@safe CT[] test2(void[] a)
+{
+    return cast(CT[])a;
+}
+
+@safe T* test3(void* a)
+{
+    return cast(T*)a;
+}
+
+@safe CT* test4(void* a)
+{
+    return cast(CT*)a;
+}
+
+@safe T[] test5()
+{
+    return cast(T[])[];
+}
+
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16589.d b/gcc/testsuite/gdc.test/fail_compilation/test16589.d
new file mode 100644
index 00000000000..a229177fceb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test16589.d
@@ -0,0 +1,64 @@
+// REQUIRED_ARGS: -transition=safe
+/* PERMUTE_ARGS:
+TEST_OUTPUT:
+---
+fail_compilation/test16589.d(26): Error: cannot take address of parameter this in @safe function access1
+fail_compilation/test16589.d(31): Error: cannot take address of parameter this in @safe function access2
+fail_compilation/test16589.d(37): Error: cannot take address of parameter s in @safe function access3
+fail_compilation/test16589.d(42): Error: cannot take address of parameter s in @safe function access4
+fail_compilation/test16589.d(47): Error: cannot take address of parameter s in @safe function access5
+fail_compilation/test16589.d(52): Error: cannot take address of parameter s in @safe function access6
+---
+*/
+
+
+
+
+
+// https://issues.dlang.org/show_bug.cgi?id=16589
+
+struct S
+{
+    int data;
+
+    @safe int* access1()
+    {
+        return &data;
+    }
+
+    @safe S* access2()
+    {
+        return &this;
+    }
+}
+
+@safe int* access3(ref S s)
+{
+    return &s.data;
+}
+
+@safe S* access4(ref S s)
+{
+    return &s;
+}
+
+@safe int* access5(S s)
+{
+    return &s.data;
+}
+
+@safe S* access6(S s)
+{
+    return &s;
+}
+
+class C
+{
+    int data;
+
+    @safe int* access7()
+    {
+        return &data;
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17425.d b/gcc/testsuite/gdc.test/fail_compilation/test17425.d
new file mode 100644
index 00000000000..f7628b83e22
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test17425.d
@@ -0,0 +1,32 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/test17425.d(24): Error: parameter index must be in range 0..4 not 4
+fail_compilation/test17425.d(27): Error: first argument to `__traits(getParameterStorageClasses, i, 4)` is not a function
+fail_compilation/test17425.d(29): Error: expression expected as second argument of `__traits(getParameterStorageClasses, foo, int)`
+fail_compilation/test17425.d(31): Error: expected 2 arguments for `getParameterStorageClasses` but had 3
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=17425
+
+ref int foo(return ref const int* p, scope int* a, out int b, lazy int c);
+
+//pragma(msg, __traits(getParameterStorageClasses, foo, 0));
+
+static assert(__traits(getParameterStorageClasses, foo, 0)[0] == "return");
+static assert(__traits(getParameterStorageClasses, foo, 0)[1] == "ref");
+
+//pragma(msg, __traits(getParameterStorageClasses, foo, 1));
+static assert(__traits(getParameterStorageClasses, foo, 1)[0] == "scope");
+static assert(__traits(getParameterStorageClasses, foo, 2)[0] == "out");
+static assert(__traits(getParameterStorageClasses, typeof(&foo), 3)[0] == "lazy");
+
+enum a1 = __traits(getParameterStorageClasses, foo, 4);
+
+int i;
+enum a2 = __traits(getParameterStorageClasses, i, 4);
+
+enum a3 = __traits(getParameterStorageClasses, foo, int);
+
+enum a4 = __traits(getParameterStorageClasses, foo, 0, 1);
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17451.d b/gcc/testsuite/gdc.test/fail_compilation/test17451.d
new file mode 100644
index 00000000000..fc2f2d22c76
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test17451.d
@@ -0,0 +1,45 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/test17451.d(22): Error: undefined identifier `allocator`
+fail_compilation/test17451.d(23): Error: `long` has no effect in expression `false`
+fail_compilation/test17451.d(30): Error: variable test17451.HashMap!(ThreadSlot).HashMap.__lambda2.v size of type ThreadSlot is invalid
+fail_compilation/test17451.d(44): Error: template instance test17451.HashMap!(ThreadSlot) error instantiating
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=17451
+
+interface ManualEvent {}
+
+interface EventDriver {
+        ManualEvent createManualEvent() ;
+}
+
+struct ArraySet(Key)
+{
+        ~this()
+    {
+                try allocator;
+                catch false; // should never happen
+        }
+}
+
+struct HashMap(TValue)
+{
+        alias Value = TValue;
+        static if ({ Value v; }) {}
+}
+
+struct Task {}
+
+class Libevent2Driver : EventDriver {
+        Libevent2ManualEvent createManualEvent() {}
+}
+
+struct ThreadSlot {
+        ArraySet!Task tasks;
+}
+
+class Libevent2ManualEvent {
+        HashMap!ThreadSlot m_waiters;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test314.d b/gcc/testsuite/gdc.test/fail_compilation/test314.d
new file mode 100644
index 00000000000..3dea03fa6b4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test314.d
@@ -0,0 +1,24 @@
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/test314.d(19): Deprecation: imports.a314.renamed is not visible from module test314
+fail_compilation/test314.d(20): Deprecation: imports.a314.bug is not visible from module test314
+fail_compilation/test314.d(22): Deprecation: imports.b314.renamedpkg is not visible from module test314
+fail_compilation/test314.d(23): Deprecation: imports.b314.bugpkg is not visible from module test314
+---
+*/
+
+module test314;
+
+import imports.a314;
+import imports.b314;
+
+void main()
+{
+    renamed.bug("This should not work.\n");
+    bug("This should not work.\n");
+
+    renamedpkg.bug("This should not work.\n");
+    bugpkg("This should not work.\n");
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test4682.d b/gcc/testsuite/gdc.test/fail_compilation/test4682.d
new file mode 100644
index 00000000000..402e3f8ae56
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test4682.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+----
+fail_compilation/test4682.d(10): Error: integer overflow: int.min / -1
+fail_compilation/test4682.d(11): Error: integer overflow: long.min / -1
+fail_compilation/test4682.d(12): Error: integer overflow: int.min % -1
+fail_compilation/test4682.d(13): Error: integer overflow: long.min % -1
+----
+*/
+auto a = int.min / -1;
+auto b = long.min / -1;
+auto c = int.min % -1;
+auto d = long.min % -1;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test4682a.d b/gcc/testsuite/gdc.test/fail_compilation/test4682a.d
new file mode 100644
index 00000000000..40446869bd9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test4682a.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+----
+fail_compilation/test4682a.d(10): Error: divide by 0
+fail_compilation/test4682a.d(11): Error: divide by 0
+fail_compilation/test4682a.d(12): Error: divide by 0
+fail_compilation/test4682a.d(13): Error: divide by 0
+----
+*/
+auto a = int.min / 0;
+auto b = long.min / 0;
+auto c = int.min % 0;
+auto d = long.min % 0;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test4838.d b/gcc/testsuite/gdc.test/fail_compilation/test4838.d
new file mode 100644
index 00000000000..0bf075737e5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test4838.d
@@ -0,0 +1,18 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test4838.d(13): Error: const/immutable/shared/inout/return attributes are only valid for non-static member functions
+fail_compilation/test4838.d(14): Error: const/immutable/shared/inout/return attributes are only valid for non-static member functions
+fail_compilation/test4838.d(15): Error: const/immutable/shared/inout/return attributes are only valid for non-static member functions
+fail_compilation/test4838.d(16): Error: const/immutable/shared/inout/return attributes are only valid for non-static member functions
+fail_compilation/test4838.d(17): Error: const/immutable/shared/inout/return attributes are only valid for non-static member functions
+fail_compilation/test4838.d(18): Error: const/immutable/shared/inout/return attributes are only valid for non-static member functions
+---
+*/
+
+void function() const fpc;
+void function() immutable fpi;
+void function() shared fps;
+void function() shared const fpsc;
+void function() inout fpw;
+void function() shared inout fpsw;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test5412a.d b/gcc/testsuite/gdc.test/fail_compilation/test5412a.d
new file mode 100644
index 00000000000..412cb214d6c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test5412a.d
@@ -0,0 +1,4 @@
+module test5412a;
+
+import A = imports.test5412a;
+import A = imports.test5412b;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test5412b.d b/gcc/testsuite/gdc.test/fail_compilation/test5412b.d
new file mode 100644
index 00000000000..846fdd3f00e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test5412b.d
@@ -0,0 +1,4 @@
+module test5412b;
+
+import A = imports.test5412a;
+static import A = imports.test5412b;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test5412c.d b/gcc/testsuite/gdc.test/fail_compilation/test5412c.d
new file mode 100644
index 00000000000..88290f66d49
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test5412c.d
@@ -0,0 +1,4 @@
+module test5412c;
+
+import test5412c2 = imports.test5412a;
+import test5412c2;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test64.d b/gcc/testsuite/gdc.test/fail_compilation/test64.d
new file mode 100644
index 00000000000..bfc63f29f12
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test64.d
@@ -0,0 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/test64a.d(1): Error: module imports from file fail_compilation/imports/test64a.d conflicts with package name imports
+---
+*/
+
+// PERMUTE_ARGS:
+
+//import std.stdio;
+
+import imports.test64a;
+
+int main(string[] args)
+{
+    //writefln(file1);
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test6883.d b/gcc/testsuite/gdc.test/fail_compilation/test6883.d
new file mode 100644
index 00000000000..131d70bf5aa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test6883.d
@@ -0,0 +1,25 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test6883.d(15): Error: array index 5 is out of bounds x[0 .. 5]
+fail_compilation/test6883.d(17): Error: array index 7 is out of bounds x[0 .. 5]
+fail_compilation/test6883.d(21): Error: array index 5 is out of bounds x[0 .. 5]
+fail_compilation/test6883.d(23): Error: array index 7 is out of bounds x[0 .. 5]
+---
+*/
+
+void main()
+{
+    {
+        int[5] x;
+        x[x.length] = 1;
+        enum size_t n = 2;
+        x[x.length + n] = 2;
+    }
+    {
+        int[5] x;
+        x[$] = 1;
+        enum size_t n = 2;
+        x[$ + n] = 2;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test8509.d b/gcc/testsuite/gdc.test/fail_compilation/test8509.d
new file mode 100644
index 00000000000..121ae9e2814
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test8509.d
@@ -0,0 +1,8 @@
+module test8509;
+enum E : string { a = "hello", b = "world" }
+
+void main()
+{
+    E e1 = E.a ~ " world";
+    E e2 = "hello " ~ E.b;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test8556.d b/gcc/testsuite/gdc.test/fail_compilation/test8556.d
new file mode 100644
index 00000000000..34900412e5b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test8556.d
@@ -0,0 +1,56 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test8556.d(21): Error: template instance test8556.Grab!(Circle!(uint[])) does not match template declaration Grab(Range) if (!isSliceable!Range)
+fail_compilation/test8556.d(52): Error: template instance test8556.grab!(Circle!(uint[])) error instantiating
+---
+*/
+
+extern(C) int printf(const char*, ...);
+
+template isSliceable(R)
+{
+    enum bool isSliceable = is(typeof( R.init[1 .. 2] ));
+}
+
+struct Grab(Range) if (!isSliceable!Range)
+{
+    public Range source;
+}
+
+Grab!R grab(R)(R input)
+{
+    return Grab!R(input);
+}
+
+// 3. evaluate isSliceable in template constraint
+auto grabExactly(R)(R range) if (!isSliceable!R) { return 0; }
+auto grabExactly(R)(R range) if ( isSliceable!R) { return 0; }
+
+struct Circle(Range)
+{
+    // 2. auto return opSlice
+    auto opSlice(size_t i, size_t j)
+    {
+        //pragma(msg, typeof(opSlice)); // prints "fwdref err" with B, but doesn't with A
+
+        printf("%d %d\n", i, j);
+        assert(j >= i);
+
+        // 1. grabExactly curcular refers this opSlice.
+        return grabExactly(typeof(this)());     // broken execution with A
+    }
+}
+
+Circle!R circle(R)()
+{
+    return Circle!R();
+}
+
+void main()
+{
+    auto t = grab(circle!(uint[])());
+
+    auto cx = circle!(uint[])();
+    auto slice = cx[23 .. 33];
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test8751.d b/gcc/testsuite/gdc.test/fail_compilation/test8751.d
new file mode 100644
index 00000000000..f739a5a9c1f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test8751.d
@@ -0,0 +1,3 @@
+Bar foo3(ref const int x) pure {
+    return y => x > y; // error
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test9150.d b/gcc/testsuite/gdc.test/fail_compilation/test9150.d
new file mode 100644
index 00000000000..650bcd48bfc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test9150.d
@@ -0,0 +1,21 @@
+// Issue 9150 - Mismatching static array length should be detected in foreach
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test9150.d(14): Error: mismatched array lengths, 5 and 3
+---
+*/
+
+void main()
+{
+    int[3][2] matrix = [ [1,11,111], [2,22,222] ];
+
+    foreach (int[5] row; matrix) //if int[3], there is no error.
+    {
+        foreach (x; row)
+        {}//write(x, "  ");
+
+        //writeln();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test9176.d b/gcc/testsuite/gdc.test/fail_compilation/test9176.d
new file mode 100644
index 00000000000..f1e876fea8d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test9176.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/test9176.d(14): Error: forward reference to inferred return type of function call 'get()'
+fail_compilation/test9176.d(10):        while evaluating: static assert(!false)
+---
+*/
+
+void foo(int x) {}
+static assert(!is(typeof(foo(S()))));
+
+struct S {
+    auto get() { return get(); }
+    alias get this;
+}
+void main(){}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/testCols.d b/gcc/testsuite/gdc.test/fail_compilation/testCols.d
new file mode 100644
index 00000000000..59ea2ddd516
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/testCols.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -vcolumns
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/testCols.d(13,5): Error: undefined identifier 'nonexistent'
+---
+*/
+
+void test()
+{
+    nonexistent();
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/testInference.d b/gcc/testsuite/gdc.test/fail_compilation/testInference.d
new file mode 100644
index 00000000000..57d2d3012f5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/testInference.d
@@ -0,0 +1,207 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/testInference.d(24): Error: cannot implicitly convert expression (this.a) of type inout(A8998) to immutable(A8998)
+---
+*/
+
+class A8998
+{
+    int i;
+}
+class C8998
+{
+    A8998 a;
+
+    this()
+    {
+        a = new A8998();
+    }
+
+    // WRONG: Returns immutable(A8998)
+    immutable(A8998) get() inout pure
+    {
+        return a;   // should be error
+    }
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/testInference.d(39): Error: cannot implicitly convert expression (s) of type const(char[]) to string
+fail_compilation/testInference.d(44): Error: cannot implicitly convert expression (a) of type int[] to immutable(int[])
+fail_compilation/testInference.d(49): Error: cannot implicitly convert expression (a) of type int[] to immutable(int[])
+fail_compilation/testInference.d(54): Error: cannot implicitly convert expression (a) of type int[] to immutable(int[])
+---
+*/
+string foo(in char[] s) pure
+{
+    return s;   //
+}
+immutable(int[]) x1() /*pure*/
+{
+    int[] a = new int[](10);
+    return a;   //
+}
+immutable(int[]) x2(int len) /*pure*/
+{
+    int[] a = new int[](len);
+    return a;
+}
+immutable(int[]) x3(immutable(int[]) org) /*pure*/
+{
+    int[] a = new int[](org.length);
+    return a;   //
+}
+
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/testInference.d(94): Error: cannot implicitly convert expression (c) of type testInference.C1 to immutable(C1)
+fail_compilation/testInference.d(95): Error: cannot implicitly convert expression (c) of type testInference.C1 to immutable(C1)
+fail_compilation/testInference.d(96): Error: cannot implicitly convert expression (c) of type testInference.C3 to immutable(C3)
+fail_compilation/testInference.d(97): Error: cannot implicitly convert expression (c) of type testInference.C3 to immutable(C3)
+fail_compilation/testInference.d(100): Error: undefined identifier 'X1', did you mean function 'x1'?
+fail_compilation/testInference.d(106): Error: cannot implicitly convert expression (s) of type S1 to immutable(S1)
+fail_compilation/testInference.d(109): Error: cannot implicitly convert expression (a) of type int*[] to immutable(int*[])
+fail_compilation/testInference.d(110): Error: cannot implicitly convert expression (a) of type const(int)*[] to immutable(int*[])
+fail_compilation/testInference.d(114): Error: cannot implicitly convert expression (s) of type S2 to immutable(S2)
+fail_compilation/testInference.d(115): Error: cannot implicitly convert expression (s) of type S2 to immutable(S2)
+fail_compilation/testInference.d(116): Error: cannot implicitly convert expression (s) of type S2 to immutable(S2)
+fail_compilation/testInference.d(118): Error: cannot implicitly convert expression (a) of type const(int)*[] to immutable(int*[])
+---
+*/
+immutable(Object) get(inout int*) pure
+{
+    auto o = new Object;
+    return o;   // should be ok
+}
+immutable(Object) get(immutable Object) pure
+{
+    auto o = new Object;
+    return o;   // should be ok
+}
+inout(Object) get(inout Object) pure
+{
+    auto o = new Object;
+    return o;   // should be ok (, but cannot in current conservative rule)
+}
+
+class C1 { C2 c2; }
+class C2 { C3 c3; }
+class C3 { C1 c1; }
+immutable(C1) recursive1(C3 pc) pure { auto c = new C1(); return c; }   // should be error, because pc.c1 == C1
+immutable(C1) recursive2(C2 pc) pure { auto c = new C1(); return c; }   // should be error, because pc.c3.c1 == C1
+immutable(C3) recursive3(C1 pc) pure { auto c = new C3(); return c; }   // should be error, c.c1 may be pc
+immutable(C3) recursive4(C2 pc) pure { auto c = new C3(); return c; }   // should be error, c.c1.c2 may be pc
+immutable(C1) recursive5(shared C2 pc) pure { auto c = new C1(); return c; }
+immutable(C1) recursive6(immutable C2 pc) pure { auto c = new C1(); return c; }
+immutable(C1) recursiveE(immutable C2 pc) pure { auto c = new X1(); return c; }
+
+class C4 { C4[] arr; }
+immutable(C4)[] recursive7(int[] arr) pure { auto a = new C4[](1); return a; }
+
+struct S1 { int* ptr; }
+immutable(S1)     foo1a(          int*[] prm) pure {                S1 s; return s; }   // NG
+immutable(S1)     foo1b(    const int*[] prm) pure {                S1 s; return s; }   // OK
+immutable(S1)     foo1c(immutable int*[] prm) pure {                S1 s; return s; }   // OK
+immutable(int*[]) bar1a(              S1 prm) pure {           int *[] a; return a; }   // NG
+immutable(int*[]) bar1b(              S1 prm) pure {     const(int)*[] a; return a; }   // NG
+immutable(int*[]) bar1c(              S1 prm) pure { immutable(int)*[] a; return a; }   // OK
+
+struct S2 { const(int)* ptr; }
+immutable(S2)     foo2a(          int*[] prm) pure {                S2 s; return s; }   // OK
+immutable(S2)     foo2b(    const int*[] prm) pure {                S2 s; return s; }   // NG
+immutable(S2)     foo2c(immutable int*[] prm) pure {                S2 s; return s; }   // NG
+immutable(int*[]) bar2a(              S2 prm) pure {           int *[] a; return a; }   // OK
+immutable(int*[]) bar2b(              S2 prm) pure {     const(int)*[] a; return a; }   // NG
+immutable(int*[]) bar2c(              S2 prm) pure { immutable(int)*[] a; return a; }   // OK
+
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/testInference.d(134): Error: cannot implicitly convert expression (f10063(cast(inout(void*))p)) of type inout(void)* to immutable(void)*
+---
+*/
+inout(void)* f10063(inout void* p) pure
+{
+    return p;
+}
+immutable(void)* g10063(inout int* p) pure
+{
+    return f10063(p);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/testInference.d(154): Error: pure function 'testInference.bar14049' cannot call impure function 'testInference.foo14049!int.foo14049'
+---
+*/
+auto impure14049() { static int i = 1; return i; }
+
+void foo14049(T)(T val)
+{
+    auto n = () @trusted {
+        return impure14049();
+    }();
+}
+
+void bar14049() pure
+{
+    foo14049(1);
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/testInference.d(166): Error: pure function 'testInference.f14160' cannot access mutable static data 'g14160'
+---
+*/
+int g14160;
+int* f14160() pure
+{
+    return &g14160; // should be rejected
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/testInference.d(180): Error: pure function 'testInference.test12422' cannot call impure function 'testInference.test12422.bar12422!().bar12422'
+---
+*/
+int g12422;
+void foo12422() { ++g12422; }
+void test12422() pure
+{
+    void bar12422()() { foo12422(); }
+    bar12422();
+}
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/testInference.d(196): Error: pure function 'testInference.test13729a' cannot access mutable static data 'g13729'
+fail_compilation/testInference.d(206): Error: pure function 'testInference.test13729b' cannot call impure function 'testInference.test13729b.foo!().foo'
+---
+*/
+int g13729;
+
+void test13729a() pure
+{
+    static void foo()   // typed as impure
+    {
+        g13729++;       // disallowed
+    }
+    foo();
+}
+void test13729b() pure
+{
+    static void foo()() // inferred to impure
+    {
+        g13729++;
+    }
+    foo();              // cannot call impure function
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/testpull1810.d b/gcc/testsuite/gdc.test/fail_compilation/testpull1810.d
new file mode 100644
index 00000000000..141c9d2ff95
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/testpull1810.d
@@ -0,0 +1,21 @@
+// REQUIRED_ARGS: -c -w
+/*
+TEST_OUTPUT:
+---
+fail_compilation/testpull1810.d(19): Warning: statement is not reachable
+---
+*/
+
+uint foo(uint i)
+{
+    try
+    {
+        ++i;
+        return 3;
+    }
+    catch (Exception e)
+    {
+    }
+    return 4;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/testscopestatic.d b/gcc/testsuite/gdc.test/fail_compilation/testscopestatic.d
new file mode 100644
index 00000000000..310e9fef472
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/testscopestatic.d
@@ -0,0 +1,24 @@
+
+/* TEST_OUTPUT:
+---
+fail_compilation/testscopestatic.d(15): Error: variable testscopestatic.foo.p cannot be 'scope' and 'static'
+fail_compilation/testscopestatic.d(16): Error: variable testscopestatic.foo.b cannot be 'scope' and 'extern'
+fail_compilation/testscopestatic.d(17): Error: variable testscopestatic.foo.c cannot be 'scope' and '__gshared'
+fail_compilation/testscopestatic.d(21): Error: variable testscopestatic.foo.S.x field cannot be 'scope'
+---
+*/
+
+
+void foo()
+{
+    scope int a;
+    static scope int* p;
+    extern scope int b;
+    scope __gshared int c;
+
+    struct S
+    {
+        scope int x;
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/verrors0.d b/gcc/testsuite/gdc.test/fail_compilation/verrors0.d
new file mode 100644
index 00000000000..0d62e780142
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/verrors0.d
@@ -0,0 +1,60 @@
+// REQUIRED_ARGS: -verrors=0
+
+void main()
+{
+    { T a; }    // 1
+    { T a; }    // 2
+    { T a; }    // 3
+    { T a; }    // 4
+    { T a; }    // 5
+    { T a; }    // 6
+    { T a; }    // 7
+    { T a; }    // 8
+    { T a; }    // 9
+    { T a; }    // 10
+    { T a; }    // 11
+    { T a; }    // 12
+    { T a; }    // 13
+    { T a; }    // 14
+    { T a; }    // 15
+    { T a; }    // 16
+    { T a; }    // 17
+    { T a; }    // 18
+    { T a; }    // 19
+    { T a; }    // 20 (default limit)
+    { T a; }    // 21
+    { T a; }    // 22
+    { T a; }    // 23
+    { T a; }    // 24
+    { T a; }    // 25
+}
+/*
+TEST_OUTPUT:
+---
+fail_compilation/verrors0.d(5): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(6): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(7): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(8): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(9): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(10): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(11): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(12): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(13): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(14): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(15): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(16): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(17): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(18): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(19): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(20): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(21): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(22): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(23): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(24): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(25): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(26): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(27): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(28): Error: undefined identifier 'T'
+fail_compilation/verrors0.d(29): Error: undefined identifier 'T'
+---
+*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/verrors5.d b/gcc/testsuite/gdc.test/fail_compilation/verrors5.d
new file mode 100644
index 00000000000..5dda1b2699e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/verrors5.d
@@ -0,0 +1,40 @@
+// REQUIRED_ARGS: -verrors=5
+
+void main()
+{
+    { T a; }    // 1
+    { T a; }    // 2
+    { T a; }    // 3
+    { T a; }    // 4
+    { T a; }    // 5
+    { T a; }    // 6
+    { T a; }    // 7
+    { T a; }    // 8
+    { T a; }    // 9
+    { T a; }    // 10
+    { T a; }    // 11
+    { T a; }    // 12
+    { T a; }    // 13
+    { T a; }    // 14
+    { T a; }    // 15
+    { T a; }    // 16
+    { T a; }    // 17
+    { T a; }    // 18
+    { T a; }    // 19
+    { T a; }    // 20 (default limit)
+    { T a; }    // 21
+    { T a; }    // 22
+    { T a; }    // 23
+    { T a; }    // 24
+    { T a; }    // 25
+}
+/*
+TEST_OUTPUT:
+---
+fail_compilation/verrors5.d(5): Error: undefined identifier 'T'
+fail_compilation/verrors5.d(6): Error: undefined identifier 'T'
+fail_compilation/verrors5.d(7): Error: undefined identifier 'T'
+fail_compilation/verrors5.d(8): Error: undefined identifier 'T'
+fail_compilation/verrors5.d(9): Error: undefined identifier 'T'
+---
+*/
diff --git a/gcc/testsuite/gdc.test/fail_compilation/warn12809.d b/gcc/testsuite/gdc.test/fail_compilation/warn12809.d
new file mode 100644
index 00000000000..100f0fb9f33
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/warn12809.d
@@ -0,0 +1,34 @@
+// REQUIRED_ARGS: -o- -w
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/warn12809.d(25): Warning: statement is not reachable
+fail_compilation/warn12809.d(33): Warning: statement is not reachable
+---
+*/
+
+//void test_unrachable1()
+//{
+//    try assert(0);
+//    finally
+//    {
+//        int x = 1;  // unreachable
+//    }
+//}
+
+void test_unrachable2()
+{
+    try assert(0);
+    finally {}
+
+    int x = 1;      // unreachable
+}
+
+void test_unrachable3()
+{
+    try {}
+    finally assert(0);
+
+    int x = 1;      // unreachable
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/warn13679.d b/gcc/testsuite/gdc.test/fail_compilation/warn13679.d
new file mode 100644
index 00000000000..0a92b766788
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/warn13679.d
@@ -0,0 +1,15 @@
+// REQUIRED_ARGS: -w
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/warn13679.d(14): Warning: cannot use foreach_reverse with an associative array
+---
+*/
+
+void main()
+{
+    int[int] aa;
+    foreach_reverse(k, v; aa) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/warn7444.d b/gcc/testsuite/gdc.test/fail_compilation/warn7444.d
new file mode 100644
index 00000000000..e2838670d63
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/warn7444.d
@@ -0,0 +1,83 @@
+// REQUIRED_ARGS: -w
+// PERMUTE_ARGS:
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/warn7444.d(23): Error: cannot implicitly convert expression (e) of type int to int[]
+---
+*/
+
+void test7444()
+{
+    int[2] sa;
+    int[]  da;
+    int    e;
+
+    {
+        // X: Changed accepts-invalid to rejects-invalid by this issue
+        // a: slice assginment
+        // b: element-wise assignment
+        sa   = e;      // X
+        sa[] = e;      // b
+        da   = e;
+        da[] = e;      // b
+
+        // lhs is static array
+        sa   = sa;     // b == identity assign
+        sa   = sa[];   // X
+        sa[] = sa;     // X
+        sa[] = sa[];   // b
+
+        sa   = da;     // X
+        sa   = da[];   // X
+        sa[] = da;     // X
+        sa[] = da[];   // b
+
+        // lhs is dynamic array
+        da   = sa;     // X
+        da   = sa[];   // a
+        da[] = sa;     // X
+        da[] = sa[];   // b
+
+        da   = da;     // a == identity assign
+        da   = da[];   // a
+        da[] = da;     // X
+        da[] = da[];   // b
+    }
+}
+
+/*
+TEST_OUTPUT:
+---
+No warning
+---
+*/
+
+void test10214()
+{
+    bool[1] arr;
+    arr = 0;
+    pragma(msg, "No warning");
+}
+
+/*
+TEST_OUTPUT:
+---
+No warning
+---
+*/
+
+struct S11228
+{
+    int[2] ii;
+    alias ii this;
+}
+void test11228()
+{
+    S11228 s;
+    int[2] ii;
+    ii = s.ii; // OK
+    ii = s;    // OK <- Warning
+    pragma(msg, "No warning");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/A16.d b/gcc/testsuite/gdc.test/runnable/A16.d
new file mode 100644
index 00000000000..f65335393b4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/A16.d
@@ -0,0 +1,12 @@
+// EXTRA_SOURCES: imports/A16a.d
+
+import std.stdio;
+
+class AA16
+{
+  protected:
+    this()
+    {
+        printf("class AA16\n");
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/Same.d b/gcc/testsuite/gdc.test/runnable/Same.d
new file mode 100644
index 00000000000..85025e77c4e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/Same.d
@@ -0,0 +1,12 @@
+// EXTRA_SOURCES: imports/Other.d
+// PERMUTE_ARGS:
+
+module Same; // makes no difference if removed
+import core.stdc.stdio;
+class Same
+{
+this()
+{
+printf("Same\n");
+}
+}
diff --git a/gcc/testsuite/gdc.test/runnable/a17.d b/gcc/testsuite/gdc.test/runnable/a17.d
new file mode 100644
index 00000000000..79eeecfeb14
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/a17.d
@@ -0,0 +1,21 @@
+// EXTRA_SOURCES: imports/a17a.d
+
+module a17;
+
+import std.stdio;
+
+private import imports.a17a;
+
+class barx {
+    this() { printf("barx\n"); }
+}
+
+
+int main()
+{
+    foo2x f = new foo2x();
+//    f = new foo2x();
+//    f.x++;
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/a18.d b/gcc/testsuite/gdc.test/runnable/a18.d
new file mode 100644
index 00000000000..4d8b000a138
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/a18.d
@@ -0,0 +1,16 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/a18a.d
+// PERMUTE_ARGS:
+
+import imports.a18a;
+
+extern(C) int printf(const char*, ...);
+
+alias   IContainer!(int) icontainer_t;
+
+int main()
+{
+        printf("Test enumerator\n");
+
+        return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/a19.d b/gcc/testsuite/gdc.test/runnable/a19.d
new file mode 100644
index 00000000000..574f95cae8f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/a19.d
@@ -0,0 +1,12 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/a19a.d
+// PERMUTE_ARGS:
+
+import imports.a19a;
+
+int main(char[][] args)
+{
+        TemplatedStruct!(Dummy) e;
+
+        return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/a21.d b/gcc/testsuite/gdc.test/runnable/a21.d
new file mode 100644
index 00000000000..6b3be9d814c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/a21.d
@@ -0,0 +1,29 @@
+// EXTRA_SOURCES: imports/a21a.d
+// PERMUTE_ARGS:
+
+import std.stdio;
+import imports.a21a;
+
+
+template BadMixin()
+{
+    int badFunc()
+    {
+        printf("badFunc\n");
+        return 2;
+    }
+}
+
+
+int main()
+{
+    int i;
+    auto x = new SomeClass;
+    i = x.goodFunc();
+    assert(i == 1);
+    i = x.badFunc();
+    assert(i == 2);
+
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/aliasthis.d b/gcc/testsuite/gdc.test/runnable/aliasthis.d
new file mode 100644
index 00000000000..f9173c463e6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/aliasthis.d
@@ -0,0 +1,1979 @@
+
+extern (C) int printf(const(char*) fmt, ...);
+import core.vararg;
+
+struct Tup(T...)
+{
+    T field;
+    alias field this;
+
+    bool opEquals(const Tup rhs) const
+    {
+        foreach (i, _; T)
+            if (field[i] != rhs.field[i])
+                return false;
+        return true;
+    }
+}
+
+Tup!T tup(T...)(T fields)
+{
+    return typeof(return)(fields);
+}
+
+template Seq(T...)
+{
+    alias T Seq;
+}
+
+/**********************************************/
+
+struct S
+{
+    int x;
+    alias x this;
+}
+
+int foo(int i)
+{
+    return i * 2;
+}
+
+void test1()
+{
+    S s;
+    s.x = 7;
+    int i = -s;
+    assert(i == -7);
+
+    i = s + 8;
+    assert(i == 15);
+
+    i = s + s;
+    assert(i == 14);
+
+    i = 9 + s;
+    assert(i == 16);
+
+    i = foo(s);
+    assert(i == 14);
+}
+
+/**********************************************/
+
+class C
+{
+    int x;
+    alias x this;
+}
+
+void test2()
+{
+    C s = new C();
+    s.x = 7;
+    int i = -s;
+    assert(i == -7);
+
+    i = s + 8;
+    assert(i == 15);
+
+    i = s + s;
+    assert(i == 14);
+
+    i = 9 + s;
+    assert(i == 16);
+
+    i = foo(s);
+    assert(i == 14);
+}
+
+/**********************************************/
+
+void test3()
+{
+    Tup!(int, double) t;
+    t[0] = 1;
+    t[1] = 1.1;
+    assert(t[0] == 1);
+    assert(t[1] == 1.1);
+    printf("%d %g\n", t[0], t[1]);
+}
+
+/**********************************************/
+
+struct Iter
+{
+    bool empty() { return true; }
+    void popFront() { }
+    ref Tup!(int, int) front() { return *new Tup!(int, int); }
+    ref Iter opSlice() { return this; }
+}
+
+void test4()
+{
+    foreach (a; Iter()) { }
+}
+
+/**********************************************/
+
+void test5()
+{
+    static struct Double1 {
+        double val = 1;
+        alias val this;
+    }
+    static Double1 x() { return Double1(); }
+    x()++;
+}
+
+/**********************************************/
+// 4617
+
+struct S4617
+{
+    struct F
+    {
+        int  square(int  n) { return n*n; }
+        real square(real n) { return n*n; }
+    }
+    F forward;
+
+    alias forward this;
+
+    alias forward.square sqr;    // okay
+
+    int field;
+    void mfunc();
+    template Templ(){}
+    void tfunc()(){}
+}
+
+template Id4617(alias k) { alias k Id4617; }
+
+void test4617a()
+{
+    alias Id4617!(S4617.square) test1;            //NG
+    alias Id4617!(S4617.forward.square) test2;    //OK
+
+    alias Id4617!(S4617.sqr) test3;               //okay
+
+    static assert(__traits(isSame, S4617.square, S4617.forward.square));
+}
+
+void test4617b()
+{
+    static struct Sub(T)
+    {
+        T value;
+        @property ref inout(T) payload() inout { return value; }
+        alias payload this;
+    }
+
+    alias Id4617!(S4617.field) S_field;
+    alias Id4617!(S4617.mfunc) S_mfunc;
+    alias Id4617!(S4617.Templ) S_Templ;
+    alias Id4617!(S4617.tfunc) S_tfunc;
+
+    alias Sub!S4617 T4617;
+    alias Id4617!(T4617.field) R_field;
+    alias Id4617!(T4617.mfunc) R_mfunc;
+    alias Id4617!(T4617.Templ) R_Templ;
+    alias Id4617!(T4617.tfunc) R_tfunc;
+    static assert(__traits(isSame, R_field, S_field));
+    static assert(__traits(isSame, R_mfunc, S_mfunc));
+    static assert(__traits(isSame, R_Templ, S_Templ));
+    static assert(__traits(isSame, R_tfunc, S_tfunc));
+
+    alias Id4617!(T4617.square) R_sqr;
+    static assert(__traits(isSame, R_sqr, S4617.forward.square));
+}
+
+/**********************************************/
+// 4773
+
+void test4773()
+{
+    struct Rebindable
+    {
+        Object obj;
+        @property const(Object) get(){ return obj; }
+        alias get this;
+    }
+
+    Rebindable r;
+    if (r) assert(0);
+    r.obj = new Object;
+    if (!r) assert(0);
+}
+
+/**********************************************/
+// 5188
+
+void test5188()
+{
+    struct S
+    {
+        int v = 10;
+        alias v this;
+    }
+
+    S s;
+    assert(s <= 20);
+    assert(s != 14);
+}
+
+/***********************************************/
+
+struct Foo {
+  void opIndexAssign(int x, size_t i) {
+    val = x;
+  }
+  void opSliceAssign(int x, size_t a, size_t b) {
+    val = x;
+  }
+  int val;
+}
+
+struct Bar {
+   Foo foo;
+   alias foo this;
+}
+
+void test6() {
+   Bar b;
+   b[0] = 1;
+   assert(b.val == 1);
+   b[0 .. 1] = 2;
+   assert(b.val == 2);
+}
+
+/**********************************************/
+// recursive alias this detection
+
+class C0 {}
+
+class C1 { C2 c; alias c this; }
+class C2 { C1 c; alias c this; }
+
+class C3 { C2 c; alias c this; }
+
+struct S0 {}
+
+struct S1 { S2* ps; @property ref get(){return *ps;} alias get this; }
+struct S2 { S1* ps; @property ref get(){return *ps;} alias get this; }
+
+struct S3 { S2* ps; @property ref get(){return *ps;} alias get this; }
+
+struct S4 { S5* ps; @property ref get(){return *ps;} alias get this; }
+struct S5 { S4* ps; @property ref get(){return *ps;} alias get this; }
+
+struct S6 { S5* ps; @property ref get(){return *ps;} alias get this; }
+
+void test7()
+{
+    // Able to check a type is implicitly convertible within a finite time.
+    static assert(!is(C1 : C0));
+    static assert( is(C2 : C1));
+    static assert( is(C1 : C2));
+    static assert(!is(C3 : C0));
+    static assert( is(C3 : C1));
+    static assert( is(C3 : C2));
+
+    static assert(!is(S1 : S0));
+    static assert( is(S2 : S1));
+    static assert( is(S1 : S2));
+    static assert(!is(S3 : S0));
+    static assert( is(S3 : S1));
+    static assert( is(S3 : S2));
+
+    C0 c0;  C1 c1;  C3 c3;
+    S0 s0;  S1 s1;  S3 s3;  S4 s4;  S6 s6;
+
+    // Allow merging types that contains alias this recursion.
+    static assert( __traits(compiles, c0 is c1));   // typeMerge(c || c) e2->implicitConvTo(t1);
+    static assert( __traits(compiles, c0 is c3));   // typeMerge(c || c) e2->implicitConvTo(t1);
+    static assert( __traits(compiles, c1 is c0));   // typeMerge(c || c) e1->implicitConvTo(t2);
+    static assert( __traits(compiles, c3 is c0));   // typeMerge(c || c) e1->implicitConvTo(t2);
+    static assert(!__traits(compiles, s1 is c0));   // typeMerge(c || c) e1
+    static assert(!__traits(compiles, s3 is c0));   // typeMerge(c || c) e1
+    static assert(!__traits(compiles, c0 is s1));   // typeMerge(c || c) e2
+    static assert(!__traits(compiles, c0 is s3));   // typeMerge(c || c) e2
+
+    static assert(!__traits(compiles, s1 is s0));   // typeMerge(s && s) e1
+    static assert(!__traits(compiles, s3 is s0));   // typeMerge(s && s) e1
+    static assert(!__traits(compiles, s0 is s1));   // typeMerge(s && s) e2
+    static assert(!__traits(compiles, s0 is s3));   // typeMerge(s && s) e2
+    static assert(!__traits(compiles, s1 is s4));   // typeMerge(s && s) e1 + e2
+    static assert(!__traits(compiles, s3 is s6));   // typeMerge(s && s) e1 + e2
+
+    static assert(!__traits(compiles, s1 is 10));   // typeMerge(s || s) e1
+    static assert(!__traits(compiles, s3 is 10));   // typeMerge(s || s) e1
+    static assert(!__traits(compiles, 10 is s1));   // typeMerge(s || s) e2
+    static assert(!__traits(compiles, 10 is s3));   // typeMerge(s || s) e2
+
+    // SliceExp::semantic
+    static assert(!__traits(compiles, c1[]));
+    static assert(!__traits(compiles, c3[]));
+    static assert(!__traits(compiles, s1[]));
+    static assert(!__traits(compiles, s3[]));
+
+    // CallExp::semantic
+//  static assert(!__traits(compiles, c1()));
+//  static assert(!__traits(compiles, c3()));
+    static assert(!__traits(compiles, s1()));
+    static assert(!__traits(compiles, s3()));
+
+    // AssignExp::semantic
+    static assert(!__traits(compiles, { c1[1] = 0; }));
+    static assert(!__traits(compiles, { c3[1] = 0; }));
+    static assert(!__traits(compiles, { s1[1] = 0; }));
+    static assert(!__traits(compiles, { s3[1] = 0; }));
+    static assert(!__traits(compiles, { c1[ ] = 0; }));
+    static assert(!__traits(compiles, { c3[ ] = 0; }));
+    static assert(!__traits(compiles, { s1[ ] = 0; }));
+    static assert(!__traits(compiles, { s3[ ] = 0; }));
+
+    // UnaExp::op_overload
+    static assert(!__traits(compiles, +c1[1]));
+    static assert(!__traits(compiles, +c3[1]));
+    static assert(!__traits(compiles, +s1[1]));
+    static assert(!__traits(compiles, +s3[1]));
+    static assert(!__traits(compiles, +c1[ ]));
+    static assert(!__traits(compiles, +c3[ ]));
+    static assert(!__traits(compiles, +s1[ ]));
+    static assert(!__traits(compiles, +s3[ ]));
+    static assert(!__traits(compiles, +c1));
+    static assert(!__traits(compiles, +c3));
+    static assert(!__traits(compiles, +s1));
+    static assert(!__traits(compiles, +s3));
+
+    // ArrayExp::op_overload
+    static assert(!__traits(compiles, c1[1]));
+    static assert(!__traits(compiles, c3[1]));
+    static assert(!__traits(compiles, s1[1]));
+    static assert(!__traits(compiles, s3[1]));
+
+    // BinExp::op_overload
+    static assert(!__traits(compiles, c1 + 10));    // e1
+    static assert(!__traits(compiles, c3 + 10));    // e1
+    static assert(!__traits(compiles, 10 + c1));    // e2
+    static assert(!__traits(compiles, 10 + c3));    // e2
+    static assert(!__traits(compiles, s1 + 10));    // e1
+    static assert(!__traits(compiles, s3 + 10));    // e1
+    static assert(!__traits(compiles, 10 + s1));    // e2
+    static assert(!__traits(compiles, 10 + s3));    // e2
+
+    // BinExp::compare_overload
+    static assert(!__traits(compiles, c1 < 10));    // (Object.opCmp(int) is invalid)
+    static assert(!__traits(compiles, c3 < 10));    // (Object.opCmp(int) is invalid)
+    static assert(!__traits(compiles, 10 < c1));    // (Object.opCmp(int) is invalid)
+    static assert(!__traits(compiles, 10 < c3));    // (Object.opCmp(int) is invalid)
+    static assert(!__traits(compiles, s1 < 10));    // e1
+    static assert(!__traits(compiles, s3 < 10));    // e1
+    static assert(!__traits(compiles, 10 < s1));    // e2
+    static assert(!__traits(compiles, 10 < s3));    // e2
+
+    // BinAssignExp::op_overload
+    static assert(!__traits(compiles, c1[1] += 1));
+    static assert(!__traits(compiles, c3[1] += 1));
+    static assert(!__traits(compiles, s1[1] += 1));
+    static assert(!__traits(compiles, s3[1] += 1));
+    static assert(!__traits(compiles, c1[ ] += 1));
+    static assert(!__traits(compiles, c3[ ] += 1));
+    static assert(!__traits(compiles, s1[ ] += 1));
+    static assert(!__traits(compiles, s3[ ] += 1));
+    static assert(!__traits(compiles, c1 += c0));   // e1
+    static assert(!__traits(compiles, c3 += c0));   // e1
+    static assert(!__traits(compiles, s1 += s0));   // e1
+    static assert(!__traits(compiles, s3 += s0));   // e1
+    static assert(!__traits(compiles, c0 += c1));   // e2
+    static assert(!__traits(compiles, c0 += c3));   // e2
+    static assert(!__traits(compiles, s0 += s1));   // e2
+    static assert(!__traits(compiles, s0 += s3));   // e2
+    static assert(!__traits(compiles, c1 += s1));   // e1 + e2
+    static assert(!__traits(compiles, c3 += s3));   // e1 + e2
+
+    // ForeachStatement::inferAggregate
+    static assert(!__traits(compiles, { foreach (e; s1){} }));
+    static assert(!__traits(compiles, { foreach (e; s3){} }));
+    static assert(!__traits(compiles, { foreach (e; c1){} }));
+    static assert(!__traits(compiles, { foreach (e; c3){} }));
+
+    // Expression::checkToBoolean
+    static assert(!__traits(compiles, { if (s1){} }));
+    static assert(!__traits(compiles, { if (s3){} }));
+}
+
+/***************************************************/
+// 11875 - endless recursion in Type::deduceType
+
+struct T11875x(C)
+{
+    C c;
+}
+class D11875a { D11875b c; alias c this; }
+class D11875b { D11875a c; alias c this; }
+static assert(!is(D11875a == D11875b));
+static assert( is(T11875x!D11875a == T11875x!D, D) && is(D == D11875a));
+static assert(!is(D11875a == T11875x!D, D));    // this used to freeze dmd
+
+// test that types in recursion are still detected
+struct T11875y(C)
+{
+    C c;
+    alias c this;
+}
+class D11875c { T11875y!D11875b c; alias c this; }
+static assert(is(D11875c : T11875y!D, D) && is(D == D11875b));
+
+/***************************************************/
+// 11930
+
+class BarObj11930 {}
+
+struct Bar11930
+{
+    BarObj11930 _obj;
+    alias _obj this;
+}
+
+BarObj11930 getBarObj11930(T)(T t)
+{
+    static if (is(T unused : BarObj11930))
+        return t;
+    else
+        static assert(false, "Can not get BarObj from " ~ T.stringof);
+}
+
+void test11930()
+{
+    Bar11930 b;
+    getBarObj11930(b);
+}
+
+/***************************************************/
+// 2781
+
+struct Tuple2781a(T...) {
+    T data;
+    alias data this;
+}
+
+struct Tuple2781b(T) {
+    T data;
+    alias data this;
+}
+
+void test2781()
+{
+    Tuple2781a!(uint, float) foo;
+    foreach(elem; foo) {}
+
+    {
+        Tuple2781b!(int[]) bar1;
+        foreach(elem; bar1) {}
+
+        Tuple2781b!(int[int]) bar2;
+        foreach(key, elem; bar2) {}
+
+        Tuple2781b!(string) bar3;
+        foreach(dchar elem; bar3) {}
+    }
+
+    {
+        Tuple2781b!(int[]) bar1;
+        foreach(elem; bar1) goto L1;
+    L1:
+        ;
+
+        Tuple2781b!(int[int]) bar2;
+        foreach(key, elem; bar2) goto L2;
+    L2:
+        ;
+
+        Tuple2781b!(string) bar3;
+        foreach(dchar elem; bar3) goto L3;
+    L3:
+        ;
+    }
+
+
+    int eval;
+
+    auto t1 = tup(10, "str");
+    auto i1 = 0;
+    foreach (e; t1)
+    {
+        pragma(msg, "[] = ", typeof(e));
+        static if (is(typeof(e) == int   )) assert(i1 == 0 && e == 10);
+        static if (is(typeof(e) == string)) assert(i1 == 1 && e == "str");
+        ++i1;
+    }
+
+    auto t2 = tup(10, "str");
+    foreach (i2, e; t2)
+    {
+        pragma(msg, "[", cast(int)i2, "] = ", typeof(e));
+        static if (is(typeof(e) == int   )) { static assert(i2 == 0); assert(e == 10); }
+        static if (is(typeof(e) == string)) { static assert(i2 == 1); assert(e == "str"); }
+    }
+
+    auto t3 = tup(10, "str");
+    auto i3 = 2;
+    foreach_reverse (e; t3)
+    {
+        --i3;
+        pragma(msg, "[] = ", typeof(e));
+        static if (is(typeof(e) == int   )) assert(i3 == 0 && e == 10);
+        static if (is(typeof(e) == string)) assert(i3 == 1 && e == "str");
+    }
+
+    auto t4 = tup(10, "str");
+    foreach_reverse (i4, e; t4)
+    {
+        pragma(msg, "[", cast(int)i4, "] = ", typeof(e));
+        static if (is(typeof(e) == int   )) { static assert(i4 == 0); assert(e == 10); }
+        static if (is(typeof(e) == string)) { static assert(i4 == 1); assert(e == "str"); }
+    }
+
+    eval = 0;
+    foreach (i, e; tup(tup((eval++, 10), 3.14), tup("str", [1,2])))
+    {
+        static if (i == 0) assert(e == tup(10, 3.14));
+        static if (i == 1) assert(e == tup("str", [1,2]));
+    }
+    assert(eval == 1);
+
+    eval = 0;
+    foreach (i, e; tup((eval++,10), tup(3.14, tup("str", tup([1,2])))))
+    {
+        static if (i == 0) assert(e == 10);
+        static if (i == 1) assert(e == tup(3.14, tup("str", tup([1,2]))));
+    }
+    assert(eval == 1);
+}
+
+/**********************************************/
+// 6546
+
+void test6546()
+{
+    class C {}
+    class D : C {}
+
+    struct S { C c; alias c this; } // S : C
+    struct T { S s; alias s this; } // T : S
+    struct U { T t; alias t this; } // U : T
+
+    C c;
+    D d;
+    S s;
+    T t;
+    U u;
+
+    assert(c is c);  // OK
+    assert(c is d);  // OK
+    assert(c is s);  // OK
+    assert(c is t);  // OK
+    assert(c is u);  // OK
+
+    assert(d is c);  // OK
+    assert(d is d);  // OK
+    assert(d is s);  // doesn't work
+    assert(d is t);  // doesn't work
+    assert(d is u);  // doesn't work
+
+    assert(s is c);  // OK
+    assert(s is d);  // doesn't work
+    assert(s is s);  // OK
+    assert(s is t);  // doesn't work
+    assert(s is u);  // doesn't work
+
+    assert(t is c);  // OK
+    assert(t is d);  // doesn't work
+    assert(t is s);  // doesn't work
+    assert(t is t);  // OK
+    assert(t is u);  // doesn't work
+
+    assert(u is c);  // OK
+    assert(u is d);  // doesn't work
+    assert(u is s);  // doesn't work
+    assert(u is t);  // doesn't work
+    assert(u is u);  // OK
+}
+
+/**********************************************/
+// 6736
+
+void test6736()
+{
+    static struct S1
+    {
+        struct S2 // must be 8 bytes in size
+        {
+            uint a, b;
+        }
+        S2 s2;
+        alias s2 this;
+    }
+    S1 c;
+    static assert(!is(typeof(c + c)));
+}
+
+/**********************************************/
+// 2777
+
+struct ArrayWrapper(T) {
+    T[] array;
+    alias array this;
+}
+
+// alias array this
+void test2777a()
+{
+    ArrayWrapper!(uint) foo;
+    foo.length = 5;  // Works
+    foo[0] = 1;      // Works
+    auto e0 = foo[0];  // Works
+    auto e4 = foo[$ - 1];  // Error:  undefined identifier __dollar
+    auto s01 = foo[0..2];  // Error:  ArrayWrapper!(uint) cannot be sliced with[]
+}
+
+// alias tuple this
+void test2777b()
+{
+    auto t = tup(10, 3.14, "str", [1,2]);
+
+    assert(t[$ - 1] == [1,2]);
+
+    auto f1 = t[];
+    assert(f1[0] == 10);
+    assert(f1[1] == 3.14);
+    assert(f1[2] == "str");
+    assert(f1[3] == [1,2]);
+
+    auto f2 = t[1..3];
+    assert(f2[0] == 3.14);
+    assert(f2[1] == "str");
+}
+
+/****************************************/
+// 2787
+
+struct Base2787
+{
+    int x;
+    void foo() { auto _ = x; }
+}
+
+struct Derived2787
+{
+    Base2787 _base;
+    alias _base this;
+    int y;
+    void bar() { auto _ = x; }
+}
+
+/***********************************/
+// 5679
+
+void test5679()
+{
+    class Foo {}
+
+    class Base
+    {
+        @property Foo getFoo() { return null; }
+    }
+    class Derived : Base
+    {
+        alias getFoo this;
+    }
+
+    Derived[] dl;
+    Derived d = new Derived();
+    dl ~= d; // Error: cannot append type alias_test.Base to type Derived[]
+}
+
+/***********************************/
+// 6508
+
+void test6508()
+{
+    int x, y;
+    Seq!(x, y) = tup(10, 20);
+    assert(x == 10);
+    assert(y == 20);
+}
+
+void test6508x()
+{
+    static int ctor, cpctor, dtor;
+
+    static struct Tuple(T...)
+    {
+        T field;
+        alias field this;
+
+        this(int)  { ++ctor;   printf("ctor\n");   }
+        this(this) { ++cpctor; printf("cpctor\n"); }
+        ~this()    { ++dtor;   printf("dtor\n");   }
+    }
+
+    {
+        alias Tup = Tuple!(int, string);
+        auto tup = Tup(1);
+        assert(ctor==1 && cpctor==0 && dtor==0);
+
+        auto getVal() { return tup; }
+        ref getRef(ref Tup s = tup) { return s; }
+
+        {
+            auto n1 = tup[0];
+            assert(ctor==1 && cpctor==0 && dtor==0);
+
+            auto n2 = getRef()[0];
+            assert(ctor==1 && cpctor==0 && dtor==0);
+
+            auto n3 = getVal()[0];
+            assert(ctor==1 && cpctor==1 && dtor==1);
+        }
+
+        // bug in DotVarExp::semantic
+        {
+            typeof(tup.field) vars;
+            vars = getVal();
+            assert(ctor==1 && cpctor==2 && dtor==2);
+        }
+    }
+    assert(ctor==1 && cpctor==2 && dtor==3);
+    assert(ctor + cpctor == dtor);
+}
+
+/***********************************/
+// 6369
+
+void test6369a()
+{
+    alias Seq!(int, string) Field;
+
+    auto t1 = Tup!(int, string)(10, "str");
+    Field field1 = t1;           // NG -> OK
+    assert(field1[0] == 10);
+    assert(field1[1] == "str");
+
+    auto t2 = Tup!(int, string)(10, "str");
+    Field field2 = t2.field;     // NG -> OK
+    assert(field2[0] == 10);
+    assert(field2[1] == "str");
+
+    auto t3 = Tup!(int, string)(10, "str");
+    Field field3;
+    field3 = t3.field;
+    assert(field3[0] == 10);
+    assert(field3[1] == "str");
+}
+
+void test6369b()
+{
+    auto t = Tup!(Tup!(int, double), string)(tup(10, 3.14), "str");
+
+    Seq!(int, double, string) fs1 = t;
+    assert(fs1[0] == 10);
+    assert(fs1[1] == 3.14);
+    assert(fs1[2] == "str");
+
+    Seq!(Tup!(int, double), string) fs2 = t;
+    assert(fs2[0][0] == 10);
+    assert(fs2[0][1] == 3.14);
+    assert(fs2[0] == tup(10, 3.14));
+    assert(fs2[1] == "str");
+
+    Tup!(Tup!(int, double), string) fs3 = t;
+    assert(fs3[0][0] == 10);
+    assert(fs3[0][1] == 3.14);
+    assert(fs3[0] == tup(10, 3.14));
+    assert(fs3[1] == "str");
+}
+
+void test6369c()
+{
+    auto t = Tup!(Tup!(int, double), Tup!(string, int[]))(tup(10, 3.14), tup("str", [1,2]));
+
+    Seq!(int, double, string, int[]) fs1 = t;
+    assert(fs1[0] == 10);
+    assert(fs1[1] == 3.14);
+    assert(fs1[2] == "str");
+    assert(fs1[3] == [1,2]);
+
+    Seq!(int, double, Tup!(string, int[])) fs2 = t;
+    assert(fs2[0] == 10);
+    assert(fs2[1] == 3.14);
+    assert(fs2[2] == tup("str", [1,2]));
+
+    Seq!(Tup!(int, double), string, int[]) fs3 = t;
+    assert(fs3[0] == tup(10, 3.14));
+    assert(fs3[0][0] == 10);
+    assert(fs3[0][1] == 3.14);
+    assert(fs3[1] == "str");
+    assert(fs3[2] == [1,2]);
+}
+
+void test6369d()
+{
+    int eval = 0;
+    Seq!(int, string) t = tup((++eval, 10), "str");
+    assert(eval == 1);
+    assert(t[0] == 10);
+    assert(t[1] == "str");
+}
+
+/**********************************************/
+// 6434
+
+struct Variant6434{}
+
+struct A6434
+{
+   Variant6434 i;
+   alias i this;
+
+   void opDispatch(string name)()
+   {
+   }
+}
+
+void test6434()
+{
+   A6434 a;
+   a.weird; // no property 'weird' for type 'VariantN!(maxSize)'
+}
+
+/**************************************/
+// 6366
+
+void test6366()
+{
+    struct Zip
+    {
+        string str;
+        size_t i;
+        this(string s)
+        {
+            str = s;
+        }
+        @property const bool empty()
+        {
+            return i == str.length;
+        }
+        @property Tup!(size_t, char) front()
+        {
+            return typeof(return)(i, str[i]);
+        }
+        void popFront()
+        {
+            ++i;
+        }
+    }
+
+    foreach (i, c; Zip("hello"))
+    {
+        switch (i)
+        {
+            case 0: assert(c == 'h');   break;
+            case 1: assert(c == 'e');   break;
+            case 2: assert(c == 'l');   break;
+            case 3: assert(c == 'l');   break;
+            case 4: assert(c == 'o');   break;
+            default:assert(0);
+        }
+    }
+
+    auto range(F...)(F field)
+    {
+        static struct Range {
+            F field;
+            bool empty = false;
+            Tup!F front() { return typeof(return)(field); }
+            void popFront(){ empty = true; }
+        }
+        return Range(field);
+    }
+
+    foreach (i, t; range(10, tup("str", [1,2]))){
+        static assert(is(typeof(i) == int));
+        static assert(is(typeof(t) == Tup!(string, int[])));
+        assert(i == 10);
+        assert(t == tup("str", [1,2]));
+    }
+    auto r1 = range(10, "str", [1,2]);
+    auto r2 = range(tup(10, "str"), [1,2]);
+    auto r3 = range(10, tup("str", [1,2]));
+    auto r4 = range(tup(10, "str", [1,2]));
+    alias Seq!(r1, r2, r3, r4) ranges;
+    foreach (n, _; ranges)
+    {
+        foreach (i, s, a; ranges[n]){
+            static assert(is(typeof(i) == int));
+            static assert(is(typeof(s) == string));
+            static assert(is(typeof(a) == int[]));
+            assert(i == 10);
+            assert(s == "str");
+            assert(a == [1,2]);
+        }
+    }
+}
+
+/***************************************************/
+// 6711
+
+void test6711()
+{
+    struct A { int i; }
+    struct B { A a; alias a this; }
+    struct C { B b; alias b this; }
+
+    B b;
+    with (b)
+    {
+        i = 42;
+    }
+    assert(b.i == 42);
+
+    C c;
+    with (c)
+    {
+        i = 42;
+    }
+    assert(c.i == 42);
+}
+
+/**********************************************/
+// 12161
+
+class A12161
+{
+    void m() {}
+}
+
+class B12161
+{
+    A12161 a;
+    alias a this;
+}
+
+void test12161()
+{
+    B12161 b = new B12161();
+    b.a = new A12161();
+    with (b)
+        m();
+}
+
+/**********************************************/
+// 6759
+
+struct Range
+{
+    size_t front() { return 0; }
+    void popFront() { empty = true; }
+    bool empty;
+}
+
+struct ARange
+{
+    Range range;
+    alias range this;
+}
+
+void test6759()
+{
+    ARange arange;
+    assert(arange.front == 0);
+    foreach(e; arange)
+    {
+        assert(e == 0);
+    }
+}
+
+/**********************************************/
+// 6479
+
+struct Memory6479
+{
+    mixin Wrapper6479!();
+}
+struct Image6479
+{
+    Memory6479 sup;
+    alias sup this;
+}
+mixin template Wrapper6479()
+{
+}
+
+/**********************************************/
+// 6832
+
+void test6832()
+{
+    static class Foo { }
+    static struct Bar { Foo foo; alias foo this; }
+    Bar bar;
+    bar = new Foo;          // ok
+    assert(bar !is null);   // ng
+
+    struct Int { int n; alias n this; }
+    Int a;
+    int b;
+    auto c = (true ? a : b);    // TODO
+    assert(c == a);
+}
+
+/**********************************************/
+// 6928
+
+void test6928()
+{
+    struct T { int* p; } // p is necessary.
+    T tx;
+
+    struct S {
+        T get() const { return tx; }
+        alias get this;
+    }
+
+    immutable(S) s;
+    immutable(T) t;
+    static assert(is(typeof(1? s:t))); // ok.
+    static assert(is(typeof(1? t:s))); // ok.
+    static assert(is(typeof(1? s:t)==typeof(1? t:s))); // fail.
+
+    auto x = 1? t:s; // ok.
+    auto y = 1? s:t; // compile error.
+}
+
+/**********************************************/
+// 6929
+
+struct S6929
+{
+    T6929 get() const { return T6929.init; }
+    alias get this;
+}
+struct T6929
+{
+    S6929 get() const { return S6929.init; }
+    alias get this;
+}
+void test6929()
+{
+    T6929 t;
+    S6929 s;
+    static assert(!is(typeof(1? t:s)));
+}
+
+/***************************************************/
+// 7136
+
+void test7136()
+{
+    struct X
+    {
+        Object get() immutable { return null; }
+        alias get this;
+    }
+    immutable(X) x;
+    Object y;
+    static assert( is(typeof(1?x:y) == Object));        // fails
+    static assert(!is(typeof(1?x:y) == const(Object))); // fails
+
+    struct A
+    {
+        int[] get() immutable { return null; }
+        alias get this;
+    }
+    immutable(A) a;
+    int[] b;
+    static assert( is(typeof(1?a:b) == int[]));         // fails
+    static assert(!is(typeof(1?a:b) == const(int[])));  // fails
+}
+
+/***************************************************/
+// 7731
+
+struct A7731
+{
+    int a;
+}
+template Inherit7731(alias X)
+{
+    X __super;
+    alias __super this;
+}
+struct B7731
+{
+    mixin Inherit7731!A7731;
+    int b;
+}
+
+struct PolyPtr7731(X)
+{
+    X* _payload;
+    static if (is(typeof(X.init.__super)))
+    {
+        alias typeof(X.init.__super) Super;
+        @property auto getSuper(){ return PolyPtr7731!Super(&_payload.__super); }
+        alias getSuper this;
+    }
+}
+template create7731(X)
+{
+    PolyPtr7731!X create7731(T...)(T args){
+        return PolyPtr7731!X(args);
+    }
+}
+
+void f7731a(PolyPtr7731!A7731 a) {/*...*/}
+void f7731b(PolyPtr7731!B7731 b) {f7731a(b);/*...*/}
+
+void test7731()
+{
+    auto b = create7731!B7731();
+}
+
+/***************************************************/
+// 7808
+
+struct Nullable7808(T)
+{
+    private T _value;
+
+    this()(T value)
+    {
+        _value = value;
+    }
+
+    @property ref inout(T) get() inout pure @safe
+    {
+        return _value;
+    }
+    alias get this;
+}
+
+class C7808 {}
+struct S7808 { C7808 c; }
+
+void func7808(S7808 s) {}
+
+void test7808()
+{
+    auto s = Nullable7808!S7808(S7808(new C7808));
+    func7808(s);
+}
+
+/***************************************************/
+// 7945
+
+struct S7945
+{
+    int v;
+    alias v this;
+}
+void foo7945(ref int n){}
+
+void test7945()
+{
+    auto s = S7945(1);
+    foo7945(s);         // 1.NG -> OK
+    s.foo7945();        // 2.OK, ufcs
+    foo7945(s.v);       // 3.OK
+    s.v.foo7945();      // 4.OK, ufcs
+}
+
+/***************************************************/
+// 15674 - alias this on out parameter, consistent with 7945 case
+
+struct S15674
+{
+    int v;
+    alias v this;
+}
+void foo15674(out int i){ i = 42; }
+
+void test15674()
+{
+    S15674 s;
+    s.v = 1;    foo15674(s);    assert(s.v == 42);
+    s.v = 1;    foo15674(s.v);  assert(s.v == 42);
+    s.v = 1;    s.foo15674();   assert(s.v == 42);
+    s.v = 1;    s.v.foo15674(); assert(s.v == 42);
+}
+
+/***************************************************/
+// 7992
+
+struct S7992
+{
+    int[] arr;
+    alias arr this;
+}
+S7992 func7992(...)
+{
+    S7992 ret;
+    ret.arr.length = _arguments.length;
+    return ret;
+}
+void test7992()
+{
+    int[] arr;
+    assert(arr.length == 0);
+    arr ~= func7992(1, 2);  //NG
+    //arr = func7992(1, 2); //OK
+    assert(arr.length == 2);
+}
+
+/***************************************************/
+// 8169
+
+void test8169()
+{
+    static struct ValueImpl
+    {
+       static immutable(int) getValue()
+       {
+           return 42;
+       }
+    }
+
+    static struct ValueUser
+    {
+       ValueImpl m_valueImpl;
+       alias m_valueImpl this;
+    }
+
+    static assert(ValueImpl.getValue() == 42); // #0, OK
+    static assert(ValueUser.getValue() == 42); // #1, NG -> OK
+    static assert(       ValueUser.m_valueImpl .getValue() == 42); // #2, NG -> OK
+    static assert(typeof(ValueUser.m_valueImpl).getValue() == 42); // #3, OK
+}
+
+/***************************************************/
+// 8735
+
+struct S8735(alias Arg)
+{
+    alias Arg Val;
+    alias Val this;
+}
+
+struct Tuple9709(T...)
+{
+    alias T expand;
+    alias expand this;
+}
+
+void test8735()
+{
+    alias S8735!1 S;
+    S s;
+    int n = s;
+    assert(n == 1);
+
+    // 11502 case
+    static void f(int i);
+    S8735!f sf;
+
+    // 9709 case
+    alias A = Tuple9709!(1,int,"foo");
+    A a;
+    //static assert(A[0] == 1);
+    static assert(a[0] == 1);
+    //static assert(is(A[1] == int));
+    //static assert(is(a[1] == int));
+    //static assert(A[2] == "foo");
+    static assert(a[2] == "foo");
+}
+
+/***************************************************/
+// 9174
+
+void test9174()
+{
+    static struct Foo
+    {
+        char x;
+        alias x this;
+    }
+    static assert(is(typeof(true ? 'A' : Foo()) == char));
+    static assert(is(typeof(true ? Foo() : 100) == int));
+}
+
+/***************************************************/
+// 9177
+
+struct S9177
+{
+    int foo(int){ return 0; }
+    alias foo this;
+}
+pragma(msg, is(S9177 : int));
+
+/***************************************************/
+// 9858
+
+struct S9858()
+{
+    @property int get() const
+    {
+        return 42;
+    }
+    alias get this;
+    void opAssign(int) {}
+}
+void test9858()
+{
+    const S9858!() s;
+    int i = s;
+}
+
+/***************************************************/
+// 9873
+
+void test9873()
+{
+    struct Tup(T...) { T field; alias field this; }
+
+    auto seq1 = Seq!(1, "hi");
+    assert(Seq!(1, "hi") == Seq!(1, "hi"));
+    assert(seq1          == Seq!(1, "hi"));
+    assert(Seq!(1, "hi") == seq1);
+    assert(seq1          == seq1);
+
+    auto seq2 = Seq!(2, "hi");
+    assert(Seq!(1, "hi") != Seq!(2, "hi"));
+    assert(seq2          != Seq!(1, "hi"));
+    assert(Seq!(1, "hi") != seq2);
+    assert(seq2          != seq1);
+
+    auto tup1 = Tup!(int, string)(1, "hi");
+    assert(Seq!(1, "hi") == tup1);
+    assert(seq1          == tup1);
+    assert(tup1          == Seq!(1, "hi"));
+    assert(tup1          == seq1);
+
+    auto tup2 = Tup!(int, string)(2, "hi");
+    assert(Seq!(1, "hi") != tup2);
+    assert(seq1          != tup2);
+    assert(tup2          != Seq!(1, "hi"));
+    assert(tup2          != seq1);
+
+    static assert(!__traits(compiles, seq1 == Seq!(1, "hi", [1,2])));
+    static assert(!__traits(compiles, tup1 == Seq!(1, "hi", [1,2])));
+}
+
+/***************************************************/
+// 10178
+
+void test10178()
+{
+    struct S { static int count; }
+    S s;
+    assert((s.tupleof == s.tupleof) == true);
+    assert((s.tupleof != s.tupleof) == false);
+
+    S getS()
+    {
+        S s;
+        ++S.count;
+        return s;
+    }
+    assert(getS().tupleof == getS().tupleof);
+    assert(S.count == 2);
+}
+
+/***************************************************/
+// 10179
+
+void test10179()
+{
+    struct S { static int count; }
+    S s;
+    static assert(s.tupleof.length == 0);
+    s.tupleof = s.tupleof;   // error -> OK
+
+    S getS()
+    {
+        S s;
+        ++S.count;
+        return s;
+    }
+    getS().tupleof = getS().tupleof;
+    assert(S.count == 2);
+}
+
+/***************************************************/
+// 9890
+
+void test9890()
+{
+    struct RefCounted(T)
+    {
+        T _payload;
+
+        ref T refCountedPayload()
+        {
+            return _payload;
+        }
+
+        alias refCountedPayload this;
+    }
+
+    struct S(int x_)
+    {
+        alias x_ x;
+    }
+
+    alias RefCounted!(S!1) Rs;
+    static assert(Rs.x == 1);
+}
+
+/***************************************************/
+// 10004
+
+void test10004()
+{
+    static int count = 0;
+
+    static S make(S)()
+    {
+        ++count;    // necessary to make this function impure
+        S s;
+        return s;
+    }
+
+    struct SX(T...) {
+        T field; alias field this;
+    }
+    alias S = SX!(int, long);
+    assert(make!S.field == make!S.field);
+    assert(count == 2);
+}
+
+/***************************************************/
+// 10180
+
+template TypeTuple10180(TL...) { alias TypeTuple10180 = TL; }
+
+template Identity10180(alias T) { alias Identity10180 = T; }
+
+struct Tuple10180(Specs...)
+{
+    static if (is(Specs))
+    {
+        alias Types = Specs;
+        Types expand;
+        alias expand this;
+    }
+    else
+    {
+        alias Types = TypeTuple10180!(Specs[0]);
+        Types expand;
+        mixin("alias Identity10180!(expand[0]) "~Specs[1]~";");
+
+        @property
+        ref Tuple10180!(Specs[0]) _Tuple_super()
+        {
+            return *cast(typeof(return)*) (&expand[0]);
+        }
+        alias _Tuple_super this;
+    }
+}
+
+void test10180()
+{
+    Tuple10180!(int, "a") x;
+    auto o1 = x.a.offsetof;     // OK
+    auto o2 = x[0].offsetof;    // NG: no property 'offsetof' for type 'int'
+    auto o3 = x._Tuple_super[0].offsetof;   // same as above
+    assert(o2 == o3);
+}
+
+/***************************************************/
+// 10456
+
+void test10456()
+{
+    S10456 s1, s2;
+    auto x = s1 == s2;
+}
+
+struct S10456
+{
+    enum E { e };
+    alias E this;
+    int[] x;
+}
+
+/***************************************************/
+// 11261
+
+template Tuple11261(Specs...)
+{
+    struct Tuple11261
+    {
+        static if (Specs.length != 4)   // anonymous field version
+        {
+            alias Specs Types;
+            Types expand;
+            alias expand this;
+        }
+        else
+        {
+            alias Seq!(Specs[0], Specs[2]) Types;
+            Types expand;
+            ref inout(Tuple11261!Types) _Tuple_super() inout @trusted
+            {
+                return *cast(typeof(return)*) &(expand[0]);
+            }
+            // This is mostly to make t[n] work.
+            alias _Tuple_super this;
+        }
+
+        this()(Types values)
+        {
+            expand[] = values[];
+        }
+    }
+}
+
+interface InputRange11261(E)
+{
+    @property bool empty();
+    @property E front();
+    void popFront();
+
+    int opApply(int delegate(E));
+    int opApply(int delegate(size_t, E));
+
+}
+template InputRangeObject11261(R)
+{
+    alias typeof(R.init.front()) E;
+
+    class InputRangeObject11261 : InputRange11261!E
+    {
+        private R _range;
+
+        this(R range) { this._range = range; }
+
+        @property bool empty() { return _range.empty; }
+        @property E front() { return _range.front; }
+        void popFront() { _range.popFront(); }
+
+        int opApply(int delegate(E) dg) { return 0; }
+        int opApply(int delegate(size_t, E) dg) { return 0; }
+    }
+}
+
+// ------
+
+class Container11261
+{
+    alias Tuple11261!(string, "key", string, "value") Key;
+
+    InputRange11261!Key opSlice()
+    {
+        Range r;
+        return new InputRangeObject11261!Range(r);
+    }
+    private struct Range
+    {
+        enum empty = false;
+        auto popFront() {}
+        auto front() { return Key("myKey", "myValue"); }
+    }
+}
+
+void test11261()
+{
+    auto container = new Container11261();
+    foreach (k, v; container)   // map the tuple of container[].front to (k, v)
+    {
+        static assert(is(typeof(k) == string) && is(typeof(v) == string));
+        break;
+    }
+}
+
+/***************************************************/
+// 11333
+
+alias id11333(a...) = a;
+
+struct Unit11333
+{
+    enum value = Unit11333.init.tupleof;
+    alias value this;
+}
+
+void test11333()
+{
+    void foo() {}
+
+    id11333!() unit;
+    unit = unit; // ok
+    foo(unit);   // ok
+
+    unit = Unit11333.value; // ok
+    foo(Unit11333.value);   // ok
+
+    Unit11333 unit2;
+    unit = unit2; // ok <- segfault
+}
+
+/***************************************************/
+// 11800
+
+struct A11800
+{
+    B11800 b;
+    alias b this;
+}
+
+struct B11800
+{
+    static struct Value {}
+    Value value;
+    alias value this;
+
+    void foo(ref const B11800 rhs)
+    {
+    }
+}
+
+void test11800()
+{
+    A11800 a;
+    B11800 b;
+    b.foo(a);
+}
+
+/***************************************************/
+// 12008
+
+struct RefCounted12008(T)
+{
+    struct RefCountedStore
+    {
+        private struct Impl
+        {
+            T _payload;
+        }
+
+        private void initialize(A...)(auto ref A args)
+        {
+            import core.memory;
+        }
+
+        void ensureInitialized()
+        {
+            initialize();
+        }
+
+    }
+    RefCountedStore _refCounted;
+
+    void opAssign(T rhs)
+    {
+    }
+
+    int refCountedPayload()
+    {
+        _refCounted.ensureInitialized();
+        return 0;
+    }
+
+    int refCountedPayload() inout
+    {
+        return 0;
+    }
+
+    alias refCountedPayload this;
+}
+
+struct SharedInput12008
+{
+    Group12008 unused;
+}
+
+struct Group12008
+{
+    RefCounted12008!SharedInput12008 _allGroups;
+}
+
+/***************************************************/
+// 12038
+
+bool f12038(void* p) { return true; }
+
+struct S12038
+{
+    @property p() { f12038(&this); }
+    alias p this;
+}
+
+/***************************************************/
+// 13490
+
+struct S13490
+{
+    int i;
+    alias i this;
+}
+
+struct T13490
+{
+    S13490[] a1, a2;
+}
+
+void test13490()
+{
+    T13490 t;
+
+    (true ? t.a1 : t.a2) ~= S13490(1);
+    assert(t.a1 == [S13490(1)]);
+    assert(t.a2 == []);
+
+    (false ? t.a1 : t.a2) ~= S13490(2);
+    assert(t.a1 == [S13490(1)]);
+    assert(t.a2 == [S13490(2)]);
+}
+
+/***************************************************/
+// 11355
+
+struct A11355
+{
+    static int postblit;
+    this(this) { ++postblit; }
+}
+
+struct B11355
+{
+    A11355 a;
+    alias a this;
+}
+
+B11355 make11355()
+{
+    return B11355();
+}
+void test11355()
+{
+    A11355 a1 = make11355();
+    assert(A11355.postblit == 1);
+}
+
+/***************************************************/
+// 13009
+
+struct T13009
+{
+    void put(char c) {}
+}
+
+struct S13009(bool rev)
+{
+    T13009 t;
+
+    static if (!rev)
+    {
+        @property       T13009  getT()       { return t; }
+        @property inout(T13009) getT() inout { return t; }
+    }
+    else
+    {
+        @property inout(T13009) getT() inout { return t; }
+        @property       T13009  getT()       { return t; }
+    }
+
+    alias getT this;
+}
+
+void test13009()
+{
+    foreach (bool rev; Seq!(false, true))
+    {
+        alias S = S13009!rev;
+
+        alias MS   =                    S;
+        alias CS   =              const(S);
+        alias WS   =        inout(      S);
+        alias WCS  =        inout(const S);
+        alias SMS  = shared(            S);
+        alias SCS  = shared(      const S);
+        alias SWS  = shared(inout       S);
+        alias SWCS = shared(inout const S);
+        alias IS   =          immutable(S);
+
+        alias MSput  = MS .put;
+        alias CSput  = CS .put;
+        alias WSput  = WS .put;
+        alias WCSput = WCS.put;
+        static assert(!__traits(compiles, { alias SMSput  = SMS .put; }));
+        static assert(!__traits(compiles, { alias SCSput  = SCS .put; }));
+        static assert(!__traits(compiles, { alias SWSput  = SWS .put; }));
+        static assert(!__traits(compiles, { alias SWCSput = SWCS.put; }));
+        alias ISput  = IS .put;
+    }
+}
+
+/***************************************************/
+// 14806
+
+struct Nullable14806
+{
+    float get() { return float.nan; }
+    alias get this;
+}
+
+struct Foo14806(T)
+{
+    T bar;
+    Nullable14806 baz;
+}
+
+void test14806()
+{
+    Foo14806!int a, b;
+    assert(a != b);
+    // ==> a.tupleof != b.tupleof
+    // ==> a.bar != b.bar || a.baz.get() != b.baz.get()
+
+    Foo14806!string c, d;
+    assert(c != d);
+    // ==> c.tupleof != d.tupleof
+    // ==> c.bar != d.bar || c.baz.get() != d.baz.get()
+}
+
+/***************************************************/
+// 14948
+
+struct RefCounted14948(T)
+{
+    struct Impl
+    {
+        T data;
+    }
+    Impl* impl;
+
+    @property ref T payload() { return impl.data; }
+
+    alias payload this;
+}
+
+struct HTTP14948
+{
+    struct Impl
+    {
+    }
+
+    RefCounted14948!Impl p;
+}
+
+void test14948()
+{
+    int[HTTP14948] aa;
+}
+
+/***************************************************/
+// 15292
+
+struct NullableRef15292(T)
+{
+    inout(T) get() inout
+    {
+        assert(false);
+    }
+
+    alias get this;
+}
+
+struct S15292
+{
+    NullableRef15292!S15292 n;  // -> no segfault
+
+    /* The field 'n' contains alias this, so to use it for the equality,
+     * following helper function is automatically generated in buildXopEquals().
+     *
+     *  static bool __xopEquals(ref const S15292 p, ref const S15292 q)
+     *  {
+     *      return p == q;
+     *  }
+     *
+     * In its definition, const(S15292) equality is analyzed. It fails, then
+     * the error is gagged.
+     */
+}
+
+/***************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test4617a();
+    test4617b();
+    test4773();
+    test5188();
+    test6();
+    test7();
+    test2781();
+    test6546();
+    test6736();
+    test2777a();
+    test2777b();
+    test5679();
+    test6508();
+    test6508x();
+    test6369a();
+    test6369b();
+    test6369c();
+    test6369d();
+    test6434();
+    test6366();
+    test6711();
+    test12161();
+    test6759();
+    test6832();
+    test6928();
+    test6929();
+    test7136();
+    test7731();
+    test7808();
+    test7945();
+    test15674();
+    test7992();
+    test8169();
+    test8735();
+    test9174();
+    test9858();
+    test9873();
+    test10178();
+    test10179();
+    test9890();
+    test10004();
+    test10180();
+    test10456();
+    test11333();
+    test11800();
+    test13490();
+    test11355();
+    test14806();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/argufilem.d b/gcc/testsuite/gdc.test/runnable/argufilem.d
new file mode 100644
index 00000000000..44d627005cc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/argufilem.d
@@ -0,0 +1,22 @@
+// EXTRA_SOURCES: imports/argufile.d
+
+// NOTE: The bug only works when main.d and argufile.d are put in
+//                      separate files and compiled like 'dmd main.d argufile.d'
+//                      Also, I'm sure writefln is causing the crash cause when I
+//                      use printf(), it doesn't crash.
+
+// main.d -------------------------------------------------------
+
+import argufile;
+
+int main(string[] args)
+{
+        string message = arguments("bob is ", 7, " years old");
+
+        writefln(message);
+
+        argufile.useargs(); // will crash here
+
+        return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/arrayop.d b/gcc/testsuite/gdc.test/runnable/arrayop.d
new file mode 100644
index 00000000000..f761b9ba77a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/arrayop.d
@@ -0,0 +1,950 @@
+import std.math;
+
+extern(C) int printf(const char*, ...);
+
+string abc;
+
+template Floating(T)
+{
+    T[3] a;
+    T[3] b;
+    T[3] c;
+
+    T[] A()
+    {
+        printf("A\n");
+        abc ~= "A";
+        return a;
+    }
+
+    T[] B()
+    {
+        printf("B\n");
+        abc ~= "B";
+        return b;
+    }
+
+    T[] C()
+    {
+        printf("C\n");
+        abc ~= "C";
+        return c;
+    }
+
+    T D()
+    {
+        printf("D\n");
+        abc ~= "D";
+        return 4;
+    }
+
+
+    void testx()
+    {
+        a = [11, 22, 33];
+        b = [1, 2, 3];
+        c = [4, 5, 6];
+
+        abc = null;
+        A()[] = B()[] + C()[];
+        assert(abc == "BCA");
+        assert(a[0] == 5);
+        assert(a[1] == 7);
+        assert(a[2] == 9);
+
+        abc = null;
+        A()[] = B()[] + 4;
+        assert(abc == "BA");
+        assert(a[0] == 5);
+        assert(a[1] == 6);
+        assert(a[2] == 7);
+
+        abc = null;
+        A()[] = 4 + B()[];
+        assert(abc == "BA");
+        assert(a[0] == 5);
+        assert(a[1] == 6);
+        assert(a[2] == 7);
+
+        abc = null;
+        A()[] = D() + B()[];
+        assert(abc == "DBA");
+        assert(a[0] == 5);
+        assert(a[1] == 6);
+        assert(a[2] == 7);
+
+        a = [11, 22, 33];
+        abc = null;
+        A()[] += B()[];
+        assert(abc == "BA");
+        assert(a[0] == 12);
+        assert(a[1] == 24);
+        assert(a[2] == 36);
+
+        a = [11, 22, 33];
+        A()[] += 4;
+        assert(a[0] == 15);
+        assert(a[1] == 26);
+        assert(a[2] == 37);
+
+        a = [11, 22, 33];
+        A()[] -= 4;
+        assert(a[0] == 7);
+        assert(a[1] == 18);
+        assert(a[2] == 29);
+
+        a = [11, 22, 33];
+        A()[] *= 4;
+        assert(a[0] == 44);
+        assert(a[1] == 88);
+        assert(a[2] == 132);
+
+        a = [4, 8, 32];
+        A()[] /= 4;
+        assert(a[0] == 1);
+        assert(a[1] == 2);
+        assert(a[2] == 8);
+
+        a = [4, 8, 33];
+        A()[] %= 4;
+        assert(a[0] == 0);
+        assert(a[1] == 0);
+        assert(a[2] == 1);
+
+        a = [11, 22, 33];
+        abc = null;
+        A()[] += 4 + B()[];
+        assert(abc == "BA");
+        assert(a[0] == 16);
+        assert(a[1] == 28);
+        assert(a[2] == 40);
+
+        abc = null;
+        A()[] = B()[] - C()[];
+        assert(abc == "BCA");
+        printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]);
+        assert(a[0] == -3);
+        assert(a[1] == -3);
+        assert(a[2] == -3);
+
+        abc = null;
+        A()[] = -B()[] - C()[];
+        assert(abc == "BCA");
+        printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]);
+        assert(a[0] == -5);
+        assert(a[1] == -7);
+        assert(a[2] == -9);
+
+        abc = null;
+        A()[] = B()[] + C()[] * 4;
+        assert(abc == "BCA");
+        printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]);
+        assert(a[0] == 17);
+        assert(a[1] == 22);
+        assert(a[2] == 27);
+
+        abc = null;
+        A()[] = B()[] + C()[] * B()[];
+        assert(abc == "BCBA");
+        printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]);
+        assert(a[0] == 5);
+        assert(a[1] == 12);
+        assert(a[2] == 21);
+
+        abc = null;
+        A()[] = B()[] + C()[] / 2;
+        assert(abc == "BCA");
+        printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]);
+        assert(a[0] == 3);
+        assert(a[1] == 4.5);
+        assert(a[2] == 6);
+
+        abc = null;
+        A()[] = B()[] + C()[] % 2;
+        assert(abc == "BCA");
+        printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]);
+        assert(a[0] == 1);
+        assert(a[1] == 3);
+        assert(a[2] == 3);
+    }
+}
+
+mixin Floating!(float) Ffloat;
+mixin Floating!(double) Fdouble;
+mixin Floating!(real) Freal;
+
+void test1()
+{
+    Ffloat.testx();
+    Fdouble.testx();
+    Freal.testx();
+}
+
+/************************************************************************/
+
+template Integral(T)
+{
+    T[3] a;
+    T[3] b;
+    T[3] c;
+
+    T[] A()
+    {
+        printf("A\n");
+        abc ~= "A";
+        return a;
+    }
+
+    T[] B()
+    {
+        printf("B\n");
+        abc ~= "B";
+        return b;
+    }
+
+    T[] C()
+    {
+        printf("C\n");
+        abc ~= "C";
+        return c;
+    }
+
+    T D()
+    {
+        printf("D\n");
+        abc ~= "D";
+        return 4;
+    }
+
+
+    void testx()
+    {
+        a = [11, 22, 33];
+        b = [1, 2, 3];
+        c = [4, 5, 6];
+
+        abc = null;
+        A()[] = B()[] + C()[];
+        assert(abc == "BCA");
+        assert(a[0] == 5);
+        assert(a[1] == 7);
+        assert(a[2] == 9);
+
+        abc = null;
+        A()[] = B()[] + 4;
+        assert(abc == "BA");
+        assert(a[0] == 5);
+        assert(a[1] == 6);
+        assert(a[2] == 7);
+
+        abc = null;
+        A()[] = 4 + B()[];
+        assert(abc == "BA");
+        assert(a[0] == 5);
+        assert(a[1] == 6);
+        assert(a[2] == 7);
+
+        abc = null;
+        A()[] = D() + B()[];
+        assert(abc == "DBA");
+        assert(a[0] == 5);
+        assert(a[1] == 6);
+        assert(a[2] == 7);
+
+        a = [11, 22, 33];
+        abc = null;
+        A()[] += B()[];
+        assert(abc == "BA");
+        assert(a[0] == 12);
+        assert(a[1] == 24);
+        assert(a[2] == 36);
+
+        a = [11, 22, 33];
+        A()[] += 4;
+        assert(a[0] == 15);
+        assert(a[1] == 26);
+        assert(a[2] == 37);
+
+        a = [11, 22, 33];
+        A()[] -= 4;
+        assert(a[0] == 7);
+        assert(a[1] == 18);
+        assert(a[2] == 29);
+
+        a = [11, 22, 27];
+        A()[] *= 4;
+        assert(a[0] == 44);
+        assert(a[1] == 88);
+        assert(a[2] == 108);
+
+        a = [11, 22, 33];
+        A()[] /= 4;
+        assert(a[0] == 2);
+        assert(a[1] == 5);
+        assert(a[2] == 8);
+
+        a = [11, 22, 33];
+        A()[] %= 4;
+        assert(a[0] == 3);
+        assert(a[1] == 2);
+        assert(a[2] == 1);
+
+        a = [1, 2, 7];
+        A()[] &= 4;
+        assert(a[0] == 0);
+        assert(a[1] == 0);
+        assert(a[2] == 4);
+
+        a = [1, 2, 7];
+        A()[] |= 4;
+        assert(a[0] == 5);
+        assert(a[1] == 6);
+        assert(a[2] == 7);
+
+        a = [1, 2, 7];
+        A()[] ^= 4;
+        assert(a[0] == 5);
+        assert(a[1] == 6);
+        assert(a[2] == 3);
+
+        a = [11, 22, 33];
+        abc = null;
+        A()[] += 4 + B()[];
+        assert(abc == "BA");
+        assert(a[0] == 16);
+        assert(a[1] == 28);
+        assert(a[2] == 40);
+
+        abc = null;
+        A()[] = B()[] - C()[];
+        assert(abc == "BCA");
+        printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]);
+        assert(a[0] == -3);
+        assert(a[1] == -3);
+        assert(a[2] == -3);
+
+        abc = null;
+        A()[] = -B()[] - C()[];
+        assert(abc == "BCA");
+        printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]);
+        assert(a[0] == -5);
+        assert(a[1] == -7);
+        assert(a[2] == -9);
+
+        abc = null;
+        A()[] = B()[] + C()[] * 4;
+        assert(abc == "BCA");
+        printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]);
+        assert(a[0] == 17);
+        assert(a[1] == 22);
+        assert(a[2] == 27);
+
+        abc = null;
+        A()[] = B()[] + C()[] * B()[];
+        assert(abc == "BCBA");
+        printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]);
+        assert(a[0] == 5);
+        assert(a[1] == 12);
+        assert(a[2] == 21);
+
+        abc = null;
+        A()[] = B()[] + C()[] / 2;
+        assert(abc == "BCA");
+        printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]);
+        assert(a[0] == 3);
+        assert(a[1] == 4);
+        assert(a[2] == 6);
+
+        abc = null;
+        A()[] = B()[] + C()[] % 2;
+        assert(abc == "BCA");
+        printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]);
+        assert(a[0] == 1);
+        assert(a[1] == 3);
+        assert(a[2] == 3);
+
+        abc = null;
+        A()[] = ~B()[];
+        assert(abc == "BA");
+        assert(a[0] == ~cast(T)1);
+        assert(a[1] == ~cast(T)2);
+        assert(a[2] == ~cast(T)3);
+
+        abc = null;
+        A()[] = B()[] & 2;
+        assert(abc == "BA");
+        assert(a[0] == 0);
+        assert(a[1] == 2);
+        assert(a[2] == 2);
+
+        abc = null;
+        A()[] = B()[] | 2;
+        assert(abc == "BA");
+        assert(a[0] == 3);
+        assert(a[1] == 2);
+        assert(a[2] == 3);
+
+        abc = null;
+        A()[] = B()[] ^ 2;
+        assert(abc == "BA");
+        assert(a[0] == 3);
+        assert(a[1] == 0);
+        assert(a[2] == 1);
+    }
+}
+
+/************************************************************************/
+
+mixin Integral!(byte) Fbyte;
+mixin Integral!(short) Fshort;
+mixin Integral!(int) Fint;
+mixin Integral!(long) Flong;
+
+void test2()
+{
+    Fbyte.testx();
+    Fshort.testx();
+    Fint.testx();
+    Flong.testx();
+}
+
+/************************************************************************/
+
+void test3()
+{
+    auto a = new double[10], b = a.dup, c = a.dup, d = a.dup;
+    a[] = -(b[] * (c[] + 4)) + 5 * d[] / 3.0;
+}
+
+/************************************************************************/
+
+void test4()
+{
+    int[] a, b;
+    if (a && b) {}
+}
+
+/***************************************************/
+
+void test4662()
+{
+    immutable double[] nums = [1.0, 2.0];
+
+    static assert(!is(typeof({ nums[] += nums[]; })));
+    static assert(!is(typeof({ nums[] -= nums[]; })));
+    static assert(!is(typeof({ nums[] /= nums[]; })));
+    static assert(!is(typeof({ nums[] += 4; })));
+    static assert(!is(typeof({ nums[] /= 7; })));
+}
+
+/***************************************************/
+// 5284
+
+void bug5284_1()
+{
+    class C { int v; }
+
+              C [] mda;
+    immutable(C)[] ida;
+    static assert(!__traits(compiles, (mda[] = ida[])));
+
+              C [1] msa;
+    immutable(C)[1] isa;
+    static assert(!__traits(compiles, (msa[] = isa[])));
+
+              C  m;
+    immutable(C) i;
+    static assert(!__traits(compiles, m = i));
+}
+void bug5284_2a()
+{
+    struct S { int v; }
+
+              S [] mda;
+    immutable(S)[] ida;
+    mda[] = ida[];
+
+              S [1] msa;
+    immutable(S)[1] isa;
+    msa[] = isa[];
+
+              S  m = S();
+    immutable(S) i = immutable(S)();
+    m = i;
+}
+void bug5284_2b()
+{
+    struct S { int v; int[] arr; }
+
+              S [] mda;
+    immutable(S)[] ida;
+    static assert(!__traits(compiles, (mda[] = ida[])));
+
+              S [1] msa;
+    immutable(S)[1] isa;
+    static assert(!__traits(compiles, (msa[] = isa[])));
+
+              S  m;
+    immutable(S) i;
+    static assert(!__traits(compiles, m = i));
+}
+void bug5284_3()
+{
+              int [] ma;
+    immutable(int)[] ia;
+    ma[] = ia[];
+
+    int m;
+    immutable(int) i;
+    m = i;
+}
+
+void test5()
+{
+    bug5284_1();
+    bug5284_2a();
+    bug5284_2b();
+    bug5284_3();
+}
+
+/************************************************************************/
+
+void test6()
+{
+    int[10] a = [1,2,3,4,5,6,7,8,9,10];
+    int[10] b;
+
+    b = a[] ^^ 2;
+    assert(b[0] == 1);
+    assert(b[1] == 4);
+    assert(b[2] == 9);
+    assert(b[3] == 16);
+    assert(b[4] == 25);
+    assert(b[5] == 36);
+    assert(b[6] == 49);
+    assert(b[7] == 64);
+    assert(b[8] == 81);
+    assert(b[9] == 100);
+
+    int[10] c = 3;
+    b = a[] ^^ c[];
+    assert(b[0] == 1);
+    assert(b[1] == 8);
+    assert(b[2] == 27);
+    assert(b[3] == 64);
+    assert(b[4] == 125);
+    assert(b[5] == 216);
+    assert(b[6] == 343);
+    assert(b[7] == 512);
+    assert(b[8] == 729);
+    assert(b[9] == 1000);
+}
+
+/************************************************************************/
+
+void test8390() {
+    const int[] a = new int[5];
+    int[] b = new int[5];
+    b[] += a[];
+}
+
+/************************************************************************/
+// 8651
+
+void test8651()
+{
+    void test(T)() @safe pure nothrow
+    {
+        T[3] a = [11, 22, 33];
+        T[3] b = [1, 2, 3];
+        T[3] c = [4, 5, 6];
+        T    d = 4;
+
+        // Arithmetic array ops
+        {
+            a[] = b[] + c[];
+            a[] = b[] + 4;
+            a[] = 4 + b[];
+            a[] = d + b[];
+            a[] += b[];
+            a[] += 4;
+            a[] -= 4;
+            a[] *= 4;
+            a[] /= 4;
+            a[] %= 4;
+            a[] += 4 + b[];
+            a[] = b[] - c[];
+            a[] = -b[] - c[];
+            a[] = b[] + c[] * 4;
+            a[] = b[] + c[] * b[];
+            a[] = b[] + c[] / 2;
+            a[] = b[] + c[] % 2;
+        }
+        // Bitwise array ops
+        static if (is(typeof(T.init & T.init)))
+        {
+            a[] &= 4;
+            a[] |= 4;
+            a[] ^= 4;
+            a[] = ~b[];
+            a[] = b[] & 2;
+            a[] = b[] | 2;
+            a[] = b[] ^ 2;
+        }
+    }
+
+    test!float();
+    test!double();
+    test!real();
+
+    test!byte();
+    test!short();
+    test!int();
+    test!long();
+}
+
+/************************************************************************/
+// 9656
+
+void test9656()
+{
+    static class C {}
+    static struct S
+    {
+        immutable int[] narr1;
+        immutable int[] narr2;
+        immutable C[] carr1;
+        immutable C[] carr2;
+        this(int n) {
+            narr1 = new int[](3); // OK, expected
+            narr2 = [1,2,3].dup;  // NG -> OK
+            carr1 = [new C].dup;  // NG -> OK
+
+            C c = new C;
+            static assert(!__traits(compiles, carr2 = [c]));
+        }
+    }
+
+    {
+        int[] ma = [1,2,3];
+        immutable ia = ma.dup;
+    }
+
+
+    {
+        static struct V { int val; }
+        V[] ma = [V(1), V(2)];
+        immutable ia = ma.dup;
+    }
+
+    {
+        static struct R { int* ptr; }
+        R[] ma = [R(new int), R(null)];
+        static assert(!__traits(compiles, { immutable ia = rarr.dup; }));
+    }
+
+    {
+        C[] ma = [new C(), new C()];
+        static assert(!__traits(compiles, { immutable ia = carr.dup; }));
+    }
+}
+
+/************************************************************************/
+// 10282
+
+void test10282()
+{
+    int[3]           a1 = [1, 3, 6];
+    int[3]           a2 = [1, 3, 6] * 3;    // OK
+    const     int[3] a3 = a1[] * 3;         // OK <- Error
+    const     int[3] a4 = [1, 3, 6] * 3;    // OK <- Error
+    immutable int[3] a5 = [1, 3, 6] * 3;    // OK <- Error
+}
+
+/************************************************************************/
+// 10433
+
+void test10433()
+{
+    void foo(T)(in int[] v1, in T v2)
+    {
+        int[2] r;
+        r[] = v1[] + v2[];
+    }
+
+    immutable int[] v = [10, 20];
+    foo(v, v);
+}
+
+/************************************************************************/
+// 10684
+
+void test10684a()
+{
+    int[] a = [0, 0];
+    a[] += [10, 20][];
+}
+
+void test10684b()
+{
+    int[] a = [1, 2, 3];
+    int[] b = [4, 5, 6];
+
+    // Allow array literal as the operand of array oeration
+    a[] += [1, 2, 3];
+    assert(a == [2, 4, 6]);
+
+    a[] *= b[] + [1, 1, 1];
+    assert(a == [2*(4+1), 4*(5+1), 6*(6+1)]);
+
+    a[] = [9, 8, 7] - [1, 2, 3];
+    assert(a == [8, 6, 4]);
+
+    a[] = [2, 4, 6] / 2;
+    assert(a == [1,2,3]);
+
+    // Disallow: [1,2,3] is not an lvalue
+    static assert(!__traits(compiles, { [1,2,3] = a[] * 2; }));
+    static assert(!__traits(compiles, { [1,2,3] += a[] * b[]; }));
+}
+
+/************************************************************************/
+// 11376
+
+template TL11376(T...)
+{
+    alias TL11376 = T;
+}
+
+auto sumArrs11376(T0, T1)(T0[] a, T1[] b)
+{
+    a[] += b[]; //no ICE without this line
+    return a;
+}
+
+static assert(!__traits(compiles, sumArrs11376(TL11376!(string[], string).init)));
+
+/************************************************************************/
+// 11525
+
+void test11525()
+{
+    static struct Complex(T)
+    {
+        T re, im;
+
+        ref opOpAssign(string op : "*")(Complex z)
+        {
+            auto temp = re*z.re - im*z.im;
+            im = im*z.re + re*z.im;
+            re = temp;
+            return this;
+        }
+    }
+
+    auto a = [Complex!double(2, 2)];
+    assert(a.length == 1 && a[0].re == 2 && a[0].im == 2);
+    a[] *= a[];
+    assert(a.length == 1 && a[0].re == 0 && a[0].im == 8);
+}
+
+/************************************************************************/
+// 12250
+
+void f12250(inout int[] p, inout int[] q, int[] r)
+{
+    r[] = p[] + q[];
+    assert(r == [5,7,9]);
+    r[] -= p[] - q[];
+    assert(r == [8,10,12]);
+}
+
+void test12250()
+{
+    immutable int[3] x = [1,2,3], y = [4,5,6];
+    int[3] z;
+    f12250(x[], y[], z[]);
+}
+
+/************************************************************************/
+// 12179
+
+void test12179()
+{
+    void foo(int[]) {}
+    int[1] a;
+
+    foo(a[] = a[]);
+    foo(a[] += a[]);
+    foo(a[] -= a[]);
+    foo(a[] *= a[]);
+    foo(a[] /= a[]);
+    foo(a[] %= a[]);
+    foo(a[] ^= a[]);
+    foo(a[] &= a[]);
+    foo(a[] |= a[]);
+    foo(a[] ^^= a[]);
+
+    // from issue 11992
+    int[]   arr1;
+    int[][] arr2;
+    arr1 ~= (a[] = [1] + a[]); // OK
+    arr2 ~= (a[] = [1] + a[]); // OK
+}
+
+/************************************************************************/
+// 12780
+
+void test12780()
+{
+    int ival = 2;
+    int[] iarr = [1, 2, 3];
+    double dval = 2.0;
+    double[] darr = [4, 5, 6];
+
+    double[] oarr = [0, 0, 0];
+
+    // multiply array operations
+    oarr[] = dval * iarr[];
+    assert(oarr == [dval * iarr[0],
+                    dval * iarr[1],
+                    dval * iarr[2]]);
+
+    oarr[] = iarr[] / dval;
+    assert(oarr == [iarr[0] / dval,
+                    iarr[1] / dval,
+                    iarr[2] / dval]);
+
+    oarr[] = dval * (ival + iarr[]);
+    assert(oarr == [dval * (ival + iarr[0]),
+                    dval * (ival + iarr[1]),
+                    dval * (ival + iarr[2])]);
+
+    oarr[] = (iarr[] & ival) / dval;
+    assert(oarr == [(iarr[0] & ival) / dval,
+                    (iarr[1] & ival) / dval,
+                    (iarr[2] & ival) / dval]);
+
+    oarr[] = darr[] + iarr[];
+    assert(oarr == [darr[0] + iarr[0],
+                    darr[1] + iarr[1],
+                    darr[2] + iarr[2]]);
+
+    oarr[] = iarr[] - darr[];
+    assert(oarr == [iarr[0] - darr[0],
+                    iarr[1] - darr[1],
+                    iarr[2] - darr[2]]);
+
+    oarr[] = darr[] * (ival & iarr[]);
+    assert(oarr == [darr[0] * (ival & iarr[0]),
+                    darr[1] * (ival & iarr[1]),
+                    darr[2] * (ival & iarr[2])]);
+
+    oarr[] = (iarr[] ^ ival) / darr[];
+    assert(oarr == [(iarr[0] ^ ival) / darr[0],
+                    (iarr[1] ^ ival) / darr[1],
+                    (iarr[2] ^ ival) / darr[2]]);
+}
+
+/************************************************************************/
+// 13497
+
+void test13497()
+{
+    int[1] a = [2], b = [3];
+    int[1] c1 =  a[] * b[];
+    int[1] c2 = (a[] * b[])[];
+    assert(c1 == [6]);
+    assert(c2 == [6]);
+}
+
+/************************************************************************/
+// 14649
+
+void test14649()
+{
+    char[] a = "abc".dup;
+    char[] b = [char(1), char(2), char(3)];
+    string x = "abc";
+    string y = [char(1), char(2), char(3)];
+    char[] r = new char[](3);
+
+    r[] = a[] + b[];
+    assert(r == "bdf");
+
+    r[] = x[] + y[];
+    assert(r == "bdf");
+
+    r[] = "hel"[] + "lo."[];
+    assert(r == [('h'+'l'), ('e'+'o'), ('l'+'.')]);
+
+    enum s = "abc";
+    r[] = s[0..3] + "def"[0..3];
+    assert(r == [('a'+'d'), ('b'+'e'), ('c'+'f')]);
+}
+
+/************************************************************************/
+// 14851
+
+void test14851()
+{
+    int[8] a, b, c;
+
+    c   = a[] | b[];    // OK <- NG from 2.068.0-b2
+    c   = a[] ^ b[];    // OK <- NG from 2.068.0-b2
+
+    c[] = a[] | b[];    // OK
+    c[] = a[] ^ b[];    // OK
+}
+
+/************************************************************************/
+
+int main()
+{
+    version(X86)
+    {
+        test1();
+        test2();
+    }
+    else version(X86_64)
+    {
+        test1();
+        test2();
+    }
+    else
+    {
+        pragma(msg, "arrayop.d:test1 Test skipped because arrayop evaluation"
+                    " order is ill-defined. See GDC issue #8");
+    }
+    test3();
+    test4();
+    test5();
+    test6();
+    test8390();
+    test8651();
+    test9656();
+    test10282();
+    test10433();
+    test10684a();
+    test10684b();
+    test11525();
+    test12250();
+    test12780();
+    test13497();
+    test14649();
+    test14851();
+
+    printf("Success\n");
+    return 0;
+}
+
+
+version (none)
+{
+extern (C) T[] _arraySliceSliceAddSliceAssignd(T[] a, T[] c, T[] b)
+{
+    foreach (i; 0 .. a.length)
+        a[i] = b[i] + c[i];
+    return a;
+}
+}
diff --git a/gcc/testsuite/gdc.test/runnable/auto1.d b/gcc/testsuite/gdc.test/runnable/auto1.d
new file mode 100644
index 00000000000..e68b06380ef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/auto1.d
@@ -0,0 +1,125 @@
+
+import core.stdc.stdio;
+
+/******************************************/
+
+scope class Foo
+{
+    static int x;
+
+    ~this()
+    {
+        printf("Foo.~this()\n");
+        x++;
+    }
+}
+
+int test1x()
+{
+    scope Foo f = new Foo();
+    return 6;
+}
+
+
+void test1()
+{
+    {
+        scope Foo f = new Foo();
+    }
+    int c;
+
+    assert(Foo.x == 1);
+    c = test1x();
+    assert(c == 6);
+    assert(Foo.x == 2);
+
+    if (c != 6)
+        scope Foo h = new Foo();
+    assert(Foo.x == 2);
+
+    if (c == 6)
+        scope Foo j = new Foo();
+    assert(Foo.x == 3);
+
+    {
+        scope Foo g = null, k = new Foo();
+        assert(Foo.x == 3);
+    }
+    assert(Foo.x == 4);
+}
+
+/******************************************/
+
+int ax;
+
+scope class A2
+{
+  this()
+  {
+    printf("A2.this()\n");
+    ax += 1;
+  }
+
+  ~this()
+  {
+    printf("A2.~this()\n");
+    ax += 1000;
+  }
+};
+
+
+void test2()
+{
+  {
+    scope A2 a = new A2();
+    printf("Hello world.\n");
+  }
+  assert(ax == 1001);
+}
+
+
+
+/******************************************/
+
+int status3;
+
+scope class Parent3
+{
+}
+
+scope class Child3 : Parent3
+{
+        this(){
+                assert(status3==0);
+                status3=1;
+        }
+
+        ~this(){
+                assert(status3==1);
+                status3=2;
+        }
+}
+
+void foo3()
+{
+        scope Parent3 o = new Child3();
+        assert(status3==1);
+}
+
+void test3()
+{
+        foo3();
+        assert(status3==2);
+}
+
+/******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/b17073.d b/gcc/testsuite/gdc.test/runnable/b17073.d
new file mode 100644
index 00000000000..82df219254d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/b17073.d
@@ -0,0 +1,13 @@
+struct S0
+{
+    int x = void;
+}
+struct S1
+{
+    S0  x = S0(42);
+}
+void main()
+{
+    S1  x;
+    assert(x.x.x == 42);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/b26.d b/gcc/testsuite/gdc.test/runnable/b26.d
new file mode 100644
index 00000000000..e32533b2b48
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/b26.d
@@ -0,0 +1,14 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/b26a.d
+// PERMUTE_ARGS:
+
+// 382
+
+struct List(T) {
+        interface A {}
+}
+
+int main(char[][] args) {
+        List!(char) list;
+        return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/bench1.d b/gcc/testsuite/gdc.test/runnable/bench1.d
new file mode 100644
index 00000000000..74b24a4c6c1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/bench1.d
@@ -0,0 +1,30 @@
+// REQUIRED_ARGS:
+// EXECUTE_ARGS: 10000
+
+extern(C) int printf(const char *, ...);
+extern(C) int atoi(const char *);
+
+    int main (string[] argv)
+    {
+        string s = "";
+        int count, loop;
+
+        count = atoi((argv[1] ~ '\0').ptr);
+        if (count == 0)
+            count = 1;
+        printf("count = %u\n", count);
+
+        for (loop = 0; loop < count; loop ++)
+            s ~= "hello\n";
+        for (loop = 0; loop < count; loop ++)
+            s ~= "h";
+        printf ("%d\n", s.length);
+        //printf("%.*s\n", s[0..100]);
+        assert(s.length == count * (6 + 1));
+        s.length = 3;
+        s.length = 10;
+        s.length = 0;
+        s.length = 1000;
+        return 0;
+    }
+
diff --git a/gcc/testsuite/gdc.test/runnable/bitops.d b/gcc/testsuite/gdc.test/runnable/bitops.d
new file mode 100644
index 00000000000..eb51f0f475f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/bitops.d
@@ -0,0 +1,148 @@
+// PERMUTE_ARGS:
+
+import core.stdc.stdio;
+import core.bitop;
+
+/*****************************************************/
+
+void test1()
+{
+    size_t array[2];
+    uint x;
+version (D_LP64)
+    size_t bitToUse = 67;
+else
+    size_t bitToUse = 35;
+
+    array[0] = 2;
+    array[1] = 0x100;
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+
+    x = btc(array.ptr, bitToUse);
+    printf("btc(array, %d) = %d\n", bitToUse, x);
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+    assert(x == 0);
+    assert(array[0] == 0x2 && array[1] == 0x108);
+
+    x = btc(array.ptr, bitToUse);
+    printf("btc(array, %d) = %d\n", bitToUse, x);
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+    assert(x != 0);
+    assert(array[0] == 2 && array[1] == 0x100);
+
+    x = bts(array.ptr, bitToUse);
+    printf("bts(array, %d) = %d\n", bitToUse, x);
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+    assert(x == 0);
+    assert(array[0] == 2 && array[1] == 0x108);
+
+    x = btr(array.ptr, bitToUse);
+    printf("btr(array, %d) = %d\n", bitToUse, x);
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+    assert(x != 0);
+    assert(array[0] == 2 && array[1] == 0x100);
+
+    x = bt(array.ptr, 1);
+    printf("bt(array, 1) = %d\n", x);
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+    assert(x != 0);
+    assert(array[0] == 2 && array[1] == 0x100);
+}
+
+/*****************************************************/
+
+void test2()
+{
+    uint v;
+    int x;
+
+    v = 0x21;
+    x = bsf(v);
+    printf("bsf(x%x) = %d\n", v, x);
+    assert(x == 0);
+
+    x = bsr(v);
+    printf("bsr(x%x) = %d\n", v, x);
+    assert(x == 5);
+}
+
+/*****************************************************/
+
+version (DigitalMars)
+void test3()
+{   uint v;
+    int b;
+
+    b = inp(b);
+    b = inpw(b);
+    b = inpl(b);
+
+    b = outp(v, cast(ubyte)b);
+    b = outpw(v, cast(ushort)b);
+    b = outpl(v, b);
+}
+
+/*****************************************************/
+
+void test4()
+{
+    uint i = 0x12_34_56_78;
+    i = bswap(i);
+    assert(i == 0x78_56_34_12);
+}
+
+/*****************************************************/
+
+void test5()
+{
+    size_t array[2];
+
+    array[0] = 2;
+    array[1] = 0x100;
+
+    printf("btc(array, 35) = %d\n", btc(array.ptr, 35));
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+
+    printf("btc(array, 35) = %d\n", btc(array.ptr, 35));
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+
+    printf("bts(array, 35) = %d\n", bts(array.ptr, 35));
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+
+    printf("btr(array, 35) = %d\n", btr(array.ptr, 35));
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+
+    printf("bt(array, 1) = %d\n", bt(array.ptr, 1));
+    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
+}
+
+
+/*****************************************************/
+
+class Node {
+  uint leaf = 0;
+
+  int m() {
+        return leaf ? 0 : bsf(leaf);
+  }
+}
+
+void test6()
+{
+    Node n = new Node();
+}
+
+/*****************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    //test3();
+    test4();
+    test5();
+    test6();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/bug11155.d b/gcc/testsuite/gdc.test/runnable/bug11155.d
new file mode 100644
index 00000000000..afe4208ebaf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/bug11155.d
@@ -0,0 +1,19 @@
+// PERMUTE_ARGS:
+
+version(D_SIMD)
+{
+    alias float4 = __vector(float[4]);
+
+    void foo(float4* ptr, float4 val)
+    {
+        assert((cast(ulong) &val & 0xf) == 0);
+    }
+
+    void main()
+    {
+        float4 v;
+        foo(&v, v);
+    }
+}
+else
+    void main(){}
diff --git a/gcc/testsuite/gdc.test/runnable/bug12928.d b/gcc/testsuite/gdc.test/runnable/bug12928.d
new file mode 100644
index 00000000000..92ce78eeda7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/bug12928.d
@@ -0,0 +1,13 @@
+// PERMUTE_ARGS: -inline -g -O
+import core.exception : RangeError;
+void main(string[] args)
+{
+  int[2] a;
+  try
+  {
+    foreach(const i; 0..3)
+      a[i] = i;
+    assert(0);
+  }
+  catch(RangeError){}
+}
diff --git a/gcc/testsuite/gdc.test/runnable/bug5.d b/gcc/testsuite/gdc.test/runnable/bug5.d
new file mode 100644
index 00000000000..cbb4dcfee40
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/bug5.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -w
+
+class F { }
+
+int test1() {
+    scope F f = new F(); // comment out and warning goes away
+    return 0;
+}
+
+int test2() { // no return at end of function
+    try {
+        return 0;
+    } finally { }
+}
+
+void main()
+{
+    test1();
+    test2();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/bug7068.d b/gcc/testsuite/gdc.test/runnable/bug7068.d
new file mode 100644
index 00000000000..70e351e8154
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/bug7068.d
@@ -0,0 +1,11 @@
+// PERMUTE_ARGS: -inline -g -O -d
+void main()
+{
+    auto darray1 = new int*[](10);
+    foreach(ref v; darray1)
+        v = new int;
+    auto darray2 = new int*[](10);
+    darray2[] = darray1[]; // calls memset instead of memcpy
+    foreach(i; 0 .. 10)
+        assert(darray1[i] == darray2[i]);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/bug846.d b/gcc/testsuite/gdc.test/runnable/bug846.d
new file mode 100644
index 00000000000..71beb8562af
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/bug846.d
@@ -0,0 +1,11 @@
+// see also: bug 8
+// EXTRA_SOURCES: imports/bug846.d
+
+import imports.bug846;
+
+void main()
+{
+    auto num = removeIf( "abcdef".dup, ( char c ) { return c == 'c'; } );
+    assert(num == 5);
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/builtin.d b/gcc/testsuite/gdc.test/runnable/builtin.d
new file mode 100644
index 00000000000..205e792879d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/builtin.d
@@ -0,0 +1,118 @@
+
+import std.stdio;
+import std.math;
+import core.bitop;
+
+version (DigitalMars)
+{
+    version (X86_64)
+        version = AnyX86;
+    else version (X86)
+        version = AnyX86;
+}
+
+/*******************************************/
+
+void test1()
+{
+    writefln("%a", sin(6.8L));
+    auto f = 6.8L;
+    writefln("%a", sin(f));
+    assert(sin(f) == sin(6.8L));
+    static assert(approxEqual(sin(6.8L), 0x1.f9f8d9aea10fdf1cp-2));
+
+    writefln("%a", cos(6.8L));
+    f = 6.8L;
+    writefln("%a", cos(f));
+    assert(cos(f) == cos(6.8L));
+    static assert(approxEqual(cos(6.8L), 0x1.bd21aaf88dcfa13ap-1));
+
+    writefln("%a", tan(6.8L));
+    f = 6.8L;
+    writefln("%a", tan(f));
+    version (Win64)
+    { }
+    else
+        assert(tan(f) == tan(6.8L));
+    static assert(approxEqual(tan(6.8L), 0x1.22fd752af75cd08cp-1));
+}
+
+/*******************************************/
+
+void test2()
+{
+    float i = 3;
+    i = i ^^ 2;
+    assert(i == 9);
+
+    int j = 2;
+    j = j ^^ 1;
+    assert(j == 2);
+
+    i = 4;
+    i = i ^^ .5;
+    assert(i == 2);
+}
+
+/**** Bug 5703 *****************************/
+
+static assert({
+    int a = 0x80;
+    int f = bsf(a);
+    int r = bsr(a);
+    a = 0x22;
+    assert(bsf(a)==1);
+    assert(bsr(a)==5);
+    a = 0x8000000;
+    assert(bsf(a)==27);
+    assert(bsr(a)==27);
+    a = 0x13f562c0;
+    assert(bsf(a) == 6);
+    assert(bsr(a) == 28);
+    assert(bswap(0xAABBCCDD) == 0xDDCCBBAA);
+    return true;
+}());
+
+/*******************************************/
+
+void test3()
+{
+    version (AnyX86)
+    {
+        static assert( _popcnt( cast(ushort)0 ) == 0 );
+        static assert( _popcnt( cast(ushort)7 ) == 3 );
+        static assert( _popcnt( cast(ushort)0xAA )== 4);
+        static assert( _popcnt( cast(ushort)0xFFFF ) == 16 );
+        static assert( _popcnt( cast(ushort)0xCCCC ) == 8 );
+        static assert( _popcnt( cast(ushort)0x7777 ) == 12 );
+        static assert( _popcnt( cast(uint)0 ) == 0 );
+        static assert( _popcnt( cast(uint)7 ) == 3 );
+        static assert( _popcnt( cast(uint)0xAA )== 4);
+        static assert( _popcnt( cast(uint)0x8421_1248 ) == 8 );
+        static assert( _popcnt( cast(uint)0xFFFF_FFFF ) == 32 );
+        static assert( _popcnt( cast(uint)0xCCCC_CCCC ) == 16 );
+        static assert( _popcnt( cast(uint)0x7777_7777 ) == 24 );
+        version (X86_64)
+        {
+            static assert( _popcnt( cast(ulong)0 ) == 0 );
+            static assert( _popcnt( cast(ulong)7 ) == 3 );
+            static assert( _popcnt( cast(ulong)0xAA )== 4);
+            static assert( _popcnt( cast(ulong)0x8421_1248 ) == 8 );
+            static assert( _popcnt( cast(ulong)0xFFFF_FFFF_FFFF_FFFF ) == 64 );
+            static assert( _popcnt( cast(ulong)0xCCCC_CCCC_CCCC_CCCC ) == 32 );
+            static assert( _popcnt( cast(ulong)0x7777_7777_7777_7777 ) == 48 );
+        }
+    }
+}
+
+/*******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/c22.d b/gcc/testsuite/gdc.test/runnable/c22.d
new file mode 100644
index 00000000000..8af091b4dce
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/c22.d
@@ -0,0 +1,15 @@
+// EXTRA_SOURCES: imports/c22a.d imports/c22b.d
+// PERMUTE_ARGS:
+
+module main;
+
+import imports.c22a;
+import imports.c22b;
+
+int main()
+{
+    afn1();
+    afn2();
+    bfn1();
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/cabi1.d b/gcc/testsuite/gdc.test/runnable/cabi1.d
new file mode 100644
index 00000000000..587bd9ac4a3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/cabi1.d
@@ -0,0 +1,237 @@
+
+// EXTRA_CPP_SOURCES: extra-files/cabi2.cpp
+
+import core.stdc.stdio;
+import core.stdc.config;
+
+struct Foo1 { char c; }
+struct Foo2 { short s; }
+struct Foo3 { char c; short s; }
+struct Foo4 { int i; }
+struct Foo5 { int i, j; }
+struct Foo6 { int i, j, k; }
+struct S7 { float a, b; }
+
+extern (C) Foo1 ctest1();
+extern (C) Foo2 ctest2();
+extern (C) Foo3 ctest3();
+extern (C) Foo4 ctest4();
+extern (C) Foo5 ctest5();
+extern (C) Foo6 ctest6();
+extern (C) S7 ctest10();
+
+void test1()
+{
+    Foo1 f1 = ctest1();
+    assert(f1.c == 3);
+
+    Foo2 f2 = ctest2();
+    assert(f2.s == 0x1234);
+
+    Foo3 f3 = ctest3();
+    assert(f3.s == 0x5678);
+
+    Foo4 f4 = ctest4();
+    assert(f4.i == 0x12345678);
+
+version (Win64)
+{
+}
+else
+{
+    Foo5 f5 = ctest5();
+    assert(f5.i == 0x12345678);
+    assert(f5.j == 0x21436587);
+}
+
+version (X86)
+{
+    Foo6 f6 = ctest6();
+    assert(f6.i == 0x12345678);
+    assert(f6.j == 0x21463587);
+    assert(f6.k == 0x24163857);
+}
+
+version (Win64)
+{
+}
+else
+{
+    S7 s7 = ctest10();
+    assert(s7.a == 2.5);
+    assert(s7.b == 1.5);
+}
+}
+
+/*******************************************/
+
+extern (C)
+{
+    char ctest7(char);
+    ubyte ctest8(ubyte);
+    byte ctest9(byte);
+}
+
+void test2()
+{
+    assert(ctest7('a') == 'b');
+    assert(ctest8(7) == 8);
+    assert(ctest9(3) == 4);
+}
+
+/******************************************/
+
+extern (C)
+{
+    void ctestrir(int x1, int x2, int x3, int x4, int x5, int x6, c_long_double a, int b, c_long_double c);
+}
+
+void test3()
+{
+    ctestrir(1,2,3,4,5,6, c_long_double(100.0), 67, c_long_double(200.0));
+}
+
+/******************************************/
+
+extern (C) void dtestrir(int x1, int x2, int x3, int x4, int x5, int x6, c_long_double a, int b, c_long_double c)
+{
+    assert(a == 300.0);
+    assert(b == 68);
+    assert(c == 401.0);
+}
+
+extern (C) void test4();
+
+/******************************************/
+
+struct S11 { ubyte a, b, c; }
+
+extern (C) S11 ctest11(ubyte x, S11, ubyte y);
+
+void test11()
+{
+  version (X86)
+  {
+  S11 t;
+  assert(S11.sizeof == 3);
+  t.a = 2;
+  t.b = 3;
+  t.c = 4;
+  auto s = ctest11(1, t, 5);
+  assert(s.a == 2);
+  assert(s.b == 3);
+  assert(s.c == 4);
+  }
+}
+
+/******************************************/
+
+struct S12 { char a,d; char b,e; ubyte c; }
+
+extern (C) S12 ctest12(ubyte x, S12, ubyte y);
+
+void test12()
+{
+  version (X86)
+  {
+  S12 t;
+  printf("D sz = %d\n", cast(int)S12.sizeof);
+//  assert(S12.sizeof == 5);
+  t.a = 2;
+  t.b = 3;
+  t.c = 4;
+  auto s = ctest12(1, t, 5);
+  assert(s.a == 2);
+  assert(s.b == 3);
+  assert(s.c == 4);
+  }
+}
+
+/******************************************/
+
+struct S13 { ushort a, b, c; }
+
+extern (C) S13 ctest13(ubyte x, S13, ubyte y);
+
+void test13()
+{
+  version (X86)
+  {
+  S13 t;
+  assert(S13.sizeof == 6);
+  t.a = 2;
+  t.b = 3;
+  t.c = 4;
+  auto s = ctest13(1, t, 5);
+  assert(s.a == 2);
+  assert(s.b == 3);
+  assert(s.c == 4);
+  }
+}
+
+/******************************************/
+
+struct S14 { char a,d,e,f; char b,g; ubyte c; }
+
+extern (C) S14 ctest14(ubyte x, S14, ubyte y);
+
+void test14()
+{
+  version (X86)
+  {
+  S14 t;
+  assert(S14.sizeof == 7);
+  t.a = 2;
+  t.b = 3;
+  t.c = 4;
+  auto s = ctest14(1, t, 5);
+  assert(s.a == 2);
+  assert(s.b == 3);
+  assert(s.c == 4);
+  }
+}
+
+/******************************************/
+
+struct S15 { char a,d,e,f; char b,g,h,i; ubyte c; }
+
+extern (C) S15 ctest15(ubyte x, S15, ubyte y);
+
+void test15()
+{
+  version (X86)
+  {
+  S15 t;
+  assert(S15.sizeof == 9);
+  t.a = 2;
+  t.b = 3;
+  t.c = 4;
+  auto s = ctest15(1, t, 5);
+  assert(s.a == 2);
+  assert(s.b == 3);
+  assert(s.c == 4);
+  }
+}
+
+/******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+version (Win64)
+{
+}
+else
+{
+    test4();
+}
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/casting.d b/gcc/testsuite/gdc.test/runnable/casting.d
new file mode 100644
index 00000000000..4c4efc9e3d6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/casting.d
@@ -0,0 +1,248 @@
+extern(C) int printf(const char*, ...);
+
+template Seq(T...) { alias T Seq; }
+
+/***************************************************/
+// 3133
+
+void test3133()
+{
+    short[2] x = [1, 2];
+    auto y = cast(int[1])x;     // no error
+}
+
+/***************************************************/
+// 7504
+
+void test7504() pure nothrow @safe
+{
+    auto n = null;
+    char[] k = n;
+    assert(k.ptr == null);
+    assert(k.length == 0);
+
+    double[] l;
+    l = n;
+    assert(l.ptr == null);
+    assert(l.length == 0);
+
+    immutable(int[]) m = n;
+    assert(m.ptr == null);
+    assert(m.length == 0);
+
+    const(float)[] o;
+    o = n;
+    assert(o.ptr == null);
+    assert(o.length == 0);
+
+    auto c = create7504(null, null);
+    assert(c.k.ptr == null);
+    assert(c.k.length == 0);
+    assert(c.l.ptr == null);
+    assert(c.l.length == 0);
+}
+
+class C7504
+{
+    int[] k;
+    string l;
+}
+
+C7504 create7504(T...)(T input)
+{
+    auto obj = new C7504;
+    obj.tupleof = input;
+    return obj;
+}
+
+/***************************************************/
+// 8119
+
+struct S8119;
+
+void test8119()
+{
+    void* v;
+    auto sp1 = cast(S8119*)v;
+
+    int* i;
+    auto sp2 = cast(S8119*)i;
+
+    S8119* s;
+    auto ip = cast(int*)s;
+}
+
+/***************************************************/
+// 8645
+
+template TypeTuple8645(TL...)
+{
+    alias TL TypeTuple8645;
+}
+
+void test8645()
+{
+    alias TypeTuple8645!(int) Foo;
+    int bar;
+    static assert(!is(typeof( cast(Foo)bar )));
+}
+
+/***************************************************/
+// 10497
+
+struct S10497;
+
+void test10497(S10497** s)
+{
+    void* ptr;
+    *s = cast(S10497*)ptr;
+}
+
+/***************************************************/
+// 10793
+
+struct RealFoo10793
+{
+    int i;
+}
+
+struct Foo10793;
+
+void test10793()
+{
+    auto rf = RealFoo10793(10);
+    void* prf = cast(void*)&rf;
+    Foo10793* f = cast(Foo10793*)prf;
+}
+
+/***************************************************/
+// 10834
+
+void test10834()
+{
+    struct S { int i; }
+    S s;
+    cast(void)s;
+
+    class C { int i; }
+    C c;
+    cast(void)c;
+
+    enum E { a, b }
+    E e;
+    cast(void)e;
+
+    int[] ia;
+    cast(void)ia;
+}
+
+/***************************************************/
+// 10842
+
+template Test10842(F, T)
+{
+    bool res;
+    F from()
+    {
+        res = true;
+        return F.init;
+    }
+    T to()
+    {
+        // The cast operand had incorrectly been eliminated
+        return cast(T)from();
+    }
+    bool test()
+    {
+        res = false;
+        to();
+        return res;
+    }
+}
+
+void test10842()
+{
+    foreach (From; Seq!(bool, byte, ubyte, short, ushort, int, uint, long, ulong, float, double, real))
+    {
+        foreach (To; Seq!(ifloat, idouble, ireal))
+        {
+            if (!Test10842!(From, To).test())
+                assert(0);
+        }
+    }
+
+    foreach (From; Seq!(ifloat, idouble, ireal))
+    {
+        foreach (To; Seq!(/*bool*, */byte, ubyte, short, ushort, int, uint, long, ulong, float, double, real))
+        {
+            if (!Test10842!(From, To).test())
+                assert(0);
+        }
+    }
+
+    if (!Test10842!(typeof(null), string).test())   // 10842
+        assert(0);
+}
+
+/***************************************************/
+// 11722
+
+class C11722
+{
+    T opCast(T)() { assert(0); }
+}
+
+void test11722()
+{
+    C11722 c = new C11722();
+    shared C11722 sc = cast(shared)c;
+}
+
+/***************************************************/
+// 14218
+
+void test14218()
+{
+    foreach (To; Seq!( byte,  short,  int,  long,
+                      ubyte, ushort, uint, ulong,
+                       char,  wchar, dchar, bool))
+    {
+        auto x = cast(To)null;
+        assert(x == 0);     // false, '0x00'
+    }
+
+    version (DigitalMars)
+    {
+        // Questionable but currently accepted
+        foreach (To; Seq!( float,  double,  real,
+                           ifloat, idouble, ireal))
+        {
+            auto x = cast(To)null;
+            assert(x == 0);     // 0i
+        }
+
+        // Internal error: backend/el.c in el_long()
+        //foreach (To; Seq!(cfloat, cdouble, creal))
+        //{
+        //    static assert(!__traits(compiles, { auto x = cast(To)null; }));
+        //}
+    }
+}
+
+/***************************************************/
+
+int main()
+{
+    test3133();
+    test7504();
+    test8119();
+    test8645();
+    test10793();
+    test10834();
+    test10842();
+    test11722();
+    test14218();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/circular.d b/gcc/testsuite/gdc.test/runnable/circular.d
new file mode 100644
index 00000000000..8fdc8aa7d49
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/circular.d
@@ -0,0 +1,25 @@
+// REQUIRED_ARGS: -d
+// PERMUTE_ARGS: -dw
+// EXTRA_SOURCES: imports/circularA.d
+// This bug is typedef-specific.
+
+// Bugzilla 4543
+
+import core.stdc.stdio;
+import imports.circularA;
+
+class bclass {};
+alias bclass Tclass;
+
+struct bstruct {}
+alias bstruct Tstruct;
+
+
+/************************************/
+
+int main()
+{
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/closure.d b/gcc/testsuite/gdc.test/runnable/closure.d
new file mode 100644
index 00000000000..f4024bff0a1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/closure.d
@@ -0,0 +1,935 @@
+
+import core.stdc.stdio;
+
+struct S { int a,b,c,d; }
+
+alias int delegate() dg_t;
+alias int delegate(int) dg1_t;
+
+void fill()
+{
+    int[100] x;
+}
+
+/************************************/
+
+dg_t foo()
+{
+    int x = 7;
+
+    int bar()
+    {
+        return x + 3;
+    }
+
+    return &bar;
+}
+
+void test1()
+{
+    dg_t dg = foo();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 10);
+}
+
+/************************************/
+
+dg_t foo2()
+{
+    dg_t abc()
+    {
+        int x = 7;
+
+        int bar()
+        {
+            return x + 3;
+        }
+
+        return &bar;
+    }
+
+    return abc();
+}
+
+void test2()
+{
+    dg_t dg = foo2();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 10);
+}
+
+/************************************/
+
+dg_t foo3()
+{
+    dg_t abc(int x)
+    {
+        int bar()
+        {
+            return x + 3;
+        }
+
+        return &bar;
+    }
+
+    return abc(7);
+}
+
+void test3()
+{
+    dg_t dg = foo3();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 10);
+}
+
+/************************************/
+
+dg_t foo4()
+{
+    S s;
+
+    s = S(4,5,6,7);
+
+    dg_t abc(S t)
+    {
+        int bar()
+        {
+            return t.d + 3;
+        }
+
+        return &bar;
+    }
+
+    return abc(s);
+}
+
+void test4()
+{
+    dg_t dg = foo4();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 10);
+}
+
+/************************************/
+
+void test5()
+{
+    int x = 7;
+
+    dg_t abc(ref int y)
+    {
+        int bar()
+        {
+            y += 4;
+            return y + 3;
+        }
+
+        return &bar;
+    }
+
+    dg_t dg = abc(x);
+    fill();
+    assert(x == 7);
+    auto i = dg();
+    assert(x == 11);
+    assert(i == 14);
+
+    x = 8;
+    i = dg();
+    assert(x == 12);
+    assert(i == 15);
+}
+
+/************************************/
+
+void test6()
+{
+    int x = 7;
+
+    dg_t abc(out int y)
+    {
+        int bar()
+        {
+            y += 4;
+            return y + 3;
+        }
+
+        return &bar;
+    }
+
+    dg_t dg = abc(x);
+    fill();
+
+    assert(x == 0);
+    auto i = dg();
+    assert(x == 4);
+    assert(i == 7);
+
+    x = 8;
+    i = dg();
+    assert(x == 12);
+    assert(i == 15);
+}
+
+/************************************/
+
+void test7()
+{
+    int[3] a = [10,11,12];
+
+    dg_t abc(int[3] y)
+    {
+        int bar()
+        {
+            y[2] += 4;
+            return y[2] + 3;
+        }
+
+        return &bar;
+    }
+
+    dg_t dg = abc(a);
+    fill();
+
+    assert(a[2] == 12);
+    auto i = dg();
+    assert(a[2] == 12);
+    assert(i == 19);
+}
+
+/************************************/
+
+void test8()
+{
+    S s = S(7,8,9,10);
+
+    dg_t abc(ref S t)
+    {
+        int bar()
+        {
+            t.d += 4;
+            return t.c + 3;
+        }
+
+        return &bar;
+    }
+
+    dg_t dg = abc(s);
+    fill();
+
+    assert(s.d == 10);
+    auto i = dg();
+    assert(s.d == 14);
+    assert(i == 12);
+}
+
+/************************************/
+
+S foo9(out dg_t dg)
+{
+    S s1 = S(7,8,9,10);
+
+    dg_t abc()
+    {
+        int bar()
+        {
+            s1.d += 4;
+            return s1.c + 3;
+        }
+
+        return &bar;
+    }
+
+    dg = abc();
+    return s1;
+}
+
+void test9()
+{
+    dg_t dg;
+
+    S s = foo9(dg);
+    fill();
+    assert(s.a == 7);
+    assert(s.b == 8);
+    assert(s.c == 9);
+    assert(s.d == 10);
+
+    auto i = dg();
+    assert(s.d == 10);
+    assert(i == 12);
+}
+
+/************************************/
+
+dg_t foo10()
+{
+    dg_t abc()
+    {
+        int x = 7;
+
+        int bar()
+        {
+            int def()
+            {
+                return x + 3;
+            }
+            return def();
+        }
+
+        return &bar;
+    }
+
+    return abc();
+}
+
+void test10()
+{
+    dg_t dg = foo10();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 10);
+}
+
+
+/************************************/
+
+dg_t foo11()
+{
+    int x = 7;
+
+    class T
+    {
+        int bar()
+        {
+            return x + 3;
+        }
+    }
+
+    T t = new T;
+
+    return &t.bar;
+}
+
+void test11()
+{
+    dg_t dg = foo11();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 10);
+}
+
+/************************************/
+
+dg_t foo12()
+{
+    int x = 7;
+
+    class T
+    {
+        int bar()
+        {
+            return x + 3;
+        }
+
+        int xyz()
+        {
+            return bar();
+        }
+    }
+
+    T t = new T;
+
+    return &t.xyz;
+}
+
+void test12()
+{
+    dg_t dg = foo12();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 10);
+}
+
+/************************************/
+
+dg_t foo13()
+{
+    int x = 7;
+
+    class T
+    {
+        int xyz()
+        {
+            int bar()
+            {
+                return x + 3;
+            }
+
+            return bar();
+        }
+    }
+
+    T t = new T;
+
+    return &t.xyz;
+}
+
+void test13()
+{
+    dg_t dg = foo13();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 10);
+}
+
+
+/************************************/
+
+dg_t foo14()
+{
+    class T
+    {
+        int xyz()
+        {
+            int x = 7;
+
+            int bar()
+            {
+                return x + 3;
+            }
+
+            return bar();
+        }
+    }
+
+    T t = new T;
+
+    return &t.xyz;
+}
+
+void test14()
+{
+    dg_t dg = foo14();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 10);
+}
+
+/************************************/
+
+dg_t foo15()
+{
+    class T
+    {
+        int x = 7;
+
+        int xyz()
+        {
+            int bar()
+            {
+                return x + 3;
+            }
+
+            return bar();
+        }
+    }
+
+    T t = new T;
+
+    return &t.xyz;
+}
+
+void test15()
+{
+    dg_t dg = foo15();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 10);
+}
+
+/************************************/
+
+dg_t foo16()
+{
+    int a = 5;
+
+    class T
+    {
+        int x = 7;
+
+        int xyz()
+        {
+            int y = 8;
+            int bar()
+            {
+                return a + x + y + 3;
+            }
+
+            return bar();
+        }
+    }
+
+    T t = new T;
+
+    return &t.xyz;
+}
+
+void test16()
+{
+    dg_t dg = foo16();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 23);
+}
+
+/************************************/
+
+dg_t foo17()
+{
+    int a = 5;
+
+    class T
+    {
+        int x = 7;
+
+        dg_t xyz()
+        {
+            int y = 8;
+
+            int bar()
+            {
+                return a + x + y + 3;
+            }
+
+            return &bar;
+        }
+    }
+
+    T t = new T;
+
+    return t.xyz();
+}
+
+void test17()
+{
+    dg_t dg = foo17();
+    fill();
+    printf("bar = %d\n", dg());
+    assert(dg() == 23);
+}
+
+/************************************/
+
+dg_t dg18;
+
+void bar18()
+{
+    int a = 7;
+    int foo() { return a + 3; }
+
+    dg18 = &foo;
+    int i = dg18();
+    assert(i == 10);
+}
+
+void test18()
+{
+    bar18();
+    fill();
+    int i = dg18();
+    assert(i == 10);
+}
+
+/************************************/
+
+void abc19(void delegate() dg)
+{
+    dg();
+    dg();
+    dg();
+}
+
+struct S19
+{
+    static S19 call(int v)
+    {
+        S19 result;
+
+        result.v = v;
+        void nest()
+        {
+            result.v += 1;
+        }
+        abc19(&nest);
+        return result;
+    }
+    int a;
+    int v;
+    int x,y,z;
+}
+
+int foo19()
+{
+    auto s = S19.call(5);
+    return s.v;
+}
+
+void test19()
+{
+    int i = foo19();
+    printf("%d\n", i);
+    assert(i == 8);
+}
+
+/************************************/
+
+void enforce20(lazy int msg)
+{
+}
+
+
+void test20()
+{
+    int x;
+    foreach (j; 0 .. 10)
+    {
+        printf("%d\n", j);
+        assert(j == x);
+        x++;
+        enforce20(j);
+    }
+}
+
+/************************************/
+
+void thrash21() { char[128] x = '\xfe'; }
+
+void delegate() dg21;
+int g_input = 11, g_output;
+
+void f21()
+{
+    int i = g_input + 2;
+
+    class X
+    {
+        // both 'private' and 'final' to make non-virtual
+        private final void actual()
+        {
+            g_output = i;
+        }
+
+        void go()
+        {
+            actual();
+        }
+    }
+
+    dg21 = & (new X).go;
+}
+
+void test21()
+{
+    f21();
+    thrash21();
+    dg21();
+    assert(g_output == 13);
+}
+
+/************************************/
+
+void thrash22() { char[128] x = '\xfe'; }
+int gi22;
+void delegate() dg22;
+
+class A22
+{
+    int x = 42;
+
+    void am()
+    {
+        int j; /* Making f access this variable causes f's chain to be am's
+                  frame.  Otherwise, f's chain would be the A instance. */
+        void f()
+        {
+            int k = j;
+
+            void g()
+            {
+                class B
+                {
+                    void bm()
+                    {
+                        gi22 = x; /* No checkedNestedReference for A.am.this,
+                                   so it is never placed in a closure. */
+                    }
+                }
+
+                (new B).bm();
+            }
+
+            dg22 = &g;
+        }
+
+        f();
+    }
+}
+
+void test22()
+{
+    (new A22).am();
+    thrash22();
+    dg22();
+    assert(gi22 == 42);
+}
+
+/************************************/
+// 1759
+
+void test1759()
+{
+    struct S { int a, b, c; }
+    struct SS { S obj; }
+
+    static int delegate() makeSum1(S s)
+    {
+        with (s) return { return a + b + c; };
+    }
+    static int delegate() makeSum2(S[1] sa)
+    {
+        with (sa[0]) return { return a + b + c; };
+    }
+    static int delegate() makeSum3(SS ss)
+    {
+        with (ss.obj) return { return a + b + c; };
+    }
+    static int delegate() makeSum4(SS[1] ssa)
+    {
+        with (ssa[0].obj) return { return a + b + c; };
+    }
+
+    S s = {15, 30, 45};
+    SS ss = {s};
+    int delegate() sum;
+
+    sum = makeSum1(s);      assert(sum() == 90);
+    sum = makeSum2([s]);    assert(sum() == 90);
+    sum = makeSum3(ss);     assert(sum() == 90);
+    sum = makeSum4([ss]);   assert(sum() == 90);
+}
+
+/************************************/
+// 1841
+
+int delegate() foo1841()
+{
+    int stack;
+    int heap = 3;
+
+    int nested_func()
+    {
+        ++heap;
+        return heap;
+    }
+    return delegate int() { return nested_func(); };
+}
+
+int delegate() foo1841b()
+{
+    int stack;
+    int heap = 7;
+
+    int nested_func()
+    {
+        ++heap;
+        return heap;
+    }
+    int more_nested() { return nested_func(); }
+    return delegate int() { return more_nested(); };
+}
+
+void test1841()
+{
+    auto z = foo1841();
+    auto p = foo1841();
+    assert(z() == 4);
+    p();
+    assert(z() == 5);
+    z = foo1841b();
+    p = foo1841b();
+    assert(z() == 8);
+    p();
+    assert(z() == 9);
+}
+
+/************************************/
+// 5911
+
+void writeln5911(const(char)[] str) {}
+
+void logout5911(lazy const(char)[] msg) { writeln5911(msg); }
+
+void test5911()
+{
+    string str = "hello world";
+    logout5911((){ return str; }());    // closure 1
+
+    try
+    {
+        throw new Exception("exception!!");
+    }
+    catch (Exception e)
+    {
+        assert(e !is null);
+        logout5911(e.toString());       // closure2 SEGV : e is null.
+    }
+}
+
+/************************************/
+// 9685
+
+auto get9685a(alias fun)()
+{
+    int x = 10;
+    struct Foo
+    {
+        size_t data;
+
+        @property clone()
+        {
+            return Foo(15);
+        }
+    }
+    return Foo(5);
+}
+void test9685a()
+{
+    uint a = 42;
+    auto bar = get9685a!(() => a)();
+    auto qux = bar.clone;
+    //printf("bar context pointer : %p\n", bar.tupleof[$-1]);
+    //printf("qux context pointer : %p\n", qux.tupleof[$-1]);
+    assert(bar.tupleof[$-1] == qux.tupleof[$-1]);
+    assert(qux.data == 15);
+}
+
+auto get9685b(alias fun)()
+{
+    int x = 10;
+    struct Foo
+    {
+        size_t data;
+
+        @property clone()
+        {
+            return Foo(data + x);
+        }
+    }
+    return Foo(5);
+}
+void test9685b()
+{
+    uint a = 42;
+    auto bar = get9685b!(() => a)();
+    auto qux = bar.clone;
+    //printf("bar context pointer : %p\n", bar.tupleof[$-1]);
+    //printf("qux context pointer : %p\n", qux.tupleof[$-1]);
+    assert(bar.tupleof[$-1] == qux.tupleof[$-1]);
+    assert(qux.data == 15);
+}
+
+/************************************/
+// 12406
+
+auto createDg12406()
+{
+    static struct Dg
+    {
+        Dg delegate() action;
+    }
+
+    static void fn(void delegate()) { }
+
+    int x; fn({ x++; }); // required
+
+    Dg dg;
+
+    Dg createDg2()
+    {
+        int x; void unusedFun() { x++; } // required
+
+        return Dg(() => dg); // lambda returns garbage instead of dg
+    }
+
+    return dg = Dg(&createDg2);
+}
+
+void test12406()
+{
+    auto dgs = [createDg12406()];
+    //printf("dgs[%2d].action = %p:%p\n", 0, dgs[$-1].action.ptr, dgs[$-1].action.funcptr);
+    foreach (i; 1 .. 10+1)
+    {
+        dgs ~= dgs[i-1].action();
+        //printf("dgs[%2d].action = %p:%p\n", i, dgs[$-1].action.ptr, dgs[$-1].action.funcptr);
+    }
+
+    foreach (i, dgx; dgs)
+    {
+        if (i % 2 == 0)
+        {
+            // All closures are equal with dgs[0].
+            assert(dgx.action.ptr     is dgs[0].action.ptr);
+            assert(dgx.action.funcptr is dgs[0].action.funcptr);    // is: createDg2
+        }
+        else
+        {
+            // Each closures has unique context.
+            for (size_t j = i + 2; j < dgs.length; j += 2)
+                assert(dgx.action.ptr !is dgs[j].action.ptr);
+            assert(dgx.action.funcptr is dgs[1].action.funcptr);    // is: lambda () => dg
+        }
+    }
+}
+
+/************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test1759();
+    test1841();
+    test5911();
+    test9685a();
+    test9685b();
+    test12406();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/complex.d b/gcc/testsuite/gdc.test/runnable/complex.d
new file mode 100644
index 00000000000..fb6aba34a9b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/complex.d
@@ -0,0 +1,405 @@
+// PERMUTE_ARGS:
+
+import std.stdio;
+import std.math;
+import core.stdc.stdio;
+
+/***************************************/
+
+void test1()
+{
+    creal c = 3.0 + 4.0i;
+    c = sqrt(c);
+    printf("re = %Lg, im = %Lg\n", c.re, c.im);
+    assert(c.re == 2.0);
+    assert(c.im == 1.0);
+
+    float f = sqrt(25.0f);
+    assert(f == 5.0);
+    double d = sqrt(4.0);
+    assert(d == 2.0);
+    real r = sqrt(9.0L);
+    assert(r == 3.0);
+}
+
+/***************************************/
+
+ireal f2() { return 1i; }
+
+void test2()
+{
+    creal v = 0+0i;
+
+    v += f2();
+    assert(v == 0 + 1i);
+
+    v = v + f2();
+    assert(v == 0 + 2i);
+}
+
+/***************************************/
+
+cdouble[1] a3;
+cdouble[1] b3;
+
+cdouble[] concat3() {
+        return a3~b3;
+}
+
+void test3()
+{
+        a3[]=0.5+1.0i;
+        b3[]=0.5+3.0i;
+
+        cdouble[] arr=concat3();
+
+        assert(arr.length==2);
+        assert(arr[0]==0.5+1.0i);
+        assert(arr[1]==0.5+3.0i);
+}
+
+/***************************************/
+
+creal[1] a4;
+creal[1] b4;
+
+creal[] concat4() {
+        return a4~b4;
+}
+
+void test4()
+{
+        a4[]=0.5+1.0i;
+        b4[]=0.5+3.0i;
+
+        creal[] arr=concat4();
+
+        assert(arr.length==2);
+        assert(arr[0]==0.5+1.0i);
+        assert(arr[1]==0.5+3.0i);
+}
+
+/***************************************/
+
+void test5()
+{
+        ifloat i=1.0fi;
+//      i += 2.2;
+//      assert(i == 1i);
+}
+
+/***************************************/
+
+void test6()
+{
+        float i=1.0f;
+//      i /= 2.2fi;
+//      assert(i == 0);
+}
+
+/***************************************/
+
+void test7()
+{
+        creal x=1.0i+2.0;
+        creal[] arr;
+
+        arr = arr ~ x;
+        assert(arr.length==1);
+        assert(arr[0]==1.0i+2.0);
+
+        x=0.0i+5.0;
+        assert(arr[0]==1.0i+2.0);
+}
+
+/****************************************/
+
+creal[1] a8;
+creal[1] b8;
+
+creal[] concat8() {
+    return a8 ~ b8;
+}
+
+void test8()
+{
+    a8[]=0.5L+1.0Li;
+    b8[]=0.5L+3.0Li;
+
+    creal[] arr=concat8();
+
+    assert(arr.length==2);
+    assert(arr[0]==0.5L+1.0Li);
+    assert(arr[1]==0.5L+3.0Li);
+}
+
+/***************************************/
+
+creal[1] a9;
+creal[1] b9;
+
+creal[] concat9() {
+    return a9~b9;
+}
+
+void test9()
+{
+    a9[]=0.5L+1.0Li;
+    b9[]=0.5L+3.0Li;
+
+    creal[] arr=concat9();
+
+    assert(arr.length==2);
+    assert(arr[0]==0.5L+1.0Li);
+    assert(arr[1]==0.5L+3.0Li);
+}
+
+
+/***************************************/
+
+void test10()
+{
+    ifloat a = 1.0i;
+    assert(a.im == 1.0);
+
+    const ifloat b = 2.0i;
+    static assert(b.im == 2.0); // FAIL
+
+}
+
+/***************************************/
+
+void test11()
+{
+    real r = real.nan;
+    assert( r!=0 );
+    if (r==0) assert(0);
+
+    ireal ir = ireal.nan;
+    assert( ir!=0 );
+    assert( ir!=0i );
+    if (ir==0) assert(0);
+    if (ir==0i) assert(0);
+
+    creal cr = creal.nan;
+    assert( cr!=0 );
+    assert( cr!=0i );
+    if (cr==0) assert(0);
+    if (cr==0i) assert(0);
+
+    double d = double.nan;
+    assert( d!=0 );
+    if (d==0) assert(0);
+
+    idouble id = idouble.nan;
+    assert( id!=0 );
+    assert( id!=0i );
+    if (id==0) assert(0);
+    if (id==0i) assert(0);
+
+    cdouble cd = cdouble.nan;
+    assert( cd!=0 );
+    assert( cd!=0i );
+    if (cd==0) assert(0);
+    if (cd==0i) assert(0);
+
+    float f = float.nan;
+    assert( f!=0 );
+    if (f==0) assert(0);
+
+    ifloat ifx = ifloat.nan;
+    assert( ifx!=0 );
+    assert( ifx!=0i );
+    if (ifx==0) assert(0);
+    if (ifx==0i) assert(0);
+
+    cfloat cf = cfloat.nan;
+    assert( cf!=0 );
+    assert( cf!=0i );
+    if (cf==0) assert(0);
+    if (cf==0i) assert(0);
+}
+
+/***************************************/
+
+void test12()
+{
+    real x = 3;
+    creal a = (2 + 4i) % 3;
+    writeln(a);
+    assert(a == 2 + 1i);
+
+    creal b = (2 + 4i) % x;
+    writeln(b);
+    assert(b == a);
+}
+
+/***************************************/
+
+void test13()
+{
+        ireal a = 5i;
+        ireal b = a % 2;
+        writeln(b);
+        assert(b == 1i);
+}
+
+/***************************************/
+
+cdouble inv( cdouble expr )
+{
+    return (1.0 + 0.0i) / expr;
+}
+
+/***************************************/
+
+void test14()
+{
+    cfloat c;
+    cfloat d;
+    assert(c != d);
+
+    cdouble e;
+    cdouble f;
+    assert(e != f);
+
+    creal g;
+    creal h;
+    assert(g != h);
+}
+
+/***************************************/
+
+void test7581()
+{
+    cfloat a() { return cfloat.nan; }
+    assert(a() != 0);
+}
+
+/***************************************/
+
+float f() { return 1.0f; }
+ifloat i() { return 1.0fi; }
+
+void test7594()
+{
+    assert(f() + i() == 1.0f + 1.0fi);
+}
+
+/***************************************/
+
+cdouble conv(cfloat a)
+{
+    return a;
+}
+
+void test7593()
+{
+    assert(conv(1.0f+1.0fi) == 1.0+1.0i);
+}
+
+/***************************************/
+
+cfloat get() { return cfloat.nan; }
+
+void test7591()
+{
+    assert(!(get() == 0));
+}
+
+/***************************************/
+
+void foo8966(cfloat x)
+{
+    assert(x.re == 3.0f);
+}
+
+__gshared cfloat[] a8966;
+
+void test8966()
+{
+    a8966 = new cfloat[2];
+    a8966[0] = 3.0f + 1.0fi;
+    foo8966(a8966[0]);
+}
+
+/***************************************/
+
+void formatTest2(cfloat s, double re, double im)
+{
+    assert(s.re == re);
+    assert(s.im == im);
+}
+
+cfloat getcf()
+{
+    return 2 + 1i;
+}
+
+void test10677()
+{
+    formatTest2( getcf(), 2, 1 );
+}
+
+/***************************************/
+
+void test7806()
+{
+    for (idouble i = -2i; i <= 2i; i += .125i)
+        for (double r = -2; r <= 2; r += .0625)
+        {
+            cdouble c = r + i;
+            printf("%g %gi\n", c.re, c.im);
+        }
+}
+
+/***************************************/
+
+void test7976() {
+    creal[] a = new creal[2];
+    auto b = a[0] = a[1];
+}
+
+/***************************************/
+// https://issues.dlang.org/show_bug.cgi?id=17087
+
+cfloat toComplex(int x) { return cast(cfloat)x; }
+
+void test17087()
+{
+    assert (toComplex(1) == 1.0);
+}
+
+/***************************************/
+
+int main(char[][] args)
+{
+
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test7581();
+    test7594();
+    test7593();
+    test7591();
+    test8966();
+    test10677();
+    test7806();
+    test7976();
+    test17087();
+
+    printf("Success!\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/constfold.d b/gcc/testsuite/gdc.test/runnable/constfold.d
new file mode 100644
index 00000000000..3fbce715e46
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/constfold.d
@@ -0,0 +1,666 @@
+//#! blah
+#line 2
+
+static assert(__LINE__ == 3); // fails as __LINE__ is 2
+
+import std.stdio;
+import std.math : signbit, sqrt;
+
+
+/************************************/
+
+static assert(-(1) == -1);
+static assert(-(6i) == -6i);
+static assert(-(1 + 6i) == -1 - 6i);
+
+static assert(!27 == 0);
+static assert(!0 == 1);
+static assert(!6.2 == 0);
+static assert(!0.0 == 1);
+static assert(!3.7i == 0);
+static assert(!0.0i == 1);
+static assert(!(2+3.7i) == 0);
+static assert(!(0+3.7i) == 0);
+static assert(!(2+0.0i) == 0);
+static assert(!(0+0.0i) == 1);
+
+static assert(-6i + 2i == -4i);
+static assert(6i - 1i == 5i);
+
+static assert((3.6 + 7.2i) / (1 + 0i) == 3.6 + 7.2i);
+static assert((3.6 + 7.2i) / (0.0 + 1i) == 7.2 - 3.6i);
+
+static assert((6 % 4) == 2);
+static assert((6u % 4u) == 2u);
+
+static assert((cast(byte)0x109 >> 1) == 4);
+static assert((cast(byte)-1 >> 1) == -1);
+static assert((cast(ubyte)0x109 >> 1) == 4);
+
+static assert((cast(short)0x10009 >> 1) == 4);
+static assert((cast(short)-1 >> 1) == -1);
+static assert((cast(ushort)0x10009 >> 1) == 4);
+
+static assert((cast(long)0x1_0000_0000_0009 >> 1) == 0x8000_0000_0004);
+static assert((cast(long)-1L >> 1) == -1);
+static assert((cast(ulong)0x10009 >> 1) == 0x8004);
+
+static assert((cast(byte)0x109 >>> 1) == 4);
+static assert((cast(byte)-1 >>> 1) == int.max);
+static assert((cast(ubyte)0x109 >>> 1) == 4);
+
+static assert((cast(short)0x10009 >>> 1) == 4);
+static assert((cast(short)-1 >>> 1) == int.max);
+static assert((cast(ushort)0x10009 >>> 1) == 4);
+
+static assert((cast(long)0x1_0000_0000_0009 >>> 1) == 0x8000_0000_0004);
+static assert((cast(long)-1L >>> 1) == long.max);
+static assert((cast(ulong)0x10009 >>> 1) == 0x8004);
+
+static assert((3 ^ 5) == 6);
+
+static assert((0 && 0) == 0);
+static assert((0 && 5) == 0);
+static assert((10 && 0) == 0);
+static assert((58 && 10000) == 1);
+
+static assert((0.0 && 0.0) == 0);
+static assert((0.0 && 5.1) == 0);
+static assert((10.0 && 0.0) == 0);
+static assert((58.6 && 10000.7) == 1);
+
+static assert((0 || 0) == 0);
+static assert((0 || 5) == 1);
+static assert((10 || 0) == 1);
+static assert((58 || 10000) == 1);
+
+static assert((0.0 || 0.0) == 0);
+static assert((0.0 || 5.1) == 1);
+static assert((10.0 || 0.0) == 1);
+static assert((58.6 || 10000.7) == 1);
+
+static assert((5 < 3) == 0);
+static assert((5 < 5) == 0);
+static assert((5 < 6) == 1);
+static assert((5 <= 3) == 0);
+static assert((5 <= 5) == 1);
+static assert((5 <= 6) == 1);
+static assert((5 > 3) == 1);
+static assert((5 > 5) == 0);
+static assert((5 > 6) == 0);
+static assert((5 >= 3) == 1);
+static assert((5 >= 5) == 1);
+static assert((5 >= 6) == 0);
+
+static assert((-5 < -3) == 1);
+static assert((-5 < -5) == 0);
+static assert((-5 < -6) == 0);
+static assert((-5 <= -3) == 1);
+static assert((-5 <= -5) == 1);
+static assert((-5 <= -6) == 0);
+static assert((-5 > -3) == 0);
+static assert((-5 > -5) == 0);
+static assert((-5 > -6) == 1);
+static assert((-5 >= -3) == 0);
+static assert((-5 >= -5) == 1);
+static assert((-5 >= -6) == 1);
+
+static assert((5u < 3u) == 0);
+static assert((5u < 5u) == 0);
+static assert((5u < 6u) == 1);
+static assert((5u <= 3u) == 0);
+static assert((5u <= 5u) == 1);
+static assert((5u <= 6u) == 1);
+static assert((5u > 3u) == 1);
+static assert((5u > 5u) == 0);
+static assert((5u > 6u) == 0);
+static assert((5u >= 3u) == 1);
+static assert((5u >= 5u) == 1);
+static assert((5u >= 6u) == 0);
+
+static assert((-5u < 3) == 0);
+static assert((-5u <= 3) == 0);
+static assert((-5u > 3) == 1);
+static assert((-5u >= 3) == 1);
+
+static assert((-5 < 3u) == 0);
+static assert((-5 <= 3u) == 0);
+static assert((-5 > 3u) == 1);
+static assert((-5 >= 3u) == 1);
+
+static assert((5.2 <    double.nan) == 0);
+static assert((5.2 <=   double.nan) == 0);
+static assert((5.2 >    double.nan) == 0);
+static assert((5.2 >=   double.nan) == 0);
+
+static assert((double.nan <    6.2) == 0);
+static assert((double.nan <=   6.2) == 0);
+static assert((double.nan >    6.2) == 0);
+static assert((double.nan >=   6.2) == 0);
+
+static assert((double.nan <    double.nan) == 0);
+static assert((double.nan <=   double.nan) == 0);
+static assert((double.nan >    double.nan) == 0);
+static assert((double.nan >=   double.nan) == 0);
+
+static assert((5.2 <    6.2) == 1);
+static assert((5.2 <=   6.2) == 1);
+static assert((5.2 >    6.2) == 0);
+static assert((5.2 >=   6.2) == 0);
+
+static assert((5.2 <    5.2) == 0);
+static assert((5.2 <=   5.2) == 1);
+static assert((5.2 >    5.2) == 0);
+static assert((5.2 >=   5.2) == 1);
+
+static assert((7.2 <    6.2) == 0);
+static assert((7.2 <=   6.2) == 0);
+static assert((7.2 >    6.2) == 1);
+static assert((7.2 >=   6.2) == 1);
+
+static assert((7.2i < 6.2i) == 0);
+
+
+static assert((7.2i == 6.2i) == 0);
+static assert((7.2i != 6.2i) == 1);
+static assert((7.2 == 6.2) == 0);
+static assert((7.2 != 6.2) == 1);
+
+static assert((7.2i == 7.2i) == 1);
+static assert((7.2i != 7.2i) == 0);
+static assert((7.2 == 7.2) == 1);
+static assert((7.2 != 7.2) == 0);
+
+static assert((7.2 == double.nan) == 0);
+static assert((7.2 != double.nan) == 1);
+static assert((double.nan == double.nan) == 0);
+static assert((double.nan != double.nan) == 1);
+static assert((double.nan == 7.2) == 0);
+static assert((double.nan != 7.2) == 1);
+
+static assert((5 is 5) == 1);
+static assert((5 is 4) == 0);
+static assert((5 !is 5) == 0);
+static assert((5 !is 4) == 1);
+
+static assert((5.1 is 5.1) == 1);
+static assert((5.1 is 4.1) == 0);
+static assert((5.1 !is 5.1) == 0);
+static assert((5.1 !is 4.1) == 1);
+
+static assert((5.1 is 5.1i) == 0);
+static assert((5.1 !is 5.1i) == 1);
+
+static assert((5 ? 2 : 3) == 2);
+static assert((0 ? 2 : 3) == 3);
+static assert((5.0 ? 2 : 3) == 2);
+static assert((0.0 ? 2 : 3) == 3);
+
+static assert("abc" == "abc");
+
+//static assert("abc"w.sizeof == 6);
+//static assert("\U00010000bc"w.sizeof == 8);
+
+static assert([1,2,3][1] == 2);
+static assert([1,2,3] ~ [4] == [1,2,3,4]);
+static assert([1,2,3][1..3] == [2,3]);
+
+static assert(['a','b','c','d'] == "abcd");
+static assert("efgh" == ['e','f','g','h']);
+static assert("efgi" != ['e','f','g','h']);
+
+static assert((2 ^^ 8) == 256);
+static assert((3 ^^ 8.0) == 6561);
+static assert((4.0 ^^ 8) == 65536);
+static assert((5.0 ^^ 8.0) == 390625);
+
+static assert((0.5 ^^ 3) == 0.125);
+static assert((1.5 ^^ 3.0) == 3.375);
+static assert((2.5 ^^ 3) == 15.625);
+static assert((3.5 ^^ 3.0) == 42.875);
+
+static assert(((-2) ^^ -5.0) == -0.031250);
+static assert(((-2.0) ^^ -6) == 0.015625);
+static assert(((-2.0) ^^ -7.0) == -0.0078125);
+
+static assert((144 ^^ 0.5) == 12);
+static assert((1089 ^^ 0.5) == 33);
+static assert((1764 ^^ 0.5) == 42);
+static assert((650.25 ^^ 0.5) == 25.5);
+
+
+void test1()
+{
+    int x;
+    int y;
+    int* p;
+
+    p = &x + cast(size_t)&y;
+    p = &x + 2;
+    p = 4 + &y;
+    p = &x - 1;
+
+    assert((&x is &x) == 1);
+    assert((&x is &y) == 0);
+    assert((&x !is &x) == 0);
+    assert((&x !is &y) == 1);
+}
+
+/************************************/
+
+void test2()
+{
+    // This test only tests undefined, architecture-dependant behavior.
+    // E.g. the result of converting a float whose value doesn't fit into the integer
+    // leads to an undefined result.
+    version(GNU)
+       return;
+
+    float f = float.infinity;
+    int i = cast(int) f;
+    writeln(i);
+    writeln(cast(int)float.max);
+    assert(i == cast(int)float.max);
+    assert(i == 0x80000000);
+}
+
+/************************************/
+
+void test3()
+{
+     real n = -0.0;
+     const real m = -0.0;
+
+     creal c = -0.0 + 3i;
+     creal d = n + 3i;
+     creal e = m + 3i;
+
+     // should print "11111"
+     writeln(signbit(n), signbit(m),
+        signbit(c.re), signbit(d.re), signbit(e.re));
+
+     assert(signbit(n) == 1);
+     assert(signbit(m) == 1);
+     assert(signbit(c.re) == 1);
+     assert(signbit(d.re) == 1);
+     assert(signbit(e.re) == 1);
+}
+
+/************************************/
+
+struct A4 { char [] a; }
+struct B4 { long x; }
+struct C4 { int a;
+    static C4 opCall(int b) { C4 q; q.a=b; return q; }
+}
+static assert(!is(typeof( (){ A4 s; B4 q = s; })));
+static assert(!is(typeof( (){ B4 x =1L; })));
+static assert(is(typeof( (){ C4 g = 7; })));
+static assert(is(typeof( (){ C4 g = 7; C4 h = g;})));
+
+/************************************/
+
+alias uint DWORD;
+MY_API_FUNCTION lpStartAddress;
+extern (Windows) alias DWORD function(void*) MY_API_FUNCTION;
+pragma(msg, MY_API_FUNCTION.stringof);
+static assert(MY_API_FUNCTION.stringof == "extern (Windows) uint function(void*)");
+
+/************************************/
+
+enum bug6 = cast(void*)0xFEFEFEFE;
+static assert(bug6 is bug6);
+
+/************************************/
+
+struct S7{
+   double z;
+}
+
+int bug7(int x) {  return x; }
+
+S7 s7;
+double e7 = 4;
+const double d7 = 4;
+
+static assert(!is(typeof(bug7(cast(long)e7))));
+static assert(!is(typeof(bug7(cast(long)s7))));
+static assert(!is(typeof(bug7(cast(long)3.256679e30))));
+
+static assert(is(typeof(bug7(cast(long)d7))));
+static assert(is(typeof(bug7(cast(long)3.256679e4))));
+
+/************************************/
+
+class C8 {
+    int x;
+}
+alias C8.x F8;
+static assert(is(typeof(F8) == int));
+static assert(is(typeof(C8.x) == int));
+
+/************************************/
+
+int foo9() {
+   int u = cast(int)(0x1_0000_0000L);
+   while (u) {
+      if (u) {
+         assert(u!=0);
+        }
+      assert(u!=0);
+   }
+   return 2;
+}
+
+static assert(foo9()==2);
+
+/************************************/
+// Bugzilla 6077
+
+void test6077() {
+    static string scat(string s1, string s2)
+    {
+        return s1 ~ s2;
+    }
+
+    static string scatass(string s1, string s2)
+    {
+        s1 ~= s2;
+        return s1;
+    }
+
+    static string[] arycats(string[] ary, string s)
+    {
+        return ary ~ s;
+    }
+
+    static string[] scatary(string s, string[] ary)
+    {
+        return s ~ ary;
+    }
+
+    static string[] arycatasss(string[] ary, string s)
+    {
+        ary ~= s;
+        return ary;
+    }
+
+    static assert(scat(null, null) is null);
+    static assert(scatass(null, null) is null);
+    static assert(arycats(null, null) == cast(string[])[null]);
+    static assert(scatary(null, null) == cast(string[])[null]);
+    static assert(arycatasss(null, null) == cast(string[])[null]);
+}
+
+/************************************/
+
+int test4()
+{
+    int i;
+
+    dchar  d;
+    d  >>= 1;
+    d >>>= 1;
+    d  <<= 1;
+    d = d  >> 1;
+    d = d >>> 1;
+    d = d  << 1;
+    wchar  w;
+    w  >>= 1;
+    w >>>= 1;
+    w  <<= 1;
+    w = w  >> 1;
+    w = w >>> 1;
+    i = w  << 1; // promoted to int
+    char   c;
+    c  >>= 1;
+    c >>>= 1;
+    c  <<= 1;
+    c = c  >> 1;
+    c = c >>> 1;
+    i = c  << 1; // promoted to int
+    return d + w + c + i;
+}
+
+static assert(test4() == 24666);
+
+/************************************/
+// 8400
+
+void test8400()
+{
+    immutable a = [1,2];
+    int[a.length+0] b; // ok
+    int[a.length  ] c; // error
+}
+
+/************************************/
+// 8939
+
+void foo8939(T)(ref T) { } // same for `auto ref`
+void bar8939(ref const int) { }
+void bar8939(ref const S8939) { }
+
+static struct S8939 { int n; }
+
+const gn8939 = 1; // or `immutable`
+const gs8939 = S8939(3);
+static assert(__traits(compiles, foo8939(gn8939), bar8939(gn8939)));
+static assert(__traits(compiles, foo8939(gs8939), bar8939(gs8939)));
+
+void test8939()
+{
+    foo8939(gn8939), bar8939(gn8939);
+    foo8939(gs8939), bar8939(gs8939);
+
+    const ln8939 = 1;
+    const ls8939 = S8939(3);
+    foo8939(ln8939), bar8939(ln8939);
+    foo8939(ls8939), bar8939(ls8939);
+}
+
+class C8939regression
+{
+    const int n1 = 0;
+    const int n2 = 0;
+    const int n3 = 0;
+    const int n4 = 1;
+
+    int refValue(V)(ref V var)
+    {
+        return 0;
+    }
+
+    void foo()
+    {
+        string[2] str;
+        refValue(str[n1]);
+
+        int[] da;
+        refValue(da[n2]);
+
+        int n; int* p = &n;
+        refValue(*cast(int*)(p + n3));
+
+        refValue([1,2,n4].ptr[0]);
+    }
+}
+
+/************************************/
+// 9058
+
+template TypeTuple9058(TL...) { alias TypeTuple9058 = TL; }
+template EnumMembers9058(T)
+{
+    alias EnumMembers9058 = TypeTuple9058!(Foo9058.A, Foo9058.B);
+}
+enum Foo9058 { A, B }
+size_t bar9058(size_t n)
+{
+    return 0;
+}
+void test9058()
+{
+    Foo9058 x = [EnumMembers9058!Foo9058][bar9058($)];
+}
+
+/************************************/
+// 11159
+
+void test11159()
+{
+    import std.math : pow;
+    enum ulong
+        e_2_pow_64 = 2uL^^64,
+        e_10_pow_19 = 10uL^^19,
+        e_10_pow_20 = 10uL^^20;
+    assert(e_2_pow_64 == pow(2uL, 64));
+    assert(e_10_pow_19 == pow(10uL, 19));
+    assert(e_10_pow_20 == pow(10uL, 20));
+}
+
+/************************************/
+// 12306
+
+void test12306()
+{
+    struct Point3D { ubyte x, y, z; }
+
+    enum      Point3D pt1 = {x:1, y:1, z:1};
+    const     Point3D pt2 = {x:1, y:1, z:1};
+    immutable Point3D pt3 = {x:1, y:1, z:1};
+
+    int[pt1.z][pt1.y][pt1.x] a1;
+    int[pt2.z][pt2.y][pt2.x] a2;
+    int[pt3.z][pt3.y][pt3.x] a3;
+
+    ubyte a = 1;
+    const     Point3D ptx = {x:a, y:1, z:1};
+
+    static assert(!__traits(compiles, { int[ptx.z][ptx.y][ptx.x] ax; }));
+}
+
+/************************************/
+// 13977
+
+void test13977()
+{
+    bool cond(bool b) { return b; }
+    int x = 0;
+    void check(int n = 1) { x = n; }
+
+    cond(true) && check();
+    assert(x == 1); x = 0;
+
+    cond(false) && check();
+    assert(x == 0); x = 0;
+
+    true && check();
+    assert(x == 1); x = 0;
+
+    false && check();
+    assert(x == 0); x = 0;
+    (int[]).init && check();
+    assert(x == 0); x = 0;
+    Object.init && check();
+    assert(x == 0);
+
+    (check(2), false) && check();
+    assert(x == 2); x = 0;
+}
+
+/************************************/
+// 13978
+
+void test13978()
+{
+    bool cond(bool b) { return b; }
+    int x = 0;
+    void check(int n = 1) { x = n; }
+
+    cond(true) || check();
+    assert(x == 0); x = 0;
+
+    cond(false) || check();
+    assert(x == 1); x = 0;
+
+    true || check();
+    assert(x == 0); x = 0;
+
+    false || check();
+    assert(x == 1); x = 0;
+    (int[]).init || check();
+    assert(x == 1); x = 0;
+    Object.init || check();
+    assert(x == 1); x = 0;
+
+    (check(2), true) || check();
+    assert(x == 2); x = 0;
+}
+
+/************************************/
+// Pull Request 3697
+
+void test3697and()
+{
+    enum x = 0;
+    auto y = x && 1 / x;
+}
+
+void test3697or()
+{
+    enum x = 0;
+    enum y = 1;
+    auto z = y || 1 / x;
+}
+
+/************************************/
+// 14459
+
+void test14459()
+{
+    const char* s0 = "hi0";
+    const(char)* p0 = s0;
+    assert(p0 == s0);
+
+    const char* s1 = "hi1";
+    const char* s2 = "hi2";
+    const char* s3 = "hi3";
+    const char* s4 = "hi4";
+    const char* s5 = "hi5";
+    const char* s6 = "hi6";
+    const char* s7 = "hi7";
+    const char* s8 = "hi8";
+    const char* s9 = "hi9";
+    const char* s10 = "hi10";
+    const char* s11 = "hi11";
+    const char* s12 = "hi12";
+    const char* s13 = "hi13";
+    const char* s14 = "hi14";
+    const char* s15 = "hi15";
+    assert(p0 == s0);           // ok
+    const char* s16 = "hi16";
+    assert(p0 == s0);           // ok <- fails
+}
+
+/************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test3697and();
+    test3697or();
+    test6077();
+    test8400();
+    test8939();
+    test9058();
+    test11159();
+    test13977();
+    test13978();
+    test14459();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/cppa.d b/gcc/testsuite/gdc.test/runnable/cppa.d
new file mode 100644
index 00000000000..f15a06a4464
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/cppa.d
@@ -0,0 +1,1173 @@
+// PERMUTE_ARGS: -g
+// EXTRA_CPP_SOURCES: extra-files/cppb.cpp
+
+import core.stdc.stdio;
+import core.stdc.stdarg;
+import core.stdc.config;
+
+extern (C++)
+        int foob(int i, int j, int k);
+
+class C
+{
+    extern (C++) int bar(int i, int j, int k)
+    {
+        printf("this = %p\n", this);
+        printf("i = %d\n", i);
+        printf("j = %d\n", j);
+        printf("k = %d\n", k);
+        return 1;
+    }
+}
+
+
+extern (C++)
+        int foo(int i, int j, int k)
+{
+    printf("i = %d\n", i);
+    printf("j = %d\n", j);
+    printf("k = %d\n", k);
+    assert(i == 1);
+    assert(j == 2);
+    assert(k == 3);
+    return 1;
+}
+
+void test1()
+{
+    foo(1, 2, 3);
+
+    auto i = foob(1, 2, 3);
+    assert(i == 7);
+
+    C c = new C();
+    c.bar(4, 5, 6);
+}
+
+/****************************************/
+
+extern (C++) interface D
+{
+    int bar(int i, int j, int k);
+}
+
+extern (C++) D getD();
+
+void test2()
+{
+    D d = getD();
+    int i = d.bar(9,10,11);
+    assert(i == 8);
+}
+
+/****************************************/
+
+extern (C++) int callE(E);
+
+extern (C++) interface E
+{
+    int bar(int i, int j, int k);
+}
+
+class F : E
+{
+    extern (C++) int bar(int i, int j, int k)
+    {
+        printf("F.bar: i = %d\n", i);
+        printf("F.bar: j = %d\n", j);
+        printf("F.bar: k = %d\n", k);
+        assert(i == 11);
+        assert(j == 12);
+        assert(k == 13);
+        return 8;
+    }
+}
+
+void test3()
+{
+    F f = new F();
+    int i = callE(f);
+    assert(i == 8);
+}
+
+/****************************************/
+
+extern (C++) void foo4(char* p);
+
+void test4()
+{
+    foo4(null);
+}
+
+/****************************************/
+
+extern(C++)
+{
+  struct foo5 { int i; int j; void* p; }
+
+  interface bar5{
+    foo5 getFoo(int i);
+  }
+
+  bar5 newBar();
+}
+
+void test5()
+{
+  bar5 b = newBar();
+  foo5 f = b.getFoo(4);
+  printf("f.p = %p, b = %p\n", f.p, cast(void*)b);
+  assert(f.p == cast(void*)b);
+}
+
+
+/****************************************/
+
+extern(C++)
+{
+    struct S6
+    {
+        int i;
+        double d;
+    }
+
+    union S6_2
+    {
+        int i;
+        double d;
+    }
+
+    enum S6_3
+    {
+        A, B
+    }
+
+    S6 foo6();
+    S6_2 foo6_2();
+    S6_3 foo6_3();
+}
+
+extern (C) int foosize6();
+
+void test6()
+{
+    S6 f = foo6();
+    printf("%d %d\n", foosize6(), S6.sizeof);
+    assert(foosize6() == S6.sizeof);
+version (X86)
+{
+    assert(f.i == 42);
+    printf("f.d = %g\n", f.d);
+    assert(f.d == 2.5);
+    assert(foo6_2().i == 42);
+    assert(foo6_3() == S6_3.A);
+}
+}
+
+/****************************************/
+
+extern (C) int foo7();
+
+struct S
+{
+    int i;
+    long l;
+}
+
+void test7()
+{
+    printf("%d %d\n", foo7(), S.sizeof);
+    assert(foo7() == S.sizeof);
+}
+
+/****************************************/
+
+extern (C++) void foo8(const(char)*);
+
+void test8()
+{
+    char c;
+    foo8(&c);
+}
+
+/****************************************/
+// 4059
+
+struct elem9 { }
+
+extern(C++) void foobar9(elem9*, elem9*);
+
+void test9()
+{
+    elem9 *a;
+    foobar9(a, a);
+}
+
+/****************************************/
+
+
+struct A11802;
+struct B11802;
+
+extern(C++) class C11802
+{
+    int x;
+    void fun(A11802*) { x += 2; }
+    void fun(B11802*) { x *= 2; }
+}
+
+extern(C++) class D11802 : C11802
+{
+    override void fun(A11802*) { x += 3; }
+    override void fun(B11802*) { x *= 3; }
+}
+
+extern(C++) void test11802x(D11802);
+
+void test11802()
+{
+    auto x = new D11802();
+    x.x = 0;
+    test11802x(x);
+    assert(x.x == 9);
+}
+
+
+/****************************************/
+
+struct S13956
+{
+}
+
+extern(C++) void func13956(S13956 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6);
+
+extern(C++) void check13956(S13956 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6)
+{
+    assert(arg0 == S13956());
+    assert(arg1 == 1);
+    assert(arg2 == 2);
+    assert(arg3 == 3);
+    assert(arg4 == 4);
+    assert(arg5 == 5);
+    assert(arg6 == 6);
+}
+
+void test13956()
+{
+    func13956(S13956(), 1, 2, 3, 4, 5, 6);
+}
+
+/****************************************/
+// 5148
+
+extern (C++)
+{
+    void foo10(const(char)*, const(char)*);
+    void foo10(const int, const int);
+    void foo10(const char, const char);
+    void foo10(bool, bool);
+
+    struct MyStructType { }
+    void foo10(const MyStructType s, const MyStructType t);
+
+    enum MyEnumType { onemember }
+    void foo10(const MyEnumType s, const MyEnumType t);
+}
+
+void test10()
+{
+    char* p;
+    foo10(p, p);
+    foo10(1,2);
+    foo10('c','d');
+    MyStructType s;
+    foo10(s,s);
+    MyEnumType e;
+    foo10(e,e);
+}
+
+/****************************************/
+
+extern (C++, N11.M) { void bar11(); }
+
+extern (C++, A11.B) { extern (C++, C) { void bar(); }}
+
+void test11()
+{
+    bar11();
+    A11.B.C.bar();
+}
+/****************************************/
+
+struct Struct10071
+{
+    void *p;
+    c_long_double r;
+}
+
+extern(C++) size_t offset10071();
+void test10071()
+{
+    assert(offset10071() == Struct10071.r.offsetof);
+}
+
+/****************************************/
+
+char[100] valistbuffer;
+
+extern(C++) void myvprintfx(const(char)* format, va_list va)
+{
+    vsprintf(valistbuffer.ptr, format, va);
+}
+extern(C++) void myvprintf(const(char)*, va_list);
+extern(C++) void myprintf(const(char)* format, ...)
+{
+    va_list ap;
+    va_start(ap, format);
+    myvprintf(format, ap);
+    va_end(ap);
+}
+
+void testvalist()
+{
+    myprintf("hello %d", 999);
+    assert(valistbuffer[0..9] == "hello 999");
+}
+
+/****************************************/
+// 12825
+
+extern(C++) class C12825
+{
+    uint a = 0x12345678;
+}
+
+void test12825()
+{
+    auto c = new C12825();
+}
+
+/****************************************/
+
+struct S13955a
+{
+    float a;
+    double b;
+}
+
+struct S13955b
+{
+    double a;
+    float b;
+}
+
+struct S13955c
+{
+    float a;
+    float b;
+}
+
+struct S13955d
+{
+    double a;
+    double b;
+}
+
+extern(C++) void check13955(S13955a a, S13955b b, S13955c c, S13955d d)
+{
+    assert(a.a == 2);
+    assert(a.b == 4);
+    assert(b.a == 8);
+    assert(b.b == 16);
+    assert(c.a == 32);
+    assert(c.b == 64);
+    assert(d.a == 128);
+    assert(d.b == 256);
+}
+
+extern(C++) void func13955(S13955a a, S13955b b, S13955c c, S13955d d);
+
+void test13955()
+{
+    func13955(S13955a(2, 4), S13955b(8, 16), S13955c(32, 64), S13955d(128, 256));
+}
+
+/****************************************/
+
+extern(C++) class C13161
+{
+    void dummyfunc() {}
+    long val_5;
+    uint val_9;
+}
+
+extern(C++) class Test : C13161
+{
+    uint val_0;
+    long val_1;
+}
+
+extern(C++) size_t getoffset13161();
+
+extern(C++) class C13161a
+{
+    void dummyfunc() {}
+    c_long_double val_5;
+    uint val_9;
+}
+
+extern(C++) class Testa : C13161a
+{
+    bool val_0;
+}
+
+extern(C++) size_t getoffset13161a();
+
+void test13161()
+{
+    assert(getoffset13161() == Test.val_0.offsetof);
+    assert(getoffset13161a() == Testa.val_0.offsetof);
+}
+
+/****************************************/
+
+version (linux)
+{
+    extern(C++, __gnu_cxx)
+    {
+        struct new_allocator(T)
+        {
+            alias size_type = size_t;
+            static if (is(T : char))
+                void deallocate(T*, size_type) { }
+            else
+                void deallocate(T*, size_type);
+        }
+    }
+}
+
+extern (C++, std)
+{
+    struct allocator(T)
+    {
+        version (linux)
+        {
+            alias size_type = size_t;
+            void deallocate(T* p, size_type sz)
+            {   (cast(__gnu_cxx.new_allocator!T*)&this).deallocate(p, sz); }
+        }
+    }
+
+    version (linux)
+    {
+        class vector(T, A = allocator!T)
+        {
+            final void push_back(ref const T);
+        }
+
+        struct char_traits(T)
+        {
+        }
+
+        // https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
+        version (none)
+        {
+            extern (C++, __cxx11)
+            {
+                struct basic_string(T, C = char_traits!T, A = allocator!T)
+                {
+                }
+            }
+        }
+        else
+        {
+            struct basic_string(T, C = char_traits!T, A = allocator!T)
+            {
+            }
+        }
+
+        struct basic_istream(T, C = char_traits!T)
+        {
+        }
+
+        struct basic_ostream(T, C = char_traits!T)
+        {
+        }
+
+        struct basic_iostream(T, C = char_traits!T)
+        {
+        }
+    }
+
+    class exception { }
+}
+
+extern (C++)
+{
+    version (linux)
+    {
+        void foo14(std.vector!(int) p);
+        void foo14a(std.basic_string!(char) *p);
+        void foo14b(std.basic_string!(int) *p);
+        void foo14c(std.basic_istream!(char) *p);
+        void foo14d(std.basic_ostream!(char) *p);
+        void foo14e(std.basic_iostream!(char) *p);
+
+        void foo14f(std.char_traits!char* x, std.basic_string!char* p, std.basic_string!char* q);
+    }
+}
+
+void test14()
+{
+    version (linux)
+    {
+        std.vector!int p;
+        foo14(p);
+
+        foo14a(null);
+        foo14b(null);
+        foo14c(null);
+        foo14d(null);
+        foo14e(null);
+        foo14f(null, null, null);
+    }
+}
+
+version (linux)
+{
+    void test14a(std.allocator!int * pa)
+    {
+    pa.deallocate(null, 0);
+    }
+
+    void gun(std.vector!int pa)
+    {
+    int x = 42;
+    pa.push_back(x);
+    }
+}
+
+void test13289()
+{
+    assert(f13289_cpp_wchar_t('a') == 'A');
+    assert(f13289_cpp_wchar_t('B') == 'B');
+    assert(f13289_d_wchar('c') == 'C');
+    assert(f13289_d_wchar('D') == 'D');
+    assert(f13289_d_dchar('e') == 'E');
+    assert(f13289_d_dchar('F') == 'F');
+    assert(f13289_cpp_test());
+}
+
+extern(C++)
+{
+    bool f13289_cpp_test();
+
+    version(Posix)
+    {
+        dchar f13289_cpp_wchar_t(dchar);
+    }
+    else version(Windows)
+    {
+        wchar f13289_cpp_wchar_t(wchar);
+    }
+
+    wchar f13289_d_wchar(wchar ch)
+    {
+        if (ch <= 'z' && ch >= 'a')
+        {
+            return cast(wchar)(ch - ('a' - 'A'));
+        }
+        else
+        {
+            return ch;
+        }
+    }
+    dchar f13289_d_dchar(dchar ch)
+    {
+        if (ch <= 'z' && ch >= 'a')
+        {
+            return ch - ('a' - 'A');
+        }
+        else
+        {
+            return ch;
+        }
+    }
+}
+
+/****************************************/
+
+version (CRuntime_Microsoft)
+{
+    struct __c_long_double
+    {
+        this(double d) { ld = d; }
+        double ld;
+        alias ld this;
+    }
+
+    alias __c_long_double myld;
+}
+else
+    alias c_long_double myld;
+
+extern (C++) myld testld(myld);
+
+
+void test15()
+{
+    myld ld = 5.0;
+    ld = testld(ld);
+    assert(ld == 6.0);
+}
+
+/****************************************/
+
+version( Windows )
+{
+    alias int   x_long;
+    alias uint  x_ulong;
+}
+else
+{
+  static if( (void*).sizeof > int.sizeof )
+  {
+    alias long  x_long;
+    alias ulong x_ulong;
+  }
+  else
+  {
+    alias int   x_long;
+    alias uint  x_ulong;
+  }
+}
+
+struct __c_long
+{
+    this(x_long d) { ld = d; }
+    x_long ld;
+    alias ld this;
+}
+
+struct __c_ulong
+{
+    this(x_ulong d) { ld = d; }
+    x_ulong ld;
+    alias ld this;
+}
+
+alias __c_long mylong;
+alias __c_ulong myulong;
+
+extern (C++) mylong testl(mylong);
+extern (C++) myulong testul(myulong);
+
+
+void test16()
+{
+  {
+    mylong ld = 5;
+    ld = testl(ld);
+    assert(ld == 5 + mylong.sizeof);
+  }
+  {
+    myulong ld = 5;
+    ld = testul(ld);
+    assert(ld == 5 + myulong.sizeof);
+  }
+}
+
+/****************************************/
+
+struct S13707
+{
+    void* a;
+    void* b;
+    this(void* a, void* b)
+    {
+        this.a = a;
+        this.b = b;
+    }
+}
+
+extern(C++) S13707 func13707();
+
+void test13707()
+{
+    auto p = func13707();
+    assert(p.a == null);
+    assert(p.b == null);
+}
+
+/****************************************/
+
+struct S13932(int x)
+{
+        int member;
+}
+
+extern(C++) void func13932(S13932!(-1) s);
+
+/****************************************/
+
+extern(C++, N13337.M13337)
+{
+  struct S13337{}
+  void foo13337(S13337 s);
+}
+
+/****************************************/
+// 14195
+
+struct Delegate1(T) {}
+struct Delegate2(T1, T2) {}
+
+template Signature(T)
+{
+    alias Signature = typeof(*(T.init));
+}
+
+extern(C++)
+{
+    alias del1_t = Delegate1!(Signature!(void function()));
+    alias del2_t = Delegate2!(Signature!(int function(float, double)), Signature!(int function(float, double)));
+    void test14195a(del1_t);
+    void test14195b(del2_t);
+}
+
+void test14195()
+{
+    test14195a(del1_t());
+    test14195b(del2_t());
+}
+
+
+/****************************************/
+// 14200
+
+template Tuple14200(T...)
+{
+  alias Tuple14200 = T;
+}
+
+extern(C++) void test14200a(Tuple14200!(int));
+extern(C++) void test14200b(float, Tuple14200!(int, double));
+
+void test14200()
+{
+  test14200a(1);
+  test14200b(1.0f, 1, 1.0);
+}
+
+/****************************************/
+// check order of overloads in vtable
+
+extern (C++) class Statement {}
+extern (C++) class ErrorStatement {}
+extern (C++) class PeelStatement {}
+extern (C++) class ExpStatement {}
+extern (C++) class DtorExpStatement {}
+
+extern (C++) class Visitor
+{
+public:
+    int visit(Statement) { return 1; }
+    int visit(ErrorStatement) { return 2; }
+    int visit(PeelStatement) { return 3; }
+}
+
+extern (C++) class Visitor2 : Visitor
+{
+    int visit2(ExpStatement) { return 4; }
+    int visit2(DtorExpStatement) { return 5; }
+}
+
+extern(C++) bool testVtableCpp(Visitor2 sv);
+extern(C++) Visitor2 getVisitor2();
+
+bool testVtableD(Visitor2 sv)
+{
+    Statement s1;
+    ErrorStatement s2;
+    PeelStatement s3;
+    ExpStatement s4;
+    DtorExpStatement s5;
+
+    if (sv.visit(s1) != 1) return false;
+    if (sv.visit(s2) != 2) return false;
+    if (sv.visit(s3) != 3) return false;
+    if (sv.visit2(s4) != 4) return false;
+    if (sv.visit2(s5) != 5) return false;
+    return true;
+}
+
+void testVtable()
+{
+    Visitor2 dinst = new Visitor2;
+    if (!testVtableCpp(dinst))
+        assert(0);
+
+    Visitor2 cppinst = getVisitor2();
+    if (!testVtableD(cppinst))
+        assert(0);
+}
+
+/****************************************/
+/* problems detected by fuzzer */
+extern(C++) void fuzz1_cppvararg(long arg10, long arg11, bool arg12);
+extern(C++) void fuzz1_dvararg(long arg10, long arg11, bool arg12)
+{
+    fuzz1_checkValues(arg10, arg11, arg12);
+}
+
+extern(C++) void fuzz1_checkValues(long arg10, long arg11, bool arg12)
+{
+    assert(arg10 == 103);
+    assert(arg11 == 104);
+    assert(arg12 == false);
+}
+
+void fuzz1()
+{
+    long arg10 = 103;
+    long arg11 = 104;
+    bool arg12 = false;
+    fuzz1_dvararg(arg10, arg11, arg12);
+    fuzz1_cppvararg(arg10, arg11, arg12);
+}
+
+////////
+extern(C++) void fuzz2_cppvararg(ulong arg10, ulong arg11, bool arg12);
+extern(C++) void fuzz2_dvararg(ulong arg10, ulong arg11, bool arg12)
+{
+    fuzz2_checkValues(arg10, arg11, arg12);
+}
+
+extern(C++) void fuzz2_checkValues(ulong arg10, ulong arg11, bool arg12)
+{
+    assert(arg10 == 103);
+    assert(arg11 == 104);
+    assert(arg12 == false);
+}
+
+void fuzz2()
+{
+    ulong arg10 = 103;
+    ulong arg11 = 104;
+    bool arg12 = false;
+    fuzz2_dvararg(arg10, arg11, arg12);
+    fuzz2_cppvararg(arg10, arg11, arg12);
+}
+
+////////
+extern(C++) void fuzz3_cppvararg(wchar arg10, wchar arg11, bool arg12);
+extern(C++) void fuzz3_dvararg(wchar arg10, wchar arg11, bool arg12)
+{
+    fuzz2_checkValues(arg10, arg11, arg12);
+}
+
+extern(C++) void fuzz3_checkValues(wchar arg10, wchar arg11, bool arg12)
+{
+    assert(arg10 == 103);
+    assert(arg11 == 104);
+    assert(arg12 == false);
+}
+
+void fuzz3()
+{
+    wchar arg10 = 103;
+    wchar arg11 = 104;
+    bool arg12 = false;
+    fuzz3_dvararg(arg10, arg11, arg12);
+    fuzz3_cppvararg(arg10, arg11, arg12);
+}
+
+void fuzz()
+{
+    fuzz1();
+    fuzz2();
+    fuzz3();
+}
+
+/****************************************/
+
+extern (C++)
+{
+    void throwit();
+}
+
+void testeh()
+{
+    printf("testeh()\n");
+    version (linux)
+    {
+        version (X86_64)
+        {
+            bool caught;
+            try
+            {
+                throwit();
+            }
+            catch (std.exception e)
+            {
+                caught = true;
+            }
+            assert(caught);
+        }
+    }
+}
+
+/****************************************/
+
+version (linux)
+{
+    version (X86_64)
+    {
+        bool raii_works = false;
+        struct RAIITest
+        {
+           ~this()
+           {
+               raii_works = true;
+           }
+        }
+
+        void dFunction()
+        {
+            RAIITest rt;
+            throwit();
+        }
+
+        void testeh2()
+        {
+            printf("testeh2()\n");
+            try
+            {
+                dFunction();
+            }
+            catch(std.exception e)
+            {
+                assert(raii_works);
+            }
+        }
+    }
+    else
+        void testeh2() { }
+}
+else
+    void testeh2() { }
+
+/****************************************/
+
+extern (C++) { void throwle(); void throwpe(); }
+
+void testeh3()
+{
+    printf("testeh3()\n");
+    version (linux)
+    {
+        version (X86_64)
+        {
+            bool caught = false;
+            try
+            {
+               throwle();
+            }
+            catch (std.exception e)  //polymorphism test.
+            {
+                caught = true;
+            }
+            assert(caught);
+        }
+    }
+}
+
+/****************************************/
+// 15579
+
+extern (C++)
+{
+    class Base
+    {
+        //~this() {}
+        void based() { }
+        ubyte x = 4;
+    }
+
+    interface Interface
+    {
+        int MethodCPP();
+        int MethodD();
+    }
+
+    class Derived : Base, Interface
+    {
+        short y = 5;
+        int MethodCPP();
+        int MethodD() {
+            printf("Derived.MethodD(): this = %p, x = %d, y = %d\n", this, x, y);
+            Derived p = this;
+            //p = cast(Derived)(cast(void*)p - 16);
+            assert(p.x == 4 || p.x == 7);
+            assert(p.y == 5 || p.y == 8);
+            return 3;
+        }
+        int Method() { return 6; }
+    }
+
+    Derived cppfoo(Derived);
+    Interface cppfooi(Interface);
+}
+
+void test15579()
+{
+    Derived d = new Derived();
+    printf("d = %p\n", d);
+    assert(d.x == 4);
+    assert(d.y == 5);
+    assert((cast(Interface)d).MethodCPP() == 30);
+    assert((cast(Interface)d).MethodD() == 3);
+    assert(d.MethodCPP() == 30);
+    assert(d.MethodD() == 3);
+    assert(d.Method() == 6);
+
+    d = cppfoo(d);
+    assert(d.x == 7);
+    assert(d.y == 8);
+
+    printf("d2 = %p\n", d);
+    assert((cast(Interface)d).MethodD() == 3);
+    assert((cast(Interface)d).MethodCPP() == 30);
+    assert(d.Method() == 6);
+
+    printf("d = %p, i = %p\n", d, cast(Interface)d);
+    Interface i = cppfooi(d);
+    printf("i2: %p\n", i);
+    assert(i.MethodD() == 3);
+    assert(i.MethodCPP() == 30);
+}
+
+/****************************************/
+// 15610
+
+extern(C++) class Base2
+{
+    int i;
+    void baser() { }
+}
+
+extern(C++) interface Interface2 { abstract void f(); }
+
+extern(C++) class Derived2 : Base2, Interface2
+{
+    final
+        override void f();
+}
+
+
+void test15610()
+{
+    auto c = new Derived2();
+    printf("test15610(): c = %p\n", c);
+    c.i = 3;
+    c.f();
+}
+
+/******************************************/
+// 15455
+
+struct X6
+{
+    ushort a;
+    ushort b;
+    ubyte c;
+    ubyte d;
+}
+
+static assert(X6.sizeof == 6);
+
+struct X8
+{
+    ushort a;
+    X6 b;
+}
+
+static assert(X8.sizeof == 8);
+
+void test15455a(X8 s)
+{
+    assert(s.a == 1);
+    assert(s.b.a == 2);
+    assert(s.b.b == 3);
+    assert(s.b.c == 4);
+    assert(s.b.d == 5);
+}
+
+extern (C++) void test15455b(X8 s);
+
+void test15455()
+{
+    X8 s;
+
+    s.a = 1;
+    s.b.a = 2;
+    s.b.b = 3;
+    s.b.c = 4;
+    s.b.d = 5;
+    test15455a(s);
+    test15455b(s);
+}
+
+/****************************************/
+// 16536 - mangling mismatch on OSX
+
+version(OSX) extern(C++) ulong pass16536(ulong);
+
+void test16536()
+{
+    version(OSX) assert(pass16536(123) == 123);
+}
+
+/****************************************/
+
+void main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test13956();
+    test5();
+    test6();
+    test10071();
+    test7();
+    test8();
+    test11802();
+    test9();
+    test10();
+    test13955();
+    test11();
+    testvalist();
+    test12825();
+    test13161();
+    test14();
+    test13289();
+    test15();
+    test16();
+    func13707();
+    func13932(S13932!(-1)(0));
+    foo13337(S13337());
+    test14195();
+    test14200();
+    testVtable();
+    fuzz();
+    testeh();
+    testeh2();
+    testeh3();
+    test15579();
+    test15610();
+    test15455();
+    test16536();
+
+    printf("Success\n");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/cppmangle1.d b/gcc/testsuite/gdc.test/runnable/cppmangle1.d
new file mode 100644
index 00000000000..a41e00096d4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/cppmangle1.d
@@ -0,0 +1,10 @@
+// EXTRA_CPP_SOURCES: extra-files/cppmangle1.cpp
+
+extern(C++):
+
+int test0(int);
+
+void main()
+{
+    assert(test0(42)==42);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/ctorpowtests.d b/gcc/testsuite/gdc.test/runnable/ctorpowtests.d
new file mode 100644
index 00000000000..2fb458e44f1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ctorpowtests.d
@@ -0,0 +1,248 @@
+// PERMUTE_ARGS:
+
+int magicVariable()
+{
+  if (__ctfe)
+   return 3;
+
+  version(GNU)
+  {
+    version(X86)
+      asm { "nop"; }
+    else version(X86_64)
+      asm { "nop"; }
+    else
+      static assert("");
+  }
+  else
+      asm { nop; }
+  return 2;
+}
+
+static assert(magicVariable()==3);
+
+void main()
+{
+  assert(!__ctfe);
+  assert(magicVariable()==2);
+}
+
+// bug 991 -- invalid.
+// bug 3500 -- is this related to 2127?
+
+// Tests for ^^
+// TODO: These tests should not require import std.math.
+
+import std.math;
+// Test float ^^ int
+static assert( 27.0 ^^ 5 == 27.0 * 27.0 * 27.0 * 27.0 * 27.0);
+static assert( 2.0 ^^ 3 == 8.0);
+
+static assert( 2.0 ^^ 4 == 16.0);
+static assert( 2 ^^ 4 == 16);
+
+// Check the typing rules.
+static assert( is (typeof(2.0^^7) == double));
+static assert( is (typeof(7^^3) == int));
+
+static assert( is (typeof(7L^^3) == long));
+static assert( is (typeof(7^^3L) == long));
+enum short POW_SHORT_1 = 3;
+enum short POW_SHORT_3 = 7;
+static assert( is (typeof(POW_SHORT_1 * POW_SHORT_1) ==
+typeof(POW_SHORT_1*POW_SHORT_1)));
+
+static assert( is (typeof(7.0^^3) == double));
+static assert( is (typeof(7.0L^^3) == real));
+static assert( is (typeof(7.0f^^3) == float));
+static assert( is (typeof(POW_SHORT_1^^3.1) == double));
+static assert( is (typeof(POW_SHORT_1^^3.1f) == float));
+static assert( is (typeof(2.1f ^^ POW_SHORT_1) == float));
+static assert( is (typeof(7.0f^^3.1) == double));
+static assert( is (typeof(7.0^^3.1f) == double));
+static assert( is (typeof(7.0f^^3.1f) == float));
+static assert( is (typeof(7.0f^^3.1L) == real));
+static assert( is (typeof(7.0L^^3.1f) == real));
+// Check typing for special cases
+static assert( is (typeof(7.0f^^2) == float));
+static assert( is (typeof(7.0f^^2.0) == double));
+static assert( is (typeof(7.0f^^8.0) == double));
+static assert( is (typeof(1^^0.5f) == float));
+static assert( is (typeof(7^^0.5f) == float));
+static assert( is (typeof(3L^^0.5) == double));
+static assert( is (typeof(123^^17.0f) == float));
+
+static assert(POW_SHORT_1 ^^ 2 == 9);
+static assert(4.0 ^^ POW_SHORT_1 == 4.0*4.0*4.0);
+static assert(4.0 ^^ 7.0 == 4.0*4.0*4.0*4.0*4.0*4.0*4.0);
+
+// ^^ has higher precedence than multiply
+static assert( 2 * 2 ^^ 3 + 1 == 17);
+static assert( 2 ^^ 3 * 2 + 1 == 17);
+// ^^ has higher precedence than negate
+static assert( -2 ^^ 3 * 2 - 1 == -17);
+
+// ^^ is right associative
+static assert( 2 ^^ 3 ^^ 2 == 2 ^^ 9);
+static assert( 2.0 ^^ -3 ^^ 2 == 2.0 ^^ -9);
+
+// 1 ^^ n is always 1, even if n is negative
+static assert( 1 ^^ -5 == 1);
+
+// -1 ^^ n gets transformed into  n & 1 ? -1 : 1
+// even if n is negative
+static assert( (-1) ^^ -5 == -1);
+static assert( (-1) ^^ -4 == 1);
+static assert( (-1) ^^ 0 == 1);
+
+// n ^^ 0 is always 1
+static assert( (-5) ^^ 0 == 1);
+
+// n ^^ 1 is always n
+static assert( 6.0 ^^ 1 == 6.0);
+
+// n ^^ -1.0 gets transformed into 1.0 / n, even if n is negative
+static assert( (-4) ^^ -1.0 == 1.0 / -4);
+static assert( 9 ^^ -1.0 == 1.0 / 9);
+
+// Other integers raised to negative powers create an error
+static assert( !is(typeof(2 ^^ -5)));
+static assert( !is(typeof((-2) ^^ -4)));
+
+// Bug 3535
+struct StructWithCtor
+{
+    this(int _n) {
+        n = _n; x = 5;
+    }
+    this(int _n, float _x) {
+        n = _n; x = _x;
+    }
+    int n;
+    float x;
+}
+
+int containsAsm() {
+       version(GNU)
+       {
+         version(X86)
+           asm { "nop"; }
+         else version(X86_64)
+           asm { "nop"; }
+         else
+           static assert("");
+       }
+       else
+          asm { nop; }
+       return 0;
+    }
+
+enum A = StructWithCtor(1);
+enum B = StructWithCtor(7, 2.3);
+
+static assert(A.n == 1);
+static assert(A.x == 5.0);
+static assert(B.n == 7);
+static assert(B.x == 2.3);
+
+int bazra(int x)
+{
+   StructWithCtor p = StructWithCtor(4);
+   return p.n ^^ 3;
+
+}
+
+static assert(bazra(14)==64);
+
+void moreCommaTests()
+{
+   auto k = (containsAsm(), containsAsm());
+   for (int i=0; i< k^^2; i+=StructWithCtor(1).n) {}
+}
+
+// Test copy constructors
+struct CopyTest {
+   double x;
+   this(double a) { x = a * 10.0;}
+   this(this) {  x+=2.0;}
+}
+
+struct CopyTest2
+{
+   int x; int x1; int x2; int x3;
+   this(int a) { x = a * 2; x1 = 3;}
+   this(this) {  x1+=17;}
+}
+
+
+const CopyTest z = CopyTest(5.3);
+/+
+// TODO: This is not yet supported. But it
+// generates an error message instead of wrong-code.
+const CopyTest w = z;
+static assert(z.x==55.0);
++/
+
+int copytest1()
+{
+   CopyTest z = CopyTest(3.4);
+   CopyTest w = z;
+   assert(w.x == 36.0);
+   CopyTest2 q = CopyTest2(7);
+   CopyTest2 q2 = q;
+   CopyTest2 q3 = q2;
+   assert(q3.x1 == 37);
+
+  return 123;
+}
+static assert(copytest1()==123);
+
+// This must not cause a segfault
+alias int FILTH;
+struct Filth
+{
+     struct Impl
+    {
+        FILTH * handle = null;
+        this(FILTH* h, uint r, string n)
+        {
+            handle = h;
+        }
+    }
+    Impl * p;
+
+    this(string name, in char[] stdioOpenmode = "rb")
+    {
+    }
+
+    ~this()
+    {
+        if (!p) return;
+    }
+
+    this(this)
+    {
+        if (!p) return;
+    }
+    }
+    struct InputByChar
+    {
+        private Filth _f;
+
+        this(Filth f)
+        {
+            _f = f;
+        }
+}
+
+
+static int nastyForCtfe=4;
+
+// Can't use a global variable
+static assert(!is(typeof( (){ static assert(0!=nastyForCtfe^^2); })));
+
+int anotherPowTest()
+{
+   double x = 5.0;
+   return x^^4 > 2.0 ? 3: 2;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/declaration.d b/gcc/testsuite/gdc.test/runnable/declaration.d
new file mode 100644
index 00000000000..0b6c6b530db
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/declaration.d
@@ -0,0 +1,412 @@
+
+extern(C) int printf(const char*, ...);
+
+/***************************************************/
+// 6475
+
+class Foo6475(Value)
+{
+    template T1(size_t n){ alias int T1; }
+}
+
+void test6475()
+{
+    alias Foo6475!(int) C1;
+    alias C1.T1!0 X1;
+    static assert(is(X1 == int));
+
+    alias const(Foo6475!(int)) C2;
+    alias C2.T1!0 X2;
+    static assert(is(X2 == int));
+}
+
+/***************************************************/
+// 6905
+
+void test6905()
+{
+    auto foo1() { static int n; return n; }
+    auto foo2() {        int n; return n; }
+    auto foo3() {               return 1; }
+    static assert(typeof(&foo1).stringof == "int delegate() nothrow @nogc @safe");
+    static assert(typeof(&foo2).stringof == "int delegate() pure nothrow @nogc @safe");
+    static assert(typeof(&foo3).stringof == "int delegate() pure nothrow @nogc @safe");
+
+    ref bar1() { static int n; return n; }
+  static assert(!__traits(compiles, {
+    ref bar2() {        int n; return n; }
+  }));
+  static assert(!__traits(compiles, {
+    ref bar3() {               return 1; }
+  }));
+
+    auto ref baz1() { static int n; return n; }
+    auto ref baz2() {        int n; return n; }
+    auto ref baz3() {               return 1; }
+    static assert(typeof(&baz1).stringof == "int delegate() nothrow @nogc ref @safe");
+    static assert(typeof(&baz2).stringof == "int delegate() pure nothrow @nogc @safe");
+    static assert(typeof(&baz3).stringof == "int delegate() pure nothrow @nogc @safe");
+}
+
+/***************************************************/
+// 7019
+
+struct S7019
+{
+    int store;
+    this(int n)
+    {
+        store = n << 3;
+    }
+}
+
+S7019 rt_gs = 2;
+enum S7019 ct_gs = 2;
+pragma(msg, ct_gs, ", ", ct_gs.store);
+
+void test7019()
+{
+    S7019 rt_ls = 3; // this compiles fine
+    enum S7019 ct_ls = 3;
+    pragma(msg, ct_ls, ", ", ct_ls.store);
+
+    static class C
+    {
+        S7019 rt_fs = 4;
+        enum S7019 ct_fs = 4;
+        pragma(msg, ct_fs, ", ", ct_fs.store);
+    }
+
+    auto c = new C;
+    assert(rt_gs == S7019(2) && rt_gs.store == 16);
+    assert(rt_ls == S7019(3) && rt_ls.store == 24);
+    assert(c.rt_fs == S7019(4) && c.rt_fs.store == 32);
+    static assert(ct_gs == S7019(2) && ct_gs.store == 16);
+    static assert(ct_ls == S7019(3) && ct_ls.store == 24);
+    static assert(C.ct_fs == S7019(4) && C.ct_fs.store == 32);
+
+    void foo(S7019 s = 5)   // fixing bug 7152
+    {
+        assert(s.store == 5 << 3);
+    }
+    foo();
+}
+
+/***************************************************/
+// 7239
+
+struct vec7239
+{
+    float x, y, z, w;
+    alias x r;  //! for color access
+    alias y g;  //! ditto
+    alias z b;  //! ditto
+    alias w a;  //! ditto
+}
+
+void test7239()
+{
+    vec7239 a = {x: 0, g: 0, b: 0, a: 1};
+    assert(a.r == 0);
+    assert(a.g == 0);
+    assert(a.b == 0);
+    assert(a.a == 1);
+}
+
+/***************************************************/
+struct S10635
+{
+    string str;
+
+    this(string[] v) { str = v[0]; }
+    this(string[string] v) { str = v.keys[0]; }
+}
+
+S10635 s10635a = ["getnonce"];
+S10635 s10635b = ["getnonce" : "str"];
+
+void test10635()
+{
+    S10635 sa = ["getnonce"];
+    S10635 sb = ["getnonce" : "str"];
+}
+
+/***************************************************/
+// 8123
+
+void test8123()
+{
+    struct S { }
+
+    struct AS
+    {
+        alias S Alias;
+    }
+
+    struct Wrapper
+    {
+        AS as;
+    }
+
+    Wrapper w;
+    static assert(is(typeof(w.as).Alias == S));         // fail
+    static assert(is(AS.Alias == S));                   // ok
+    static assert(is(typeof(w.as) == AS));              // ok
+    static assert(is(typeof(w.as).Alias == AS.Alias));  // fail
+}
+
+/***************************************************/
+// 8147
+
+enum A8147 { a, b, c }
+
+@property ref T front8147(T)(T[] a)
+if (!is(T[] == void[]))
+{
+    return a[0];
+}
+
+template ElementType8147(R)
+{
+    static if (is(typeof({ R r = void; return r.front8147; }()) T))
+        alias T ElementType8147;
+    else
+        alias void ElementType8147;
+}
+
+void test8147()
+{
+    auto arr = [A8147.a];
+    alias typeof(arr) R;
+    auto e = ElementType8147!R.init;
+}
+
+/***************************************************/
+// 8410
+
+void test8410()
+{
+    struct Foo { int[15] x; string s; }
+
+    Foo[5] a1 = Foo([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "hello"); // OK
+    Foo f = { s: "hello" }; // OK (not static)
+    Foo[5] a2 = { s: "hello" }; // error
+}
+
+/***************************************************/
+// 8942
+
+alias const int A8942_0;
+static assert(is(A8942_0 == const int)); // passes
+
+void test8942()
+{
+    alias const int A8942_1;
+    static assert(is(A8942_1 == const int)); // passes
+
+    static struct S { int i; }
+    foreach (Unused; typeof(S.tupleof))
+    {
+        alias const(int) A8942_2;
+        static assert(is(A8942_2 == const int)); // also passes
+
+        alias const int A8942_3;
+        static assert(is(A8942_3 == const int)); // fails
+        // Error: static assert  (is(int == const(int))) is false
+    }
+}
+
+/***************************************************/
+// 10144
+
+final class TNFA10144(char_t)
+{
+    enum Act { don }
+    const Act[] action_lookup1 = [ Act.don, ];
+}
+alias X10144 = TNFA10144!char;
+
+class C10144
+{
+    enum Act { don }
+    synchronized { enum x1 = [Act.don]; }
+    override     { enum x2 = [Act.don]; }
+    abstract     { enum x3 = [Act.don]; }
+    final        { enum x4 = [Act.don]; }
+    synchronized { static s1 = [Act.don]; }
+    override     { static s2 = [Act.don]; }
+    abstract     { static s3 = [Act.don]; }
+    final        { static s4 = [Act.don]; }
+    synchronized { __gshared gs1 = [Act.don]; }
+    override     { __gshared gs2 = [Act.don]; }
+    abstract     { __gshared gs3 = [Act.don]; }
+    final        { __gshared gs4 = [Act.don]; }
+}
+
+/***************************************************/
+
+// 10142
+
+class File10142
+{
+    enum Access : ubyte { Read = 0x01 }
+    enum Open : ubyte { Exists = 0 }
+    enum Share : ubyte { None = 0 }
+    enum Cache : ubyte { None = 0x00 }
+
+    struct Style
+    {
+        Access  access;
+        Open    open;
+        Share   share;
+        Cache   cache;
+    }
+    enum Style ReadExisting = { Access.Read, Open.Exists };
+
+    this (const(char[]) path, Style style = ReadExisting)
+    {
+        assert(style.access == Access.Read);
+        assert(style.open   == Open  .Exists);
+        assert(style.share  == Share .None);
+        assert(style.cache  == Cache .None);
+    }
+}
+
+void test10142()
+{
+    auto f = new File10142("dummy");
+}
+
+/***************************************************/
+// 11421
+
+void test11421()
+{
+    // AAs in array
+    const            a1 = [[1:2], [3:4]];   // ok <- error
+    const int[int][] a2 = [[1:2], [3:4]];   // ok
+    static assert(is(typeof(a1) == typeof(a2)));
+
+    // AAs in AA
+    auto aa = [1:["a":1.0], 2:["b":2.0]];
+    static assert(is(typeof(aa) == double[string][int]));
+    assert(aa[1]["a"] == 1.0);
+    assert(aa[2]["b"] == 2.0);
+}
+
+/***************************************************/
+// 13776
+
+enum a13776(T) = __traits(compiles, { T; });
+
+enum b13776(A...) = 1;
+
+template x13776s()
+{
+    struct S;
+    alias x13776s = b13776!(a13776!S);
+}
+template y13776s()
+{
+    struct S;
+    alias x2 = b13776!(a13776!S);
+    alias y13776s = x2;
+}
+template z13776s()
+{
+    struct S;
+    alias x1 = a13776!S;
+    alias x2 = b13776!(x1);
+    alias z13776s = x2;
+}
+
+template x13776c()
+{
+    class C;
+    alias x13776c = b13776!(a13776!C);
+}
+template y13776c()
+{
+    class C;
+    alias x2 = b13776!(a13776!C);
+    alias y13776c = x2;
+}
+template z13776c()
+{
+    class C;
+    alias x1 = a13776!C;
+    alias x2 = b13776!(x1);
+    alias z13776c = x2;
+}
+
+void test13776()
+{
+    alias xs = x13776s!();  // ok <- ng
+    alias ys = y13776s!();  // ok <- ng
+    alias zs = z13776s!();  // ok
+
+    alias xc = x13776c!();  // ok <- ng
+    alias yc = y13776c!();  // ok <- ng
+    alias zc = z13776c!();  // ok
+}
+
+/***************************************************/
+// 14090
+
+template Packed14090(Args...)
+{
+    enum x = __traits(compiles, { Args[0] v; });
+    // Args[0] is an opaque struct Empty, so the variable declaration fails to compile.
+    // The error message creation calls TypeStruct('_Empty')->toChars(), and
+    // it wrongly calls TemplateInstance('RoundRobin!()')->toAlias().
+    // Finally it will cause incorrect "recursive template instantiation" error.
+}
+
+template Map14090(A...)
+{
+    alias Map14090 = A[0];
+}
+
+template RoundRobin14090()
+{
+    struct Empty;
+    alias RoundRobin14090 = Map14090!(Packed14090!(Empty));
+}
+
+alias roundRobin14090 = RoundRobin14090!();
+
+/***************************************************/
+// 13950
+
+template Tuple13950(T...) { alias T Tuple13950; }
+
+void f13950(int x = 0, Tuple13950!() xs = Tuple13950!())
+{
+    assert(x == 0);
+    assert(xs.length == 0);
+}
+
+void test13950()
+{
+    f13950();
+}
+
+/***************************************************/
+
+int main()
+{
+    test6475();
+    test6905();
+    test7019();
+    test7239();
+    test8123();
+    test8147();
+    test8410();
+    test8942();
+    test10142();
+    test11421();
+    test13950();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/delegate.d b/gcc/testsuite/gdc.test/runnable/delegate.d
new file mode 100644
index 00000000000..a371e1cee3d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/delegate.d
@@ -0,0 +1,357 @@
+// REQUIRED_ARGS:
+
+import core.stdc.stdio;
+
+/********************************************************/
+
+//int delegate(int, char[]) *p;
+
+class Foo
+{
+   int bar(int i, char[] s) { return 4; }
+}
+
+class Bar : Foo
+{
+   override int bar(int i, char[] s) { return 5; }
+}
+
+void test1()
+{
+    int delegate(int, char[]) dg;
+    Foo f = new Foo();
+    Bar b = new Bar();
+    int x;
+
+    dg = &f.bar;
+    x = dg(3, null);
+    assert(x == 4);
+
+    f = b;
+    dg = &f.bar;
+    x = dg(3, null);
+    assert(x == 5);
+}
+
+/********************************************************/
+
+int foo2()
+{
+    return 3;
+}
+
+void test2()
+{
+    int function () fp;
+
+    fp = &foo2;
+    assert(fp() == 3);
+}
+
+/********************************************************/
+
+class Foo3
+{
+    int bar(int i, char[] s) { return 47; }
+
+    void test()
+    {
+        int delegate(int, char[]) dg;
+
+        dg = &bar;
+        printf("%d %d\n", dg(3, null), result());
+        assert(dg(3, null) == result());
+
+        dg = &this.bar;
+        printf("%d %d\n", dg(3, null), result());
+        assert(dg(3, null) == result());
+    }
+
+    int result() { return 47; }
+}
+
+class Bar3 : Foo3
+{
+    override int bar(int i, char[] s) { return 48; }
+
+    override int result() { return 48; }
+
+    void test2()
+    {
+        int delegate(int, char[]) dg;
+
+        dg = &super.bar;
+        assert(dg(3, null) == 47);
+    }
+
+}
+
+void test3()
+{
+    Foo3 f = new Foo3();
+    f.test();
+
+    Bar3 b = new Bar3();
+    b.test();
+    b.test2();
+}
+
+/********************************************************/
+
+
+int foo4(int x) { return 1; }
+int foo4(char x) { return 2; }
+int foo4(int x, int y) { return 3; }
+
+void test4()
+{
+    int function (char) fp;
+
+    fp = &foo4;
+    assert(fp(0) == 2);
+}
+
+/********************************************************/
+
+class Abc
+{
+    int foo1(int x) { return 1; }
+    int foo1(char x) { return 2; }
+    int foo1(int x, int y) { return 3; }
+}
+
+void test5()
+{
+    int delegate(char) dg;
+    Abc a = new Abc();
+
+    dg = &a.foo1;
+    assert(dg(0) == 2);
+}
+
+/********************************************************/
+
+int delegate(int) bar6;
+
+int[int delegate(int)] aa6;
+
+void test6()
+{
+    aa6[bar6] = 0;
+}
+
+/********************************************************/
+
+void foo7(void delegate(int) dg)
+{
+    dg(1);
+    //writefln("%s", dg(3));
+}
+
+void test7()
+{
+    foo7(delegate(int i)
+        {
+            printf("i = %d\n", i);
+        }
+        );
+}
+
+/********************************************************/
+
+void foo8(int delegate(int) dg)
+{
+    printf("%d\n", dg(3));
+    assert(dg(3) == 6);
+}
+
+void test8()
+{
+    foo8(delegate(int i)
+        {
+            return i * 2;
+        }
+        );
+}
+
+/********************************************************/
+
+void foo9(int delegate(int) dg)
+{
+    assert(dg(3) == 6);
+}
+
+void test9()
+{
+    foo9( (int i) { return i * 2; } );
+}
+
+/********************************************************/
+// 8257
+
+struct S8257 {
+    static int g() {
+        return 6;
+    }
+}
+
+void test8257()
+{
+     S8257 s;
+     int w = 2;
+     S8257 func() { ++w; return s; }
+     auto k = &(func()).g;
+     // check that the call to func() still happened
+     assert(w == 3);
+     assert( k() == 6);
+}
+
+auto f8257(string m)() { return &__traits(getMember, S8257.init, m); }
+static assert (__traits(compiles, f8257!"g"()));
+
+/********************************************************/
+
+void foo10(int delegate() dg)
+{
+    assert(dg() == 6);
+}
+
+void test10()
+{   int i = 3;
+
+    foo10( { return i * 2; } );
+}
+
+/********************************************************/
+
+class A12
+{
+public:
+  int delegate(int, int) dgs[4];
+  int function(int, int) fps[4];
+  int delegate(int, int) dg;
+  int function(int, int) fp;
+  int f(int x, int y) {
+    printf("here ");
+    int res = x + y;
+    printf("%d\n", res);
+    return res;
+  }
+
+  void bug_1() {
+//    fp = &f;
+//    fp(1,2);
+    dg = &f;
+    dg(1,2);
+//    fps[] = [&f, &f, &f, &(f)];  // bug 1: this line shouldn't compile
+//    this.fps[0](1, 2);  // seg-faults here!
+
+    dgs[] = [&(f), &(f), &(f), &(f)];  // bug 1: why this line can't compile?
+    this.dgs[0](1, 2);
+
+    dgs[] = [&(this.f), &(this.f), &(this.f), &(this.f)];
+    this.dgs[0](1, 2);
+  }
+
+}
+
+void test12()
+{
+  A12 a = new A12();
+
+  a.bug_1();
+}
+
+/********************************************************/
+// 1570
+
+class A13
+{
+    int f()
+    {
+        return 1;
+    }
+}
+
+class B13 : A13
+{
+    override int f()
+    {
+        return 2;
+    }
+}
+
+void test13()
+{
+    B13 b = new B13;
+    assert(b.f() == 2);
+    assert(b.A13.f() == 1);
+    assert((&b.f)() == 2);
+    assert((&b.A13.f)() == 1);
+}
+
+/********************************************************/
+// 2472
+
+class A2472
+{
+    void foo() {}
+}
+
+void test2472()
+{
+    auto a = new A2472;
+    auto fp1 = (&a.foo).funcptr;
+    auto dg = &a.foo;
+    auto fp2 = dg.funcptr;
+    assert(fp1 == fp2);
+}
+
+/********************************************************/
+
+void testAssign()
+{
+    static class C
+    {
+        int a;
+        this(int a) { this.a = a; }
+        int funca() { return a; }
+        int funcb() { return a + 1; }
+    }
+
+    auto x = new C(5);
+    auto y = new C(7);
+
+    auto dg = &x.funca;
+    assert(dg() == 5);
+    dg.funcptr = &C.funcb;
+    assert(dg() == 6);
+    dg.ptr = cast(void*)y;
+    assert(dg() == 8);
+    dg.funcptr = &C.funca;
+    assert(dg() == 7);
+}
+
+/********************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test12();
+    test13();
+    test2472();
+    test8257();
+    testAssign();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/dhry.d b/gcc/testsuite/gdc.test/runnable/dhry.d
new file mode 100644
index 00000000000..9edf593d46f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/dhry.d
@@ -0,0 +1,911 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -release -O -g -inline
+
+/*
+ *************************************************************************
+ *
+ *                   "DHRYSTONE" Benchmark Program
+ *                   -----------------------------
+ *
+ *  Version:    C, Version 2.1
+ *
+ *  File:       dhry.h (part 1 of 3)
+ *
+ *  Date:       May 25, 1988
+ *
+ *  Author:     Reinhold P. Weicker
+ *              Siemens Nixdorf Inf. Syst.
+ *              STM OS 32
+ *              Otto-Hahn-Ring 6
+ *              W-8000 Muenchen 83
+ *              Germany
+ *                      Phone:    [+49]-89-636-42436
+ *                                (8-17 Central European Time)
+ *                      UUCP:     weicker@ztivax.uucp@unido.uucp
+ *                      Internet: weicker@ztivax.siemens.com
+ *
+ *              Original Version (in Ada) published in
+ *              "Communications of the ACM" vol. 27., no. 10 (Oct. 1984),
+ *              pp. 1013 - 1030, together with the statistics
+ *              on which the distribution of statements etc. is based.
+ *
+ *              In this C version, the following C library functions are
+ *              used:
+ *              - strcpy, strcmp (inside the measurement loop)
+ *              - printf, scanf (outside the measurement loop)
+ *
+ *  Collection of Results:
+ *              Reinhold Weicker (address see above) and
+ *
+ *              Rick Richardson
+ *              PC Research. Inc.
+ *              94 Apple Orchard Drive
+ *              Tinton Falls, NJ 07724
+ *                      Phone:  (201) 834-1378 (9-17 EST)
+ *                      UUCP:   ...!uunet!pcrat!rick
+ *
+ *      Please send results to Rick Richardson and/or Reinhold Weicker.
+ *      Complete information should be given on hardware and software
+ *      used. Hardware information includes: Machine type, CPU, type and
+ *      size of caches; for microprocessors: clock frequency, memory speed
+ *      (number of wait states). Software information includes: Compiler
+ *      (and runtime library) manufacturer and version, compilation
+ *      switches, OS version. The Operating System version may give an
+ *      indication about the compiler; Dhrystone itself performs no OS
+ *      calls in the measurement loop.
+ *
+ *      The complete output generated by the program should be mailed
+ *      such that at least some checks for correctness can be made.
+ *
+ *************************************************************************
+ *
+ *  History:    This version C/2.1 has been made for two reasons:
+ *
+ *              1) There is an obvious need for a common C version of
+ *              Dhrystone, since C is at present the most popular system
+ *              programming language for the class of processors
+ *              (microcomputers, minicomputers) where Dhrystone is used
+ *              most. There should be, as far as possible, only one C
+ *              version of Dhrystone such that results can be compared
+ *              without restrictions. In the past, the C versions
+ *              distributed by Rick Richardson (Version 1.1) and by
+ *              Reinhold Weicker had small (though not significant)
+ *              differences.
+ *
+ *              2) As far as it is possible without changes to the
+ *              Dhrystone statistics, optimizing compilers should be
+ *              prevented from removing significant statements.
+ *
+ *              This C version has been developed in cooperation with
+ *              Rick Richardson (Tinton Falls, NJ), it incorporates many
+ *              ideas from the "Version 1.1" distributed previously by
+ *              him over the UNIX network Usenet.
+ *              I also thank Chaim Benedelac (National Semiconductor),
+ *              David Ditzel (SUN), Earl Killian and John Mashey (MIPS),
+ *              Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley)
+ *              for their help with comments on earlier versions of the
+ *              benchmark.
+ *
+ *  Changes:    In the initialization part, this version follows mostly
+ *              Rick Richardson's version distributed via Usenet, not the
+ *              version distributed earlier via floppy disk by Reinhold
+ *              Weicker. As a concession to older compilers, names have
+ *              been made unique within the first 8 characters. Inside the
+ *              measurement loop, this version follows the version
+ *              previously distributed by Reinhold Weicker.
+ *
+ *              At several places in the benchmark, code has been added,
+ *              but within the measurement loop only in branches that
+ *              are not executed. The intention is that optimizing
+ *              compilers should be prevented from moving code out of the
+ *              measurement loop, or from removing code altogether. Since
+ *              the statements that are executed within the measurement
+ *              loop have NOT been changed, the numbers defining the
+ *              "Dhrystone distribution" (distribution of statements,
+ *              operand types and locality) still hold. Except for
+ *              sophisticated optimizing compilers, execution times for
+ *              this version should be the same as for previous versions.
+ *
+ *              Since it has proven difficult to subtract the time for the
+ *              measurement loop overhead in a correct way, the loop check
+ *              has been made a part of the benchmark. This does have
+ *              an impact - though a very minor one - on the distribution
+ *              statistics which have been updated for this version.
+ *
+ *              All changes within the measurement loop are described
+ *              and discussed in the companion paper "Rationale for
+ *              Dhrystone version 2".
+ *
+ *              Because of the self-imposed limitation that the order and
+ *              distribution of the executed statements should not be
+ *              changed, there are still cases where optimizing compilers
+ *              may not generate code for some statements. To a certain
+ *              degree, this is unavoidable for small synthetic
+ *              benchmarks. Users of the benchmark are advised to check
+ *              code listings whether code is generated for all statements
+ *              of Dhrystone.
+ *
+ *              Version 2.1 is identical to version 2.0 distributed via
+ *              the UNIX network Usenet in March 1988 except that it
+ *              corrects some minor deficiencies that were found by users
+ *              of version 2.0. The only change within the measurement
+ *              loop is that a non-executed "else" part was added to the
+ *              "if" statement in Func_3, and a non-executed "else" part
+ *              removed from Proc_3.
+ *
+ *************************************************************************
+ *
+ * Defines:     The following "Defines" are possible:
+ *              -DROPT         (default: Not defined)
+ *                      As an approximation to what an average C
+ *                      programmer might do, the "register" storage class
+ *                      is applied (if enabled by -DROPT)
+ *                      - for local variables, if they are used
+ *                        (dynamically) five or more times
+ *                      - for parameters if they are used (dynamically)
+ *                        six or more times
+ *                      Note that an optimal "register" strategy is
+ *                      compiler-dependent, and that "register"
+ *                      declarations do not necessarily lead to faster
+ *                      execution.
+ *              -DNOSTRUCTASSIGN        (default: Not defined)
+ *                      Define if the C compiler does not support
+ *                      assignment of structures.
+ *              -DNOENUMS               (default: Not defined)
+ *                      Define if the C compiler does not support
+ *                      enumeration types.
+ *
+ *************************************************************************
+ *
+ *  Compilation model and measurement (IMPORTANT):
+ *
+ *  This C version of Dhrystone consists of three files:
+ *  - dhry.h (this file, containing global definitions and comments)
+ *  - dhry_1.c (containing the code corresponding to Ada package Pack_1)
+ *  - dhry_2.c (containing the code corresponding to Ada package Pack_2)
+ *
+ *  The following "ground rules" apply for measurements:
+ *  - Separate compilation
+ *  - No procedure merging
+ *  - Otherwise, compiler optimizations are allowed but should be
+ *    indicated
+ *  - Default results are those without register declarations
+ *  See the companion paper "Rationale for Dhrystone Version 2" for a more
+ *  detailed discussion of these ground rules.
+ *
+ *  For 16-Bit processors (e.g. 80186, 80286), times for all compilation
+ *  models ("small", "medium", "large" etc.) should be given if possible,
+ *  together with a definition of these models for the compiler system
+ *  used.
+ *
+ *************************************************************************
+ *
+ *  Dhrystone (C version) statistics:
+ *
+ *  [Comment from the first distribution, updated for version 2.
+ *   Note that because of language differences, the numbers are slightly
+ *   different from the Ada version.]
+ *
+ *  The following program contains statements of a high level programming
+ *  language (here: C) in a distribution considered representative:
+ *
+ *    assignments                  52 (51.0 %)
+ *    control statements           33 (32.4 %)
+ *    procedure, function calls    17 (16.7 %)
+ *
+ *  103 statements are dynamically executed. The program is balanced with
+ *  respect to the three aspects:
+ *
+ *    - statement type
+ *    - operand type
+ *    - operand locality
+ *         operand global, local, parameter, or constant.
+ *
+ *  The combination of these three aspects is balanced only approximately.
+ *
+ *  1. Statement Type:
+ *  -----------------             number
+ *
+ *     V1 = V2                     9
+ *       (incl. V1 = F(..)
+ *     V = Constant               12
+ *     Assignment,                 7
+ *       with array element
+ *     Assignment,                 6
+ *       with record component
+ *                                --
+ *                                34       34
+ *
+ *     X = Y +|-|"&&"|"|" Z        5
+ *     X = Y +|-|"==" Constant     6
+ *     X = X +|- 1                 3
+ *     X = Y *|/ Z                 2
+ *     X = Expression,             1
+ *           two operators
+ *     X = Expression,             1
+ *           three operators
+ *                                --
+ *                                18       18
+ *
+ *     if ....                    14
+ *       with "else"      7
+ *       without "else"   7
+ *           executed        3
+ *           not executed    4
+ *     for ...                     7  |  counted every time
+ *     while ...                   4  |  the loop condition
+ *     do ... while                1  |  is evaluated
+ *     switch ...                  1
+ *     break                       1
+ *     declaration with            1
+ *       initialization
+ *                                --
+ *                                34       34
+ *
+ *     P (...)  procedure call    11
+ *       user procedure      10
+ *       library procedure    1
+ *     X = F (...)
+ *             function  call      6
+ *       user function        5
+ *       library function     1
+ *                                --
+ *                                17       17
+ *                                        ---
+ *                                        103
+ *
+ *    The average number of parameters in procedure or function calls
+ *    is 1.82 (not counting the function values as implicit parameters).
+ *
+ *
+ *  2. Operators
+ *  ------------
+ *                          number    approximate
+ *                                    percentage
+ *
+ *    Arithmetic             32          50.8
+ *
+ *       +                     21          33.3
+ *       -                      7          11.1
+ *       *                      3           4.8
+ *       / (int div)            1           1.6
+ *
+ *    Comparison             27           42.8
+ *
+ *       ==                     9           14.3
+ *       /=                     4            6.3
+ *       >                      1            1.6
+ *       <                      3            4.8
+ *       >=                     1            1.6
+ *       <=                     9           14.3
+ *
+ *    Logic                   4            6.3
+ *
+ *       && (AND-THEN)          1            1.6
+ *       |  (OR)                1            1.6
+ *       !  (NOT)               2            3.2
+ *
+ *                           --          -----
+ *                           63          100.1
+ *
+ *
+ *  3. Operand Type (counted once per operand reference):
+ *  ---------------
+ *                          number    approximate
+ *                                    percentage
+ *
+ *     Integer               175        72.3 %
+ *     Character              45        18.6 %
+ *     Pointer                12         5.0 %
+ *     String30                6         2.5 %
+ *     Array                   2         0.8 %
+ *     Record                  2         0.8 %
+ *                           ---       -------
+ *                           242       100.0 %
+ *
+ *  When there is an access path leading to the final operand (e.g. a
+ *  record component), only the final data type on the access path is
+ *  counted.
+ *
+ *
+ *  4. Operand Locality:
+ *  -------------------
+ *                                number    approximate
+ *                                          percentage
+ *
+ *     local variable              114        47.1 %
+ *     global variable              22         9.1 %
+ *     parameter                    45        18.6 %
+ *        value                        23         9.5 %
+ *        reference                    22         9.1 %
+ *     function result               6         2.5 %
+ *     constant                     55        22.7 %
+ *                                 ---       -------
+ *                                 242       100.0 %
+ *
+ *
+ *  The program does not compute anything meaningful, but it is
+ *  syntactically and semantically correct. All variables have a value
+ *  assigned to them before they are used as a source operand.
+ *
+ *  There has been no explicit effort to account for the effects of a
+ *  cache, or to balance the use of long or short displacements for code
+ *  or data.
+ *
+ *************************************************************************
+ */
+
+import core.stdc.stdio;
+import core.stdc.string;
+import core.stdc.stdlib;
+import std.string;
+
+
+/* Compiler and system dependent definitions: */
+
+const double Mic_secs_Per_Second = 1000000.0;
+                /* Berkeley UNIX C returns process times in seconds/HZ */
+
+enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5}
+alias int Enumeration;
+        /* for boolean and enumeration types in Ada, Pascal */
+
+/* General definitions: */
+
+const int StrLen = 30;
+
+alias int     One_Thirty;
+alias int     One_Fifty;
+alias char    Capital_Letter;
+alias bool    Boolean;
+alias char    Str_30 [StrLen];
+alias int     Arr_1_Dim [50];
+alias int     Arr_2_Dim [50] [50];
+
+struct record
+{
+    record *Ptr_Comp;
+    Enumeration    Discr;
+    union V {
+          struct V1 {
+                  Enumeration Enum_Comp;
+                  int         Int_Comp;
+                  char        Str_Comp [StrLen];
+                  }
+          V1 var_1;
+          struct V2 {
+                  Enumeration E_Comp_2;
+                  char        Str_2_Comp [StrLen];
+                  }
+          V2 var_2;
+          struct V3 {
+                  char        Ch_1_Comp;
+                  char        Ch_2_Comp;
+                  }
+          V3 var_3;
+          }
+    V variant;
+}
+
+alias record Rec_Type;
+alias record *Rec_Pointer;
+
+
+/* Global Variables: */
+
+Rec_Pointer     Ptr_Glob,
+                Next_Ptr_Glob;
+int             Int_Glob;
+Boolean         Bool_Glob;
+char            Ch_1_Glob,
+                Ch_2_Glob;
+int             Arr_1_Glob [50];
+int             Arr_2_Glob [50] [50];
+
+char[StrLen] Reg_Define = "Register option selected.";
+
+/* variables for time measurement: */
+
+const int Too_Small_Time = 2;
+                /* Measurements should last at least 2 seconds */
+
+double          Begin_Time,
+                End_Time,
+                User_Time;
+
+double          Microseconds,
+                Dhrystones_Per_Second,
+                Vax_Mips;
+
+/* end of variables for time measurement */
+
+
+void main ()
+/*****/
+
+  /* main program, corresponds to procedures        */
+  /* Main and Proc_0 in the Ada version             */
+{
+        One_Fifty       Int_1_Loc;
+        One_Fifty       Int_2_Loc;
+        One_Fifty       Int_3_Loc;
+        char            Ch_Index;
+        Enumeration     Enum_Loc;
+        Str_30          Str_1_Loc;
+        Str_30          Str_2_Loc;
+        int             Run_Index;
+        int             Number_Of_Runs;
+
+/+
+        FILE            *Ap;
+
+  /* Initializations */
+
+  if ((Ap = fopen("dhry.res","a+")) == null)
+    {
+       printf("Can not open dhry.res\n\n");
+       exit(1);
+    }
++/
+
+  Next_Ptr_Glob = cast(Rec_Pointer) malloc (Rec_Type.sizeof);
+  Ptr_Glob = cast(Rec_Pointer) malloc (Rec_Type.sizeof);
+
+  Ptr_Glob.Ptr_Comp                    = Next_Ptr_Glob;
+  Ptr_Glob.Discr                       = Ident_1;
+  Ptr_Glob.variant.var_1.Enum_Comp     = Ident_3;
+  Ptr_Glob.variant.var_1.Int_Comp      = 40;
+//  strcpy (Ptr_Glob.variant.var_1.Str_Comp,
+//          "DHRYSTONE PROGRAM, SOME STRING");
+//  strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
+  Ptr_Glob.variant.var_1.Str_Comp[] = "DHRYSTONE PROGRAM, SOME STRING";
+  Str_1_Loc[] = "DHRYSTONE PROGRAM, 1'ST STRING";
+
+  Arr_2_Glob [8][7] = 10;
+        /* Was missing in published program. Without this statement,    */
+        /* Arr_2_Glob [8][7] would have an undefined value.             */
+        /* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
+        /* overflow may occur for this array element.                   */
+
+  printf ("\n");
+  printf ("Dhrystone Benchmark, Version 2.1 (Language: D)\n");
+  printf ("\n");
+  printf ("Please give the number of runs through the benchmark: ");
+  {
+    int n;
+    //scanf ("%d", &n);
+    n = 10000000;
+    Number_Of_Runs = n;
+  }
+  printf ("\n");
+
+  printf ("Execution starts, %d runs through Dhrystone\n",Number_Of_Runs);
+
+  /***************/
+  /* Start timer */
+  /***************/
+
+  Begin_Time = dtime();
+
+  for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
+  {
+
+    Proc_5();
+    Proc_4();
+      /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
+    Int_1_Loc = 2;
+    Int_2_Loc = 3;
+    //strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
+    Str_2_Loc[] = "DHRYSTONE PROGRAM, 2'ND STRING";
+    Enum_Loc = Ident_2;
+    Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
+      /* Bool_Glob == 1 */
+    while (Int_1_Loc < Int_2_Loc)  /* loop body executed once */
+    {
+      Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
+        /* Int_3_Loc == 7 */
+      Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
+        /* Int_3_Loc == 7 */
+      Int_1_Loc += 1;
+    } /* while */
+      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
+    Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
+      /* Int_Glob == 5 */
+    Proc_1 (Ptr_Glob);
+    for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
+                             /* loop body executed twice */
+    {
+      if (Enum_Loc == Func_1 (Ch_Index, 'C'))
+          /* then, not executed */
+        {
+        Proc_6 (Ident_1, &Enum_Loc);
+        //strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
+        Str_2_Loc[] = "DHRYSTONE PROGRAM, 3'RD STRING";
+        Int_2_Loc = Run_Index;
+        Int_Glob = Run_Index;
+        }
+    }
+      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
+    Int_2_Loc = Int_2_Loc * Int_1_Loc;
+    Int_1_Loc = Int_2_Loc / Int_3_Loc;
+    Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
+      /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
+    Proc_2 (&Int_1_Loc);
+      /* Int_1_Loc == 5 */
+
+  } /* loop "for Run_Index" */
+
+  /**************/
+  /* Stop timer */
+  /**************/
+
+  End_Time = dtime();
+
+  printf ("Execution ends\n");
+  printf ("\n");
+  printf ("Final values of the variables used in the benchmark:\n");
+  printf ("\n");
+  printf ("Int_Glob:            %d\n", Int_Glob);
+  printf ("        should be:   %d\n", 5);
+  printf ("Bool_Glob:           %d\n", Bool_Glob);
+  printf ("        should be:   %d\n", 1);
+  printf ("Ch_1_Glob:           %c\n", Ch_1_Glob);
+  printf ("        should be:   %c\n", cast(int)'A');
+  printf ("Ch_2_Glob:           %c\n", Ch_2_Glob);
+  printf ("        should be:   %c\n", cast(int)'B');
+  printf ("Arr_1_Glob[8]:       %d\n", Arr_1_Glob[8]);
+  printf ("        should be:   %d\n", 7);
+  printf ("Arr_2_Glob[8][7]:    %d\n", Arr_2_Glob[8][7]);
+  printf ("        should be:   Number_Of_Runs + 10\n");
+  printf ("Ptr_Glob.\n");
+  printf ("  Ptr_Comp:          %d\n", cast(int) Ptr_Glob.Ptr_Comp);
+  printf ("        should be:   (implementation-dependent)\n");
+  printf ("  Discr:             %d\n", Ptr_Glob.Discr);
+  printf ("        should be:   %d\n", 0);
+  printf ("  Enum_Comp:         %d\n", Ptr_Glob.variant.var_1.Enum_Comp);
+  printf ("        should be:   %d\n", 2);
+  printf ("  Int_Comp:          %d\n", Ptr_Glob.variant.var_1.Int_Comp);
+  printf ("        should be:   %d\n", 17);
+  printf ("  Str_Comp:          %.*s\n", Ptr_Glob.variant.var_1.Str_Comp.length, Ptr_Glob.variant.var_1.Str_Comp.ptr);
+  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
+  printf ("Next_Ptr_Glob.\n");
+  printf ("  Ptr_Comp:          %d\n", cast(int) Next_Ptr_Glob.Ptr_Comp);
+  printf ("        should be:   (implementation-dependent), same as above\n");
+  printf ("  Discr:             %d\n", Next_Ptr_Glob.Discr);
+  printf ("        should be:   %d\n", 0);
+  printf ("  Enum_Comp:         %d\n", Next_Ptr_Glob.variant.var_1.Enum_Comp);
+  printf ("        should be:   %d\n", 1);
+  printf ("  Int_Comp:          %d\n", Next_Ptr_Glob.variant.var_1.Int_Comp);
+  printf ("        should be:   %d\n", 18);
+  printf ("  Str_Comp:          %.*s\n", Next_Ptr_Glob.variant.var_1.Str_Comp.length, Next_Ptr_Glob.variant.var_1.Str_Comp.ptr);
+  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
+  printf ("Int_1_Loc:           %d\n", Int_1_Loc);
+  printf ("        should be:   %d\n", 5);
+  printf ("Int_2_Loc:           %d\n", Int_2_Loc);
+  printf ("        should be:   %d\n", 13);
+  printf ("Int_3_Loc:           %d\n", Int_3_Loc);
+  printf ("        should be:   %d\n", 7);
+  printf ("Enum_Loc:            %d\n", Enum_Loc);
+  printf ("        should be:   %d\n", 1);
+  printf ("Str_1_Loc:           %.*s\n", Str_1_Loc.length, Str_1_Loc.ptr);
+  printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");
+  printf ("Str_2_Loc:           %.*s\n", Str_2_Loc.length, Str_2_Loc.ptr);
+  printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");
+  printf ("\n");
+
+  User_Time = End_Time - Begin_Time;
+
+  if (User_Time < Too_Small_Time)
+  {
+    printf ("Measured time too small to obtain meaningful results\n");
+    printf ("Please increase number of runs\n");
+    printf ("\n");
+  }
+  else
+  {
+    Microseconds = User_Time * Mic_secs_Per_Second
+                        / cast(double) Number_Of_Runs;
+    Dhrystones_Per_Second = cast(double) Number_Of_Runs / User_Time;
+    Vax_Mips = Dhrystones_Per_Second / 1757.0;
+
+    printf ("Register option selected?  NO\n");
+    strcpy(Reg_Define.ptr, "Register option not selected.");
+    printf ("Microseconds for one run through Dhrystone: ");
+    printf ("%7.1lf \n", Microseconds);
+    printf ("Dhrystones per Second:                      ");
+    printf ("%10.1lf \n", Dhrystones_Per_Second);
+    printf ("VAX MIPS rating = %10.3lf \n",Vax_Mips);
+    printf ("\n");
+
+   /+
+  fprintf(Ap,"\n");
+  fprintf(Ap,"Dhrystone Benchmark, Version 2.1 (Language: D)\n");
+  fprintf(Ap,"%.*s\n",Reg_Define.length, Reg_Define.ptr);
+  fprintf(Ap,"Microseconds for one loop: %7.1lf\n",Microseconds);
+  fprintf(Ap,"Dhrystones per second: %10.1lf\n",Dhrystones_Per_Second);
+  fprintf(Ap,"VAX MIPS rating: %10.3lf\n",Vax_Mips);
+  fclose(Ap);
+  +/
+
+  }
+
+}
+
+void Proc_1 (Rec_Pointer Ptr_Val_Par)
+/******************/
+
+    /* executed once */
+{
+      Rec_Pointer Next_Record = Ptr_Val_Par.Ptr_Comp;
+                                        /* == Ptr_Glob_Next */
+  /* Local variable, initialized with Ptr_Val_Par.Ptr_Comp,    */
+  /* corresponds to "rename" in Ada, "with" in Pascal           */
+
+  *Ptr_Val_Par.Ptr_Comp = *Ptr_Glob;
+  Ptr_Val_Par.variant.var_1.Int_Comp = 5;
+  Next_Record.variant.var_1.Int_Comp
+        = Ptr_Val_Par.variant.var_1.Int_Comp;
+  Next_Record.Ptr_Comp = Ptr_Val_Par.Ptr_Comp;
+  Proc_3 (&Next_Record.Ptr_Comp);
+    /* Ptr_Val_Par.Ptr_Comp.Ptr_Comp
+                        == Ptr_Glob.Ptr_Comp */
+  if (Next_Record.Discr == Ident_1)
+    /* then, executed */
+  {
+    Next_Record.variant.var_1.Int_Comp = 6;
+    Proc_6 (Ptr_Val_Par.variant.var_1.Enum_Comp,
+           &Next_Record.variant.var_1.Enum_Comp);
+    Next_Record.Ptr_Comp = Ptr_Glob.Ptr_Comp;
+    Proc_7 (Next_Record.variant.var_1.Int_Comp, 10,
+           &Next_Record.variant.var_1.Int_Comp);
+  }
+  else /* not executed */
+    *Ptr_Val_Par = *Ptr_Val_Par.Ptr_Comp;
+} /* Proc_1 */
+
+void Proc_2 (One_Fifty *Int_Par_Ref)
+/******************/
+    /* executed once */
+    /* *Int_Par_Ref == 1, becomes 4 */
+{
+  One_Fifty  Int_Loc;
+  Enumeration   Enum_Loc;
+
+  Int_Loc = *Int_Par_Ref + 10;
+  do /* executed once */
+    if (Ch_1_Glob == 'A')
+      /* then, executed */
+    {
+      Int_Loc -= 1;
+      *Int_Par_Ref = Int_Loc - Int_Glob;
+      Enum_Loc = Ident_1;
+    } /* if */
+  while (Enum_Loc != Ident_1); /* true */
+} /* Proc_2 */
+
+
+void Proc_3 (Rec_Pointer *Ptr_Ref_Par)
+/******************/
+    /* executed once */
+    /* Ptr_Ref_Par becomes Ptr_Glob */
+
+{
+  if (Ptr_Glob !=    null)
+    /* then, executed */
+    *Ptr_Ref_Par = Ptr_Glob.Ptr_Comp;
+  Proc_7 (10, Int_Glob, &Ptr_Glob.variant.var_1.Int_Comp);
+} /* Proc_3 */
+
+void Proc_4 () /* without parameters */
+/*******/
+    /* executed once */
+{
+  Boolean Bool_Loc;
+
+  Bool_Loc = Ch_1_Glob == 'A';
+  Bool_Glob = Bool_Loc | Bool_Glob;
+  Ch_2_Glob = 'B';
+} /* Proc_4 */
+
+
+void Proc_5 () /* without parameters */
+/*******/
+    /* executed once */
+{
+  Ch_1_Glob = 'A';
+  Bool_Glob = false;
+} /* Proc_5 */
+
+
+void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par)
+/*********************************/
+    /* executed once */
+    /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
+{
+  *Enum_Ref_Par = Enum_Val_Par;
+  if (! Func_3 (Enum_Val_Par))
+    /* then, not executed */
+    *Enum_Ref_Par = Ident_4;
+  final switch (Enum_Val_Par)
+  {
+    case Ident_1:
+      *Enum_Ref_Par = Ident_1;
+      break;
+    case Ident_2:
+      if (Int_Glob > 100)
+        /* then */
+      *Enum_Ref_Par = Ident_1;
+      else *Enum_Ref_Par = Ident_4;
+      break;
+    case Ident_3: /* executed */
+      *Enum_Ref_Par = Ident_2;
+      break;
+    case Ident_4: break;
+    case Ident_5:
+      *Enum_Ref_Par = Ident_3;
+      break;
+  } /* switch */
+} /* Proc_6 */
+
+
+void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref)
+/**********************************************/
+    /* executed three times                                      */
+    /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
+    /*                  Int_Par_Ref becomes 7                    */
+    /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
+    /*                  Int_Par_Ref becomes 17                   */
+    /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
+    /*                  Int_Par_Ref becomes 18                   */
+{
+  One_Fifty Int_Loc;
+
+  Int_Loc = Int_1_Par_Val + 2;
+  *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
+} /* Proc_7 */
+
+
+void Proc_8 (ref Arr_1_Dim Arr_1_Par_Ref, ref Arr_2_Dim Arr_2_Par_Ref, int Int_1_Par_Val, int Int_2_Par_Val)
+/*********************************************************************/
+    /* executed once      */
+    /* Int_Par_Val_1 == 3 */
+    /* Int_Par_Val_2 == 7 */
+{
+      One_Fifty Int_Index;
+      One_Fifty Int_Loc;
+
+  Int_Loc = Int_1_Par_Val + 5;
+  Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
+  Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
+  Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
+  for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
+    Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
+  Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
+  Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
+  Int_Glob = 5;
+} /* Proc_8 */
+
+
+Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val)
+/*************************************************/
+    /* executed three times                                         */
+    /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
+    /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
+    /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
+{
+  Capital_Letter        Ch_1_Loc;
+  Capital_Letter        Ch_2_Loc;
+
+  Ch_1_Loc = Ch_1_Par_Val;
+  Ch_2_Loc = Ch_1_Loc;
+  if (Ch_2_Loc != Ch_2_Par_Val)
+    /* then, executed */
+    return (Ident_1);
+  else  /* not executed */
+  {
+    Ch_1_Glob = Ch_1_Loc;
+    return (Ident_2);
+   }
+} /* Func_1 */
+
+
+Boolean Func_2 (Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref)
+/*************************************************/
+    /* executed once */
+    /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
+    /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
+{
+      One_Thirty        Int_Loc;
+      Capital_Letter    Ch_Loc;
+
+  Int_Loc = 2;
+  while (Int_Loc <= 2) /* loop body executed once */
+    if (Func_1 (Str_1_Par_Ref[Int_Loc],
+                Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
+      /* then, executed */
+    {
+      Ch_Loc = 'A';
+      Int_Loc += 1;
+    } /* if, while */
+  if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
+    /* then, not executed */
+    Int_Loc = 7;
+  if (Ch_Loc == 'R')
+    /* then, not executed */
+    return (true);
+  else /* executed */
+  {
+    //if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
+    //if (memcmp (Str_1_Par_Ref, Str_2_Par_Ref, 30) > 0)
+    if (Str_1_Par_Ref > Str_2_Par_Ref)
+      /* then, not executed */
+    {
+      Int_Loc += 7;
+      Int_Glob = Int_Loc;
+      return (true);
+    }
+    else /* executed */
+      return (false);
+  } /* if Ch_Loc */
+} /* Func_2 */
+
+
+Boolean Func_3 (Enumeration Enum_Par_Val)
+/***************************/
+    /* executed once        */
+    /* Enum_Par_Val == Ident_3 */
+{
+  Enumeration Enum_Loc;
+
+  Enum_Loc = Enum_Par_Val;
+  if (Enum_Loc == Ident_3)
+    /* then, executed */
+    return (true);
+  else /* not executed */
+    return (false);
+} /* Func_3 */
+
+version (Windows)
+{
+    import core.sys.windows.windows;
+
+    double dtime()
+    {
+     double q;
+
+     q = cast(double)GetTickCount() * 1.0e-03;
+
+     return q;
+    }
+}
+
+version (linux)
+{
+    import core.stdc.time;
+
+    double dtime()
+    {
+     double q;
+
+     q = cast(double)time(null);
+
+     return q;
+    }
+}
+
+version (OSX)   // supplied by Anders F Bjorklund
+{
+    import core.sys.posix.sys.time;
+
+    double dtime()
+    {
+     double q;
+     timeval tv;
+
+     gettimeofday(&tv,null);
+     q = cast(double)tv.tv_sec + cast(double)tv.tv_usec * 1.0e-6;
+
+     return q;
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/eh.d b/gcc/testsuite/gdc.test/runnable/eh.d
new file mode 100644
index 00000000000..34b3ac677d6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/eh.d
@@ -0,0 +1,797 @@
+// PERMUTE_ARGS: -O -fPIC
+
+extern(C) int printf(const char*, ...);
+
+/****************************************************/
+
+class Abc : Exception
+{
+    this()
+    {
+        super("");
+    }
+    int i;
+}
+
+int y;
+
+alias int boo;
+
+void foo(int x)
+{
+    y = cast(boo)1;
+L6:
+    try
+    {
+        printf("try 1\n");
+        y += 4;
+        if (y == 5)
+            goto L6;
+        y += 3;
+    }
+    finally
+    {
+        y += 5;
+        printf("finally 1\n");
+    }
+    try
+    {
+        printf("try 2\n");
+        y = 1;
+        if (y == 4)
+            goto L6;
+        y++;
+    }
+    catch (Abc c)
+    {
+        printf("catch 2\n");
+        y = 2 + c.i;
+    }
+    y++;
+    printf("done\n");
+}
+
+/****************************************************/
+
+
+class IntException : Exception
+{
+    this(int i)
+    {
+        m_i = i;
+    super("");
+    }
+
+    int getValue()
+    {
+        return m_i;
+    }
+
+    int m_i;
+}
+
+
+void test2()
+{
+    int     cIterations =   10;
+
+    int     i;
+    long    total_x     =   0;
+    long    total_nox   =   0;
+
+    for(int WARMUPS = 2; WARMUPS-- > 0; )
+    {
+        for(total_x = 0, i = 0; i < cIterations; ++i)
+        {
+            total_nox += fn2_nox();
+        }
+printf("foo\n");
+
+        for(total_nox = 0, i = 0; i < cIterations; ++i)
+        {
+printf("i = %d\n", i);
+            try
+            {
+                int z = 1;
+
+                throw new IntException(z);
+            }
+            catch(IntException x)
+            {
+printf("catch, i = %d\n", i);
+                total_x += x.getValue();
+            }
+        }
+    }
+
+    printf("iterations %d totals: %ld, %ld\n", cIterations, total_x, total_nox);
+}
+
+int fn2_nox()
+{
+    return 47;
+}
+
+
+/****************************************************/
+
+void test3()
+{
+    static int x;
+    try
+    {
+    }
+    finally
+    {
+        printf("a\n");
+        assert(x == 0);
+        x++;
+    }
+    printf("--\n");
+    assert(x == 1);
+    try
+    {
+        printf("tb\n");
+        assert(x == 1);
+    }
+    finally
+    {
+        printf("b\n");
+        assert(x == 1);
+        x++;
+    }
+    assert(x == 2);
+}
+
+/****************************************************/
+
+class Tester
+{
+    this(void delegate() dg_) { dg = dg_; }
+    void delegate() dg;
+    void stuff() { dg(); }
+}
+
+void test4()
+{
+    printf("Starting test\n");
+
+    int a = 0;
+    int b = 0;
+    int c = 0;
+    int d = 0;
+
+    try
+    {
+        a++;
+        throw new Exception("test1");
+        a++;
+    }
+    catch(Exception e)
+    {
+        auto es = e.toString();
+                printf("%.*s\n", es.length, es.ptr);
+        b++;
+    }
+    finally
+    {
+        c++;
+    }
+
+    printf("initial test.\n");
+
+    assert(a == 1);
+    assert(b == 1);
+    assert(c == 1);
+
+    printf("pass\n");
+
+    Tester t = new Tester(
+    delegate void()
+    {
+        try
+        {
+            a++;
+            throw new Exception("test2");
+            a++;
+        }
+        catch(Exception e)
+        {
+            b++;
+            throw e;
+            b++;
+        }
+    });
+
+    try
+    {
+        c++;
+        t.stuff();
+        c++;
+    }
+    catch(Exception e)
+    {
+        d++;
+        string es = e.toString;
+        printf("%.*s\n", es.length, es.ptr);
+    }
+
+    assert(a == 2);
+    assert(b == 2);
+    assert(c == 2);
+    assert(d == 1);
+
+
+    int q0 = 0;
+    int q1 = 0;
+    int q2 = 0;
+    int q3 = 0;
+
+    Tester t2 = new Tester(
+    delegate void()
+    {
+        try
+        {
+            q0++;
+            throw new Exception("test3");
+            q0++;
+        }
+        catch(Exception e)
+        {
+            printf("Never called.\n");
+            q1++;
+            throw e;
+            q1++;
+        }
+    });
+
+    try
+    {
+        q2++;
+        t2.stuff();
+        q2++;
+    }
+    catch(Exception e)
+    {
+        q3++;
+                string es = e.toString;
+        printf("%.*s\n", es.length, es.ptr);
+    }
+
+    assert(q0 == 1);
+    assert(q1 == 1);
+    assert(q2 == 1);
+    assert(q3 == 1);
+
+    printf("Passed!\n");
+}
+
+/****************************************************/
+
+void test5()
+{
+    char[] result;
+    int i = 3;
+    while(i--)
+    {
+        try
+        {
+            printf("i: %d\n", i);
+            result ~= 't';
+            if (i == 1)
+                continue;
+        }
+        finally
+        {
+            printf("finally\n");
+            result ~= cast(char)('a' + i);
+        }
+    }
+    printf("--- %.*s", result.length, result.ptr);
+    if (result != "tctbta")
+        assert(0);
+}
+
+/****************************************************/
+
+void test6()
+{
+    char[] result;
+
+    while (true)
+    {
+        try
+        {
+            printf("one\n");
+            result ~= 'a';
+            break;
+        }
+        finally
+        {
+            printf("two\n");
+            result ~= 'b';
+        }
+    }
+    printf("three\n");
+    result ~= 'c';
+    if (result != "abc")
+        assert(0);
+}
+
+/****************************************************/
+
+string a7;
+
+void doScan(int i)
+{
+    a7 ~= "a";
+    try
+    {
+        try
+        {
+            a7 ~= "b";
+            return;
+        }
+        finally
+        {
+            a7 ~= "c";
+        }
+    }
+    finally
+    {
+        a7 ~= "d";
+    }
+}
+
+void test7()
+{
+    doScan(0);
+    assert(a7 == "abcd");
+}
+
+
+/****************************************************
+ * Exception chaining tests. See also test4.d
+ ****************************************************/
+int result1513;
+
+void bug1513a()
+{
+     throw new Exception("d");
+}
+
+void bug1513b()
+{
+    try
+    {
+        try
+        {
+            bug1513a();
+        }
+        finally
+        {
+            result1513 |=4;
+           throw new Exception("f");
+        }
+    }
+    catch(Exception e)
+    {
+        assert(e.msg == "d");
+        assert(e.next.msg == "f");
+        assert(!e.next.next);
+    }
+}
+
+void bug1513c()
+{
+    try
+    {
+        try
+        {
+            throw new Exception("a");
+        }
+        finally
+        {
+            result1513 |= 1;
+            throw new Exception("b");
+        }
+    }
+    finally
+    {
+        bug1513b();
+        result1513 |= 2;
+        throw new Exception("c");
+    }
+}
+
+void bug1513()
+{
+    result1513 = 0;
+    try
+    {
+        bug1513c();
+    }
+    catch(Exception e)
+    {
+        assert(result1513 == 7);
+        assert(e.msg == "a");
+        assert(e.next.msg == "b");
+        assert(e.next.next.msg == "c");
+    }
+}
+
+void collideone()
+{
+    try
+    {
+        throw new Exception("x");
+    }
+    finally
+    {
+        throw new Exception("y");
+    }
+}
+
+void doublecollide()
+{
+    try
+    {
+        try
+        {
+            try
+            {
+                throw new Exception("p");
+            }
+            finally
+            {
+                throw new Exception("q");
+            }
+        }
+        finally
+        {
+            collideone();
+        }
+    }
+    catch(Exception e)
+    {
+            assert(e.msg == "p");
+            assert(e.next.msg == "q");
+            assert(e.next.next.msg == "x");
+            assert(e.next.next.next.msg == "y");
+            assert(!e.next.next.next.next);
+    }
+}
+
+void collidetwo()
+{
+       try
+        {
+            try
+            {
+                throw new Exception("p2");
+            }
+            finally
+            {
+                throw new Exception("q2");
+            }
+        }
+        finally
+        {
+            collideone();
+        }
+}
+
+void collideMixed()
+{
+    int works = 6;
+    try
+    {
+        try
+        {
+            try
+            {
+                throw new Exception("e");
+            }
+            finally
+            {
+                throw new Error("t");
+            }
+        }
+        catch(Exception f)
+        {    // Doesn't catch, because Error is chained to it.
+            works += 2;
+        }
+    }
+    catch(Error z)
+    {
+        works += 4;
+        assert(z.msg=="t"); // Error comes first
+        assert(z.next is null);
+        assert(z.bypassedException.msg == "e");
+    }
+    assert(works == 10);
+}
+
+class AnotherException : Exception
+{
+    this(string s)
+    {
+        super(s);
+    }
+}
+
+void multicollide()
+{
+    try
+    {
+       try
+        {
+            try
+            {
+                try
+                {
+                    throw new Exception("m2");
+                }
+                finally
+                {
+                    throw new AnotherException("n2");
+                }
+            }
+            catch(AnotherException s)
+            {   // Not caught -- we needed to catch the root cause "m2", not
+                // just the collateral "n2" (which would leave m2 uncaught).
+                assert(0);
+            }
+        }
+        finally
+        {
+            collidetwo();
+        }
+    }
+    catch(Exception f)
+    {
+        assert(f.msg == "m2");
+        assert(f.next.msg == "n2");
+        Throwable e = f.next.next;
+        assert(e.msg == "p2");
+        assert(e.next.msg == "q2");
+        assert(e.next.next.msg == "x");
+        assert(e.next.next.next.msg == "y");
+        assert(!e.next.next.next.next);
+    }
+}
+
+/****************************************************/
+
+void use9568(char [] x, char [] y) {}
+
+int bug9568()
+{
+    try
+        return 7;
+     finally
+        use9568(null,null);
+}
+
+void test9568()
+{
+    assert( bug9568() == 7 );
+}
+
+/****************************************************/
+
+version (DigitalMars)
+{
+void test8a()
+{
+  int a;
+  goto L2;    // L2 is not addressable.
+
+  try {
+      a += 2;
+  }
+  catch (Exception) {
+      a += 3;
+L2: ;
+      a += 100;
+  }
+  assert(a == 100);
+}
+
+void test8b()
+{
+  int a;
+  goto L2;    // L2 is not addressable.
+
+  try {
+  }
+  catch (Exception) {
+      a += 3;
+L2: ;
+      a += 100;
+  }
+  assert(a == 100);
+}
+
+void test8c()
+{
+  int a;
+  goto L2;    // L2 is not addressable.
+
+  try
+    static assert(true);
+  catch (Exception) {
+      a += 3;
+L2: ;
+      a += 100;
+  }
+  assert(a == 100);
+}
+
+void test8()
+{
+  test8a();
+  test8b();
+  test8c();
+}
+}
+
+/****************************************************/
+
+uint foo9(uint i)
+{
+    try
+    {
+        ++i;
+        return 3;
+    }
+    catch (Exception e)
+    {
+        debug printf("Exception happened\n");
+    }
+    return 4;
+}
+
+void test9()
+{
+    assert(foo9(7) == 3);
+}
+
+/****************************************************/
+// 10964
+
+void test10964()
+{
+    static struct S
+    {
+        this(this)
+        {
+            throw new Exception("BOOM!");
+        }
+    }
+
+    S    ss;
+    S[1] sa;
+    int result;
+
+    result = 0;
+    try
+    {
+        ss = ss;
+    }
+    catch (Exception e) result = 1;
+    catch (Error     e) result = 2;
+    catch (Throwable e) result = 3;
+    assert(result == 1);
+
+    try
+    {
+        sa = ss;
+    }
+    catch (Exception e) result = 1;
+    catch (Error     e) result = 2;
+    catch (Throwable e) result = 3;
+    assert(result == 1);
+
+    try
+    {
+        sa = sa;
+    }
+    catch (Exception e) result = 1;
+    catch (Error     e) result = 2;
+    catch (Throwable e) result = 3;
+    assert(result == 1);
+}
+
+/****************************************************/
+
+alias Action = void delegate();
+
+class A10
+{
+    invariant()
+    {
+    }
+
+    public Action foo(Action a)
+    {
+        synchronized
+        {
+            B10 elements = new B10;
+            Action[] actions = [a];
+
+            elements.bar(actions);
+
+            if (actions.length > 1)
+                elements.bar(actions);
+            return actions[0];
+        }
+        return null;
+    }
+}
+
+class B10
+{
+    public bool bar(ref Action[])
+    {
+        return false;
+    }
+}
+
+class D10
+{
+    void baz()
+    {
+    }
+}
+
+void test12989()
+{
+    auto a = new A10;
+    auto d = new D10;
+
+    assert(a.foo(&d.baz) == &d.baz);
+}
+
+/****************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=17481
+
+class C17481
+{
+    synchronized void trigger(){ new ubyte[1]; }
+}
+
+void test17481()
+{
+    auto k = new shared C17481;
+    k.trigger;
+}
+
+/****************************************************/
+
+int main()
+{
+    printf("start\n");
+    foo(3);
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+
+    bug1513();
+    doublecollide();
+    collideMixed();
+    multicollide();
+    test9568();
+
+    version(DigitalMars) test8();
+    test9();
+    test10964();
+    test12989();
+    test17481();
+
+    printf("finish\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/eh2.d b/gcc/testsuite/gdc.test/runnable/eh2.d
new file mode 100644
index 00000000000..dc285a5dfab
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/eh2.d
@@ -0,0 +1,85 @@
+// PERMUTE_ARGS: -fPIC
+
+extern(C) int printf(const char*, ...);
+
+class Abc : Throwable
+{
+    this() pure
+    {
+        super("");
+    }
+    static int x;
+    int a,b,c;
+
+    synchronized void test()
+    {
+        printf("test 1\n");
+        x |= 1;
+        foo();
+        printf("test 2\n");
+        x |= 2;
+    }
+
+    shared void foo()
+    {
+        printf("foo 1\n");
+        x |= 4;
+        throw this;
+        printf("foo 2\n");
+        x |= 8;
+    }
+}
+
+struct RefCounted
+{
+    void *p;
+    ~this()
+    {
+        p = null;
+    }
+}
+
+struct S
+{
+    RefCounted _data;
+
+    int get() @property
+    {
+        throw new Exception("");
+    }
+}
+
+void b9438()
+{
+    try
+    {
+        S s;
+        S().get;
+    }
+    catch (Exception e){ }
+}
+
+int main()
+{
+    printf("hello world\n");
+    auto a = new shared(Abc)();
+    printf("hello 2\n");
+    Abc.x |= 0x10;
+
+    try
+    {
+        Abc.x |= 0x20;
+        a.test();
+        Abc.x |= 0x40;
+    }
+    catch (shared(Abc) b)
+    {
+        Abc.x |= 0x80;
+        printf("Caught %p, x = x%x\n", b, Abc.x);
+        assert(a is b);
+        assert(Abc.x == 0xB5);
+    }
+    printf("Success!\n");
+    b9438();
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/entity1.d b/gcc/testsuite/gdc.test/runnable/entity1.d
new file mode 100644
index 00000000000..39211934110
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/entity1.d
@@ -0,0 +1,144 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+module dstress.run.named_entity_02;
+
+// "-//W3C//ENTITIES Symbolic//EN//HTML"
+
+int main(){
+        assert('\&fnof;'==402);
+        assert('\&Alpha;'==913);
+        assert('\&Beta;'==914);
+        assert('\&Gamma;'==915);
+        assert('\&Delta;'==916);
+        assert('\&Epsilon;'==917);
+        assert('\&Zeta;'==918);
+        assert('\&Eta;'==919);
+        assert('\&Theta;'==920);
+        assert('\&Iota;'==921);
+        assert('\&Kappa;'==922);
+        assert('\&Lambda;'==923);
+        assert('\&Mu;'==924);
+        assert('\&Nu;'==925);
+        assert('\&Xi;'==926);
+        assert('\&Omicron;'==927);
+        assert('\&Pi;'==928);
+        assert('\&Rho;'==929);
+        assert('\&Sigma;'==931);
+        assert('\&Tau;'==932);
+        assert('\&Upsilon;'==933);
+        assert('\&Phi;'==934);
+        assert('\&Chi;'==935);
+        assert('\&Psi;'==936);
+        assert('\&Omega;'==937);
+        assert('\&alpha;'==945);
+        assert('\&beta;'==946);
+        assert('\&gamma;'==947);
+        assert('\&delta;'==948);
+        assert('\&epsilon;'==949);
+        assert('\&zeta;'==950);
+        assert('\&eta;'==951);
+        assert('\&theta;'==952);
+        assert('\&iota;'==953);
+        assert('\&kappa;'==954);
+        assert('\&lambda;'==955);
+        assert('\&mu;'==956);
+        assert('\&nu;'==957);
+        assert('\&xi;'==958);
+        assert('\&omicron;'==959);
+        assert('\&pi;'==960);
+        assert('\&rho;'==961);
+        assert('\&sigmaf;'==962);
+        assert('\&sigma;'==963);
+        assert('\&tau;'==964);
+        assert('\&upsilon;'==965);
+        assert('\&phi;'==966);
+        assert('\&chi;'==967);
+        assert('\&psi;'==968);
+        assert('\&omega;'==969);
+        assert('\&thetasym;'==977);
+        assert('\&upsih;'==978);
+        assert('\&piv;'==982);
+        assert('\&bull;'==8226);
+        assert('\&hellip;'==8230);
+        assert('\&prime;'==8242);
+        assert('\&Prime;'==8243);
+        assert('\&oline;'==8254);
+        assert('\&frasl;'==8260);
+        assert('\&weierp;'==8472);
+        assert('\&image;'==8465);
+        assert('\&real;'==8476);
+        assert('\&trade;'==8482);
+        assert('\&alefsym;'==8501);
+        assert('\&larr;'==8592);
+        assert('\&uarr;'==8593);
+        assert('\&rarr;'==8594);
+        assert('\&darr;'==8595);
+        assert('\&harr;'==8596);
+        assert('\&crarr;'==8629);
+        assert('\&lArr;'==8656);
+        assert('\&uArr;'==8657);
+        assert('\&rArr;'==8658);
+        assert('\&dArr;'==8659);
+        assert('\&hArr;'==8660);
+        assert('\&forall;'==8704);
+        assert('\&part;'==8706);
+        assert('\&exist;'==8707);
+        assert('\&empty;'==8709);
+        assert('\&nabla;'==8711);
+        assert('\&isin;'==8712);
+        assert('\&notin;'==8713);
+        assert('\&ni;'==8715);
+        assert('\&prod;'==8719);
+        assert('\&sum;'==8721);
+        assert('\&minus;'==8722);
+        assert('\&lowast;'==8727);
+        assert('\&radic;'==8730);
+        assert('\&prop;'==8733);
+        assert('\&infin;'==8734);
+        assert('\&ang;'==8736);
+        assert('\&and;'==8743);
+        assert('\&or;'==8744);
+        assert('\&cap;'==8745);
+        assert('\&cup;'==8746);
+        assert('\&int;'==8747);
+        assert('\&there4;'==8756);
+        assert('\&sim;'==8764);
+        assert('\&cong;'==8773);
+        assert('\&asymp;'==8776);
+        assert('\&ne;'==8800);
+        assert('\&equiv;'==8801);
+        assert('\&le;'==8804);
+        assert('\&ge;'==8805);
+        assert('\&sub;'==8834);
+        assert('\&sup;'==8835);
+        assert('\&nsub;'==8836);
+        assert('\&sube;'==8838);
+        assert('\&supe;'==8839);
+        assert('\&oplus;'==8853);
+        assert('\&otimes;'==8855);
+        assert('\&perp;'==8869);
+        assert('\&sdot;'==8901);
+        assert('\&lceil;'==8968);
+        assert('\&rceil;'==8969);
+        assert('\&lfloor;'==8970);
+        assert('\&rfloor;'==8971);
+        //assert('\&lang;'==9001); // U+2329 valid for HTML 4.01; changed in HTML5
+        //assert('\&rang;'==9002); // U+232A valid for HTML 4.01; changed in HTML5
+    assert('\&lang;'==0x27E8); // valid for HTML 5 and later. The character was introduced in HTML 3.2
+    assert('\&rang;'==0x27E9); // valid for HTML 5 and later. The character was introduced in HTML 3.2
+        assert('\&loz;'==9674);
+        assert('\&spades;'==9824);
+        assert('\&clubs;'==9827);
+        assert('\&hearts;'==9829);
+        assert('\&diams;'==9830);
+        return 0;
+}
+
+// Bug 5221
+static assert('\&check;'==10003);
+static assert('\&lsim;'==8818);
+static assert('\&numero;'==8470);
+static assert('\&urcorn;'==8989);
+static assert('\&Zdot;'==379);
diff --git a/gcc/testsuite/gdc.test/runnable/extern1.d b/gcc/testsuite/gdc.test/runnable/extern1.d
new file mode 100644
index 00000000000..ad53e4e2d28
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extern1.d
@@ -0,0 +1,14 @@
+// note: not actually imported, just built and linked against
+// EXTRA_SOURCES: imports/extern1a.d
+// PERMUTE_ARGS:
+
+extern (C)
+{
+    extern int x;
+}
+
+int main()
+{
+    assert(x == 3);
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/externmangle.d b/gcc/testsuite/gdc.test/runnable/externmangle.d
new file mode 100644
index 00000000000..bf80adafe02
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/externmangle.d
@@ -0,0 +1,314 @@
+// EXTRA_CPP_SOURCES: extra-files/externmangle.cpp
+
+extern(C++):
+
+struct Foo(X)
+{
+    X* v;
+}
+
+
+struct Boo(X)
+{
+    X* v;
+}
+
+
+void test1(Foo!int arg1);
+void test2(int* arg2, Boo!(int*) arg1);
+
+
+struct Test3(int X, int Y)
+{
+}
+
+void test3(Test3!(3,3) arg1);
+
+void test4(Foo!(int*) arg1, Boo!(int*) arg2, Boo!(int*) arg3, int*, Foo!(double));
+
+void test5(Foo!(int*) arg1, Boo!(int*) arg2, Boo!(int*) arg3);
+
+
+struct Goo
+{
+    struct Foo(X)
+    {
+        X* v;
+    }
+
+    struct Boo(X)
+    {
+        struct Xoo(Y)
+        {
+            Y* v;
+        };
+        X* v;
+    }
+
+
+    void test6(Foo!(Boo!(Foo!(void))) arg1);
+    void test7(Boo!(void).Xoo!(int) arg1);
+}
+
+struct P1
+{
+    struct Mem(T)
+    {
+    }
+}
+
+struct P2
+{
+    struct Mem(T)
+    {
+    }
+}
+
+void test8(P1.Mem!int, P2.Mem!int);
+void test9(Foo!(int**), Foo!(int*), int**, int*);
+
+
+interface Test10
+{
+    private final void test10();
+    public final void test11();
+    protected final void test12();
+    public final void test13() const;
+
+    private void test14();
+    public void test15();
+    protected void test16();
+
+    private static void test17();
+    public static void test18();
+    protected static void test19();
+};
+
+Test10 Test10Ctor();
+void Test10Dtor(ref Test10 ptr);
+
+struct Test20
+{
+    __gshared:
+    private extern int test20;
+    protected extern int test21;
+    public extern int test22;
+};
+
+
+int test23(Test10*, Test10, Test10**, const(Test10));
+int test23b(const Test10*, const Test10, Test10);
+
+void test24(int function(int,int));
+
+void test25(int[291][6][5]* arr);
+int test26(int[291][6]* arr);
+
+void test27(int, ...);
+void test28(int);
+
+void test29(float);
+void test30(const float);
+
+struct Array(T)
+{
+    int dim;
+}
+
+
+interface Module
+{
+    public static void imports(Module);
+    public static int dim(Array!Module*);
+};
+
+ulong testlongmangle(int a, uint b, long c, ulong d);
+
+__gshared extern int[2][2][2] test31;
+__gshared extern int* test32;
+
+
+alias int function(Expression , void* ) apply_fp_t;
+
+interface Expression
+{
+    public final int apply(apply_fp_t fp, apply_fp_t fp2, void* param);
+    public final int getType();
+    public static Expression create(int);
+    public static void dispose(ref Expression);
+}
+
+//int test34(int[0][0]*);
+version(CRuntime_Microsoft){}
+else
+{
+    int test35(real arg);
+}
+
+const(char)* test36(const(char)*);
+
+final class Test37
+{
+    static Test37 create()
+    {
+        return new Test37;
+    }
+
+    bool test()
+    {
+        return true;
+    }
+}
+
+bool test37();
+
+interface Test38
+{
+     final int test(int, ...);
+     public static Test38 create();
+     public static void dispose(ref Test38);
+}
+
+extern(C++) int test39cpp(C2!char, S2!(int)*);
+
+extern(C++, class)
+struct S1
+{
+    private int val;
+    static S1* init(int);
+    int value();
+}
+
+extern(C++, class)
+struct S2(T)
+{
+    private T val;
+    static S2!T* init(int);
+    T value();
+}
+
+extern(C++, struct)
+class C1
+{
+    const(char)* data;
+
+    static C1 init(const(char)* p);
+    const(char)* getDataCPP();
+    extern(C++) const(char)* getDataD()
+    {
+        return data;
+    }
+}
+
+extern(C++, struct)
+class C2(T)
+{
+    const(T)* data;
+
+    static C2!T init(const(T)* p);
+    const(T)* getData();
+}
+
+void test39()
+{
+    S1* s1 = S1.init(42);
+    assert(s1.value == 42);
+    assert(S2!int.init(43).value == 43);
+    const(char)* ptr = "test".ptr;
+    C1 c1 = C1.init(ptr);
+    assert(c1.getDataCPP() == ptr);
+    assert(c1.getDataD() == ptr);
+    C2!char c2 = C2!char.init(ptr);
+    assert(c2.getData() == ptr);
+    auto result = test39cpp(c2, S2!int.init(43));
+    assert(result == 0);
+}
+
+
+void main()
+{
+    test1(Foo!int());
+    test2(null, Boo!(int*)());
+    test3(Test3!(3,3)());
+    test4(Foo!(int*)(), Boo!(int*)(), Boo!(int*)(), null, Foo!(double)());
+    test5(Foo!(int*)(), Boo!(int*)(), Boo!(int*)());
+    Goo goo;
+    goo.test6(Goo.Foo!(Goo.Boo!(Goo.Foo!(void)))());
+    goo.test7(Goo.Boo!(void).Xoo!(int)());
+
+    test8(P1.Mem!int(), P2.Mem!int());
+    test9(Foo!(int**)(), Foo!(int*)(), null, null);
+
+    auto t10 = Test10Ctor();
+    scope(exit) Test10Dtor(t10);
+
+    t10.test10();
+    t10.test11();
+    t10.test12();
+    t10.test13();
+    t10.test14();
+    t10.test15();
+    t10.test16();
+    t10.test17();
+    t10.test18();
+    t10.test19();
+
+    assert(Test20.test20 == 20);
+    assert(Test20.test21 == 21);
+    assert(Test20.test22 == 22);
+
+    assert(test23(null, null, null, null) == 1);
+    assert(test23b(null, null, null) == 1);
+
+    extern(C++) static int cb(int a, int b){return a+b;}
+
+    test24(&cb);
+    int[291][6][5] arr;
+    arr[1][1][1] = 42;
+    test25(&arr);
+    assert(test26(&arr[0]) == 42);
+
+    test27(3,4,5);
+    test28(3);
+
+    test29(3.14f);
+    test30(3.14f);
+
+    auto t32 = &Module.imports;
+    Array!Module arr2;
+    arr2.dim = 20;
+    assert(Module.dim(&arr2) == 20);
+
+    assert(testlongmangle(1, 2, 3, 4) == 10);
+    assert(test31 == [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]);
+    assert(test32 == null);
+
+    auto ee = Expression.create(42);
+    extern(C++) static int efun(Expression e, void* p)
+    {
+        return cast(int)(cast(size_t)p ^ e.getType());
+    }
+
+    extern(C++) static int efun2(Expression e, void* p)
+    {
+        return cast(int)(cast(size_t)p * e.getType());
+    }
+
+    auto test33 = ee.apply(&efun, &efun2, cast(void*)&Expression.create);
+    assert(test33 == cast(int)(cast(size_t)cast(void*)&Expression.create ^ 42) * cast(int)(cast(size_t)cast(void*)&Expression.create * 42));
+    Expression.dispose(ee);
+    assert(ee is null);
+    //assert(test34(null) == 0);
+    version(CRuntime_Microsoft){}
+    else
+    {
+        assert(test35(3.14L) == 3);
+    }
+    const char* hello = "hello";
+    assert(test36(hello) == hello);
+    assert(test37());
+    auto t38 = Test38.create();
+    assert(t38.test(1, 2, 3) == 1);
+    Test38.dispose(t38);
+    test39();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/externmangle2.d b/gcc/testsuite/gdc.test/runnable/externmangle2.d
new file mode 100644
index 00000000000..7d87fbd67f3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/externmangle2.d
@@ -0,0 +1,164 @@
+// EXTRA_CPP_SOURCES: extra-files/externmangle2.cpp
+
+version(Windows)
+{
+    void main()
+    {
+    }
+}
+else
+{
+    extern(C++):
+
+    struct Test32NS1
+    {
+        struct Foo(X)
+        {
+            X *v;
+        }
+
+
+        struct Bar(X)
+        {
+            X *v;
+        }
+
+    };
+
+    struct Test32NS2
+    {
+        struct Foo(X)
+        {
+            X *v;
+        }
+    };
+
+    struct Test32(alias Y, alias Z)
+    {
+        Y!(int)* field;
+    };
+
+
+    void test32a(Test32!(Test32NS1.Foo, Test32NS1.Foo) arg);
+    void test32b(Test32!(Test32NS1.Foo, Test32NS1.Bar) arg);
+    void test32c(Test32!(Test32NS1.Foo, Test32NS2.Foo) arg);
+    void test32d(Test32!(Test32NS1.Foo, Test32NS2.Foo) arg1, Test32!(Test32NS2.Foo, Test32NS1.Foo) arg2);
+
+    interface XXX
+    {
+    }
+
+    void test33a(XXX, XXX*);
+
+
+    struct Test33(alias A, alias B)
+    {
+    }
+
+    /*
+    void test33(XXX, Test33!(test33a, test33a) arg, XXX);
+
+
+    struct Test34(alias A)
+    {
+    };
+
+    struct Test34A
+    {
+        static void foo(int);
+    };
+
+
+    void test34(Test34!(Test34A.foo) arg);
+    */
+
+    __gshared extern int test36;
+
+    /*
+    struct Test37(alias A)
+    {
+    };
+
+    struct Test37A
+    {
+        __gshared extern int t38;
+    };
+
+    void test37(Test37!(test36) arg);
+    void test38(Test37!(Test37A.t38) arg);
+    */
+
+    struct Test39
+    {
+        struct T39A(X)
+        {
+        }
+    }
+
+    struct T39A
+    {
+    }
+
+    void test39(Test39.T39A!(.T39A));
+
+    version(none)
+    {
+        version(Posix) //Only for g++ with -std=c++0x and Visual Studio 2013+
+        {
+
+            struct Test40(T, V...)
+            {
+
+            }
+
+            void test40(Test40!(int, double, void))
+            {
+            }
+        }
+        else version(Win64) //Only for g++ with -std=c++0x and Visual Studio 2013+
+        {
+
+            struct Test40(T, V...)
+            {
+
+            }
+
+            void test40(Test40!(int, double, void))
+            {
+            }
+        }
+    }
+
+
+    __gshared extern const XXX test41;
+    struct Test42
+    {
+        __gshared extern const XXX test42;
+    }
+    __gshared extern int[4] test43;
+    const(XXX) test44();
+
+    void main()
+    {
+        test32a(Test32!(Test32NS1.Foo, Test32NS1.Foo)());
+        test32b(Test32!(Test32NS1.Foo, Test32NS1.Bar)());
+        test32c(Test32!(Test32NS1.Foo, Test32NS2.Foo)());
+        test32d(Test32!(Test32NS1.Foo, Test32NS2.Foo)(), Test32!(Test32NS2.Foo, Test32NS1.Foo)());
+
+        //test33a(null, null);
+        //test33(null, Test33!(test33a, test33a)(), null);
+
+        //test34(Test34!(Test34A.foo)());
+
+        assert(test36 == 36);
+
+        //test37(Test37!(test36)());
+        //test38(Test37!(Test37A.t38)());
+        test39(Test39.T39A!(.T39A)());
+
+        assert(test41 is null);
+        assert(Test42.test42 is null);
+        assert(test43 == [1, 2, 3, 4]);
+        auto ptr = &test44;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/alice30.txt b/gcc/testsuite/gdc.test/runnable/extra-files/alice30.txt
new file mode 100644
index 00000000000..bab83c9ab71
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/alice30.txt
@@ -0,0 +1,3853 @@
+***This is the Project Gutenberg Etext of Alice in Wonderland***
+*This 30th edition should be labeled alice30.txt or alice30.zip.
+***This Edition Is Being Officially Released On March 8, 1994***
+**In Celebration Of The 23rd Anniversary of Project Gutenberg***
+
+
+Please take a look at the important information in this header.
+We encourage you to keep this file on your own disk, keeping an
+electronic path open for the next readers.  Do not remove this.
+
+
+**Welcome To The World of Free Plain Vanilla Electronic Texts**
+
+**Etexts Readable By Both Humans and By Computers, Since 1971**
+
+*These Etexts Prepared By Hundreds of Volunteers and Donations*
+
+Information on contacting Project Gutenberg to get Etexts, and
+further information is included below.  We need your donations.
+
+
+Alice's Adventures in Wonderland
+
+March, 1994  [Etext #11]
+[Originally released in January, 1991]
+
+
+*****The Project Gutenberg Etext of Alice In Wonderland*****
+******This file should be named alice30.txt or alice30.zip******
+
+Corrected EDITIONS of our etexts get a new NUMBER, alice31.txt
+VERSIONS based on separate sources get new LETTER, alice30a.txt
+
+
+We are now trying to release all our books one month in advance
+of the official release dates, for time for better editing.  We
+have this as a goal to accomplish by the end of the year but we
+cannot guarantee to stay that far ahead every month after that.
+
+Please note:  neither this list nor its contents are final till
+midnight of the last day of the month of any such announcement.
+The official release date of all Project Gutenberg Etexts is at
+Midnight, Central Time, of the last day of the stated month.  A
+preliminary version may often be posted for suggestion, comment
+and editing by those who wish to do so.  To be sure you have an
+up to date first edition [xxxxx10x.xxx] please check file sizes
+in the first week of the next month.  Since our ftp program has
+a bug in it that scrambles the date [tried to fix and failed] a
+look at the file size will have to do, but we will try to see a
+new copy has at least one byte more or less.
+
+
+Information about Project Gutenberg (one page)
+
+We produce about two million dollars for each hour we work.  The
+fifty hours is one conservative estimate for how long it we take
+to get any etext selected, entered, proofread, edited, copyright
+searched and analyzed, the copyright letters written, etc.  This
+projected audience is one hundred million readers.  If our value
+per text is nominally estimated at one dollar then we produce $4
+million dollars per hour this year as we release some eight text
+files per month:  thus upping our productivity from $2 million.
+
+The Goal of Project Gutenberg is to Give Away One Trillion Etext
+Files by the December 31, 2001.  [10,000 x 100,000,000=Trillion]
+This is ten thousand titles each to one hundred million readers,
+which is 10% of the expected number of computer users by the end
+of the year 2001.
+
+We need your donations more than ever!
+
+All donations should be made to "Project Gutenberg/IBC", and are
+tax deductible to the extent allowable by law ("IBC" is Illinois
+Benedictine College).  (Subscriptions to our paper newsletter go
+to IBC, too)
+
+For these and other matters, please mail to:
+
+Project Gutenberg
+P. O. Box  2782
+Champaign, IL 61825
+
+When all other email fails try our Michael S. Hart, Executive
+Director:
+hart@vmd.cso.uiuc.edu (internet)   hart@uiucvmd   (bitnet)
+
+We would prefer to send you this information by email
+(Internet, Bitnet, Compuserve, ATTMAIL or MCImail).
+
+******
+If you have an FTP program (or emulator), please
+FTP directly to the Project Gutenberg archives:
+[Mac users, do NOT point and click. . .type]
+
+ftp mrcnext.cso.uiuc.edu
+login:  anonymous
+password:  your@login
+cd etext/etext91
+or cd etext92
+or cd etext93 [for new books]  [now also in cd etext/etext93]
+or cd etext/articles [get suggest gut for more information]
+dir [to see files]
+get or mget [to get files. . .set bin for zip files]
+GET 0INDEX.GUT
+for a list of books
+and
+GET NEW GUT for general information
+and
+MGET GUT* for newsletters.
+
+**Information prepared by the Project Gutenberg legal advisor**
+(Three Pages)
+
+
+***START**THE SMALL PRINT!**FOR PUBLIC DOMAIN ETEXTS**START***
+Why is this "Small Print!" statement here?  You know: lawyers.
+They tell us you might sue us if there is something wrong with
+your copy of this etext, even if you got it for free from
+someone other than us, and even if what's wrong is not our
+fault.  So, among other things, this "Small Print!" statement
+disclaims most of our liability to you.  It also tells you how
+you can distribute copies of this etext if you want to.
+
+*BEFORE!* YOU USE OR READ THIS ETEXT
+By using or reading any part of this PROJECT GUTENBERG-tm
+etext, you indicate that you understand, agree to and accept
+this "Small Print!" statement.  If you do not, you can receive
+a refund of the money (if any) you paid for this etext by
+sending a request within 30 days of receiving it to the person
+you got it from.  If you received this etext on a physical
+medium (such as a disk), you must return it with your request.
+
+ABOUT PROJECT GUTENBERG-TM ETEXTS
+This PROJECT GUTENBERG-tm etext, like most PROJECT GUTENBERG-
+tm etexts, is a "public domain" work distributed by Professor
+Michael S. Hart through the Project Gutenberg Association at
+Illinois Benedictine College (the "Project").  Among other
+things, this means that no one owns a United States copyright
+on or for this work, so the Project (and you!) can copy and
+distribute it in the United States without permission and
+without paying copyright royalties.  Special rules, set forth
+below, apply if you wish to copy and distribute this etext
+under the Project's "PROJECT GUTENBERG" trademark.
+
+To create these etexts, the Project expends considerable
+efforts to identify, transcribe and proofread public domain
+works.  Despite these efforts, the Project's etexts and any
+medium they may be on may contain "Defects".  Among other
+things, Defects may take the form of incomplete, inaccurate or
+corrupt data, transcription errors, a copyright or other
+intellectual property infringement, a defective or damaged
+disk or other etext medium, a computer virus, or computer
+codes that damage or cannot be read by your equipment.
+
+LIMITED WARRANTY; DISCLAIMER OF DAMAGES
+But for the "Right of Replacement or Refund" described below,
+[1] the Project (and any other party you may receive this
+etext from as a PROJECT GUTENBERG-tm etext) disclaims all
+liability to you for damages, costs and expenses, including
+legal fees, and [2] YOU HAVE NO REMEDIES FOR NEGLIGENCE OR
+UNDER STRICT LIABILITY, OR FOR BREACH OF WARRANTY OR CONTRACT,
+INCLUDING BUT NOT LIMITED TO INDIRECT, CONSEQUENTIAL, PUNITIVE
+OR INCIDENTAL DAMAGES, EVEN IF YOU GIVE NOTICE OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+If you discover a Defect in this etext within 90 days of
+receiving it, you can receive a refund of the money (if any)
+you paid for it by sending an explanatory note within that
+time to the person you received it from.  If you received it
+on a physical medium, you must return it with your note, and
+such person may choose to alternatively give you a replacement
+copy.  If you received it electronically, such person may
+choose to alternatively give you a second opportunity to
+receive it electronically.
+
+THIS ETEXT IS OTHERWISE PROVIDED TO YOU "AS-IS".  NO OTHER
+WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, ARE MADE TO YOU AS
+TO THE ETEXT OR ANY MEDIUM IT MAY BE ON, INCLUDING BUT NOT
+LIMITED TO WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
+PARTICULAR PURPOSE.
+
+Some states do not allow disclaimers of implied warranties or
+the exclusion or limitation of consequential damages, so the
+above disclaimers and exclusions may not apply to you, and you
+may have other legal rights.
+
+INDEMNITY
+You will indemnify and hold the Project, its directors,
+officers, members and agents harmless from all liability, cost
+and expense, including legal fees, that arise directly or
+indirectly from any of the following that you do or cause:
+[1] distribution of this etext, [2] alteration, modification,
+or addition to the etext, or [3] any Defect.
+
+DISTRIBUTION UNDER "PROJECT GUTENBERG-tm"
+You may distribute copies of this etext electronically, or by
+disk, book or any other medium if you either delete this
+"Small Print!" and all other references to Project Gutenberg,
+or:
+
+[1]  Only give exact copies of it.  Among other things, this
+     requires that you do not remove, alter or modify the
+     etext or this "small print!" statement.  You may however,
+     if you wish, distribute this etext in machine readable
+     binary, compressed, mark-up, or proprietary form,
+     including any form resulting from conversion by word pro-
+     cessing or hypertext software, but only so long as
+     *EITHER*:
+
+     [*]  The etext, when displayed, is clearly readable, and
+          does *not* contain characters other than those
+          intended by the author of the work, although tilde
+          (~), asterisk (*) and underline (_) characters may
+          be used to convey punctuation intended by the
+          author, and additional characters may be used to
+          indicate hypertext links; OR
+
+     [*]  The etext may be readily converted by the reader at
+          no expense into plain ASCII, EBCDIC or equivalent
+          form by the program that displays the etext (as is
+          the case, for instance, with most word processors);
+          OR
+
+     [*]  You provide, or agree to also provide on request at
+          no additional cost, fee or expense, a copy of the
+          etext in its original plain ASCII form (or in EBCDIC
+          or other equivalent proprietary form).
+
+[2]  Honor the etext refund and replacement provisions of this
+     "Small Print!" statement.
+
+[3]  Pay a trademark license fee to the Project of 20% of the
+     net profits you derive calculated using the method you
+     already use to calculate your applicable taxes.  If you
+     don't derive profits, no royalty is due.  Royalties are
+     payable to "Project Gutenberg Association / Illinois
+     Benedictine College" within the 60 days following each
+     date you prepare (or were legally required to prepare)
+     your annual (or equivalent periodic) tax return.
+
+WHAT IF YOU *WANT* TO SEND MONEY EVEN IF YOU DON'T HAVE TO?
+The Project gratefully accepts contributions in money, time,
+scanning machines, OCR software, public domain etexts, royalty
+free copyright licenses, and every other sort of contribution
+you can think of.  Money should be paid to "Project Gutenberg
+Association / Illinois Benedictine College".
+
+This "Small Print!" by Charles B. Kramer, Attorney
+Internet (72600.2026@compuserve.com); TEL: (212-254-5093)
+*END*THE SMALL PRINT! FOR PUBLIC DOMAIN ETEXTS*Ver.04.29.93*END*
+
+
+
+
+                ALICE'S ADVENTURES IN WONDERLAND
+
+                          Lewis Carroll
+
+               THE MILLENNIUM FULCRUM EDITION 3.0
+
+
+
+
+                            CHAPTER I
+
+                      Down the Rabbit-Hole
+
+
+  Alice was beginning to get very tired of sitting by her sister
+on the bank, and of having nothing to do:  once or twice she had
+peeped into the book her sister was reading, but it had no
+pictures or conversations in it, `and what is the use of a book,'
+thought Alice `without pictures or conversation?'
+
+  So she was considering in her own mind (as well as she could,
+for the hot day made her feel very sleepy and stupid), whether
+the pleasure of making a daisy-chain would be worth the trouble
+of getting up and picking the daisies, when suddenly a White
+Rabbit with pink eyes ran close by her.
+
+  There was nothing so VERY remarkable in that; nor did Alice
+think it so VERY much out of the way to hear the Rabbit say to
+itself, `Oh dear!  Oh dear!  I shall be late!'  (when she thought
+it over afterwards, it occurred to her that she ought to have
+wondered at this, but at the time it all seemed quite natural);
+but when the Rabbit actually TOOK A WATCH OUT OF ITS WAISTCOAT-
+POCKET, and looked at it, and then hurried on, Alice started to
+her feet, for it flashed across her mind that she had never
+before seen a rabbit with either a waistcoat-pocket, or a watch to
+take out of it, and burning with curiosity, she ran across the
+field after it, and fortunately was just in time to see it pop
+down a large rabbit-hole under the hedge.
+
+  In another moment down went Alice after it, never once
+considering how in the world she was to get out again.
+
+  The rabbit-hole went straight on like a tunnel for some way,
+and then dipped suddenly down, so suddenly that Alice had not a
+moment to think about stopping herself before she found herself
+falling down a very deep well.
+
+  Either the well was very deep, or she fell very slowly, for she
+had plenty of time as she went down to look about her and to
+wonder what was going to happen next.  First, she tried to look
+down and make out what she was coming to, but it was too dark to
+see anything; then she looked at the sides of the well, and
+noticed that they were filled with cupboards and book-shelves;
+here and there she saw maps and pictures hung upon pegs.  She
+took down a jar from one of the shelves as she passed; it was
+labelled `ORANGE MARMALADE', but to her great disappointment it
+was empty:  she did not like to drop the jar for fear of killing
+somebody, so managed to put it into one of the cupboards as she
+fell past it.
+
+  `Well!' thought Alice to herself, `after such a fall as this, I
+shall think nothing of tumbling down stairs!  How brave they'll
+all think me at home!  Why, I wouldn't say anything about it,
+even if I fell off the top of the house!' (Which was very likely
+true.)
+
+  Down, down, down.  Would the fall NEVER come to an end!  `I
+wonder how many miles I've fallen by this time?' she said aloud.
+`I must be getting somewhere near the centre of the earth.  Let
+me see:  that would be four thousand miles down, I think--' (for,
+you see, Alice had learnt several things of this sort in her
+lessons in the schoolroom, and though this was not a VERY good
+opportunity for showing off her knowledge, as there was no one to
+listen to her, still it was good practice to say it over) `--yes,
+that's about the right distance--but then I wonder what Latitude
+or Longitude I've got to?'  (Alice had no idea what Latitude was,
+or Longitude either, but thought they were nice grand words to
+say.)
+
+  Presently she began again.  `I wonder if I shall fall right
+THROUGH the earth!  How funny it'll seem to come out among the
+people that walk with their heads downward!  The Antipathies, I
+think--' (she was rather glad there WAS no one listening, this
+time, as it didn't sound at all the right word) `--but I shall
+have to ask them what the name of the country is, you know.
+Please, Ma'am, is this New Zealand or Australia?' (and she tried
+to curtsey as she spoke--fancy CURTSEYING as you're falling
+through the air!  Do you think you could manage it?)  `And what
+an ignorant little girl she'll think me for asking!  No, it'll
+never do to ask:  perhaps I shall see it written up somewhere.'
+
+  Down, down, down.  There was nothing else to do, so Alice soon
+began talking again.  `Dinah'll miss me very much to-night, I
+should think!'  (Dinah was the cat.)  `I hope they'll remember
+her saucer of milk at tea-time.  Dinah my dear!  I wish you were
+down here with me!  There are no mice in the air, I'm afraid, but
+you might catch a bat, and that's very like a mouse, you know.
+But do cats eat bats, I wonder?'  And here Alice began to get
+rather sleepy, and went on saying to herself, in a dreamy sort of
+way, `Do cats eat bats?  Do cats eat bats?' and sometimes, `Do
+bats eat cats?' for, you see, as she couldn't answer either
+question, it didn't much matter which way she put it.  She felt
+that she was dozing off, and had just begun to dream that she
+was walking hand in hand with Dinah, and saying to her very
+earnestly, `Now, Dinah, tell me the truth:  did you ever eat a
+bat?' when suddenly, thump! thump! down she came upon a heap of
+sticks and dry leaves, and the fall was over.
+
+  Alice was not a bit hurt, and she jumped up on to her feet in a
+moment:  she looked up, but it was all dark overhead; before her
+was another long passage, and the White Rabbit was still in
+sight, hurrying down it.  There was not a moment to be lost:
+away went Alice like the wind, and was just in time to hear it
+say, as it turned a corner, `Oh my ears and whiskers, how late
+it's getting!'  She was close behind it when she turned the
+corner, but the Rabbit was no longer to be seen:  she found
+herself in a long, low hall, which was lit up by a row of lamps
+hanging from the roof.
+
+  There were doors all round the hall, but they were all locked;
+and when Alice had been all the way down one side and up the
+other, trying every door, she walked sadly down the middle,
+wondering how she was ever to get out again.
+
+  Suddenly she came upon a little three-legged table, all made of
+solid glass; there was nothing on it except a tiny golden key,
+and Alice's first thought was that it might belong to one of the
+doors of the hall; but, alas! either the locks were too large, or
+the key was too small, but at any rate it would not open any of
+them.  However, on the second time round, she came upon a low
+curtain she had not noticed before, and behind it was a little
+door about fifteen inches high:  she tried the little golden key
+in the lock, and to her great delight it fitted!
+
+  Alice opened the door and found that it led into a small
+passage, not much larger than a rat-hole:  she knelt down and
+looked along the passage into the loveliest garden you ever saw.
+How she longed to get out of that dark hall, and wander about
+among those beds of bright flowers and those cool fountains, but
+she could not even get her head though the doorway; `and even if
+my head would go through,' thought poor Alice, `it would be of
+very little use without my shoulders.  Oh, how I wish
+I could shut up like a telescope!  I think I could, if I only
+know how to begin.'  For, you see, so many out-of-the-way things
+had happened lately, that Alice had begun to think that very few
+things indeed were really impossible.
+
+  There seemed to be no use in waiting by the little door, so she
+went back to the table, half hoping she might find another key on
+it, or at any rate a book of rules for shutting people up like
+telescopes:  this time she found a little bottle on it, (`which
+certainly was not here before,' said Alice,) and round the neck
+of the bottle was a paper label, with the words `DRINK ME'
+beautifully printed on it in large letters.
+
+  It was all very well to say `Drink me,' but the wise little
+Alice was not going to do THAT in a hurry.  `No, I'll look
+first,' she said, `and see whether it's marked "poison" or not';
+for she had read several nice little histories about children who
+had got burnt, and eaten up by wild beasts and other unpleasant
+things, all because they WOULD not remember the simple rules
+their friends had taught them:  such as, that a red-hot poker
+will burn you if you hold it too long; and that if you cut your
+finger VERY deeply with a knife, it usually bleeds; and she had
+never forgotten that, if you drink much from a bottle marked
+`poison,' it is almost certain to disagree with you, sooner or
+later.
+
+  However, this bottle was NOT marked `poison,' so Alice ventured
+to taste it, and finding it very nice, (it had, in fact, a sort
+of mixed flavour of cherry-tart, custard, pine-apple, roast
+turkey, toffee, and hot buttered toast,) she very soon finished
+it off.
+
+     *       *       *       *       *       *       *
+
+         *       *       *       *       *       *
+
+     *       *       *       *       *       *       *
+
+  `What a curious feeling!' said Alice; `I must be shutting up
+like a telescope.'
+
+  And so it was indeed:  she was now only ten inches high, and
+her face brightened up at the thought that she was now the right
+size for going through the little door into that lovely garden.
+First, however, she waited for a few minutes to see if she was
+going to shrink any further:  she felt a little nervous about
+this; `for it might end, you know,' said Alice to herself, `in my
+going out altogether, like a candle.  I wonder what I should be
+like then?'  And she tried to fancy what the flame of a candle is
+like after the candle is blown out, for she could not remember
+ever having seen such a thing.
+
+  After a while, finding that nothing more happened, she decided
+on going into the garden at once; but, alas for poor Alice!
+when she got to the door, she found she had forgotten the
+little golden key, and when she went back to the table for it,
+she found she could not possibly reach it:  she could see it
+quite plainly through the glass, and she tried her best to climb
+up one of the legs of the table, but it was too slippery;
+and when she had tired herself out with trying,
+the poor little thing sat down and cried.
+
+  `Come, there's no use in crying like that!' said Alice to
+herself, rather sharply; `I advise you to leave off this minute!'
+She generally gave herself very good advice, (though she very
+seldom followed it), and sometimes she scolded herself so
+severely as to bring tears into her eyes; and once she remembered
+trying to box her own ears for having cheated herself in a game
+of croquet she was playing against herself, for this curious
+child was very fond of pretending to be two people.  `But it's no
+use now,' thought poor Alice, `to pretend to be two people!  Why,
+there's hardly enough of me left to make ONE respectable
+person!'
+
+  Soon her eye fell on a little glass box that was lying under
+the table:  she opened it, and found in it a very small cake, on
+which the words `EAT ME' were beautifully marked in currants.
+`Well, I'll eat it,' said Alice, `and if it makes me grow larger,
+I can reach the key; and if it makes me grow smaller, I can creep
+under the door; so either way I'll get into the garden, and I
+don't care which happens!'
+
+  She ate a little bit, and said anxiously to herself, `Which
+way?  Which way?', holding her hand on the top of her head to
+feel which way it was growing, and she was quite surprised to
+find that she remained the same size:  to be sure, this generally
+happens when one eats cake, but Alice had got so much into the
+way of expecting nothing but out-of-the-way things to happen,
+that it seemed quite dull and stupid for life to go on in the
+common way.
+
+  So she set to work, and very soon finished off the cake.
+
+     *       *       *       *       *       *       *
+
+         *       *       *       *       *       *
+
+     *       *       *       *       *       *       *
+
+
+
+
+                           CHAPTER II
+
+                        The Pool of Tears
+
+
+  `Curiouser and curiouser!' cried Alice (she was so much
+surprised, that for the moment she quite forgot how to speak good
+English); `now I'm opening out like the largest telescope that
+ever was!  Good-bye, feet!' (for when she looked down at her
+feet, they seemed to be almost out of sight, they were getting so
+far off).  `Oh, my poor little feet, I wonder who will put on
+your shoes and stockings for you now, dears?  I'm sure _I_ shan't
+be able!  I shall be a great deal too far off to trouble myself
+about you:  you must manage the best way you can; --but I must be
+kind to them,' thought Alice, `or perhaps they won't walk the
+way I want to go!  Let me see:  I'll give them a new pair of
+boots every Christmas.'
+
+  And she went on planning to herself how she would manage it.
+`They must go by the carrier,' she thought; `and how funny it'll
+seem, sending presents to one's own feet!  And how odd the
+directions will look!
+
+            ALICE'S RIGHT FOOT, ESQ.
+                HEARTHRUG,
+                    NEAR THE FENDER,
+                        (WITH ALICE'S LOVE).
+
+Oh dear, what nonsense I'm talking!'
+
+  Just then her head struck against the roof of the hall:  in
+fact she was now more than nine feet high, and she at once took
+up the little golden key and hurried off to the garden door.
+
+  Poor Alice!  It was as much as she could do, lying down on one
+side, to look through into the garden with one eye; but to get
+through was more hopeless than ever:  she sat down and began to
+cry again.
+
+  `You ought to be ashamed of yourself,' said Alice, `a great
+girl like you,' (she might well say this), `to go on crying in
+this way!  Stop this moment, I tell you!'  But she went on all
+the same, shedding gallons of tears, until there was a large pool
+all round her, about four inches deep and reaching half down the
+hall.
+
+  After a time she heard a little pattering of feet in the
+distance, and she hastily dried her eyes to see what was coming.
+It was the White Rabbit returning, splendidly dressed, with a
+pair of white kid gloves in one hand and a large fan in the
+other:  he came trotting along in a great hurry, muttering to
+himself as he came, `Oh! the Duchess, the Duchess! Oh! won't she
+be savage if I've kept her waiting!'  Alice felt so desperate
+that she was ready to ask help of any one; so, when the Rabbit
+came near her, she began, in a low, timid voice, `If you please,
+sir--'  The Rabbit started violently, dropped the white kid
+gloves and the fan, and skurried away into the darkness as hard
+as he could go.
+
+  Alice took up the fan and gloves, and, as the hall was very
+hot, she kept fanning herself all the time she went on talking:
+`Dear, dear!  How queer everything is to-day!  And yesterday
+things went on just as usual.  I wonder if I've been changed in
+the night?  Let me think:  was I the same when I got up this
+morning?  I almost think I can remember feeling a little
+different.  But if I'm not the same, the next question is, Who in
+the world am I?  Ah, THAT'S the great puzzle!'  And she began
+thinking over all the children she knew that were of the same age
+as herself, to see if she could have been changed for any of
+them.
+
+  `I'm sure I'm not Ada,' she said, `for her hair goes in such
+long ringlets, and mine doesn't go in ringlets at all; and I'm
+sure I can't be Mabel, for I know all sorts of things, and she,
+oh! she knows such a very little!  Besides, SHE'S she, and I'm I,
+and--oh dear, how puzzling it all is!  I'll try if I know all the
+things I used to know.  Let me see:  four times five is twelve,
+and four times six is thirteen, and four times seven is--oh dear!
+I shall never get to twenty at that rate!  However, the
+Multiplication Table doesn't signify:  let's try Geography.
+London is the capital of Paris, and Paris is the capital of Rome,
+and Rome--no, THAT'S all wrong, I'm certain!  I must have been
+changed for Mabel!  I'll try and say "How doth the little--"'
+and she crossed her hands on her lap as if she were saying lessons,
+and began to repeat it, but her voice sounded hoarse and
+strange, and the words did not come the same as they used to do:--
+
+            `How doth the little crocodile
+              Improve his shining tail,
+            And pour the waters of the Nile
+              On every golden scale!
+
+            `How cheerfully he seems to grin,
+              How neatly spread his claws,
+            And welcome little fishes in
+              With gently smiling jaws!'
+
+  `I'm sure those are not the right words,' said poor Alice, and
+her eyes filled with tears again as she went on, `I must be Mabel
+after all, and I shall have to go and live in that poky little
+house, and have next to no toys to play with, and oh! ever so
+many lessons to learn!  No, I've made up my mind about it; if I'm
+Mabel, I'll stay down here!  It'll be no use their putting their
+heads down and saying "Come up again, dear!"  I shall only look
+up and say "Who am I then?  Tell me that first, and then, if I
+like being that person, I'll come up:  if not, I'll stay down
+here till I'm somebody else"--but, oh dear!' cried Alice, with a
+sudden burst of tears, `I do wish they WOULD put their heads
+down!  I am so VERY tired of being all alone here!'
+
+  As she said this she looked down at her hands, and was
+surprised to see that she had put on one of the Rabbit's little
+white kid gloves while she was talking.  `How CAN I have done
+that?' she thought.  `I must be growing small again.'  She got up
+and went to the table to measure herself by it, and found that,
+as nearly as she could guess, she was now about two feet high,
+and was going on shrinking rapidly:  she soon found out that the
+cause of this was the fan she was holding, and she dropped it
+hastily, just in time to avoid shrinking away altogether.
+
+`That WAS a narrow escape!' said Alice, a good deal frightened at
+the sudden change, but very glad to find herself still in
+existence; `and now for the garden!' and she ran with all speed
+back to the little door:  but, alas! the little door was shut
+again, and the little golden key was lying on the glass table as
+before, `and things are worse than ever,' thought the poor child,
+`for I never was so small as this before, never!  And I declare
+it's too bad, that it is!'
+
+  As she said these words her foot slipped, and in another
+moment, splash! she was up to her chin in salt water.  Her first
+idea was that she had somehow fallen into the sea, `and in that
+case I can go back by railway,' she said to herself.  (Alice had
+been to the seaside once in her life, and had come to the general
+conclusion, that wherever you go to on the English coast you find
+a number of bathing machines in the sea, some children digging in
+the sand with wooden spades, then a row of lodging houses, and
+behind them a railway station.)  However, she soon made out that
+she was in the pool of tears which she had wept when she was nine
+feet high.
+
+  `I wish I hadn't cried so much!' said Alice, as she swam about,
+trying to find her way out.  `I shall be punished for it now, I
+suppose, by being drowned in my own tears!  That WILL be a queer
+thing, to be sure!  However, everything is queer to-day.'
+
+  Just then she heard something splashing about in the pool a
+little way off, and she swam nearer to make out what it was:  at
+first she thought it must be a walrus or hippopotamus, but then
+she remembered how small she was now, and she soon made out that
+it was only a mouse that had slipped in like herself.
+
+  `Would it be of any use, now,' thought Alice, `to speak to this
+mouse?  Everything is so out-of-the-way down here, that I should
+think very likely it can talk:  at any rate, there's no harm in
+trying.'  So she began:  `O Mouse, do you know the way out of
+this pool?  I am very tired of swimming about here, O Mouse!'
+(Alice thought this must be the right way of speaking to a mouse:
+she had never done such a thing before, but she remembered having
+seen in her brother's Latin Grammar, `A mouse--of a mouse--to a
+mouse--a mouse--O mouse!'  The Mouse looked at her rather
+inquisitively, and seemed to her to wink with one of its little
+eyes, but it said nothing.
+
+  `Perhaps it doesn't understand English,' thought Alice; `I
+daresay it's a French mouse, come over with William the
+Conqueror.'  (For, with all her knowledge of history, Alice had
+no very clear notion how long ago anything had happened.)  So she
+began again:  `Ou est ma chatte?' which was the first sentence in
+her French lesson-book.  The Mouse gave a sudden leap out of the
+water, and seemed to quiver all over with fright.  `Oh, I beg
+your pardon!' cried Alice hastily, afraid that she had hurt the
+poor animal's feelings.  `I quite forgot you didn't like cats.'
+
+  `Not like cats!' cried the Mouse, in a shrill, passionate
+voice.  `Would YOU like cats if you were me?'
+
+  `Well, perhaps not,' said Alice in a soothing tone:  `don't be
+angry about it.  And yet I wish I could show you our cat Dinah:
+I think you'd take a fancy to cats if you could only see her.
+She is such a dear quiet thing,' Alice went on, half to herself,
+as she swam lazily about in the pool, `and she sits purring so
+nicely by the fire, licking her paws and washing her face--and
+she is such a nice soft thing to nurse--and she's such a capital
+one for catching mice--oh, I beg your pardon!' cried Alice again,
+for this time the Mouse was bristling all over, and she felt
+certain it must be really offended.  `We won't talk about her any
+more if you'd rather not.'
+
+  `We indeed!' cried the Mouse, who was trembling down to the end
+of his tail.  `As if I would talk on such a subject!  Our family
+always HATED cats:  nasty, low, vulgar things!  Don't let me hear
+the name again!'
+
+  `I won't indeed!' said Alice, in a great hurry to change the
+subject of conversation.  `Are you--are you fond--of--of dogs?'
+The Mouse did not answer, so Alice went on eagerly:  `There is
+such a nice little dog near our house I should like to show you!
+A little bright-eyed terrier, you know, with oh, such long curly
+brown hair!  And it'll fetch things when you throw them, and
+it'll sit up and beg for its dinner, and all sorts of things--I
+can't remember half of them--and it belongs to a farmer, you
+know, and he says it's so useful, it's worth a hundred pounds!
+He says it kills all the rats and--oh dear!' cried Alice in a
+sorrowful tone, `I'm afraid I've offended it again!'  For the
+Mouse was swimming away from her as hard as it could go, and
+making quite a commotion in the pool as it went.
+
+  So she called softly after it, `Mouse dear!  Do come back
+again, and we won't talk about cats or dogs either, if you don't
+like them!'  When the Mouse heard this, it turned round and swam
+slowly back to her:  its face was quite pale (with passion, Alice
+thought), and it said in a low trembling voice, `Let us get to
+the shore, and then I'll tell you my history, and you'll
+understand why it is I hate cats and dogs.'
+
+  It was high time to go, for the pool was getting quite crowded
+with the birds and animals that had fallen into it:  there were a
+Duck and a Dodo, a Lory and an Eaglet, and several other curious
+creatures.  Alice led the way, and the whole party swam to the
+shore.
+
+
+
+                           CHAPTER III
+
+                  A Caucus-Race and a Long Tale
+
+
+  They were indeed a queer-looking party that assembled on the
+bank--the birds with draggled feathers, the animals with their
+fur clinging close to them, and all dripping wet, cross, and
+uncomfortable.
+
+  The first question of course was, how to get dry again:  they
+had a consultation about this, and after a few minutes it seemed
+quite natural to Alice to find herself talking familiarly with
+them, as if she had known them all her life.  Indeed, she had
+quite a long argument with the Lory, who at last turned sulky,
+and would only say, `I am older than you, and must know better';
+and this Alice would not allow without knowing how old it was,
+and, as the Lory positively refused to tell its age, there was no
+more to be said.
+
+  At last the Mouse, who seemed to be a person of authority among
+them, called out, `Sit down, all of you, and listen to me!  I'LL
+soon make you dry enough!'  They all sat down at once, in a large
+ring, with the Mouse in the middle.  Alice kept her eyes
+anxiously fixed on it, for she felt sure she would catch a bad
+cold if she did not get dry very soon.
+
+  `Ahem!' said the Mouse with an important air, `are you all ready?
+This is the driest thing I know.  Silence all round, if you please!
+"William the Conqueror, whose cause was favoured by the pope, was
+soon submitted to by the English, who wanted leaders, and had been
+of late much accustomed to usurpation and conquest.  Edwin and
+Morcar, the earls of Mercia and Northumbria--"'
+
+  `Ugh!' said the Lory, with a shiver.
+
+  `I beg your pardon!' said the Mouse, frowning, but very
+politely:  `Did you speak?'
+
+  `Not I!' said the Lory hastily.
+
+  `I thought you did,' said the Mouse.  `--I proceed.  "Edwin and
+Morcar, the earls of Mercia and Northumbria, declared for him:
+and even Stigand, the patriotic archbishop of Canterbury, found
+it advisable--"'
+
+  `Found WHAT?' said the Duck.
+
+  `Found IT,' the Mouse replied rather crossly:  `of course you
+know what "it" means.'
+
+  `I know what "it" means well enough, when I find a thing,' said
+the Duck:  `it's generally a frog or a worm.  The question is,
+what did the archbishop find?'
+
+  The Mouse did not notice this question, but hurriedly went on,
+`"--found it advisable to go with Edgar Atheling to meet William
+and offer him the crown.  William's conduct at first was
+moderate.  But the insolence of his Normans--"  How are you
+getting on now, my dear?' it continued, turning to Alice as it
+spoke.
+
+  `As wet as ever,' said Alice in a melancholy tone:  `it doesn't
+seem to dry me at all.'
+
+  `In that case,' said the Dodo solemnly, rising to its feet, `I
+move that the meeting adjourn, for the immediate adoption of more
+energetic remedies--'
+
+  `Speak English!' said the Eaglet.  `I don't know the meaning of
+half those long words, and, what's more, I don't believe you do
+either!'  And the Eaglet bent down its head to hide a smile:
+some of the other birds tittered audibly.
+
+  `What I was going to say,' said the Dodo in an offended tone,
+`was, that the best thing to get us dry would be a Caucus-race.'
+
+  `What IS a Caucus-race?' said Alice; not that she wanted much
+to know, but the Dodo had paused as if it thought that SOMEBODY
+ought to speak, and no one else seemed inclined to say anything.
+
+  `Why,' said the Dodo, `the best way to explain it is to do it.'
+(And, as you might like to try the thing yourself, some winter
+day, I will tell you how the Dodo managed it.)
+
+  First it marked out a race-course, in a sort of circle, (`the
+exact shape doesn't matter,' it said,) and then all the party
+were placed along the course, here and there.  There was no `One,
+two, three, and away,' but they began running when they liked,
+and left off when they liked, so that it was not easy to know
+when the race was over.  However, when they had been running half
+an hour or so, and were quite dry again, the Dodo suddenly called
+out `The race is over!' and they all crowded round it, panting,
+and asking, `But who has won?'
+
+  This question the Dodo could not answer without a great deal of
+thought, and it sat for a long time with one finger pressed upon
+its forehead (the position in which you usually see Shakespeare,
+in the pictures of him), while the rest waited in silence.  At
+last the Dodo said, `EVERYBODY has won, and all must have
+prizes.'
+
+  `But who is to give the prizes?' quite a chorus of voices
+asked.
+
+  `Why, SHE, of course,' said the Dodo, pointing to Alice with
+one finger; and the whole party at once crowded round her,
+calling out in a confused way, `Prizes! Prizes!'
+
+  Alice had no idea what to do, and in despair she put her hand
+in her pocket, and pulled out a box of comfits, (luckily the salt
+water had not got into it), and handed them round as prizes.
+There was exactly one a-piece all round.
+
+  `But she must have a prize herself, you know,' said the Mouse.
+
+  `Of course,' the Dodo replied very gravely.  `What else have
+you got in your pocket?' he went on, turning to Alice.
+
+  `Only a thimble,' said Alice sadly.
+
+  `Hand it over here,' said the Dodo.
+
+  Then they all crowded round her once more, while the Dodo
+solemnly presented the thimble, saying `We beg your acceptance of
+this elegant thimble'; and, when it had finished this short
+speech, they all cheered.
+
+  Alice thought the whole thing very absurd, but they all looked
+so grave that she did not dare to laugh; and, as she could not
+think of anything to say, she simply bowed, and took the thimble,
+looking as solemn as she could.
+
+  The next thing was to eat the comfits:  this caused some noise
+and confusion, as the large birds complained that they could not
+taste theirs, and the small ones choked and had to be patted on
+the back.  However, it was over at last, and they sat down again
+in a ring, and begged the Mouse to tell them something more.
+
+  `You promised to tell me your history, you know,' said Alice,
+`and why it is you hate--C and D,' she added in a whisper, half
+afraid that it would be offended again.
+
+  `Mine is a long and a sad tale!' said the Mouse, turning to
+Alice, and sighing.
+
+  `It IS a long tail, certainly,' said Alice, looking down with
+wonder at the Mouse's tail; `but why do you call it sad?'  And
+she kept on puzzling about it while the Mouse was speaking, so
+that her idea of the tale was something like this:--
+
+                    `Fury said to a
+                   mouse, That he
+                 met in the
+               house,
+            "Let us
+              both go to
+                law:  I will
+                  prosecute
+                    YOU.  --Come,
+                       I'll take no
+                        denial; We
+                     must have a
+                 trial:  For
+              really this
+           morning I've
+          nothing
+         to do."
+           Said the
+             mouse to the
+               cur, "Such
+                 a trial,
+                   dear Sir,
+                         With
+                     no jury
+                  or judge,
+                would be
+              wasting
+             our
+              breath."
+               "I'll be
+                 judge, I'll
+                   be jury,"
+                         Said
+                    cunning
+                      old Fury:
+                     "I'll
+                      try the
+                         whole
+                          cause,
+                             and
+                        condemn
+                       you
+                      to
+                       death."'
+
+
+  `You are not attending!' said the Mouse to Alice severely.
+`What are you thinking of?'
+
+  `I beg your pardon,' said Alice very humbly:  `you had got to
+the fifth bend, I think?'
+
+  `I had NOT!' cried the Mouse, sharply and very angrily.
+
+  `A knot!' said Alice, always ready to make herself useful, and
+looking anxiously about her.  `Oh, do let me help to undo it!'
+
+  `I shall do nothing of the sort,' said the Mouse, getting up
+and walking away.  `You insult me by talking such nonsense!'
+
+  `I didn't mean it!' pleaded poor Alice.  `But you're so easily
+offended, you know!'
+
+  The Mouse only growled in reply.
+
+  `Please come back and finish your story!' Alice called after
+it; and the others all joined in chorus, `Yes, please do!' but
+the Mouse only shook its head impatiently, and walked a little
+quicker.
+
+  `What a pity it wouldn't stay!' sighed the Lory, as soon as it
+was quite out of sight; and an old Crab took the opportunity of
+saying to her daughter `Ah, my dear!  Let this be a lesson to you
+never to lose YOUR temper!'  `Hold your tongue, Ma!' said the
+young Crab, a little snappishly.  `You're enough to try the
+patience of an oyster!'
+
+  `I wish I had our Dinah here, I know I do!' said Alice aloud,
+addressing nobody in particular.  `She'd soon fetch it back!'
+
+  `And who is Dinah, if I might venture to ask the question?'
+said the Lory.
+
+  Alice replied eagerly, for she was always ready to talk about
+her pet:  `Dinah's our cat.  And she's such a capital one for
+catching mice you can't think!  And oh, I wish you could see her
+after the birds!  Why, she'll eat a little bird as soon as look
+at it!'
+
+  This speech caused a remarkable sensation among the party.
+Some of the birds hurried off at once:  one old Magpie began
+wrapping itself up very carefully, remarking, `I really must be
+getting home; the night-air doesn't suit my throat!' and a Canary
+called out in a trembling voice to its children, `Come away, my
+dears!  It's high time you were all in bed!'  On various pretexts
+they all moved off, and Alice was soon left alone.
+
+  `I wish I hadn't mentioned Dinah!' she said to herself in a
+melancholy tone.  `Nobody seems to like her, down here, and I'm
+sure she's the best cat in the world!  Oh, my dear Dinah!  I
+wonder if I shall ever see you any more!'  And here poor Alice
+began to cry again, for she felt very lonely and low-spirited.
+In a little while, however, she again heard a little pattering of
+footsteps in the distance, and she looked up eagerly, half hoping
+that the Mouse had changed his mind, and was coming back to
+finish his story.
+
+
+
+                           CHAPTER IV
+
+                The Rabbit Sends in a Little Bill
+
+
+  It was the White Rabbit, trotting slowly back again, and
+looking anxiously about as it went, as if it had lost something;
+and she heard it muttering to itself `The Duchess!  The Duchess!
+Oh my dear paws!  Oh my fur and whiskers!  She'll get me
+executed, as sure as ferrets are ferrets!  Where CAN I have
+dropped them, I wonder?'  Alice guessed in a moment that it was
+looking for the fan and the pair of white kid gloves, and she
+very good-naturedly began hunting about for them, but they were
+nowhere to be seen--everything seemed to have changed since her
+swim in the pool, and the great hall, with the glass table and
+the little door, had vanished completely.
+
+  Very soon the Rabbit noticed Alice, as she went hunting about,
+and called out to her in an angry tone, `Why, Mary Ann, what ARE
+you doing out here?  Run home this moment, and fetch me a pair of
+gloves and a fan!  Quick, now!'  And Alice was so much frightened
+that she ran off at once in the direction it pointed to, without
+trying to explain the mistake it had made.
+
+  `He took me for his housemaid,' she said to herself as she ran.
+`How surprised he'll be when he finds out who I am!  But I'd
+better take him his fan and gloves--that is, if I can find them.'
+As she said this, she came upon a neat little house, on the door
+of which was a bright brass plate with the name `W. RABBIT'
+engraved upon it.  She went in without knocking, and hurried
+upstairs, in great fear lest she should meet the real Mary Ann,
+and be turned out of the house before she had found the fan and
+gloves.
+
+  `How queer it seems,' Alice said to herself, `to be going
+messages for a rabbit!  I suppose Dinah'll be sending me on
+messages next!'  And she began fancying the sort of thing that
+would happen:  `"Miss Alice!  Come here directly, and get ready
+for your walk!" "Coming in a minute, nurse!  But I've got to see
+that the mouse doesn't get out."  Only I don't think,' Alice went
+on, `that they'd let Dinah stop in the house if it began ordering
+people about like that!'
+
+  By this time she had found her way into a tidy little room with
+a table in the window, and on it (as she had hoped) a fan and two
+or three pairs of tiny white kid gloves:  she took up the fan and
+a pair of the gloves, and was just going to leave the room, when
+her eye fell upon a little bottle that stood near the looking-
+glass.  There was no label this time with the words `DRINK ME,'
+but nevertheless she uncorked it and put it to her lips.  `I know
+SOMETHING interesting is sure to happen,' she said to herself,
+`whenever I eat or drink anything; so I'll just see what this
+bottle does.  I do hope it'll make me grow large again, for
+really I'm quite tired of being such a tiny little thing!'
+
+  It did so indeed, and much sooner than she had expected:
+before she had drunk half the bottle, she found her head pressing
+against the ceiling, and had to stoop to save her neck from being
+broken.  She hastily put down the bottle, saying to herself
+`That's quite enough--I hope I shan't grow any more--As it is, I
+can't get out at the door--I do wish I hadn't drunk quite so
+much!'
+
+  Alas! it was too late to wish that!  She went on growing, and
+growing, and very soon had to kneel down on the floor:  in
+another minute there was not even room for this, and she tried
+the effect of lying down with one elbow against the door, and the
+other arm curled round her head.  Still she went on growing, and,
+as a last resource, she put one arm out of the window, and one
+foot up the chimney, and said to herself `Now I can do no more,
+whatever happens.  What WILL become of me?'
+
+  Luckily for Alice, the little magic bottle had now had its full
+effect, and she grew no larger:  still it was very uncomfortable,
+and, as there seemed to be no sort of chance of her ever getting
+out of the room again, no wonder she felt unhappy.
+
+  `It was much pleasanter at home,' thought poor Alice, `when one
+wasn't always growing larger and smaller, and being ordered about
+by mice and rabbits.  I almost wish I hadn't gone down that
+rabbit-hole--and yet--and yet--it's rather curious, you know,
+this sort of life!  I do wonder what CAN have happened to me!
+When I used to read fairy-tales, I fancied that kind of thing
+never happened, and now here I am in the middle of one!  There
+ought to be a book written about me, that there ought!  And when
+I grow up, I'll write one--but I'm grown up now,' she added in a
+sorrowful tone; `at least there's no room to grow up any more
+HERE.'
+
+  `But then,' thought Alice, `shall I NEVER get any older than I
+am now?  That'll be a comfort, one way--never to be an old woman--
+but then--always to have lessons to learn!  Oh, I shouldn't like THAT!'
+
+  `Oh, you foolish Alice!' she answered herself.  `How can you
+learn lessons in here?  Why, there's hardly room for YOU, and no
+room at all for any lesson-books!'
+
+  And so she went on, taking first one side and then the other,
+and making quite a conversation of it altogether; but after a few
+minutes she heard a voice outside, and stopped to listen.
+
+  `Mary Ann!  Mary Ann!' said the voice.  `Fetch me my gloves
+this moment!'  Then came a little pattering of feet on the
+stairs.  Alice knew it was the Rabbit coming to look for her, and
+she trembled till she shook the house, quite forgetting that she
+was now about a thousand times as large as the Rabbit, and had no
+reason to be afraid of it.
+
+  Presently the Rabbit came up to the door, and tried to open it;
+but, as the door opened inwards, and Alice's elbow was pressed
+hard against it, that attempt proved a failure.  Alice heard it
+say to itself `Then I'll go round and get in at the window.'
+
+  `THAT you won't' thought Alice, and, after waiting till she
+fancied she heard the Rabbit just under the window, she suddenly
+spread out her hand, and made a snatch in the air.  She did not
+get hold of anything, but she heard a little shriek and a fall,
+and a crash of broken glass, from which she concluded that it was
+just possible it had fallen into a cucumber-frame, or something
+of the sort.
+
+  Next came an angry voice--the Rabbit's--`Pat! Pat!  Where are
+you?'  And then a voice she had never heard before, `Sure then
+I'm here!  Digging for apples, yer honour!'
+
+  `Digging for apples, indeed!' said the Rabbit angrily.  `Here!
+Come and help me out of THIS!'  (Sounds of more broken glass.)
+
+  `Now tell me, Pat, what's that in the window?'
+
+  `Sure, it's an arm, yer honour!'  (He pronounced it `arrum.')
+
+  `An arm, you goose!   Who ever saw one that size?  Why, it
+fills the whole window!'
+
+  `Sure, it does, yer honour:  but it's an arm for all that.'
+
+  `Well, it's got no business there, at any rate:  go and take it
+away!'
+
+  There was a long silence after this, and Alice could only hear
+whispers now and then; such as, `Sure, I don't like it, yer
+honour, at all, at all!'  `Do as I tell you, you coward!' and at
+last she spread out her hand again, and made another snatch in
+the air.  This time there were TWO little shrieks, and more
+sounds of broken glass.  `What a number of cucumber-frames there
+must be!' thought Alice.  `I wonder what they'll do next!  As for
+pulling me out of the window, I only wish they COULD!  I'm sure I
+don't want to stay in here any longer!'
+
+  She waited for some time without hearing anything more:  at
+last came a rumbling of little cartwheels, and the sound of a
+good many voices all talking together:  she made out the words:
+`Where's the other ladder?--Why, I hadn't to bring but one;
+Bill's got the other--Bill! fetch it here, lad!--Here, put 'em up
+at this corner--No, tie 'em together first--they don't reach half
+high enough yet--Oh! they'll do well enough; don't be particular--
+Here, Bill! catch hold of this rope--Will the roof bear?--Mind
+that loose slate--Oh, it's coming down!  Heads below!' (a loud
+crash)--`Now, who did that?--It was Bill, I fancy--Who's to go
+down the chimney?--Nay, I shan't! YOU do it!--That I won't,
+then!--Bill's to go down--Here, Bill! the master says you're to
+go down the chimney!'
+
+  `Oh! So Bill's got to come down the chimney, has he?' said
+Alice to herself.  `Shy, they seem to put everything upon Bill!
+I wouldn't be in Bill's place for a good deal:  this fireplace is
+narrow, to be sure; but I THINK I can kick a little!'
+
+  She drew her foot as far down the chimney as she could, and
+waited till she heard a little animal (she couldn't guess of what
+sort it was) scratching and scrambling about in the chimney close
+above her:  then, saying to herself `This is Bill,' she gave one
+sharp kick, and waited to see what would happen next.
+
+  The first thing she heard was a general chorus of `There goes
+Bill!' then the Rabbit's voice along--`Catch him, you by the
+hedge!' then silence, and then another confusion of voices--`Hold
+up his head--Brandy now--Don't choke him--How was it, old fellow?
+What happened to you?  Tell us all about it!'
+
+  Last came a little feeble, squeaking voice, (`That's Bill,'
+thought Alice,) `Well, I hardly know--No more, thank ye; I'm
+better now--but I'm a deal too flustered to tell you--all I know
+is, something comes at me like a Jack-in-the-box, and up I goes
+like a sky-rocket!'
+
+  `So you did, old fellow!' said the others.
+
+  `We must burn the house down!' said the Rabbit's voice; and
+Alice called out as loud as she could, `If you do.  I'll set
+Dinah at you!'
+
+  There was a dead silence instantly, and Alice thought to
+herself, `I wonder what they WILL do next!  If they had any
+sense, they'd take the roof off.'  After a minute or two, they
+began moving about again, and Alice heard the Rabbit say, `A
+barrowful will do, to begin with.'
+
+  `A barrowful of WHAT?' thought Alice; but she had not long to
+doubt, for the next moment a shower of little pebbles came
+rattling in at the window, and some of them hit her in the face.
+`I'll put a stop to this,' she said to herself, and shouted out,
+`You'd better not do that again!' which produced another dead
+silence.
+
+  Alice noticed with some surprise that the pebbles were all
+turning into little cakes as they lay on the floor, and a bright
+idea came into her head.  `If I eat one of these cakes,' she
+thought, `it's sure to make SOME change in my size; and as it
+can't possibly make me larger, it must make me smaller, I
+suppose.'
+
+  So she swallowed one of the cakes, and was delighted to find
+that she began shrinking directly.  As soon as she was small
+enough to get through the door, she ran out of the house, and
+found quite a crowd of little animals and birds waiting outside.
+The poor little Lizard, Bill, was in the middle, being held up by
+two guinea-pigs, who were giving it something out of a bottle.
+They all made a rush at Alice the moment she appeared; but she
+ran off as hard as she could, and soon found herself safe in a
+thick wood.
+
+  `The first thing I've got to do,' said Alice to herself, as she
+wandered about in the wood, `is to grow to my right size again;
+and the second thing is to find my way into that lovely garden.
+I think that will be the best plan.'
+
+  It sounded an excellent plan, no doubt, and very neatly and
+simply arranged; the only difficulty was, that she had not the
+smallest idea how to set about it; and while she was peering
+about anxiously among the trees, a little sharp bark just over
+her head made her look up in a great hurry.
+
+  An enormous puppy was looking down at her with large round
+eyes, and feebly stretching out one paw, trying to touch her.
+`Poor little thing!' said Alice, in a coaxing tone, and she tried
+hard to whistle to it; but she was terribly frightened all the
+time at the thought that it might be hungry, in which case it
+would be very likely to eat her up in spite of all her coaxing.
+
+  Hardly knowing what she did, she picked up a little bit of
+stick, and held it out to the puppy; whereupon the puppy jumped
+into the air off all its feet at once, with a yelp of delight,
+and rushed at the stick, and made believe to worry it; then Alice
+dodged behind a great thistle, to keep herself from being run
+over; and the moment she appeared on the other side, the puppy
+made another rush at the stick, and tumbled head over heels in
+its hurry to get hold of it; then Alice, thinking it was very
+like having a game of play with a cart-horse, and expecting every
+moment to be trampled under its feet, ran round the thistle
+again; then the puppy began a series of short charges at the
+stick, running a very little way forwards each time and a long
+way back, and barking hoarsely all the while, till at last it sat
+down a good way off, panting, with its tongue hanging out of its
+mouth, and its great eyes half shut.
+
+  This seemed to Alice a good opportunity for making her escape;
+so she set off at once, and ran till she was quite tired and out
+of breath, and till the puppy's bark sounded quite faint in the
+distance.
+
+  `And yet what a dear little puppy it was!' said Alice, as she
+leant against a buttercup to rest herself, and fanned herself
+with one of the leaves:  `I should have liked teaching it tricks
+very much, if--if I'd only been the right size to do it!  Oh
+dear!  I'd nearly forgotten that I've got to grow up again!  Let
+me see--how IS it to be managed?  I suppose I ought to eat or
+drink something or other; but the great question is, what?'
+
+  The great question certainly was, what?  Alice looked all round
+her at the flowers and the blades of grass, but she did not see
+anything that looked like the right thing to eat or drink under
+the circumstances.  There was a large mushroom growing near her,
+about the same height as herself; and when she had looked under
+it, and on both sides of it, and behind it, it occurred to her
+that she might as well look and see what was on the top of it.
+
+  She stretched herself up on tiptoe, and peeped over the edge of
+the mushroom, and her eyes immediately met those of a large
+caterpillar, that was sitting on the top with its arms folded,
+quietly smoking a long hookah, and taking not the smallest notice
+of her or of anything else.
+
+
+
+                            CHAPTER V
+
+                    Advice from a Caterpillar
+
+
+  The Caterpillar and Alice looked at each other for some time in
+silence:  at last the Caterpillar took the hookah out of its
+mouth, and addressed her in a languid, sleepy voice.
+
+  `Who are YOU?' said the Caterpillar.
+
+  This was not an encouraging opening for a conversation.  Alice
+replied, rather shyly, `I--I hardly know, sir, just at present--
+at least I know who I WAS when I got up this morning, but I think
+I must have been changed several times since then.'
+
+  `What do you mean by that?' said the Caterpillar sternly.
+`Explain yourself!'
+
+  `I can't explain MYSELF, I'm afraid, sir' said Alice, `because
+I'm not myself, you see.'
+
+  `I don't see,' said the Caterpillar.
+
+  `I'm afraid I can't put it more clearly,' Alice replied very
+politely, `for I can't understand it myself to begin with; and
+being so many different sizes in a day is very confusing.'
+
+  `It isn't,' said the Caterpillar.
+
+  `Well, perhaps you haven't found it so yet,' said Alice; `but
+when you have to turn into a chrysalis--you will some day, you
+know--and then after that into a butterfly, I should think you'll
+feel it a little queer, won't you?'
+
+  `Not a bit,' said the Caterpillar.
+
+  `Well, perhaps your feelings may be different,' said Alice;
+`all I know is, it would feel very queer to ME.'
+
+  `You!' said the Caterpillar contemptuously.  `Who are YOU?'
+
+  Which brought them back again to the beginning of the
+conversation.  Alice felt a little irritated at the Caterpillar's
+making such VERY short remarks, and she drew herself up and said,
+very gravely, `I think, you ought to tell me who YOU are, first.'
+
+  `Why?' said the Caterpillar.
+
+  Here was another puzzling question; and as Alice could not
+think of any good reason, and as the Caterpillar seemed to be in
+a VERY unpleasant state of mind, she turned away.
+
+  `Come back!' the Caterpillar called after her.  `I've something
+important to say!'
+
+  This sounded promising, certainly:  Alice turned and came back
+again.
+
+  `Keep your temper,' said the Caterpillar.
+
+  `Is that all?' said Alice, swallowing down her anger as well as
+she could.
+
+  `No,' said the Caterpillar.
+
+  Alice thought she might as well wait, as she had nothing else
+to do, and perhaps after all it might tell her something worth
+hearing.  For some minutes it puffed away without speaking, but
+at last it unfolded its arms, took the hookah out of its mouth
+again, and said, `So you think you're changed, do you?'
+
+  `I'm afraid I am, sir,' said Alice; `I can't remember things as
+I used--and I don't keep the same size for ten minutes together!'
+
+  `Can't remember WHAT things?' said the Caterpillar.
+
+  `Well, I've tried to say "HOW DOTH THE LITTLE BUSY BEE," but it
+all came different!' Alice replied in a very melancholy voice.
+
+  `Repeat, "YOU ARE OLD, FATHER WILLIAM,"' said the Caterpillar.
+
+  Alice folded her hands, and began:--
+
+    `You are old, Father William,' the young man said,
+      `And your hair has become very white;
+    And yet you incessantly stand on your head--
+      Do you think, at your age, it is right?'
+
+    `In my youth,' Father William replied to his son,
+      `I feared it might injure the brain;
+    But, now that I'm perfectly sure I have none,
+      Why, I do it again and again.'
+
+    `You are old,' said the youth, `as I mentioned before,
+      And have grown most uncommonly fat;
+    Yet you turned a back-somersault in at the door--
+      Pray, what is the reason of that?'
+
+    `In my youth,' said the sage, as he shook his grey locks,
+      `I kept all my limbs very supple
+    By the use of this ointment--one shilling the box--
+      Allow me to sell you a couple?'
+
+    `You are old,' said the youth, `and your jaws are too weak
+      For anything tougher than suet;
+    Yet you finished the goose, with the bones and the beak--
+      Pray how did you manage to do it?'
+
+    `In my youth,' said his father, `I took to the law,
+      And argued each case with my wife;
+    And the muscular strength, which it gave to my jaw,
+      Has lasted the rest of my life.'
+
+    `You are old,' said the youth, `one would hardly suppose
+      That your eye was as steady as ever;
+    Yet you balanced an eel on the end of your nose--
+      What made you so awfully clever?'
+
+    `I have answered three questions, and that is enough,'
+      Said his father; `don't give yourself airs!
+    Do you think I can listen all day to such stuff?
+      Be off, or I'll kick you down stairs!'
+
+
+  `That is not said right,' said the Caterpillar.
+
+  `Not QUITE right, I'm afraid,' said Alice, timidly; `some of the
+words have got altered.'
+
+  `It is wrong from beginning to end,' said the Caterpillar
+decidedly, and there was silence for some minutes.
+
+  The Caterpillar was the first to speak.
+
+  `What size do you want to be?' it asked.
+
+  `Oh, I'm not particular as to size,' Alice hastily replied;
+`only one doesn't like changing so often, you know.'
+
+  `I DON'T know,' said the Caterpillar.
+
+  Alice said nothing:  she had never been so much contradicted in
+her life before, and she felt that she was losing her temper.
+
+  `Are you content now?' said the Caterpillar.
+
+  `Well, I should like to be a LITTLE larger, sir, if you
+wouldn't mind,' said Alice:  `three inches is such a wretched
+height to be.'
+
+  `It is a very good height indeed!' said the Caterpillar
+angrily, rearing itself upright as it spoke (it was exactly three
+inches high).
+
+  `But I'm not used to it!' pleaded poor Alice in a piteous tone.
+And she thought of herself, `I wish the creatures wouldn't be so
+easily offended!'
+
+  `You'll get used to it in time,' said the Caterpillar; and it
+put the hookah into its mouth and began smoking again.
+
+  This time Alice waited patiently until it chose to speak again.
+In a minute or two the Caterpillar took the hookah out of its
+mouth and yawned once or twice, and shook itself.  Then it got
+down off the mushroom, and crawled away in the grass, merely
+remarking as it went, `One side will make you grow taller, and
+the other side will make you grow shorter.'
+
+  `One side of WHAT?  The other side of WHAT?' thought Alice to
+herself.
+
+  `Of the mushroom,' said the Caterpillar, just as if she had
+asked it aloud; and in another moment it was out of sight.
+
+  Alice remained looking thoughtfully at the mushroom for a
+minute, trying to make out which were the two sides of it; and as
+it was perfectly round, she found this a very difficult question.
+However, at last she stretched her arms round it as far as they
+would go, and broke off a bit of the edge with each hand.
+
+  `And now which is which?' she said to herself, and nibbled a
+little of the right-hand bit to try the effect:  the next moment
+she felt a violent blow underneath her chin:  it had struck her
+foot!
+
+  She was a good deal frightened by this very sudden change, but
+she felt that there was no time to be lost, as she was shrinking
+rapidly; so she set to work at once to eat some of the other bit.
+Her chin was pressed so closely against her foot, that there was
+hardly room to open her mouth; but she did it at last, and
+managed to swallow a morsel of the lefthand bit.
+
+
+     *       *       *       *       *       *       *
+
+         *       *       *       *       *       *
+
+     *       *       *       *       *       *       *
+
+  `Come, my head's free at last!' said Alice in a tone of
+delight, which changed into alarm in another moment, when she
+found that her shoulders were nowhere to be found:  all she could
+see, when she looked down, was an immense length of neck, which
+seemed to rise like a stalk out of a sea of green leaves that lay
+far below her.
+
+  `What CAN all that green stuff be?' said Alice.  `And where
+HAVE my shoulders got to?  And oh, my poor hands, how is it I
+can't see you?'  She was moving them about as she spoke, but no
+result seemed to follow, except a little shaking among the
+distant green leaves.
+
+  As there seemed to be no chance of getting her hands up to her
+head, she tried to get her head down to them, and was delighted
+to find that her neck would bend about easily in any direction,
+like a serpent.  She had just succeeded in curving it down into a
+graceful zigzag, and was going to dive in among the leaves, which
+she found to be nothing but the tops of the trees under which she
+had been wandering, when a sharp hiss made her draw back in a
+hurry:  a large pigeon had flown into her face, and was beating
+her violently with its wings.
+
+  `Serpent!' screamed the Pigeon.
+
+  `I'm NOT a serpent!' said Alice indignantly.  `Let me alone!'
+
+  `Serpent, I say again!' repeated the Pigeon, but in a more
+subdued tone, and added with a kind of sob, `I've tried every
+way, and nothing seems to suit them!'
+
+  `I haven't the least idea what you're talking about,' said
+Alice.
+
+  `I've tried the roots of trees, and I've tried banks, and I've
+tried hedges,' the Pigeon went on, without attending to her; `but
+those serpents!  There's no pleasing them!'
+
+  Alice was more and more puzzled, but she thought there was no
+use in saying anything more till the Pigeon had finished.
+
+  `As if it wasn't trouble enough hatching the eggs,' said the
+Pigeon; `but I must be on the look-out for serpents night and
+day!  Why, I haven't had a wink of sleep these three weeks!'
+
+  `I'm very sorry you've been annoyed,' said Alice, who was
+beginning to see its meaning.
+
+  `And just as I'd taken the highest tree in the wood,' continued
+the Pigeon, raising its voice to a shriek, `and just as I was
+thinking I should be free of them at last, they must needs come
+wriggling down from the sky!  Ugh, Serpent!'
+
+  `But I'm NOT a serpent, I tell you!' said Alice.  `I'm a--I'm
+a--'
+
+  `Well!  WHAT are you?' said the Pigeon.  `I can see you're
+trying to invent something!'
+
+  `I--I'm a little girl,' said Alice, rather doubtfully, as she
+remembered the number of changes she had gone through that day.
+
+  `A likely story indeed!' said the Pigeon in a tone of the
+deepest contempt.  `I've seen a good many little girls in my
+time, but never ONE with such a neck as that!  No, no!  You're a
+serpent; and there's no use denying it.  I suppose you'll be
+telling me next that you never tasted an egg!'
+
+  `I HAVE tasted eggs, certainly,' said Alice, who was a very
+truthful child; `but little girls eat eggs quite as much as
+serpents do, you know.'
+
+  `I don't believe it,' said the Pigeon; `but if they do, why
+then they're a kind of serpent, that's all I can say.'
+
+  This was such a new idea to Alice, that she was quite silent
+for a minute or two, which gave the Pigeon the opportunity of
+adding, `You're looking for eggs, I know THAT well enough; and
+what does it matter to me whether you're a little girl or a
+serpent?'
+
+  `It matters a good deal to ME,' said Alice hastily; `but I'm
+not looking for eggs, as it happens; and if I was, I shouldn't
+want YOURS:  I don't like them raw.'
+
+  `Well, be off, then!' said the Pigeon in a sulky tone, as it
+settled down again into its nest.  Alice crouched down among the
+trees as well as she could, for her neck kept getting entangled
+among the branches, and every now and then she had to stop and
+untwist it.  After a while she remembered that she still held the
+pieces of mushroom in her hands, and she set to work very
+carefully, nibbling first at one and then at the other, and
+growing sometimes taller and sometimes shorter, until she had
+succeeded in bringing herself down to her usual height.
+
+  It was so long since she had been anything near the right size,
+that it felt quite strange at first; but she got used to it in a
+few minutes, and began talking to herself, as usual.  `Come,
+there's half my plan done now!  How puzzling all these changes
+are!  I'm never sure what I'm going to be, from one minute to
+another!  However, I've got back to my right size:  the next
+thing is, to get into that beautiful garden--how IS that to be
+done, I wonder?'  As she said this, she came suddenly upon an
+open place, with a little house in it about four feet high.
+`Whoever lives there,' thought Alice, `it'll never do to come
+upon them THIS size:  why, I should frighten them out of their
+wits!'  So she began nibbling at the righthand bit again, and did
+not venture to go near the house till she had brought herself
+down to nine inches high.
+
+
+
+                           CHAPTER VI
+
+                         Pig and Pepper
+
+
+  For a minute or two she stood looking at the house, and
+wondering what to do next, when suddenly a footman in livery came
+running out of the wood--(she considered him to be a footman
+because he was in livery:  otherwise, judging by his face only,
+she would have called him a fish)--and rapped loudly at the door
+with his knuckles.  It was opened by another footman in livery,
+with a round face, and large eyes like a frog; and both footmen,
+Alice noticed, had powdered hair that curled all over their
+heads.  She felt very curious to know what it was all about, and
+crept a little way out of the wood to listen.
+
+  The Fish-Footman began by producing from under his arm a great
+letter, nearly as large as himself, and this he handed over to
+the other, saying, in a solemn tone, `For the Duchess.  An
+invitation from the Queen to play croquet.'  The Frog-Footman
+repeated, in the same solemn tone, only changing the order of the
+words a little, `From the Queen.  An invitation for the Duchess
+to play croquet.'
+
+  Then they both bowed low, and their curls got entangled
+together.
+
+  Alice laughed so much at this, that she had to run back into
+the wood for fear of their hearing her; and when she next peeped
+out the Fish-Footman was gone, and the other was sitting on the
+ground near the door, staring stupidly up into the sky.
+
+  Alice went timidly up to the door, and knocked.
+
+  `There's no sort of use in knocking,' said the Footman, `and
+that for two reasons.  First, because I'm on the same side of the
+door as you are; secondly, because they're making such a noise
+inside, no one could possibly hear you.'  And certainly there was
+a most extraordinary noise going on within--a constant howling
+and sneezing, and every now and then a great crash, as if a dish
+or kettle had been broken to pieces.
+
+  `Please, then,' said Alice, `how am I to get in?'
+
+  `There might be some sense in your knocking,' the Footman went
+on without attending to her, `if we had the door between us.  For
+instance, if you were INSIDE, you might knock, and I could let
+you out, you know.'  He was looking up into the sky all the time
+he was speaking, and this Alice thought decidedly uncivil.  `But
+perhaps he can't help it,' she said to herself; `his eyes are so
+VERY nearly at the top of his head.  But at any rate he might
+answer questions.--How am I to get in?' she repeated, aloud.
+
+  `I shall sit here,' the Footman remarked, `till tomorrow--'
+
+  At this moment the door of the house opened, and a large plate
+came skimming out, straight at the Footman's head:  it just
+grazed his nose, and broke to pieces against one of the trees
+behind him.
+
+  `--or next day, maybe,' the Footman continued in the same tone,
+exactly as if nothing had happened.
+
+  `How am I to get in?' asked Alice again, in a louder tone.
+
+  `ARE you to get in at all?' said the Footman.  `That's the
+first question, you know.'
+
+  It was, no doubt:  only Alice did not like to be told so.
+`It's really dreadful,' she muttered to herself, `the way all the
+creatures argue.  It's enough to drive one crazy!'
+
+  The Footman seemed to think this a good opportunity for
+repeating his remark, with variations.  `I shall sit here,' he
+said, `on and off, for days and days.'
+
+  `But what am I to do?' said Alice.
+
+  `Anything you like,' said the Footman, and began whistling.
+
+  `Oh, there's no use in talking to him,' said Alice desperately:
+`he's perfectly idiotic!'  And she opened the door and went in.
+
+  The door led right into a large kitchen, which was full of
+smoke from one end to the other:  the Duchess was sitting on a
+three-legged stool in the middle, nursing a baby; the cook was
+leaning over the fire, stirring a large cauldron which seemed to
+be full of soup.
+
+  `There's certainly too much pepper in that soup!' Alice said to
+herself, as well as she could for sneezing.
+
+  There was certainly too much of it in the air.  Even the
+Duchess sneezed occasionally; and as for the baby, it was
+sneezing and howling alternately without a moment's pause.  The
+only things in the kitchen that did not sneeze, were the cook,
+and a large cat which was sitting on the hearth and grinning from
+ear to ear.
+
+  `Please would you tell me,' said Alice, a little timidly, for
+she was not quite sure whether it was good manners for her to
+speak first, `why your cat grins like that?'
+
+  `It's a Cheshire cat,' said the Duchess, `and that's why.  Pig!'
+
+  She said the last word with such sudden violence that Alice
+quite jumped; but she saw in another moment that it was addressed
+to the baby, and not to her, so she took courage, and went on
+again:--
+
+  `I didn't know that Cheshire cats always grinned; in fact, I
+didn't know that cats COULD grin.'
+
+  `They all can,' said the Duchess; `and most of 'em do.'
+
+  `I don't know of any that do,' Alice said very politely,
+feeling quite pleased to have got into a conversation.
+
+  `You don't know much,' said the Duchess; `and that's a fact.'
+
+  Alice did not at all like the tone of this remark, and thought
+it would be as well to introduce some other subject of
+conversation.  While she was trying to fix on one, the cook took
+the cauldron of soup off the fire, and at once set to work
+throwing everything within her reach at the Duchess and the baby
+--the fire-irons came first; then followed a shower of saucepans,
+plates, and dishes.  The Duchess took no notice of them even when
+they hit her; and the baby was howling so much already, that it
+was quite impossible to say whether the blows hurt it or not.
+
+  `Oh, PLEASE mind what you're doing!' cried Alice, jumping up
+and down in an agony of terror.  `Oh, there goes his PRECIOUS
+nose'; as an unusually large saucepan flew close by it, and very
+nearly carried it off.
+
+  `If everybody minded their own business,' the Duchess said in a
+hoarse growl, `the world would go round a deal faster than it
+does.'
+
+  `Which would NOT be an advantage,' said Alice, who felt very
+glad to get an opportunity of showing off a little of her
+knowledge.  `Just think of what work it would make with the day
+and night!  You see the earth takes twenty-four hours to turn
+round on its axis--'
+
+  `Talking of axes,' said the Duchess, `chop off her head!'
+
+  Alice glanced rather anxiously at the cook, to see if she meant
+to take the hint; but the cook was busily stirring the soup, and
+seemed not to be listening, so she went on again:  `Twenty-four
+hours, I THINK; or is it twelve?  I--'
+
+  `Oh, don't bother ME,' said the Duchess; `I never could abide
+figures!'  And with that she began nursing her child again,
+singing a sort of lullaby to it as she did so, and giving it a
+violent shake at the end of every line:
+
+        `Speak roughly to your little boy,
+          And beat him when he sneezes:
+        He only does it to annoy,
+          Because he knows it teases.'
+
+                    CHORUS.
+
+    (In which the cook and the baby joined):--
+
+                `Wow! wow! wow!'
+
+  While the Duchess sang the second verse of the song, she kept
+tossing the baby violently up and down, and the poor little thing
+howled so, that Alice could hardly hear the words:--
+
+        `I speak severely to my boy,
+          I beat him when he sneezes;
+        For he can thoroughly enjoy
+          The pepper when he pleases!'
+
+                    CHORUS.
+
+                `Wow! wow! wow!'
+
+  `Here! you may nurse it a bit, if you like!' the Duchess said
+to Alice, flinging the baby at her as she spoke.  `I must go and
+get ready to play croquet with the Queen,' and she hurried out of
+the room.  The cook threw a frying-pan after her as she went out,
+but it just missed her.
+
+  Alice caught the baby with some difficulty, as it was a queer-
+shaped little creature, and held out its arms and legs in all
+directions, `just like a star-fish,' thought Alice.  The poor
+little thing was snorting like a steam-engine when she caught it,
+and kept doubling itself up and straightening itself out again,
+so that altogether, for the first minute or two, it was as much
+as she could do to hold it.
+
+  As soon as she had made out the proper way of nursing it,
+(which was to twist it up into a sort of knot, and then keep
+tight hold of its right ear and left foot, so as to prevent its
+undoing itself,) she carried it out into the open air.  `IF I
+don't take this child away with me,' thought Alice, `they're sure
+to kill it in a day or two:  wouldn't it be murder to leave it
+behind?'  She said the last words out loud, and the little thing
+grunted in reply (it had left off sneezing by this time).  `Don't
+grunt,' said Alice; `that's not at all a proper way of expressing
+yourself.'
+
+  The baby grunted again, and Alice looked very anxiously into
+its face to see what was the matter with it.  There could be no
+doubt that it had a VERY turn-up nose, much more like a snout
+than a real nose; also its eyes were getting extremely small for
+a baby:  altogether Alice did not like the look of the thing at
+all.  `But perhaps it was only sobbing,' she thought, and looked
+into its eyes again, to see if there were any tears.
+
+  No, there were no tears.  `If you're going to turn into a pig,
+my dear,' said Alice, seriously, `I'll have nothing more to do
+with you.  Mind now!'  The poor little thing sobbed again (or
+grunted, it was impossible to say which), and they went on for
+some while in silence.
+
+  Alice was just beginning to think to herself, `Now, what am I
+to do with this creature when I get it home?' when it grunted
+again, so violently, that she looked down into its face in some
+alarm.  This time there could be NO mistake about it:  it was
+neither more nor less than a pig, and she felt that it would be
+quite absurd for her to carry it further.
+
+  So she set the little creature down, and felt quite relieved to
+see it trot away quietly into the wood.  `If it had grown up,'
+she said to herself, `it would have made a dreadfully ugly child:
+but it makes rather a handsome pig, I think.'  And she began
+thinking over other children she knew, who might do very well as
+pigs, and was just saying to herself, `if one only knew the right
+way to change them--' when she was a little startled by seeing
+the Cheshire Cat sitting on a bough of a tree a few yards off.
+
+  The Cat only grinned when it saw Alice.  It looked good-
+natured, she thought:  still it had VERY long claws and a great
+many teeth, so she felt that it ought to be treated with respect.
+
+  `Cheshire Puss,' she began, rather timidly, as she did not at
+all know whether it would like the name:  however, it only
+grinned a little wider.  `Come, it's pleased so far,' thought
+Alice, and she went on.  `Would you tell me, please, which way I
+ought to go from here?'
+
+  `That depends a good deal on where you want to get to,' said
+the Cat.
+
+  `I don't much care where--' said Alice.
+
+  `Then it doesn't matter which way you go,' said the Cat.
+
+  `--so long as I get SOMEWHERE,' Alice added as an explanation.
+
+  `Oh, you're sure to do that,' said the Cat, `if you only walk
+long enough.'
+
+  Alice felt that this could not be denied, so she tried another
+question.  `What sort of people live about here?'
+
+  `In THAT direction,' the Cat said, waving its right paw round,
+`lives a Hatter:  and in THAT direction,' waving the other paw,
+`lives a March Hare.  Visit either you like:  they're both mad.'
+
+  `But I don't want to go among mad people,' Alice remarked.
+
+  `Oh, you can't help that,' said the Cat:  `we're all mad here.
+I'm mad.  You're mad.'
+
+  `How do you know I'm mad?' said Alice.
+
+  `You must be,' said the Cat, `or you wouldn't have come here.'
+
+  Alice didn't think that proved it at all; however, she went on
+`And how do you know that you're mad?'
+
+  `To begin with,' said the Cat, `a dog's not mad.  You grant
+that?'
+
+  `I suppose so,' said Alice.
+
+  `Well, then,' the Cat went on, `you see, a dog growls when it's
+angry, and wags its tail when it's pleased.  Now I growl when I'm
+pleased, and wag my tail when I'm angry.  Therefore I'm mad.'
+
+  `I call it purring, not growling,' said Alice.
+
+  `Call it what you like,' said the Cat.  `Do you play croquet
+with the Queen to-day?'
+
+  `I should like it very much,' said Alice, `but I haven't been
+invited yet.'
+
+  `You'll see me there,' said the Cat, and vanished.
+
+  Alice was not much surprised at this, she was getting so used
+to queer things happening.  While she was looking at the place
+where it had been, it suddenly appeared again.
+
+  `By-the-bye, what became of the baby?' said the Cat.  `I'd
+nearly forgotten to ask.'
+
+  `It turned into a pig,' Alice quietly said, just as if it had
+come back in a natural way.
+
+  `I thought it would,' said the Cat, and vanished again.
+
+  Alice waited a little, half expecting to see it again, but it
+did not appear, and after a minute or two she walked on in the
+direction in which the March Hare was said to live.  `I've seen
+hatters before,' she said to herself; `the March Hare will be
+much the most interesting, and perhaps as this is May it won't be
+raving mad--at least not so mad as it was in March.'  As she said
+this, she looked up, and there was the Cat again, sitting on a
+branch of a tree.
+
+  `Did you say pig, or fig?' said the Cat.
+
+  `I said pig,' replied Alice; `and I wish you wouldn't keep
+appearing and vanishing so suddenly:  you make one quite giddy.'
+
+  `All right,' said the Cat; and this time it vanished quite slowly,
+beginning with the end of the tail, and ending with the grin,
+which remained some time after the rest of it had gone.
+
+  `Well!  I've often seen a cat without a grin,' thought Alice;
+`but a grin without a cat!  It's the most curious thing I ever
+saw in my life!'
+
+  She had not gone much farther before she came in sight of the
+house of the March Hare:  she thought it must be the right house,
+because the chimneys were shaped like ears and the roof was
+thatched with fur.  It was so large a house, that she did not
+like to go nearer till she had nibbled some more of the lefthand
+bit of mushroom, and raised herself to about two feet high:  even
+then she walked up towards it rather timidly, saying to herself
+`Suppose it should be raving mad after all!  I almost wish I'd
+gone to see the Hatter instead!'
+
+
+
+                           CHAPTER VII
+
+                         A Mad Tea-Party
+
+
+  There was a table set out under a tree in front of the house,
+and the March Hare and the Hatter were having tea at it:  a
+Dormouse was sitting between them, fast asleep, and the other two
+were using it as a cushion, resting their elbows on it, and talking
+over its head.  `Very uncomfortable for the Dormouse,' thought Alice;
+`only, as it's asleep, I suppose it doesn't mind.'
+
+  The table was a large one, but the three were all crowded
+together at one corner of it:  `No room!  No room!' they cried
+out when they saw Alice coming.  `There's PLENTY of room!' said
+Alice indignantly, and she sat down in a large arm-chair at one
+end of the table.
+
+  `Have some wine,' the March Hare said in an encouraging tone.
+
+  Alice looked all round the table, but there was nothing on it
+but tea.  `I don't see any wine,' she remarked.
+
+  `There isn't any,' said the March Hare.
+
+  `Then it wasn't very civil of you to offer it,' said Alice
+angrily.
+
+  `It wasn't very civil of you to sit down without being
+invited,' said the March Hare.
+
+  `I didn't know it was YOUR table,' said Alice; `it's laid for a
+great many more than three.'
+
+  `Your hair wants cutting,' said the Hatter.  He had been
+looking at Alice for some time with great curiosity, and this was
+his first speech.
+
+  `You should learn not to make personal remarks,' Alice said
+with some severity; `it's very rude.'
+
+  The Hatter opened his eyes very wide on hearing this; but all
+he SAID was, `Why is a raven like a writing-desk?'
+
+  `Come, we shall have some fun now!' thought Alice.  `I'm glad
+they've begun asking riddles.--I believe I can guess that,' she
+added aloud.
+
+  `Do you mean that you think you can find out the answer to it?'
+said the March Hare.
+
+  `Exactly so,' said Alice.
+
+  `Then you should say what you mean,' the March Hare went on.
+
+  `I do,' Alice hastily replied; `at least--at least I mean what
+I say--that's the same thing, you know.'
+
+  `Not the same thing a bit!' said the Hatter.  `You might just
+as well say that "I see what I eat" is the same thing as "I eat
+what I see"!'
+
+  `You might just as well say,' added the March Hare, `that "I
+like what I get" is the same thing as "I get what I like"!'
+
+  `You might just as well say,' added the Dormouse, who seemed to
+be talking in his sleep, `that "I breathe when I sleep" is the
+same thing as "I sleep when I breathe"!'
+
+  `It IS the same thing with you,' said the Hatter, and here the
+conversation dropped, and the party sat silent for a minute,
+while Alice thought over all she could remember about ravens and
+writing-desks, which wasn't much.
+
+  The Hatter was the first to break the silence.  `What day of
+the month is it?' he said, turning to Alice:  he had taken his
+watch out of his pocket, and was looking at it uneasily, shaking
+it every now and then, and holding it to his ear.
+
+  Alice considered a little, and then said `The fourth.'
+
+  `Two days wrong!' sighed the Hatter.  `I told you butter
+wouldn't suit the works!' he added looking angrily at the March
+Hare.
+
+  `It was the BEST butter,' the March Hare meekly replied.
+
+  `Yes, but some crumbs must have got in as well,' the Hatter
+grumbled:  `you shouldn't have put it in with the bread-knife.'
+
+  The March Hare took the watch and looked at it gloomily:  then
+he dipped it into his cup of tea, and looked at it again:  but he
+could think of nothing better to say than his first remark, `It
+was the BEST butter, you know.'
+
+  Alice had been looking over his shoulder with some curiosity.
+`What a funny watch!' she remarked.  `It tells the day of the
+month, and doesn't tell what o'clock it is!'
+
+  `Why should it?' muttered the Hatter.  `Does YOUR watch tell
+you what year it is?'
+
+  `Of course not,' Alice replied very readily:  `but that's
+because it stays the same year for such a long time together.'
+
+  `Which is just the case with MINE,' said the Hatter.
+
+  Alice felt dreadfully puzzled.  The Hatter's remark seemed to
+have no sort of meaning in it, and yet it was certainly English.
+`I don't quite understand you,' she said, as politely as she
+could.
+
+  `The Dormouse is asleep again,' said the Hatter, and he poured
+a little hot tea upon its nose.
+
+  The Dormouse shook its head impatiently, and said, without
+opening its eyes, `Of course, of course; just what I was going to
+remark myself.'
+
+  `Have you guessed the riddle yet?' the Hatter said, turning to
+Alice again.
+
+  `No, I give it up,' Alice replied:  `what's the answer?'
+
+  `I haven't the slightest idea,' said the Hatter.
+
+  `Nor I,' said the March Hare.
+
+  Alice sighed wearily.  `I think you might do something better
+with the time,' she said, `than waste it in asking riddles that
+have no answers.'
+
+  `If you knew Time as well as I do,' said the Hatter, `you
+wouldn't talk about wasting IT.  It's HIM.'
+
+  `I don't know what you mean,' said Alice.
+
+  `Of course you don't!' the Hatter said, tossing his head
+contemptuously.  `I dare say you never even spoke to Time!'
+
+  `Perhaps not,' Alice cautiously replied:  `but I know I have to
+beat time when I learn music.'
+
+  `Ah! that accounts for it,' said the Hatter.  `He won't stand
+beating.  Now, if you only kept on good terms with him, he'd do
+almost anything you liked with the clock.  For instance, suppose
+it were nine o'clock in the morning, just time to begin lessons:
+you'd only have to whisper a hint to Time, and round goes the
+clock in a twinkling!  Half-past one, time for dinner!'
+
+  (`I only wish it was,' the March Hare said to itself in a
+whisper.)
+
+  `That would be grand, certainly,' said Alice thoughtfully:
+`but then--I shouldn't be hungry for it, you know.'
+
+  `Not at first, perhaps,' said the Hatter:  `but you could keep
+it to half-past one as long as you liked.'
+
+  `Is that the way YOU manage?' Alice asked.
+
+  The Hatter shook his head mournfully.  `Not I!' he replied.
+`We quarrelled last March--just before HE went mad, you know--'
+(pointing with his tea spoon at the March Hare,) `--it was at the
+great concert given by the Queen of Hearts, and I had to sing
+
+            "Twinkle, twinkle, little bat!
+            How I wonder what you're at!"
+
+You know the song, perhaps?'
+
+  `I've heard something like it,' said Alice.
+
+  `It goes on, you know,' the Hatter continued, `in this way:--
+
+            "Up above the world you fly,
+            Like a tea-tray in the sky.
+                    Twinkle, twinkle--"'
+
+Here the Dormouse shook itself, and began singing in its sleep
+`Twinkle, twinkle, twinkle, twinkle--' and went on so long that
+they had to pinch it to make it stop.
+
+  `Well, I'd hardly finished the first verse,' said the Hatter,
+`when the Queen jumped up and bawled out, "He's murdering the
+time!  Off with his head!"'
+
+  `How dreadfully savage!' exclaimed Alice.
+
+  `And ever since that,' the Hatter went on in a mournful tone,
+`he won't do a thing I ask!  It's always six o'clock now.'
+
+  A bright idea came into Alice's head.  `Is that the reason so
+many tea-things are put out here?' she asked.
+
+  `Yes, that's it,' said the Hatter with a sigh:  `it's always
+tea-time, and we've no time to wash the things between whiles.'
+
+  `Then you keep moving round, I suppose?' said Alice.
+
+  `Exactly so,' said the Hatter:  `as the things get used up.'
+
+  `But what happens when you come to the beginning again?' Alice
+ventured to ask.
+
+  `Suppose we change the subject,' the March Hare interrupted,
+yawning.  `I'm getting tired of this.  I vote the young lady
+tells us a story.'
+
+  `I'm afraid I don't know one,' said Alice, rather alarmed at
+the proposal.
+
+  `Then the Dormouse shall!' they both cried.  `Wake up,
+Dormouse!'  And they pinched it on both sides at once.
+
+  The Dormouse slowly opened his eyes.  `I wasn't asleep,' he
+said in a hoarse, feeble voice:  `I heard every word you fellows
+were saying.'
+
+  `Tell us a story!' said the March Hare.
+
+  `Yes, please do!' pleaded Alice.
+
+  `And be quick about it,' added the Hatter, `or you'll be asleep
+again before it's done.'
+
+  `Once upon a time there were three little sisters,' the
+Dormouse began in a great hurry; `and their names were Elsie,
+Lacie, and Tillie; and they lived at the bottom of a well--'
+
+  `What did they live on?' said Alice, who always took a great
+interest in questions of eating and drinking.
+
+  `They lived on treacle,' said the Dormouse, after thinking a
+minute or two.
+
+  `They couldn't have done that, you know,' Alice gently
+remarked; `they'd have been ill.'
+
+  `So they were,' said the Dormouse; `VERY ill.'
+
+  Alice tried to fancy to herself what such an extraordinary ways
+of living would be like, but it puzzled her too much, so she went
+on:  `But why did they live at the bottom of a well?'
+
+  `Take some more tea,' the March Hare said to Alice, very
+earnestly.
+
+  `I've had nothing yet,' Alice replied in an offended tone, `so
+I can't take more.'
+
+  `You mean you can't take LESS,' said the Hatter:  `it's very
+easy to take MORE than nothing.'
+
+  `Nobody asked YOUR opinion,' said Alice.
+
+  `Who's making personal remarks now?' the Hatter asked
+triumphantly.
+
+  Alice did not quite know what to say to this:  so she helped
+herself to some tea and bread-and-butter, and then turned to the
+Dormouse, and repeated her question.  `Why did they live at the
+bottom of a well?'
+
+  The Dormouse again took a minute or two to think about it, and
+then said, `It was a treacle-well.'
+
+  `There's no such thing!'  Alice was beginning very angrily, but
+the Hatter and the March Hare went `Sh! sh!' and the Dormouse
+sulkily remarked, `If you can't be civil, you'd better finish the
+story for yourself.'
+
+  `No, please go on!' Alice said very humbly; `I won't interrupt
+again.  I dare say there may be ONE.'
+
+  `One, indeed!' said the Dormouse indignantly.  However, he
+consented to go on.  `And so these three little sisters--they
+were learning to draw, you know--'
+
+  `What did they draw?' said Alice, quite forgetting her promise.
+
+  `Treacle,' said the Dormouse, without considering at all this
+time.
+
+  `I want a clean cup,' interrupted the Hatter:  `let's all move
+one place on.'
+
+  He moved on as he spoke, and the Dormouse followed him:  the
+March Hare moved into the Dormouse's place, and Alice rather
+unwillingly took the place of the March Hare.  The Hatter was the
+only one who got any advantage from the change:  and Alice was a
+good deal worse off than before, as the March Hare had just upset
+the milk-jug into his plate.
+
+  Alice did not wish to offend the Dormouse again, so she began
+very cautiously:  `But I don't understand.  Where did they draw
+the treacle from?'
+
+  `You can draw water out of a water-well,' said the Hatter; `so
+I should think you could draw treacle out of a treacle-well--eh,
+stupid?'
+
+  `But they were IN the well,' Alice said to the Dormouse, not
+choosing to notice this last remark.
+
+  `Of course they were', said the Dormouse; `--well in.'
+
+  This answer so confused poor Alice, that she let the Dormouse
+go on for some time without interrupting it.
+
+  `They were learning to draw,' the Dormouse went on, yawning and
+rubbing its eyes, for it was getting very sleepy; `and they drew
+all manner of things--everything that begins with an M--'
+
+  `Why with an M?' said Alice.
+
+  `Why not?' said the March Hare.
+
+  Alice was silent.
+
+  The Dormouse had closed its eyes by this time, and was going
+off into a doze; but, on being pinched by the Hatter, it woke up
+again with a little shriek, and went on:  `--that begins with an
+M, such as mouse-traps, and the moon, and memory, and muchness--
+you know you say things are "much of a muchness"--did you ever
+see such a thing as a drawing of a muchness?'
+
+  `Really, now you ask me,' said Alice, very much confused, `I
+don't think--'
+
+  `Then you shouldn't talk,' said the Hatter.
+
+  This piece of rudeness was more than Alice could bear:  she got
+up in great disgust, and walked off; the Dormouse fell asleep
+instantly, and neither of the others took the least notice of her
+going, though she looked back once or twice, half hoping that
+they would call after her:  the last time she saw them, they were
+trying to put the Dormouse into the teapot.
+
+  `At any rate I'll never go THERE again!' said Alice as she
+picked her way through the wood.  `It's the stupidest tea-party I
+ever was at in all my life!'
+
+  Just as she said this, she noticed that one of the trees had a
+door leading right into it.  `That's very curious!' she thought.
+`But everything's curious today.  I think I may as well go in at once.'
+And in she went.
+
+  Once more she found herself in the long hall, and close to the
+little glass table.  `Now, I'll manage better this time,'
+she said to herself, and began by taking the little golden key,
+and unlocking the door that led into the garden.  Then she went
+to work nibbling at the mushroom (she had kept a piece of it
+in her pocket) till she was about a foot high:  then she walked down
+the little passage:  and THEN--she found herself at last in the
+beautiful garden, among the bright flower-beds and the cool fountains.
+
+
+
+                          CHAPTER VIII
+
+                   The Queen's Croquet-Ground
+
+
+  A large rose-tree stood near the entrance of the garden:  the
+roses growing on it were white, but there were three gardeners at
+it, busily painting them red.  Alice thought this a very curious
+thing, and she went nearer to watch them, and just as she came up
+to them she heard one of them say, `Look out now, Five!  Don't go
+splashing paint over me like that!'
+
+  `I couldn't help it,' said Five, in a sulky tone; `Seven jogged
+my elbow.'
+
+  On which Seven looked up and said, `That's right, Five!  Always
+lay the blame on others!'
+
+  `YOU'D better not talk!' said Five.  `I heard the Queen say only
+yesterday you deserved to be beheaded!'
+
+  `What for?' said the one who had spoken first.
+
+  `That's none of YOUR business, Two!' said Seven.
+
+  `Yes, it IS his business!' said Five, `and I'll tell him--it
+was for bringing the cook tulip-roots instead of onions.'
+
+  Seven flung down his brush, and had just begun `Well, of all
+the unjust things--' when his eye chanced to fall upon Alice, as
+she stood watching them, and he checked himself suddenly:  the
+others looked round also, and all of them bowed low.
+
+  `Would you tell me,' said Alice, a little timidly, `why you are
+painting those roses?'
+
+  Five and Seven said nothing, but looked at Two.  Two began in a
+low voice, `Why the fact is, you see, Miss, this here ought to
+have been a RED rose-tree, and we put a white one in by mistake;
+and if the Queen was to find it out, we should all have our heads
+cut off, you know.  So you see, Miss, we're doing our best, afore
+she comes, to--'  At this moment Five, who had been anxiously
+looking across the garden, called out `The Queen!  The Queen!'
+and the three gardeners instantly threw themselves flat upon
+their faces.  There was a sound of many footsteps, and Alice
+looked round, eager to see the Queen.
+
+  First came ten soldiers carrying clubs; these were all shaped
+like the three gardeners, oblong and flat, with their hands and
+feet at the corners:  next the ten courtiers; these were
+ornamented all over with diamonds, and walked two and two, as the
+soldiers did.  After these came the royal children; there were
+ten of them, and the little dears came jumping merrily along hand
+in hand, in couples:  they were all ornamented with hearts.  Next
+came the guests, mostly Kings and Queens, and among them Alice
+recognised the White Rabbit:  it was talking in a hurried nervous
+manner, smiling at everything that was said, and went by without
+noticing her.  Then followed the Knave of Hearts, carrying the
+King's crown on a crimson velvet cushion; and, last of all this
+grand procession, came THE KING AND QUEEN OF HEARTS.
+
+  Alice was rather doubtful whether she ought not to lie down on
+her face like the three gardeners, but she could not remember
+ever having heard of such a rule at processions; `and besides,
+what would be the use of a procession,' thought she, `if people
+had all to lie down upon their faces, so that they couldn't see it?'
+So she stood still where she was, and waited.
+
+  When the procession came opposite to Alice, they all stopped
+and looked at her, and the Queen said severely `Who is this?'
+She said it to the Knave of Hearts, who only bowed and smiled in reply.
+
+  `Idiot!' said the Queen, tossing her head impatiently; and,
+turning to Alice, she went on, `What's your name, child?'
+
+  `My name is Alice, so please your Majesty,' said Alice very
+politely; but she added, to herself, `Why, they're only a pack of
+cards, after all.  I needn't be afraid of them!'
+
+  `And who are THESE?' said the Queen, pointing to the three
+gardeners who were lying round the rosetree; for, you see, as
+they were lying on their faces, and the pattern on their backs
+was the same as the rest of the pack, she could not tell whether
+they were gardeners, or soldiers, or courtiers, or three of her
+own children.
+
+  `How should I know?' said Alice, surprised at her own courage.
+`It's no business of MINE.'
+
+  The Queen turned crimson with fury, and, after glaring at her
+for a moment like a wild beast, screamed `Off with her head!
+Off--'
+
+  `Nonsense!' said Alice, very loudly and decidedly, and the
+Queen was silent.
+
+  The King laid his hand upon her arm, and timidly said
+`Consider, my dear:  she is only a child!'
+
+  The Queen turned angrily away from him, and said to the Knave
+`Turn them over!'
+
+  The Knave did so, very carefully, with one foot.
+
+  `Get up!' said the Queen, in a shrill, loud voice, and the
+three gardeners instantly jumped up, and began bowing to the
+King, the Queen, the royal children, and everybody else.
+
+  `Leave off that!' screamed the Queen.  `You make me giddy.'
+And then, turning to the rose-tree, she went on, `What HAVE you
+been doing here?'
+
+  `May it please your Majesty,' said Two, in a very humble tone,
+going down on one knee as he spoke, `we were trying--'
+
+  `I see!' said the Queen, who had meanwhile been examining the
+roses.  `Off with their heads!' and the procession moved on,
+three of the soldiers remaining behind to execute the unfortunate
+gardeners, who ran to Alice for protection.
+
+  `You shan't be beheaded!' said Alice, and she put them into a
+large flower-pot that stood near.  The three soldiers wandered
+about for a minute or two, looking for them, and then quietly
+marched off after the others.
+
+  `Are their heads off?' shouted the Queen.
+
+  `Their heads are gone, if it please your Majesty!' the soldiers
+shouted in reply.
+
+  `That's right!' shouted the Queen.  `Can you play croquet?'
+
+  The soldiers were silent, and looked at Alice, as the question
+was evidently meant for her.
+
+  `Yes!' shouted Alice.
+
+  `Come on, then!' roared the Queen, and Alice joined the
+procession, wondering very much what would happen next.
+
+  `It's--it's a very fine day!' said a timid voice at her side.
+She was walking by the White Rabbit, who was peeping anxiously
+into her face.
+
+  `Very,' said Alice:  `--where's the Duchess?'
+
+  `Hush!  Hush!' said the Rabbit in a low, hurried tone.  He
+looked anxiously over his shoulder as he spoke, and then raised
+himself upon tiptoe, put his mouth close to her ear, and
+whispered `She's under sentence of execution.'
+
+  `What for?' said Alice.
+
+  `Did you say "What a pity!"?' the Rabbit asked.
+
+  `No, I didn't,' said Alice:  `I don't think it's at all a pity.
+I said "What for?"'
+
+  `She boxed the Queen's ears--' the Rabbit began.  Alice gave a
+little scream of laughter.  `Oh, hush!' the Rabbit whispered in a
+frightened tone.  `The Queen will hear you!  You see, she came
+rather late, and the Queen said--'
+
+  `Get to your places!' shouted the Queen in a voice of thunder,
+and people began running about in all directions, tumbling up
+against each other; however, they got settled down in a minute or
+two, and the game began.  Alice thought she had never seen such a
+curious croquet-ground in her life; it was all ridges and
+furrows; the balls were live hedgehogs, the mallets live
+flamingoes, and the soldiers had to double themselves up and to
+stand on their hands and feet, to make the arches.
+
+  The chief difficulty Alice found at first was in managing her
+flamingo:  she succeeded in getting its body tucked away,
+comfortably enough, under her arm, with its legs hanging down,
+but generally, just as she had got its neck nicely straightened
+out, and was going to give the hedgehog a blow with its head, it
+WOULD twist itself round and look up in her face, with such a
+puzzled expression that she could not help bursting out laughing:
+and when she had got its head down, and was going to begin again,
+it was very provoking to find that the hedgehog had unrolled
+itself, and was in the act of crawling away:  besides all this,
+there was generally a ridge or furrow in the way wherever she
+wanted to send the hedgehog to, and, as the doubled-up soldiers
+were always getting up and walking off to other parts of the
+ground, Alice soon came to the conclusion that it was a very
+difficult game indeed.
+
+  The players all played at once without waiting for turns,
+quarrelling all the while, and fighting for the hedgehogs; and in
+a very short time the Queen was in a furious passion, and went
+stamping about, and shouting `Off with his head!' or `Off with
+her head!' about once in a minute.
+
+  Alice began to feel very uneasy:  to be sure, she had not as
+yet had any dispute with the Queen, but she knew that it might
+happen any minute, `and then,' thought she, `what would become of
+me?  They're dreadfully fond of beheading people here; the great
+wonder is, that there's any one left alive!'
+
+  She was looking about for some way of escape, and wondering
+whether she could get away without being seen, when she noticed a
+curious appearance in the air:  it puzzled her very much at
+first, but, after watching it a minute or two, she made it out to
+be a grin, and she said to herself `It's the Cheshire Cat:  now I
+shall have somebody to talk to.'
+
+  `How are you getting on?' said the Cat, as soon as there was
+mouth enough for it to speak with.
+
+  Alice waited till the eyes appeared, and then nodded.  `It's no
+use speaking to it,' she thought, `till its ears have come, or at
+least one of them.'  In another minute the whole head appeared,
+and then Alice put down her flamingo, and began an account of the
+game, feeling very glad she had someone to listen to her.  The
+Cat seemed to think that there was enough of it now in sight, and
+no more of it appeared.
+
+  `I don't think they play at all fairly,' Alice began, in rather
+a complaining tone, `and they all quarrel so dreadfully one can't
+hear oneself speak--and they don't seem to have any rules in
+particular; at least, if there are, nobody attends to them--and
+you've no idea how confusing it is all the things being alive;
+for instance, there's the arch I've got to go through next
+walking about at the other end of the ground--and I should have
+croqueted the Queen's hedgehog just now, only it ran away when it
+saw mine coming!'
+
+  `How do you like the Queen?' said the Cat in a low voice.
+
+  `Not at all,' said Alice:  `she's so extremely--'  Just then
+she noticed that the Queen was close behind her, listening:  so
+she went on, `--likely to win, that it's hardly worth while
+finishing the game.'
+
+  The Queen smiled and passed on.
+
+  `Who ARE you talking to?' said the King, going up to Alice, and
+looking at the Cat's head with great curiosity.
+
+  `It's a friend of mine--a Cheshire Cat,' said Alice:  `allow me
+to introduce it.'
+
+  `I don't like the look of it at all,' said the King:
+`however, it may kiss my hand if it likes.'
+
+  `I'd rather not,' the Cat remarked.
+
+  `Don't be impertinent,' said the King, `and don't look at me
+like that!'  He got behind Alice as he spoke.
+
+  `A cat may look at a king,' said Alice.  `I've read that in
+some book, but I don't remember where.'
+
+  `Well, it must be removed,' said the King very decidedly, and
+he called the Queen, who was passing at the moment, `My dear!  I
+wish you would have this cat removed!'
+
+  The Queen had only one way of settling all difficulties, great
+or small.  `Off with his head!' she said, without even looking
+round.
+
+  `I'll fetch the executioner myself,' said the King eagerly, and
+he hurried off.
+
+  Alice thought she might as well go back, and see how the game
+was going on, as she heard the Queen's voice in the distance,
+screaming with passion.  She had already heard her sentence three
+of the players to be executed for having missed their turns, and
+she did not like the look of things at all, as the game was in
+such confusion that she never knew whether it was her turn or
+not.  So she went in search of her hedgehog.
+
+  The hedgehog was engaged in a fight with another hedgehog,
+which seemed to Alice an excellent opportunity for croqueting one
+of them with the other:  the only difficulty was, that her
+flamingo was gone across to the other side of the garden, where
+Alice could see it trying in a helpless sort of way to fly up
+into a tree.
+
+  By the time she had caught the flamingo and brought it back,
+the fight was over, and both the hedgehogs were out of sight:
+`but it doesn't matter much,' thought Alice, `as all the arches
+are gone from this side of the ground.'  So she tucked it away
+under her arm, that it might not escape again, and went back for
+a little more conversation with her friend.
+
+  When she got back to the Cheshire Cat, she was surprised to
+find quite a large crowd collected round it:  there was a dispute
+going on between the executioner, the King, and the Queen, who
+were all talking at once, while all the rest were quite silent,
+and looked very uncomfortable.
+
+  The moment Alice appeared, she was appealed to by all three to
+settle the question, and they repeated their arguments to her,
+though, as they all spoke at once, she found it very hard indeed
+to make out exactly what they said.
+
+  The executioner's argument was, that you couldn't cut off a
+head unless there was a body to cut it off from:  that he had
+never had to do such a thing before, and he wasn't going to begin
+at HIS time of life.
+
+  The King's argument was, that anything that had a head could be
+beheaded, and that you weren't to talk nonsense.
+
+  The Queen's argument was, that if something wasn't done about
+it in less than no time she'd have everybody executed, all round.
+(It was this last remark that had made the whole party look so
+grave and anxious.)
+
+  Alice could think of nothing else to say but `It belongs to the
+Duchess:  you'd better ask HER about it.'
+
+  `She's in prison,' the Queen said to the executioner:  `fetch
+her here.'  And the executioner went off like an arrow.
+
+   The Cat's head began fading away the moment he was gone, and,
+by the time he had come back with the Dutchess, it had entirely
+disappeared; so the King and the executioner ran wildly up and down
+looking for it, while the rest of the party went back to the game.
+
+
+
+                           CHAPTER IX
+
+                     The Mock Turtle's Story
+
+
+  `You can't think how glad I am to see you again, you dear old
+thing!' said the Duchess, as she tucked her arm affectionately
+into Alice's, and they walked off together.
+
+  Alice was very glad to find her in such a pleasant temper, and
+thought to herself that perhaps it was only the pepper that had
+made her so savage when they met in the kitchen.
+
+  `When I'M a Duchess,' she said to herself, (not in a very
+hopeful tone though), `I won't have any pepper in my kitchen AT
+ALL.  Soup does very well without--Maybe it's always pepper that
+makes people hot-tempered,' she went on, very much pleased at
+having found out a new kind of rule, `and vinegar that makes them
+sour--and camomile that makes them bitter--and--and barley-sugar
+and such things that make children sweet-tempered.  I only wish
+people knew that:  then they wouldn't be so stingy about it, you
+know--'
+
+  She had quite forgotten the Duchess by this time, and was a
+little startled when she heard her voice close to her ear.
+`You're thinking about something, my dear, and that makes you
+forget to talk.  I can't tell you just now what the moral of that
+is, but I shall remember it in a bit.'
+
+  `Perhaps it hasn't one,' Alice ventured to remark.
+
+  `Tut, tut, child!' said the Duchess.  `Everything's got a
+moral, if only you can find it.'  And she squeezed herself up
+closer to Alice's side as she spoke.
+
+  Alice did not much like keeping so close to her:  first,
+because the Duchess was VERY ugly; and secondly, because she was
+exactly the right height to rest her chin upon Alice's shoulder,
+and it was an uncomfortably sharp chin.  However, she did not
+like to be rude, so she bore it as well as she could.
+
+  `The game's going on rather better now,' she said, by way of
+keeping up the conversation a little.
+
+  `'Tis so,' said the Duchess:  `and the moral of that is--"Oh,
+'tis love, 'tis love, that makes the world go round!"'
+
+  `Somebody said,' Alice whispered, `that it's done by everybody
+minding their own business!'
+
+  `Ah, well!  It means much the same thing,' said the Duchess,
+digging her sharp little chin into Alice's shoulder as she added,
+`and the moral of THAT is--"Take care of the sense, and the
+sounds will take care of themselves."'
+
+  `How fond she is of finding morals in things!' Alice thought to
+herself.
+
+  `I dare say you're wondering why I don't put my arm round your
+waist,' the Duchess said after a pause:  `the reason is, that I'm
+doubtful about the temper of your flamingo.  Shall I try the
+experiment?'
+
+  `HE might bite,' Alice cautiously replied, not feeling at all
+anxious to have the experiment tried.
+
+  `Very true,' said the Duchess:  `flamingoes and mustard both
+bite.  And the moral of that is--"Birds of a feather flock
+together."'
+
+  `Only mustard isn't a bird,' Alice remarked.
+
+  `Right, as usual,' said the Duchess:  `what a clear way you
+have of putting things!'
+
+  `It's a mineral, I THINK,' said Alice.
+
+  `Of course it is,' said the Duchess, who seemed ready to agree
+to everything that Alice said; `there's a large mustard-mine near
+here.  And the moral of that is--"The more there is of mine, the
+less there is of yours."'
+
+  `Oh, I know!' exclaimed Alice, who had not attended to this
+last remark, `it's a vegetable.  It doesn't look like one, but it
+is.'
+
+  `I quite agree with you,' said the Duchess; `and the moral of
+that is--"Be what you would seem to be"--or if you'd like it put
+more simply--"Never imagine yourself not to be otherwise than
+what it might appear to others that what you were or might have
+been was not otherwise than what you had been would have appeared
+to them to be otherwise."'
+
+  `I think I should understand that better,' Alice said very
+politely, `if I had it written down:  but I can't quite follow it
+as you say it.'
+
+  `That's nothing to what I could say if I chose,' the Duchess
+replied, in a pleased tone.
+
+  `Pray don't trouble yourself to say it any longer than that,'
+said Alice.
+
+  `Oh, don't talk about trouble!' said the Duchess.  `I make you
+a present of everything I've said as yet.'
+
+  `A cheap sort of present!' thought Alice.  `I'm glad they don't
+give birthday presents like that!'  But she did not venture to
+say it out loud.
+
+  `Thinking again?' the Duchess asked, with another dig of her
+sharp little chin.
+
+  `I've a right to think,' said Alice sharply, for she was
+beginning to feel a little worried.
+
+  `Just about as much right,' said the Duchess, `as pigs have to fly;
+and the m--'
+
+  But here, to Alice's great surprise, the Duchess's voice died
+away, even in the middle of her favourite word `moral,' and the
+arm that was linked into hers began to tremble.  Alice looked up,
+and there stood the Queen in front of them, with her arms folded,
+frowning like a thunderstorm.
+
+  `A fine day, your Majesty!' the Duchess began in a low, weak
+voice.
+
+  `Now, I give you fair warning,' shouted the Queen, stamping on
+the ground as she spoke; `either you or your head must be off,
+and that in about half no time!  Take your choice!'
+
+  The Duchess took her choice, and was gone in a moment.
+
+  `Let's go on with the game,' the Queen said to Alice; and Alice
+was too much frightened to say a word, but slowly followed her
+back to the croquet-ground.
+
+  The other guests had taken advantage of the Queen's absence,
+and were resting in the shade:  however, the moment they saw her,
+they hurried back to the game, the Queen merely remarking that a
+moment's delay would cost them their lives.
+
+  All the time they were playing the Queen never left off
+quarrelling with the other players, and shouting `Off with his
+head!' or `Off with her head!'  Those whom she sentenced were
+taken into custody by the soldiers, who of course had to leave
+off being arches to do this, so that by the end of half an hour
+or so there were no arches left, and all the players, except the
+King, the Queen, and Alice, were in custody and under sentence of
+execution.
+
+  Then the Queen left off, quite out of breath, and said to
+Alice, `Have you seen the Mock Turtle yet?'
+
+  `No,' said Alice.  `I don't even know what a Mock Turtle is.'
+
+  `It's the thing Mock Turtle Soup is made from,' said the Queen.
+
+  `I never saw one, or heard of one,' said Alice.
+
+  `Come on, then,' said the Queen, `and he shall tell you his
+history,'
+
+  As they walked off together, Alice heard the King say in a low
+voice, to the company generally, `You are all pardoned.'  `Come,
+THAT'S a good thing!' she said to herself, for she had felt quite
+unhappy at the number of executions the Queen had ordered.
+
+  They very soon came upon a Gryphon, lying fast asleep in the
+sun.  (IF you don't know what a Gryphon is, look at the picture.)
+`Up, lazy thing!' said the Queen, `and take this young lady to
+see the Mock Turtle, and to hear his history.  I must go back and
+see after some executions I have ordered'; and she walked off,
+leaving Alice alone with the Gryphon.  Alice did not quite like
+the look of the creature, but on the whole she thought it would
+be quite as safe to stay with it as to go after that savage
+Queen:  so she waited.
+
+  The Gryphon sat up and rubbed its eyes:  then it watched the
+Queen till she was out of sight:  then it chuckled.  `What fun!'
+said the Gryphon, half to itself, half to Alice.
+
+  `What IS the fun?' said Alice.
+
+  `Why, SHE,' said the Gryphon.  `It's all her fancy, that:  they
+never executes nobody, you know.  Come on!'
+
+  `Everybody says "come on!" here,' thought Alice, as she went
+slowly after it:  `I never was so ordered about in all my life,
+never!'
+
+  They had not gone far before they saw the Mock Turtle in the
+distance, sitting sad and lonely on a little ledge of rock, and,
+as they came nearer, Alice could hear him sighing as if his heart
+would break.  She pitied him deeply.  `What is his sorrow?' she
+asked the Gryphon, and the Gryphon answered, very nearly in the
+same words as before, `It's all his fancy, that:  he hasn't got
+no sorrow, you know.  Come on!'
+
+  So they went up to the Mock Turtle, who looked at them with
+large eyes full of tears, but said nothing.
+
+  `This here young lady,' said the Gryphon, `she wants for to
+know your history, she do.'
+
+  `I'll tell it her,' said the Mock Turtle in a deep, hollow
+tone:  `sit down, both of you, and don't speak a word till I've
+finished.'
+
+  So they sat down, and nobody spoke for some minutes.  Alice
+thought to herself, `I don't see how he can EVEN finish, if he
+doesn't begin.'  But she waited patiently.
+
+  `Once,' said the Mock Turtle at last, with a deep sigh, `I was
+a real Turtle.'
+
+  These words were followed by a very long silence, broken only
+by an occasional exclamation of `Hjckrrh!' from the Gryphon, and
+the constant heavy sobbing of the Mock Turtle.  Alice was very
+nearly getting up and saying, `Thank you, sir, for your
+interesting story,' but she could not help thinking there MUST be
+more to come, so she sat still and said nothing.
+
+  `When we were little,' the Mock Turtle went on at last, more
+calmly, though still sobbing a little now and then, `we went to
+school in the sea.  The master was an old Turtle--we used to call
+him Tortoise--'
+
+  `Why did you call him Tortoise, if he wasn't one?' Alice asked.
+
+  `We called him Tortoise because he taught us,' said the Mock
+Turtle angrily:  `really you are very dull!'
+
+  `You ought to be ashamed of yourself for asking such a simple
+question,' added the Gryphon; and then they both sat silent and
+looked at poor Alice, who felt ready to sink into the earth.  At
+last the Gryphon said to the Mock Turtle, `Drive on, old fellow!
+Don't be all day about it!' and he went on in these words:
+
+  `Yes, we went to school in the sea, though you mayn't believe
+it--'
+
+  `I never said I didn't!' interrupted Alice.
+
+  `You did,' said the Mock Turtle.
+
+  `Hold your tongue!' added the Gryphon, before Alice could speak
+again.  The Mock Turtle went on.
+
+  `We had the best of educations--in fact, we went to school
+every day--'
+
+  `I'VE been to a day-school, too,' said Alice; `you needn't be
+so proud as all that.'
+
+  `With extras?' asked the Mock Turtle a little anxiously.
+
+  `Yes,' said Alice, `we learned French and music.'
+
+  `And washing?' said the Mock Turtle.
+
+  `Certainly not!' said Alice indignantly.
+
+  `Ah! then yours wasn't a really good school,' said the Mock
+Turtle in a tone of great relief.  `Now at OURS they had at the
+end of the bill, "French, music, AND WASHING--extra."'
+
+  `You couldn't have wanted it much,' said Alice; `living at the
+bottom of the sea.'
+
+  `I couldn't afford to learn it.' said the Mock Turtle with a
+sigh.  `I only took the regular course.'
+
+  `What was that?' inquired Alice.
+
+  `Reeling and Writhing, of course, to begin with,' the Mock
+Turtle replied; `and then the different branches of Arithmetic--
+Ambition, Distraction, Uglification, and Derision.'
+
+  `I never heard of "Uglification,"' Alice ventured to say.  `What is it?'
+
+  The Gryphon lifted up both its paws in surprise.  `What!  Never
+heard of uglifying!' it exclaimed.  `You know what to beautify is,
+I suppose?'
+
+  `Yes,' said Alice doubtfully:  `it means--to--make--anything--prettier.'
+
+  `Well, then,' the Gryphon went on, `if you don't know what to
+uglify is, you ARE a simpleton.'
+
+  Alice did not feel encouraged to ask any more questions about
+it, so she turned to the Mock Turtle, and said `What else had you
+to learn?'
+
+  `Well, there was Mystery,' the Mock Turtle replied, counting
+off the subjects on his flappers, `--Mystery, ancient and modern,
+with Seaography:  then Drawling--the Drawling-master was an old
+conger-eel, that used to come once a week:  HE taught us
+Drawling, Stretching, and Fainting in Coils.'
+
+  `What was THAT like?' said Alice.
+
+  `Well, I can't show it you myself,' the Mock Turtle said:  `I'm
+too stiff.  And the Gryphon never learnt it.'
+
+  `Hadn't time,' said the Gryphon:  `I went to the Classics
+master, though.  He was an old crab, HE was.'
+
+  `I never went to him,' the Mock Turtle said with a sigh:  `he
+taught Laughing and Grief, they used to say.'
+
+  `So he did, so he did,' said the Gryphon, sighing in his turn;
+and both creatures hid their faces in their paws.
+
+  `And how many hours a day did you do lessons?' said Alice, in a
+hurry to change the subject.
+
+  `Ten hours the first day,' said the Mock Turtle: `nine the
+next, and so on.'
+
+  `What a curious plan!' exclaimed Alice.
+
+  `That's the reason they're called lessons,' the Gryphon
+remarked:  `because they lessen from day to day.'
+
+  This was quite a new idea to Alice, and she thought it over a
+little before she made her next remark.  `Then the eleventh day
+must have been a holiday?'
+
+  `Of course it was,' said the Mock Turtle.
+
+  `And how did you manage on the twelfth?' Alice went on eagerly.
+
+  `That's enough about lessons,' the Gryphon interrupted in a
+very decided tone:  `tell her something about the games now.'
+
+
+
+                            CHAPTER X
+
+                      The Lobster Quadrille
+
+
+  The Mock Turtle sighed deeply, and drew the back of one flapper
+across his eyes.  He looked at Alice, and tried to speak, but for
+a minute or two sobs choked his voice.  `Same as if he had a bone
+in his throat,' said the Gryphon:  and it set to work shaking him
+and punching him in the back.  At last the Mock Turtle recovered
+his voice, and, with tears running down his cheeks, he went on
+again:--
+
+  `You may not have lived much under the sea--' (`I haven't,' said Alice)--
+`and perhaps you were never even introduced to a lobster--'
+(Alice began to say `I once tasted--' but checked herself hastily,
+and said `No, never') `--so you can have no idea what a delightful
+thing a Lobster Quadrille is!'
+
+  `No, indeed,' said Alice.  `What sort of a dance is it?'
+
+  `Why,' said the Gryphon, `you first form into a line along the sea-shore--'
+
+  `Two lines!' cried the Mock Turtle.  `Seals, turtles, salmon, and so on;
+then, when you've cleared all the jelly-fish out of the way--'
+
+  `THAT generally takes some time,' interrupted the Gryphon.
+
+  `--you advance twice--'
+
+  `Each with a lobster as a partner!' cried the Gryphon.
+
+  `Of course,' the Mock Turtle said:  `advance twice, set to
+partners--'
+
+  `--change lobsters, and retire in same order,' continued the
+Gryphon.
+
+  `Then, you know,' the Mock Turtle went on, `you throw the--'
+
+  `The lobsters!' shouted the Gryphon, with a bound into the air.
+
+  `--as far out to sea as you can--'
+
+  `Swim after them!' screamed the Gryphon.
+
+  `Turn a somersault in the sea!' cried the Mock Turtle,
+capering wildly about.
+
+  `Change lobsters again!' yelled the Gryphon at the top of its voice.
+
+  `Back to land again, and that's all the first figure,' said the
+Mock Turtle, suddenly dropping his voice; and the two creatures,
+who had been jumping about like mad things all this time, sat
+down again very sadly and quietly, and looked at Alice.
+
+  `It must be a very pretty dance,' said Alice timidly.
+
+  `Would you like to see a little of it?' said the Mock Turtle.
+
+  `Very much indeed,' said Alice.
+
+  `Come, let's try the first figure!' said the Mock Turtle to the
+Gryphon.  `We can do without lobsters, you know.  Which shall
+sing?'
+
+  `Oh, YOU sing,' said the Gryphon.  `I've forgotten the words.'
+
+  So they began solemnly dancing round and round Alice, every now
+and then treading on her toes when they passed too close, and
+waving their forepaws to mark the time, while the Mock Turtle
+sang this, very slowly and sadly:--
+
+
+`"Will you walk a little faster?" said a whiting to a snail.
+"There's a porpoise close behind us, and he's treading on my
+ tail.
+See how eagerly the lobsters and the turtles all advance!
+They are waiting on the shingle--will you come and join the
+dance?
+
+Will you, won't you, will you, won't you, will you join the
+dance?
+Will you, won't you, will you, won't you, won't you join the
+dance?
+
+
+"You can really have no notion how delightful it will be
+When they take us up and throw us, with the lobsters, out to
+                                                      sea!"
+But the snail replied "Too far, too far!" and gave a look
+                                                       askance--
+Said he thanked the whiting kindly, but he would not join the
+   dance.
+    Would not, could not, would not, could not, would not join
+        the dance.
+    Would not, could not, would not, could not, could not join
+        the dance.
+
+`"What matters it how far we go?" his scaly friend replied.
+"There is another shore, you know, upon the other side.
+The further off from England the nearer is to France--
+Then turn not pale, beloved snail, but come and join the dance.
+
+    Will you, won't you, will you, won't you, will you join the
+         dance?
+    Will you, won't you, will you, won't you, won't you join the
+         dance?"'
+
+
+
+  `Thank you, it's a very interesting dance to watch,' said
+Alice, feeling very glad that it was over at last:  `and I do so
+like that curious song about the whiting!'
+
+  `Oh, as to the whiting,' said the Mock Turtle, `they--you've
+seen them, of course?'
+
+  `Yes,' said Alice, `I've often seen them at dinn--' she
+checked herself hastily.
+
+  `I don't know where Dinn may be,' said the Mock Turtle, `but
+if you've seen them so often, of course you know what they're
+like.'
+
+  `I believe so,' Alice replied thoughtfully.  `They have their
+tails in their mouths--and they're all over crumbs.'
+
+  `You're wrong about the crumbs,' said the Mock Turtle:
+`crumbs would all wash off in the sea.  But they HAVE their tails
+in their mouths; and the reason is--' here the Mock Turtle
+yawned and shut his eyes.--`Tell her about the reason and all
+that,' he said to the Gryphon.
+
+  `The reason is,' said the Gryphon, `that they WOULD go with
+the lobsters to the dance.  So they got thrown out to sea.  So
+they had to fall a long way.  So they got their tails fast in
+their mouths.  So they couldn't get them out again.  That's all.'
+
+  `Thank you,' said Alice, `it's very interesting.  I never knew
+so much about a whiting before.'
+
+  `I can tell you more than that, if you like,' said the
+Gryphon.  `Do you know why it's called a whiting?'
+
+  `I never thought about it,' said Alice.  `Why?'
+
+  `IT DOES THE BOOTS AND SHOES.' the Gryphon replied very
+solemnly.
+
+  Alice was thoroughly puzzled.  `Does the boots and shoes!' she
+repeated in a wondering tone.
+
+  `Why, what are YOUR shoes done with?' said the Gryphon.  `I
+mean, what makes them so shiny?'
+
+  Alice looked down at them, and considered a little before she
+gave her answer.  `They're done with blacking, I believe.'
+
+  `Boots and shoes under the sea,' the Gryphon went on in a deep
+voice, `are done with a whiting.  Now you know.'
+
+  `And what are they made of?' Alice asked in a tone of great
+curiosity.
+
+  `Soles and eels, of course,' the Gryphon replied rather
+impatiently:  `any shrimp could have told you that.'
+
+  `If I'd been the whiting,' said Alice, whose thoughts were
+still running on the song, `I'd have said to the porpoise, "Keep
+back, please:  we don't want YOU with us!"'
+
+  `They were obliged to have him with them,' the Mock Turtle
+said:  `no wise fish would go anywhere without a porpoise.'
+
+  `Wouldn't it really?' said Alice in a tone of great surprise.
+
+  `Of course not,' said the Mock Turtle:  `why, if a fish came
+to ME, and told me he was going a journey, I should say "With
+what porpoise?"'
+
+  `Don't you mean "purpose"?' said Alice.
+
+  `I mean what I say,' the Mock Turtle replied in an offended
+tone.  And the Gryphon added `Come, let's hear some of YOUR
+adventures.'
+
+  `I could tell you my adventures--beginning from this morning,'
+said Alice a little timidly:  `but it's no use going back to
+yesterday, because I was a different person then.'
+
+  `Explain all that,' said the Mock Turtle.
+
+  `No, no!  The adventures first,' said the Gryphon in an
+impatient tone:  `explanations take such a dreadful time.'
+
+  So Alice began telling them her adventures from the time when
+she first saw the White Rabbit.  She was a little nervous about
+it just at first, the two creatures got so close to her, one on
+each side, and opened their eyes and mouths so VERY wide, but she
+gained courage as she went on.  Her listeners were perfectly
+quiet till she got to the part about her repeating `YOU ARE OLD,
+FATHER WILLIAM,' to the Caterpillar, and the words all coming
+different, and then the Mock Turtle drew a long breath, and said
+`That's very curious.'
+
+  `It's all about as curious as it can be,' said the Gryphon.
+
+  `It all came different!' the Mock Turtle repeated
+thoughtfully.  `I should like to hear her try and repeat
+something now.  Tell her to begin.'  He looked at the Gryphon as
+if he thought it had some kind of authority over Alice.
+
+  `Stand up and repeat "'TIS THE VOICE OF THE SLUGGARD,"' said
+the Gryphon.
+
+  `How the creatures order one about, and make one repeat
+lessons!' thought Alice; `I might as well be at school at once.'
+However, she got up, and began to repeat it, but her head was so
+full of the Lobster Quadrille, that she hardly knew what she was
+saying, and the words came very queer indeed:--
+
+    `'Tis the voice of the Lobster; I heard him declare,
+    "You have baked me too brown, I must sugar my hair."
+    As a duck with its eyelids, so he with his nose
+    Trims his belt and his buttons, and turns out his toes.'
+
+              [later editions continued as follows
+    When the sands are all dry, he is gay as a lark,
+    And will talk in contemptuous tones of the Shark,
+    But, when the tide rises and sharks are around,
+    His voice has a timid and tremulous sound.]
+
+  `That's different from what I used to say when I was a child,'
+said the Gryphon.
+
+  `Well, I never heard it before,' said the Mock Turtle; `but it
+sounds uncommon nonsense.'
+
+  Alice said nothing; she had sat down with her face in her
+hands, wondering if anything would EVER happen in a natural way
+again.
+
+  `I should like to have it explained,' said the Mock Turtle.
+
+  `She can't explain it,' said the Gryphon hastily.  `Go on with
+the next verse.'
+
+  `But about his toes?' the Mock Turtle persisted.  `How COULD
+he turn them out with his nose, you know?'
+
+  `It's the first position in dancing.' Alice said; but was
+dreadfully puzzled by the whole thing, and longed to change the
+subject.
+
+  `Go on with the next verse,' the Gryphon repeated impatiently:
+`it begins "I passed by his garden."'
+
+  Alice did not dare to disobey, though she felt sure it would
+all come wrong, and she went on in a trembling voice:--
+
+    `I passed by his garden, and marked, with one eye,
+    How the Owl and the Panther were sharing a pie--'
+
+        [later editions continued as follows
+    The Panther took pie-crust, and gravy, and meat,
+    While the Owl had the dish as its share of the treat.
+    When the pie was all finished, the Owl, as a boon,
+    Was kindly permitted to pocket the spoon:
+    While the Panther received knife and fork with a growl,
+    And concluded the banquet--]
+
+  `What IS the use of repeating all that stuff,' the Mock Turtle
+interrupted, `if you don't explain it as you go on?  It's by far
+the most confusing thing I ever heard!'
+
+  `Yes, I think you'd better leave off,' said the Gryphon:  and
+Alice was only too glad to do so.
+
+  `Shall we try another figure of the Lobster Quadrille?' the
+Gryphon went on.  `Or would you like the Mock Turtle to sing you
+a song?'
+
+  `Oh, a song, please, if the Mock Turtle would be so kind,'
+Alice replied, so eagerly that the Gryphon said, in a rather
+offended tone, `Hm!  No accounting for tastes!  Sing her
+"Turtle Soup," will you, old fellow?'
+
+  The Mock Turtle sighed deeply, and began, in a voice sometimes
+choked with sobs, to sing this:--
+
+
+    `Beautiful Soup, so rich and green,
+    Waiting in a hot tureen!
+    Who for such dainties would not stoop?
+    Soup of the evening, beautiful Soup!
+    Soup of the evening, beautiful Soup!
+        Beau--ootiful Soo--oop!
+        Beau--ootiful Soo--oop!
+    Soo--oop of the e--e--evening,
+        Beautiful, beautiful Soup!
+
+    `Beautiful Soup!  Who cares for fish,
+    Game, or any other dish?
+    Who would not give all else for two
+    Pennyworth only of beautiful Soup?
+    Pennyworth only of beautiful Soup?
+        Beau--ootiful Soo--oop!
+        Beau--ootiful Soo--oop!
+    Soo--oop of the e--e--evening,
+        Beautiful, beauti--FUL SOUP!'
+
+  `Chorus again!' cried the Gryphon, and the Mock Turtle had
+just begun to repeat it, when a cry of `The trial's beginning!'
+was heard in the distance.
+
+  `Come on!' cried the Gryphon, and, taking Alice by the hand,
+it hurried off, without waiting for the end of the song.
+
+  `What trial is it?' Alice panted as she ran; but the Gryphon
+only answered `Come on!' and ran the faster, while more and more
+faintly came, carried on the breeze that followed them, the
+melancholy words:--
+
+    `Soo--oop of the e--e--evening,
+        Beautiful, beautiful Soup!'
+
+
+
+                           CHAPTER XI
+
+                      Who Stole the Tarts?
+
+
+  The King and Queen of Hearts were seated on their throne when
+they arrived, with a great crowd assembled about them--all sorts
+of little birds and beasts, as well as the whole pack of cards:
+the Knave was standing before them, in chains, with a soldier on
+each side to guard him; and near the King was the White Rabbit,
+with a trumpet in one hand, and a scroll of parchment in the
+other.  In the very middle of the court was a table, with a large
+dish of tarts upon it:  they looked so good, that it made Alice
+quite hungry to look at them--`I wish they'd get the trial done,'
+she thought, `and hand round the refreshments!'  But there seemed
+to be no chance of this, so she began looking at everything about
+her, to pass away the time.
+
+  Alice had never been in a court of justice before, but she had
+read about them in books, and she was quite pleased to find that
+she knew the name of nearly everything there.  `That's the
+judge,' she said to herself, `because of his great wig.'
+
+  The judge, by the way, was the King; and as he wore his crown
+over the wig, (look at the frontispiece if you want to see how he
+did it,) he did not look at all comfortable, and it was certainly
+not becoming.
+
+  `And that's the jury-box,' thought Alice, `and those twelve
+creatures,' (she was obliged to say `creatures,' you see, because
+some of them were animals, and some were birds,) `I suppose they
+are the jurors.'  She said this last word two or three times over
+to herself, being rather proud of it:  for she thought, and
+rightly too, that very few little girls of her age knew the
+meaning of it at all.  However, `jury-men' would have done just
+as well.
+
+  The twelve jurors were all writing very busily on slates.
+`What are they doing?'  Alice whispered to the Gryphon.  `They
+can't have anything to put down yet, before the trial's begun.'
+
+  `They're putting down their names,' the Gryphon whispered in
+reply, `for fear they should forget them before the end of the
+trial.'
+
+  `Stupid things!' Alice began in a loud, indignant voice, but
+she stopped hastily, for the White Rabbit cried out, `Silence in
+the court!' and the King put on his spectacles and looked
+anxiously round, to make out who was talking.
+
+  Alice could see, as well as if she were looking over their
+shoulders, that all the jurors were writing down `stupid things!'
+on their slates, and she could even make out that one of them
+didn't know how to spell `stupid,' and that he had to ask his
+neighbour to tell him.  `A nice muddle their slates'll be in
+before the trial's over!' thought Alice.
+
+  One of the jurors had a pencil that squeaked.  This of course,
+Alice could not stand, and she went round the court and got
+behind him, and very soon found an opportunity of taking it
+away.  She did it so quickly that the poor little juror (it was
+Bill, the Lizard) could not make out at all what had become of
+it; so, after hunting all about for it, he was obliged to write
+with one finger for the rest of the day; and this was of very
+little use, as it left no mark on the slate.
+
+  `Herald, read the accusation!' said the King.
+
+  On this the White Rabbit blew three blasts on the trumpet, and
+then unrolled the parchment scroll, and read as follows:--
+
+    `The Queen of Hearts, she made some tarts,
+          All on a summer day:
+      The Knave of Hearts, he stole those tarts,
+          And took them quite away!'
+
+  `Consider your verdict,' the King said to the jury.
+
+  `Not yet, not yet!' the Rabbit hastily interrupted.  `There's
+a great deal to come before that!'
+
+  `Call the first witness,' said the King; and the White Rabbit
+blew three blasts on the trumpet, and called out, `First
+witness!'
+
+  The first witness was the Hatter.  He came in with a teacup in
+one hand and a piece of bread-and-butter in the other.  `I beg
+pardon, your Majesty,' he began, `for bringing these in:  but I
+hadn't quite finished my tea when I was sent for.'
+
+  `You ought to have finished,' said the King.  `When did you
+begin?'
+
+  The Hatter looked at the March Hare, who had followed him into
+the court, arm-in-arm with the Dormouse.  `Fourteenth of March, I
+think it was,' he said.
+
+  `Fifteenth,' said the March Hare.
+
+  `Sixteenth,' added the Dormouse.
+
+  `Write that down,' the King said to the jury, and the jury
+eagerly wrote down all three dates on their slates, and then
+added them up, and reduced the answer to shillings and pence.
+
+  `Take off your hat,' the King said to the Hatter.
+
+  `It isn't mine,' said the Hatter.
+
+  `Stolen!' the King exclaimed, turning to the jury, who
+instantly made a memorandum of the fact.
+
+  `I keep them to sell,' the Hatter added as an explanation;
+`I've none of my own.  I'm a hatter.'
+
+  Here the Queen put on her spectacles, and began staring at the
+Hatter, who turned pale and fidgeted.
+
+  `Give your evidence,' said the King; `and don't be nervous, or
+I'll have you executed on the spot.'
+
+  This did not seem to encourage the witness at all:  he kept
+shifting from one foot to the other, looking uneasily at the
+Queen, and in his confusion he bit a large piece out of his
+teacup instead of the bread-and-butter.
+
+  Just at this moment Alice felt a very curious sensation, which
+puzzled her a good deal until she made out what it was:  she was
+beginning to grow larger again, and she thought at first she
+would get up and leave the court; but on second thoughts she
+decided to remain where she was as long as there was room for
+her.
+
+  `I wish you wouldn't squeeze so.' said the Dormouse, who was
+sitting next to her.  `I can hardly breathe.'
+
+  `I can't help it,' said Alice very meekly:  `I'm growing.'
+
+  `You've no right to grow here,' said the Dormouse.
+
+  `Don't talk nonsense,' said Alice more boldly:  `you know
+you're growing too.'
+
+  `Yes, but I grow at a reasonable pace,' said the Dormouse:
+`not in that ridiculous fashion.'  And he got up very sulkily
+and crossed over to the other side of the court.
+
+  All this time the Queen had never left off staring at the
+Hatter, and, just as the Dormouse crossed the court, she said to
+one of the officers of the court, `Bring me the list of the
+singers in the last concert!' on which the wretched Hatter
+trembled so, that he shook both his shoes off.
+
+  `Give your evidence,' the King repeated angrily, `or I'll have
+you executed, whether you're nervous or not.'
+
+  `I'm a poor man, your Majesty,' the Hatter began, in a
+trembling voice, `--and I hadn't begun my tea--not above a week
+or so--and what with the bread-and-butter getting so thin--and
+the twinkling of the tea--'
+
+  `The twinkling of the what?' said the King.
+
+  `It began with the tea,' the Hatter replied.
+
+  `Of course twinkling begins with a T!' said the King sharply.
+`Do you take me for a dunce?  Go on!'
+
+  `I'm a poor man,' the Hatter went on, `and most things
+twinkled after that--only the March Hare said--'
+
+  `I didn't!' the March Hare interrupted in a great hurry.
+
+  `You did!' said the Hatter.
+
+  `I deny it!' said the March Hare.
+
+  `He denies it,' said the King:  `leave out that part.'
+
+  `Well, at any rate, the Dormouse said--' the Hatter went on,
+looking anxiously round to see if he would deny it too:  but the
+Dormouse denied nothing, being fast asleep.
+
+  `After that,' continued the Hatter, `I cut some more bread-
+and-butter--'
+
+  `But what did the Dormouse say?' one of the jury asked.
+
+  `That I can't remember,' said the Hatter.
+
+  `You MUST remember,' remarked the King, `or I'll have you
+executed.'
+
+  The miserable Hatter dropped his teacup and bread-and-butter,
+and went down on one knee.  `I'm a poor man, your Majesty,' he
+began.
+
+  `You're a very poor speaker,' said the King.
+
+  Here one of the guinea-pigs cheered, and was immediately
+suppressed by the officers of the court.  (As that is rather a
+hard word, I will just explain to you how it was done.  They had
+a large canvas bag, which tied up at the mouth with strings:
+into this they slipped the guinea-pig, head first, and then sat
+upon it.)
+
+  `I'm glad I've seen that done,' thought Alice.  `I've so often
+read in the newspapers, at the end of trials, "There was some
+attempts at applause, which was immediately suppressed by the
+officers of the court," and I never understood what it meant
+till now.'
+
+  `If that's all you know about it, you may stand down,'
+continued the King.
+
+  `I can't go no lower,' said the Hatter:  `I'm on the floor, as
+it is.'
+
+  `Then you may SIT down,' the King replied.
+
+  Here the other guinea-pig cheered, and was suppressed.
+
+  `Come, that finished the guinea-pigs!' thought Alice.  `Now we
+shall get on better.'
+
+  `I'd rather finish my tea,' said the Hatter, with an anxious
+look at the Queen, who was reading the list of singers.
+
+  `You may go,' said the King, and the Hatter hurriedly left the
+court, without even waiting to put his shoes on.
+
+  `--and just take his head off outside,' the Queen added to one
+of the officers:  but the Hatter was out of sight before the
+officer could get to the door.
+
+  `Call the next witness!' said the King.
+
+  The next witness was the Duchess's cook.  She carried the
+pepper-box in her hand, and Alice guessed who it was, even before
+she got into the court, by the way the people near the door began
+sneezing all at once.
+
+  `Give your evidence,' said the King.
+
+  `Shan't,' said the cook.
+
+  The King looked anxiously at the White Rabbit, who said in a
+low voice, `Your Majesty must cross-examine THIS witness.'
+
+  `Well, if I must, I must,' the King said, with a melancholy
+air, and, after folding his arms and frowning at the cook till
+his eyes were nearly out of sight, he said in a deep voice, `What
+are tarts made of?'
+
+  `Pepper, mostly,' said the cook.
+
+  `Treacle,' said a sleepy voice behind her.
+
+  `Collar that Dormouse,' the Queen shrieked out.  `Behead that
+Dormouse!  Turn that Dormouse out of court!  Suppress him!  Pinch
+him!  Off with his whiskers!'
+
+  For some minutes the whole court was in confusion, getting the
+Dormouse turned out, and, by the time they had settled down
+again, the cook had disappeared.
+
+  `Never mind!' said the King, with an air of great relief.
+`Call the next witness.'  And he added in an undertone to the
+Queen, `Really, my dear, YOU must cross-examine the next witness.
+It quite makes my forehead ache!'
+
+  Alice watched the White Rabbit as he fumbled over the list,
+feeling very curious to see what the next witness would be like,
+`--for they haven't got much evidence YET,' she said to herself.
+Imagine her surprise, when the White Rabbit read out, at the top
+of his shrill little voice, the name `Alice!'
+
+
+
+                           CHAPTER XII
+
+                        Alice's Evidence
+
+
+  `Here!' cried Alice, quite forgetting in the flurry of the
+moment how large she had grown in the last few minutes, and she
+jumped up in such a hurry that she tipped over the jury-box with
+the edge of her skirt, upsetting all the jurymen on to the heads
+of the crowd below, and there they lay sprawling about, reminding
+her very much of a globe of goldfish she had accidentally upset
+the week before.
+
+  `Oh, I BEG your pardon!' she exclaimed in a tone of great
+dismay, and began picking them up again as quickly as she could,
+for the accident of the goldfish kept running in her head, and
+she had a vague sort of idea that they must be collected at once
+and put back into the jury-box, or they would die.
+
+  `The trial cannot proceed,' said the King in a very grave
+voice, `until all the jurymen are back in their proper places--
+ALL,' he repeated with great emphasis, looking hard at Alice as
+he said do.
+
+  Alice looked at the jury-box, and saw that, in her haste, she
+had put the Lizard in head downwards, and the poor little thing
+was waving its tail about in a melancholy way, being quite unable
+to move.  She soon got it out again, and put it right; `not that
+it signifies much,' she said to herself; `I should think it
+would be QUITE as much use in the trial one way up as the other.'
+
+  As soon as the jury had a little recovered from the shock of
+being upset, and their slates and pencils had been found and
+handed back to them, they set to work very diligently to write
+out a history of the accident, all except the Lizard, who seemed
+too much overcome to do anything but sit with its mouth open,
+gazing up into the roof of the court.
+
+  `What do you know about this business?' the King said to
+Alice.
+
+  `Nothing,' said Alice.
+
+  `Nothing WHATEVER?' persisted the King.
+
+  `Nothing whatever,' said Alice.
+
+  `That's very important,' the King said, turning to the jury.
+They were just beginning to write this down on their slates, when
+the White Rabbit interrupted:  `UNimportant, your Majesty means,
+of course,' he said in a very respectful tone, but frowning and
+making faces at him as he spoke.
+
+  `UNimportant, of course, I meant,' the King hastily said, and
+went on to himself in an undertone, `important--unimportant--
+unimportant--important--' as if he were trying which word
+sounded best.
+
+  Some of the jury wrote it down `important,' and some
+`unimportant.'  Alice could see this, as she was near enough to
+look over their slates; `but it doesn't matter a bit,' she
+thought to herself.
+
+  At this moment the King, who had been for some time busily
+writing in his note-book, cackled out `Silence!' and read out
+from his book, `Rule Forty-two.  ALL PERSONS MORE THAN A MILE
+HIGH TO LEAVE THE COURT.'
+
+  Everybody looked at Alice.
+
+  `I'M not a mile high,' said Alice.
+
+  `You are,' said the King.
+
+  `Nearly two miles high,' added the Queen.
+
+  `Well, I shan't go, at any rate,' said Alice:  `besides,
+that's not a regular rule:  you invented it just now.'
+
+  `It's the oldest rule in the book,' said the King.
+
+  `Then it ought to be Number One,' said Alice.
+
+  The King turned pale, and shut his note-book hastily.
+`Consider your verdict,' he said to the jury, in a low, trembling
+voice.
+
+  `There's more evidence to come yet, please your Majesty,' said
+the White Rabbit, jumping up in a great hurry; `this paper has
+just been picked up.'
+
+  `What's in it?' said the Queen.
+
+  `I haven't opened it yet,' said the White Rabbit, `but it seems
+to be a letter, written by the prisoner to--to somebody.'
+
+  `It must have been that,' said the King, `unless it was
+written to nobody, which isn't usual, you know.'
+
+  `Who is it directed to?' said one of the jurymen.
+
+  `It isn't directed at all,' said the White Rabbit; `in fact,
+there's nothing written on the OUTSIDE.'  He unfolded the paper
+as he spoke, and added `It isn't a letter, after all:  it's a set
+of verses.'
+
+  `Are they in the prisoner's handwriting?' asked another of
+the jurymen.
+
+  `No, they're not,' said the White Rabbit, `and that's the
+queerest thing about it.'  (The jury all looked puzzled.)
+
+  `He must have imitated somebody else's hand,' said the King.
+(The jury all brightened up again.)
+
+  `Please your Majesty,' said the Knave, `I didn't write it, and
+they can't prove I did:  there's no name signed at the end.'
+
+  `If you didn't sign it,' said the King, `that only makes the
+matter worse.  You MUST have meant some mischief, or else you'd
+have signed your name like an honest man.'
+
+  There was a general clapping of hands at this:  it was the
+first really clever thing the King had said that day.
+
+  `That PROVES his guilt,' said the Queen.
+
+  `It proves nothing of the sort!' said Alice.  `Why, you don't
+even know what they're about!'
+
+  `Read them,' said the King.
+
+  The White Rabbit put on his spectacles.  `Where shall I begin,
+please your Majesty?' he asked.
+
+  `Begin at the beginning,' the King said gravely, `and go on
+till you come to the end:  then stop.'
+
+  These were the verses the White Rabbit read:--
+
+        `They told me you had been to her,
+          And mentioned me to him:
+        She gave me a good character,
+          But said I could not swim.
+
+        He sent them word I had not gone
+          (We know it to be true):
+        If she should push the matter on,
+          What would become of you?
+
+        I gave her one, they gave him two,
+          You gave us three or more;
+        They all returned from him to you,
+          Though they were mine before.
+
+        If I or she should chance to be
+          Involved in this affair,
+        He trusts to you to set them free,
+          Exactly as we were.
+
+        My notion was that you had been
+          (Before she had this fit)
+        An obstacle that came between
+          Him, and ourselves, and it.
+
+        Don't let him know she liked them best,
+          For this must ever be
+        A secret, kept from all the rest,
+          Between yourself and me.'
+
+  `That's the most important piece of evidence we've heard yet,'
+said the King, rubbing his hands; `so now let the jury--'
+
+  `If any one of them can explain it,' said Alice, (she had
+grown so large in the last few minutes that she wasn't a bit
+afraid of interrupting him,) `I'll give him sixpence.  _I_ don't
+believe there's an atom of meaning in it.'
+
+  The jury all wrote down on their slates, `SHE doesn't believe
+there's an atom of meaning in it,' but none of them attempted to
+explain the paper.
+
+  `If there's no meaning in it,' said the King, `that saves a
+world of trouble, you know, as we needn't try to find any.  And
+yet I don't know,' he went on, spreading out the verses on his
+knee, and looking at them with one eye; `I seem to see some
+meaning in them, after all.  "--SAID I COULD NOT SWIM--" you
+can't swim, can you?' he added, turning to the Knave.
+
+  The Knave shook his head sadly.  `Do I look like it?' he said.
+(Which he certainly did NOT, being made entirely of cardboard.)
+
+  `All right, so far,' said the King, and he went on muttering
+over the verses to himself:  `"WE KNOW IT TO BE TRUE--" that's
+the jury, of course-- "I GAVE HER ONE, THEY GAVE HIM TWO--" why,
+that must be what he did with the tarts, you know--'
+
+  `But, it goes on "THEY ALL RETURNED FROM HIM TO YOU,"' said
+Alice.
+
+  `Why, there they are!' said the King triumphantly, pointing to
+the tarts on the table.  `Nothing can be clearer than THAT.
+Then again--"BEFORE SHE HAD THIS FIT--"  you never had fits, my
+dear, I think?' he said to the Queen.
+
+  `Never!' said the Queen furiously, throwing an inkstand at the
+Lizard as she spoke.  (The unfortunate little Bill had left off
+writing on his slate with one finger, as he found it made no
+mark; but he now hastily began again, using the ink, that was
+trickling down his face, as long as it lasted.)
+
+  `Then the words don't FIT you,' said the King, looking round
+the court with a smile.  There was a dead silence.
+
+  `It's a pun!' the King added in an offended tone, and
+everybody laughed, `Let the jury consider their verdict,' the
+King said, for about the twentieth time that day.
+
+  `No, no!' said the Queen.  `Sentence first--verdict afterwards.'
+
+  `Stuff and nonsense!' said Alice loudly.  `The idea of having
+the sentence first!'
+
+  `Hold your tongue!' said the Queen, turning purple.
+
+  `I won't!' said Alice.
+
+  `Off with her head!' the Queen shouted at the top of her voice.
+Nobody moved.
+
+  `Who cares for you?' said Alice, (she had grown to her full
+size by this time.)  `You're nothing but a pack of cards!'
+
+  At this the whole pack rose up into the air, and came flying
+down upon her:  she gave a little scream, half of fright and half
+of anger, and tried to beat them off, and found herself lying on
+the bank, with her head in the lap of her sister, who was gently
+brushing away some dead leaves that had fluttered down from the
+trees upon her face.
+
+  `Wake up, Alice dear!' said her sister; `Why, what a long
+sleep you've had!'
+
+  `Oh, I've had such a curious dream!' said Alice, and she told
+her sister, as well as she could remember them, all these strange
+Adventures of hers that you have just been reading about; and
+when she had finished, her sister kissed her, and said, `It WAS a
+curious dream, dear, certainly:  but now run in to your tea; it's
+getting late.'  So Alice got up and ran off, thinking while she
+ran, as well she might, what a wonderful dream it had been.
+
+  But her sister sat still just as she left her, leaning her
+head on her hand, watching the setting sun, and thinking of
+little Alice and all her wonderful Adventures, till she too began
+dreaming after a fashion, and this was her dream:--
+
+  First, she dreamed of little Alice herself, and once again the
+tiny hands were clasped upon her knee, and the bright eager eyes
+were looking up into hers--she could hear the very tones of her
+voice, and see that queer little toss of her head to keep back
+the wandering hair that WOULD always get into her eyes--and
+still as she listened, or seemed to listen, the whole place
+around her became alive the strange creatures of her little
+sister's dream.
+
+  The long grass rustled at her feet as the White Rabbit hurried
+by--the frightened Mouse splashed his way through the
+neighbouring pool--she could hear the rattle of the teacups as
+the March Hare and his friends shared their never-ending meal,
+and the shrill voice of the Queen ordering off her unfortunate
+guests to execution--once more the pig-baby was sneezing on the
+Duchess's knee, while plates and dishes crashed around it--once
+more the shriek of the Gryphon, the squeaking of the Lizard's
+slate-pencil, and the choking of the suppressed guinea-pigs,
+filled the air, mixed up with the distant sobs of the miserable
+Mock Turtle.
+
+  So she sat on, with closed eyes, and half believed herself in
+Wonderland, though she knew she had but to open them again, and
+all would change to dull reality--the grass would be only
+rustling in the wind, and the pool rippling to the waving of the
+reeds--the rattling teacups would change to tinkling sheep-
+bells, and the Queen's shrill cries to the voice of the shepherd
+boy--and the sneeze of the baby, the shriek of the Gryphon, and
+all thy other queer noises, would change (she knew) to the
+confused clamour of the busy farm-yard--while the lowing of the
+cattle in the distance would take the place of the Mock Turtle's
+heavy sobs.
+
+  Lastly, she pictured to herself how this same little sister of
+hers would, in the after-time, be herself a grown woman; and how
+she would keep, through all her riper years, the simple and
+loving heart of her childhood:  and how she would gather about
+her other little children, and make THEIR eyes bright and eager
+with many a strange tale, perhaps even with the dream of
+Wonderland of long ago:  and how she would feel with all their
+simple sorrows, and find a pleasure in all their simple joys,
+remembering her own child-life, and the happy summer days.
+
+                             THE END
+
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/cabi2.cpp b/gcc/testsuite/gdc.test/runnable/extra-files/cabi2.cpp
new file mode 100644
index 00000000000..8d7ed6786c7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/cabi2.cpp
@@ -0,0 +1,224 @@
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdint.h>
+
+#if __cplusplus
+extern "C" {
+#endif
+
+struct Foo1 { char c; };
+
+struct Foo1 ctest1()
+{
+    struct Foo1 f;
+
+    f.c = 3;
+    return f;
+}
+
+struct Foo2 { short s; };
+
+struct Foo2 ctest2()
+{
+    struct Foo2 f;
+
+    f.s = 0x1234;
+    return f;
+}
+
+struct Foo3 { char c; short s; };
+
+struct Foo3 ctest3()
+{
+    struct Foo3 f;
+
+    f.s = 0x5678;
+    return f;
+}
+
+
+struct Foo4 { int i; };
+
+struct Foo4 ctest4()
+{
+    struct Foo4 f;
+
+    f.i = 0x12345678;
+    return f;
+}
+
+struct Foo5 { int i, j; };
+
+struct Foo5 ctest5()
+{
+    struct Foo5 f;
+
+    f.i = 0x12345678;
+    f.j = 0x21436587;
+    return f;
+}
+
+
+struct Foo6 { int i, j, k; };
+
+struct Foo6 ctest6()
+{
+    struct Foo6 f;
+
+    f.i = 0x12345678;
+    f.j = 0x21463587;
+    f.k = 0x24163857;
+    return f;
+}
+
+struct S7 { float a,b; };
+
+struct S7 ctest10()
+{
+    struct S7 f;
+
+    f.a = 2.5;
+    f.b = 1.5;
+    return f;
+}
+
+// =================================
+
+char ctest7(char c)
+{
+    return c + 1;
+}
+
+unsigned char ctest8(unsigned char c)
+{
+    return c + 1;
+}
+
+signed char ctest9(signed char c)
+{
+    return c + 1;
+}
+
+/***********************************************/
+
+void ctestrir(int x1, int x2, int x3, int x4, int x5, int x6, long double a, int b, long double c)
+{
+    assert(a == 100.0);
+    assert(b == 67);
+    assert(c == 200.0);
+}
+
+/***********************************************/
+
+extern void dtestrir(int x1, int x2, int x3, int x4, int x5, int x6, long double a, int b, long double c);
+
+void test4()
+{
+    dtestrir(1,2,3,4,5,6, 300.0, 68, 401.0);
+}
+
+/**********************************************/
+
+typedef struct S11 {
+  char a;
+  char b;
+  char c;
+} S11;
+
+S11 ctest11(char x, S11 s, char y) {
+  printf("C sz = %d\n", (int)sizeof(S11));
+  assert(sizeof(S11) == 3);
+  printf("x   = %d\n", (int)x);
+  printf("s.a = %d\n", (int)s.a);
+  printf("s.b = %d\n", (int)s.b);
+  printf("s.c = %d\n", (int)s.c);
+  printf("y   = %d\n", (int)y);
+  return s;
+}
+
+/**********************************************/
+
+typedef struct S12 {
+  char a,d;
+  char b,e;
+  char c;
+} S12;
+
+S12 ctest12(char x, S12 s, char y) {
+  printf("C sz = %d\n", (int)sizeof(S12));
+  assert(sizeof(S12) == 5);
+  printf("x   = %d\n", (int)x);
+  printf("s.a = %d\n", (int)s.a);
+  printf("s.b = %d\n", (int)s.b);
+  printf("s.c = %d\n", (int)s.c);
+  printf("y   = %d\n", (int)y);
+  return s;
+}
+
+
+/**********************************************/
+
+typedef struct S13 {
+  short a;
+  short b;
+  short c;
+} S13;
+
+S13 ctest13(char x, S13 s, char y) {
+  printf("C sz = %d\n", (int)sizeof(S13));
+  assert(sizeof(S13) == 6);
+  printf("x   = %d\n", (int)x);
+  printf("s.a = %d\n", (int)s.a);
+  printf("s.b = %d\n", (int)s.b);
+  printf("s.c = %d\n", (int)s.c);
+  printf("y   = %d\n", (int)y);
+  return s;
+}
+
+
+/**********************************************/
+
+typedef struct S14 {
+  char a,d,e,f;
+  char b,g;
+  char c;
+} S14;
+
+S14 ctest14(char x, S14 s, char y) {
+  printf("C sz = %d\n", (int)sizeof(S14));
+  assert(sizeof(S14) == 7);
+  printf("x   = %d\n", (int)x);
+  printf("s.a = %d\n", (int)s.a);
+  printf("s.b = %d\n", (int)s.b);
+  printf("s.c = %d\n", (int)s.c);
+  printf("y   = %d\n", (int)y);
+  return s;
+}
+
+
+/**********************************************/
+
+typedef struct S15 {
+  char a,d,e,f;
+  char b,g,h,i;
+  char c;
+} S15;
+
+S15 ctest15(char x, S15 s, char y) {
+  printf("C sz = %d\n", (int)sizeof(S15));
+  assert(sizeof(S15) == 9);
+  printf("x   = %d\n", (int)x);
+  printf("s.a = %d\n", (int)s.a);
+  printf("s.b = %d\n", (int)s.b);
+  printf("s.c = %d\n", (int)s.c);
+  printf("y   = %d\n", (int)y);
+  return s;
+}
+
+
+
+#if __cplusplus
+}
+#endif
+
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/cppb.cpp b/gcc/testsuite/gdc.test/runnable/extra-files/cppb.cpp
new file mode 100644
index 00000000000..e20438fbdc4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/cppb.cpp
@@ -0,0 +1,752 @@
+/*
+GCC 5.1 introduced new implementations of std::string and std::list:
+
+https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
+
+This causes e.g. std::string to be actually defined as
+std::__cxx11::string.
+
+On machines with GCC 5.1, this manifests as a linker error when
+running the cppa.d / cppb.cpp test:
+
+cppa.o: In function `_D4cppa6test14FZv':
+cppa.d:(.text._D4cppa6test14FZv+0x11): undefined reference to `foo14a(std::string*)'
+cppa.d:(.text._D4cppa6test14FZv+0x18): undefined reference to `foo14b(std::basic_string<int, std::char_traits<int>, std::allocator<int> >*)'
+cppa.d:(.text._D4cppa6test14FZv+0x3a): undefined reference to `foo14f(std::char_traits<char>*, std::string*, std::string*)'
+cppa.o: In function `_D4cppa7testeh3FZv':
+cppa.d:(.text._D4cppa7testeh3FZv+0x19): undefined reference to `throwle()'
+collect2: error: ld returned 1 exit status
+--- errorlevel 1
+
+When the .cpp file is compiled with g++ 5.3.0, the actual function
+signatures in the cppb.o object file are:
+
+foo14a(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)
+foo14b(std::__cxx11::basic_string<int, std::char_traits<int>, std::allocator<int> >*)
+foo14f(std::char_traits<char>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)
+
+Fortunately, it is easily possible to disable the new feature
+by defining _GLIBCXX_USE_CXX11_ABI as 0 before including any standard
+headers.
+*/
+#define _GLIBCXX_USE_CXX11_ABI 0
+
+#include <stdio.h>
+#include <assert.h>
+#include <exception>
+
+/**************************************/
+
+int foo(int i, int j, int k);
+
+int foob(int i, int j, int k)
+{
+    printf("i = %d\n", i);
+    printf("j = %d\n", j);
+    printf("k = %d\n", k);
+    assert(i == 1);
+    assert(j == 2);
+    assert(k == 3);
+
+    foo(i, j, k);
+
+    return 7;
+}
+
+/**************************************/
+
+class D *dthis;
+
+class D
+{
+  public:
+    virtual int bar(int i, int j, int k)
+    {
+    printf("this = %p\n", this);
+    assert(this == dthis);
+    printf("D.bar: i = %d\n", i);
+    printf("D.bar: j = %d\n", j);
+    printf("D.bar: k = %d\n", k);
+    assert(i == 9);
+    assert(j == 10);
+    assert(k == 11);
+    return 8;
+    }
+};
+
+
+D* getD()
+{
+    D *d = new D();
+    dthis = d;
+    return d;
+}
+
+/**************************************/
+
+class E
+{
+  public:
+    virtual int bar(int i, int j, int k);
+};
+
+
+int callE(E *e)
+{
+    return e->bar(11,12,13);
+}
+
+/**************************************/
+
+void foo4(char *p)
+{
+}
+
+/**************************************/
+
+struct foo5 { int i; int j; void *p; };
+
+class bar5
+{
+public:
+  virtual foo5 getFoo(int i){
+    printf("This = %p\n", this);
+    foo5 f;
+    f.i = 1;
+    f.j = 2 + i;
+    f.p = (void*)this;
+    return f;
+  }
+};
+
+bar5* newBar()
+{
+  bar5* b = new bar5();
+  printf("bar = %p\n", b);
+  return b;
+}
+
+
+/**************************************/
+
+struct A11802;
+struct B11802;
+
+class C11802
+{
+public:
+    virtual void fun(A11802 *);
+    virtual void fun(B11802 *);
+};
+
+class D11802 : public C11802
+{
+public:
+    void fun(A11802 *);
+    void fun(B11802 *);
+};
+
+void test11802x(D11802 *c)
+{
+    c->fun((A11802 *)0);
+    c->fun((B11802 *)0);
+}
+
+/**************************************/
+
+typedef struct
+{
+    int i;
+    double d;
+} S6;
+
+union S6_2
+{
+    int i;
+    double d;
+};
+
+enum S6_3
+{
+    A, B
+};
+
+
+S6 foo6(void)
+{
+    S6 s;
+    s.i = 42;
+    s.d = 2.5;
+    return s;
+}
+
+S6_2 foo6_2(void)
+{
+    S6_2 s;
+    s.i = 42;
+    return s;
+}
+
+S6_3 foo6_3(void)
+{
+    S6_3 s = A;
+    return s;
+}
+
+extern "C" { int foosize6()
+{
+    return sizeof(S6);
+}
+}
+
+/**************************************/
+
+typedef struct
+{
+    int i;
+    long long d;
+} S7;
+
+extern "C" { int foo7()
+{
+    return sizeof(S7);
+}
+}
+
+/**************************************/
+
+struct S13955a
+{
+    float a;
+    double b;
+};
+
+struct S13955b
+{
+    double a;
+    float b;
+};
+
+struct S13955c
+{
+    float a;
+    float b;
+};
+
+struct S13955d
+{
+    double a;
+    double b;
+};
+
+void check13955(S13955a a, S13955b b, S13955c c, S13955d d);
+
+void func13955(S13955a a, S13955b b, S13955c c, S13955d d)
+{
+    check13955(a, b, c, d);
+}
+
+/**************************************/
+
+struct Struct10071
+{
+    void *p;
+    long double r;
+};
+
+size_t offset10071()
+{
+    Struct10071 s;
+    return (char *)&s.r - (char *)&s;
+}
+
+/**************************************/
+
+void foo8(const char *p)
+{
+}
+
+/**************************************/
+// 4059
+
+struct elem9 { };
+void foobar9(elem9*, elem9*) { }
+
+/**************************************/
+// 5148
+
+void foo10(const char*, const char*) { }
+void foo10(const int, const int) { }
+void foo10(const char, const char) { }
+void foo10(bool, bool) { }
+
+struct MyStructType { };
+void foo10(const MyStructType s, const MyStructType t) { }
+
+enum MyEnumType { onemember };
+void foo10(const MyEnumType s, const MyEnumType t) { }
+
+/**************************************/
+
+namespace N11 { namespace M { void bar11() { } } }
+
+namespace A11 { namespace B { namespace C { void bar() { } } } }
+
+/**************************************/
+
+void myvprintfx(const char* format, va_list);
+
+void myvprintf(const char* format, va_list va)
+{
+    myvprintfx(format, va);
+}
+
+/**************************************/
+
+class C13161
+{
+public:
+        virtual void dummyfunc() {}
+        long long val_5;
+        unsigned val_9;
+};
+
+class Test : public C13161
+{
+public:
+        unsigned val_0;
+        long long val_1;
+};
+
+size_t getoffset13161()
+{
+    Test s;
+    return (char *)&s.val_0 - (char *)&s;
+}
+
+class C13161a
+{
+public:
+        virtual void dummyfunc() {}
+        long double val_5;
+        unsigned val_9;
+};
+
+class Testa : public C13161a
+{
+public:
+        bool val_0;
+};
+
+size_t getoffset13161a()
+{
+    Testa s;
+    return (char *)&s.val_0 - (char *)&s;
+}
+
+/****************************************************/
+
+#if __linux__ || __APPLE__ || __FreeBSD__
+#include <memory>
+#include <vector>
+#include <string>
+
+#if __linux__
+template struct std::allocator<int>;
+template struct std::vector<int>;
+
+void foo15()
+{
+    std::allocator<int>* p;
+    p->deallocate(0, 0);
+}
+
+#endif
+
+// _Z5foo14PSt6vectorIiSaIiEE
+void foo14(std::vector<int, std::allocator<int> > *p) { }
+
+void foo14a(std::basic_string<char> *p) { }
+void foo14b(std::basic_string<int> *p) { }
+void foo14c(std::basic_istream<char> *p) { }
+void foo14d(std::basic_ostream<char> *p) { }
+void foo14e(std::basic_iostream<char> *p) { }
+
+void foo14f(std::char_traits<char>* x, std::basic_string<char> *p, std::basic_string<char> *q) { }
+
+#endif
+
+/**************************************/
+
+struct S13956
+{
+};
+
+void check13956(S13956 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6);
+
+void func13956(S13956 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6)
+{
+    check13956(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+}
+
+/**************************************/
+
+wchar_t f13289_cpp_wchar_t(wchar_t ch)
+{
+    if (ch <= L'z' && ch >= L'a')
+    {
+        return ch - (L'a' - L'A');
+    }
+    else
+    {
+        return ch;
+    }
+}
+
+#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
+unsigned short f13289_d_wchar(unsigned short ch);
+wchar_t f13289_d_dchar(wchar_t ch);
+#elif _WIN32
+wchar_t f13289_d_wchar(wchar_t ch);
+unsigned int f13289_d_dchar(unsigned int ch);
+#endif
+
+bool f13289_cpp_test()
+{
+#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
+    if (!(f13289_d_wchar((unsigned short)'c') == (unsigned short)'C')) return false;
+    if (!(f13289_d_wchar((unsigned short)'D') == (unsigned short)'D')) return false;
+    if (!(f13289_d_dchar(L'e') == L'E')) return false;
+    if (!(f13289_d_dchar(L'F') == L'F')) return false;
+    return true;
+#elif _WIN32
+    if (!(f13289_d_wchar(L'c') == L'C')) return false;
+    if (!(f13289_d_wchar(L'D') == L'D')) return false;
+    if (!(f13289_d_dchar((unsigned int)'e') == (unsigned int)'E')) return false;
+    if (!(f13289_d_dchar((unsigned int)'F') == (unsigned int)'F')) return false;
+    return true;
+#else
+    return false;
+#endif
+}
+
+/******************************************/
+
+long double testld(long double ld)
+{
+    assert(ld == 5);
+    return ld + 1;
+}
+
+long testl(long lng)
+{
+    assert(lng == 5);
+    return lng + sizeof(long);
+}
+
+unsigned long testul(unsigned long ul)
+{
+    assert(ul == 5);
+    return ul + sizeof(unsigned long);
+}
+
+/******************************************/
+
+struct S13707
+{
+    void* a;
+    void* b;
+    S13707(void *a, void* b)
+    {
+        this->a = a;
+        this->b = b;
+    }
+};
+
+S13707 func13707()
+{
+    S13707 pt(NULL, NULL);
+    return pt;
+}
+
+/******************************************/
+
+template <int x> struct S13932
+{
+    int member;
+};
+
+void func13932(S13932<-1> s) {}
+
+/******************************************/
+
+namespace N13337 {
+  namespace M13337 {
+    struct S13337 { };
+    void foo13337(S13337 s) { }
+  }
+}
+
+/****************************************/
+// 14195
+
+template <typename T>
+struct Delegate1 {};
+
+template <typename R1>
+struct Delegate1 < R1() > {};
+
+template <typename T1, typename T2>
+struct Delegate2 {};
+
+template < typename R1, typename T1, typename T2, typename R2, typename T3, typename T4 >
+struct Delegate2<R1(T1, T2), R2(T3, T4)> {};
+
+void test14195a(Delegate1<void()> func) {}
+
+void test14195b(Delegate2<int(float, double), int(float, double)> func) {}
+
+/******************************************/
+// 14200
+
+void test14200a(int a) {};
+void test14200b(float a, int b, double c) {};
+
+/******************************************/
+// check order of overloads in vtable
+
+class Statement;
+class ErrorStatement;
+class PeelStatement;
+class ExpStatement;
+class DtorExpStatement;
+
+class Visitor
+{
+public:
+    virtual int visit(Statement*) { return 1; }
+    virtual int visit(ErrorStatement*) { return 2; }
+    virtual int visit(PeelStatement*) { return 3; }
+};
+
+class Visitor2 : public Visitor
+{
+public:
+    virtual int visit2(ExpStatement*) { return 4; }
+    virtual int visit2(DtorExpStatement*) { return 5; }
+};
+
+bool testVtableCpp(Visitor2* sv)
+{
+    if (sv->visit((Statement*)0) != 1) return false;
+    if (sv->visit((ErrorStatement*)0) != 2) return false;
+    if (sv->visit((PeelStatement*)0) != 3) return false;
+    if (sv->visit2((ExpStatement*)0) != 4) return false;
+    if (sv->visit2((DtorExpStatement*)0) != 5) return false;
+    return true;
+}
+
+Visitor2 inst;
+
+Visitor2* getVisitor2()
+{
+    return &inst;
+}
+
+/******************************************/
+// issues detected by fuzzer
+#if _LP64
+#define longlong long
+#else
+#define longlong long long
+#endif
+
+void fuzz1_checkValues(longlong arg10, longlong arg11, bool arg12);
+void fuzz1_cppvararg(longlong arg10, longlong arg11, bool arg12)
+{
+    fuzz1_checkValues(arg10, arg11, arg12);
+}
+
+void fuzz2_checkValues(unsigned longlong arg10, unsigned longlong arg11, bool arg12);
+void fuzz2_cppvararg(unsigned longlong arg10, unsigned longlong arg11, bool arg12)
+{
+    fuzz2_checkValues(arg10, arg11, arg12);
+}
+
+#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
+#define wchar unsigned short
+#elif _WIN32
+#define wchar wchar_t
+#endif
+
+void fuzz3_checkValues(wchar arg10, wchar arg11, bool arg12);
+void fuzz3_cppvararg(wchar arg10, wchar arg11, bool arg12)
+{
+    fuzz3_checkValues(arg10, arg11, arg12);
+}
+
+/******************************************/
+
+void throwit()
+{
+#if _WIN32
+#else
+    std::exception se;
+    throw se;
+#endif
+}
+
+/******************************************/
+
+#if linux
+#include <stdexcept>
+
+void throwle()
+{
+     std::logic_error le("test");
+     throw le;
+}
+
+#endif
+
+/******************************************/
+// 15579
+
+class Base
+{
+public:
+    //virtual ~Base() {}
+    virtual void base();
+    unsigned char x;
+};
+
+class Interface
+{
+public:
+    virtual int MethodCPP() = 0;
+    virtual int MethodD() = 0;
+};
+
+class Derived : public Base, public Interface
+{
+public:
+    Derived();
+    short y;
+    int MethodCPP();
+#if _WIN32 || _WIN64
+    int MethodD();
+    virtual int Method();
+#else
+    int MethodD() { return 3; }  // need def or vtbl[] is not generated
+    virtual int Method()  { return 6; }  // need def or vtbl[] is not generated
+#endif
+};
+
+void Base::base() { }
+int Derived::MethodCPP() {
+    printf("Derived::MethodCPP() this = %p, x = %d, y = %d\n", this, x, y);
+    assert(x == 4 || x == 7);
+    assert(y == 5 || y == 8);
+    return 30;
+}
+Derived::Derived() { }
+
+
+Derived *cppfoo(Derived *d)
+{
+    printf("cppfoo(): d = %p\n", d);
+    assert(d->x == 4);
+    assert(d->y == 5);
+    assert(d->MethodD() == 3);
+    assert(d->MethodCPP() == 30);
+    assert(d->Method() == 6);
+
+    d = new Derived();
+    d->x = 7;
+    d->y = 8;
+    assert(d->MethodD() == 3);
+    assert(d->MethodCPP() == 30);
+    assert(d->Method() == 6);
+    printf("d1 = %p\n", d);
+    return d;
+}
+
+Interface *cppfooi(Interface *i)
+{
+    printf("cppfooi(): i = %p\n", i);
+    assert(i->MethodD() == 3);
+    assert(i->MethodCPP() == 30);
+
+    Derived *d = new Derived();
+    d->x = 7;
+    d->y = 8;
+    printf("d = %p, i = %p\n", d, (Interface *)d);
+    return d;
+}
+
+/******************************************/
+// 15610
+
+class Base2
+{
+  public:
+    int i;
+    virtual void baser() { }
+};
+
+class Interface2
+{
+  public:
+    virtual void f() = 0;
+};
+
+class Derived2 : public Base2, public Interface2
+{
+  public:
+    void f();
+};
+
+void Derived2::f()
+{
+    printf("Derived2::f() this = %p i = %d\n", this, i);
+    assert(i == 3);
+}
+
+/******************************************/
+// 15455
+
+struct X6
+{
+    unsigned short a;
+    unsigned short b;
+    unsigned char c;
+    unsigned char d;
+};
+
+struct X8
+{
+    unsigned short a;
+    X6 b;
+};
+
+void test15455b(X8 s)
+{
+    assert(sizeof(X6) == 6);
+    assert(sizeof(X8) == 8);
+    assert(s.a == 1);
+    assert(s.b.a == 2);
+    assert(s.b.b == 3);
+    assert(s.b.c == 4);
+    assert(s.b.d == 5);
+}
+
+
+/****************************************/
+// 16536 - mangling mismatch on OSX
+
+#if defined(__APPLE__)
+__UINTMAX_TYPE__ pass16536(__UINTMAX_TYPE__ a)
+{
+    return a;
+}
+#endif
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/cppmangle1.cpp b/gcc/testsuite/gdc.test/runnable/extra-files/cppmangle1.cpp
new file mode 100644
index 00000000000..62a5ad12945
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/cppmangle1.cpp
@@ -0,0 +1,4 @@
+int test0(int x)
+{
+    return x;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/depsprot.d b/gcc/testsuite/gdc.test/runnable/extra-files/depsprot.d
new file mode 100644
index 00000000000..a53f0ffc8d6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/depsprot.d
@@ -0,0 +1,3 @@
+import depsprot_default;
+private import depsprot_private;
+public import depsprot_public;
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/externmangle.cpp b/gcc/testsuite/gdc.test/runnable/extra-files/externmangle.cpp
new file mode 100644
index 00000000000..da3e8449b2e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/externmangle.cpp
@@ -0,0 +1,404 @@
+#include <stdint.h>
+
+template<class X>
+struct Foo
+{
+    X *v;
+};
+
+template<class X>
+struct Boo
+{
+    X *v;
+};
+
+void test1(Foo<int> arg1)
+{
+}
+
+
+void test2(int* arg2, Boo<int*> arg1)
+{
+}
+
+template<int X, int Y>
+struct Test3
+{
+
+};
+
+void test3(Test3<3,3> arg1)
+{
+}
+
+void test4(Foo<int*> arg1, Boo<int*> arg2, Boo<int*> arg3, int*, Foo<double>)
+{
+}
+
+void test5(Foo<int*> arg1, Boo<int*> arg2, Boo<int*> arg3)
+{
+}
+
+struct Goo
+{
+
+    template<class X>
+    struct Foo
+    {
+        X* v;
+    };
+
+    template<class X>
+    struct Boo
+    {
+        template<class Y>
+        struct Xoo
+        {
+            Y* v;
+        };
+        X* v;
+    };
+
+
+    void test6(Foo<Boo<Foo<void> > > arg1);
+    void test7(Boo<void>::Xoo<int> arg1);
+};
+
+void Goo::test6(Goo::Foo<Goo::Boo<Goo::Foo<void> > > arg1)
+{
+}
+
+void Goo::test7(Goo::Boo<void>::Xoo<int> arg1)
+{
+}
+
+struct P1
+{
+    template<class T>
+    struct Mem
+    {
+    };
+};
+
+struct P2
+{
+    template<class T>
+    struct Mem
+    {
+    };
+};
+
+void test8(P1::Mem<int>, P2::Mem<int>){}
+void test9(Foo<int**>, Foo<int*>, int**, int*){}
+
+
+
+class Test10
+{
+    private: void test10();
+    public: void test11();
+    protected: void test12();
+    public: void test13() const;
+
+    private: void test14(); // Private methods in D are always non-virtual
+    public: virtual void test15();
+    protected: virtual void test16();
+
+    private: static void test17();
+    public: static void test18();
+    protected: static void test19();
+};
+
+Test10* Test10Ctor()
+{
+    return new Test10();
+}
+
+void Test10Dtor(Test10*& ptr)
+{
+    delete ptr;
+    ptr = 0;
+}
+
+void Test10::test10(){}
+void Test10::test11(){}
+void Test10::test12(){}
+void Test10::test13() const{}
+void Test10::test14(){}
+void Test10::test15(){}
+void Test10::test16(){}
+void Test10::test17(){}
+void Test10::test18(){}
+void Test10::test19(){}
+
+struct Test20
+{
+    private: static int test20;
+    protected: static int test21;
+    public: static int test22;
+};
+
+int Test20::test20 = 20;
+int Test20::test21 = 21;
+int Test20::test22 = 22;
+
+int test23(Test10**, Test10*, Test10***, Test10 const *const)
+{
+    return 1;
+}
+
+int test23b(Test10 const *const *const,  Test10 const* const, Test10*)
+{
+    return 1;
+}
+
+void test24(int(*)(int,int))
+{
+}
+
+void test25(int arr[2][5][6][291])
+{
+}
+
+int test26(int arr[5][6][291])
+{
+    return arr[1][1][1];
+}
+
+void test27(int, ...){}
+void test28(int){}
+
+void test29(float){}
+void test30(const float){}
+
+template<class T>
+struct Array
+{
+    int dim;
+};
+
+class Module
+{
+public:
+    static void imports(Module*);
+    static int dim(Array<Module*>*);
+};
+
+
+void Module::imports(Module*)
+{
+}
+
+int Module::dim(Array<Module*>* arr)
+{
+    return arr->dim;
+}
+
+#if _LP64
+unsigned long testlongmangle(int32_t a, uint32_t b, long c, unsigned long d)
+{
+    return a + b + c + d;
+}
+#else
+unsigned long long testlongmangle(int a, unsigned int b, long long c, unsigned long long d)
+{
+    return a + b + c + d;
+}
+#endif
+
+int test31[2][2][2] = {1, 1, 1, 1, 1, 1, 1, 1};
+int *test32 = 0;
+
+
+
+class Expression;
+
+typedef int (*apply_fp_t)(Expression*, void*);
+
+class Expression
+{
+    int type;
+public:
+    int apply(apply_fp_t fp, apply_fp_t fp2, void *param);
+    int getType();
+    static Expression* create(int v);
+    static void dispose(Expression*&);
+};
+
+int Expression::apply(apply_fp_t fp, apply_fp_t fp2, void *param)
+{
+    return fp(this, param) * fp2(this, param);
+}
+
+int Expression::getType()
+{
+    return type;
+}
+
+Expression* Expression::create(int v)
+{
+    Expression *e = new Expression();
+    e->type = v;
+    return e;
+}
+
+void Expression::dispose(Expression *&e)
+{
+    if (e)
+        delete e;
+    e = 0;
+}
+
+/*int test34(int v[0][0][0])
+{
+    return 0;
+}*/
+
+#ifndef _MSC_VER
+    int test35(long double arg)
+    {
+        return (int)arg;
+    }
+#endif
+
+const char *test36(const char *arg)
+{
+    return arg;
+}
+
+class Test37
+{
+public:
+    static Test37 *create();
+    bool test();
+};
+
+bool test37()
+{
+    Test37 *o = Test37::create();
+    return o->test();
+}
+
+class Test38
+{
+public:
+     int test(int, ...);
+     static Test38* create();
+     static void dispose(Test38*&);
+};
+
+int Test38::test(int a, ...)
+{
+    return a;
+}
+
+Test38* Test38::create()
+{
+    Test38 *t = new Test38();
+    return t;
+}
+
+void Test38::dispose(Test38 *&t)
+{
+    if (t)
+        delete t;
+    t = 0;
+}
+
+class S1
+{
+    int val;
+public:
+    static S1* init(int);
+    S1(int v) : val(v) {}
+    int value();
+};
+
+S1* S1::init(int x)
+{
+    return new S1(x);
+}
+
+int S1::value()
+{
+    return val;
+}
+
+template<class T>
+class S2
+{
+    T val;
+public:
+    static S2<T>* init(T);
+    S2(T v) : val(v) {}
+    T value();
+};
+
+template<>
+S2<int>* S2<int>::init(int x)
+{
+    return new S2<int>(x);
+}
+
+template<>
+int S2<int>::value()
+{
+    return val;
+}
+
+struct C1
+{
+    const char *data;
+
+    static C1* init(const char *p);
+
+    C1(const char* p) : data(p) { }
+
+    virtual const char* getDataCPP();
+    virtual const char* getDataD();
+};
+
+C1* C1::init(const char *p)
+{
+    return new C1(p);
+}
+
+const char* C1::getDataCPP()
+{
+    return data;
+}
+
+template<class T>
+struct C2
+{
+    const T *data;
+
+    static C2* init(const T *p);
+
+    C2(const T* p) : data(p) { }
+
+    virtual const T* getData();
+};
+
+template<>
+C2<char>* C2<char>::init(const char *p)
+{
+    return new C2<char>(p);
+}
+
+template<>
+const char* C2<char>::getData()
+{
+    return data;
+}
+
+int test39cpp(C2<char>* c2, S2<int>* s2)
+{
+    C2<char>* otherC2 = C2<char>::init(c2->getData());
+    if (c2->getData() != otherC2->getData())
+        return 1;
+    S2<int>* otherS2 = S2<int>::init(s2->value());
+    if (s2->value() != otherS2->value())
+        return 2;
+    return 0;
+}
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/externmangle2.cpp b/gcc/testsuite/gdc.test/runnable/extra-files/externmangle2.cpp
new file mode 100644
index 00000000000..b481348976a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/externmangle2.cpp
@@ -0,0 +1,145 @@
+
+struct Test32NS1
+{
+    template<class X>
+    struct Foo
+    {
+        X *v;
+    };
+
+    template<class X>
+    struct Bar
+    {
+        X *v;
+    };
+
+};
+
+struct Test32NS2
+{
+    template<class X>
+    struct Foo
+    {
+        X *v;
+    };
+};
+
+template <template <class X> class Y, template <class X> class Z>
+struct Test32
+{
+    Y<int>* field;
+};
+
+
+void test32a(Test32<Test32NS1::Foo, Test32NS1::Foo> arg)
+{
+}
+
+void test32b(Test32<Test32NS1::Foo, Test32NS1::Bar> arg)
+{
+}
+
+void test32c(Test32<Test32NS1::Foo, Test32NS2::Foo> arg)
+{
+}
+
+void test32d(Test32<Test32NS1::Foo, Test32NS2::Foo> arg1, Test32<Test32NS2::Foo, Test32NS1::Foo> arg2)
+{
+}
+
+
+class XXX
+{
+};
+template <void (&Goo)(XXX*, XXX**), void (&Xoo)(XXX*, XXX**)>
+struct Test33
+{
+};
+
+void test33a(XXX*, XXX**){}
+
+void test33(XXX*, Test33<test33a, test33a> arg, XXX*)
+{
+}
+
+template <void (&Goo)(int)>
+struct Test34
+{
+};
+
+struct Test34A
+{
+    static void foo(int);
+};
+
+void Test34A::foo(int) {}
+void test34(Test34<Test34A::foo> arg)
+{
+}
+
+int test36= 36;
+
+template <int& XREF>
+struct Test37
+{
+};
+
+struct Test37A
+{
+    static int t38;
+};
+
+int Test37A::t38 = 42;
+
+void test37(Test37<test36> arg)
+{
+}
+
+void test38(Test37<Test37A::t38> arg)
+{
+}
+
+struct Test39
+{
+    template <class X>
+    struct T39A
+    {
+    };
+};
+
+struct T39A
+{
+};
+
+void test39(Test39::T39A< ::T39A >)
+{
+}
+
+#if 0 //only for g++ with -std=c++0x and Visual C++ >= 2013
+    #if defined(__GNUG__) || (defined(_MSC_VER) && _MSC_VER >= 1200)
+    template<class... VarArg> struct Test40
+    {
+    };
+
+    void test40(Test40<int, double, void> arg)
+    {
+    }
+    #endif
+
+
+#endif
+
+
+extern XXX const * const  test41 = 0;
+
+namespace Test42
+{
+    extern XXX const * const  test42 = 0;
+}
+
+int test43[4] = {1, 2, 3, 4};
+
+XXX const* const test44()
+{
+    return new XXX;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/foo37.txt b/gcc/testsuite/gdc.test/runnable/extra-files/foo37.txt
new file mode 100644
index 00000000000..8eadfc9b2aa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/foo37.txt
@@ -0,0 +1,2 @@
+hello
+betty
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/lib10386/foo/bar.d b/gcc/testsuite/gdc.test/runnable/extra-files/lib10386/foo/bar.d
new file mode 100644
index 00000000000..86e5839acc8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/lib10386/foo/bar.d
@@ -0,0 +1,6 @@
+module lib10386.foo.bar;
+
+void foo(int x)
+{
+    assert(x == 1);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/lib10386/foo/package.d b/gcc/testsuite/gdc.test/runnable/extra-files/lib10386/foo/package.d
new file mode 100644
index 00000000000..6e2a5dfcac1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/lib10386/foo/package.d
@@ -0,0 +1,3 @@
+module lib10386.foo;
+
+public import lib10386.foo.bar;
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/lib13666.d b/gcc/testsuite/gdc.test/runnable/extra-files/lib13666.d
new file mode 100644
index 00000000000..57db015f62a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/lib13666.d
@@ -0,0 +1,11 @@
+module lib13666;
+
+template drt_envvars()
+{
+    extern(C) __gshared bool enabled = false;
+}
+
+bool foo()
+{
+	return drt_envvars!().enabled;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/lib13774a.d b/gcc/testsuite/gdc.test/runnable/extra-files/lib13774a.d
new file mode 100644
index 00000000000..e623075d494
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/lib13774a.d
@@ -0,0 +1,11 @@
+module lib13774a;
+
+void comdef()()
+{
+    __gshared int a;
+}
+
+void use1()
+{
+    comdef();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/lib13774b.d b/gcc/testsuite/gdc.test/runnable/extra-files/lib13774b.d
new file mode 100644
index 00000000000..5d0ae9be64e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/lib13774b.d
@@ -0,0 +1,7 @@
+module lib13774b;
+import lib13774a;
+
+void use2()
+{
+    comdef();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/lib846.d b/gcc/testsuite/gdc.test/runnable/extra-files/lib846.d
new file mode 100644
index 00000000000..65547765e22
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/lib846.d
@@ -0,0 +1,38 @@
+module link846a;
+
+template ElemTypeOf(T)
+{
+    alias typeof(T.init[0]) ElemTypeOf;
+}
+
+template removeIf_(Elem, Pred)
+{
+    size_t fn(Elem[] buf, Pred pred)
+    {
+        void exch(size_t p1, size_t p2)
+        {
+            Elem t  = buf[p1];
+            buf[p1] = buf[p2];
+            buf[p2] = t;
+        }
+
+        size_t cnt = 0;
+
+        for (size_t pos = 0, len = buf.length; pos < len; ++pos)
+        {
+            if (pred(buf[pos]))
+                ++cnt;
+            else
+                exch(pos, pos - cnt);
+        }
+        return buf.length - cnt;
+    }
+}
+
+template removeIf(Buf, Pred)
+{
+    size_t removeIf(Buf buf, Pred pred)
+    {
+        return removeIf_!(ElemTypeOf!Buf, Pred).fn(buf, pred);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/link14834a.d b/gcc/testsuite/gdc.test/runnable/extra-files/link14834a.d
new file mode 100644
index 00000000000..86734ee6665
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/link14834a.d
@@ -0,0 +1,57 @@
+module link14834a;
+
+struct DirIterator
+{
+    int i = 1;
+
+    @property bool empty() { return i == 0; }
+    @property int front() { return 10; }
+    void popFront() { --i; }
+}
+
+auto dirEntries(string path)
+{
+    bool f(int x)
+    {
+        assert(path == ".");    // should pass
+        return true;
+    }
+    return filter!f(DirIterator());
+}
+
+template filter(alias pred)
+{
+    auto filter(R)(R range)
+    {
+        return FilterResult!(pred, R)(range);
+    }
+}
+
+struct FilterResult(alias pred, R)
+{
+    R input;
+
+    this(R r)
+    {
+        input = r;
+        while (!input.empty && !pred(input.front))
+        {
+            input.popFront();
+        }
+    }
+
+    @property bool empty() { return input.empty; }
+
+    @property auto ref front()
+    {
+        return input.front;
+    }
+
+    void popFront()
+    {
+        do
+        {
+            input.popFront();
+        } while (!input.empty && !pred(input.front));
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/link14834b.d b/gcc/testsuite/gdc.test/runnable/extra-files/link14834b.d
new file mode 100644
index 00000000000..14ebd8e341d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/link14834b.d
@@ -0,0 +1,9 @@
+import link14834a;
+
+void main()
+{
+    foreach (n; dirEntries("."))
+    {
+        assert(n == 10);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug.d b/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug.d
new file mode 100644
index 00000000000..67da9dc2a23
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug.d
@@ -0,0 +1,16 @@
+module linkdebug;
+
+void main()
+{
+    import linkdebug_uni;
+    import linkdebug_range;
+
+    // OK
+    //SortedRangeX!(uint[], "a <= b") SR;
+
+    CodepointSet set;
+    set.addInterval(1, 2);
+
+    // NG, order dependent.
+    SortedRange!(uint[], "a <= b") SR;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug_primitives.d b/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug_primitives.d
new file mode 100644
index 00000000000..81026d6345f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug_primitives.d
@@ -0,0 +1,13 @@
+module linkdebug_primitives;
+
+size_t popBackN(R)(ref R r, size_t n)
+{
+    n = cast(size_t) (n < r.length ? n : r.length);
+    r = r[0 .. $ - n];
+    return n;
+}
+
+auto moveAt(R, I)(R r, I i)
+{
+    return r[i];
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug_range.d b/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug_range.d
new file mode 100644
index 00000000000..ddf91bfdf92
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug_range.d
@@ -0,0 +1,48 @@
+module linkdebug_range;
+
+import linkdebug_primitives : popBackN, moveAt;
+
+auto stride(R)(R r)
+{
+    static struct Result
+    {
+        R source;
+
+        void popBack()
+        {
+            popBackN(source, 0);
+        }
+
+        uint moveAt(size_t n)
+        {
+            return .moveAt(source, n);
+        }
+    }
+    return Result(r);
+}
+
+struct SortedRange(Range, alias pred = "a < b")
+{
+    this(Range input)
+    out
+    {
+        dbgVerifySorted();
+    }
+    body
+    {
+    }
+
+    void dbgVerifySorted()
+    {
+        debug
+        {
+            uint[] _input;
+            auto st = stride(_input);
+        }
+    }
+}
+
+auto assumeSorted(alias pred = "a < b", R)(R r)
+{
+    return SortedRange!(R, pred)(r);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug_uni.d b/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug_uni.d
new file mode 100644
index 00000000000..248fae14217
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/linkdebug_uni.d
@@ -0,0 +1,19 @@
+module linkdebug_uni;
+
+import linkdebug_range;
+
+struct GcPolicy {}
+
+alias CodepointSet = InversionList!();
+
+struct InversionList(SP = GcPolicy)
+{
+@trusted:
+    size_t addInterval(int a, int b, size_t hint = 0)
+    {
+        auto data = new uint[](0);        // affects to the number of missimg symbol
+        auto range = assumeSorted(data[]);  // NG
+        //SortedRange!(uint[], "a < b") SR; // OK
+        return 1;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/main846.d b/gcc/testsuite/gdc.test/runnable/extra-files/main846.d
new file mode 100644
index 00000000000..d0b882ade2b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/main846.d
@@ -0,0 +1,6 @@
+import lib846;
+
+void main()
+{
+    auto num = removeIf("abcdef".dup, (char c){ return c == 'c'; });
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/mul9377a.d b/gcc/testsuite/gdc.test/runnable/extra-files/mul9377a.d
new file mode 100644
index 00000000000..643dacd790d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/mul9377a.d
@@ -0,0 +1,11 @@
+import core.stdc.stdio;
+
+import mul9377b;
+
+void abc()
+{
+    printf("mul9377b.abc()\n");
+    foo();
+    bar();
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/mul9377b.d b/gcc/testsuite/gdc.test/runnable/extra-files/mul9377b.d
new file mode 100644
index 00000000000..7ab2657612e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/mul9377b.d
@@ -0,0 +1,40 @@
+module mul9377b;
+
+import core.stdc.stdio;
+
+int j;
+
+int foo()()
+{
+    printf("foo()\n");
+    static int z = 7;
+    assert(z != 10);
+    return ++z;
+}
+
+void bar()
+{
+    assert(j == 7);
+    foo();
+    printf("bar\n");
+}
+
+template def()
+{
+    alias int defint;
+
+    static this()
+    {
+        printf("def.static this()\n");
+        j = 7;
+    }
+
+    //void mem(int){}
+    void mem()
+    {
+        printf("def().mem()\n");
+    }
+}
+
+def!().defint x;
+
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/multi9377.d b/gcc/testsuite/gdc.test/runnable/extra-files/multi9377.d
new file mode 100644
index 00000000000..54b73d95d57
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/multi9377.d
@@ -0,0 +1,13 @@
+import core.stdc.stdio;
+
+import mul9377a, mul9377b;
+
+int main()
+{
+    printf("main\n");
+    abc();
+    def!().mem();
+    pragma(msg, def!().mem.mangleof);
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/objc_self_test.m b/gcc/testsuite/gdc.test/runnable/extra-files/objc_self_test.m
new file mode 100644
index 00000000000..c5de95cd257
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/objc_self_test.m
@@ -0,0 +1,17 @@
+#import <Foundation/Foundation.h>
+
+@interface objc_self_test : NSObject
+-(int) getValue;
+@end
+
+@implementation objc_self_test
+-(int) getValue
+{
+    return 3;
+}
+@end
+
+int getValue ()
+{
+    return [[[objc_self_test alloc] init] getValue];
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/statictor.d.out b/gcc/testsuite/gdc.test/runnable/extra-files/statictor.d.out
new file mode 100644
index 00000000000..f3ab0e3cff8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/statictor.d.out
@@ -0,0 +1,8 @@
+shared static this()
+Foo static ctor
+static ctor
+Bar static ctor
+Bar static dtor
+static dtor
+Foo static dtor
+shared static this()
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/std14198/array.d b/gcc/testsuite/gdc.test/runnable/extra-files/std14198/array.d
new file mode 100644
index 00000000000..db061916d81
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/std14198/array.d
@@ -0,0 +1,27 @@
+module std14198.array;
+
+version(bug14198)
+{
+}
+else
+    import std14198.uni;
+
+struct Appender(A)
+{
+    alias T = immutable char;
+
+    void put(U)(U item)
+    if (
+            is(U : T) ||
+            is(immutable U == immutable char)
+       )
+    {
+        import std14198.uni; // necessary
+        assert(0);
+    }
+}
+
+Appender!A appender(A)()
+{
+    return Appender!A();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/std14198/conv.d b/gcc/testsuite/gdc.test/runnable/extra-files/std14198/conv.d
new file mode 100644
index 00000000000..63492f1fbd6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/std14198/conv.d
@@ -0,0 +1,34 @@
+module std14198.conv;
+
+template to(T)
+{
+    T to(A...)(A args)
+    {
+        return toImpl!T(args);
+    }
+}
+
+T toImpl(T, S)(S value)
+    if (is(S : T))
+{
+    return value;
+}
+
+T toImpl(T, S)(S value)
+    if (!is(S : T) &&
+        is(T == string))
+{
+    alias src = value;
+
+    import std14198.format : FormatSpec;
+    import std14198.array : appender;
+
+    auto w = appender!T();
+    FormatSpec!char f; // necessary
+
+    string str = src ? "true" : "false";
+    for (; !str.length; str = str[1..$])
+        w.put(str[0]);
+
+    return "";
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/std14198/format.d b/gcc/testsuite/gdc.test/runnable/extra-files/std14198/format.d
new file mode 100644
index 00000000000..516d370f394
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/std14198/format.d
@@ -0,0 +1,11 @@
+module std14198.format;
+
+struct FormatSpec(Char) if (is(Char == char))
+{
+    import std14198.conv;
+
+    string toString()
+    {
+        return to!string(true); // necessary
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/std14198/uni.d b/gcc/testsuite/gdc.test/runnable/extra-files/std14198/uni.d
new file mode 100644
index 00000000000..011382c6cba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/std14198/uni.d
@@ -0,0 +1,12 @@
+module std14198.uni;
+
+alias CodepointSet = InversionList!();
+
+struct InversionList()
+{
+    import std14198.format;
+
+    void toString(FormatSpec!char fs) // necessary
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test10386.d b/gcc/testsuite/gdc.test/runnable/extra-files/test10386.d
new file mode 100644
index 00000000000..3bcd3a08e47
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test10386.d
@@ -0,0 +1,11 @@
+module test10386;
+
+// import lib.foo.bar;  // ok
+import lib10386.foo;  // linker failure
+
+void main()
+{
+    static assert(foo.mangleof == "_D8lib103863foo3bar3fooFiZv");
+    foo(1);
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test10567.d b/gcc/testsuite/gdc.test/runnable/extra-files/test10567.d
new file mode 100644
index 00000000000..3d2aab77586
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test10567.d
@@ -0,0 +1,15 @@
+import test10567a;
+
+template TypeTuple(TL...) { alias TL TypeTuple; }
+
+void main()
+{
+    foreach (BigInt; TypeTuple!(BigInt1, BigInt2, BigInt3))
+    {
+        auto i = BigInt([100]);
+        auto j = BigInt([100]);
+
+        assert(typeid(BigInt).equals(&i, &j) == true);
+        assert(typeid(BigInt).compare(&i, &j) == 0);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test10567a.d b/gcc/testsuite/gdc.test/runnable/extra-files/test10567a.d
new file mode 100644
index 00000000000..222e52e44e7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test10567a.d
@@ -0,0 +1,52 @@
+struct BigInt1
+{
+    int[] dara;
+
+    bool opEquals(const ref BigInt1 rhs) const  // -> stored in TypeInfo_Struct.xopEquals
+    {
+        return true;
+    }
+    bool opEquals(T)(T rhs) const
+    {
+        return false;
+    }
+
+    int opCmp(const ref BigInt1 rhs) const      // stored in TypeInfo_Struct.xopCmp
+    {
+        return 0;
+    }
+    int opCmp(T)(T rhs) const
+    {
+        return 1;
+    }
+}
+
+struct BigInt2
+{
+    int[] dara;
+
+    bool opEquals(const ref BigInt2 rhs) const  // stored in TypeInfo_Struct.xopEquals
+    {
+        return true;
+    }
+
+    int opCmp(const ref BigInt2 rhs) const      // stored in TypeInfo_Struct.xopCmp
+    {
+        return 0;
+    }
+}
+
+struct BigInt3
+{
+    int[] dara;
+
+    bool opEquals(T)(T rhs) const   // stored in TypeInfo_Struct.xopEquals
+    {
+        return true;
+    }
+
+    int opCmp(T)(T rhs) const       // stored in TypeInfo_Struct.xopCmp
+    {
+        return 0;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test13666.d b/gcc/testsuite/gdc.test/runnable/extra-files/test13666.d
new file mode 100644
index 00000000000..564154f0fa6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test13666.d
@@ -0,0 +1,6 @@
+import lib13666;
+
+int main()
+{
+	return foo();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test14198.d b/gcc/testsuite/gdc.test/runnable/extra-files/test14198.d
new file mode 100644
index 00000000000..46dd2c585a3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test14198.d
@@ -0,0 +1,30 @@
+module test14198;
+
+import std14198.conv;
+
+struct S
+{
+    ptrdiff_t function() fptr = &handler;
+
+    static ptrdiff_t handler() pure @safe
+    {
+        static if (is(typeof(to!string(false))))
+        {
+            to!string(false);
+            // [1] to!string(bool src) should be deduced to pure @safe, and the function will be mangled to:
+            //     --> _D8std141984conv11__T2toTAyaZ9__T2toTbZ2toFNaNbNiNfbZAya
+            // [2] its object code would be stored in the library file, because it's instantiated in std14188.uni:
+            //     --> FormatSpec!char --> to!string(bool src) in FormatSpec!char.toString()
+            //     But semanti3 of FormatSpec!char.toString() won't get called from this module compilation,
+            //     so the instantiaion is invisible.
+            //     Then, the object code is also stored in test14198.obj, and the link will succeed.
+        }
+        else
+            static assert(0);
+        return 0;
+    }
+}
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test15.txt b/gcc/testsuite/gdc.test/runnable/extra-files/test15.txt
new file mode 100644
index 00000000000..51f30ec35ea
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test15.txt
@@ -0,0 +1,815 @@
+ad0.doubleclick.be
+ad0.erasercash.com
+ad0.ezcybersearch.com
+ad0.gamesweb.com
+ad0.haynet.com
+ad0.hpg.com.br
+ad0.hpg.ig.com.br
+ad0.paycount.com
+ad0.popupad.net
+ad00.erasercash.com
+ad00.ezcybersearch.com
+ad00.hpg.com.br
+ad00.hpg.ig.com.br
+ad00.paycount.com
+ad00.popupad.net
+ad01.erasercash.com
+ad01.ezcybersearch.com
+ad01.focalink.com
+ad01.hpg.com.br
+ad01.hpg.ig.com.br
+ad01.mediacorpsingapore.com
+ad01.nakednews.com
+ad01.paycount.com
+ad01.popupad.net
+ad02.focalink.com
+ad03.erasercash.com
+ad03.ezcybersearch.com
+ad03.focalink.com
+ad03.freenet.de
+ad03.hpg.com.br
+ad03.hpg.ig.com.br
+ad03.paycount.com
+ad03.popupad.net
+ad04.erasercash.com
+ad04.ezcybersearch.com
+ad04.focalink.com
+ad04.hpg.com.br
+ad04.hpg.ig.com.br
+ad04.paycount.com
+ad04.popupad.net
+ad05.erasercash.com
+ad05.ezcybersearch.com
+ad05.focalink.com
+ad05.hpg.com.br
+ad05.hpg.ig.com.br
+ad05.paycount.com
+ad05.popupad.net
+ad06.erasercash.com
+ad06.ezcybersearch.com
+ad06.focalink.com
+ad06.hpg.com.br
+ad06.hpg.ig.com.br
+ad06.paycount.com
+ad06.popupad.net
+ad07.erasercash.com
+ad07.ezcybersearch.com
+ad07.focalink.com
+ad07.hpg.com.br
+ad07.hpg.ig.com.br
+ad07.paycount.com
+ad07.popupad.net
+ad08.erasercash.com
+ad08.ezcybersearch.com
+ad08.focalink.com
+ad08.hpg.com.br
+ad08.hpg.ig.com.br
+ad08.paycount.com
+ad08.popupad.net
+ad09.erasercash.com
+ad09.ezcybersearch.com
+ad09.focalink.com
+ad09.hpg.com.br
+ad09.hpg.ig.com.br
+ad09.paycount.com
+ad09.popupad.net
+ad1.aaddzz.com
+ad1.adnetwork.com.br
+ad1.adsolution.de
+ad1.adverticum.net
+ad1.bb.ru
+ad1.dada.it
+ad1.denverpost.com
+ad1.dialpad.com
+ad1.doubleclick.be
+ad1.doubleclick.com
+ad1.doubleclick.net
+ad1.emediate.dk
+ad1.erasercash.com
+ad1.ezcybersearch.com
+ad1.gamezone.com
+ad1.gamezone.de
+ad1.hpg.com.br
+ad1.hpg.ig.com.br
+ad1.icorp.net
+ad1.ixo.com
+ad1.kde.cz
+ad1.lbe.ru
+ad1.lbn.ru
+ad1.outpost.com
+ad1.pamedia.com.au
+ad1.paycount.com
+ad1.peel.com
+ad1.popupad.net
+ad1.primorye.ru
+ad1.radioreti.it
+ad1.targetgraph.com
+ad1.trafficx.com
+ad1.yourmedia.com
+ad1.zendmedia.com
+ad10.doubleclick.be
+ad10.erasercash.com
+ad10.ezcybersearch.com
+ad10.focalink.com
+ad10.hpg.com.br
+ad10.hpg.ig.com.br
+ad10.lbn.ru
+ad10.paycount.com
+ad10.popupad.net
+ad100.erasercash.com
+ad100.ezcybersearch.com
+ad100.hpg.com.br
+ad100.hpg.ig.com.br
+ad100.paycount.com
+ad100.popupad.net
+ad101.erasercash.com
+ad101.ezcybersearch.com
+ad101.hpg.com.br
+ad101.hpg.ig.com.br
+ad101.paycount.com
+ad101.popupad.net
+ad102.erasercash.com
+ad102.ezcybersearch.com
+ad102.hpg.com.br
+ad102.hpg.ig.com.br
+ad102.paycount.com
+ad102.popupad.net
+ad103.erasercash.com
+ad103.ezcybersearch.com
+ad103.hpg.com.br
+ad103.hpg.ig.com.br
+ad103.paycount.com
+ad103.popupad.net
+ad104.erasercash.com
+ad104.ezcybersearch.com
+ad104.hpg.com.br
+ad104.hpg.ig.com.br
+ad104.paycount.com
+ad104.popupad.net
+ad105.erasercash.com
+ad105.ezcybersearch.com
+ad105.hpg.com.br
+ad105.hpg.ig.com.br
+ad105.paycount.com
+ad105.popupad.net
+ad106.erasercash.com
+ad106.ezcybersearch.com
+ad106.hpg.com.br
+ad106.hpg.ig.com.br
+ad106.paycount.com
+ad106.popupad.net
+ad107.erasercash.com
+ad107.ezcybersearch.com
+ad107.hpg.com.br
+ad107.hpg.ig.com.br
+ad107.paycount.com
+ad107.popupad.net
+ad108.erasercash.com
+ad108.ezcybersearch.com
+ad108.hpg.com.br
+ad108.hpg.ig.com.br
+ad108.paycount.com
+ad108.popupad.net
+ad109.erasercash.com
+ad109.ezcybersearch.com
+ad109.hpg.com.br
+ad109.hpg.ig.com.br
+ad109.paycount.com
+ad109.popupad.net
+ad11.doubleclick.be
+ad11.erasercash.com
+ad11.ezcybersearch.com
+ad11.focalink.com
+ad11.hpg.com.br
+ad11.hpg.ig.com.br
+ad11.lbn.ru
+ad11.paycount.com
+ad11.popupad.net
+ad110.erasercash.com
+ad110.ezcybersearch.com
+ad110.hpg.com.br
+ad110.hpg.ig.com.br
+ad110.paycount.com
+ad110.popupad.net
+ad111.erasercash.com
+ad111.ezcybersearch.com
+ad111.hpg.com.br
+ad111.hpg.ig.com.br
+ad111.paycount.com
+ad111.popupad.net
+ad112.erasercash.com
+ad112.ezcybersearch.com
+ad112.hpg.com.br
+ad112.hpg.ig.com.br
+ad112.paycount.com
+ad112.popupad.net
+ad113.erasercash.com
+ad113.ezcybersearch.com
+ad113.hpg.com.br
+ad113.hpg.ig.com.br
+ad113.paycount.com
+ad113.popupad.net
+ad114.erasercash.com
+ad114.ezcybersearch.com
+ad114.hpg.com.br
+ad114.hpg.ig.com.br
+ad114.paycount.com
+ad114.popupad.net
+ad115.erasercash.com
+ad115.ezcybersearch.com
+ad115.hpg.com.br
+ad115.hpg.ig.com.br
+ad115.paycount.com
+ad115.popupad.net
+ad116.erasercash.com
+ad116.ezcybersearch.com
+ad116.hpg.com.br
+ad116.hpg.ig.com.br
+ad116.paycount.com
+ad116.popupad.net
+ad117.erasercash.com
+ad117.ezcybersearch.com
+ad117.hpg.com.br
+ad117.hpg.ig.com.br
+ad117.paycount.com
+ad117.popupad.net
+ad118.erasercash.com
+ad118.ezcybersearch.com
+ad118.hpg.com.br
+ad118.hpg.ig.com.br
+ad118.paycount.com
+ad118.popupad.net
+ad119.erasercash.com
+ad119.ezcybersearch.com
+ad119.hpg.com.br
+ad119.hpg.ig.com.br
+ad119.paycount.com
+ad119.popupad.net
+ad12.doubleclick.be
+ad12.erasercash.com
+ad12.ezcybersearch.com
+ad12.focalink.com
+ad12.hpg.com.br
+ad12.hpg.ig.com.br
+ad12.lbn.ru
+ad12.paycount.com
+ad12.popupad.net
+ad120.erasercash.com
+ad120.ezcybersearch.com
+ad120.hpg.com.br
+ad120.hpg.ig.com.br
+ad120.paycount.com
+ad120.popupad.net
+ad121.erasercash.com
+ad121.ezcybersearch.com
+ad121.hpg.com.br
+ad121.hpg.ig.com.br
+ad121.paycount.com
+ad121.popupad.net
+ad122.erasercash.com
+ad122.ezcybersearch.com
+ad122.hpg.com.br
+ad122.hpg.ig.com.br
+ad122.paycount.com
+ad122.popupad.net
+ad123.erasercash.com
+ad123.ezcybersearch.com
+ad123.hpg.com.br
+ad123.hpg.ig.com.br
+ad123.paycount.com
+ad123.popupad.net
+ad124.erasercash.com
+ad124.ezcybersearch.com
+ad124.hpg.com.br
+ad124.hpg.ig.com.br
+ad124.paycount.com
+ad124.popupad.net
+ad125.erasercash.com
+ad125.ezcybersearch.com
+ad125.hpg.com.br
+ad125.hpg.ig.com.br
+ad125.paycount.com
+ad125.popupad.net
+ad126.erasercash.com
+ad126.ezcybersearch.com
+ad126.hpg.com.br
+ad126.hpg.ig.com.br
+ad126.paycount.com
+ad126.popupad.net
+ad127.erasercash.com
+ad127.ezcybersearch.com
+ad127.hpg.com.br
+ad127.hpg.ig.com.br
+ad127.paycount.com
+ad127.popupad.net
+ad128.erasercash.com
+ad128.ezcybersearch.com
+ad128.hpg.com.br
+ad128.hpg.ig.com.br
+ad128.paycount.com
+ad128.popupad.net
+ad129.erasercash.com
+ad129.ezcybersearch.com
+ad129.hpg.com.br
+ad129.hpg.ig.com.br
+ad129.paycount.com
+ad129.popupad.net
+ad13.doubleclick.be
+ad13.erasercash.com
+ad13.ezcybersearch.com
+ad13.focalink.com
+ad13.hpg.com.br
+ad13.hpg.ig.com.br
+ad13.lbn.ru
+ad13.paycount.com
+ad13.popupad.net
+ad130.erasercash.com
+ad130.ezcybersearch.com
+ad130.hpg.com.br
+ad130.hpg.ig.com.br
+ad130.paycount.com
+ad130.popupad.net
+ad131.erasercash.com
+ad131.ezcybersearch.com
+ad131.hpg.com.br
+ad131.hpg.ig.com.br
+ad131.paycount.com
+ad131.popupad.net
+ad132.erasercash.com
+ad132.ezcybersearch.com
+ad132.hpg.com.br
+ad132.hpg.ig.com.br
+ad132.paycount.com
+ad132.popupad.net
+ad133.erasercash.com
+ad133.ezcybersearch.com
+ad133.hpg.com.br
+ad133.hpg.ig.com.br
+ad133.paycount.com
+ad133.popupad.net
+ad134.erasercash.com
+ad134.ezcybersearch.com
+ad134.hpg.com.br
+ad134.hpg.ig.com.br
+ad134.paycount.com
+ad134.popupad.net
+ad135.erasercash.com
+ad135.ezcybersearch.com
+ad135.hpg.com.br
+ad135.hpg.ig.com.br
+ad135.paycount.com
+ad135.popupad.net
+ad136.erasercash.com
+ad136.ezcybersearch.com
+ad136.hpg.com.br
+ad136.hpg.ig.com.br
+ad136.paycount.com
+ad136.popupad.net
+ad137.erasercash.com
+ad137.ezcybersearch.com
+ad137.hpg.com.br
+ad137.hpg.ig.com.br
+ad137.paycount.com
+ad137.popupad.net
+ad138.erasercash.com
+ad138.ezcybersearch.com
+ad138.hpg.com.br
+ad138.hpg.ig.com.br
+ad138.paycount.com
+ad138.popupad.net
+ad139.erasercash.com
+ad139.ezcybersearch.com
+ad139.hpg.com.br
+ad139.hpg.ig.com.br
+ad139.paycount.com
+ad139.popupad.net
+ad14.doubleclick.be
+ad14.erasercash.com
+ad14.ezcybersearch.com
+ad14.focalink.com
+ad14.hpg.com.br
+ad14.hpg.ig.com.br
+ad14.paycount.com
+ad14.popupad.net
+ad140.erasercash.com
+ad140.ezcybersearch.com
+ad140.hpg.com.br
+ad140.hpg.ig.com.br
+ad140.paycount.com
+ad140.popupad.net
+ad141.erasercash.com
+ad141.ezcybersearch.com
+ad141.hpg.com.br
+ad141.hpg.ig.com.br
+ad141.paycount.com
+ad141.popupad.net
+ad142.erasercash.com
+ad142.ezcybersearch.com
+ad142.hpg.com.br
+ad142.hpg.ig.com.br
+ad142.paycount.com
+ad142.popupad.net
+ad143.erasercash.com
+ad143.ezcybersearch.com
+ad143.hpg.com.br
+ad143.hpg.ig.com.br
+ad143.paycount.com
+ad143.popupad.net
+ad144.erasercash.com
+ad144.ezcybersearch.com
+ad144.hpg.com.br
+ad144.hpg.ig.com.br
+ad144.paycount.com
+ad144.popupad.net
+ad145.erasercash.com
+ad145.ezcybersearch.com
+ad145.hpg.com.br
+ad145.hpg.ig.com.br
+ad145.paycount.com
+ad145.popupad.net
+ad146.erasercash.com
+ad146.ezcybersearch.com
+ad146.hpg.com.br
+ad146.hpg.ig.com.br
+ad146.paycount.com
+ad146.popupad.net
+ad147.erasercash.com
+ad147.ezcybersearch.com
+ad147.hpg.com.br
+ad147.hpg.ig.com.br
+ad147.paycount.com
+ad147.popupad.net
+ad148.erasercash.com
+ad148.ezcybersearch.com
+ad148.hpg.com.br
+ad148.hpg.ig.com.br
+ad148.paycount.com
+ad148.popupad.net
+ad149.erasercash.com
+ad149.ezcybersearch.com
+ad149.hpg.com.br
+ad149.hpg.ig.com.br
+ad149.paycount.com
+ad149.popupad.net
+ad15.doubleclick.be
+ad15.erasercash.com
+ad15.ezcybersearch.com
+ad15.focalink.com
+ad15.hpg.com.br
+ad15.hpg.ig.com.br
+ad15.paycount.com
+ad15.popupad.net
+ad150.erasercash.com
+ad150.ezcybersearch.com
+ad150.hpg.com.br
+ad150.hpg.ig.com.br
+ad150.paycount.com
+ad150.popupad.net
+ad151.erasercash.com
+ad151.ezcybersearch.com
+ad151.hpg.com.br
+ad151.hpg.ig.com.br
+ad151.paycount.com
+ad151.popupad.net
+ad152.erasercash.com
+ad152.ezcybersearch.com
+ad152.hpg.com.br
+ad152.hpg.ig.com.br
+ad152.paycount.com
+ad152.popupad.net
+ad153.erasercash.com
+ad153.ezcybersearch.com
+ad153.hpg.com.br
+ad153.hpg.ig.com.br
+ad153.paycount.com
+ad153.popupad.net
+ad154.erasercash.com
+ad154.ezcybersearch.com
+ad154.hpg.com.br
+ad154.hpg.ig.com.br
+ad154.paycount.com
+ad154.popupad.net
+ad155.erasercash.com
+ad155.ezcybersearch.com
+ad155.hpg.com.br
+ad155.hpg.ig.com.br
+ad155.paycount.com
+ad155.popupad.net
+ad156.erasercash.com
+ad156.ezcybersearch.com
+ad156.hpg.com.br
+ad156.hpg.ig.com.br
+ad156.paycount.com
+ad156.popupad.net
+ad157.erasercash.com
+ad157.ezcybersearch.com
+ad157.hpg.com.br
+ad157.hpg.ig.com.br
+ad157.paycount.com
+ad157.popupad.net
+ad158.erasercash.com
+ad158.ezcybersearch.com
+ad158.hpg.com.br
+ad158.hpg.ig.com.br
+ad158.paycount.com
+ad158.popupad.net
+ad159.erasercash.com
+ad159.ezcybersearch.com
+ad159.hpg.com.br
+ad159.hpg.ig.com.br
+ad159.paycount.com
+ad159.popupad.net
+ad16.doubleclick.be
+ad16.erasercash.com
+ad16.ezcybersearch.com
+ad16.focalink.com
+ad16.hpg.com.br
+ad16.hpg.ig.com.br
+ad16.paycount.com
+ad16.popupad.net
+ad160.erasercash.com
+ad160.ezcybersearch.com
+ad160.hpg.com.br
+ad160.hpg.ig.com.br
+ad160.paycount.com
+ad160.popupad.net
+ad161.erasercash.com
+ad161.ezcybersearch.com
+ad161.hpg.com.br
+ad161.hpg.ig.com.br
+ad161.paycount.com
+ad161.popupad.net
+ad162.erasercash.com
+ad162.ezcybersearch.com
+ad162.hpg.com.br
+ad162.hpg.ig.com.br
+ad162.paycount.com
+ad162.popupad.net
+ad163.erasercash.com
+ad163.ezcybersearch.com
+ad163.hpg.com.br
+ad163.hpg.ig.com.br
+ad163.paycount.com
+ad163.popupad.net
+ad164.erasercash.com
+ad164.ezcybersearch.com
+ad164.hpg.com.br
+ad164.hpg.ig.com.br
+ad164.paycount.com
+ad164.popupad.net
+ad165.erasercash.com
+ad165.ezcybersearch.com
+ad165.hpg.com.br
+ad165.hpg.ig.com.br
+ad165.paycount.com
+ad165.popupad.net
+ad166.erasercash.com
+ad166.ezcybersearch.com
+ad166.hpg.com.br
+ad166.hpg.ig.com.br
+ad166.paycount.com
+ad166.popupad.net
+ad167.erasercash.com
+ad167.ezcybersearch.com
+ad167.hpg.com.br
+ad167.hpg.ig.com.br
+ad167.paycount.com
+ad167.popupad.net
+ad168.erasercash.com
+ad168.ezcybersearch.com
+ad168.hpg.com.br
+ad168.hpg.ig.com.br
+ad168.paycount.com
+ad168.popupad.net
+ad169.erasercash.com
+ad169.ezcybersearch.com
+ad169.hpg.com.br
+ad169.hpg.ig.com.br
+ad169.paycount.com
+ad169.popupad.net
+ad17.doubleclick.be
+ad17.erasercash.com
+ad17.ezcybersearch.com
+ad17.focalink.com
+ad17.hpg.com.br
+ad17.hpg.ig.com.br
+ad17.paycount.com
+ad17.popupad.net
+ad170.erasercash.com
+ad170.ezcybersearch.com
+ad170.hpg.com.br
+ad170.hpg.ig.com.br
+ad170.paycount.com
+ad170.popupad.net
+ad171.erasercash.com
+ad171.ezcybersearch.com
+ad171.hpg.com.br
+ad171.hpg.ig.com.br
+ad171.paycount.com
+ad171.popupad.net
+ad172.erasercash.com
+ad172.ezcybersearch.com
+ad172.hpg.com.br
+ad172.hpg.ig.com.br
+ad172.paycount.com
+ad172.popupad.net
+ad173.erasercash.com
+ad173.ezcybersearch.com
+ad173.hpg.com.br
+ad173.hpg.ig.com.br
+ad173.paycount.com
+ad173.popupad.net
+ad174.erasercash.com
+ad174.ezcybersearch.com
+ad174.hpg.com.br
+ad174.hpg.ig.com.br
+ad174.paycount.com
+ad174.popupad.net
+ad175.erasercash.com
+ad175.ezcybersearch.com
+ad175.hpg.com.br
+ad175.hpg.ig.com.br
+ad175.paycount.com
+ad175.popupad.net
+ad176.erasercash.com
+ad176.ezcybersearch.com
+ad176.hpg.com.br
+ad176.hpg.ig.com.br
+ad176.paycount.com
+ad176.popupad.net
+ad177.erasercash.com
+ad177.ezcybersearch.com
+ad177.hpg.com.br
+ad177.hpg.ig.com.br
+ad177.paycount.com
+ad177.popupad.net
+ad178.erasercash.com
+ad178.ezcybersearch.com
+ad178.hpg.com.br
+ad178.hpg.ig.com.br
+ad178.paycount.com
+ad178.popupad.net
+ad179.erasercash.com
+ad179.ezcybersearch.com
+ad179.hpg.com.br
+ad179.hpg.ig.com.br
+ad179.paycount.com
+ad179.popupad.net
+ad18.doubleclick.be
+ad18.erasercash.com
+ad18.ezcybersearch.com
+ad18.focalink.com
+ad18.hpg.com.br
+ad18.hpg.ig.com.br
+ad18.paycount.com
+ad18.popupad.net
+ad180.erasercash.com
+ad180.ezcybersearch.com
+ad180.hpg.com.br
+ad180.hpg.ig.com.br
+ad180.paycount.com
+ad180.popupad.net
+ad181.erasercash.com
+ad181.ezcybersearch.com
+ad181.hpg.com.br
+ad181.hpg.ig.com.br
+ad181.paycount.com
+ad181.popupad.net
+ad182.erasercash.com
+ad182.ezcybersearch.com
+ad182.hpg.com.br
+ad182.hpg.ig.com.br
+ad182.paycount.com
+ad182.popupad.net
+ad183.erasercash.com
+ad183.ezcybersearch.com
+ad183.hpg.com.br
+ad183.hpg.ig.com.br
+ad183.paycount.com
+ad183.popupad.net
+ad184.erasercash.com
+ad184.ezcybersearch.com
+ad184.hpg.com.br
+ad184.hpg.ig.com.br
+ad184.paycount.com
+ad184.popupad.net
+ad185.erasercash.com
+ad185.ezcybersearch.com
+ad185.hpg.com.br
+ad185.hpg.ig.com.br
+ad185.paycount.com
+ad185.popupad.net
+ad186.erasercash.com
+ad186.ezcybersearch.com
+ad186.hpg.com.br
+ad186.hpg.ig.com.br
+ad186.paycount.com
+ad186.popupad.net
+ad187.erasercash.com
+ad187.ezcybersearch.com
+ad187.hpg.com.br
+ad187.hpg.ig.com.br
+ad187.paycount.com
+ad187.popupad.net
+ad188.erasercash.com
+ad188.ezcybersearch.com
+ad188.hpg.com.br
+ad188.hpg.ig.com.br
+ad188.paycount.com
+ad188.popupad.net
+ad189.erasercash.com
+ad189.ezcybersearch.com
+ad189.hpg.com.br
+ad189.hpg.ig.com.br
+ad189.paycount.com
+ad189.popupad.net
+ad19.doubleclick.be
+ad19.erasercash.com
+ad19.ezcybersearch.com
+ad19.focalink.com
+ad19.hpg.com.br
+ad19.hpg.ig.com.br
+ad19.paycount.com
+ad19.popupad.net
+ad190.erasercash.com
+ad190.ezcybersearch.com
+ad190.hpg.com.br
+ad190.hpg.ig.com.br
+ad190.paycount.com
+ad190.popupad.net
+ad191.erasercash.com
+ad191.ezcybersearch.com
+ad191.hpg.com.br
+ad191.hpg.ig.com.br
+ad191.paycount.com
+ad191.popupad.net
+ad192.erasercash.com
+ad192.ezcybersearch.com
+ad192.hpg.com.br
+ad192.hpg.ig.com.br
+ad192.paycount.com
+ad192.popupad.net
+ad193.erasercash.com
+ad193.ezcybersearch.com
+ad193.hpg.com.br
+ad193.hpg.ig.com.br
+ad193.paycount.com
+ad193.popupad.net
+ad194.erasercash.com
+ad194.ezcybersearch.com
+ad194.hpg.com.br
+ad194.hpg.ig.com.br
+ad194.paycount.com
+ad194.popupad.net
+ad195.erasercash.com
+ad195.ezcybersearch.com
+ad195.hpg.com.br
+ad195.hpg.ig.com.br
+ad195.paycount.com
+ad195.popupad.net
+ad196.erasercash.com
+ad196.ezcybersearch.com
+ad196.hpg.com.br
+ad196.hpg.ig.com.br
+ad196.paycount.com
+ad196.popupad.net
+ad197.erasercash.com
+ad197.ezcybersearch.com
+ad197.hpg.com.br
+ad197.hpg.ig.com.br
+ad197.paycount.com
+ad197.popupad.net
+ad198.erasercash.com
+ad198.ezcybersearch.com
+ad198.hpg.com.br
+ad198.hpg.ig.com.br
+ad198.paycount.com
+ad198.popupad.net
+ad199.erasercash.com
+ad199.ezcybersearch.com
+ad199.hpg.com.br
+ad199.hpg.ig.com.br
+ad199.paycount.com
+ad199.popupad.net
+ad2.163.com
+ad2.adcept.net
+ad2.adnetwork.com.br
+ad2.adverticum.net
+ad2.allbanners.ru
+ad2.asit.de
+ad2.asv.de
+ad2.atlas.cz
+ad2.bannerbank.ru
+ad2.bb.ru
+ad2.billboard.cz
+ad2.billboard.sk
+ad2.dialpad.com
+ad2.doubleclick.be
+ad2.doubleclick.com
+ad2.doubleclick.net
+ad2.erasercash.com
+ad2.ezcybersearch.com
+ad2.gamezone.com
+ad2.hpg.com.br
+ad2.hpg.ig.com.br
+ad2.lbe.ru
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test2.d b/gcc/testsuite/gdc.test/runnable/extra-files/test2.d
new file mode 100644
index 00000000000..6f6589d2cc5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test2.d
@@ -0,0 +1,394 @@
+
+import object;
+import core.stdc.stdio;
+import std.algorithm;
+
+/* ================================ */
+
+class Foo
+{
+	int foo(int x) { return x + 3; }
+}
+
+class Bar : Foo
+{
+	override int foo(int y) { return y + 4; }
+}
+
+void test1()
+{
+    Bar e;
+
+    assert(e is null);
+    e = new Bar();
+    assert(e.foo(5) == 9);
+}
+
+/* ================================ */
+
+class Foo2
+{
+    int foo(int x)
+    {
+	return x + 3;
+    }
+}
+
+class Bar2 : Foo2
+{
+    override int foo(int y)
+    {
+	assert(Foo2.foo(2) == 5);
+	return y + 4;
+    }
+}
+
+void test2()
+{
+    Bar2 e;
+
+    assert(e is null);
+    e = new Bar2();
+    assert(e.foo(5) == 9);
+    assert(e.Foo2.foo(10) == 13);
+}
+
+/* ================================ */
+
+void test3()
+{
+    debug printf("debug\n");
+    debug(1) printf("debug(1)\n");
+    debug(2) printf("debug(2)\n");
+    debug(3) printf("debug(3)\n");
+    debug(bar) printf("debug(bar)\n");
+    debug(10) assert(0);
+
+    debug(1)
+    {	int d1 = 3;
+
+	printf("debug(1) { }\n");
+    }
+    debug(2)
+    {
+	printf("debug(2): d1 = %d\n", d1);
+    }
+}
+
+/* ================================ */
+
+int x1;
+int x2;
+
+class Foo4
+{
+    static  this() { x1 = 3; printf("Foo4 ctor()\n"); }
+    static ~this() { x1 = 4; printf("Foo4 dtor()\n"); }
+}
+
+static  this() { x2 = 5; printf("ctor()\n"); }
+static ~this() { x2 = 6; printf("dtor()\n"); }
+
+void test4()
+{
+    printf("x1 = %d, x2 = %d\n", x1, x2);
+    assert(x1 == 3);
+    assert(x2 == 5);
+}
+
+/* ================================ */
+
+void test5()
+{
+    printf("test5()\n");
+    static uint foo;
+    static uint x = 3;
+    static uint len = 32;
+
+    version (D_Bits)
+    {
+	bit[] bits;
+
+	bits = (cast(bit *)&foo)[0..len];
+	bits[6] = true;
+	assert(foo == (1 << 6));
+    }
+}
+
+/* ================================ */
+
+int[] test6_1(int[] a)
+{
+	a.length = 6;
+	return a;
+}
+
+void test6()
+{
+    printf("test6()\n");
+    int b[3];
+    int a[];
+
+    b[0] = 0;
+    b[1] = 1;
+    b[2] = 2;
+    assert(b.length == 3);
+    a = test6_1(b);
+    a[2] = 2;
+    assert(a.length == 6);
+}
+
+/* ================================ */
+
+class OutBuffer7
+{
+    char data[];
+    uint offset;
+
+    void write(const(char) *p, uint nbytes)
+    {
+	data[offset .. offset + nbytes] = (cast(char *)p)[0 .. nbytes];
+    }
+}
+
+
+void test7()
+{
+    printf("test7()\n");
+    int i;
+    OutBuffer7 ob = new OutBuffer7;
+
+    ob.data = new char[10];
+    printf("ob.data.length = %d\n", ob.data.length);
+    assert(ob.data.length == 10);
+    for (i = 0; i < 10; i++)
+	assert(ob.data[i] == char.init);
+
+printf("test7.1()\n");
+    ob.data[] = '-';
+printf("test7.2()\n");
+    printf("ob.data[] = '%.*s'\n", cast(int)ob.data.length, ob.data.ptr);
+    for (i = 0; i < 10; i++)
+	assert(ob.data[i] == '-');
+
+    ob.offset = 3;
+    ob.write("foo", 3);
+    printf("ob.data.length = %d\n", ob.data.length);
+    printf("ob.data[] = '%.*s'\n", cast(int)ob.data.length, ob.data.ptr);
+    for (i = 0; i < 10; i++)
+    {	if (i < 3 || i >= 6)
+	    assert(ob.data[i] == '-');
+    }
+    assert(ob.data[3] == 'f');
+    assert(ob.data[4] == 'o');
+    assert(ob.data[5] == 'o');
+}
+
+/* ================================ */
+
+class A8
+{
+    enum { bar = 8, baz }
+    int foo;
+}
+
+void test8()
+{
+    printf("test8()\n");
+    A8 a;
+    a = new A8();
+    a.foo = A8.bar;
+    assert(a.foo == 8);
+}
+
+/* ================================ */
+
+
+int z9;
+
+unittest
+{
+    printf("module unittest 9\n");
+    z9 = 3;
+}
+
+
+void test9()
+{
+    assert(z9 == 3);
+}
+
+/* ================================ */
+
+void test10()
+{
+    printf("test10()\n");
+    const int i = 8000;
+    assert(i == 8000);
+    static int j = 78;
+    assert(j == 78);
+}
+
+/* ================================ */
+
+Object test11_a()
+{
+    return null;
+}
+
+void test11()
+{
+    assert(test11_a() is null);
+}
+
+/* ================================ */
+
+class A12 { }
+class B12 { }
+
+int testx(A12 a) { return 1; }
+
+int testx(B12 b) { return 2; }
+
+void test12()
+{
+    A12 a = new A12();
+    B12 b = new B12();
+
+    assert(testx(a) == 1);
+    assert(testx(b) == 2);
+}
+
+/* ================================ */
+
+char[] tolower13(ref char[] s)
+{
+    int i;
+
+    for (i = 0; i < s.length; i++)
+    {
+	char c = s[i];
+	if ('A' <= c && c <= 'Z')
+	    s[i] = cast(char)(c + (cast(char)'a' - 'A'));
+    }
+    return s;
+}
+
+void test13()
+{
+    auto s1 = "FoL".dup;
+    char[] s2;
+
+    s2 = tolower13(s1);
+    assert(std.algorithm.cmp(s2, "fol") == 0);
+    assert(s2 == s1);
+}
+
+/* ================================ */
+
+alias ABC14* LPABC14;
+class ABC14 { }
+
+alias DEF14* LPDEF14;
+DEF14[3] foo;
+struct DEF14 { int x; }
+
+void test14()
+{
+    assert(foo.sizeof == int.sizeof * 3);
+}
+
+/* ================================ */
+
+class bits15
+{
+    bool a = true, b = true, c = true;
+    void dump()
+    {
+	printf("%d %d %d\n", a, b, c);
+    }
+}
+
+void test15()
+{
+     bits15 k = new bits15;
+     k.a = true; k.dump();
+     k.b = true; k.dump();
+     k.c = true; k.dump();
+     assert(k.a == true);
+     assert(k.b == true);
+     assert(k.c == true);
+}
+
+
+/* ================================ */
+
+align(4) struct foo16
+{
+    short s;
+    int i;
+}
+
+void test16()
+{
+    assert(foo16.sizeof == 8);
+}
+
+/* ================================ */
+
+enum Color { red, blue, green };
+int[Color.max+1] colors1 = [ Color.blue:6, Color.green:2, Color.red:5 ];
+
+
+enum { red, blue, green };
+int[3] colors2 = [ blue:6, green:2, red:5 ];
+
+void test17()
+{
+    assert(colors1.length == 3);
+    assert(colors1[0] == 5);
+    assert(colors1[1] == 6);
+    assert(colors1[2] == 2);
+    assert(colors2[0] == 5);
+    assert(colors2[1] == 6);
+    assert(colors2[2] == 2);
+}
+
+/* ================================ */
+
+class Test19 { struct { int a, b, c; } }
+
+void test19()
+{
+    Test19 t = new Test19();
+
+    t.a = 3;
+    assert(t.a == 3);
+}
+
+/* ================================ */
+
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test19();
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test35.d b/gcc/testsuite/gdc.test/runnable/extra-files/test35.d
new file mode 100644
index 00000000000..ec831765996
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test35.d
@@ -0,0 +1,7 @@
+import imports.test35a;
+
+void main()
+{
+    auto num = removeIf( "abcdef".dup, ( char c ) { return c == 'c'; } );
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test39.d b/gcc/testsuite/gdc.test/runnable/extra-files/test39.d
new file mode 100644
index 00000000000..dd05b1b3529
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test39.d
@@ -0,0 +1,10 @@
+
+//pragma (lib, "a39.lib");
+
+import imports.test39a;
+
+void main()
+{
+        auto t = new Test!(char);
+        t.show ("hello");
+} 
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test44.d b/gcc/testsuite/gdc.test/runnable/extra-files/test44.d
new file mode 100644
index 00000000000..e7e1db369cf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test44.d
@@ -0,0 +1,19 @@
+
+import imports.test44a;
+
+const char[][7] DAY_NAME = [
+        DAY.SUN: "sunday", "monday", "tuesday", "wednesday",
+          "thursday", "friday", "saturday"
+];
+
+
+void main()
+{
+    assert(DAY_NAME[DAY.SUN] == "sunday");
+    assert(DAY_NAME[DAY.MON] == "monday");
+    assert(DAY_NAME[DAY.TUE] == "tuesday");
+    assert(DAY_NAME[DAY.WED] == "wednesday");
+    assert(DAY_NAME[DAY.THU] == "thursday");
+    assert(DAY_NAME[DAY.FRI] == "friday");
+    assert(DAY_NAME[DAY.SAT] == "saturday");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/test_shared.d b/gcc/testsuite/gdc.test/runnable/extra-files/test_shared.d
new file mode 100644
index 00000000000..919810306a4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/test_shared.d
@@ -0,0 +1,3 @@
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/teststdio.txt b/gcc/testsuite/gdc.test/runnable/extra-files/teststdio.txt
new file mode 100644
index 00000000000..9a5f6b1290d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/teststdio.txt
@@ -0,0 +1,6 @@
+asdfasdf
+a
+sdf
+asdf
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/extra-files/untag.html b/gcc/testsuite/gdc.test/runnable/extra-files/untag.html
new file mode 100644
index 00000000000..cec0c87a114
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/extra-files/untag.html
@@ -0,0 +1,555 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+	<!-- headlinks removed -->
+	<link rel="shortcut icon" href="../../../../misc/favicon.ico"/>
+    <title>Abbott and Costello Meet Frankenstein - Wikipedia, the free encyclopedia</title>
+    <style type="text/css">/*<![CDATA[*/ @import "../../../../skins/offline/main.css"; /*]]>*/</style>
+    <link rel="stylesheet" type="text/css" media="print" href="../../../../skins/common/commonPrint.css" />
+    <!--[if lt IE 5.5000]><style type="text/css">@import "../../../../skins/monobook/IE50Fixes.css";</style><![endif]-->
+    <!--[if IE 5.5000]><style type="text/css">@import "../../../../skins/monobook/IE55Fixes.css";</style><![endif]-->
+    <!--[if IE 6]><style type="text/css">@import "../../../../skins/monobook/IE60Fixes.css";</style><![endif]-->
+    <!--[if IE]><script type="text/javascript" src="../../../../skins/common/IEFixes.js"></script>
+    <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
+    <script type="text/javascript" src="../../../../skins/common/wikibits.js"></script>
+    <script type="text/javascript" src="../../../../skins/offline/md5.js"></script>
+    <script type="text/javascript" src="../../../../skins/offline/utf8.js"></script>
+    <script type="text/javascript" src="../../../../skins/offline/lookup.js"></script>
+    <script type="text/javascript" src="../../../../raw/gen.js"></script>        <style type="text/css">/*<![CDATA[*/
+@import "../../../../raw/MediaWiki%7ECommon.css";
+@import "../../../../raw/MediaWiki%7EMonobook.css";
+@import "../../../../raw/gen.css";
+/*]]>*/</style>          </head>
+  <body
+    class="ns-0">
+    <div id="globalWrapper">
+      <div id="column-content">
+	<div id="content">
+	  <a name="top" id="contentTop"></a>
+	        <h1 class="firstHeading">Abbott and Costello Meet Frankenstein</h1>
+	  <div id="bodyContent">
+	    <h3 id="siteSub">From Wikipedia, the free encyclopedia</h3>
+	    <div id="contentSub"></div>
+	    	    	    <!-- start content -->
+	    <table class="infobox vevent" style="width:20em; text-align:left; font-size:90%;" cellspacing="2">
+<tr>
+<th class="summary" style="font-size: 110%; text-align: center;" colspan="2"><i>Abbott and Costello Meet Frankenstein</i></th>
+</tr>
+<tr>
+<td style="font-size: 95%; line-height:1.5em; text-align: center;" colspan="2"><a href="../../../../articles/a/%26/c/Image%7EA%26cfrank.jpg_1a86.html" class="image" title="A&amp;cfrank.jpg"><img alt="" src="../../../../images/local/thumb/2/23/A&amp;cfrank.jpg/200px-A&amp;cfrank.jpg" width="200" height="303" border="0" /></a><br />
+<i>Abbott and Costello Meet Frankenstein</i> Theatrical Poster</td>
+</tr>
+<tr class="description">
+<th>Directed by</th>
+<td><a href="../../../../articles/c/h/a/Charles_Barton_f649.html" title="Charles Barton">Charles Barton</a></td>
+</tr>
+<tr>
+<th>Produced&#160;by</th>
+<td>Robert Arthur</td>
+</tr>
+<tr>
+<th>Written&#160;by</th>
+<td><a href="../../../../articles/r/o/b/Robert_Lees_4940.html" title="Robert Lees">Robert Lees</a><br />
+Frederic I. Rinaldo<br />
+John Grant</td>
+</tr>
+<tr>
+<th>Starring</th>
+<td><a href="../../../../articles/b/u/d/Bud_Abbott_cd1f.html" title="Bud Abbott">Bud Abbott</a><br />
+<a href="../../../../articles/l/o/u/Lou_Costello_553d.html" title="Lou Costello">Lou Costello</a><br />
+<a href="../../../../articles/l/o/n/Lon_Chaney%2C_Jr._3ef0.html" title="Lon Chaney, Jr.">Lon Chaney, Jr.</a><br />
+<a href="../../../../articles/b/e/l/Bela_Lugosi_59d1.html" class="mw-redirect" title="Bela Lugosi">Bela Lugosi</a><br />
+<a href="../../../../articles/g/l/e/Glenn_Strange_7693.html" title="Glenn Strange">Glenn Strange</a></td>
+</tr>
+<tr>
+<th>Music&#160;by</th>
+<td><a href="../../../../articles/f/r/a/Frank_Skinner_%28composer%29_103e.html" title="Frank Skinner (composer)">Frank Skinner</a></td>
+</tr>
+<tr>
+<th>Editing&#160;by</th>
+<td>Frank Gross</td>
+</tr>
+<tr>
+<th>Distributed&#160;by</th>
+<td><a href="../../../../articles/u/n/i/Universal_International_4c70.html" class="mw-redirect" title="Universal International">Universal International</a></td>
+</tr>
+<tr>
+<th>Release&#160;date(s)</th>
+<td><a href="../../../../articles/j/u/n/June_15.html" title="June 15">June 15</a>, <a href="../../../../articles/1/9/4/1948.html" title="1948">1948</a> (U.S. release)</td>
+</tr>
+<tr>
+<th>Running time</th>
+<td>83 min.</td>
+</tr>
+<tr>
+<th>Language</th>
+<td><a href="../../../../articles/e/n/g/English_language.html" title="English language">English</a></td>
+</tr>
+<tr>
+<th>Budget</th>
+<td>$760,000</td>
+</tr>
+<tr>
+<th>Preceded&#160;by</th>
+<td><i><a href="../../../../articles/h/o/u/House_of_Dracula_f4bb.html" title="House of Dracula">House of Dracula</a></i> (<a href="../../../../articles/1/9/4/1945_in_film.html" title="1945 in film">1945</a>)<br />
+<i><a href="../../../../articles/t/h/e/The_Invisible_Man%27s_Revenge_98c7.html" title="The Invisible Man's Revenge">The Invisible Man's Revenge</a></i> (<a href="../../../../articles/1/9/4/1944_in_film.html" title="1944 in film">1944</a>)<br />
+<i><a href="../../../../articles/t/h/e/The_Noose_Hangs_High_a16d.html" title="The Noose Hangs High">The Noose Hangs High</a></i> (<a href="../../../../articles/1/9/4/1948_in_film.html" title="1948 in film">1948</a>)</td>
+</tr>
+<tr>
+<th>Followed&#160;by</th>
+<td><i><a href="../../../../articles/m/e/x/Mexican_Hayride_c692.html" title="Mexican Hayride">Mexican Hayride</a></i> (<a href="../../../../articles/1/9/4/1948_in_film.html" title="1948 in film">1948</a>)<br />
+<i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Invisible_Man_c511.html" title="Abbott and Costello Meet the Invisible Man">Abbott and Costello Meet the Invisible Man</a></i> (<a href="../../../../articles/1/9/5/1951_in_film.html" title="1951 in film">1951</a>)</td>
+</tr>
+</table>
+<p><b>Abbott and Costello Meet Frankenstein</b> (onscreen title: <i>Bud Abbott Lou Costello Meet Frankenstein</i>) is a <a href="../../../../articles/1/9/4/1948_in_film.html" title="1948 in film">1948</a> <a href="../../../../articles/c/o/m/Comedy_film.html" title="Comedy film">comedy</a>/<a href="../../../../articles/h/o/r/Horror_film.html" title="Horror film">horror film</a> <a href="../../../../articles/f/i/l/Film_director.html" title="Film director">directed</a> by <a href="../../../../articles/c/h/a/Charles_Barton_f649.html" title="Charles Barton">Charles Barton</a> and starring the comedy team of <a href="../../../../articles/a/b/b/Abbott_and_Costello_fa65.html" title="Abbott and Costello">Abbott and Costello</a>.</p>
+<p>This is the first of several films where the comedy duo meets classic characters from <a href="../../../../articles/u/n/i/Universal_Studios_23de.html" title="Universal Studios">Universal</a>'s film stable. In the film, they encounter <a href="../../../../articles/d/r/a/Dracula.html" title="Dracula">Dracula</a>, <a href="../../../../articles/f/r/a/Frankenstein%27s_monster.html" title="Frankenstein's monster">Frankenstein's monster</a>, and the <a href="../../../../articles/t/h/e/The_Wolf_Man_%281941_film%29_e5e9.html" title="The Wolf Man (1941 film)">Wolf Man</a>. Subsequent films pair the duo with <a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Mummy_0243.html" title="Abbott and Costello Meet the Mummy">the Mummy</a>, the <a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Keystone_Kops_a436.html" title="Abbott and Costello Meet the Keystone Kops">Keystone Kops</a>, and the <a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Invisible_Man_c511.html" title="Abbott and Costello Meet the Invisible Man">Invisible Man</a>. On a TV special in the early 1950s, the comedy duo did a sketch where they interacted with the latest original Universal Studios monster being promoted at the time, the Creature from the Black Lagoon.</p>
+<p>The film is considered the swan song for the "Big Three" Universal horror monsters – Dracula, the Wolf Man and Frankenstein's monster – although it does not appear to fit within the loose continuity of the earlier films.</p>
+<p>The film was re-released in <a href="../../../../articles/1/9/5/1956.html" title="1956">1956</a> along with <i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Killer%2C_Boris_Karloff_0b24.html" title="Abbott and Costello Meet the Killer, Boris Karloff">Abbott and Costello Meet the Killer, Boris Karloff</a></i>.</p>
+<p>In 2001, the United States <a href="../../../../articles/l/i/b/Library_of_Congress_f2f1.html" title="Library of Congress">Library of Congress</a> deemed this film "culturally, historically, or aesthetically significant" and selected it for preservation in the <a href="../../../../articles/n/a/t/National_Film_Registry_0c8c.html" title="National Film Registry">National Film Registry</a>.</p>
+<p>In September 2007, Reader’s Digest selected the movie as one of the top 100 funniest films of all time.</p>
+<table id="toc" class="toc" summary="Contents">
+<tr>
+<td>
+<div id="toctitle">
+<h2>Contents</h2>
+</div>
+<ul>
+<li class="toclevel-1"><a href="#Plot"><span class="tocnumber">1</span> <span class="toctext">Plot</span></a></li>
+<li class="toclevel-1"><a href="#Cast"><span class="tocnumber">2</span> <span class="toctext">Cast</span></a></li>
+<li class="toclevel-1"><a href="#Production"><span class="tocnumber">3</span> <span class="toctext">Production</span></a></li>
+<li class="toclevel-1"><a href="#Film_mistakes"><span class="tocnumber">4</span> <span class="toctext">Film mistakes</span></a></li>
+<li class="toclevel-1"><a href="#Cultural_references"><span class="tocnumber">5</span> <span class="toctext">Cultural references</span></a></li>
+<li class="toclevel-1"><a href="#Routines"><span class="tocnumber">6</span> <span class="toctext">Routines</span></a></li>
+<li class="toclevel-1"><a href="#DVD_releases"><span class="tocnumber">7</span> <span class="toctext">DVD releases</span></a></li>
+<li class="toclevel-1"><a href="#Notes"><span class="tocnumber">8</span> <span class="toctext">Notes</span></a></li>
+<li class="toclevel-1"><a href="#External_links"><span class="tocnumber">9</span> <span class="toctext">External links</span></a></li>
+</ul>
+</td>
+</tr>
+</table>
+<script type="text/javascript">
+//<![CDATA[
+ if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } 
+//]]>
+</script>
+<p><a name="Plot" id="Plot"></a></p>
+<h2><span class="editsection">[<a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html" title="Edit section: Plot">edit</a>]</span> <span class="mw-headline">Plot</span></h2>
+<p>Chick Young (<a href="../../../../articles/b/u/d/Bud_Abbott_cd1f.html" title="Bud Abbott">Bud Abbott</a>) and Wilbur Grey (<a href="../../../../articles/l/o/u/Lou_Costello_553d.html" title="Lou Costello">Lou Costello</a>) work as baggage clerks in LaMirada, Florida. When Wilbur mishandles two crates belonging to 'MacDougal's House of Horrors' museum, Mr. MacDougal (<a href="../../../../articles/f/r/a/Frank_Ferguson_a96e.html" title="Frank Ferguson">Frank Ferguson</a>) demands that they deliver them in person so that they can be inspected by an insurance agent. MacDougal boasts to Wilbur's girlfriend, Dr. Sandra Mornay (Lénore Aubert), that the crates contain "the remains of the original Count Dracula" (<a href="../../../../articles/b/e/l/Bela_Lugosi_59d1.html" class="mw-redirect" title="Bela Lugosi">Bela Lugosi</a>) and "the body of the Frankenstein Monster" (<a href="../../../../articles/g/l/e/Glenn_Strange_7693.html" title="Glenn Strange">Glenn Strange</a>).</p>
+<p>Dracula awakens, hypnotizes Wilbur, and spirits away his own coffin (and the revived Monster) before anyone else sees them. MacDougal then arrives with the insurance agent. Finding the storage crates empty, he accuses the boys of theft and has them arrested.</p>
+<p>Mornay receives Dracula and the Monster at her island castle. Sandra is a gifted surgeon who has studied Dr. Frankenstein's notebooks, and has been posing as Wilbur's girlfriend as part of Dracula's scheme to replace the Monster's brutish brain with one more pliable — Wilbur's.</p>
+<p>Wilbur and Chick are bailed out of jail and mistakenly believe Sandra to be their benefactor. Actually Joan Raymond (<a href="../../../../articles/j/a/n/Jane_Randolph_7069.html" title="Jane Randolph">Jane Randolph</a>), who also seems to like Wilbur, is responsible for the good deed. Joan is secretly working for the company that is processing MacDougal's insurance claim, and hopes Wilbur will lead her to the missing 'exhibits'.</p>
+<p>Meanwhile, Larry Talbot (<a href="../../../../articles/l/o/n/Lon_Chaney%2C_Jr._3ef0.html" title="Lon Chaney, Jr.">Lon Chaney, Jr.</a>) has taken the apartment across the hall from Wilbur and Chick. He has tracked Dracula and the Monster from Europe, and knows them to be alive. Talbot asks the boys to help him find and destroy the villains. Wilbur is amenable to the plan, but Chick thinks both of them are crazy. Talbot's desperate insistence that he be locked in his room before moonrise impresses Chick even less.</p>
+<p>The following night, Wilbur, Chick and Joan go to Sandra's castle to pick her up for a costume ball. Sandra has told Wilbur to come alone, and receives the extra guests rather icily.</p>
+<p>While the ladies powder their noses, Wilbur answers a telephone call from someone wanting to speak to a 'Dr Lejos'. It is Talbot, who informs them that they are in the "house of Dracula". Wilbur reluctantly agrees to search the castle with Chick, and soon stumbles upon an underground passageway, complete with boat and dock. Behind a secret revolving wall, Wilbur again encounters Dracula and the Monster, but escapes. Wilbur's every attempt to get Chick to witness the villains fails - thanks to the revolving wall. Meanwhile, Joan has discovered Dr Frankenstein's notebook in Sandra's bureau, while Sandra has discovered Joan's employee I.D. in her bag.</p>
+<p>Suavely reattired, Dracula (a.k.a. Dr. Lejos) is introduced by Sandra to Joan and the boys. He commends Sandra on her 'choice', expertly massaging the ego of Wilbur, who does not realize the true context of the remark. Also working at the castle is the naive Dr. Stevens (Charles Bradstreet), who questions some of the specialized equipment that has arrived. Dracula manages to deflect Dr. Stevens' questions by pairing him with Joan and shooing off the 'young people' to their ball. Sandra claims to have a sudden splitting headache and will not be able to attend the event. When Dracula consults Sandra in private, she admits that Dr. Stevens' questions, Joan's insurance credentials and Wilbur's inquiries have made her nervous, and wants to postpone the experiments. Impatient, Dracula asserts his will by hypnotizing her, and biting her in the throat.</p>
+<p>At the ball, the boys encounter Talbot and MacDougal. Dracula arrives unexpectedly with Sandra, now under his spell. Dracula easily deflects Talbot's accusations, making the man appear disturbed. Dracula takes Joan for a dance while Sandra lures Wilbur to a quiet spot. Just before she can bite Wilbur's neck, Chick and Larry approach looking for Joan, and Sandra flees. As they search the grounds, Talbot transforms into the Wolf Man. Wilbur escapes, but the Wolf Man finds and injures MacDougal. Later noting that Chick is costumed as a werewolf, MacDougal concludes that Chick attacked him for revenge. (The fact that Chick is dressed like Talbot certainly does not help the situation). Chick manages to slip away, only to witness Dracula hypnotizing Wilbur. Chick becomes somewhat hypnotized himself, while Wilbur and an entranced Joan are brought back to the castle by Dracula and Sandra. The next morning, Chick is still on the lam when he finds Larry, who confesses that he was MacDougal's attacker. Now finally convinced, Chick agrees to help Larry rescue Wilbur and Joan.</p>
+<p>While Wilbur is being held in a pillory, Sandra finally explains to him the plan to transplant his brain into the Monster. She and Dracula leave him to prepare the Monster for the operation. Chick and Talbot arrive, free Wilbur, and head off to save Joan. Wilbur, meanwhile, is lured back to the castle by Dracula, who easily overpowers his mind.</p>
+<p>While the Monster receives an electrical boost in the lab, Sandra is about to open Wilbur's skull when Talbot storms in and casts her aside. Chick fends off Dracula with a chair, lifting it over his head to swing it at the vampire and inadvertently knocking out Sandra in the process. But just as Talbot is about to untie Wilbur, he once again transforms into the Wolf Man.</p>
+<p>Dracula returns to the scene, only to have a tug-of-war with the Wolf Man over Wilbur's gurney. Dracula flees, with the Wolf Man giving chase. Chick arrives to untie Wilbur just as the Monster, now fully recovered, breaks his own restraints and rises from his stretcher. Sandra attempts to order him back as Dracula does, but the Monster defiantly tosses her out a window.</p>
+<p>Dr. Stevens, meanwhile, has managed to find Joan and gets her to the boat. Dracula, in an attempt to escape, transforms into a bat, but the Wolf Man snares him and both fall over a balcony and into the rocky seas below. Joan abruptly wakes from her trance, while the boys escape the castle and head to the pier, with the Monster in pursuit. Once again Chick and Wilbur encounter Mr. MacDougal, who still insists that he wants his exhibits. They loudly reply, "..here comes one of them now!" When the Monster appears, MacDougal and his partner jump off the pier. Chick and Wilbur attempt to escape in a rowboat that is securely tied to the pier. The Monster throws barrels at them, in a series of near misses. Wilbur finally unties the boat, while Stevens and Joan arrive and set the pier ablaze. The Monster turns around and marches into the flames, slowing and succumbing as the pier collapses into the water.</p>
+<p>Just as Chick and Wilbur relax, they hear a disembodied voice (<a href="../../../../articles/v/i/n/Vincent_Price_ab84.html" title="Vincent Price">Vincent Price</a>) and see a cigarette floating in the air: "Allow me to introduce myself, I'm the <a href="../../../../articles/i/n/v/Invisible_Man_894b.html" title="Invisible Man">Invisible Man</a>!" The boys jump off the boat and swim away as the Invisible Man lights his cigarette and laughs. (This scene presaged 1951's <i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Invisible_Man_c511.html" title="Abbott and Costello Meet the Invisible Man">Abbott and Costello Meet the Invisible Man</a></i>, though Price did not star, and all characters were different.</p>
+<p><a name="Cast" id="Cast"></a></p>
+<h2><span class="editsection">[<a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html" title="Edit section: Cast">edit</a>]</span> <span class="mw-headline">Cast</span></h2>
+<ul>
+<li><a href="../../../../articles/b/u/d/Bud_Abbott_cd1f.html" title="Bud Abbott">Bud Abbott</a> as Chick Young</li>
+<li><a href="../../../../articles/l/o/u/Lou_Costello_553d.html" title="Lou Costello">Lou Costello</a> as Wilbur Grey</li>
+<li><a href="../../../../articles/l/o/n/Lon_Chaney%2C_Jr._3ef0.html" title="Lon Chaney, Jr.">Lon Chaney, Jr.</a> as Larry Talbot, the <a href="../../../../articles/t/h/e/The_Wolf_Man_%281941_film%29_e5e9.html" title="The Wolf Man (1941 film)">Wolfman</a></li>
+<li><a href="../../../../articles/b/e/l/Bela_Lugosi_59d1.html" class="mw-redirect" title="Bela Lugosi">Bela Lugosi</a> as <a href="../../../../articles/c/o/u/Count_Dracula_0c41.html" title="Count Dracula">Count Dracula</a></li>
+<li><a href="../../../../articles/g/l/e/Glenn_Strange_7693.html" title="Glenn Strange">Glenn Strange</a> as the <a href="../../../../articles/f/r/a/Frankenstein.html" title="Frankenstein">Frankenstein</a> Monster<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup></li>
+<li>Lenore Aubert as Dr. Sandra Mornay</li>
+<li><a href="../../../../articles/j/a/n/Jane_Randolph_7069.html" title="Jane Randolph">Jane Randolph</a> as Joan Raymond</li>
+<li>Charles Bradstreet as Dr. Stevens</li>
+</ul>
+<p><a name="Production" id="Production"></a></p>
+<h2><span class="editsection">[<a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html" title="Edit section: Production">edit</a>]</span> <span class="mw-headline">Production</span></h2>
+<p>The film was originally intended to be titled <i>The Brain of Frankenstein</i>, but its name was changed prior to the filming schedule, which ran from <a href="../../../../articles/f/e/b/February_5.html" title="February 5">February 5</a> through <a href="../../../../articles/m/a/r/March_20.html" title="March 20">March 20</a>, 1948.</p>
+<p><a href="../../../../articles/w/a/l/Walter_Lantz_d857.html" title="Walter Lantz">Walter Lantz</a>, noted for the creation of <a href="../../../../articles/w/o/o/Woody_Woodpecker_3063.html" title="Woody Woodpecker">Woody Woodpecker</a>, provided the animation for Dracula's transformations.</p>
+<p>In a <a href="../../../../articles/1/9/9/1996.html" title="1996">1996</a> documentary, <i>100 Years of Horror</i>, hosted by <a href="../../../../articles/c/h/r/Christopher_Lee_b095.html" title="Christopher Lee">Christopher Lee</a>, it was revealed that the studio hired two additional comedians to add laughs between takes on the set.</p>
+<p>Costello hated the script for <i>Abbott and Costello Meet Frankenstein</i>.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1" title="">[2]</a></sup> He said that his five-year-old daughter could have written something better, but later warmed to the film during production.</p>
+<p>During the filming of <i>Abbott and Costello Meet Frankenstein</i>, Glenn Strange found Costello so funny he would often break up laughing, necessitating many retakes. There were several pie fights between takes as well, but Abbott and Costello respected the three monsters (Chaney as the Wolfman, Lugosi as Dracula and Strange as the Monster) and made sure no pies were flung at the heavily made-up actors.</p>
+<p><a href="../../../../articles/b/o/r/Boris_Karloff_4d96.html" title="Boris Karloff">Boris Karloff</a> was originally approached to play the monster once again, but declined. He did, however, help promote the movie and can be seen in several publicity photos, including one where he is buying a ticket, even though he refused to actually see the film (considering it an insult).</p>
+<p>The Australian film board required that almost every scene involving a monster should be removed before release.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2" title="">[3]</a></sup></p>
+<p><a name="Film_mistakes" id="Film_mistakes"></a></p>
+<h2><span class="editsection">[<a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html" title="Edit section: Film mistakes">edit</a>]</span> <span class="mw-headline">Film mistakes</span></h2>
+<p>At one point in the film, where Abbott and Costello's characters are going through the revolving panel, Costello calls Abbott by his real name instead of his character's name. In addition, although the film is titled <i>Abbott and Costello Meet Frankenstein</i>, there is no character named Frankenstein in this movie. He is referenced for his work in bringing his creature to life, but the character himself does not appear. In addition, <a href="../../../../articles/d/r/a/Dracula.html" title="Dracula">Dracula</a>'s <a href="../../../../articles/r/e/f/Reflection.html" title="Reflection">reflection</a> can be seen in the mirror when he makes the <a href="../../../../articles/n/u/r/Nurse.html" title="Nurse">nurse</a> his next victim. The studio intended to remove the reflection, but failed to do before the theatrical release, and to this day can still be seen in the movie.</p>
+<p><a name="Cultural_references" id="Cultural_references"></a></p>
+<h2><span class="editsection">[<a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html" title="Edit section: Cultural references">edit</a>]</span> <span class="mw-headline">Cultural references</span></h2>
+<table class="metadata plainlinks ambox ambox-style" style="margin: auto;">
+<tr>
+<td class="ambox-image">
+<div style="width: 52px;"><a href="../../../../articles/a/m/b/Image%7EAmbox_style.png_780a.html" class="image" title="Ambox style.png"><img alt="" src="../../../../images/local/d/d6/Ambox_style.png" width="40" height="40" border="0" /></a></div>
+</td>
+<td class="ambox-text" style="width:auto;"><b><a href="../../../../articles/t/r/i/Wikipedia%7ETrivia_sections_49e9.html" title="Wikipedia:Trivia sections">Trivia sections are discouraged</a></b> under <a href="../../../../articles/p/o/l/Wikipedia%7EPolicies_and_guidelines_cdad.html" title="Wikipedia:Policies and guidelines">Wikipedia guidelines</a>.<br />
+<small>The article could be improved by <a href="../../../../articles/h/a/n/Wikipedia%7EHandling_trivia_c9aa.html#Recommendations_for_handling_trivia" title="Wikipedia:Handling trivia">integrating</a> relevant items and removing <a href="../../../../articles/w/h/a/Wikipedia%7EWhat_Wikipedia_is_not_86da.html" title="Wikipedia:What Wikipedia is not">inappropriate</a> ones.</small></td>
+</tr>
+</table>
+<ul>
+<li>In a <a href="../../../../articles/2/0/0/2006.html" title="2006">2006</a> episode of Iconoclasts on the <a href="../../../../articles/s/u/n/Sundance_Channel_764e.html" title="Sundance Channel">Sundance Channel</a>, <a href="../../../../articles/q/u/e/Quentin_Tarantino_858b.html" title="Quentin Tarantino">Quentin Tarantino</a> cited the film as his favorite childhood movie because "when it was supposed to be funny, it was really funny, and when it was supposed to be scary, it was really scary."</li>
+<li>The film was unofficially remade in Mexico as <i>Frankenstein, el Vampiro y Compañía</i> (1962) and in Egypt as <i>Haram Alek</i> (1953).<sup id="cite_ref-3" class="reference"><a href="#cite_note-3" title="">[4]</a></sup></li>
+<li>In the <i><a href="../../../../articles/e/n/t/Star_Trek%7E_Enterprise_849e.html" title="Star Trek: Enterprise">Star Trek: Enterprise</a></i> episode "<a href="../../../../articles/h/o/r/Horizon_%28Enterprise_episode%29_6d7c.html" class="mw-redirect" title="Horizon (Enterprise episode)">Horizon</a>", <a href="../../../../articles/t/r/i/Trip_Tucker_96a0.html" class="mw-redirect" title="Trip Tucker">Trip Tucker</a> wanted to show the film.</li>
+<li>In an episode of <i><a href="../../../../articles/h/o/m/Home_Improvement_0a18.html" class="mw-redirect" title="Home Improvement">Home Improvement</a></i> in which Mark is putting together a project for <a href="../../../../articles/f/i/l/Film.html" title="Film">film</a> class, after Tim tells his other sons that film was something he himself appreciated in school, Randy sarcastically quips back that his favorite movie was <i>Abbott and Costello Meet Frankenstein</i>.<sup class="noprint Template-Fact"><span title="This claim needs references to reliable sources&#160;since February 2008" style="white-space: nowrap;">[<i><a href="../../../../articles/c/i/t/Wikipedia%7ECitation_needed_0174.html" title="Wikipedia:Citation needed">citation needed</a></i>]</span></sup></li>
+<li>In 1954, an Egyptian film studio created Ismil and Abdel Meet Frankenstein, a scene-for-scene <a href="../../../../articles/r/e/m/Remake.html" title="Remake">remake</a> of the 1948 classic. This version is not commercially available on <a href="../../../../articles/d/v/d/DVD_1991.html" title="DVD">DVD</a>, but is scheduled for a public film showing at the <a href="../../../../articles/m/i/d/Mid-Atlantic_Nostalgia_Convention_a12f.html" title="Mid-Atlantic Nostalgia Convention">Mid-Atlantic Nostalgia Convention</a> in <a href="../../../../articles/s/e/p/September.html" title="September">September</a> <a href="../../../../articles/2/0/0/2008.html" title="2008">2008</a>.</li>
+</ul>
+<p><a name="Routines" id="Routines"></a></p>
+<h2><span class="editsection">[<a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html" title="Edit section: Routines">edit</a>]</span> <span class="mw-headline">Routines</span></h2>
+<p>The <i>Moving Candle</i> routine previously used in <i><a href="../../../../articles/h/o/l/Hold_That_Ghost_5d90.html" title="Hold That Ghost">Hold That Ghost</a></i> was utilized again in this film.</p>
+<p><a name="DVD_releases" id="DVD_releases"></a></p>
+<h2><span class="editsection">[<a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html" title="Edit section: DVD releases">edit</a>]</span> <span class="mw-headline">DVD releases</span></h2>
+<table class="gallery" cellspacing="0" cellpadding="0">
+<tr>
+<td>
+<div class="gallerybox" style="width: 155px;">
+<div class="thumb" style="padding: 13px 0; width: 150px;">
+<div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="../../../../articles/m/o/v/Image%7EMovie_DVD_cover_abbott_%26_costello_meet_frankenstein.jpg_4342.html" class="image" title="Movie DVD cover abbott &amp; costello meet frankenstein.jpg"><img alt="" src="../../../../images/local/thumb/4/46/Movie_DVD_cover_abbott_&amp;_costello_meet_frankenstein.jpg/85px-Movie_DVD_cover_abbott_&amp;_costello_meet_frankenstein.jpg" width="85" height="120" border="0" /></a></div>
+</div>
+<div class="gallerytext">
+<center>August 29, 2000</center>
+</div>
+</div>
+</td>
+<td>
+<div class="gallerybox" style="width: 155px;">
+<div class="thumb" style="padding: 13px 0; width: 150px;">
+<div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="../../../../articles/a/%26/c/Image%7EA%26cdvd3.jpg_6f62.html" class="image" title="A&amp;cdvd3.jpg"><img alt="" src="../../../../images/local/thumb/5/55/A&amp;cdvd3.jpg/84px-A&amp;cdvd3.jpg" width="84" height="120" border="0" /></a></div>
+</div>
+<div class="gallerytext">
+<center>August 3, 2004</center>
+</div>
+</div>
+</td>
+</tr>
+</table>
+<p><a name="Notes" id="Notes"></a></p>
+<h2><span class="editsection">[<a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html" title="Edit section: Notes">edit</a>]</span> <span class="mw-headline">Notes</span></h2>
+<div class="references-small">
+<ol class="references">
+<li id="cite_note-0"><b><a href="#cite_ref-0" title="">^</a></b> The monster is actually played by two actors. Glenn Strange plays him for most of the film, but when he broke his foot during production, Lon Chaney, Jr. (who previously played the monster in <i><a href="../../../../articles/t/h/e/The_Ghost_of_Frankenstein_9d19.html" title="The Ghost of Frankenstein">The Ghost of Frankenstein</a></i>), took over the role for a portion of the laboratory battle sequence.</li>
+<li id="cite_note-1"><b><a href="#cite_ref-1" title="">^</a></b> Furmanek, Bob and Ron Palumbo (1991). <i>Abbott and Costello in Hollywood</i>. New York: Perigee Books. <a href="../../../../articles/b/o/o/Special%7EBookSources_0399516050_5a3e.html" class="internal">ISBN 0-399-51605-0</a></li>
+<li id="cite_note-2"><b><a href="#cite_ref-2" title="">^</a></b> Furmanek, Bob and Ron Palumbo (1991). <i>Abbott and Costello in Hollywood</i>. New York: Perigee Books. <a href="../../../../articles/b/o/o/Special%7EBookSources_0399516050_5a3e.html" class="internal">ISBN 0-399-51605-0</a></li>
+<li id="cite_note-3"><b><a href="#cite_ref-3" title="">^</a></b> <a href="http://frankensteinia.blogspot.com/2007/09/frankenstein-gets-knocked-off.html" class="external text" title="http://frankensteinia.blogspot.com/2007/09/frankenstein-gets-knocked-off.html" rel="nofollow">Frankensteinia: The Frankenstein Blog: Frankenstein Gets Knocked-Off</a></li>
+</ol>
+</div>
+<p><a name="External_links" id="External_links"></a></p>
+<h2><span class="editsection">[<a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html" title="Edit section: External links">edit</a>]</span> <span class="mw-headline">External links</span></h2>
+<ul>
+<li><a href="http://www.imdb.com/title/tt0040068/" class="external text" title="http://www.imdb.com/title/tt0040068/" rel="nofollow"><i>Abbott and Costello Meet Frankenstein</i></a> at the <a href="../../../../articles/i/n/t/Internet_Movie_Database_7ea7.html" title="Internet Movie Database">Internet Movie Database</a></li>
+<li><a href="http://www.allmovie.com/cg/avg.dll?p=avg&amp;sql=1:574" class="external text" title="http://www.allmovie.com/cg/avg.dll?p=avg&amp;sql=1:574" rel="nofollow"><i>Abbott and Costello Meet Frankenstein</i></a> at <a href="../../../../articles/a/l/l/Allmovie.html" title="Allmovie">Allmovie</a></li>
+</ul>
+<table class="navbox" cellspacing="0" style=";">
+<tr>
+<td style="padding:2px;">
+<table cellspacing="0" class="nowraplinks collapsible autocollapse" style="width:100%;background:transparent;color:inherit;;">
+<tr>
+<th style=";" colspan="2" class="navbox-title">
+<div style="float:left; width:6em;text-align:left;">
+<div class="noprint plainlinksneverexpand" style="background-color:transparent; padding:0; white-space:nowrap; font-weight:normal; font-size:xx-small;&#160;;;border:none;;"><a href="../../../../articles/a/b/b/Template%7EAbbott_and_Costello_8f59.html" title="Template:Abbott and Costello"><span title="View this template" style=";;border:none;;">v</span></a>&#160;<span style="font-size:80%;">•</span>&#160;<a href="../../../../articles/a/b/b/Template_talk%7EAbbott_and_Costello_ba36.html" title="Template talk:Abbott and Costello"><span style="color:#002bb8;;;border:none;;" title="Discussion about this template">d</span></a>&#160;<span style="font-size:80%;">•</span>&#160;<a href="http://en.wikipedia.org../../../../articles/a/b/b/Template%7EAbbott_and_Costello_8f59.html" class="external text" title="http://en.wikipedia.org../../../../articles/a/b/b/Template%7EAbbott_and_Costello_8f59.html" rel="nofollow"><span style="color:#002bb8;;;border:none;;" title="You can edit this template. Please use the preview button before saving.">e</span></a></div>
+</div>
+<span style="font-size:110%;"><a href="../../../../articles/a/b/b/Abbott_and_Costello_fa65.html" title="Abbott and Costello">Abbott and Costello</a></span></th>
+</tr>
+<tr style="height:2px;">
+<td></td>
+</tr>
+<tr>
+<td colspan="2" style="width:100%;padding:0px;;;" class="navbox-list navbox-odd">
+<div style="padding:0em 0.25em"><span style="white-space:nowrap;"><i><a href="../../../../articles/o/n/e/One_Night_in_the_Tropics_9a69.html" title="One Night in the Tropics">One Night in the Tropics</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/b/u/c/Buck_Privates_bda4.html" title="Buck Privates">Buck Privates</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/i/n/_/In_the_Navy_%28film%29_e5f7.html" title="In the Navy (film)">In the Navy</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/h/o/l/Hold_That_Ghost_5d90.html" title="Hold That Ghost">Hold That Ghost</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/k/e/e/Keep_%27Em_Flying_fb10.html" title="Keep 'Em Flying">Keep 'Em Flying</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/r/i/d/Ride_%27Em_Cowboy_370e.html" title="Ride 'Em Cowboy">Ride 'Em Cowboy</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/r/i/o/Rio_Rita_%281942_film%29_f599.html" title="Rio Rita (1942 film)">Rio Rita</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/p/a/r/Pardon_My_Sarong_51a7.html" title="Pardon My Sarong">Pardon My Sarong</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/w/h/o/Who_Done_It__%281942_film%29_d608.html" title="Who Done It? (1942 film)">Who Done It?</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/i/t/_/It_Ain%27t_Hay_d1bc.html" title="It Ain't Hay">It Ain't Hay</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/h/i/t/Hit_the_Ice_%28film%29_79b7.html" title="Hit the Ice (film)">Hit the Ice</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/i/n/_/In_Society_789c.html" title="In Society">In Society</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/l/o/s/Lost_in_a_Harem_66be.html" title="Lost in a Harem">Lost in a Harem</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/h/e/r/Here_Come_the_Co-Eds_9097.html" title="Here Come the Co-Eds">Here Come the Co-Eds</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/t/h/e/The_Naughty_Nineties_aad8.html" title="The Naughty Nineties">The Naughty Nineties</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/a/b/b/Abbott_and_Costello_in_Hollywood_62d2.html" title="Abbott and Costello in Hollywood">Abbott and Costello in Hollywood</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/l/i/t/Little_Giant_66a6.html" title="Little Giant">Little Giant</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/t/h/e/The_Time_of_Their_Lives_831c.html" title="The Time of Their Lives">The Time of Their Lives</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/b/u/c/Buck_Privates_Come_Home_c7e4.html" title="Buck Privates Come Home">Buck Privates Come Home</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/t/h/e/The_Wistful_Widow_of_Wagon_Gap_0dfb.html" title="The Wistful Widow of Wagon Gap">The Wistful Widow of Wagon Gap</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/t/h/e/The_Noose_Hangs_High_a16d.html" title="The Noose Hangs High">The Noose Hangs High</a></i> •</span> <span style="white-space:nowrap;"><i><strong class="selflink">Abbott and Costello Meet Frankenstein</strong></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/m/e/x/Mexican_Hayride_c692.html" title="Mexican Hayride">Mexican Hayride</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/a/f/r/Africa_Screams_4927.html" title="Africa Screams">Africa Screams</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Killer%2C_Boris_Karloff_0b24.html" title="Abbott and Costello Meet the Killer, Boris Karloff">Abbott and Costello Meet the Killer, Boris Karloff</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/a/b/b/Abbott_and_Costello_in_the_Foreign_Legion_3ad4.html" title="Abbott and Costello in the Foreign Legion">Abbott and Costello in the Foreign Legion</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Invisible_Man_c511.html" title="Abbott and Costello Meet the Invisible Man">Abbott and Costello Meet the Invisible Man</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/c/o/m/Comin%27_Round_the_Mountain_9601.html" title="Comin' Round the Mountain">Comin' Round the Mountain</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/j/a/c/Jack_and_the_Beanstalk_%281952_film%29_018a.html" title="Jack and the Beanstalk (1952 film)">Jack and the Beanstalk</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/l/o/s/Lost_in_Alaska_461e.html" title="Lost in Alaska">Lost in Alaska</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Captain_Kidd_7dab.html" title="Abbott and Costello Meet Captain Kidd">Abbott and Costello Meet Captain Kidd</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Go_to_Mars_0a6a.html" title="Abbott and Costello Go to Mars">Abbott and Costello Go to Mars</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Dr._Jekyll_and_Mr._Hyde_5399.html" title="Abbott and Costello Meet Dr. Jekyll and Mr. Hyde">Abbott and Costello Meet Dr. Jekyll and Mr. Hyde</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Keystone_Kops_a436.html" title="Abbott and Costello Meet the Keystone Kops">Abbott and Costello Meet the Keystone Kops</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Mummy_0243.html" title="Abbott and Costello Meet the Mummy">Abbott and Costello Meet the Mummy</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/d/a/n/Dance_with_Me_Henry_dbd4.html" title="Dance with Me Henry">Dance with Me Henry</a></i> •</span> <span style="white-space:nowrap;"><i><a href="../../../../articles/t/h/e/The_World_of_Abbott_and_Costello_fb17.html" title="The World of Abbott and Costello">The World of Abbott and Costello</a></i></span><br />
+<b>Lou Costello solo film:</b> <span style="white-space:nowrap;"><i><a href="../../../../articles/t/h/e/The_30_Foot_Bride_of_Candy_Rock_7ce2.html" title="The 30 Foot Bride of Candy Rock">The 30 Foot Bride of Candy Rock</a></i></span></div>
+</td>
+</tr>
+</table>
+</td>
+</tr>
+</table>
+<table class="navbox" cellspacing="0" style=";">
+<tr>
+<td style="padding:2px;">
+<table cellspacing="0" class="nowraplinks collapsible autocollapse" style="width:100%;background:transparent;color:inherit;;">
+<tr>
+<th style=";" colspan="2" class="navbox-title">
+<div style="float:left; width:6em;text-align:left;">
+<div class="noprint plainlinksneverexpand" style="background-color:transparent; padding:0; white-space:nowrap; font-weight:normal; font-size:xx-small;&#160;;;border:none;;"><a href="../../../../articles/u/n/i/Template%7EUniversal_Horror_5eb2.html" title="Template:Universal Horror"><span title="View this template" style=";;border:none;;">v</span></a>&#160;<span style="font-size:80%;">•</span>&#160;<a href="../../../../articles/u/n/i/Template_talk%7EUniversal_Horror_d0ee.html" title="Template talk:Universal Horror"><span style="color:#002bb8;;;border:none;;" title="Discussion about this template">d</span></a>&#160;<span style="font-size:80%;">•</span>&#160;<a href="http://en.wikipedia.org../../../../articles/u/n/i/Template%7EUniversal_Horror_5eb2.html" class="external text" title="http://en.wikipedia.org../../../../articles/u/n/i/Template%7EUniversal_Horror_5eb2.html" rel="nofollow"><span style="color:#002bb8;;;border:none;;" title="You can edit this template. Please use the preview button before saving.">e</span></a></div>
+</div>
+<span style="font-size:110%;"><a href="../../../../articles/u/n/i/Universal_Horror_db04.html" title="Universal Horror">Universal Horror</a> film series</span></th>
+</tr>
+<tr style="height:2px;">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Dracula</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-odd">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/d/r/a/Dracula_%281931_film%29.html" title="Dracula (1931 film)">Dracula</a></i> (1931)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%28Spanish-language_version%29_27a3.html" title="Dracula (Spanish-language version)">Dracula (Spanish-language version)</a></i> (1931)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula%27s_Daughter_d3d9.html" title="Dracula's Daughter">Dracula's Daughter</a></i> (1936)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/s/o/n/Son_of_Dracula_%281943_film%29_48c1.html" title="Son of Dracula (1943 film)">Son of Dracula</a></i> (1943)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Frankenstein's Monster</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-even">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/f/r/a/Frankenstein_%281931_film%29.html" title="Frankenstein (1931 film)">Frankenstein</a></i> (1931)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/b/r/i/Bride_of_Frankenstein_ebc1.html" title="Bride of Frankenstein">Bride of Frankenstein</a></i> (1935)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/s/o/n/Son_of_Frankenstein_a9ca.html" title="Son of Frankenstein">Son of Frankenstein</a></i> (1939)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Ghost_of_Frankenstein_9d19.html" title="The Ghost of Frankenstein">The Ghost of Frankenstein</a></i> (1942)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/h/o/u/House_of_Frankenstein_1997_aa1e.html" title="House of Frankenstein 1997">House of Frankenstein 1997</a></i></div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">The Wolf Man<br />
+alone and with other monsters</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-odd">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/t/h/e/The_Wolf_Man_%281941_film%29_e5e9.html" title="The Wolf Man (1941 film)">The Wolf Man</a></i> (1941)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/f/r/a/Frankenstein_Meets_the_Wolf_Man_eab7.html" title="Frankenstein Meets the Wolf Man">Frankenstein Meets the Wolf Man</a></i> (1943)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/h/o/u/House_of_Frankenstein_%281944_film%29_991c.html" title="House of Frankenstein (1944 film)">House of Frankenstein</a></i> (1944)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/h/o/u/House_of_Dracula_f4bb.html" title="House of Dracula">House of Dracula</a></i> (1945)<span style="font-weight:bold;">&#160;·</span> <i><strong class="selflink">Abbott and Costello Meet Frankenstein</strong></i> (1948)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">London werewolves</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-even">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/w/e/r/Werewolf_of_London_a436.html" title="Werewolf of London">Werewolf of London</a></i> (1935)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/s/h/e/She-Wolf_of_London_%28film%29_1758.html" title="She-Wolf of London (film)">She-Wolf of London</a></i> (1946)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Mummies</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-odd">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/t/h/e/The_Mummy_%281932_film%29_49a8.html" title="The Mummy (1932 film)">The Mummy</a></i> (1932)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Mummy%27s_Hand_64ab.html" title="The Mummy's Hand">The Mummy's Hand</a></i> (1940)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Mummy%27s_Tomb_e782.html" title="The Mummy's Tomb">The Mummy's Tomb</a></i> (1942)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Mummy%27s_Ghost_75ba.html" title="The Mummy's Ghost">The Mummy's Ghost</a></i> (1944)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Mummy%27s_Curse_8ed3.html" title="The Mummy's Curse">The Mummy's Curse</a></i> (1944)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Mummy_0243.html" title="Abbott and Costello Meet the Mummy">Abbott and Costello Meet the Mummy</a></i> (1955)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">The Invisible Man</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-even">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/t/h/e/The_Invisible_Man_%281933_film%29_8511.html" class="mw-redirect" title="The Invisible Man (1933 film)">The Invisible Man</a></i> (1933)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Invisible_Man_Returns_625c.html" title="The Invisible Man Returns">The Invisible Man Returns</a></i> (1940)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Invisible_Woman_143f.html" title="The Invisible Woman">The Invisible Woman</a></i> (1940)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/i/n/v/Invisible_Agent_77a5.html" title="Invisible Agent">Invisible Agent</a></i> (1942)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Invisible_Man%27s_Revenge_98c7.html" title="The Invisible Man's Revenge">The Invisible Man's Revenge</a></i> (1944)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_the_Invisible_Man_c511.html" title="Abbott and Costello Meet the Invisible Man">Abbott and Costello Meet the Invisible Man</a></i> (1951)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">The Phantom of the Opera</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-odd">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/t/h/e/The_Phantom_of_the_Opera_%281925_film%29_7f13.html" title="The Phantom of the Opera (1925 film)">The Phantom of the Opera</a></i> § (1925)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/p/h/a/Phantom_of_the_Opera_%281943_film%29_f074.html" title="Phantom of the Opera (1943 film)">Phantom of the Opera</a></i> (1943)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Climax_0fd4.html" title="The Climax">The Climax</a></i> (1944)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Edgar Allan Poe</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-even">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/m/u/r/Murders_in_the_Rue_Morgue_%28film%29_e788.html" title="Murders in the Rue Morgue (film)">Murders in the Rue Morgue</a></i> (1932)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Black_Cat_%281934_film%29_6487.html" title="The Black Cat (1934 film)">The Black Cat</a></i> (1934)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Raven_%281935_film%29_e18f.html" title="The Raven (1935 film)">The Raven</a></i> (1935)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;"><a href="../../../../articles/i/n/n/Inner_Sanctum_5ea1.html" class="mw-redirect" title="Inner Sanctum">Inner Sanctum</a> Mysteries</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-odd">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/c/a/l/Calling_Dr._Death_767f.html" title="Calling Dr. Death">Calling Dr. Death</a></i> (1943)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/w/e/i/Weird_Woman_c931.html" title="Weird Woman">Weird Woman</a></i> (1944)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/e/a/Dead_Man%27s_Eyes_ba92.html" title="Dead Man's Eyes">Dead Man's Eyes</a></i> (1944)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/s/t/r/Strange_Confession_a642.html" title="Strange Confession">Strange Confession</a></i> (1945)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Frozen_Ghost_e61f.html" title="The Frozen Ghost">The Frozen Ghost</a></i> (1945)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/p/i/l/Pillow_of_Death_61aa.html" title="Pillow of Death">Pillow of Death</a></i> (1945)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">The Ape Woman</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-even">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/c/a/p/Captive_Wild_Woman_6055.html" title="Captive Wild Woman">Captive Wild Woman</a></i> (1943)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/j/u/n/Jungle_Woman_9306.html" title="Jungle Woman">Jungle Woman</a></i> (1944)<span style="font-weight:bold;">&#160;·</span> <i>The Jungle Captive</i> (1945)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">The Creature from the Black Lagoon</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-odd">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/c/r/e/Creature_from_the_Black_Lagoon_d27b.html" title="Creature from the Black Lagoon">Creature from the Black Lagoon</a></i> (1954)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/r/e/v/Revenge_of_the_Creature_4fe3.html" title="Revenge of the Creature">Revenge of the Creature</a></i> (1955)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Creature_Walks_Among_Us_510d.html" title="The Creature Walks Among Us">The Creature Walks Among Us</a></i> (1956)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Others</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-even">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/t/h/e/The_Hunchback_of_Notre_Dame_%281923_film%29_14ab.html" title="The Hunchback of Notre Dame (1923 film)">The Hunchback of Notre Dame</a></i> § (1923)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Cat_and_the_Canary_%281927_film%29_5aac.html" title="The Cat and the Canary (1927 film)">The Cat and the Canary</a></i> § (1927)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Man_Who_Laughs_%281928_film%29_2840.html" title="The Man Who Laughs (1928 film)">The Man Who Laughs</a></i> § (1928)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Last_Warning_81b0.html" title="The Last Warning">The Last Warning</a></i> § (1929)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Last_Performance_6098.html" title="The Last Performance">The Last Performance</a></i> § (1929)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Cat_Creeps_e2e0.html" title="The Cat Creeps">The Cat Creeps</a></i> (1930)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/l/a/_/La_Voluntad_del_muerto_c442.html" title="La Voluntad del muerto">La Voluntad del muerto</a></i> (1930)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Mystery_of_Edwin_Drood_%281935_film%29_ba28.html" title="The Mystery of Edwin Drood (1935 film)">The Mystery of Edwin Drood</a></i> (1935)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/o/w/Tower_of_London_%281939_film%29_f50b.html" title="Tower of London (1939 film)">Tower of London</a></i> (1939)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/m/a/n/Man_Made_Monster_67f4.html" title="Man Made Monster">Man Made Monster</a></i> (1941)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/n/i/g/Night_Monster_0dd1.html" title="Night Monster">Night Monster</a></i> (1942)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Mad_Ghoul_65e0.html" title="The Mad Ghoul">The Mad Ghoul</a></i> (1943)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/h/o/u/House_of_Horrors_5ece.html" title="House of Horrors">House of Horrors</a></i> (1946)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Strange_Door_59ee.html" title="The Strange Door">The Strange Door</a></i> (1951)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Black_Castle_e1f0.html" title="The Black Castle">The Black Castle</a></i> (1952)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Dr._Jekyll_and_Mr._Hyde_5399.html" title="Abbott and Costello Meet Dr. Jekyll and Mr. Hyde">Abbott and Costello Meet Dr. Jekyll and Mr Hyde</a></i> (1953)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/c/u/l/Cult_of_the_Cobra_807c.html" title="Cult of the Cobra">Cult of the Cobra</a></i> (1955)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/a/r/Tarantula_%28film%29.html" title="Tarantula (film)">Tarantula</a></i> (1955)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Mole_People_16c7.html" title="The Mole People">The Mole People</a></i> (1956)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Deadly_Mantis_d769.html" title="The Deadly Mantis">The Deadly Mantis</a></i> (1957)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Monolith_Monsters_2ba2.html" title="The Monolith Monsters">The Monolith Monsters</a></i> (1957)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/m/o/n/Monster_on_the_Campus_a4ea.html" title="Monster on the Campus">Monster on the Campus</a></i> (1958)</div>
+</td>
+</tr>
+<tr style="height:2px;">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-abovebelow" style=";" colspan="2"><b>Note:</b> § denotes a <a href="../../../../articles/s/i/l/Silent_film.html" title="Silent film">silent film</a>.</td>
+</tr>
+</table>
+</td>
+</tr>
+</table>
+<table class="navbox" cellspacing="0" style=";">
+<tr>
+<td style="padding:2px;">
+<table cellspacing="0" class="nowraplinks collapsible show" style="width:100%;background:transparent;color:inherit;;">
+<tr>
+<th style=";" colspan="2" class="navbox-title">
+<div style="float:left; width:6em;text-align:left;">
+<div class="noprint plainlinksneverexpand" style="background-color:transparent; padding:0; white-space:nowrap; font-weight:normal; font-size:xx-small;&#160;;;border:none;;"><a href="../../../../articles/d/r/a/Template%7EDracula_31d6.html" title="Template:Dracula"><span title="View this template" style=";;border:none;;">v</span></a>&#160;<span style="font-size:80%;">•</span>&#160;<a href="../../../../articles/d/r/a/Template_talk%7EDracula_0ffd.html" title="Template talk:Dracula"><span style="color:#002bb8;;;border:none;;" title="Discussion about this template">d</span></a>&#160;<span style="font-size:80%;">•</span>&#160;<a href="http://en.wikipedia.org../../../../articles/d/r/a/Template%7EDracula_31d6.html" class="external text" title="http://en.wikipedia.org../../../../articles/d/r/a/Template%7EDracula_31d6.html" rel="nofollow"><span style="color:#002bb8;;;border:none;;" title="You can edit this template. Please use the preview button before saving.">e</span></a></div>
+</div>
+<span style="font-size:110%;"><a href="../../../../articles/d/r/a/Dracula.html" title="Dracula">Dracula</a></span></th>
+</tr>
+<tr style="height:2px;">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Characters of Dracula</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-odd">
+<div style="padding:0em 0.25em"><a href="../../../../articles/c/o/u/Count_Dracula_0c41.html" title="Count Dracula">Count Dracula</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/j/o/n/Jonathan_Harker_f513.html" title="Jonathan Harker">Jonathan Harker</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/m/i/n/Mina_Harker_1b1a.html" title="Mina Harker">Mina Harker</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/a/b/r/Abraham_Van_Helsing_ecd9.html" title="Abraham Van Helsing">Abraham Van Helsing</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/l/u/c/Lucy_Westenra_645b.html" title="Lucy Westenra">Lucy Westenra</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/a/r/t/Arthur_Holmwood_07e5.html" title="Arthur Holmwood">Arthur Holmwood</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/j/o/h/John_Seward_d538.html" title="John Seward">Dr. John Seward</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/q/u/i/Quincey_Morris_117e.html" title="Quincey Morris">Quincey Morris</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/r/e/n/Renfield.html" title="Renfield">Renfield</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/b/r/i/Brides_of_Dracula_9ecc.html" title="Brides of Dracula">Brides</a></div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Film Adaptations of Dracula</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-even">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/n/o/s/Nosferatu.html" title="Nosferatu">Nosferatu</a></i> (1922)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%281931_film%29.html" title="Dracula (1931 film)">Dracula</a></i> (1931)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%28Spanish-language_version%29_27a3.html" title="Dracula (Spanish-language version)">Dracula</a></i> (1931 Spanish Version)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%281958_film%29.html" title="Dracula (1958 film)">Dracula</a></i> (1958)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_Has_Risen_from_the_Grave_ffea.html" title="Dracula Has Risen from the Grave">Dracula Has Risen from the Grave</a></i> (1968)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/c/o/u/Count_Dracula_%281970_film%29_bebb.html" title="Count Dracula (1970 film)">Count Dracula</a></i> (1970)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%281973%29.html" title="Dracula (1973)">Dracula</a></i> (1973)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/c/o/u/Count_Dracula_%281977%29_c3fa.html" title="Count Dracula (1977)">Count Dracula (1977)</a></i> (1977)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%281979_film%29.html" title="Dracula (1979 film)">Dracula</a></i> (1979)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/n/o/s/Nosferatu_the_Vampyre_d854.html" title="Nosferatu the Vampyre">Nosferatu the Vampyre</a></i> (1979)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/b/r/a/Bram_Stoker%27s_Dracula_d465.html" title="Bram Stoker's Dracula">Bram Stoker's Dracula</a></i> (1992)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%282002%29.html" title="Dracula (2002)">Dracula</a></i> (2002)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/p/a/g/Dracula%7E_Pages_from_a_Virgin%27s_Diary_0e8d.html" title="Dracula: Pages from a Virgin's Diary">Dracula: Pages from a Virgin's Diary</a></i> (2002)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%282006%29.html" title="Dracula (2006)">Dracula</a></i> (2006)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Other films featuring Dracula</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-odd">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/d/r/a/Dracula%27s_Daughter_d3d9.html" title="Dracula's Daughter">Dracula's Daughter</a></i> (1936)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/s/o/n/Son_of_Dracula_%281943_film%29_48c1.html" title="Son of Dracula (1943 film)">Son of Dracula</a></i> (1943)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/h/o/u/House_of_Frankenstein_%281944_film%29_991c.html" title="House of Frankenstein (1944 film)">House of Frankenstein</a></i> (1944)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/h/o/u/House_of_Dracula_f4bb.html" title="House of Dracula">House of Dracula</a></i> (1945)<span style="font-weight:bold;">&#160;·</span> <i><strong class="selflink">Abbott and Costello Meet Frankenstein</strong></i> (1948)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Brides_of_Dracula_6e76.html" class="mw-redirect" title="The Brides of Dracula">The Brides of Dracula</a></i> (1960)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/p/r/i/Dracula%7E_Prince_of_Darkness_5421.html" title="Dracula: Prince of Darkness">Dracula: Prince of Darkness</a></i> (1966)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_Has_Risen_from_the_Grave_ffea.html" title="Dracula Has Risen from the Grave">Dracula Has Risen from the Grave</a></i> (1968)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/a/s/Taste_the_Blood_of_Dracula_a80c.html" title="Taste the Blood of Dracula">Taste the Blood of Dracula</a></i> (1970)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/s/c/a/Scars_of_Dracula_92fb.html" title="Scars of Dracula">Scars of Dracula</a></i> (1970)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_AD_1972_8f87.html" title="Dracula AD 1972">Dracula AD 1972</a></i> (1972)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Satanic_Rites_of_Dracula_7764.html" title="The Satanic Rites of Dracula">The Satanic Rites of Dracula</a></i> (1973)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/The_Legend_of_the_7_Golden_Vampires_1a81.html" title="The Legend of the 7 Golden Vampires">The Legend of the 7 Golden Vampires</a></i> (1974)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/h/e/Dark_Prince%7E_The_True_Story_of_Dracula_c032.html" title="Dark Prince: The True Story of Dracula">Dark Prince: The True Story of Dracula</a></i> (2000)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_2000.html" title="Dracula 2000">Dracula 2000</a></i> (2000)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/a/s/c/Dracula_II%7E_Ascension_cd81.html" title="Dracula II: Ascension">Dracula II: Ascension</a></i> (2003)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_3000.html" title="Dracula 3000">Dracula 3000</a></i> (2004)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/t/r/i/Blade%7E_Trinity_5851.html" title="Blade: Trinity">Blade: Trinity</a></i> (2004)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/v/a/n/Van_Helsing_%28film%29_95a7.html" title="Van Helsing (film)">Van Helsing</a></i> (2004)<span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/l/e/g/Dracula_III%7E_Legacy_c42f.html" title="Dracula III: Legacy">Dracula III: Legacy</a></i> (2005)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Stage Adaptations of Dracula</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-even">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/d/r/a/Dracula_%28play%29.html" title="Dracula (play)">Dracula</a></i> (1924) <span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/c/o/u/Count_Dracula_%281972%29_455a.html" title="Count Dracula (1972)">Count Dracula</a></i> (1972) <span style="font-weight:bold;">&#160;·</span> Dracula, a Musical Nightmare (1974) <span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%281980%29.html" title="Dracula (1980)">Dracula</a></i> (1980) <span style="font-weight:bold;">&#160;·</span> Dracula: the Musical? (1982) <span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%281995%29.html" title="Dracula (1995)">Dracula</a></i> (1995) <span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%281996%29.html" title="Dracula (1996)">Dracula</a></i> (1996) <span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula_%282000%29.html" title="Dracula (2000)">Dracula</a></i> (2000) <span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/r/a/Dracula%2C_the_Musical_6c20.html" title="Dracula, the Musical">Dracula, the Musical</a></i> (2004)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Parodies of Dracula</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-odd">
+<div style="padding:0em 0.25em"><i><a href="../../../../articles/b/l/a/Blacula.html" title="Blacula">Blacula</a></i> (1972) <span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/l/o/v/Love_at_First_Bite_8d9c.html" class="mw-redirect" title="Love at First Bite">Love at First Bite</a></i> (1979) <span style="font-weight:bold;">&#160;·</span> <i><a href="../../../../articles/d/e/a/Dracula%7E_Dead_and_Loving_It_d1fb.html" title="Dracula: Dead and Loving It">Dracula: Dead and Loving It</a></i> (1995)</div>
+</td>
+</tr>
+<tr style="height:2px">
+<td></td>
+</tr>
+<tr>
+<td class="navbox-group" style=";;">Dracula in video games</td>
+<td style="text-align:left;border-left:2px solid #fdfdfd;width:100%;padding:0px;;;" class="navbox-list navbox-even">
+<div style="padding:0em 0.25em"><a href="../../../../articles/d/r/a/Dracula_%28Castlevania%29_db73.html" title="Dracula (Castlevania)">Dracula (Castlevania)</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/c/a/s/Castlevania.html" title="Castlevania">Castlevania</a> <span style="font-weight:bold;">&#160;·</span> <a href="../../../../articles/a/l/u/Alucard_%28Castlevania%29_ead1.html" title="Alucard (Castlevania)">Alucard</a></div>
+</td>
+</tr>
+</table>
+</td>
+</tr>
+</table>
+
+
+<!-- 
+NewPP limit report
+Preprocessor node count: 2425/1000000
+Post-expand include size: 80992/2048000 bytes
+Template argument size: 48214/2048000 bytes
+Expensive parser function count: 3/500
+-->
+<div class="printfooter">
+</div>
+	    <div id="catlinks"><div id='catlinks' class='catlinks'><div id="mw-normal-catlinks"><a href="../../../../articles/c/a/t/Special%7ECategories_101d.html" title="Special:Categories">Categories</a>:&#32;<span dir='ltr'><a href="../../../../articles/e/n/g/Category%7EEnglish-language_films_bc72.html" title="Category:English-language films">English-language films</a></span> | <span dir='ltr'><a href="../../../../articles/1/9/4/Category%7E1948_films.html" title="Category:1948 films">1948 films</a></span> | <span dir='ltr'><a href="../../../../articles/a/m/e/Category%7EAmerican_films_c371.html" title="Category:American films">American films</a></span> | <span dir='ltr'><a href="../../../../articles/c/o/m/Category%7EComedy_horror_films_fe9e.html" title="Category:Comedy horror films">Comedy horror films</a></span> | <span dir='ltr'><a href="../../../../articles/f/r/a/Category%7EFrankenstein_films_a72c.html" title="Category:Frankenstein films">Frankenstein films</a></span> | <span dir='ltr'><a href="../../../../articles/b/l/a/Category%7EBlack_and_white_films_27c4.html" title="Category:Black and white films">Black and white films</a></span> | <span dir='ltr'><a href="../../../../articles/b/_/m/Category%7EB_movies_16f7.html" title="Category:B movies">B movies</a></span> | <span dir='ltr'><a href="../../../../articles/u/n/i/Category%7EUnited_States_National_Film_Registry_films_7405.html" title="Category:United States National Film Registry films">United States National Film Registry films</a></span> | <span dir='ltr'><a href="../../../../articles/w/e/r/Category%7EWerewolves_in_film_and_television_e856.html" title="Category:Werewolves in film and television">Werewolves in film and television</a></span> | <span dir='ltr'><a href="../../../../articles/d/r/a/Category%7EDracula_films_b631.html" title="Category:Dracula films">Dracula films</a></span> | <span dir='ltr'><a href="../../../../articles/a/b/b/Category%7EAbbott_and_Costello_%28film_series%29_47a1.html" title="Category:Abbott and Costello (film series)">Abbott and Costello (film series)</a></span> | <span dir='ltr'><a href="../../../../articles/c/r/o/Category%7ECrossover_fiction_0d54.html" title="Category:Crossover fiction">Crossover fiction</a></span> | <span dir='ltr'><a href="../../../../articles/f/i/l/Category%7EFilms_directed_by_Charles_Barton_39a6.html" title="Category:Films directed by Charles Barton">Films directed by Charles Barton</a></span></div><div id="mw-hidden-catlinks" class="mw-hidden-cats-hidden">Hidden categories:&#32;<span dir='ltr'><a href="../../../../articles/a/r/t/Category%7EArticles_with_trivia_sections_from_June_2007_b36d.html" title="Category:Articles with trivia sections from June 2007">Articles with trivia sections from June 2007</a></span> | <span dir='ltr'><a href="../../../../articles/a/l/l/Category%7EAll_articles_with_unsourced_statements_2f67.html" title="Category:All articles with unsourced statements">All articles with unsourced statements</a></span> | <span dir='ltr'><a href="../../../../articles/a/r/t/Category%7EArticles_with_unsourced_statements_since_February_2008_7f92.html" title="Category:Articles with unsourced statements since February 2008">Articles with unsourced statements since February 2008</a></span></div></div></div>	    <!-- end content -->
+	    <div class="visualClear"></div>
+	  </div>
+	</div>
+      </div>
+      <div id="column-one">
+	<div id="p-cactions" class="portlet">
+	  <h5>Views</h5>
+	  <ul>
+	    <li id="ca-nstab-main"
+	       class="selected"	       ><a href="../../../../articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html">Article</a></li><li id="ca-talk"
+	       	       ><a href="../../../../articles/a/b/b/Talk%7EAbbott_and_Costello_Meet_Frankenstein_d4fc.html">Discussion</a></li><li id="ca-current"
+	       	       ><a href="http://en.wikipedia.org/wiki/Abbott_and_Costello_Meet_Frankenstein">Current revision</a></li>	  </ul>
+	</div>
+	<div class="portlet" id="p-logo">
+	  <a style="background-image: url(../../../../misc/Wiki.png);"
+	    href="../../../../index.html"
+	    title="Main Page"></a>
+	</div>
+	<script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
+		<div class='portlet' id='p-navigation'>
+	  <h5>Navigation</h5>
+	  <div class='pBody'>
+	    <ul>
+	    	      <li id="n-mainpage"><a href="../../../../index.html">Main Page</a></li>
+	     	      <li id="n-Contents"><a href="../../../../articles/c/o/n/Portal%7EContents_b878.html">Contents</a></li>
+	     	      <li id="n-featuredcontent"><a href="../../../../articles/f/e/a/Portal%7EFeatured_content_5442.html">Featured content</a></li>
+	     	      <li id="n-currentevents"><a href="../../../../articles/c/u/r/Portal%7ECurrent_events_bb60.html">Current events</a></li>
+	     	    </ul>
+	  </div>
+	</div>
+		<div class='portlet' id='p-interaction'>
+	  <h5>Interaction</h5>
+	  <div class='pBody'>
+	    <ul>
+	    	      <li id="n-aboutsite"><a href="../../../../articles/a/b/o/Wikipedia%7EAbout_8d82.html">About Wikipedia</a></li>
+	     	      <li id="n-portal"><a href="../../../../articles/c/o/m/Wikipedia%7ECommunity_Portal_6a3c.html">Community portal</a></li>
+	     	      <li id="n-recentchanges"><a href="../../../../articles/r/e/c/Special%7ERecentChanges_e0d0.html">Recent changes</a></li>
+	     	      <li id="n-contact"><a href="../../../../articles/c/o/n/Wikipedia%7EContact_us_afd6.html">Contact Wikipedia</a></li>
+	     	      <li id="n-sitesupport"><a href="http://wikimediafoundation.org/wiki/Donate">Donate to Wikipedia</a></li>
+	     	      <li id="n-help"><a href="../../../../articles/c/o/n/Help%7EContents_22de.html">Help</a></li>
+	     	    </ul>
+	  </div>
+	</div>
+		<div id="p-search" class="portlet">
+	  <h5><label for="searchInput">Search</label></h5>
+	  <div id="searchBody" class="pBody">
+	    <form action="javascript:goToStatic(3)" id="searchform"><div>
+	      <input id="searchInput" name="search" type="text"
+	        accesskey="f" value="" />
+	      <input type='submit' name="go" class="searchButton" id="searchGoButton"
+	        value="Go" />
+	    </div></form>
+	  </div>
+	</div>
+	<div id="p-lang" class="portlet">
+	  <h5>Languages</h5>
+	  <div class="pBody">
+	    <ul>
+	      	      <li>
+	      <a href="../../../../../de/articles/a/b/b/Abbott_und_Costello_treffen_Frankenstein_3ec4.html">Deutsch</a>
+	      </li>
+	      	      <li>
+	      <a href="../../../../../et/articles/a/b/b/Abbott_and_Costello_Meet_Frankenstein_59d9.html">Eesti</a>
+	      </li>
+	      	      <li>
+	      <a href="../../../../../it/articles/i/l/_/Il_cervello_di_Frankenstein_d283.html">Italiano</a>
+	      </li>
+	      	      <li>
+	      <a href="../../../../../no/articles/a/b/b/Abbott_og_Costello_i_redselskabinettet_95ad.html">‪Norsk (bokmål)‬</a>
+	      </li>
+	      	    </ul>
+	  </div>
+	</div>
+	      </div><!-- end of the left (by default at least) column -->
+      <div class="visualClear"></div>
+      <div id="footer">
+    <div id="f-poweredbyico"><a href="http://www.mediawiki.org/"><img src="../../../../skins/common/images/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" /></a></div>	<div id="f-copyrightico"><a href="http://wikimediafoundation.org/"><img src="../../../../misc/wikimedia-button.png" border="0" alt="Wikimedia Foundation"/></a></div>	<ul id="f-list">
+	  	  	  <li id="f-credits">This page was last modified 23:38, 23 May 2008 by Wikipedia user <a href="../../../../articles/b/a/r/User%7EBarticus88_0fa5.html" title="User:Barticus88">Barticus88</a>. Based on work by Wikipedia user(s) <a href="../../../../articles/k/b/d/User%7EKbdankbot_f267.html" title="User:Kbdankbot">Kbdankbot</a>, Otrauthor, <a href="../../../../articles/d/o/n/User%7EDonaldd23_880f.html" title="User:Donaldd23">Donaldd23</a>, <a href="../../../../articles/l/u/g/User%7ELugnuts_a0c2.html" title="User:Lugnuts">Lugnuts</a>, <a href="../../../../articles/b/a/d/User%7EBadgernet_5043.html" title="User:Badgernet">Badgernet</a>, <a href="../../../../articles/d/y/s/User%7EDysepsion_8adb.html" title="User:Dysepsion">Dysepsion</a>, <a href="../../../../articles/d/u/m/User%7EDumZiBoT_2099.html" title="User:DumZiBoT">DumZiBoT</a>, <a href="../../../../articles/t/i/n/User%7ETinyMark_4a01.html" title="User:TinyMark">TinyMark</a>, <a href="../../../../articles/s/t/r/User%7EStr1977_cbd8.html" title="User:Str1977">Str1977</a>, <a href="../../../../articles/d/o/c/User%7EDoczilla_1c36.html" title="User:Doczilla">Doczilla</a>, <a href="../../../../articles/t/f/c/User%7ETFCforever_8e6c.html" title="User:TFCforever">TFCforever</a>, <a href="../../../../articles/v/o/l/User%7EVolkovBot_5c6d.html" title="User:VolkovBot">VolkovBot</a>, JamesGothMog13, <a href="../../../../articles/s/l/i/User%7ESlingbat_bd02.html" title="User:Slingbat">Slingbat</a>, <a href="../../../../articles/s/i/l/User%7ESilkTork_60ce.html" title="User:SilkTork">SilkTork</a>, <a href="../../../../articles/p/o/p/User%7EPopplewick_9d47.html" title="User:Popplewick">Popplewick</a>, <a href="../../../../articles/t/o/m/User%7ETom_Tresser_5804.html" title="User:Tom Tresser">Tom Tresser</a>, <a href="../../../../articles/a/n/i/User%7EAnimalz_Records_4f65.html" title="User:Animalz Records">Animalz Records</a>, Grantleigh, <a href="../../../../articles/t/j/m/User%7ETjmayerinsf_3183.html" title="User:Tjmayerinsf">Tjmayerinsf</a>, Marbpl, <a href="../../../../articles/j/o/n/User%7EJon138_bba3.html" title="User:Jon138">Jon138</a>, <a href="../../../../articles/m/l/o/User%7EMlouns_fbae.html" title="User:Mlouns">Mlouns</a>, <a href="../../../../articles/b/a/l/User%7EBalance2214_25ad.html" title="User:Balance2214">Balance2214</a>, John O'C, Tronta, <a href="../../../../articles/d/m/a/User%7EDmacw6_8359.html" title="User:Dmacw6">Dmacw6</a>, <a href="../../../../articles/n/a/t/User%7ENatureBoyMD_96c3.html" title="User:NatureBoyMD">NatureBoyMD</a>, <a href="../../../../articles/h/e/n/User%7EHenryCow_e1da.html" title="User:HenryCow">HenryCow</a>, <a href="../../../../articles/k/b/d/User%7EKbdank71_f952.html" title="User:Kbdank71">Kbdank71</a>, Jzummak, <a href="../../../../articles/z/v/a/User%7EZvar_a270.html" title="User:Zvar">Zvar</a>, <a href="../../../../articles/i/r/i/User%7EIrishguy_9732.html" title="User:Irishguy">Irishguy</a>, <a href="../../../../articles/s/m/a/User%7ESmackBot_cc7a.html" title="User:SmackBot">SmackBot</a>, <a href="../../../../articles/t/h/e/User%7ETheRingess_7faf.html" title="User:TheRingess">TheRingess</a>, <a href="../../../../articles/d/a/v/User%7EDavid_Gerard_df91.html" title="User:David Gerard">David Gerard</a>, <a href="../../../../articles/s/c/o/User%7EScottandrewhutchins_fac3.html" title="User:Scottandrewhutchins">Scottandrewhutchins</a>, <a href="../../../../articles/c/y/d/User%7ECydebot_38a6.html" title="User:Cydebot">Cydebot</a>, MOVIEMAN1963, Kepittman, <a href="../../../../articles/a/n/d/User%7EAndrzejbanas_e861.html" title="User:Andrzejbanas">Andrzejbanas</a>, <a href="../../../../articles/s/k/i/User%7ESkierRMH_4ae2.html" title="User:SkierRMH">SkierRMH</a>, <a href="../../../../articles/a/m/x/User%7EAmxitsa_0a7b.html" title="User:Amxitsa">Amxitsa</a>, <a href="../../../../articles/z/o/n/User%7EZondor_d557.html" title="User:Zondor">Zondor</a>, <a href="../../../../articles/j/o/g/User%7EJogersbot_c8cf.html" title="User:Jogersbot">Jogersbot</a>, <a href="../../../../articles/p/a/u/User%7EPaul_A_a8ca.html" title="User:Paul A">Paul A</a>, <a href="../../../../articles/m/a/l/User%7EMallanox_1ced.html" title="User:Mallanox">Mallanox</a>, <a href="../../../../articles/a/n/d/User%7EAndman8_44a5.html" title="User:Andman8">Andman8</a>, <a href="../../../../articles/r/e/e/User%7EReedy_bc31.html" title="User:Reedy">Reedy</a>, <a href="../../../../articles/w/a/v/User%7EWavy_G_9d03.html" title="User:Wavy G">Wavy G</a>, <a href="../../../../articles/t/h/e/User%7EThe_Iconoclast_bf11.html" title="User:The Iconoclast">The Iconoclast</a>, <a href="../../../../articles/p/r/o/User%7EProteus71_15e9.html" title="User:Proteus71">Proteus71</a>, <a href="../../../../articles/b/e/t/User%7EBetacommandBot_3654.html" title="User:BetacommandBot">BetacommandBot</a>, Andreal, Andrew777, <a href="../../../../articles/h/e/a/User%7EHEAD_ON_APPLY_DIRECTLY_TO_THE_FOREHEAD_1e75.html" title="User:HEAD ON APPLY DIRECTLY TO THE FOREHEAD">HEAD ON APPLY DIRECTLY TO THE FOREHEAD</a>, <a href="../../../../articles/n/e/h/User%7ENehrams2020_121d.html" title="User:Nehrams2020">Nehrams2020</a>, <a href="../../../../articles/2/3/s/User%7E23skidoo.html" title="User:23skidoo">23skidoo</a>, <a href="../../../../articles/i/b/a/User%7EIbaranoff24_bfad.html" title="User:Ibaranoff24">Ibaranoff24</a>, <a href="../../../../articles/m/o/t/User%7EMotor_c62e.html" title="User:Motor">Motor</a>, <a href="../../../../articles/d/a/v/User%7EDavid_L_Rattigan_f48b.html" title="User:David L Rattigan">David L Rattigan</a>, <a href="../../../../articles/j/a/m/User%7EJamesMLane_34be.html" title="User:JamesMLane">JamesMLane</a>, Sledgeh101, <a href="../../../../articles/a/r/t/User%7EArtemisboy_24da.html" title="User:Artemisboy">Artemisboy</a>, Estrose, <a href="../../../../articles/n/e/t/User%7ENetBot_052d.html" title="User:NetBot">NetBot</a>, <a href="../../../../articles/b/o/b/User%7EBobblewik_fbc0.html" title="User:Bobblewik">Bobblewik</a>, <a href="../../../../articles/n/o/i/User%7ENoirish_ce0d.html" title="User:Noirish">Noirish</a>, <a href="../../../../articles/h/e/l/User%7EHelga76_03d6.html" title="User:Helga76">Helga76</a>, <a href="../../../../articles/i/c/e/User%7EIceDrake523_e684.html" title="User:IceDrake523">IceDrake523</a>, <a href="../../../../articles/i/a/n/User%7EIanblair23_6de0.html" title="User:Ianblair23">Ianblair23</a>, <a href="../../../../articles/w/h/o/User%7EWho_d957.html" title="User:Who">Who</a>, <a href="../../../../articles/j/e/f/User%7EJeff_Watts_14b9.html" title="User:Jeff Watts">Jeff Watts</a>, <a href="../../../../articles/s/i/m/User%7ESimonP_1010.html" title="User:SimonP">SimonP</a>, <a href="../../../../articles/p/e/a/User%7EPearle_6f07.html" title="User:Pearle">Pearle</a>, <a href="../../../../articles/c/r/y/User%7ECryptoDerk_6aa9.html" title="User:CryptoDerk">CryptoDerk</a>, <a href="../../../../articles/j/e/f/User%7EJeffq_074c.html" title="User:Jeffq">Jeffq</a>, <a href="../../../../articles/o/w/e/User%7EOwenBlacker_920f.html" title="User:OwenBlacker">OwenBlacker</a>, <a href="../../../../articles/g/a/m/User%7EGamaliel_c9b8.html" title="User:Gamaliel">Gamaliel</a>, <a href="../../../../articles/t/i/m/User%7ETimc_6767.html" title="User:Timc">Timc</a>, <a href="../../../../articles/z/a/n/User%7EZanimum_8561.html" title="User:Zanimum">Zanimum</a>, <a href="../../../../articles/r/f/c/User%7ERfc1394_3d02.html" title="User:Rfc1394">Rfc1394</a>, <a href="../../../../articles/k/o/y/User%7EKoyaanis_Qatsi_7ab5.html" title="User:Koyaanis Qatsi">Koyaanis Qatsi</a> and <a href="../../../../articles/z/o/e/User%7EZoe_6ab7.html" title="User:Zoe">Zoe</a> and Anonymous user(s) of Wikipedia.</li>	  <li id="f-copyright">All text is available under the terms of the <a class='internal' href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_the_GNU_Free_Documentation_License" title="Wikipedia:Text of the GNU Free Documentation License">GNU Free Documentation License</a>. (See <b><a class='internal' href="http://en.wikipedia.org/wiki/Wikipedia:Copyrights" title="Wikipedia:Copyrights">Copyrights</a></b> for details.) <br /> Wikipedia&reg; is a registered trademark of the <a href="http://www.wikimediafoundation.org">Wikimedia Foundation, Inc</a>., a U.S. registered <a class='internal' href="http://en.wikipedia.org/wiki/501%28c%29#501.28c.29.283.29" title="501(c)(3)">501(c)(3)</a> <a href="http://wikimediafoundation.org/wiki/Deductibility_of_donations">tax-deductible</a> <a class='internal' href="http://en.wikipedia.org/wiki/Non-profit_organization" title="Non-profit organization">nonprofit</a> <a href="http://en.wikipedia.org/wiki/Charitable_organization" title="Charitable organization">charity</a>.<br /></li>	  <li id="f-about"><a href="../../../../articles/a/b/o/Wikipedia%7EAbout_8d82.html" title="Wikipedia:About">About Wikipedia</a></li>	  <li id="f-disclaimer"><a href="../../../../articles/g/e/n/Wikipedia%7EGeneral_disclaimer_3e44.html" title="Wikipedia:General disclaimer">Disclaimers</a></li>	  	</ul>
+      </div>
+    </div>
+  </body>
+</html>
diff --git a/gcc/testsuite/gdc.test/runnable/foreach.d b/gcc/testsuite/gdc.test/runnable/foreach.d
new file mode 100644
index 00000000000..331c927504a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/foreach.d
@@ -0,0 +1,299 @@
+
+import core.stdc.stdio;
+
+/**************************************************/
+
+void test1()
+{
+    int i;
+
+    foreach (char c; "abcd")
+    {
+        switch (i++)
+        {   case 0:     assert(c == 'a');   break;
+            case 1:     assert(c == 'b');   break;
+            case 2:     assert(c == 'c');   break;
+            case 3:     assert(c == 'd');   break;
+            default:    assert(0);
+        }
+    }
+
+    i = 0;
+    foreach (wchar c; "asdf")
+    {
+        switch (i++)
+        {   case 0:     assert(c == 'a');   break;
+            case 1:     assert(c == 's');   break;
+            case 2:     assert(c == 'd');   break;
+            case 3:     assert(c == 'f');   break;
+            default:    assert(0);
+        }
+    }
+
+    i = 0;
+    foreach (dchar c; "bncd")
+    {
+        switch (i++)
+        {   case 0:     assert(c == 'b');   break;
+            case 1:     assert(c == 'n');   break;
+            case 2:     assert(c == 'c');   break;
+            case 3:     assert(c == 'd');   break;
+            default:    assert(0);
+        }
+    }
+}
+
+/**************************************************/
+
+void test2()
+{
+    int i;
+
+    uint[5] a;
+    a[0] = 16;
+    a[1] = 1;
+    a[2] = 5;
+    a[3] = 8;
+    a[4] = 3;
+
+    foreach (uint u; a)
+    {
+        switch (i++)
+        {   case 0:     assert(u == 16);    break;
+            case 1:     assert(u == 1);     break;
+            case 2:     assert(u == 5);     break;
+            case 3:     assert(u == 8);     break;
+            case 4:     assert(u == 3);     break;
+            default:    assert(0);
+        }
+    }
+
+    uint[] b = a;
+
+    i = 0;
+    foreach (uint u; b)
+    {
+        switch (i++)
+        {   case 0:     assert(u == 16);    break;
+            case 1:     assert(u == 1);     break;
+            case 2:     assert(u == 5);     break;
+            case 3:     assert(u == 8);     break;
+            case 4:     assert(u == 3);     break;
+            default:    assert(0);
+        }
+    }
+
+    test2_x(a);
+}
+
+void test2_x(uint[5] a)
+{
+    int i;
+
+    foreach (uint u; a)
+    {
+        switch (i++)
+        {   case 0:     assert(u == 16);    break;
+            case 1:     assert(u == 1);     break;
+            case 2:     assert(u == 5);     break;
+            case 3:     assert(u == 8);     break;
+            case 4:     assert(u == 3);     break;
+            default:    assert(0);
+        }
+    }
+}
+
+/**************************************************/
+
+void test3()
+{
+    int i;
+
+    uint[5] a;
+    a[0] = 16;
+
+    foreach (ref uint u; a)
+    {
+        i += u;
+        u++;
+    }
+    assert(i == 16);
+    assert(a[0] == 17);
+    assert(a[4] == 1);
+
+    foreach (uint u; a)
+    {
+        printf("u = %d\n", u);
+        //u++;
+    }
+    assert(a[0] == 17);
+    assert(a[4] == 1);
+}
+
+/**************************************************/
+
+enum E4 { m }
+
+struct X4 {
+    char [] b;
+    E4 a;
+}
+
+void test4()
+{
+    X4 [] x;
+    foreach (X4 w; x) {}
+}
+
+
+/**************************************************/
+
+class Thing5
+{}
+
+class Things5
+{
+public:
+  int opApply(int delegate(ref Thing5 thing) dg)
+  {
+    Thing5 thing = new Thing5();
+
+    return dg(thing);
+  }
+}
+
+void foo5(Things5 things)
+{
+    foreach(Thing5 t; things)
+    {
+    }
+}
+
+void test5()
+{
+}
+
+
+/**************************************************/
+
+void test6()
+{
+    static long[3] a = [21,22,23];
+    long[3] b;
+    int sum;
+
+    foreach (int i, ref long v; a)
+    {
+        printf("a[%d] = %lld\n", i, v);
+        b[i] = v;
+    }
+
+    for (uint i = 0; i < 3; i++)
+    {
+        assert(b[i] == 21 + i);
+    }
+
+    foreach (ref long v; a)
+    {
+        printf("a[] = %lld\n", v);
+        sum += v;
+    }
+    assert(sum == 21 + 22 + 23);
+}
+
+/**************************************************/
+
+void test7()
+{
+    uint[string] a;
+
+    a["foo"] = 3;
+    a["bar"] = 4;
+    foreach (string s, uint v; a)
+    {
+        printf("a[%.*s] = %d\n", s.length, s.ptr, v);
+        if (s == "bar")
+            assert(v == 4);
+        else if (s == "foo")
+            assert(v == 3);
+        else
+            assert(0);
+    }
+}
+
+
+/**************************************************/
+
+class Foo8
+{
+    int x, y, z;
+
+    int opApply(int delegate(ref int a, ref int b, ref int c) dg)
+    {
+        int result = dg(x, y, z);
+        return 0;
+    }
+}
+
+void test8()
+{
+    Foo8 f = new Foo8();
+    f.x = 63;
+    f.y = 47;
+    f.z = 83;
+    foreach (int a, ref int b, int c; f)
+    {
+        printf("a = %d, b = %d, c = %d\n", a, b, c);
+        assert(a == 63);
+        assert(b == 47);
+        assert(c == 83);
+        a++;
+        b++;
+        c++;
+    }
+    foreach (int a, ref int b, int c; f)
+    {
+        printf("a = %d, b = %d, c = %d\n", a, b, c);
+        assert(a == 63);
+        assert(b == 48);
+        assert(c == 83);
+        a++;
+        b++;
+        c++;
+    }
+}
+
+/**************************************************/
+
+struct S
+{
+    int opApply(int delegate(ref int a)) { return 0; }
+    int opApplyReverse(int delegate(ref int a)) { return 0; }
+    int dg(int delegate(ref int a)) { return 0; }
+}
+
+void test9()
+{
+    S s;
+    foreach(a; s) {}
+    foreach_reverse(a; s) {}
+    foreach(a; &s.dg) {}
+}
+
+/**************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/foreach2.d b/gcc/testsuite/gdc.test/runnable/foreach2.d
new file mode 100644
index 00000000000..34edb41edaf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/foreach2.d
@@ -0,0 +1,268 @@
+
+import core.stdc.stdio;
+
+/**************************************************/
+
+void test1()
+{
+    uint[char[]] a;
+    int i;
+
+    a["hello"] = 73;
+    a["world"] = 82;
+
+    foreach (uint u; a)
+    {
+        i++;
+        u++;
+    }
+    assert(i == 2);
+    assert(a["hello"] == 73);
+    assert(a["world"] == 82);
+}
+
+/**************************************************/
+
+void test2()
+{
+    uint[char[]] a;
+    int i;
+
+    a["hello"] = 73;
+    a["world"] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        u++;
+    }
+    assert(i == 2);
+    assert(a["hello"] == 74);
+    assert(a["world"] == 83);
+}
+
+/**************************************************/
+
+void test3()
+{
+    uint[char[]] a;
+    int i;
+
+    a["hello"] = 73;
+    a["world"] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            break;
+        u++;
+    }
+    assert(i == 1);
+    assert(a["hello"] == 73);
+    assert(a["world"] == 82);
+}
+
+/**************************************************/
+
+void test4()
+{
+    uint[char[]] a;
+    int i;
+
+    a["hello"] = 73;
+    a["world"] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i == 1)
+            continue;
+        u++;
+    }
+    assert(i == 2);
+    assert((a["hello"] == 73 && a["world"] == 83) ||
+           (a["hello"] == 74 && a["world"] == 82));
+}
+
+/**************************************************/
+
+void test5()
+{
+    uint[char[]] a;
+    int i;
+
+    a["hello"] = 73;
+    a["world"] = 82;
+
+Loop:
+    while (1)
+    {
+        foreach (ref uint u; a)
+        {
+            i++;
+            if (i)
+                break Loop;
+            u++;
+        }
+    }
+    assert(i == 1);
+    assert(a["hello"] == 73);
+    assert(a["world"] == 82);
+}
+
+/**************************************************/
+
+void test6()
+{
+    uint[char[]] a;
+    int i;
+
+    a["hello"] = 73;
+    a["world"] = 82;
+
+Loop:
+    while (1)
+    {
+        foreach (ref uint u; a)
+        {
+            i++;
+            if (i == 1)
+                continue Loop;
+            u++;
+        }
+        break;
+    }
+    assert(i == 3);
+    assert(a["hello"] == 74);
+    assert(a["world"] == 83);
+}
+
+/**************************************************/
+
+void test7()
+{
+    uint[char[]] a;
+    int i;
+
+    a["hello"] = 73;
+    a["world"] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            goto Label;
+        u++;
+    }
+    assert(0);
+Label:
+    assert(i == 1);
+    assert(a["hello"] == 73);
+    assert(a["world"] == 82);
+}
+
+/**************************************************/
+
+void test8_x(uint[char[]] a)
+{
+    int i;
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            return;
+        u++;
+    }
+}
+
+void test8()
+{
+    uint[char[]] a;
+    int i;
+
+    a["hello"] = 73;
+    a["world"] = 82;
+
+    test8_x(a);
+    assert(i == 0);
+    assert(a["hello"] == 73);
+    assert(a["world"] == 82);
+}
+
+/**************************************************/
+
+int test9_x(uint[char[]] a)
+{
+    int i;
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            return 67;
+        u++;
+    }
+    return 23;
+}
+
+void test9()
+{
+    uint[char[]] a;
+    int i;
+
+    a["hello"] = 73;
+    a["world"] = 82;
+
+    i = test9_x(a);
+    assert(i == 67);
+    assert(a["hello"] == 73);
+    assert(a["world"] == 82);
+}
+
+/**************************************************/
+
+int test10_x(uint[char[]] a)
+{
+    int i;
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            return i;
+        u++;
+    }
+    return 23;
+}
+
+void test10()
+{
+    uint[char[]] a;
+    int i;
+
+    a["hello"] = 73;
+    a["world"] = 82;
+
+    i = test10_x(a);
+    assert(i == 1);
+    assert(a["hello"] == 73);
+    assert(a["world"] == 82);
+}
+
+/**************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/foreach3.d b/gcc/testsuite/gdc.test/runnable/foreach3.d
new file mode 100644
index 00000000000..e167217e7a3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/foreach3.d
@@ -0,0 +1,285 @@
+
+import core.stdc.stdio;
+
+struct Foo
+{
+    uint array[2];
+
+    int opApply(int delegate(ref uint) dg)
+    {
+        int result;
+        for (int i = 0; i < array.length; i++)
+        {
+            result = dg(array[i]);
+            if (result)
+                break;
+        }
+        return result;
+    }
+}
+
+
+/**************************************************/
+
+void test1()
+{
+    Foo a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (uint u; a)
+    {
+        i++;
+        u++;
+    }
+    assert(i == 2);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+void test2()
+{
+    Foo a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        u++;
+    }
+    assert(i == 2);
+    assert(a.array[0] == 74);
+    assert(a.array[1] == 83);
+}
+
+/**************************************************/
+
+void test3()
+{
+    Foo a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            break;
+        u++;
+    }
+    assert(i == 1);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+void test4()
+{
+    Foo a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i == 1)
+            continue;
+        u++;
+    }
+    assert(i == 2);
+    assert(a.array[0] == 73 && a.array[1] == 83);
+}
+
+/**************************************************/
+
+void test5()
+{
+    Foo a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+Loop:
+    while (1)
+    {
+        foreach (ref uint u; a)
+        {
+            i++;
+            if (i)
+                break Loop;
+            u++;
+        }
+    }
+    assert(i == 1);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+void test6()
+{
+    Foo a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+Loop:
+    while (1)
+    {
+        foreach (ref uint u; a)
+        {
+            i++;
+            if (i == 1)
+                continue Loop;
+            u++;
+        }
+        break;
+    }
+    assert(i == 3);
+    assert(a.array[0] == 74);
+    assert(a.array[1] == 83);
+}
+
+/**************************************************/
+
+void test7()
+{
+    Foo a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            goto Label;
+        u++;
+    }
+    assert(0);
+Label:
+    assert(i == 1);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+void test8_x(Foo a)
+{
+    int i;
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            return;
+        u++;
+    }
+}
+
+void test8()
+{
+    Foo a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    test8_x(a);
+    assert(i == 0);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+int test9_x(Foo a)
+{
+    int i;
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            return 67;
+        u++;
+    }
+    return 23;
+}
+
+void test9()
+{
+    Foo a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    i = test9_x(a);
+    assert(i == 67);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+int test10_x(Foo a)
+{
+    int i;
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            return i;
+        u++;
+    }
+    return 23;
+}
+
+void test10()
+{
+    Foo a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    i = test10_x(a);
+    assert(i == 1);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/foreach4.d b/gcc/testsuite/gdc.test/runnable/foreach4.d
new file mode 100644
index 00000000000..32ac4663f1e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/foreach4.d
@@ -0,0 +1,930 @@
+
+import core.stdc.stdio;
+import std.stdio;
+
+alias bool bit;
+
+/************************************************/
+
+class Foo
+{
+    uint array[2];
+
+    int opApply(int delegate(ref uint) dg)
+    {
+        int result;
+        for (int i = 0; i < array.length; i++)
+        {
+            result = dg(array[i]);
+            if (result)
+                break;
+        }
+        return result;
+    }
+}
+
+
+/**************************************************/
+
+void test1()
+{
+    Foo a = new Foo();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (uint u; a)
+    {
+        i++;
+        u++;
+    }
+    assert(i == 2);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+void test2()
+{
+    Foo a = new Foo();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        u++;
+    }
+    assert(i == 2);
+    assert(a.array[0] == 74);
+    assert(a.array[1] == 83);
+}
+
+/**************************************************/
+
+void test3()
+{
+    Foo a = new Foo();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            break;
+        u++;
+    }
+    assert(i == 1);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+void test4()
+{
+    Foo a = new Foo();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i == 1)
+            continue;
+        u++;
+    }
+    assert(i == 2);
+    assert(a.array[0] == 73 && a.array[1] == 83);
+}
+
+/**************************************************/
+
+void test5()
+{
+    Foo a = new Foo();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+Loop:
+    while (1)
+    {
+        foreach (ref uint u; a)
+        {
+            i++;
+            if (i)
+                break Loop;
+            u++;
+        }
+    }
+    assert(i == 1);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+void test6()
+{
+    Foo a = new Foo();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+Loop:
+    while (1)
+    {
+        foreach (ref uint u; a)
+        {
+            i++;
+            if (i == 1)
+                continue Loop;
+            u++;
+        }
+        break;
+    }
+    assert(i == 3);
+    assert(a.array[0] == 74);
+    assert(a.array[1] == 83);
+}
+
+/**************************************************/
+
+void test7()
+{
+    Foo a = new Foo();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            goto Label;
+        u++;
+    }
+    assert(0);
+Label:
+    assert(i == 1);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+void test8_x(Foo a)
+{
+    int i;
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            return;
+        u++;
+    }
+}
+
+void test8()
+{
+    Foo a = new Foo();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    test8_x(a);
+    assert(i == 0);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+int test9_x(Foo a)
+{
+    int i;
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            return 67;
+        u++;
+    }
+    return 23;
+}
+
+void test9()
+{
+    Foo a = new Foo();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    i = test9_x(a);
+    assert(i == 67);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+int test10_x(Foo a)
+{
+    int i;
+    foreach (ref uint u; a)
+    {
+        i++;
+        if (i)
+            return i;
+        u++;
+    }
+    return 23;
+}
+
+void test10()
+{
+    Foo a = new Foo();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    i = test10_x(a);
+    assert(i == 1);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+/+
+the expected output:
+
+1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0
+1
+1 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 1 1 1 0
+1 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 1 1 1 0
+1 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 1 1 1 0
++/
+
+void test11()
+{
+    bit[25] data;
+    int j;
+
+    for (int i = 0; i < 25; i += 5) {
+        data[i+0] = data[i+1] = true;
+    }
+
+    for (int i = 0; i < 25; i++) {
+        printf("%d ", data[i]);
+        if ((i % 5) < 2)
+            assert(data[i] == true);
+        else
+            assert(data[i] == false);
+    }
+
+    printf("\n%d\n", data[22] = true);
+    j = data[22] = true;
+    assert(j == true);
+
+    for (int i = 0; i < 25; i += 5) {
+        data[i+1] = data[i+3] = true;
+        j = i % 5;
+        if (j == 0 || j == 1 || j == 3)
+            assert(data[i] == true);
+        else
+            assert(data[i] == false);
+    }
+
+    for (int i = 0; i < 25; i++) {
+        printf("%d ", data[i]);
+    }
+
+    printf("\n");
+
+    int k;
+    foreach (bit b; data) {
+        printf("%d ", b);
+        j = k % 5;
+        if (j == 0 || j == 1 || j == 3 || k == 22)
+            assert(data[k] == true);
+        else
+            assert(data[k] == false);
+        k++;
+    }
+    printf("\n");
+
+    foreach (int l, bit b; data) {
+        printf("%d ", b);
+        j = l % 5;
+        if (j == 0 || j == 1 || j == 3 || l == 22)
+            assert(data[l] == true);
+        else
+            assert(data[l] == false);
+    }
+    printf("\n");
+}
+
+
+/**************************************************/
+
+void test12()
+{
+    int j;
+
+    j = 0;
+    foreach (dchar d; "hello")
+    {
+        printf("d = x%x\n", d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        j++;
+    }
+    assert(j == 5);
+
+    j = 0;
+    foreach (size_t i, dchar d; "hello")
+    {
+        printf("i = %d, d = x%x\n", i, d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        assert(i == j);
+        j++;
+    }
+    assert(j == 5);
+}
+
+/**************************************************/
+
+void test13()
+{
+    int j;
+
+    j = 0;
+    foreach (wchar d; "hello")
+    {
+        printf("d = x%x\n", d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        j++;
+    }
+    assert(j == 5);
+
+    j = 0;
+    foreach (size_t i, wchar d; "hello")
+    {
+        printf("i = %d, d = x%x\n", i, d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        assert(i == j);
+        j++;
+    }
+    assert(j == 5);
+}
+
+/**************************************************/
+
+void test14()
+{
+    int j;
+
+    j = 0;
+    foreach (char d; cast(wstring)"hello")
+    {
+        printf("d = x%x\n", d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        j++;
+    }
+    assert(j == 5);
+
+    j = 0;
+    foreach (size_t i, char d; cast(wstring)"hello")
+    {
+        printf("i = %d, d = x%x\n", i, d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        assert(i == j);
+        j++;
+    }
+    assert(j == 5);
+}
+
+/**************************************************/
+
+void test15()
+{
+    int j;
+
+    j = 0;
+    foreach (dchar d; cast(wstring)"hello")
+    {
+        printf("d = x%x\n", d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        j++;
+    }
+    assert(j == 5);
+
+    j = 0;
+    foreach (size_t i, dchar d; cast(wstring)"hello")
+    {
+        printf("i = %d, d = x%x\n", i, d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        assert(i == j);
+        j++;
+    }
+    assert(j == 5);
+}
+
+/**************************************************/
+
+void test16()
+{
+    int j;
+
+    j = 0;
+    foreach (char d; cast(dstring)"hello")
+    {
+        printf("d = x%x\n", d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        j++;
+    }
+    assert(j == 5);
+
+    j = 0;
+    foreach (size_t i, char d; cast(dstring)"hello")
+    {
+        printf("i = %d, d = x%x\n", i, d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        assert(i == j);
+        j++;
+    }
+    assert(j == 5);
+}
+
+/**************************************************/
+
+void test17()
+{
+    int j;
+
+    j = 0;
+    foreach (wchar d; cast(dstring)"hello")
+    {
+        printf("d = x%x\n", d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        j++;
+    }
+    assert(j == 5);
+
+    j = 0;
+    foreach (size_t i, wchar d; cast(dstring)"hello")
+    {
+        printf("i = %d, d = x%x\n", i, d);
+        if (j == 0) assert(d == 'h');
+        if (j == 1) assert(d == 'e');
+        if (j == 2) assert(d == 'l');
+        if (j == 3) assert(d == 'l');
+        if (j == 4) assert(d == 'o');
+        assert(i == j);
+        j++;
+    }
+    assert(j == 5);
+}
+
+/**************************************************/
+
+void test18()
+{
+    string a = "\xE2\x89\xA0";      // \u2260 encoded as 3 UTF-8 bytes
+
+    foreach (dchar c; a)
+    {
+        printf("a[] = %x\n", c);    // prints 'a[] = 2260'
+        assert(c == 0x2260);
+    }
+
+    dstring b = "\u2260";
+
+    int i;
+    foreach (char c; b)
+    {
+        printf("%x, ", c);      // prints e2, 89, a0
+        if (i == 0) assert(c == 0xE2);
+        else if (i == 1) assert(c == 0x89);
+        else if (i == 2) assert(c == 0xA0);
+        else
+            assert(0);
+        i++;
+    }
+    printf("\n");
+}
+
+/**************************************************/
+
+void test19()
+{
+    string string = x"F0 9D 83 93";
+
+    int count=0;
+    dchar tmp;
+    foreach(dchar value ; string){
+        tmp=value;
+        count++;
+    }
+    assert(count==1);
+    assert(tmp==0x01D0D3);
+}
+
+/**************************************************/
+
+struct S20
+{
+    int opApply(int delegate(ref int i) dg)
+    {
+       return 0;
+    }
+}
+
+S20 foo20;
+
+void test20()
+{
+    label:
+    foreach(int i; foo20)
+    {
+       continue label;
+    }
+}
+
+
+/**************************************************/
+
+void foo21(string[] args)
+{
+    printf("args.length = %d\n", args.length);
+    assert(args.length == 3);
+    foreach (i, arg; args)
+    {
+        assert(typeid(typeof(i)) == typeid(size_t));
+        assert(typeid(typeof(arg)) == typeid(string));
+        writefln("args[%d] = '%s'", i, arg);
+    }
+    foreach (arg; args)
+    {
+        assert(typeid(typeof(arg)) == typeid(string));
+        writefln("args[] = '%s'", arg);
+    }
+}
+
+void test21()
+{
+    string[] args;
+
+    args.length = 3;
+    args[0] = "a";
+    args[1] = "bc";
+    args[2] = "d";
+    foo21(args);
+}
+
+/**************************************************/
+
+void test22()
+{
+    int[string] map;
+
+    map["hello"] = 3;
+    map["world"] = 4;
+
+    foreach (key, value; map)
+    {
+        assert(typeid(typeof(key)) == typeid(string));
+        assert(typeid(typeof(value)) == typeid(int));
+        writefln("map[%s] = %s", key, value);
+    }
+    foreach (key, int value; map)
+    {
+        assert(typeid(typeof(key)) == typeid(string));
+        assert(typeid(typeof(value)) == typeid(int));
+        writefln("map[%s] = %s", key, value);
+    }
+    foreach (string key, value; map)
+    {
+        assert(typeid(typeof(key)) == typeid(string));
+        assert(typeid(typeof(value)) == typeid(int));
+        writefln("map[%s] = %s", key, value);
+    }
+    foreach (value; map)
+    {
+        assert(typeid(typeof(value)) == typeid(int));
+        writefln("map[] = %s", value);
+    }
+}
+
+/**************************************************/
+
+class Foo23
+{
+    int array[2];
+
+    int opApply(int delegate(ref int) dg)
+    {
+        int result;
+        for (int i = 0; i < array.length; i++)
+        {
+            result = dg(array[i]);
+            if (result)
+                break;
+        }
+        return result;
+    }
+
+    int opApply(int delegate(ref size_t, ref int) dg)
+    {
+        int result;
+        for (size_t i = 0; i < array.length; i++)
+        {
+            result = dg(i, array[i]);
+            if (result)
+                break;
+        }
+        return result;
+    }
+}
+
+void test23()
+{
+    Foo23 a = new Foo23();
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (u; a)
+    {
+        assert(typeid(typeof(u)) == typeid(int));
+        i++;
+        u++;
+        //writefln("u = %d", u);
+        assert((i == 1) ? u == 74 : u == 83);
+    }
+    assert(i == 2);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+
+    foreach (j, u; a)
+    {
+        assert(typeid(typeof(j)) == typeid(size_t));
+        assert(typeid(typeof(u)) == typeid(int));
+        i++;
+        u++;
+        writefln("u = %d", u);
+        assert((i == 3) ? u == 74 : u == 83);
+        assert(j == i - 3);
+    }
+    assert(i == 4);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+}
+
+/**************************************************/
+
+struct Collection24
+{
+    int opApply(int delegate(ref int) dg){
+        return 0;
+    }
+}
+
+bool foo24()
+{
+    Collection24 a,b;
+
+    foreach(int x; a){
+        foreach(int y; b){
+            return false;
+        }
+    }
+
+    return true;
+}
+
+void test24()
+{
+    assert(foo24() == true);
+}
+
+/**************************************************/
+
+void test25()
+{
+    alias void function(string[string]) FN;
+    FN fn = function (string[string] aarray)
+    {
+        foreach (string s; aarray)
+        {
+            writeln(s);
+            assert(s == "b");
+        }
+    };
+    string[string] aarray;
+    aarray["a"] = "b";
+    fn(aarray);
+}
+
+/**************************************************/
+
+struct Foo26
+{
+    uint array[2];
+
+    int forward(int delegate(ref uint) dg)
+    {
+        int result;
+        for (int i = 0; i < array.length; i++)
+        {
+            result = dg(array[i]);
+            if (result)
+                break;
+        }
+        return result;
+    }
+
+    int forward(int delegate(ref uint) dg, int x) { return 1; }
+
+    int reverse(int delegate(ref uint) dg, int x) { return 1; }
+
+    int reverse(int delegate(ref uint) dg)
+    {
+        int result;
+        foreach_reverse (v; array)
+        {
+            auto u = v;
+            result = dg(u);
+            if (result)
+                break;
+        }
+        return result;
+    }
+}
+
+
+void test26()
+{
+    Foo26 a;
+    int i;
+
+    a.array[0] = 73;
+    a.array[1] = 82;
+
+    foreach (u; &a.forward)
+    {
+        writeln(u);
+        i++;
+        u++;
+    }
+    assert(i == 2);
+    assert(a.array[0] == 73);
+    assert(a.array[1] == 82);
+
+    foreach (uint u; &a.reverse)
+    {
+        writeln(u);
+    }
+}
+
+/**************************************************/
+
+struct S27
+{
+    int[] a;
+
+    bool empty() { return a.length == 0; }
+
+    void popFront() { a = a[1 .. $]; }
+    int front() { return a[0]; }
+
+    void popBack() { a = a[0 .. $ - 1]; }
+    ref int back() { return a[$ - 1]; }
+}
+
+void test27()
+{
+    S27 s;
+    s.a = [5,6,7];
+    string r;
+
+    foreach (e; s)
+    {
+        printf("%d\n", e);
+        r ~= cast(char)(e + '0');
+    }
+    assert(r == "567");
+
+    r = null;
+    foreach_reverse (ref e; s)
+    {
+        e++;
+        printf("%d\n", e);
+        r ~= cast(char)(e + '0');
+    }
+    assert(r == "876");
+
+    r = null;
+    foreach (e; s)
+    {
+        printf("%d\n", e);
+        r ~= cast(char)(e + '0');
+    }
+    assert(r == "678");
+}
+
+/**************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/foreach5.d b/gcc/testsuite/gdc.test/runnable/foreach5.d
new file mode 100644
index 00000000000..0566d5040a4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/foreach5.d
@@ -0,0 +1,1119 @@
+
+extern(C) int printf(const char* fmt, ...);
+
+/***************************************/
+
+void test1()
+{
+    char[] a;
+
+    int foo()
+    {
+        printf("foo\n");
+        a ~= "foo";
+        return 10;
+    }
+
+    foreach (i; 0 .. foo())
+    {
+        printf("%d\n", i);
+        a ~= cast(char)('0' + i);
+    }
+    assert(a == "foo0123456789");
+
+    foreach_reverse (i; 0 .. foo())
+    {
+        printf("%d\n", i);
+        a ~= cast(char)('0' + i);
+    }
+    assert(a == "foo0123456789foo9876543210");
+}
+
+/***************************************/
+// 2411
+
+struct S2411
+{
+    int n;
+    string s;
+}
+
+void test2411()
+{
+    S2411 s;
+    assert(s.n == 0);
+    assert(s.s == "");
+    foreach (i, ref e; s.tupleof)
+    {
+        static if (i == 0)
+            e = 10;
+        static if (i == 1)
+            e = "str";
+    }
+    assert(s.n == 10);
+    assert(s.s == "str");
+}
+
+/***************************************/
+// 2442
+
+template canForeach(T, E)
+{
+    enum canForeach = __traits(compiles,
+    {
+        foreach(a; new T)
+        {
+            static assert(is(typeof(a) == E));
+        }
+    });
+}
+
+void test2442()
+{
+    struct S1
+    {
+        int opApply(int delegate(ref const(int) v) dg) const { return 0; }
+        int opApply(int delegate(ref int v) dg)              { return 0; }
+    }
+          S1 ms1;
+    const S1 cs1;
+    foreach (x; ms1) { static assert(is(typeof(x) ==       int)); }
+    foreach (x; cs1) { static assert(is(typeof(x) == const int)); }
+
+    struct S2
+    {
+        int opApply(int delegate(ref  int v) dg) { return 0; }
+        int opApply(int delegate(ref long v) dg) { return 0; }
+    }
+    S2 ms2;
+    static assert(!__traits(compiles, { foreach (    x; ms2) {} }));    // ambiguous
+    static assert( __traits(compiles, { foreach (int x; ms2) {} }));
+
+    struct S3
+    {
+        int opApply(int delegate(ref int v) dg) const        { return 0; }
+        int opApply(int delegate(ref int v) dg) shared const { return 0; }
+    }
+    immutable S3 ms3;
+    static assert(!__traits(compiles, { foreach (int x; ms3) {} }));    // ambiguous
+
+    // from https://github.com/D-Programming-Language/dmd/pull/120
+    static class C
+    {
+        int opApply(int delegate(ref              int v) dg)              { return 0; }
+        int opApply(int delegate(ref        const int v) dg) const        { return 0; }
+        int opApply(int delegate(ref    immutable int v) dg) immutable    { return 0; }
+        int opApply(int delegate(ref       shared int v) dg) shared       { return 0; }
+        int opApply(int delegate(ref shared const int v) dg) shared const { return 0; }
+    }
+    static class D
+    {
+        int opApply(int delegate(ref int v) dg) const        { return 0; }
+    }
+    static class E
+    {
+        int opApply(int delegate(ref int v) dg) shared const { return 0; }
+    }
+
+    static assert( canForeach!(             C  ,              int  ));
+    static assert( canForeach!(       const(C) ,        const(int) ));
+    static assert( canForeach!(   immutable(C) ,    immutable(int) ));
+    static assert( canForeach!(      shared(C) ,       shared(int) ));
+    static assert( canForeach!(shared(const(C)), shared(const(int))));
+
+    static assert( canForeach!(             D  , int));
+    static assert( canForeach!(       const(D) , int));
+    static assert( canForeach!(   immutable(D) , int));
+    static assert(!canForeach!(      shared(D) , int));
+    static assert(!canForeach!(shared(const(D)), int));
+
+    static assert(!canForeach!(             E  , int));
+    static assert(!canForeach!(       const(E) , int));
+    static assert( canForeach!(   immutable(E) , int));
+    static assert( canForeach!(      shared(E) , int));
+    static assert( canForeach!(shared(const(E)), int));
+}
+
+/***************************************/
+// 2443
+
+struct S2443
+{
+    int[] arr;
+    int opApply(int delegate(size_t i, ref int v) dg)
+    {
+        int result = 0;
+        foreach (i, ref x; arr)
+        {
+            if ((result = dg(i, x)) != 0)
+                break;
+        }
+        return result;
+    }
+}
+
+void test2443()
+{
+    S2443 s;
+    foreach (i, ref v; s) {}
+    foreach (i,     v; s) {}
+    static assert(!__traits(compiles, { foreach (ref i, ref v; s) {} }));
+    static assert(!__traits(compiles, { foreach (ref i,     v; s) {} }));
+}
+
+/***************************************/
+// 3187
+
+class Collection
+{
+    int opApply(int delegate(ref Object) a)
+    {
+        return 0;
+    }
+}
+
+Object testForeach(Collection level1, Collection level2)
+{
+    foreach (first; level1) {
+        foreach (second; level2)
+            return second;
+    }
+    return null;
+}
+
+void test3187()
+{
+    testForeach(new Collection, new Collection);
+}
+
+/***************************************/
+// 4090
+
+void test4090a()
+{
+    double[10] arr = 1;
+    double tot = 0;
+
+  static assert(!__traits(compiles, {
+    foreach (immutable ref x; arr) {}
+  }));
+    foreach (const ref x; arr)
+    {
+        static assert(is(typeof(x) == const double));
+        tot += x;
+    }
+    foreach (immutable x; arr)
+    {
+        static assert(is(typeof(x) == immutable double));
+        tot += x;
+    }
+    assert(tot == 1*10 + 1*10);
+}
+
+void test4090b()
+{
+    int tot = 0;
+
+  static assert(!__traits(compiles, {
+    foreach (immutable ref x; 1..11) {}
+  }));
+    foreach (const ref x; 1..11)
+    {
+        static assert(is(typeof(x) == const int));
+        tot += x;
+    }
+    foreach (immutable x; 1..11)
+    {
+        static assert(is(typeof(x) == immutable int));
+        tot += x;
+    }
+    assert(tot == 55 + 55);
+}
+
+/***************************************/
+// 5605
+
+struct MyRange
+{
+    int theOnlyOne;
+
+    @property bool empty() const
+    {
+        return true;
+    }
+
+    @property ref int front()
+    {
+        return theOnlyOne;
+    }
+
+    void popFront()
+    {}
+}
+
+struct MyCollection
+{
+    MyRange opSlice() const
+    {
+        return MyRange();
+    }
+}
+
+void test5605()
+{
+    auto coll = MyCollection();
+
+    foreach (i; coll) {            // <-- compilation error
+        // ...
+    }
+}
+
+/***************************************/
+// 7004
+
+void func7004(A...)(A args)
+{
+    foreach (i, e; args){}        // OK
+    foreach (uint i, e; args){}   // OK
+    foreach (size_t i, e; args){} // NG
+}
+void test7004()
+{
+    func7004(1, 3.14);
+}
+
+/***************************************/
+// 7406
+
+template TypeTuple7406(T...)
+{
+    alias T TypeTuple7406;
+}
+
+template foobar7406(T)
+{
+    enum foobar = 2;
+}
+
+void test7406()
+{
+    foreach (sym; TypeTuple7406!(int, double))     // OK
+        pragma(msg, sym.stringof);
+
+    foreach (sym; TypeTuple7406!(foobar7406))      // OK
+        pragma(msg, sym.stringof);
+
+    foreach (sym; TypeTuple7406!(test7406))        // OK
+        pragma(msg, sym.stringof);
+
+    foreach (sym; TypeTuple7406!(int, foobar7406)) // Error: type int has no value
+        pragma(msg, sym.stringof);
+
+    foreach (sym; TypeTuple7406!(int, test7406))   // Error: type int has no value
+        pragma(msg, sym.stringof);
+}
+
+/***************************************/
+// 6659
+
+void test6659()
+{
+    static struct Iter
+    {
+        ~this()
+        {
+            ++_dtor;
+        }
+
+        bool opCmp(ref const Iter rhs) { return _pos == rhs._pos; }
+        void opUnary(string op:"++")() { ++_pos; }
+        size_t _pos;
+
+        static size_t _dtor;
+    }
+
+    foreach (ref iter; Iter(0) .. Iter(10))
+    {
+        assert(Iter._dtor == 0);
+    }
+    assert(Iter._dtor == 2);
+
+    Iter._dtor = 0; // reset
+
+    for (auto iter = Iter(0), limit = Iter(10); iter != limit; ++iter)
+    {
+        assert(Iter._dtor == 0);
+    }
+    assert(Iter._dtor == 2);
+}
+
+void test6659a()
+{
+    auto value = 0;
+    try
+    {
+        for ({scope(success) { assert(value == 1); value = 2;} }  true; )
+        {
+            value = 1;
+            break;
+        }
+        assert(value == 2);
+    }
+    catch (Exception e)
+    {
+        assert(0);
+    }
+    assert(value == 2);
+}
+
+void test6659b()
+{
+    auto value = 0;
+    try
+    {
+        for ({scope(failure) value = 1;}  true; )
+        {
+            throw new Exception("");
+        }
+        assert(0);
+    }
+    catch (Exception e)
+    {
+        assert(e);
+    }
+    assert(value == 1);
+}
+
+void test6659c()
+{
+    auto value = 0;
+    try
+    {
+        for ({scope(exit) value = 1;}  true; )
+        {
+            throw new Exception("");
+        }
+        assert(0);
+    }
+    catch (Exception e)
+    {
+        assert(e);
+    }
+    assert(value == 1);
+}
+
+/***************************************/
+
+// 10221
+
+void test10221()
+{
+    // All of these should work, but most are too slow.  Just check they compile.
+    foreach(char i; char.min..char.max+1) {}
+    if (0) foreach(wchar i; wchar.min..wchar.max+1) {}
+    if (0) foreach(dchar i; dchar.min..dchar.max+1) {}
+    foreach(byte i; byte.min..byte.max+1) {}
+    foreach(ubyte i; ubyte.min..ubyte.max+1) {}
+    if (0) foreach(short i; short.min..short.max+1) {}
+    if (0) foreach(ushort i; ushort.min..ushort.max+1) {}
+    if (0) foreach(int i; int.min..int.max+1U) {}
+    if (0) foreach(uint i; uint.min..uint.max+1L) {}
+    if (0) foreach(long i; long.min..long.max+1UL) {}
+
+    foreach_reverse(char i; char.min..char.max+1) { assert(i == typeof(i).max); break; }
+    foreach_reverse(wchar i; wchar.min..wchar.max+1) { assert(i == typeof(i).max); break; }
+    foreach_reverse(dchar i; dchar.min..dchar.max+1) { assert(i == typeof(i).max); break; }
+    foreach_reverse(byte i; byte.min..byte.max+1) { assert(i == typeof(i).max); break; }
+    foreach_reverse(ubyte i; ubyte.min..ubyte.max+1) { assert(i == typeof(i).max); break; }
+    foreach_reverse(short i; short.min..short.max+1) { assert(i == typeof(i).max); break; }
+    foreach_reverse(ushort i; ushort.min..ushort.max+1) { assert(i == typeof(i).max); break; }
+    foreach_reverse(int i; int.min..int.max+1U) { assert(i == typeof(i).max); break; }
+    foreach_reverse(uint i; uint.min..uint.max+1L) { assert(i == typeof(i).max); break; }
+    foreach_reverse(long i; long.min..long.max+1UL) { assert(i == typeof(i).max); break; }
+}
+
+/***************************************/
+// 7814
+
+struct File7814
+{
+    ~this(){}
+}
+
+struct ByLine7814
+{
+    File7814 file;
+
+    // foreach interface
+    @property bool empty() const    { return true; }
+    @property char[] front()        { return null; }
+    void popFront(){}
+}
+
+void test7814()
+{
+    int dummy;
+    ByLine7814 f;
+    foreach (l; f) {
+        scope(failure) // 'failure' or 'success' fails, but 'exit' works
+            dummy = -1;
+        dummy = 0;
+    }
+}
+
+/***************************************/
+// 10049
+
+struct ByLine10049
+{
+    bool empty() { return true; }
+    string front() { return null; }
+    void popFront() {}
+
+    ~this() {}  // necessary
+}
+
+void test10049()
+{
+    ByLine10049 r;
+    foreach (line; r)
+    {
+        doNext:
+            {}
+    }
+}
+
+/******************************************/
+
+struct T11955(T...) { T field; alias field this; }
+
+alias X11955 = uint;
+
+struct S11955
+{
+    enum empty = false;
+    T11955!(uint, uint) front;
+    void popFront() {}
+}
+
+void test11955()
+{
+    foreach(X11955 i, v; S11955()) {}
+}
+
+/******************************************/
+// 6652
+
+void test6652()
+{
+    size_t sum;
+    foreach (i; 0 .. 10)
+        sum += i++; // 0123456789
+    assert(sum == 45);
+
+    sum = 0;
+    foreach (ref i; 0 .. 10)
+        sum += i++; // 02468
+    assert(sum == 20);
+
+    sum = 0;
+    foreach_reverse (i; 0 .. 10)
+        sum += i--; // 9876543210
+    assert(sum == 45);
+
+    sum = 0;
+    foreach_reverse (ref i; 0 .. 10)
+        sum += i--; // 97531
+    assert(sum == 25);
+
+    enum ary = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+    sum = 0;
+    foreach (i, v; ary)
+    {
+        assert(i == v);
+        sum += i++; // 0123456789
+    }
+    assert(sum == 45);
+
+    sum = 0;
+    foreach (ref i, v; ary)
+    {
+        assert(i == v);
+        sum += i++; // 02468
+    }
+    assert(sum == 20);
+
+    sum = 0;
+    foreach_reverse (i, v; ary)
+    {
+        assert(i == v);
+        sum += i--; // 9876543210
+    }
+    assert(sum == 45);
+
+    sum = 0;
+    foreach_reverse (ref i, v; ary)
+    {
+        assert(i == v);
+        sum += i--; // 97531
+    }
+    assert(sum == 25);
+
+    static struct Iter
+    {
+        ~this()
+        {
+            ++_dtorCount;
+        }
+
+        bool opCmp(ref const Iter rhs)
+        {
+            return _pos == rhs._pos;
+        }
+
+        void opUnary(string op)() if(op == "++" || op == "--")
+        {
+            mixin(op ~ q{_pos;});
+        }
+
+        size_t _pos;
+        static size_t _dtorCount;
+    }
+
+    Iter._dtorCount = sum = 0;
+    foreach (v; Iter(0) .. Iter(10))
+        sum += v._pos++; // 0123456789
+    assert(sum == 45 && Iter._dtorCount == 12);
+
+    Iter._dtorCount = sum = 0;
+    foreach (ref v; Iter(0) .. Iter(10))
+        sum += v._pos++; // 02468
+    assert(sum == 20 && Iter._dtorCount == 2);
+
+    // additional dtor calls due to unnecessary postdecrements
+    Iter._dtorCount = sum = 0;
+    foreach_reverse (v; Iter(0) .. Iter(10))
+        sum += v._pos--; // 9876543210
+    assert(sum == 45 && Iter._dtorCount >= 12);
+
+    Iter._dtorCount = sum = 0;
+    foreach_reverse (ref v; Iter(0) .. Iter(10))
+        sum += v._pos--; // 97531
+    assert(sum == 25 && Iter._dtorCount >= 2);
+}
+
+/***************************************/
+// 8595
+
+struct OpApply8595
+{
+    int opApply(int delegate(ref int) dg)
+    {
+        assert(0);
+    }
+}
+
+string test8595()
+{
+    foreach (elem; OpApply8595.init)
+    {
+        static assert(is(typeof(return) == string));
+    }
+    assert(0);
+}
+
+/***************************************/
+// 9068
+
+struct Foo9068
+{
+    static int[] destroyed;
+    int x;
+    ~this() { destroyed ~= x; }
+}
+
+struct SimpleCounter9068
+{
+    static int destroyedCount;
+    enum int limit = 5;
+    int counter;
+    ~this() { destroyedCount++; }
+
+    // Range primitives.
+    @property bool empty() const { return counter >= limit; }
+    @property int front() { return counter; }
+    void popFront() { counter++; }
+}
+
+void test9068()
+{
+    //----------------------------------------
+    // There was never a bug in this case (no range).
+    int sum;
+loop_simple:
+    foreach (i; [10, 20])
+    {
+        sum += i;
+        break loop_simple;
+    }
+    assert(sum == 10);
+
+    //----------------------------------------
+    // There was a bug with loops over ranges.
+    int last = -1;
+X:  foreach (i; SimpleCounter9068())
+    {
+        switch(i)
+        {
+            case 3:
+                break X;
+            default:
+                last = i;
+       }
+    }
+    assert(last == 2);
+    assert(SimpleCounter9068.destroyedCount == 1);
+
+    //----------------------------------------
+    // Simpler case: the compiler error had nothing to do with the switch.
+    last = -1;
+loop_with_range:
+    foreach (i; SimpleCounter9068())
+    {
+        last = i;
+        break loop_with_range;
+    }
+    assert(last == 0);
+    assert(SimpleCounter9068.destroyedCount == 2);
+
+    //----------------------------------------
+    // Test with destructors: the loop is implicitly wrapped into two
+    // try/finally clauses.
+loop_with_dtors:
+    for (auto x = Foo9068(4), y = Foo9068(5); x.x != 10; ++x.x)
+    {
+        if (x.x == 8)
+            break loop_with_dtors;
+    }
+    assert(Foo9068.destroyed == [5, 8]);
+    Foo9068.destroyed = null;
+
+    //----------------------------------------
+    // Same with an unlabelled break.
+    for (auto x = Foo9068(4), y = Foo9068(5); x.x != 10; ++x.x)
+    {
+        if (x.x == 7)
+            break;
+    }
+    assert(Foo9068.destroyed == [5, 7]);
+    Foo9068.destroyed = null;
+}
+
+/***************************************/
+// 11885
+
+struct Foo11885
+{
+    static int[] destroyed;
+    int x;
+    ~this() { destroyed ~= x; }
+}
+
+struct SimpleCounter11885
+{
+    static int destroyedCount;
+    enum int limit = 5;
+    int counter;
+    ~this() { destroyedCount++; }
+
+    // Range primitives.
+    @property bool empty() const { return counter >= limit; }
+    @property int front() { return counter; }
+    void popFront() { counter++; }
+}
+
+void test11885()
+{
+    //----------------------------------------
+    // There was never a bug in this case (no range).
+    int sum;
+loop_simple:
+    foreach (i; [10, 20])
+    {
+        sum += i;
+        continue loop_simple;
+    }
+    assert(sum == 30);
+
+    //----------------------------------------
+    // There was a bug with loops over ranges.
+    int last = -1;
+X:  foreach (i; SimpleCounter11885())
+    {
+        switch(i)
+        {
+            case 3:
+                continue X;
+            default:
+                last = i;
+       }
+    }
+    assert(last == 4);
+    assert(SimpleCounter11885.destroyedCount == 1);
+
+    //----------------------------------------
+    // Simpler case: the compiler error had nothing to do with the switch.
+    last = -1;
+loop_with_range:
+    foreach (i; SimpleCounter11885())
+    {
+        last = i;
+        continue loop_with_range;
+    }
+    assert(last == 4);
+    assert(SimpleCounter11885.destroyedCount == 2);
+
+    //----------------------------------------
+    // Test with destructors: the loop is implicitly wrapped into two
+    // try/finally clauses.
+loop_with_dtors:
+    for (auto x = Foo11885(4), y = Foo11885(5); x.x != 10; ++x.x)
+    {
+        if (x.x == 8)
+            continue loop_with_dtors;
+    }
+    assert(Foo11885.destroyed == [5, 10]);
+    Foo11885.destroyed = null;
+
+    //----------------------------------------
+    // Same with an unlabelled continue.
+    for (auto x = Foo11885(4), y = Foo11885(5); x.x != 10; ++x.x)
+    {
+        if (x.x == 7)
+            continue;
+    }
+    assert(Foo11885.destroyed == [5, 10]);
+    Foo11885.destroyed = null;
+}
+
+/***************************************/
+// 10475
+
+void test10475a()
+{
+    struct DirIterator
+    {
+        int _store = 42;
+        ~this() { assert(0); }
+    }
+
+    DirIterator dirEntries()
+    {
+        throw new Exception("");
+    }
+
+    try
+    {
+        for (DirIterator c = dirEntries(); true; ) {}
+        assert(0);
+    }
+    catch (Exception e)
+    {
+        assert(e.next is null);
+    }
+}
+
+void test10475b()
+{
+    uint g;
+    struct S
+    {
+        uint flag;
+        ~this() { g |= flag; }
+    }
+
+    S thrown()
+    {
+        throw new Exception("");
+    }
+
+    g = 0x0;
+    try
+    {
+        for (auto x = S(0x1), y = S(0x2), z = thrown(); true; ) {}
+        assert(0);
+    }
+    catch (Exception e)
+    {
+        assert(e.next is null);
+    }
+    assert(g == 0x3);
+
+    g = 0x0;
+    try
+    {
+        for (auto x = S(0x1), y = thrown(), z = S(0x2); true; ) {}
+        assert(0);
+    }
+    catch (Exception e)
+    {
+        assert(e.next is null);
+    }
+    assert(g == 0x1);
+
+    g = 0x0;
+    try
+    {
+        for (auto x = thrown(), y = S(0x1), z = S(0x2); true; ) {}
+        assert(0);
+    }
+    catch (Exception e)
+    {
+        assert(e.next is null);
+    }
+    assert(g == 0x0);
+}
+
+/***************************************/
+// 11291
+
+void test11291()
+{
+    struct Tuple(T...)
+    {
+        T field;
+        alias field this;
+    }
+    struct zip
+    {
+        string[] s1, s2;
+
+        bool empty() { return true; }
+        auto front() { return Tuple!(string, string)(s1[0], s2[0]); }
+        void popFront() {}
+    }
+
+    foreach (const a, const b; zip(["foo"], ["bar"]))
+    {
+        static assert(is(typeof(a) == const string));
+        static assert(is(typeof(b) == const string));
+
+        static assert(!__traits(compiles, a = "something"));
+        static assert(!__traits(compiles, b = "something"));
+    }
+}
+
+/***************************************/
+// 12103
+
+alias TypeTuple12103(TL...) = TL;
+
+alias Id12103(alias a) = a;
+
+void test12103()
+{
+    alias fs1 = TypeTuple12103!(() => 0, () => 1);
+    foreach (i, f; fs1)
+    {
+        static assert(f() == i);
+        static assert(Id12103!f() == i);
+        assert(f() == i);
+        assert(Id12103!f() == i);
+    }
+
+    alias fs2 = TypeTuple12103!(x=>x+0, y=>y+1);
+    foreach (i, f; fs2)
+    {
+        static assert(f(0) == i);
+        static assert(Id12103!f(0) == i);
+        assert(f(0) == i);
+        assert(Id12103!f(0) == i);
+    }
+}
+
+/***************************************/
+// 12739
+
+struct S12739
+{
+nothrow:
+    int opApply(int delegate(ref int) nothrow dg)
+    {
+        return 0;
+    }
+}
+
+void test12739() nothrow
+{
+    S12739 s;
+    foreach (e; s) {}
+}
+
+/***************************************/
+// 12932
+
+void test12932() @nogc
+{
+    int sum;
+    foreach (e; [1,2,3])
+    {
+        sum += e;
+    }
+    assert(sum == 6);
+}
+
+/***************************************/
+// 13756
+
+void test13756()
+{
+    int[int] org = [1:2], aa;
+
+    aa = org.dup;
+    foreach (v; aa)
+    {
+        static assert(is(typeof(v) == int));
+        v = 20;
+    }
+    assert(aa == [1:2]);
+
+    aa = org.dup;
+    foreach (ref v; aa)
+    {
+        static assert(is(typeof(v) == int));
+        v = 20;
+    }
+    assert(aa == [1:20]);
+
+    aa = org.dup;
+    foreach (k, v; aa)
+    {
+        static assert(is(typeof(k) == int));
+        static assert(is(typeof(v) == int));
+        k = 10;
+        v = 20;
+    }
+    assert(aa == [1:2]);
+
+    aa = org.dup;
+    foreach (k, ref v; aa)
+    {
+        static assert(is(typeof(k) == int));
+        static assert(is(typeof(v) == int));
+        k = 10;
+        v = 20;
+    }
+    assert(aa == [1:20]);
+
+    aa = org.dup;
+    foreach (ref k, v; aa)      // NG -> OK
+    {
+        static assert(is(typeof(k) == const int));
+        static assert(is(typeof(v) == int));
+        static assert(!__traits(compiles, k = 10));
+        v = 20;
+    }
+    assert(aa == [1:2]);
+
+    aa = org.dup;
+    foreach (ref k, ref v; aa)  // NG -> OK
+    {
+        static assert(is(typeof(k) == const int));
+        static assert(is(typeof(v) == int));
+        static assert(!__traits(compiles, k = 10));
+        v = 20;
+    }
+    assert(aa == [1:20]);
+
+    foreach (ref const k, v; aa)  // NG -> OK, same with 'ref k'
+    {
+        static assert(is(typeof(k) == const int));
+    }
+}
+
+/***************************************/
+// 14653
+
+static string result14653;
+
+class RangeClass14653
+{
+    int a;
+
+    this(T)(T...) { result14653 ~= "c"; }
+    ~this()       { result14653 ~= "d"; a = -1; }
+
+    @property bool empty() { result14653 ~= "e"; return a >= 2; }
+    @property int front()  { result14653 ~= "f"; assert(a >= 0); return a; }
+    void popFront()        { result14653 ~= "p"; ++a; }
+}
+
+auto scoped14653(T, A...)(A args)
+{
+    static struct Scoped(T)
+    {
+        void[__traits(classInstanceSize, T)] store;
+        T payload() { return cast(T)cast(void*)store.ptr; }
+        alias payload this;
+
+        ~this()
+        {
+            //.destroy(payload);
+            payload.__dtor();
+            (cast(byte[])store)[] = 0;
+        }
+    }
+
+    Scoped!T result = void;
+
+    //emplace!T(result.store[], args);
+    result.store[] = typeid(T).initializer[];
+    result.payload.__ctor(args);
+
+    return result;
+}
+
+void test14653()
+{
+    foreach (e; scoped14653!RangeClass14653(1))
+    {
+        result14653 ~= "b";
+    }
+    assert(result14653 == "cefbpefbped", result14653);
+}
+
+/***************************************/
+
+int main()
+{
+    test1();
+    test2411();
+    test2442();
+    test2443();
+    test3187();
+    test4090a();
+    test4090b();
+    test5605();
+    test7004();
+    test10221();
+    test7406();
+    test6659();
+    test6659a();
+    test6659b();
+    test6659c();
+    test7814();
+    test6652();
+    test9068();
+    test11885();
+    test10475a();
+    test10475b();
+    test11291();
+    test12103();
+    test12739();
+    test12932();
+    test13756();
+    test14653();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/funclit.d b/gcc/testsuite/gdc.test/runnable/funclit.d
new file mode 100644
index 00000000000..2cd6090ecd4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/funclit.d
@@ -0,0 +1,1266 @@
+import core.vararg;
+
+extern (C) int printf(const char*, ...);
+
+/***************************************************/
+// lambda syntax check
+
+auto una(alias dg)(int n)
+{
+    return dg(n);
+}
+auto bin(alias dg)(int n, int m)
+{
+    return dg(n, m);
+}
+void test1()
+{
+    assert(una!(      a  => a*2 )(2) == 4);
+    assert(una!( (    a) => a*2 )(2) == 4);
+    assert(una!( (int a) => a*2 )(2) == 4);
+    assert(una!(             (    a){ return a*2; } )(2) == 4);
+    assert(una!( function    (    a){ return a*2; } )(2) == 4);
+    assert(una!( function int(    a){ return a*2; } )(2) == 4);
+    assert(una!( function    (int a){ return a*2; } )(2) == 4);
+    assert(una!( function int(int a){ return a*2; } )(2) == 4);
+    assert(una!( delegate    (    a){ return a*2; } )(2) == 4);
+    assert(una!( delegate int(    a){ return a*2; } )(2) == 4);
+    assert(una!( delegate    (int a){ return a*2; } )(2) == 4);
+    assert(una!( delegate int(int a){ return a*2; } )(2) == 4);
+
+    // partial parameter specialization syntax
+    assert(bin!( (    a,     b) => a*2+b )(2,1) == 5);
+    assert(bin!( (int a,     b) => a*2+b )(2,1) == 5);
+    assert(bin!( (    a, int b) => a*2+b )(2,1) == 5);
+    assert(bin!( (int a, int b) => a*2+b )(2,1) == 5);
+    assert(bin!(             (    a,     b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!(             (int a,     b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!(             (    a, int b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!(             (int a, int b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( function    (    a,     b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( function    (int a,     b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( function    (    a, int b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( function    (int a, int b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( function int(    a,     b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( function int(int a,     b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( function int(    a, int b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( function int(int a, int b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( delegate    (    a,     b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( delegate    (int a,     b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( delegate    (    a, int b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( delegate    (int a, int b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( delegate int(    a,     b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( delegate int(int a,     b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( delegate int(    a, int b){ return a*2+b; } )(2,1) == 5);
+    assert(bin!( delegate int(int a, int b){ return a*2+b; } )(2,1) == 5);
+}
+
+/***************************************************/
+// on initializer
+
+void test2()
+{
+    // explicit typed binding ignite parameter types inference
+    int function(int) fn1 = a => a*2;                               assert(fn1(2) == 4);
+    int function(int) fn2 =             (    a){ return a*2; };     assert(fn2(2) == 4);
+    int function(int) fn3 = function    (    a){ return a*2; };     assert(fn3(2) == 4);
+    int function(int) fn4 = function int(    a){ return a*2; };     assert(fn4(2) == 4);
+    int function(int) fn5 = function    (int a){ return a*2; };     assert(fn5(2) == 4);
+    int function(int) fn6 = function int(int a){ return a*2; };     assert(fn6(2) == 4);
+    int delegate(int) dg1 = a => a*2;                               assert(dg1(2) == 4);
+    int delegate(int) dg2 =             (    a){ return a*2; };     assert(dg2(2) == 4);
+    int delegate(int) dg3 = delegate    (    a){ return a*2; };     assert(dg3(2) == 4);
+    int delegate(int) dg4 = delegate int(    a){ return a*2; };     assert(dg4(2) == 4);
+    int delegate(int) dg5 = delegate    (int a){ return a*2; };     assert(dg5(2) == 4);
+    int delegate(int) dg6 = delegate int(int a){ return a*2; };     assert(dg6(2) == 4);
+
+    // funciton/delegate mismatching always raises an error
+    static assert(!__traits(compiles, { int function(int) xfg3 = delegate    (    a){ return a*2; }; }));
+    static assert(!__traits(compiles, { int function(int) xfg4 = delegate int(    a){ return a*2; }; }));
+    static assert(!__traits(compiles, { int function(int) xfg5 = delegate    (int a){ return a*2; }; }));
+    static assert(!__traits(compiles, { int function(int) xfg6 = delegate int(int a){ return a*2; }; }));
+    static assert(!__traits(compiles, { int delegate(int) xdn3 = function    (    a){ return a*2; }; }));
+    static assert(!__traits(compiles, { int delegate(int) xdn4 = function int(    a){ return a*2; }; }));
+    static assert(!__traits(compiles, { int delegate(int) xdn5 = function    (int a){ return a*2; }; }));
+    static assert(!__traits(compiles, { int delegate(int) xdn6 = function int(int a){ return a*2; }; }));
+
+    // auto binding requires explicit parameter types at least
+    static assert(!__traits(compiles, { auto afn1 = a => a*2;                           }));
+    static assert(!__traits(compiles, { auto afn2 =             (    a){ return a*2; }; }));
+    static assert(!__traits(compiles, { auto afn3 = function    (    a){ return a*2; }; }));
+    static assert(!__traits(compiles, { auto afn4 = function int(    a){ return a*2; }; }));
+    static assert(!__traits(compiles, { auto adg3 = delegate    (    a){ return a*2; }; }));
+    static assert(!__traits(compiles, { auto adg4 = delegate int(    a){ return a*2; }; }));
+    auto afn5 = function    (int a){ return a*2; };     assert(afn5(2) == 4);
+    auto afn6 = function int(int a){ return a*2; };     assert(afn6(2) == 4);
+    auto adg5 = delegate    (int a){ return a*2; };     assert(adg5(2) == 4);
+    auto adg6 = delegate int(int a){ return a*2; };     assert(adg6(2) == 4);
+
+    // partial specialized lambda
+    string delegate(int, string) dg =
+        (n, string s){
+            string r = "";
+            foreach (_; 0..n) r~=s;
+            return r;
+        };
+    assert(dg(2, "str") == "strstr");
+}
+
+/***************************************************/
+// on return statement
+
+void test3()
+{
+    // inference matching system is same as on initializer
+    int delegate(int) mul(int x)
+    {
+        return a => a * x;
+    }
+    assert(mul(5)(2) == 10);
+}
+
+/***************************************************/
+// on function arguments
+
+auto foo4(int delegate(int) dg) { return dg(10); }
+auto foo4(int delegate(int, int) dg) { return dg(10, 20); }
+
+void nbar4fp(void function(int) fp) { }
+void nbar4dg(void delegate(int) dg) { }
+void tbar4fp(T,R)(R function(T) dg) { static assert(is(typeof(dg) == void function(int))); }
+void tbar4dg(T,R)(R delegate(T) dg) { static assert(is(typeof(dg) == void delegate(int))); }
+
+auto nbaz4(void function() fp) { return 1; }
+auto nbaz4(void delegate() dg) { return 2; }
+auto tbaz4(R)(R function() dg) { static assert(is(R == void)); return 1; }
+auto tbaz4(R)(R delegate() dg) { static assert(is(R == void)); return 2; }
+
+auto thoo4(T)(T lambda){ return lambda; }
+
+void tfun4a()(int function(int) a){}
+void tfun4b(T)(T function(T) a){}
+void tfun4c(T)(T f){}
+
+void test4()
+{
+    int v;
+    static void sfoo() {}
+           void nfoo() {}
+
+    // parameter type inference + overload resolution
+    assert(foo4((a)   => a * 2) == 20);
+    assert(foo4((a,b) => a * 2 + b) == 40);
+
+    // function/delegate inference
+    nbar4fp((int x){ });
+    nbar4dg((int x){ });
+    tbar4fp((int x){ });
+    tbar4dg((int x){ });
+
+    // function/delegate inference + overload resolution
+    assert(nbaz4({ }) == 1);
+    assert(nbaz4({ v = 1; }) == 2);
+    assert(nbaz4({ sfoo(); }) == 1);    // Bugzilla 8836
+    assert(nbaz4({ nfoo(); }) == 2);
+
+    assert(tbaz4({ }) == 1);
+    assert(tbaz4({ v = 1; }) == 2);
+    assert(tbaz4({ sfoo(); }) == 1);
+    assert(tbaz4({ nfoo(); }) == 2);
+
+    // template function deduction
+    static assert(is(typeof(thoo4({ })) : void function()));
+    static assert(is(typeof(thoo4({ v = 1;  })) : void delegate()));
+
+    tfun4a(a => a);
+    static assert(!__traits(compiles, { tfun4b(a => a); }));
+    static assert(!__traits(compiles, { tfun4c(a => a); }));
+}
+
+void fsvarg4(int function(int)[] a...){}
+void fcvarg4(int dummy, ...){}
+
+void tsvarg4a()(int function(int)[] a...){}
+void tsvarg4b(T)(T function(T)[] a...){}
+void tsvarg4c(T)(T [] a...){}
+void tcvarg4()(int dummy, ...){}
+
+void test4v()
+{
+    fsvarg4(function(int a){ return a; });      // OK
+    fsvarg4(a => a);                            // OK
+
+    fcvarg4(0, function(int a){ return a; });   // OK
+    static assert(!__traits(compiles, { fcvarg4(0, a => a); }));
+
+    tsvarg4a(function(int a){ return a; });     // OK
+    tsvarg4b(function(int a){ return a; });     // OK
+    tsvarg4c(function(int a){ return a; });     // OK
+    tsvarg4a(a => a);
+    static assert(!__traits(compiles, { tsvarg4b(a => a); }));
+    static assert(!__traits(compiles, { tsvarg4c(a => a); }));
+
+    tcvarg4(0, function(int a){ return a; });   // OK
+    static assert(!__traits(compiles, { tcvarg4(0, a => a); }));
+}
+
+// A lambda in function default argument should be deduced to delegate, by the
+// preparation inferType call in TypeFunction.semantic.
+void test4_findRoot(scope bool delegate(real lo, real hi) tolerance = (real a, real b) => false)
+{}
+
+/***************************************************/
+// on CallExp::e1
+
+void test5()
+{
+    assert((a => a*2)(10) == 20);
+    assert((    a,        s){ return s~s; }(10, "str") == "strstr");
+    assert((int a,        s){ return s~s; }(10, "str") == "strstr");
+    assert((    a, string s){ return s~s; }(10, "str") == "strstr");
+    assert((int a, string s){ return s~s; }(10, "str") == "strstr");
+}
+
+/***************************************************/
+// escape check to nested function symbols
+
+void checkNestedRef(alias dg)(bool isnested)
+{
+    static if (is(typeof(dg) == delegate))
+        enum isNested = true;
+    else static if ((is(typeof(dg) PF == F*, F) && is(F == function)))
+        enum isNested = false;
+    else
+        static assert(0);
+
+    assert(isnested == isNested);
+    dg();
+}
+
+void freeFunc(){}
+
+void test6()
+{
+    static void localFunc(){}
+    void nestedLocalFunc(){}
+
+    checkNestedRef!({  })(false);
+
+    checkNestedRef!({ freeFunc(); })(false);
+    checkNestedRef!({ localFunc(); })(false);
+    checkNestedRef!({ nestedLocalFunc(); })(true);
+    checkNestedRef!({ void inner(){} inner(); })(false);
+
+    checkNestedRef!({ auto f = &freeFunc; })(false);
+    checkNestedRef!({ auto f = &localFunc; })(false);
+    checkNestedRef!({ auto f = &nestedLocalFunc; })(true);
+    checkNestedRef!({ void inner(){} auto f = &inner; })(false);
+}
+
+/***************************************************/
+// on AssignExp::e2
+
+void test7()
+{
+    int function(int) fp;
+    fp = a => a;
+    fp = (int a) => a;
+    fp = function(int a) => a;
+    fp = function int(int a) => a;
+    static assert(!__traits(compiles, { fp = delegate(int a) => a; }));
+    static assert(!__traits(compiles, { fp = delegate int(int a) => a; }));
+
+    int delegate(int) dg;
+    dg = a => a;
+    dg = (int a) => a;
+    dg = delegate(int a) => a;
+    dg = delegate int(int a) => a;
+    static assert(!__traits(compiles, { dg = function(int a) => a; }));
+    static assert(!__traits(compiles, { dg = function int(int a) => a; }));
+}
+
+/***************************************************/
+// on StructLiteralExp::elements
+
+void test8()
+{
+    struct S
+    {
+        int function(int) fp;
+    }
+    auto s1 = S(a => a);
+    static assert(!__traits(compiles, { auto s2 = S((a, b) => a); }));
+}
+
+/***************************************************/
+// on concat operation
+
+void test9()
+{
+    int function(int)[] a2;
+    a2 ~= x => x;
+}
+
+/***************************************************/
+// on associative array key
+
+void test10()
+{
+    int[int function()] aa;
+    assert(!aa.remove(() => 1));
+
+    int[int function(int)] aa2;
+    assert(!aa2.remove(x => 1));
+}
+
+/***************************************************/
+// on common type deduction
+
+void test11()
+{
+    auto a1 = [x => x, (int x) => x * 2];
+    static assert(is(typeof(a1[0]) == int function(int) pure @safe nothrow @nogc));
+    assert(a1[0](10) == 10);
+    assert(a1[1](10) == 20);
+
+    //int n = 10;
+    //auto a2 = [x => n, (int x) => x * 2];
+    //static assert(is(typeof(a2[0]) == int delegate(int) @safe nothrow));
+    //assert(a2[0](99) == 10);
+    //assert(a2[1](10) == 20);
+
+    int function(int) fp = true ? (x => x) : (x => x*2);
+    assert(fp(10) == 10);
+
+    int m = 10;
+    int delegate(int) dg = true ? (x => x) : (x => m*2);
+    assert(dg(10) == 10);
+}
+
+/***************************************************/
+// 3235
+
+void test3235()
+{
+    // from TDPL
+    auto f = (int i) {};
+    static if (is(typeof(f) _ == F*, F) && is(F == function))
+    {} else static assert(0);
+}
+
+/***************************************************/
+// 6714
+
+void foo6714x(int function (int, int) a){}
+void bar6714x(int delegate (int, int) a){}
+
+int bar6714y(double delegate(int, int) a){ return 1; }
+int bar6714y(   int delegate(int, int) a){ return 2; }
+
+void test6714()
+{
+    foo6714x((a, b) { return a + b; });
+    bar6714x((a, b) { return a + b; });
+
+    assert(bar6714y((a, b){ return 1.0;  }) == 1);
+    assert(bar6714y((a, b){ return 1.0f; }) == 1);
+    assert(bar6714y((a, b){ return a;    }) == 2);
+}
+
+/***************************************************/
+// 7193
+
+void test7193()
+{
+    static assert(!__traits(compiles, {
+        delete a => a;
+    }));
+}
+
+/***************************************************/
+// 7207 : on CastExp
+
+void test7202()
+{
+    auto dg = cast(int function(int))(a => a);
+    assert(dg(10) == 10);
+}
+
+/***************************************************/
+// 7288
+
+void test7288()
+{
+    // 7288 -> OK
+    auto foo()
+    {
+        int x;
+        return () => { return x; };
+    }
+    pragma(msg, typeof(&foo));
+    alias int delegate() pure nothrow @nogc @safe delegate() pure nothrow @nogc @safe delegate() pure nothrow @safe Dg;
+    pragma(msg, Dg);
+    static assert(is(typeof(&foo) == Dg));  // should pass
+}
+
+/***************************************************/
+// 7499
+
+void test7499()
+{
+    int function(int)[]   a1 = [ x => x ];  // 7499
+    int function(int)[][] a2 = [[x => x]];  // +a
+    assert(a1[0]   (10) == 10);
+    assert(a2[0][0](10) == 10);
+}
+
+/***************************************************/
+// 7500
+
+void test7500()
+{
+    alias immutable bool function(int[]) Foo;
+    Foo f = a => true;
+}
+
+/***************************************************/
+// 7525
+
+void test7525()
+{
+    {
+        char[] delegate() a = { return null; };
+           int delegate() b = { return 1U; };
+          uint delegate() c = { return 1; };
+         float delegate() d = { return 1.0; };
+        double delegate() e = { return 1.0f; };
+    }
+
+    {
+        char[] delegate(int) a = (x){ return null; };
+           int delegate(int) b = (x){ return 1U; };
+          uint delegate(int) c = (x){ return 1; };
+         float delegate(int) d = (x){ return 1.0; };
+        double delegate(int) e = (x){ return 1.0f; };
+    }
+}
+
+/***************************************************/
+// 7582
+
+void test7582()
+{
+    void delegate(int) foo;
+    void delegate(int) foo2;
+    foo = (a) {
+        foo2 = (b) { };
+    };
+}
+
+/***************************************************/
+// 7649
+
+void test7649()
+{
+    void foo(int function(int) fp = x => 1)
+    {
+        assert(fp(1) == 1);
+    }
+    foo();
+}
+
+/***************************************************/
+// 7650
+
+void test7650()
+{
+    int[int function(int)] aa1 = [x=>x:1, x=>x*2:2];
+    foreach (k, v; aa1) {
+        if (v == 1) assert(k(10) == 10);
+        if (v == 2) assert(k(10) == 20);
+    }
+
+    int function(int)[int] aa2 = [1:x=>x, 2:x=>x*2];
+    assert(aa2[1](10) == 10);
+    assert(aa2[2](10) == 20);
+
+    int n = 10;
+    int[int delegate(int)] aa3 = [x=>n+x:1, x=>n+x*2:2];
+    foreach (k, v; aa3) {
+        if (v == 1) assert(k(10) == 20);
+        if (v == 2) assert(k(10) == 30);
+    }
+
+    int delegate(int)[int] aa4 = [1:x=>n+x, 2:x=>n+x*2];
+    assert(aa4[1](10) == 20);
+    assert(aa4[2](10) == 30);
+}
+
+/***************************************************/
+// 7705
+
+void test7705()
+{
+    void foo1(void delegate(ref int ) dg){ int x=10; dg(x); }
+    foo1((ref x){ pragma(msg, typeof(x)); assert(x == 10); });
+    static assert(!__traits(compiles, foo1((x){}) ));
+
+    void foo2(void delegate(int, ...) dg){ dg(20, 3.14); }
+    foo2((x,...){ pragma(msg, typeof(x)); assert(x == 20); });
+
+    void foo3(void delegate(int[]...) dg){ dg(1, 2, 3); }
+    foo3((x ...){ pragma(msg, typeof(x)); assert(x == [1,2,3]); });
+}
+
+/***************************************************/
+// 7713
+
+void foo7713(T)(T delegate(in Object) dlg)
+{}
+void test7713()
+{
+   foo7713( (in obj) { return 15; } );   // line 6
+}
+
+/***************************************************/
+// 7743
+
+auto foo7743a()
+{
+    int x = 10;
+    return () nothrow {
+        return x;
+    };
+}
+auto foo7743b()
+{
+    int x = 10;
+    return () nothrow => x;
+}
+void test7743()
+{
+    pragma(msg, typeof(&foo7743a));
+    static assert(is(typeof(&foo7743a) == int delegate() pure nothrow @nogc @safe function() pure nothrow @safe));
+    assert(foo7743a()() == 10);
+
+    static assert(is(typeof(&foo7743b) == int delegate() pure nothrow @nogc @safe function() pure nothrow @safe));
+    assert(foo7743b()() == 10);
+}
+
+/***************************************************/
+// 7761
+
+enum dg7761 = (int a) pure => 2 * a;
+
+void test7761()
+{
+    static assert(is(typeof(dg7761) == int function(int) pure @safe nothrow @nogc));
+    assert(dg7761(10) == 20);
+}
+
+/***************************************************/
+// 7941
+
+void test7941()
+{
+    static assert(!__traits(compiles, { enum int c = function(){}; }));
+}
+
+/***************************************************/
+// 8005
+
+void test8005()
+{
+    auto n = (a, int n = 2){ return n; }(1);
+    assert(n == 2);
+}
+
+/***************************************************/
+// test8198
+
+void test8198()
+{
+    T delegate(T) zero(T)(T delegate(T) f)
+    {
+        return x => x;
+    }
+
+    T delegate(T) delegate(T delegate(T)) succ(T)(T delegate(T) delegate(T delegate(T)) n)
+    {
+        return f => x => f(n(f)(x));
+    }
+
+    uint delegate(uint) delegate(uint delegate(uint)) n = &zero!uint;
+    foreach (i; 0..10)
+    {
+        assert(n(x => x + 1)(0) == i);
+        n = succ(n);
+    }
+}
+
+/***************************************************/
+// 8226
+
+immutable f8226 = (int x) => x * 2;
+
+void test8226()
+{
+    assert(f8226(10) == 20);
+}
+
+/***************************************************/
+// 8241
+
+auto exec8241a(alias a = function(x) => x, T...)(T as)
+{
+    return a(as);
+}
+
+auto exec8241b(alias a = (x) => x, T...)(T as)
+{
+    return a(as);
+}
+
+void test8241()
+{
+    exec8241a(2);
+    exec8241b(2);
+}
+
+/***************************************************/
+// 8242
+
+template exec8242(alias a, T...)
+{
+    auto func8242(T as)
+    {
+        return a(as);
+    }
+}
+
+mixin exec8242!(x => x, int);
+mixin exec8242!((string x) => x, string);
+
+void test8242()
+{
+    func8242(1);
+    func8242("");
+}
+
+/***************************************************/
+// 8315
+
+void test8315()
+{
+    bool b;
+    foo8315!(a => b)();
+}
+
+void foo8315(alias pred)()
+if (is(typeof(pred(1)) == bool))
+{}
+
+/***************************************************/
+// 8397
+
+void test8397()
+{
+    void function(int) f;
+  static assert(!is(typeof({
+    f = function(string x) {};
+  })));
+}
+
+/***************************************************/
+// 8496
+
+void test8496()
+{
+    alias extern (C) void function() Func;
+
+    Func fp = (){};
+
+    fp = (){};
+}
+
+/***************************************************/
+// 8575
+
+template tfunc8575(func...)
+{
+    auto tfunc8575(U)(U u) { return func[0](u); }
+}
+auto bar8575(T)(T t)
+{
+    return tfunc8575!(a => a)(t);
+}
+void foo8575a() { assert(bar8575(uint.init + 1) == +1); }
+void foo8575b() { assert(bar8575( int.init - 1) == -1); }
+
+void test8575()
+{
+    foo8575a();
+    foo8575b();
+}
+
+/***************************************************/
+// 9153
+
+void writeln9153(string s){}
+
+void test9153()
+{
+    auto tbl1 = [
+        (string x) { writeln9153(x); },
+        (string x) { x ~= 'a'; },
+    ];
+    auto tbl2 = [
+        (string x) { x ~= 'a'; },
+        (string x) { writeln9153(x); },
+    ];
+}
+
+/***************************************************/
+// 9393
+
+template ifThrown9393a(E)
+{
+    void ifThrown9393a(T)(scope T delegate(E) errHandler)
+    {
+    }
+}
+void ifThrown9393b(E, T)(scope T delegate(E) errHandler)
+{
+}
+
+void foo9393(T)(void delegate(T) dg){ dg(T.init); }
+void foo9393()(void delegate(int) dg){ foo9393!int(dg); }
+
+void test9393()
+{
+    ifThrown9393a!Exception(e => 10);
+    ifThrown9393b!Exception(e => 10);
+
+    foo9393((x){ assert(x == int.init); });
+}
+
+/***************************************************/
+// 9415
+
+void test9415()
+{
+    int z;
+    typeof((int a){return z;}) dg;
+    dg = (int a){return z;};
+}
+
+/***************************************************/
+// 9628
+
+template TypeTuple9628(TL...) { alias TypeTuple9628 = TL; }
+void map9628(alias func)() { func(0); }
+
+void test9628()
+{
+    auto items = [[10, 20], [30]];
+    size_t[] res;
+
+    res = null;
+    foreach (_; 0 .. 2)
+    {
+        foreach (sub; items)
+        {
+            map9628!((       i){ res ~= sub.length; });
+            map9628!((size_t i){ res ~= sub.length; });
+        }
+    }
+    assert(res == [2,2,1,1, 2,2,1,1]);
+
+    res = null;
+    foreach (_; TypeTuple9628!(0, 1))
+    {
+        foreach (sub; items)
+        {
+            map9628!((       i){ res ~= sub.length; });
+            map9628!((size_t i){ res ~= sub.length; });
+        }
+    }
+    assert(res == [2,2,1,1, 2,2,1,1]);
+}
+
+/***************************************************/
+// 9928
+
+void test9928()
+{
+    void* smth = (int x) { return x; };
+}
+
+/***************************************************/
+// 10133
+
+ptrdiff_t countUntil10133(alias pred, R)(R haystack)
+{
+    typeof(return) i;
+
+    alias T = dchar;
+
+    foreach (T elem; haystack)
+    {
+        if (pred(elem)) return i;
+        ++i;
+    }
+
+    return -1;
+}
+
+bool func10133(string s)() if (countUntil10133!(x => x == 'x')(s) == 1)
+{
+    return true;
+}
+
+bool func10133a(string s)() if (countUntil10133!(x => s == "x")(s) != -1)
+{
+    return true;
+}
+bool func10133b(string s)() if (countUntil10133!(x => s == "x")(s) != -1)
+{
+    return true;
+}
+
+void test10133()
+{
+    func10133!("ax")();
+
+    func10133a!("x")();
+    static assert(!is(typeof(func10133a!("ax")())));
+    static assert(!is(typeof(func10133b!("ax")())));
+    func10133b!("x")();
+}
+
+/***************************************************/
+// 10219
+
+void test10219()
+{
+    interface I { }
+    class C : I { }
+
+    void test_dg(I delegate(C) dg)
+    {
+        C c = new C;
+        void* cptr = cast(void*) c;
+        void* iptr = cast(void*) cast(I) c;
+        void* xptr = cast(void*) dg(c);
+        assert(cptr != iptr);
+        assert(cptr != xptr); // should pass
+        assert(iptr == xptr); // should pass
+    }
+
+    C delegate(C c) dg = delegate C(C c) { return c; };
+    static assert(!__traits(compiles, { test_dg(dg); }));
+    static assert(!__traits(compiles, { test_dg(delegate C(C c) { return c; }); }));
+    static assert(!__traits(compiles, { I delegate(C) dg2 = dg; }));
+
+    // creates I delegate(C)
+    test_dg(c => c);
+    test_dg(delegate(C c) => c);
+
+    void test_fp(I function(C) fp)
+    {
+        C c = new C;
+        void* cptr = cast(void*) c;
+        void* iptr = cast(void*) cast(I) c;
+        void* xptr = cast(void*) fp(c);
+        assert(cptr != iptr);
+        assert(cptr != xptr); // should pass
+        assert(iptr == xptr); // should pass
+    }
+
+    C function(C c) fp = function C(C c) { return c; };
+    static assert(!__traits(compiles, { test_fp(fp); }));
+    static assert(!__traits(compiles, { test_fp(function C(C c) { return c; }); }));
+    static assert(!__traits(compiles, { I function(C) fp2 = fp; }));
+
+    // creates I function(C)
+    test_fp(c => c);
+    test_fp(function(C c) => c);
+}
+
+/***************************************************/
+// 10288
+
+T foo10288(T)(T x)
+{
+    void lambda() @trusted nothrow { x += 10; }
+    lambda();
+    return x;
+}
+
+T bar10288(T)(T x)
+{
+    () @trusted { x += 10; } ();
+    return x;
+}
+
+T baz10288(T)(T arg)
+{
+    static int g = 10;
+    () @trusted { x += g; } ();
+    return x;
+}
+
+void test10288() @safe pure nothrow
+{
+    assert(foo10288(10) == 20); // OK
+    assert(bar10288(10) == 20); // OK <- NG
+    static assert(!__traits(compiles, baz10288(10)));
+}
+
+/***************************************************/
+// 10666
+
+struct S10666
+{
+    int val;
+    ~this() {}
+}
+
+void foo10666(S10666 s1)
+{
+    S10666 s2;
+
+    /* Even if closureVars(s1 and s2) are accessed by directly called lambdas,
+     * they won't escape the scope of this function.
+     */
+    auto x1 = (){ return s1.val; }();   // OK
+    auto x2 = (){ return s2.val; }();   // OK
+}
+
+/***************************************************/
+// 11081
+
+T ifThrown11081(E : Throwable, T)(T delegate(E) errorHandler)
+{
+    return errorHandler();
+}
+
+void test11081()
+{
+    static if (__traits(compiles, ifThrown11081!Exception(e => 0)))
+    {
+    }
+    static if (__traits(compiles, ifThrown11081!Exception(e => 0)))
+    {
+    }
+}
+
+/***************************************************/
+// 11220
+
+int parsePrimaryExp11220(int x)
+{
+    parseAmbig11220!( (parsed){ x += 1; } )();
+    return 1;
+}
+
+typeof(handler(1)) parseAmbig11220(alias handler)()
+{
+    return handler(parsePrimaryExp11220(1));
+}
+
+/***************************************************/
+// 11230
+
+template map11230(fun...)
+{
+    auto map11230(Range)(Range r)
+    {
+        return MapResult11230!(fun, Range)(r);
+    }
+}
+
+struct MapResult11230(alias fun, R)
+{
+    R _input;
+    this(R input) { _input = input; }
+}
+
+class A11230 { A11230[] as; }
+class B11230 { A11230[] as; }
+class C11230 : A11230 {}
+
+C11230 visit11230(A11230 a)
+{
+    a.as.map11230!(a => visit11230);
+    return null;
+}
+C11230 visit11230(B11230 b)
+{
+    b.as.map11230!(a => visit11230);
+    return null;
+}
+C11230 visit11230()
+{
+    return null;
+}
+
+/***************************************************/
+// 10336
+
+struct S10336
+{
+    template opDispatch(string name)
+    {
+        enum opDispatch = function(int x) {
+            return x;
+        };
+    }
+}
+
+void test10336()
+{
+    S10336 s;
+    assert(s.hello(12) == 12);
+}
+
+/***************************************************/
+// 10928
+
+struct D10928
+{
+    int x;
+    ~this() @nogc {}
+}
+
+void f10928a(D10928 bar)
+{
+    (){ bar.x++; }();
+}
+void f10928b(D10928 bar) @nogc
+{
+    (){ bar.x++; }();
+}
+
+void test10928()
+{
+    f10928a(D10928.init);
+    f10928b(D10928.init);
+}
+
+/***************************************************/
+// 11661
+
+void test11661()
+{
+    void delegate() dg = {};  // OK
+    void function() fp = {};  // OK <- NG
+}
+
+/***************************************************/
+// 11774
+
+void f11774(T, R)(R delegate(T[]) dg)
+{
+    T[] src;
+    dg(src);
+}
+
+void test11774()
+{
+    int[] delegate(int[]) dg = (int[] a) => a;
+    f11774!int(dg);
+    f11774!Object(a => a);
+    f11774!int(dg);
+}
+
+/***************************************************/
+// 12421
+
+void test12421()
+{
+    void test(string decl, bool polymorphic = true)()
+    {
+        // parse AliasDeclaration in Statement
+        mixin("alias f = " ~ decl ~ ";");
+        assert(f(1) == 1);
+      static if (polymorphic)
+        assert(f("s") == "s");
+
+        // parse AliasDeclaration in DeclDefs
+        mixin("template X() { alias g = " ~ decl ~ "; }");
+        alias g = X!().g;
+        assert(g(1) == 1);
+      static if (polymorphic)
+        assert(g("s") == "s");
+    }
+
+    test!(q{      x  => x });
+    test!(q{ (    x) => x });
+    test!(q{ (int x) => x }, false);
+
+    test!(q{ (    x){ return x; } });
+    test!(q{ (int x){ return x; } }, false);
+
+    test!(q{ function     (    x) => x });
+    test!(q{ function     (int x) => x }, false);
+    test!(q{ function int (    x) => x }, false);
+    test!(q{ function int (int x) => x }, false);
+
+    test!(q{ delegate     (    x) => x });
+    test!(q{ delegate     (int x) => x }, false);
+    test!(q{ delegate int (    x) => x }, false);
+    test!(q{ delegate int (int x) => x }, false);
+
+    test!(q{ function     (    x){ return x; } });
+    test!(q{ function     (int x){ return x; } }, false);
+    test!(q{ function int (    x){ return x; } }, false);
+    test!(q{ function int (int x){ return x; } }, false);
+
+    test!(q{ delegate     (    x){ return x; } });
+    test!(q{ delegate     (int x){ return x; } }, false);
+    test!(q{ delegate int (    x){ return x; } }, false);
+    test!(q{ delegate int (int x){ return x; } }, false);
+
+    // This is problematic case, and should be disallowed in the future.
+    alias f = x => y;
+    int y = 10;
+    assert(f(1) == 10);;
+}
+
+/***************************************************/
+// 12508
+
+interface A12508(T)
+{
+    T getT();
+}
+
+class C12508 : A12508!double
+{
+    double getT() { return 1; }
+}
+
+void f12508(A12508!double delegate() dg)
+{
+    auto a = dg();
+    assert(a !is null);
+    assert(a.getT() == 1.0);    // fails!
+}
+
+void t12508(T)(A12508!T delegate() dg)
+{
+    auto a = dg();
+    assert(a !is null);
+    assert(a.getT() == 1.0);    // fails!
+}
+
+ref alias Dg12508 = A12508!double delegate();
+void t12508(T)(Dg12508 dg) {}
+
+void test12508()
+{
+    f12508({ return new C12508(); });
+    t12508({ return new C12508(); });
+    static assert(!__traits(compiles, x12508({ return new C12508(); })));
+}
+
+/***************************************************/
+// 13879
+
+void test13879()
+{
+    bool function(int)[2] funcs1 = (int x) => true; // OK
+    assert(funcs1[0] is funcs1[1]);
+    funcs1[0] = x => true;                          // OK
+    bool function(int)[2] funcs2 = x => true;       // OK <- Error
+    assert(funcs2[0] is funcs2[1]);
+}
+
+/***************************************************/
+// 15794
+
+struct Foo15794
+{
+    static void fun(Holder)()
+    {
+        int i = Holder.fn();
+    }
+}
+
+struct Holder15794(alias Fn)
+{
+    alias fn = Fn;
+}
+
+void gun15794(alias fn, U...)()
+{
+    Foo15794.fun!(Holder15794!fn)();
+}
+
+void test15794()
+{
+    gun15794!(() => 0)(); // Line 26
+}
+
+/***************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test4v();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test3235();
+    test6714();
+    test7193();
+    test7202();
+    test7288();
+    test7499();
+    test7500();
+    test7525();
+    test7582();
+    test7649();
+    test7650();
+    test7705();
+    test7713();
+    test7743();
+    test7761();
+    test7941();
+    test8005();
+    test8198();
+    test8226();
+    test8241();
+    test8242();
+    test8315();
+    test8397();
+    test8496();
+    test8575();
+    test9153();
+    test9393();
+    test9415();
+    test9628();
+    test9928();
+    test10133();
+    test10219();
+    test10288();
+    test10336();
+    test10928();
+    test11661();
+    test11774();
+    test12421();
+    test12508();
+    test13879();
+    test15794();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/functype.d b/gcc/testsuite/gdc.test/runnable/functype.d
new file mode 100644
index 00000000000..57442c59152
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/functype.d
@@ -0,0 +1,341 @@
+extern(C) int printf(const char*, ...);
+
+/***************************************************/
+
+void testfp()
+{
+    static int func1(int n = 1) { return n; }
+    static int func2(int n    ) { return n; }
+    static assert(typeof(func1).stringof == "pure nothrow @nogc @safe int(int n = 1)");
+    static assert(typeof(func2).stringof == "pure nothrow @nogc @safe int(int n)");
+    static assert( is(typeof(func1())));     // OK
+    static assert(!is(typeof(func2())));     // NG
+
+    alias typeof(func1) Func1;
+    alias typeof(func2) Func2;
+    static assert(is(Func1 == Func2));
+    static assert(Func1.stringof == "pure nothrow @nogc @safe int(int n = 1)");
+    static assert(Func2.stringof == "pure nothrow @nogc @safe int(int n)");
+
+    auto fp1 = &func1;
+    auto fp2 = &func2;
+    static assert(typeof(fp1).stringof == "int function(int n = 1) pure nothrow @nogc @safe");
+    static assert(typeof(fp2).stringof == "int function(int n) pure nothrow @nogc @safe");
+    static assert( is(typeof(fp1())));     // OK
+    static assert(!is(typeof(fp2())));     // NG
+
+    alias typeof(fp1) Fp1;
+    alias typeof(fp2) Fp2;
+    static assert(is(Fp1 == Fp2));
+    static assert(Fp1.stringof == "int function(int n = 1) pure nothrow @nogc @safe");
+    static assert(Fp2.stringof == "int function(int n) pure nothrow @nogc @safe");
+
+    typeof(fp1) fp3 = fp1;
+    typeof(fp2) fp4 = fp2;
+    static assert(is(typeof(fp3) == typeof(fp4)));
+    static assert(typeof(fp3).stringof == "int function(int n = 1) pure nothrow @nogc @safe");
+    static assert(typeof(fp4).stringof == "int function(int n) pure nothrow @nogc @safe");
+    static assert( is(typeof(fp3())));     // OK
+    static assert(!is(typeof(fp4())));     // NG
+
+    alias typeof(fp3) Fp3;
+    alias typeof(fp4) Fp4;
+    static assert(is(Fp3 == Fp4));
+    static assert(Fp3.stringof == "int function(int n = 1) pure nothrow @nogc @safe");
+    static assert(Fp4.stringof == "int function(int n) pure nothrow @nogc @safe");
+
+    auto fplit1 = function(int n = 1) { return n; };
+    auto fplit2 = function(int n    ) { return n; };
+    static assert( is(typeof(fplit1())));   // OK
+    static assert(!is(typeof(fplit2())));   // NG
+}
+
+void testdg()
+{
+    int nest1(int n = 1) { return n; }
+    int nest2(int n    ) { return n; }
+    static assert(typeof(nest1).stringof == "pure nothrow @nogc @safe int(int n = 1)");
+    static assert(typeof(nest2).stringof == "pure nothrow @nogc @safe int(int n)");
+    static assert( is(typeof(nest1())));     // OK
+    static assert(!is(typeof(nest2())));     // NG
+
+    alias typeof(nest1) Nest1;
+    alias typeof(nest2) Nest2;
+    static assert(is(Nest1 == Nest2));
+    static assert(Nest1.stringof == "pure nothrow @nogc @safe int(int n = 1)");
+    static assert(Nest2.stringof == "pure nothrow @nogc @safe int(int n)");
+
+    auto dg1 = &nest1;
+    auto dg2 = &nest2;
+    static assert(typeof(dg1).stringof == "int delegate(int n = 1) pure nothrow @nogc @safe");
+    static assert(typeof(dg2).stringof == "int delegate(int n) pure nothrow @nogc @safe");
+    static assert( is(typeof(dg1())));     // OK
+    static assert(!is(typeof(dg2())));     // NG
+
+    alias typeof(dg1) Dg1;
+    alias typeof(dg2) Dg2;
+    static assert(is(Dg1 == Dg2));
+    static assert(Dg1.stringof == "int delegate(int n = 1) pure nothrow @nogc @safe");
+    static assert(Dg2.stringof == "int delegate(int n) pure nothrow @nogc @safe");
+
+    typeof(dg1) dg3 = dg1;
+    typeof(dg2) dg4 = dg2;
+    static assert(typeof(dg3).stringof == "int delegate(int n = 1) pure nothrow @nogc @safe");
+    static assert(typeof(dg4).stringof == "int delegate(int n) pure nothrow @nogc @safe");
+    static assert( is(typeof(dg3())));     // OK
+    static assert(!is(typeof(dg4())));     // NG
+
+    alias typeof(dg3) Dg3;
+    alias typeof(dg4) Dg4;
+    static assert(is(Dg3 == Dg4));
+    static assert(Dg3.stringof == "int delegate(int n = 1) pure nothrow @nogc @safe");
+    static assert(Dg4.stringof == "int delegate(int n) pure nothrow @nogc @safe");
+
+    auto dglit1 = delegate(int n = 1) { return n; };
+    auto dglit2 = delegate(int n    ) { return n; };
+    static assert( is(typeof(dglit1())));   // OK
+    static assert(!is(typeof(dglit2())));   // NG
+}
+
+void testda()
+{
+    // Unsupported cases with current implementation.
+
+    int function(int n = 1)[] fpda = [n => n + 1, n => n+2];
+    assert(fpda[0](1) == 2);
+    assert(fpda[1](1) == 3);
+    static assert(!is(typeof(fpda[0]() == 1)));     // cannot call with using defArgs
+    static assert(!is(typeof(fpda[1]() == 2)));     // cannot call with using defArgs
+    static assert(typeof(fpda).stringof == "int function(int)[]");
+    static assert(typeof(fpda).stringof != "int funciton(int n = 1)[]");
+
+    int delegate(int n = 1)[] dgda = [n => n + 1, n => n+2];
+    assert(dgda[0](1) == 2);
+    assert(dgda[1](1) == 3);
+    static assert(!is(typeof(dgda[0]() == 1)));     // cannot call with using defArgs
+    static assert(!is(typeof(dgda[1]() == 2)));     // cannot call with using defArgs
+    static assert(typeof(dgda).stringof == "int delegate(int)[]");
+    static assert(typeof(fpda).stringof != "int delegate(int n = 1)[]");
+}
+
+template StringOf(T)
+{
+    // template type parameter cannot have redundant informations
+    enum StringOf = T.stringof;
+}
+
+void testti()
+{
+    int[] test(int[] a = []) { return a; }
+    static assert(typeof(test).stringof == "pure nothrow @nogc @safe int[](int[] a = [])");
+    static assert(StringOf!(typeof(test)) == "pure nothrow @nogc @safe int[](int[])");
+
+    float function(float x = 0F) fp = x => x;
+    static assert(typeof(fp).stringof == "float function(float x = " ~ (0F).stringof ~ ")");
+    static assert(StringOf!(typeof(fp)) == "float function(float)");
+
+    double delegate(double x = 0.0) dg = x => x;
+    static assert(typeof(dg).stringof == "double delegate(double x = " ~ (0.0).stringof ~ ")");
+    static assert(StringOf!(typeof(dg)) == "double delegate(double)");
+
+    template F(T) {}
+    auto fp1 = (int a = 1) {};
+    auto fp2 = (int b = 2) {};
+    static assert(typeof(fp1).stringof != typeof(fp2).stringof);
+    alias F1 = F!(typeof(fp1));
+    alias F2 = F!(typeof(fp2));
+    static assert(__traits(isSame, F1, F2));
+    static assert(F1.mangleof == F2.mangleof);
+}
+
+void testxx()
+{
+    // The corner cases which I had introduced in forum discussion
+
+    // f will inherit default args from its initializer, if it's declared with 'auto'
+    auto f1 = (int n = 10){ return 10; };
+    assert(f1() == 10);
+
+    // what is the actual default arg of f?
+    int function(int n = 10) f2 = (int n = 20){ return n; };
+    int function(int n     ) f3 = (int n = 30){ return n; };
+    int function(int n = 40) f4 = (int n     ){ return n; };
+    assert(f2() == 10);
+    static assert(!is(typeof(f3())));
+    assert(f4() == 40);
+
+    // conditional expression and the type of its result
+    auto f5 = true ? (int n = 10){ return n; }
+                   : (int n = 20){ return n; } ;
+    auto f6 = true ? (int n = 10, string s = "hello"){ return n; }
+                   : (int n = 10, string s = "world"){ return n; } ;
+    static assert(!is(typeof(f5())));   // cannot call
+    static assert(!is(typeof(f6())));   // cannot call
+
+    int function(int n = 10) f7;    // default arg of the first parameter is 10
+    f7 = (int n = 20){ return n; }; // function literal's default arg will be ignored
+    assert(f7() == 10);
+
+    // returning function pointer/delegate type can have default args
+    int delegate(int n = 10) foo(int x) { return n => n + x; }
+    auto f = foo(1);
+    assert(f() == 11);
+}
+
+/***************************************************/
+// 3646
+
+int bar3646(int x = 10) { printf("bar %d\n", x); return x; }
+int bam3646(int y)      { printf("bam %d\n", y); return y; }
+
+int qux3646()      { printf("quux\n");       return 20; }
+int qux3646(int i) { printf("quux %d\n", i); return 30; }
+
+void foo3646a(Fn)(Fn fn)
+{
+    fn();
+}
+
+void foo3646b(alias fn)(int res1, int res2)
+{
+    assert(fn() == res1);
+    assert(fn(42) == res2);
+}
+
+void test3646()
+{
+    static assert(!is(typeof(foo3646(&bar3646))));
+    static assert(!is(typeof(foo3646(&bam3646))));
+    static assert(typeof(&bar3646).stringof == "int function(int x = 10)");
+    static assert(typeof(&bam3646).stringof == "int function(int y)");
+
+    foo3646b!bar3646(10, 42);
+    static assert(!is(typeof(foo3646b!bam3646(0, 0))));
+    foo3646b!qux3646(20, 30);
+}
+
+/***************************************************/
+// 3866
+
+void test3866()
+{
+
+    auto foo = (int a = 1) { return a; };
+    auto bar = (int a) { return a; };
+
+    assert(foo() == 1);
+    static assert(!is(typeof(bar())));
+    assert(foo(2) == 2);
+    assert(bar(3) == 3);
+}
+
+/***************************************************/
+// 8579
+
+void test8579()
+{
+    static void func1(int i, double j = 1.0) {}
+    static void func2(int x, double y) {}
+    auto fn1 = &func1;
+    auto fn2 = &func2;
+    static assert(is(typeof(fn1) == typeof(fn2)));
+           assert(   typeid(fn1) is typeid(fn2) );
+    static assert(typeof(fn1).stringof == "void function(int i, double j = " ~ (1.0).stringof ~ ") pure nothrow @nogc @safe");
+    static assert(typeof(fn2).stringof == "void function(int x, double y) pure nothrow @nogc @safe");
+
+    static int func3(int x, double y) { return 0; }
+    static int func4(int i, double j = 1.0) { return 0; }
+    auto fn3 = &func3;
+    auto fn4 = &func4;
+    static assert(is(typeof(fn3) == typeof(fn4)));
+           assert(   typeid(fn3) is typeid(fn4) );
+    static assert(typeof(fn3).stringof == "int function(int x, double y) pure nothrow @nogc @safe");
+    static assert(typeof(fn4).stringof == "int function(int i, double j = " ~ (1.0).stringof ~ ") pure nothrow @nogc @safe");
+}
+
+/***************************************************/
+// 14210
+
+string foo14210a(DT)(string name, DT dg)
+{
+    return name ~ " :: " ~ typeof(dg).stringof;
+}
+string foo14210b(DT)(string name, DT dg)
+{
+    return name ~ " :: " ~ typeof(dg).stringof;
+}
+void test14210()
+{
+    assert(foo14210a("1", (int a)    => a+0) == "1 :: int function(int) pure nothrow @nogc @safe");
+    assert(foo14210a("2", (int a=40) => a+2) == "2 :: int function(int) pure nothrow @nogc @safe");
+
+    assert(foo14210b("2", (int a=40) => a+2) == "2 :: int function(int) pure nothrow @nogc @safe");
+    assert(foo14210b("1", (int a)    => a+0) == "1 :: int function(int) pure nothrow @nogc @safe");
+}
+
+/***************************************************/
+// 10734
+
+// There's no platform independent export symbol, so
+// test just only in Win32.
+version(Win32)
+{
+
+extern(Windows)
+{
+    // use a symbol from kernel32.lib, not user32.lib. The latter might not
+    //  be passed automatically on the command line
+    export void* GetModuleHandleA(const(char)*moduleName);
+    alias void* function(const(char)*moduleName) PROC;
+}
+
+void test10734()
+{
+    PROC lpfnProc = &GetModuleHandleA;
+}
+
+}
+
+/***************************************************/
+// 14656
+
+void test14656()
+{
+    //void unaryFun()(auto int a) pure nothrow @safe @nogc {}   // changed to invalid by fixing issue 14669
+    alias Identity(F) = F;
+    //unaryFun!()(41);
+    static void fun(int n) pure nothrow @safe @nogc {}
+    alias F = typeof(fun);
+    assert(Identity!F.stringof == "pure nothrow @nogc @safe void(int)");
+}
+
+void test14656_ref()
+{
+    void unaryFun()(auto ref int a) pure nothrow @safe @nogc {}
+    alias Identity(F) = F;
+    unaryFun!()(41);
+    static void fun(int n) pure nothrow @safe @nogc {}
+    alias F = typeof(fun);
+    assert(Identity!F.stringof == "pure nothrow @nogc @safe void(int)");
+}
+
+/***************************************************/
+
+int main()
+{
+    testfp();
+    testdg();
+    testda();
+    testti();
+    testxx();
+    test3646();
+    test3866();
+    test8579();
+    test14210();
+    test14656();
+    test14656_ref();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/gdb1.d b/gcc/testsuite/gdc.test/runnable/gdb1.d
new file mode 100644
index 00000000000..2dc50613188
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/gdb1.d
@@ -0,0 +1,16 @@
+/*
+REQUIRED_ARGS: -g
+PERMUTE_ARGS:
+GDB_SCRIPT:
+---
+b 15
+r ARG1 ARG2
+echo RESULT=
+p args
+---
+GDB_MATCH: RESULT=.*ARG1.*ARG2
+*/
+void main(string[] args)
+{
+    // BP
+}
diff --git a/gcc/testsuite/gdc.test/runnable/gdb10311.d b/gcc/testsuite/gdc.test/runnable/gdb10311.d
new file mode 100644
index 00000000000..57b040bd922
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/gdb10311.d
@@ -0,0 +1,20 @@
+/*
+REQUIRED_ARGS: -g
+PERMUTE_ARGS:
+GDB_SCRIPT:
+---
+b 19
+r
+echo RESULT=
+p x
+---
+GDB_MATCH: RESULT=.*33
+*/
+void call(void delegate() dg) { dg(); }
+
+void main()
+{
+    int x=32;
+    call({++x;});
+    // BP
+}
diff --git a/gcc/testsuite/gdc.test/runnable/gdb14225.d b/gcc/testsuite/gdc.test/runnable/gdb14225.d
new file mode 100644
index 00000000000..a97b0424d79
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/gdb14225.d
@@ -0,0 +1,18 @@
+/*
+REQUIRED_ARGS: -g
+PERMUTE_ARGS:
+GDB_SCRIPT:
+---
+b 17
+r
+echo RESULT=
+p lok
+---
+GDB_MATCH: RESULT=.*Something
+*/
+void main()
+{
+    string lok = "Something";
+    auto chars = "Anything".dup;
+    // BP
+}
diff --git a/gcc/testsuite/gdc.test/runnable/gdb14276.d b/gcc/testsuite/gdc.test/runnable/gdb14276.d
new file mode 100644
index 00000000000..ab57427aafc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/gdb14276.d
@@ -0,0 +1,22 @@
+/*
+REQUIRED_ARGS: -g
+PERMUTE_ARGS:
+GDB_SCRIPT:
+---
+b 21
+r
+echo RESULT=
+p v[0] + v[1] + v[2] + v[3]
+---
+GDB_MATCH: RESULT=.*1234
+*/
+import core.simd;
+
+void main()
+{
+    version (X86_64)
+        int4 v = [1000, 200, 30, 4];
+    else
+        int[4] v = [1000, 200, 30, 4];
+    // BP
+}
diff --git a/gcc/testsuite/gdc.test/runnable/gdb14313.d b/gcc/testsuite/gdc.test/runnable/gdb14313.d
new file mode 100644
index 00000000000..369ba29d70d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/gdb14313.d
@@ -0,0 +1,22 @@
+/*
+REQUIRED_ARGS: -g
+PERMUTE_ARGS:
+GDB_SCRIPT:
+---
+b 21
+r
+echo RESULT=
+p 'gdb.x' + 'gdb.y'
+---
+GDB_MATCH: RESULT=.*4000065002
+*/
+module gdb;
+
+__gshared uint x = 4_000_000_000;
+__gshared ushort y = 65000;
+
+void main()
+{
+    ++x; ++y;
+    // BP
+}
diff --git a/gcc/testsuite/gdc.test/runnable/gdb14330.d b/gcc/testsuite/gdc.test/runnable/gdb14330.d
new file mode 100644
index 00000000000..ded690a53cc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/gdb14330.d
@@ -0,0 +1,21 @@
+/*
+REQUIRED_ARGS: -g
+PERMUTE_ARGS:
+GDB_SCRIPT:
+---
+b 20
+r
+echo RESULT=
+p str
+---
+GDB_MATCH: RESULT=.*something
+*/
+module gdb;
+
+__gshared ulong x;
+
+void main()
+{
+    string str = "something";
+    // BP
+}
diff --git a/gcc/testsuite/gdc.test/runnable/gdb4149.d b/gcc/testsuite/gdc.test/runnable/gdb4149.d
new file mode 100644
index 00000000000..9a29b3c75d1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/gdb4149.d
@@ -0,0 +1,24 @@
+/*
+REQUIRED_ARGS: -g
+PERMUTE_ARGS:
+GDB_SCRIPT:
+---
+b 17
+r
+echo RESULT=
+p x
+---
+GDB_MATCH: RESULT=.*33
+*/
+
+void foo(ref int x)
+{
+    ++x;
+    // BP
+}
+
+void main()
+{
+    auto x = 32;
+    foo(x);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/gdb4181.d b/gcc/testsuite/gdc.test/runnable/gdb4181.d
new file mode 100644
index 00000000000..a859bdded9e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/gdb4181.d
@@ -0,0 +1,23 @@
+/*
+REQUIRED_ARGS: -g
+PERMUTE_ARGS:
+GDB_SCRIPT:
+---
+b 22
+r
+echo RESULT=
+p 'gdb.x' + 'gdb.STest.y'
+---
+GDB_MATCH: RESULT=.*33
+*/
+module gdb;
+
+int x;
+struct STest { static int y; }
+
+void main()
+{
+    x = 11;
+    STest.y = 22;
+    // BP
+}
diff --git a/gcc/testsuite/gdc.test/runnable/hello.d b/gcc/testsuite/gdc.test/runnable/hello.d
new file mode 100644
index 00000000000..88adaa4234b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/hello.d
@@ -0,0 +1,12 @@
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+int main(char[][] args)
+{
+    printf("hello world\n");
+    printf("args.length = %d\n", args.length);
+    for (int i = 0; i < args.length; i++)
+        printf("args[%d] = '%.*s'\n", i, args[i].length, args[i].ptr);
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/helloUTF8.d b/gcc/testsuite/gdc.test/runnable/helloUTF8.d
new file mode 100644
index 00000000000..78f3bcdb3dd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/helloUTF8.d
@@ -0,0 +1,10 @@
+﻿// PERMUTE_ARGS:
+
+extern(C) int printf(const char *, ...);
+
+int main(char[][] args)
+{
+    printf("hello world\n");
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/hospital.d b/gcc/testsuite/gdc.test/runnable/hospital.d
new file mode 100644
index 00000000000..d91cfc28646
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/hospital.d
@@ -0,0 +1,251 @@
+// REQUIRED_ARGS:
+
+// NOTE: the shootout appears to be BSD licensed content.
+// Including this in the test suite based on that license.
+
+/* The Great Computer Language Shootout
+   http://shootout.alioth.debian.org/
+
+   Unoptimised reference implementation
+
+   contributed by Isaac Gouy
+*/
+
+import std.stdio, std.string, std.conv;
+import core.memory;
+
+int main(string[] args)
+{
+    //std.gc.setV1_0();
+    int n = args.length > 1 ? to!int(args[1]) : 1000;
+
+    HealthcareRegion healthcareSystem = HealthcareRegion.Create();
+
+    for(int i = 0; i < n; i++)
+        healthcareSystem.TransferPatients();
+
+    Totals t = healthcareSystem.AccumulateTotals();
+
+    writeln("Patients: ", t.patients );
+    writeln("Time:     ", t.hospitalTime );
+    writeln("Visits:   ", t.hospitalVisits );
+
+    if (n == 1000)
+    {
+        assert(t.patients == 102515);
+        assert(t.hospitalTime == 33730654);
+        assert(t.hospitalVisits == 106371);
+    }
+    return 0;
+}
+
+class HealthcareRegion
+{
+public:
+    static HealthcareRegion Create()
+    {
+        return HealthcareRegion.Create(LEVELS, 0, 42);
+    }
+
+    static HealthcareRegion Create(int level, int seed1, int seed2)
+    {
+        HealthcareRegion r = null;
+
+        if(level > 0)
+        {
+            r = new HealthcareRegion(level, seed1*seed2);
+            for(ptrdiff_t i = r.districts.length-1; i >= 0; i--)
+                r.districts[i] = Create(level-1, cast(int)((seed1*4)+i+1), seed2);
+        }
+        return r;
+    }
+
+    this(int level, int s)
+    {
+        districts = new HealthcareRegion[DISTRICTS];
+        localHospital = new Hospital(level == LEVELS, level, s);
+    }
+
+private:
+    enum int LEVELS = 5, DISTRICTS = 4;
+    HealthcareRegion[] districts;
+    Hospital localHospital;
+
+package:
+    Patient[] TransferPatients()
+    {
+        for(ptrdiff_t i = districts.length-1; i >= 0; i--)
+            if(districts[i])
+                foreach(Patient p; districts[i].TransferPatients().dup)
+                    localHospital.NewArrival(p);
+
+        localHospital.TriageExaminationTreatment();
+
+        return localHospital.RegionalTransferPatients();
+    }
+
+    Totals AccumulateTotals()
+    {
+        Totals t = new Totals();
+        for(ptrdiff_t i = districts.length-1; i >= 0; i--)
+            if(districts[i])
+                t += districts[i].AccumulateTotals();
+
+        localHospital.AccumulateTotals(t);
+
+        return t;
+    }
+}
+
+class Hospital
+{
+    public this(bool hasNoRegionalHospital, int level, int seed)
+    {
+        this.hasNoRegionalHospital = hasNoRegionalHospital;
+        availableStaff = 1 << (level - 1);
+        discharged = new Totals();
+        this.seed = seed;
+    }
+
+package:
+    void TriageExaminationTreatment()
+    {
+        DischargePatients();
+        TreatOrTransferPatients();
+        TriagePatients();
+
+        if(genRandom(1.0) > 0.7)
+        {   Patient p = new Patient();
+            NewArrival(p);
+        }
+    }
+
+    Patient[] RegionalTransferPatients()
+    {
+        return transfers;
+    }
+
+    void AccumulateTotals(Totals t)
+    {
+        foreach(Patient p; triage) t.Plus(p);
+        foreach(Patient p; examination) t.Plus(p);
+        foreach(Patient p; treatment) t.Plus(p);
+        t += discharged;
+    }
+
+    void NewArrival(Patient p)
+    {
+        p.hospitalVisits++;
+        if(availableStaff > 0)
+        {
+            availableStaff--;
+            examination ~= p;
+            p.remainingTime = 3;
+            p.hospitalTime += 3;
+        } else {
+            triage ~= p;
+        }
+    }
+
+private:
+    Patient[] triage, examination, treatment, transfers;
+    Totals discharged;
+    int availableStaff;
+    bool hasNoRegionalHospital;
+
+    void DischargePatients()
+    {
+        for(ptrdiff_t i = treatment.length-1; i >= 0; i--)
+        {
+            Patient p = treatment[i];
+            p.remainingTime -= 1;
+            if(!p.remainingTime)
+            {
+                availableStaff++;
+                treatment = treatment[0..i] ~ treatment[i+1..$];
+                discharged.Plus(p);
+            }
+        }
+    }
+
+    void TreatOrTransferPatients()
+    {
+        delete transfers;
+
+        for(ptrdiff_t i = examination.length-1; i >= 0; i--)
+        {
+            Patient p = examination[i];
+            p.remainingTime -= 1;
+
+            if(!p.remainingTime)
+            {
+                // no transfer
+                if(genRandom(1.0) > 0.1 || hasNoRegionalHospital)
+                {
+                    examination = examination[0..i] ~ examination[i+1..$];
+                    treatment ~= p;
+                    p.remainingTime = 10;
+                    p.hospitalTime += 10;
+                } else {
+                // transfer
+                    availableStaff++;
+                    examination = examination[0..i] ~ examination[i+1..$];
+                    transfers ~= p;
+                }
+            }
+        }
+    }
+
+    void TriagePatients()
+    {
+        for(ptrdiff_t i = triage.length-1; i >= 0; i--)
+        {
+            Patient p = triage[i];
+            if(availableStaff > 0)
+            {
+                availableStaff--;
+                p.remainingTime = 3;
+                p.hospitalTime += 3;
+                triage = triage[0..i] ~ triage[i+1..$];
+                examination ~= p;
+            } else {
+                p.hospitalTime++;
+            }
+        }
+    }
+
+    int seed = 42;
+    const int IM = 139968;
+    const int IA = 3877;
+    const int IC = 29573;
+    double genRandom(double max)
+    {
+        return(max * (seed = (seed * IA + IC) % IM) / IM);
+    }
+}
+
+class Patient
+{
+    package int remainingTime, hospitalTime, hospitalVisits;
+}
+
+class Totals
+{
+    public Totals opAddAssign(Totals b)
+    {
+        patients += b.patients;
+        hospitalTime += b.hospitalTime;
+        hospitalVisits += b.hospitalVisits;
+        return this;
+    }
+
+package:
+    long patients, hospitalTime, hospitalVisits;
+
+    void Plus(Patient p)
+    {
+        patients++;
+        hospitalTime += p.hospitalTime;
+        hospitalVisits += p.hospitalVisits;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/ice10086a.d b/gcc/testsuite/gdc.test/runnable/ice10086a.d
new file mode 100644
index 00000000000..c2f5ae6f729
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ice10086a.d
@@ -0,0 +1,6 @@
+// EXTRA_SOURCES: imports/ice10086x.d imports/ice10086y.d
+
+import imports.ice10086x;
+import imports.ice10086y;
+
+void main() { test(); }
diff --git a/gcc/testsuite/gdc.test/runnable/ice10086b.d b/gcc/testsuite/gdc.test/runnable/ice10086b.d
new file mode 100644
index 00000000000..0dc64f84c16
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ice10086b.d
@@ -0,0 +1,6 @@
+// EXTRA_SOURCES: imports/ice10086y.d imports/ice10086x.d
+
+import imports.ice10086y;
+import imports.ice10086x;
+
+void main() { test(); }
diff --git a/gcc/testsuite/gdc.test/runnable/ice10857.d b/gcc/testsuite/gdc.test/runnable/ice10857.d
new file mode 100644
index 00000000000..d38351981ea
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ice10857.d
@@ -0,0 +1,3 @@
+// EXTRA_SOURCES: imports/ice10857a.d imports/ice10857b.d
+
+import imports.ice10857a;
diff --git a/gcc/testsuite/gdc.test/runnable/ice15030.d b/gcc/testsuite/gdc.test/runnable/ice15030.d
new file mode 100644
index 00000000000..5925e745ecc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ice15030.d
@@ -0,0 +1,92 @@
+// REQUIRED_ARGS: -unittest -boundscheck=off
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: imports/a15030.d imports/b15030.d
+
+void main() {}
+
+/+
+Compiler output with -v switch.
+
+With 2.068.0:
+--------
+code      a
+code      b
+function  b.__unittestL5_2
+function  b.__unittestL5_2.__lambda1
+function  b.__unittestL5_2.__lambda1.__lambda2
+function  b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash
+function  b.__unittestL5_2.__lambda1.__lambda2.__lambda2
+
+The nested functions '__lambda1', '__lambda2', and 'filter' are
+(fortunately) generated from outer to inner.
+
+
+With 2.068.1:
+--------
+code      a
+function  b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter
+function  b.__unittestL5_2.__lambda1.__lambda2
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash
+code      b
+function  b.__unittestL5_2
+function  b.__unittestL5_2.__lambda1
+Assertion failure: '!v->csym' on line 1060 in file 'glue.c'
+
+abnormal program termination
+
+'filer' is generated before its ancestor functions '__lambda1' and '__lambda2' - it's a bug.
+
+
+Fixed (contains debug prints):
+--------
+code      a
+b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter @[algorithm.d(5)]
+    --> pushed to unittest @[b.d(5)]
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash
+code      b
+function  b.__unittestL5_2
+function  b.__unittestL5_2.__lambda1
+function  b.__unittestL5_2.__lambda1.__lambda2
+function  b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter
+function  b.__unittestL5_2.__lambda1.__lambda2.__lambda2
+
+By using `deferredNested` correctly, those nested function generations are ordered again.
+
+
+Fixed more:
+--------
+function  D main
+code      a
+code      b
+function  b.__unittestL5_2
+function  b.__unittestL5_2.__lambda1
+function  b.__unittestL5_2.__lambda1.__lambda2
+function  b.__unittestL5_2.__lambda1.__lambda2.filter!(int[]).filter
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals
+function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash
+function  b.__unittestL5_2.__lambda1.__lambda2.__lambda2
+
+By the tweak in TemplateInstance::appendToModuleMember(), all the code of
+(implicitly) nested instances are stored into corresponding module object file.
+
++/
diff --git a/gcc/testsuite/gdc.test/runnable/ice15138.d b/gcc/testsuite/gdc.test/runnable/ice15138.d
new file mode 100644
index 00000000000..14d6bfb6020
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ice15138.d
@@ -0,0 +1,11 @@
+// EXTRA_SOURCES: imports/ice15138a.d
+// PERMUTE_ARGS: -unittest -inline
+// COMPILE_SEPARATELY
+
+import imports.ice15138a;
+
+void main()
+{
+    JSONValue v;
+    v.get!JSONValue;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/ice15176.d b/gcc/testsuite/gdc.test/runnable/ice15176.d
new file mode 100644
index 00000000000..357207d13cb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ice15176.d
@@ -0,0 +1,9 @@
+// EXTRA_SOURCES: imports/ice15176a.d imports/ice15176b.d
+// COMPILE_SEPARATELY
+
+import imports.ice15176a;
+
+void main()
+{
+    func();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/ice15200.d b/gcc/testsuite/gdc.test/runnable/ice15200.d
new file mode 100644
index 00000000000..b4e2cc3c1c8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ice15200.d
@@ -0,0 +1,11 @@
+// EXTRA_SOURCES: imports/ice15200a.d imports/ice15200b.d
+// COMPILE_SEPARATELY
+
+module ice15200;
+
+import imports.ice15200a;
+
+void main()
+{
+    f();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/ice4481.d b/gcc/testsuite/gdc.test/runnable/ice4481.d
new file mode 100644
index 00000000000..638d1518f60
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ice4481.d
@@ -0,0 +1,10 @@
+// EXTRA_SOURCES: imports/ice4481a.d imports/ice4481b.d
+
+import imports.ice4481a;
+import imports.ice4481b;
+
+void main()
+{
+    auto f = new Font();
+    assert(f.textHeight("str"));
+}
diff --git a/gcc/testsuite/gdc.test/runnable/ifti.d b/gcc/testsuite/gdc.test/runnable/ifti.d
new file mode 100644
index 00000000000..9ea97a258ed
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ifti.d
@@ -0,0 +1,120 @@
+import std.stdio;
+
+struct S {
+    int x = 3;
+    void fun(T)(T x) { writefln("S.fun(%s)(%s)",typeid(T),x); this.x += x; }
+}
+
+class Tst(TST, int v = 2) {
+    int x = 3;
+    int z = 4;
+
+    final private void proc(int x) { writefln("proc(%s) -> %s",x,this.x); }
+    void fun(T)(T x) { writefln("fun(%s)(%s) -> %s",typeid(T),x,this.x);}
+    void fun()() { writefln("fun()() -> %s",this.x); }
+    void fun2()() { writefln("fun2"); }
+
+    class Inner {
+        int y = 99;
+        Tst outer;
+        void f3() { z = 55; }
+        // Make sure the correct this-ptr is used
+        void f1() { writefln("Inner.f1"); proc(-11); outer.proc(-11); }
+        void f2() { writefln("Inner.f2"); fun(-17); outer.fun(-17); }
+    }
+    Inner inner;
+
+    this() {
+        inner = new Inner;
+        inner.outer = this;
+    }
+
+    void callInnerf1() { writefln("callInnerf1"); inner.f1(); }
+    void callInnerf2() { writefln("callInnerf2"); inner.f2(); }
+
+
+//
+    void opAdd(T)(T x) { this.x += x; writefln("opAdd(%s)",x); }
+    void opPos()() { writefln("opPos()"); }
+    //void opPos() { writefln("xxx"); }
+    void opIndex(T)(T x) { writefln("opIndex[%s]",x); }
+
+    void opIndex(A,B,C)(A a, B b, C c) {
+        writefln("opIndex[(%s)%s,(%s)%s,(%s)%s]",typeid(A),a,
+                 typeid(B),b,typeid(C),c);
+    }
+
+
+    static if (v > 1) {
+        void opCall(A = int, B = float)(A a = 1, B b = 8.2) { writefln("opCall(%s,%s)",a,b); this.x++; }
+
+    }
+    void opSlice(A,B)(A a, B b) { writefln("opSlice(%s,%s)",a,b); }
+    void opSlice()() { writefln("opSlice()"); }
+
+    void opIndexAssign(A,B)(A a, B b) {
+        writefln("opIndexAssign((%s)%s,(%s)%s)",typeid(A),a,typeid(B),b);
+    }
+
+    void opSliceAssign(A,B,C)(A a, B b, C c) {
+        writefln("opSliceAssign(%s,%s,%s)",a,b,c);
+    }
+
+    bool opEquals(A)(A x) { writefln("opEquals((%s))",typeid(A));return true; }
+
+    int opApply(T)(int delegate(ref T)dg) {
+        for (int i = 0; i < 5; i++) {
+            T d = cast(T)(i+0.1);
+            if (auto result = dg(d))
+                return result;
+        }
+        return 0;
+    }
+}
+
+class Y : Tst!(float) {}
+
+void main() {
+    Tst!(int) t = new Tst!(int);
+    Y u = new Y;
+    S s;
+    t.x = 7;
+    t.proc(5);
+    t.fun(5);
+    t.fun();
+    t.callInnerf1();
+    t.callInnerf2();
+    u.fun(5);
+    u.fun();
+    u.callInnerf1();
+    u.callInnerf2();
+    s.fun(5);
+    t.fun2();
+
+    +t;
+    t+5;
+    t[55];
+    t[1,2,3.0];
+    u[1,2,3.0];
+    t(1,2.5);
+    t(2);
+    t();
+    t[];
+    t[1..2];
+    u[1..2.5];
+    t[1i] = 5;
+    t[-4.5..7i] = "hello";
+    t == t;
+    auto b = t != t; // without assignment -> "! has no effect in expression"
+    t == u;
+    u == t;
+    u == u;
+    b = u != u;
+    foreach(int i;t) {
+        writefln("%s",i);
+    }
+    foreach(double i;t) {
+        writefln("%s",i);
+    }
+
+}
diff --git a/gcc/testsuite/gdc.test/runnable/implicit.d b/gcc/testsuite/gdc.test/runnable/implicit.d
new file mode 100644
index 00000000000..bc3f626f4d4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/implicit.d
@@ -0,0 +1,481 @@
+
+import std.stdio;
+
+/***********************************/
+
+template cat1(T)
+{
+    T cat1(T i) { return i + 1; }
+}
+
+void test1()
+{
+    auto a = cat1(1);
+    assert(a == 2);
+}
+
+/***********************************/
+
+template cat2(T)
+{
+    T cat2(T* p) { return *p + 1; }
+}
+
+void test2()
+{
+    int i = 1;
+    auto a = cat2(&i);
+    assert(a == 2);
+    assert(typeid(typeof(a)) == typeid(int));
+}
+
+/***********************************/
+
+struct S3 { }
+
+template cat3(T)
+{
+    T cat3(T* p, S3 s) { return *p + 1; }
+}
+
+void test3()
+{
+    S3 s;
+    int i = 1;
+    auto a = cat3(&i, s);
+    assert(a == 2);
+    assert(typeid(typeof(a)) == typeid(int));
+}
+
+/***********************************/
+
+template cat4(T, int N)
+{
+    T cat4(T[N] p, T[N] q) { return p[0] + N; }
+}
+
+void test4()
+{
+    int[3] i;
+    i[0] = 7;
+    i[1] = 8;
+    i[2] = 9;
+    auto a = cat4(i, i);
+    assert(a == 10);
+    assert(typeid(typeof(a)) == typeid(int));
+}
+
+/***********************************/
+
+template cat5(T, U=T*, int V=7)
+{
+    T cat5(T x)
+    {
+        U u = &x;
+
+        return x + 3 + *u + V;
+    }
+}
+
+void test5()
+{
+    int x = 2;
+
+    auto a = cat5(x);
+    assert(a == 14);
+    assert(typeid(typeof(a)) == typeid(int));
+
+    auto b = cat5!(int,int*,8)(x);
+    assert(b == 15);
+    assert(typeid(typeof(b)) == typeid(int));
+}
+
+/***********************************/
+
+int* pureMaker() pure
+{
+    return [1,2,3,4].ptr + 1;
+}
+
+void testDIP29_1()
+{
+    int* p;
+    static assert(!__traits(compiles, { immutable x = p + 3; }));
+    immutable x = pureMaker() + 1;
+    immutable y = pureMaker() - 1;
+    immutable z = 1 + pureMaker();
+}
+
+/***********************************/
+
+int** pureMaker2() pure
+{
+    int*[] da = [[11,12,13].ptr, [21,22,23].ptr, [31,32,33].ptr, [41,42,43].ptr];
+    return da.ptr + 1;
+}
+
+void testDIP29_2()
+{
+    immutable x2 = pureMaker2() + 1;
+    immutable y2 = pureMaker2() - 1;
+    immutable z2 = 1 + pureMaker2();
+}
+
+/***********************************/
+
+int[] pureMaker3a() pure
+{
+    return new int[4];
+}
+
+int* pureMaker3b() pure
+{
+    return new int[4].ptr;
+}
+
+int[4] pureMaker3c() pure
+{
+    int[4] buf;
+    return buf;
+}
+
+void testDIP29_3()
+{
+    immutable x1 = pureMaker3a()[];
+    immutable x2 = pureMaker3a()[0..2];
+
+    immutable y2 = pureMaker3b()[0..2];
+
+    // Conversion from *rvalue* of mutable static array to immutable slice
+    immutable z1 = pureMaker3c()[];
+    immutable z2 = pureMaker3c()[0..2];
+
+    // Issue 12467 - conversion from lvalue of mutable static array to immutable slice
+    char[3] arr = "foo";
+    static assert(!__traits(compiles, { string str = arr[]; }));
+}
+
+/***********************************/
+
+import core.vararg;
+
+int* maker() pure { return null; }
+int* maker1(int *) pure { return null; }
+int* function(int *) pure makerfp1;
+int* maker2(int *, ...) pure { return null; }
+int* maker3(int) pure { return null; }
+int* maker4(ref int) pure { return null; }
+int* maker5(ref immutable int) pure { return null; }
+
+void testDIP29_4()
+{
+    { immutable x = maker1(maker()); }
+    { immutable x = maker1(null); }
+    static assert(__traits(compiles, { immutable x = (*makerfp1)(maker()); }));
+    { shared x = maker1(null); }
+    { immutable x = maker2(null, 3); }
+    { immutable int g; immutable x = maker2(null, 3, &g); }
+    static assert(!__traits(compiles, { int g; immutable x = maker2(null, 3, &g); }));
+    { immutable x = maker3(1); }
+    static assert(!__traits(compiles, { int g; immutable x = maker4(g); }));
+    { immutable int g; immutable x = maker5(g); }
+}
+
+/***********************************/
+// 14155
+
+immutable int g14155;
+
+static this() { g14155 = 1; }
+
+             int*  make14155m (             int*  p) pure { return null; }
+       const(int*) make14155c (       const(int*) p) pure { return &g14155; }
+   immutable(int*) make14155i (   immutable(int*) p) pure { return &g14155; }
+      shared(int*) make14155sm(      shared(int*) p) pure { return null; }
+shared(const int*) make14155sc(shared(const int*) p) pure { return &g14155; }
+
+void test14155_for_testDIP29_4()
+{
+    static assert( __traits(compiles, {              int*  p = make14155m (null); }));  //  m <- m (normal)
+    static assert( __traits(compiles, {        const(int*) p = make14155m (null); }));  //  c <- m (normal)
+    static assert( __traits(compiles, {       shared(int*) p = make14155m (null); }));  // sm <- m (unique)
+    static assert( __traits(compiles, { shared(const int*) p = make14155m (null); }));  // sc <- m (unique)
+    static assert( __traits(compiles, {    immutable(int*) p = make14155m (null); }));  //  i <- m (unique)
+
+    static assert(!__traits(compiles, {              int*  p = make14155c (null); }));  //  m <- c (NG) <bugzilla case>
+    static assert( __traits(compiles, {        const(int*) p = make14155c (null); }));  //  c <- c (normal)
+    static assert(!__traits(compiles, {       shared(int*) p = make14155c (null); }));  // sm <- c (NG)
+    static assert( __traits(compiles, { shared(const int*) p = make14155c (null); }));  // sc <- c (unique or immutable global)
+    static assert( __traits(compiles, {    immutable(int*) p = make14155c (null); }));  //  i <- c (unique or immutable global)
+
+    static assert(!__traits(compiles, {              int*  p = make14155i (null); }));  //  m <- i (NG)
+    static assert( __traits(compiles, {        const(int*) p = make14155i (null); }));  //  c <- i (normal)
+    static assert(!__traits(compiles, {       shared(int*) p = make14155i (null); }));  // sm <- i (NG)
+    static assert( __traits(compiles, { shared(const int*) p = make14155i (null); }));  // sc <- i (normal)
+    static assert( __traits(compiles, {    immutable(int*) p = make14155i (null); }));  //  i <- i (normal)
+
+    static assert( __traits(compiles, {              int*  p = make14155sm(null); }));  //  m <- sm (unique)
+    static assert( __traits(compiles, {        const(int*) p = make14155sm(null); }));  //  c <- sm (unique)
+    static assert( __traits(compiles, {       shared(int*) p = make14155sm(null); }));  // sm <- sm (normal)
+    static assert( __traits(compiles, { shared(const int*) p = make14155sm(null); }));  // sc <- sm (normal)
+    static assert( __traits(compiles, {    immutable(int*) p = make14155sm(null); }));  //  i <- sm (unique)
+
+    static assert(!__traits(compiles, {              int*  p = make14155sc(null); }));  //  m <- sc (NG)
+    static assert( __traits(compiles, {        const(int*) p = make14155sc(null); }));  //  c <- sc (unique or immutable global)
+    static assert(!__traits(compiles, {       shared(int*) p = make14155sc(null); }));  // sm <- sc (NG)
+    static assert( __traits(compiles, { shared(const int*) p = make14155sc(null); }));  // sc <- sc (normal)
+    static assert( __traits(compiles, {    immutable(int*) p = make14155sc(null); }));  //  i <- sc
+
+    int x;
+    int* nestf() pure { return &x; }
+    static assert(!__traits(compiles, { immutable(int*) ip = nestf(); }));
+}
+
+/***********************************/
+// 14141
+
+struct S14141
+{
+    Object obj;
+
+    const(Object) getObj() const pure
+    {
+        return obj;
+    }
+}
+
+void test14141()
+{
+    const S14141 s;
+    static assert(is(typeof(s.getObj()) == const Object));           // ok
+    static assert(!__traits(compiles, { Object o = s.getObj(); }));  // ok <- fails
+}
+
+/***********************************/
+
+int[] test6(int[] a) pure @safe nothrow
+{
+    return a.dup;
+}
+
+/***********************************/
+
+int*[] pureFoo() pure { return null; }
+
+
+void testDIP29_5() pure
+{
+    { char[] s; immutable x = s.dup; }
+    { immutable x = (cast(int*[])null).dup; }
+    { immutable x = pureFoo(); }
+    { immutable x = pureFoo().dup; }
+}
+
+/***********************************/
+
+void testDIP29_6()
+{
+    /******* structs ************/
+
+    static assert(__traits(compiles,
+    {
+        static struct S { int *p; }
+        immutable s = new S;        // since p is null
+    }));
+
+    static assert(!__traits(compiles,
+    {
+        __gshared int x;
+        static struct S { int *p = &x; }
+        immutable s = new S;        // x is mutable
+    }));
+
+    static assert(!__traits(compiles,
+    {
+        int y;
+        struct S { int x; void bar() { y = 3; } }
+        immutable s = new S;        // nested struct
+    }));
+
+    static assert(!__traits(compiles,
+    {
+        static struct S { int x; this(int); }
+        immutable s = new S(1);
+    }));
+
+    static assert(__traits(compiles,
+    {
+        static struct S { int x; this(int) pure; }
+        immutable s = new S(1);
+    }));
+
+    static assert(__traits(compiles,
+    {
+        static struct S { int* p = void; this(int) pure; }
+        immutable s = new S(1);
+    }));
+
+    static assert(!__traits(compiles,
+    {
+        static struct S { int* p = void; this(int*) pure; }
+        int x;
+        immutable s = new S(&x);
+    }));
+
+    static assert(__traits(compiles,
+    {
+        static struct S { int* p = void; this(immutable(int)*) pure; }
+        immutable int x;
+        immutable s = new S(&x);
+    }));
+
+    static assert(__traits(compiles,
+    {
+        static struct S { int* p = void; this(int*) pure; }
+        immutable s = new S(null);
+    }));
+
+    /******* classes ************/
+
+    static assert(__traits(compiles,
+    {
+        static class S { int *p; }
+        immutable s = new S;        // since p is null
+    }));
+
+    static assert(!__traits(compiles,
+    {
+        __gshared int x;
+        static class S { int *p = &x; }
+        immutable s = new S;        // x is mutable
+    }));
+
+    static assert(!__traits(compiles,
+    {
+        int y;
+        class S { int x; void bar() { y = 3; } }
+        immutable s = new S;        // nested class
+    }));
+
+    static assert(!__traits(compiles,
+    {
+        static class S { int x; this(int); }
+        immutable s = new S(1);
+    }));
+
+    static assert(__traits(compiles,
+    {
+        static class S { int x; this(int) pure; }
+        immutable s = new S(1);
+    }));
+
+    static assert(__traits(compiles,
+    {
+        static class S { int* p = void; this(int) pure; }
+        immutable s = new S(1);
+    }));
+
+    static assert(!__traits(compiles,
+    {
+        static class S { int* p = void; this(int*) pure; }
+        int x;
+        immutable s = new S(&x);
+    }));
+
+    static assert(__traits(compiles,
+    {
+        static class S { int* p = void; this(immutable(int)*) pure; }
+        immutable int x;
+        immutable s = new S(&x);
+    }));
+
+    static assert(__traits(compiles,
+    {
+        static class S { int* p = void; this(int*) pure; }
+        immutable s = new S(null);
+    }));
+}
+
+// 14155
+
+void test14155_for_testDIP29_6()
+{
+    static class CI
+    {
+        int* p;
+        this(int) immutable pure { p = &g14155; }
+    }
+
+    static assert(!__traits(compiles, {           CI c = new immutable CI(1); }));
+    static assert( __traits(compiles, {     const CI c = new immutable CI(1); }));
+    static assert( __traits(compiles, { immutable CI c = new immutable CI(1); }));
+    static assert(!__traits(compiles, {    shared CI c = new immutable CI(1); }));
+    static assert(!__traits(compiles, {           CI c = new     const CI(1); }));
+    static assert( __traits(compiles, {     const CI c = new     const CI(1); }));
+    static assert( __traits(compiles, { immutable CI c = new     const CI(1); }));
+    static assert(!__traits(compiles, {    shared CI c = new     const CI(1); }));
+}
+
+/***********************************/
+// 13640
+
+struct S13640
+{
+    static struct R
+    {
+        int* p;
+        this(inout ref int* p) inout pure { this.p = p; }
+    }
+
+    int* p;
+
+    void foo() inout pure
+    {
+        // Implicit conversion from inout(R) to R should be disallowed.
+        static assert(!__traits(compiles, { R r = inout(R)(p); }));
+    }
+}
+
+/***********************************/
+// 15778
+
+void test15778()
+{
+     char[] cs = new  char[](3);
+    wchar[] ws = new wchar[](3);
+    dchar[] ds = new dchar[](3);
+
+    cs[] = "abc";   assert(cs == "abc");
+    cs[] = "def"c;  assert(cs == "def");
+    ws[] = "abc";   assert(ws == "abc");
+    ws[] = "def"w;  assert(ws == "def");
+    ds[] = "abc";   assert(ds == "abc");
+    ds[] = "def"d;  assert(ds == "def");
+
+    static assert(!__traits(compiles, (cs[] = "a"w)));
+    static assert(!__traits(compiles, (cs[] = "a"d)));
+    static assert(!__traits(compiles, (ws[] = "a"c)));
+    static assert(!__traits(compiles, (ws[] = "a"d)));
+    static assert(!__traits(compiles, (ds[] = "a"c)));
+    static assert(!__traits(compiles, (ds[] = "a"w)));
+}
+
+/***********************************/
+
+void main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    testDIP29_1();
+    testDIP29_2();
+    testDIP29_3();
+    testDIP29_4();
+    testDIP29_5();
+    testDIP29_6();
+    test15778();
+
+    writefln("Success");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/A16a.d b/gcc/testsuite/gdc.test/runnable/imports/A16a.d
new file mode 100644
index 00000000000..9f385cc960e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/A16a.d
@@ -0,0 +1,20 @@
+import A16;
+
+import std.stdio;
+
+class B16 : AA16
+{
+  public
+    this()
+    {
+	super();
+	printf("class B16\n");
+    }
+}
+
+int main()
+{
+    new B16;
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/Other.d b/gcc/testsuite/gdc.test/runnable/imports/Other.d
new file mode 100644
index 00000000000..cd523c02a61
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/Other.d
@@ -0,0 +1,18 @@
+module imports.Other; // makes no difference if removed
+import Same;
+import core.stdc.stdio;
+
+class Other : Same // segfault
+// class Other : Same.Same //***UGLY ALERT*** but doesn't segfault
+{
+this()
+{
+printf("other\n");
+}
+}
+
+int main()
+{
+    new Other;
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a11447.d b/gcc/testsuite/gdc.test/runnable/imports/a11447.d
new file mode 100644
index 00000000000..5f33fb3c375
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a11447.d
@@ -0,0 +1,14 @@
+module imports.a11447;
+struct A { }
+
+void map(alias dg)(A r) { }
+
+struct TTT
+{
+    static auto yyy(A a)
+    {
+        map!(b => 0)(a);
+    }
+}
+
+void bar() { }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a12010.d b/gcc/testsuite/gdc.test/runnable/imports/a12010.d
new file mode 100644
index 00000000000..fdf6759d5e7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a12010.d
@@ -0,0 +1,3 @@
+module imports.a12010;
+import imports.std12010container : Array, BinaryHeap;
+BinaryHeap!(Array!int) test;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a12037.d b/gcc/testsuite/gdc.test/runnable/imports/a12037.d
new file mode 100644
index 00000000000..7c25d874c42
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a12037.d
@@ -0,0 +1,77 @@
+module imports.aXXXXX;
+
+auto min(A, B)(A a, B b) { return a < b ? a : b; }
+alias TypeTuple(T...) = T;
+
+private template CustomFloatParams(uint bits)
+{
+    static if (bits ==  8) alias CustomFloatParams!( 4,  3) CustomFloatParams;
+    static if (bits == 16) alias CustomFloatParams!(10,  5) CustomFloatParams;
+    static if (bits == 32) alias CustomFloatParams!(23,  8) CustomFloatParams;
+    static if (bits == 64) alias CustomFloatParams!(52, 11) CustomFloatParams;
+    static if (bits == 80) alias CustomFloatParams!(64, 15) CustomFloatParams;
+}
+private template CustomFloatParams(uint precision, uint exponentWidth)
+{
+    alias TypeTuple!(
+        precision,
+        exponentWidth,
+    ) CustomFloatParams;
+}
+
+struct CustomFloat(uint precision, uint exponentWidth)
+if ((1 + precision + exponentWidth) % 8 == 0 && precision + exponentWidth > 0)
+{
+private:
+    union ToBinary(F)
+    if (is(typeof(CustomFloatParams!(F.sizeof*8))) || is(F == real))
+    {
+        F set;
+
+        // If on Linux or Mac, where 80-bit reals are padded, ignore the
+        // padding.
+        CustomFloat!(CustomFloatParams!(min(F.sizeof*8, 80))) get;
+
+        // Convert F to the correct binary type.
+        static typeof(get) opCall(F value)
+        {
+            ToBinary r;
+            r.set = value;
+            return r.get;
+        }
+        alias get this;
+    }
+
+public:
+    @property bool sign() { return 1; }
+    @property void sign(bool) {}
+
+    this(F)(F input)
+    if (__traits(compiles, cast(real)input))
+    {
+        this = input;
+    }
+
+    void opAssign(F)(F input)
+    if (__traits(compiles, cast(real)input))
+    {
+        static if (is(F == float) || is(F == double) || is(F == real))
+                auto value = ToBinary!(F)(input);
+        else    auto value = ToBinary!(real)(input);
+
+        sign = value.sign;
+    }
+
+    @property F get(F)()
+    if (is(F == float) || is(F == double) || is(F == real))
+    {
+        ToBinary!F result;
+        return F.init;
+    }
+
+    T opCast(T)()
+    if (__traits(compiles, get!T))
+    {
+        return get!T;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a12874.d b/gcc/testsuite/gdc.test/runnable/imports/a12874.d
new file mode 100644
index 00000000000..fb2e6f2f04f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a12874.d
@@ -0,0 +1,13 @@
+module imports.a12874;
+
+template foo(alias x)
+{
+    void check(int[] arr)
+    {
+        auto n = arr[0];
+    }
+    void foo()
+    {
+        check([]);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a14267.d b/gcc/testsuite/gdc.test/runnable/imports/a14267.d
new file mode 100644
index 00000000000..9e7e2d9522b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a14267.d
@@ -0,0 +1,19 @@
+module imports.a14267;
+
+struct SysTime14267
+{
+    // semantic() is called twice, and its scope is wrongly set to NULL
+    // at the second call.
+    this(long stdTime) {}
+    this(this) {}
+    ~this() {}
+
+    static SysTime14267 min()
+    {
+        // inlining this function will call the semantic3() of SysTime14267 constructor.
+        // but its 'scope' field is NULL so unintentionally semantic3() call fails.
+        auto st = SysTime14267(long.min);
+        auto st2 = st;
+        return st2;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a14992.d b/gcc/testsuite/gdc.test/runnable/imports/a14992.d
new file mode 100644
index 00000000000..1cdd0ef9026
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a14992.d
@@ -0,0 +1,5 @@
+module imports.a14992;
+
+struct S1 { }
+
+struct S2 { int v; int[] a; }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a15030.d b/gcc/testsuite/gdc.test/runnable/imports/a15030.d
new file mode 100644
index 00000000000..c33df1f0a4a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a15030.d
@@ -0,0 +1,3 @@
+module a;
+
+import imports.std15030algo;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a15079.d b/gcc/testsuite/gdc.test/runnable/imports/a15079.d
new file mode 100644
index 00000000000..f8e3a82420a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a15079.d
@@ -0,0 +1,50 @@
+module imports.a15079;
+
+Vector!string parseAlgorithmName()
+{
+    assert(0);
+}
+
+struct Vector(ALLOC)
+{
+    @disable this(this);
+
+    RefCounted!(Vector, ALLOC) dupr()
+    {
+        assert(0);
+    }
+}
+
+struct RefCounted(T, ALLOC)
+{
+    ~this()
+    {
+        T* objc;
+        .destroy(*objc);
+    }
+}
+
+// ----
+
+void _destructRecurse(S)(ref S s)
+    if (is(S == struct))
+{
+    static if (__traits(hasMember, S, "__xdtor") &&
+               __traits(isSame, S, __traits(parent, s.__xdtor)))
+    {
+        s.__xdtor();
+    }
+}
+
+void destroy(T)(ref T obj) if (is(T == struct))
+{
+    _destructRecurse(obj);
+    () @trusted {
+        auto buf = (cast(ubyte*) &obj)[0 .. T.sizeof];
+        auto init = cast(ubyte[])typeid(T).init();
+        if (init.ptr is null) // null ptr means initialize to 0s
+            buf[] = 0;
+        else
+            buf[] = init[];
+    } ();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a17a.d b/gcc/testsuite/gdc.test/runnable/imports/a17a.d
new file mode 100644
index 00000000000..a8cfeb8e389
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a17a.d
@@ -0,0 +1,7 @@
+module imports.a17a;
+
+private import a17;
+
+class foo2x : barx {
+    int x;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a18a.d b/gcc/testsuite/gdc.test/runnable/imports/a18a.d
new file mode 100644
index 00000000000..444f00a9658
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a18a.d
@@ -0,0 +1,28 @@
+module imports.a18a;
+
+interface IEnumerator
+{
+}
+
+class Enumerator(T) : IEnumerator
+{
+	this()
+	{
+	}
+}
+
+interface IContainer(T)
+{
+	alias   Container!(int)		selected_type;
+
+	IEnumerator	enumerate();
+}
+
+class Container(T) : IContainer!(int)
+{
+	IEnumerator	enumerate()
+	{
+	    return new Enumerator!(int)();
+	}
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a19a.d b/gcc/testsuite/gdc.test/runnable/imports/a19a.d
new file mode 100644
index 00000000000..534ce9beebd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a19a.d
@@ -0,0 +1,15 @@
+module imports.a19a;
+
+struct Dummy
+{
+}
+
+struct TemplatedStruct(Param)
+{
+        static real fgh = 0;
+}
+
+void foo()
+{
+        alias TemplatedStruct!(Dummy) X;        
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a20a.d b/gcc/testsuite/gdc.test/runnable/imports/a20a.d
new file mode 100644
index 00000000000..01be04f16cb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a20a.d
@@ -0,0 +1 @@
+import a20;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a21a.d b/gcc/testsuite/gdc.test/runnable/imports/a21a.d
new file mode 100644
index 00000000000..8ba14620aed
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a21a.d
@@ -0,0 +1,21 @@
+module imports.a21a;
+
+import std.stdio;
+import a21;
+
+template GoodMixin()
+{
+    int goodFunc()
+    {
+	printf("goodFunc\n");
+	return 1;
+    }
+}
+
+
+class SomeClass
+{
+    mixin GoodMixin;
+    mixin BadMixin;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a7595.d b/gcc/testsuite/gdc.test/runnable/imports/a7595.d
new file mode 100644
index 00000000000..a2b1dc10c41
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a7595.d
@@ -0,0 +1,27 @@
+@trusted:
+
+import test7595;
+
+struct Matrix
+{
+    int[4] _data;
+}
+
+void inverse(const ref Matrix m)
+{
+    for (size_t i = 0; i < 4; i++)
+        assert(m._data[i] == i + 1);
+}
+
+void main()
+{
+    Matrix m9;
+    m9._data[0] = 1;
+    m9._data[1] = 2;
+    m9._data[2] = 3;
+    m9._data[3] = 4;
+    for (size_t i = 0; i < 4; i++)
+        assert(m9._data[i] == i + 1);
+
+    benchmark!({ inverse(m9); })(1);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a9546.d b/gcc/testsuite/gdc.test/runnable/imports/a9546.d
new file mode 100644
index 00000000000..696f129dc02
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a9546.d
@@ -0,0 +1,12 @@
+module imports.a9546;
+
+struct S
+{
+    private   int privA;
+    protected int protA;
+    package   int packA;
+
+    private   void privF() {}
+    protected void protF() {}
+    package   void packF() {}
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/a9741.d b/gcc/testsuite/gdc.test/runnable/imports/a9741.d
new file mode 100644
index 00000000000..d10e6ac4c53
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/a9741.d
@@ -0,0 +1,7 @@
+module imports.a9741b;
+
+template ShowAttributes(alias X)
+{
+    pragma(msg, X.stringof);
+    pragma(msg, __traits(getAttributes, X));
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/argufile.d b/gcc/testsuite/gdc.test/runnable/imports/argufile.d
new file mode 100644
index 00000000000..0b48761af06
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/argufile.d
@@ -0,0 +1,146 @@
+// argufile.d ----------------------------------------------------
+
+public:
+
+import core.vararg;
+import std.stdio;
+import std.utf;
+
+dstring formatstring(TypeInfo[] arguments, va_list argptr)
+{
+
+	dstring message = null;
+
+	void putc(dchar c)
+	{
+		message ~= c;
+	}
+
+
+	doFormat(&putc, arguments, argptr);
+
+
+	return message;
+}
+
+string arguments(...) // turns a bunch of arguments into a formatted char[] string
+{
+	return std.utf.toUTF8(formatstring(_arguments, _argptr));
+}
+
+void useargs(...)
+{
+	string crashage = arguments("why is 8 scared of 7? because", 7,8,9);
+
+	//printf("%.*s\n", crashage);
+	writefln(crashage);
+}
+
+
+// dustmited version of the deprecated doFormat.
+// See the full file at:
+// https://github.com/dlang/undeaD/blob/master/src/undead/doformat.d
+void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list ap)
+{
+    import core.stdc.stdlib : alloca, malloc;
+    import std.format ;
+
+    size_t bufLength = 1024;
+    void* argBuffer = malloc(bufLength);
+    size_t bufUsed ;
+    foreach (ti; arguments)
+    {
+        auto pos = bufUsed;
+        // Align to next word boundary
+        bufUsed += ti.tsize + size_t.sizeof - 1;
+        bufUsed -= bufUsed& size_t.sizeof - 1;
+        // Copy argument into buffer
+        va_arg(ap, ti, argBuffer + pos);
+    }
+
+    auto argptr = argBuffer;
+    void* skipArg(TypeInfo ti)
+    {
+        auto p = argptr;
+        // Align to next word boundary
+        argptr += ti.tsize + size_t.sizeof - 1;
+        argptr -= cast(size_t)argptr & size_t.sizeof - 1;
+        return p;
+    }
+    auto getArg(T)()
+    {
+        return *cast(T*)skipArg(typeid(T));
+    }
+
+    TypeInfo ti;
+    Mangle m;
+    void formatArg()
+    {
+        ulong vnumber;
+        char vchar;
+        Mangle m2;
+        int signed ;
+        string s;
+
+        void putstr(const char[] s)
+        {
+            foreach (c; s)
+                putc(c);
+
+        }
+
+        //printf("formatArg(fc = '%c', m = '%c')\n", fc, m);
+        int mi;
+        switch (m)
+        {
+            L2:
+                putstr((&vchar)[0 .. 1]);
+                return;
+
+            case Mangle.Tint:
+                signed = 1;
+                vnumber = getArg!int;
+                goto Lnumber;
+
+            case Mangle.Tarray:
+                mi = 10;
+while (1)
+                {
+                    m2 = cast(Mangle)typeid(ti).name[mi];
+                    switch (m2)
+                    {
+                        case Mangle.Tchar:
+                            s = getArg!string;
+                            putstr(s);
+                            break;
+
+                        case Mangle.Timmutable:
+                            mi++;
+                            continue;
+
+                        default:
+;
+                    }
+                    return;
+                }
+            default:
+;
+        }
+
+    Lnumber:
+;
+vchar = cast(char)('0' + vnumber);
+                goto L2;
+    }
+
+    for (int j ; j < arguments.length; )
+    {
+        ti = arguments[j++];
+        int mi = 9;
+        do
+            m = cast(Mangle)typeid(ti).name[mi++];
+while (m == Mangle.Tconst );
+
+            formatArg;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/b11447.d b/gcc/testsuite/gdc.test/runnable/imports/b11447.d
new file mode 100644
index 00000000000..f510d096839
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/b11447.d
@@ -0,0 +1,15 @@
+module imports.b11447;
+class A {}
+
+void map(alias dg)(int b) { }
+
+auto aaa(A a)
+{
+    int bs;
+
+    static A ggg;
+
+    bs.map!(
+        b => (a is ggg ? "a" : "b")
+    );
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/b15030.d b/gcc/testsuite/gdc.test/runnable/imports/b15030.d
new file mode 100644
index 00000000000..4754a3be618
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/b15030.d
@@ -0,0 +1,17 @@
+module b;
+
+import imports.std15030algo;
+
+unittest
+{
+    auto dg =
+        // __lambda1
+        (int[] delegate(int[]) self) =>
+            // __lambda2
+            (int[] arr) => arr
+                           ? self([arr.filter!(
+                                // __lambda2.__lambda2
+                                a => a
+                             ).front])
+                           : null;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/b26a.d b/gcc/testsuite/gdc.test/runnable/imports/b26a.d
new file mode 100644
index 00000000000..a959a3b3dac
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/b26a.d
@@ -0,0 +1,5 @@
+module imports.b26a;
+
+import b26;
+
+void foo(List!(char) list) {}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/bar10378.d b/gcc/testsuite/gdc.test/runnable/imports/bar10378.d
new file mode 100644
index 00000000000..f4d3bcb5b9b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/bar10378.d
@@ -0,0 +1,4 @@
+
+module bar;
+
+void writeln() { }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/bug10425.d b/gcc/testsuite/gdc.test/runnable/imports/bug10425.d
new file mode 100644
index 00000000000..1a16e86f2e0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/bug10425.d
@@ -0,0 +1,32 @@
+module imports.bug10425;
+
+struct A()
+{
+    int opCmp(const ref A p) const
+    {
+        return 0;
+    }
+
+    string toString()
+    {
+        return "";
+    }
+}
+
+struct B()
+{
+    void foo()
+    {
+        auto a = new A!();
+    }
+}
+
+struct C
+{
+    alias A!() a_t;
+
+    this(B!() b)
+    {
+
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/bug846.d b/gcc/testsuite/gdc.test/runnable/imports/bug846.d
new file mode 100644
index 00000000000..d83805d8425
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/bug846.d
@@ -0,0 +1,39 @@
+module imports.bug846;
+
+template ElemTypeOf( T )
+{
+    alias typeof(T.init[0]) ElemTypeOf;
+}
+
+template removeIf_( Elem, Pred )
+{
+    size_t fn( Elem[] buf, Pred pred )
+    {
+        void exch( size_t p1, size_t p2 )
+        {
+            Elem t  = buf[p1];
+            buf[p1] = buf[p2];
+            buf[p2] = t;
+        }
+
+        size_t cnt = 0;
+
+        for( size_t pos = 0, len = buf.length; pos < len; ++pos )
+        {
+            if( pred( buf[pos] ) )
+                ++cnt;
+            else
+                exch( pos, pos - cnt );
+        }
+        return buf.length - cnt;
+    }
+}
+
+template removeIf( Buf, Pred )
+{
+    size_t removeIf( Buf buf, Pred pred )
+    {
+        return removeIf_!(ElemTypeOf!(Buf), Pred).fn( buf, pred );
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/c11447.d b/gcc/testsuite/gdc.test/runnable/imports/c11447.d
new file mode 100644
index 00000000000..2fbda9fea0f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/c11447.d
@@ -0,0 +1,67 @@
+module imports.c11447;
+template map(fun...)
+{
+    auto map(Range)(Range r)
+    {
+        return MapResult!(fun, Range)(r);
+    }
+}
+private struct MapResult(alias fun, R)
+{
+    R _input;
+    this(R input) { _input = input; }
+    @property bool empty() { return _input.length == 0; }
+    @property auto ref front() { return fun(_input[0]); }
+    void popFront() { _input = _input[1..$]; }
+}
+
+class A {}
+
+struct TemplateInstancier
+{
+    auto instanciateFromResolvedArgs(A a)
+    {
+        auto bs = [B(a)];
+
+        static A gladeulfeurah;
+        gladeulfeurah = a;
+
+        auto r = bs.map!(
+            b => b.apply!(
+                function string() { assert(0); },
+                delegate string(i) {
+                    assert(a is gladeulfeurah, "tagazok");
+                    return "";
+                }
+            )
+        );
+
+        foreach (e; r) {}
+    }
+}
+
+enum Tag { Undefined, A, }
+
+struct B
+{
+    A a;
+    Tag tag;
+
+    this(A a)
+    {
+        tag = Tag.A;
+        this.a = a;
+    }
+}
+
+auto apply(alias undefinedHandler, alias handler)(B b)
+{
+    final switch(b.tag) with(Tag)
+    {
+        case Undefined :
+            return undefinedHandler();
+
+        case A :
+            return handler(b.a);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/c22a.d b/gcc/testsuite/gdc.test/runnable/imports/c22a.d
new file mode 100644
index 00000000000..98f49bcddc4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/c22a.d
@@ -0,0 +1,5 @@
+module imports.c22a;
+
+void afn1() {}
+void afn2() {}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/c22b.d b/gcc/testsuite/gdc.test/runnable/imports/c22b.d
new file mode 100644
index 00000000000..05969333948
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/c22b.d
@@ -0,0 +1,6 @@
+module imports.c22b;
+
+public import imports.c22a : afn1;
+
+void bfn1() {}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/circularA.d b/gcc/testsuite/gdc.test/runnable/imports/circularA.d
new file mode 100644
index 00000000000..4b5dd9d2d54
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/circularA.d
@@ -0,0 +1,30 @@
+module imports.circularA;
+import circular;
+
+class A
+{
+    struct
+    {
+        Tclass a;
+        Tstruct b;
+    }
+    union
+    {
+        Tclass c;
+        Tstruct d;
+    }
+}
+
+struct B
+{
+    struct
+    {
+        Tclass a;
+        Tstruct b;
+    }
+    union
+    {
+        Tclass c;
+        Tstruct d;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/depsprot_default.d b/gcc/testsuite/gdc.test/runnable/imports/depsprot_default.d
new file mode 100644
index 00000000000..2d5de351b2b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/depsprot_default.d
@@ -0,0 +1 @@
+void pack() {}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/depsprot_private.d b/gcc/testsuite/gdc.test/runnable/imports/depsprot_private.d
new file mode 100644
index 00000000000..be063dd66aa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/depsprot_private.d
@@ -0,0 +1 @@
+void priv() {}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/depsprot_public.d b/gcc/testsuite/gdc.test/runnable/imports/depsprot_public.d
new file mode 100644
index 00000000000..ad18eaf8df3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/depsprot_public.d
@@ -0,0 +1 @@
+void pub() {}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/extern1a.d b/gcc/testsuite/gdc.test/runnable/imports/extern1a.d
new file mode 100644
index 00000000000..2ef5e0ec270
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/extern1a.d
@@ -0,0 +1,4 @@
+extern (C)
+{
+    int x = 3;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice10086x.d b/gcc/testsuite/gdc.test/runnable/imports/ice10086x.d
new file mode 100644
index 00000000000..51b75375746
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice10086x.d
@@ -0,0 +1,34 @@
+module imports.ice10086x;
+
+import imports.ice10086y;
+
+struct S1
+{
+    int a1 = 123;
+}
+
+@safe auto f1(S1 r)
+{
+    return r;
+}
+
+@safe auto f2a()(S1 r)
+{
+    return bind!(f1, r);
+}
+
+@safe auto f2b(S1 r)
+{
+    return bind!(f1, r);
+}
+
+void test()
+{
+    S1 s1;
+
+    auto za = bind!(f2a, s1)();
+    assert(za.a1 == 123);
+
+    auto zb = bind!(f2b, s1)();
+    assert(zb.a1 == 123);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice10086y.d b/gcc/testsuite/gdc.test/runnable/imports/ice10086y.d
new file mode 100644
index 00000000000..60874417432
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice10086y.d
@@ -0,0 +1,10 @@
+module imports.ice10086y;
+
+auto bind(alias f, bindValues...)()
+{
+    auto bind(Types...)(Types values)
+    {
+        return f(bindValues, values);
+    }
+    return bind();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice10857a.d b/gcc/testsuite/gdc.test/runnable/imports/ice10857a.d
new file mode 100644
index 00000000000..afafc39f35f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice10857a.d
@@ -0,0 +1,19 @@
+module imports.ice10857a;
+
+template filter(alias pred)
+{
+    auto filter(Range)(Range rs)
+    {
+        return FilterResult!(pred, Range)(rs);
+    }
+}
+
+private struct FilterResult(alias pred, R)
+{
+    R _input;
+
+    void popFront()
+    {
+        assert(pred(_input[0]) == 123);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice10857b.d b/gcc/testsuite/gdc.test/runnable/imports/ice10857b.d
new file mode 100644
index 00000000000..e127a7b986f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice10857b.d
@@ -0,0 +1,14 @@
+module imports.ice10857b;
+
+import imports.ice10857a;
+import imports.ice10857b;
+
+void foo(int outer)
+{
+    int[] infos = [1];
+    auto f1 = filter!(s => outer)(infos);     // NG: error is triggered here
+    f1.popFront();
+    auto f2 = filter!((int s)=>outer)(infos); // OK
+    f2.popFront();
+}
+void main() { foo(123); }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice15138a.d b/gcc/testsuite/gdc.test/runnable/imports/ice15138a.d
new file mode 100644
index 00000000000..5f72044123c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice15138a.d
@@ -0,0 +1,28 @@
+module imports.ice15138a;
+
+alias AliasSeq(TL...) = TL;
+
+alias FieldNameTuple(T...) = AliasSeq!();
+
+struct TaggedAlgebraic(U)
+{
+    alias X = FieldNameTuple!(U.tupleof);
+}
+
+void get(T, U)(TaggedAlgebraic!U ta) {}
+
+union PayloadUnion
+{
+    int dummy;
+}
+
+struct JSONValue
+{
+    alias Payload = TaggedAlgebraic!PayloadUnion;
+
+    void get(T)()
+    {
+        Payload payload;
+        .get!T(payload);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice15176a.d b/gcc/testsuite/gdc.test/runnable/imports/ice15176a.d
new file mode 100644
index 00000000000..48c9362f6ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice15176a.d
@@ -0,0 +1,13 @@
+module imports.ice15176a;
+
+import imports.ice15176b;
+
+struct Stack(T)
+{
+    T[] data;
+}
+
+void func()
+{
+    alias ValStack = Stack!CodepointSet;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice15176b.d b/gcc/testsuite/gdc.test/runnable/imports/ice15176b.d
new file mode 100644
index 00000000000..394023f9710
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice15176b.d
@@ -0,0 +1,8 @@
+module imports.ice15176b;
+
+alias CodepointSet = InversionList!();
+
+struct InversionList()
+{
+    uint[] data;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice15200a.d b/gcc/testsuite/gdc.test/runnable/imports/ice15200a.d
new file mode 100644
index 00000000000..13b59b7fbe6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice15200a.d
@@ -0,0 +1,14 @@
+module imports.ice15200a;
+
+import imports.ice15200b;
+
+auto f() // not void
+{
+    sub([0], false);
+}
+void sub(R)(R list, bool b)
+{
+    foreach (i; list.filter!(delegate(e) => b))
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice15200b.d b/gcc/testsuite/gdc.test/runnable/imports/ice15200b.d
new file mode 100644
index 00000000000..e4507535904
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice15200b.d
@@ -0,0 +1,41 @@
+module imports.ice15200b;
+
+template filter(alias pred)
+{
+    auto filter(R)(R range)
+    {
+        return FilterResult!(pred, R)(range);
+    }
+}
+
+struct FilterResult(alias pred, R)
+{
+    R _input;
+
+    this(R r)
+    {
+        _input = r;
+        while (_input.length && !pred(_input[0]))
+        {
+            _input = _input[1..$];
+        }
+    }
+
+    @property bool empty()
+    {
+        return _input.length == 0;
+    }
+
+    @property auto ref front()
+    {
+        return _input[0];
+    }
+
+    void popFront()
+    {
+        do
+        {
+            _input = _input[1..$];
+        } while (_input.length && !pred(_input[0]));
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice4481a.d b/gcc/testsuite/gdc.test/runnable/imports/ice4481a.d
new file mode 100644
index 00000000000..07eb0539d1e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice4481a.d
@@ -0,0 +1,9 @@
+module imports.ice4481a;
+
+template reduce(alias pred)
+{
+    auto reduce(R)(R range)
+    {
+        return pred(range[0]);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ice4481b.d b/gcc/testsuite/gdc.test/runnable/imports/ice4481b.d
new file mode 100644
index 00000000000..1bcd59dc752
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ice4481b.d
@@ -0,0 +1,14 @@
+module imports.ice4481b;
+
+import imports.ice4481a;
+
+class Font
+{
+public:
+    int charHeight(dchar c) { return c == 's'; }
+    int textHeight(in string text)
+    {
+        auto maxHeight = (dchar ch) { return charHeight(ch); };
+        return reduce!(maxHeight)(text);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/inc11239.d b/gcc/testsuite/gdc.test/runnable/imports/inc11239.d
new file mode 100644
index 00000000000..62d7ac812f3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/inc11239.d
@@ -0,0 +1,12 @@
+// REQUIRED_ARGS:
+module imports.inc11239;
+
+int foo(T)(T x)
+{
+    return 3;
+}
+
+debug
+{
+    int x = foo(2);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/inline2a.d b/gcc/testsuite/gdc.test/runnable/imports/inline2a.d
new file mode 100644
index 00000000000..c0f4d173e96
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/inline2a.d
@@ -0,0 +1,191 @@
+/*******************************************************************************
+
+        @file Primes.d
+
+        Copyright (C) 2004 Kris Bell
+
+        This software is provided 'as-is', without any express or implied
+        warranty. In no event will the authors be held liable for damages
+        of any kind arising from the use of this software.
+
+        Permission is hereby granted to anyone to use this software for any
+        purpose, including commercial applications, and to alter it and/or
+        redistribute it freely, subject to the following restrictions:
+
+        1. The origin of this software must not be misrepresented; you must
+           not claim that you wrote the original software. If you use this
+           software in a product, an acknowledgment within documentation of
+           said product would be appreciated but is not required.
+
+        2. Altered source versions must be plainly marked as such, and must
+           not be misrepresented as being the original software.
+
+        3. This notice may not be removed or altered from any distribution
+           of the source.
+
+
+                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
+        @version        Initial version, April 2004
+        @author         Kris
+
+
+*******************************************************************************/
+
+// originally: module primes;
+module imports.inline2a;
+
+class Primes
+{
+        private
+         static const short primes[] =
+        [
+           2,    3,    5,    7,   11,   13,   17,   19,   23,   29,
+          31,   37,   41,   43,   47,   53,   59,   61,   67,   71,
+          73,   79,   83,   89,   97,  101,  103,  107,  109,  113,
+         127,  131,  137,  139,  149,  151,  157,  163,  167,  173,
+         179,  181,  191,  193,  197,  199,  211,  223,  227,  229,
+         233,  239,  241,  251,  257,  263,  269,  271,  277,  281,
+         283,  293,  307,  311,  313,  317,  331,  337,  347,  349,
+         353,  359,  367,  373,  379,  383,  389,  397,  401,  409,
+         419,  421,  431,  433,  439,  443,  449,  457,  461,  463,
+         467,  479,  487,  491,  499,  503,  509,  521,  523,  541,
+         547,  557,  563,  569,  571,  577,  587,  593,  599,  601,
+         607,  613,  617,  619,  631,  641,  643,  647,  653,  659,
+         661,  673,  677,  683,  691,  701,  709,  719,  727,  733,
+         739,  743,  751,  757,  761,  769,  773,  787,  797,  809,
+         811,  821,  823,  827,  829,  839,  853,  857,  859,  863,
+         877,  881,  883,  887,  907,  911,  919,  929,  937,  941,
+         947,  953,  967,  971,  977,  983,  991,  997, 1009, 1013,
+        1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069,
+        1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151,
+        1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223,
+        1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291,
+        1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373,
+        1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451,
+        1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511,
+        1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583,
+        1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657,
+        1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733,
+        1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811,
+        1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889,
+        1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987,
+        1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053,
+        2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129,
+        2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213,
+        2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287,
+        2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357,
+        2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423,
+        2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531,
+        2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617,
+        2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687,
+        2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741,
+        2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819,
+        2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903,
+        2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999,
+        3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079,
+        3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181,
+        3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257,
+        3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331,
+        3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413,
+        3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511,
+        3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571,
+        3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643,
+        3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727,
+        3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821,
+        3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907,
+        3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989,
+        4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057,
+        4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139,
+        4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231,
+        4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297,
+        4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409,
+        4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493,
+        4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583,
+        4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657,
+        4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751,
+        4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831,
+        4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937,
+        4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003,
+        5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087,
+        5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179,
+        5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279,
+        5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387,
+        5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443,
+        5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521,
+        5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639,
+        5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693,
+        5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791,
+        5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857,
+        5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939,
+        5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053,
+        6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133,
+        6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221,
+        6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301,
+        6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367,
+        6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473,
+        6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571,
+        6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673,
+        6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761,
+        6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833,
+        6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917,
+        6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997,
+        7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103,
+        7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207,
+        7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297,
+        7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411,
+        7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499,
+        7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561,
+        7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643,
+        7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723,
+        7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829,
+        7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919
+        ];
+
+        /*********************************************************************
+
+                Binary-chop search on sorted data.
+
+        *********************************************************************/
+
+        private static ptrdiff_t bsearch (in short[] array, short match)
+        {
+                ptrdiff_t l, u, m;
+
+                l = -1;
+                u = array.length;
+
+                while (l+1 != u)
+                      {
+                      m = (l + u) / 2;
+                      if (array[m] < match)
+                          l = m;
+                      else
+                         u = m;
+                      }
+
+               if (u >= array.length || array[u] != match)
+                   return -u;
+               return u;
+        }
+
+        /**********************************************************************
+
+                return a prime number between 2 and 7919 (inclusive) that
+                is equal to or larger than the given 'target' number.
+
+        **********************************************************************/
+
+        static int lookup (short target)
+        {
+                auto index = bsearch (primes, target);
+                if (index < 0)
+                    index = -index;
+
+                if (index >= primes.length)
+                    index = primes.length - 1;
+
+                return primes[index];
+        }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link10920a.d b/gcc/testsuite/gdc.test/runnable/imports/link10920a.d
new file mode 100644
index 00000000000..3be975f7ecf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link10920a.d
@@ -0,0 +1,19 @@
+module imports.link10920a;
+
+struct FormatSpec(C)
+{
+    void func() {}
+}
+
+struct BitArray
+{
+    auto toString()
+    {
+        // An auto function may runs semantic3 to calculate return type,
+        // even if it's non-root symbol.
+        // But inside the function body, all instantiations should be treated
+        // as speculative.
+        FormatSpec!char fs;
+        fs.func();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link11069x.d b/gcc/testsuite/gdc.test/runnable/imports/link11069x.d
new file mode 100644
index 00000000000..da44d5979b6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link11069x.d
@@ -0,0 +1,10 @@
+module imports.link11069x;
+import imports.link11069z;
+
+import std.algorithm;
+
+void bar()
+{
+    Vector2[] tc;
+    sort(tc);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link11069y.d b/gcc/testsuite/gdc.test/runnable/imports/link11069y.d
new file mode 100644
index 00000000000..4a962f6f7f2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link11069y.d
@@ -0,0 +1,10 @@
+module imports.link11069y;
+import std.traits;
+
+void readWriteVariable(T)(ref T data)
+{
+    foreach (it; __traits(allMembers, T))
+    {
+        enum vValid = mixin(`is(FunctionTypeOf!(T.` ~ it ~ `) == function)`);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link11069z.d b/gcc/testsuite/gdc.test/runnable/imports/link11069z.d
new file mode 100644
index 00000000000..5987cb4be7b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link11069z.d
@@ -0,0 +1,22 @@
+module imports.link11069z;
+struct Matrix(T, uint _M)
+{
+    int opCmp()(auto ref in Matrix b) const
+    {
+        return 0;
+    }
+
+    pure auto opDispatch(string s)()
+    {
+        enum L = s.length;
+        Matrix!(T, L) ret;
+        return ret;
+    }
+
+    pure Matrix normalized()
+    {
+        return Matrix();
+    }
+}
+
+alias Matrix!(float, 2) Vector2;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link11127a.d b/gcc/testsuite/gdc.test/runnable/imports/link11127a.d
new file mode 100644
index 00000000000..e2cfcd28652
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link11127a.d
@@ -0,0 +1,21 @@
+module imports.link11127a;
+
+struct Cycle(Range)
+{
+    alias Range R;
+
+    R _original;
+    size_t _index;
+
+    this(R input, size_t index = 0) {}
+}
+
+Cycle!R cycle(R)(R input)
+{
+    return Cycle!R(input);
+}
+
+Cycle!R cycle(R)(R input, size_t index = 0)
+{
+    return Cycle!R(input, index);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link11395a.d b/gcc/testsuite/gdc.test/runnable/imports/link11395a.d
new file mode 100644
index 00000000000..e23242819a3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link11395a.d
@@ -0,0 +1,15 @@
+module imports.link11395a;
+
+struct SA
+{
+    bool flag;
+    int[] nums;
+
+    bool opEquals(bool b) { return flag == b; }
+}
+
+struct SB
+{
+    int num;
+    SA sa;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link12144a.d b/gcc/testsuite/gdc.test/runnable/imports/link12144a.d
new file mode 100644
index 00000000000..f4fc8eba701
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link12144a.d
@@ -0,0 +1,50 @@
+module imports.link12144a;
+struct S1 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S2 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S3 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S4 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S5 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S6 { bool opEquals(T : typeof(this))(T) { return false; } ~this(){} }
+struct S7 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S8 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S9 { bool opEquals(T : typeof(this))(T) { return false; } }
+
+struct S10 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S11 { bool opEquals(T : typeof(this))(T) const { return false; }
+             int opCmp(T : typeof(this))(T) const { return 0; }
+             size_t toHash() const nothrow @safe { return 0; } }
+struct S12 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S13 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S14 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S15 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S16 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S17 { bool opEquals(T : typeof(this))(T) { return false; } }
+struct S18 { bool opEquals(T : typeof(this))(T) { return false; } }
+
+void fun()()
+{
+    { auto a = new S1[1]; }
+    { auto p = new S2(); }
+    { alias P = S3*; auto p = new P; }
+    { S4[int] aa; auto b = (aa == aa); }
+    { S5[] a; a.length = 10; }
+    { S6[] a; delete a; }
+    { S7[] a = []; }
+    { S8[] a = [S8.init]; }
+    { S9[int] aa = [1:S9.init]; }
+
+    { auto ti = typeid(S10[int]); }
+    { auto ti = typeid(int[S11]); }
+    { auto ti = typeid(S12[]); }
+    { auto ti = typeid(S13*); }
+    { auto ti = typeid(S14[3]); }
+    { auto ti = typeid(S15 function()); }
+    { auto ti = typeid(S16 delegate()); }
+    { auto ti = typeid(void function(S17)); }   // TypeInfo_Function doesn't have parameter types
+    { auto ti = typeid(void delegate(S18)); }   // ditto
+}
+
+struct B12146
+{
+    bool opCmp(ubyte val) { return false; }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link13043a.d b/gcc/testsuite/gdc.test/runnable/imports/link13043a.d
new file mode 100644
index 00000000000..fe5bedb8a4d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link13043a.d
@@ -0,0 +1,17 @@
+module imports.lin13043a;
+
+struct QualifiedNameTests
+{
+    struct Inner
+    {
+        const int opCmp(ref const Inner) { return 0; }
+    }
+
+    shared(const(Inner[string])[]) data;
+
+  version(bug)
+    size_t toHash() const
+    {
+        return typeid(typeof(data)).getHash(cast(const void*)&data);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link13394a.d b/gcc/testsuite/gdc.test/runnable/imports/link13394a.d
new file mode 100644
index 00000000000..57b4422a8f6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link13394a.d
@@ -0,0 +1,24 @@
+module imports.link13394a;
+
+class A
+{
+    this() { }
+}
+
+class Btpl(T) : T
+{
+    this()() { }
+
+    invariant() {}
+}
+
+alias B = Btpl!A;
+
+struct Stpl()
+{
+    void func()() {}
+
+    invariant() {}
+}
+
+alias S = Stpl!();
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link13400a.d b/gcc/testsuite/gdc.test/runnable/imports/link13400a.d
new file mode 100644
index 00000000000..2b565dbd349
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link13400a.d
@@ -0,0 +1,16 @@
+module imports.link13400a;
+
+struct BigInt
+{
+    this(string s) {}
+
+    // This template opEquals is determined to 'identity opEquals' by
+    // hasIdentityOpEquals() in clone.c with the speculative instantiation
+    // with dummy rvalue argument.
+    // Then BigInt.opEquals!().opEquals(const BigInt y) const pure is stored
+    // in template instance cache.
+    bool opEquals()(auto ref const BigInt y) const pure
+    {
+       return true;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link13415a.d b/gcc/testsuite/gdc.test/runnable/imports/link13415a.d
new file mode 100644
index 00000000000..de3bbe2ac9b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link13415a.d
@@ -0,0 +1,20 @@
+module imports.link13415a;
+struct S(alias func)
+{
+    void call()
+    {
+        func();
+    }
+}
+
+extern(C) int printf(in char*, ...);
+
+void f(int i = 77)
+{
+    void g()
+    {
+        printf("i = %d;\n", i);
+        assert(i == 77);
+    }
+    S!g().call();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link14074x.d b/gcc/testsuite/gdc.test/runnable/imports/link14074x.d
new file mode 100644
index 00000000000..2bcb8e5c8a5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link14074x.d
@@ -0,0 +1,5 @@
+module imports.link14074x;
+
+void put(R)(R)
+{
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link14074y.d b/gcc/testsuite/gdc.test/runnable/imports/link14074y.d
new file mode 100644
index 00000000000..340307e8f2f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link14074y.d
@@ -0,0 +1,31 @@
+module imports.link14074y;
+
+void encode(R, E)(R sink, E value)
+{
+    encodeInt(sink);
+    encodeArray(sink, value);
+
+    static assert(false);
+}
+
+void encodeInt(R)(R sink)
+{
+    encodeLongType(sink);
+}
+
+void encodeLongType(R)(R sink)
+{
+    import imports.link14074x;
+    put(sink);
+}
+
+void encodeArray(R, A)(R sink, A)
+{
+    encodeArrayHead(sink,
+        __traits(compiles, { encode(cast(ubyte[])null, A.tupleof[0].init); }));
+}
+
+void encodeArrayHead(R)(R sink, ulong arrayLength)
+{
+    encodeLongType(sink);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link14074z.d b/gcc/testsuite/gdc.test/runnable/imports/link14074z.d
new file mode 100644
index 00000000000..04e863208db
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link14074z.d
@@ -0,0 +1,56 @@
+import imports.link14074z;
+
+void replaceAllWith(RE)(RE re)
+if (is(RE == S!()) || true)
+{
+    auto m = RegexMatch!()(re);
+}
+
+struct RegexMatch()
+{
+    this(RE)(RE prog)
+    {
+        enum x = is(RE == S!());
+    }
+}
+
+struct S()  // StaticRegex
+{
+    alias Matcher = BTM!();
+    alias M = Matcher!();
+}
+
+struct Input()
+{
+    struct L
+    {
+        auto loopBack()
+        {
+            return Input();
+        }
+    }
+    auto loopBack()
+    {
+        return L();
+    }
+}
+
+template BTM()  // BacktrackingMatcher
+{
+    struct BTM(Stream = Input!())
+    {
+        Stream s;
+        dchar front;
+
+        this(Stream stream)
+        {
+        }
+
+        auto bwdMatcher(ref BTM matcher)
+        {
+            alias BMTempl = .BTM!();
+            alias BM = BMTempl!(typeof(s.loopBack()));
+            auto m = BM(s.loopBack());
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link14541traits.d b/gcc/testsuite/gdc.test/runnable/imports/link14541traits.d
new file mode 100644
index 00000000000..de248494614
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link14541traits.d
@@ -0,0 +1,54 @@
+module imports.link14541traits;
+
+template hasElaborateAssign(S)
+{
+    static if (is(S == struct))
+    {
+        extern __gshared S lvalue;
+
+        enum hasElaborateAssign = is(typeof(S.init.opAssign(S.init))) ||
+                                  is(typeof(S.init.opAssign(lvalue)));
+    }
+    else
+    {
+        enum bool hasElaborateAssign = false;
+    }
+}
+
+void swap(T)(ref T lhs, ref T rhs) @trusted pure nothrow @nogc
+{
+    static if (hasElaborateAssign!T)
+    {
+    }
+    else
+    {
+    }
+}
+
+template Tuple(Types...)
+{
+    struct Tuple
+    {
+        Types field;
+        alias field this;
+
+        this(Types values)
+        {
+            field[] = values[];
+        }
+
+        void opAssign(R)(auto ref R rhs)
+        {
+            static if (is(R : Tuple!Types) && !__traits(isRef, rhs))
+            {
+                // Use swap-and-destroy to optimize rvalue assignment
+                swap!(Tuple!Types)(this, rhs);
+            }
+            else
+            {
+                // Do not swap; opAssign should be called on the fields.
+                field[] = rhs.field[];
+            }
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link14588a.d b/gcc/testsuite/gdc.test/runnable/imports/link14588a.d
new file mode 100644
index 00000000000..2ea2661de65
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link14588a.d
@@ -0,0 +1,15 @@
+module imports.link14588a;
+
+void func(alias a)()
+{
+}
+
+class A
+{
+    int i;
+
+    void all()()
+    {
+        func!(i)();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link14814a.d b/gcc/testsuite/gdc.test/runnable/imports/link14814a.d
new file mode 100644
index 00000000000..7d64df07b31
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link14814a.d
@@ -0,0 +1,11 @@
+module imports.link14814a;
+
+void fun0()
+{
+}
+
+void fun4()
+{
+    void function()[TypeInfo] funs;
+    funs[typeid(int)] = &fun0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link15194b.d b/gcc/testsuite/gdc.test/runnable/imports/link15194b.d
new file mode 100644
index 00000000000..fdba76902e8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link15194b.d
@@ -0,0 +1,7 @@
+module imports.link15194b;
+
+auto fun()
+{
+    import imports.link15194std;
+    return new RedBlackTree!int;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link15194std.d b/gcc/testsuite/gdc.test/runnable/imports/link15194std.d
new file mode 100644
index 00000000000..95c63ce99c9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link15194std.d
@@ -0,0 +1,67 @@
+module imports.link15194std;
+
+// std.algorithm.setopts
+
+/* setUnion template function is instantiated in module link15194 as root,
+ * and linked into executable.
+ *
+ * - In "original case", due to link to typeid(const RBRange!(RBNode!int*)),
+ *   unSpeculative should be called for the type of typeid operand.
+ *
+ * - In "additional case", typeid(const RBRange!(RBNode!int*)*) returns
+ *   TypeInfo_Pointer instance. But later its 'next' field access will reference
+ *   RBRange instance. Therefore typeid should also unSpeculative the bottom struct
+ *   of operand type.
+ */
+version (A)
+{
+    // additional case
+
+    TypeInfo setUnion(Rs...)(Rs )
+    {
+        return typeid(const Rs[0]*).next;
+
+        // semanticTypeInfo should also unSpaculate TypePointer.next.
+    }
+}
+else
+{
+    // original case
+
+    struct SetUnion(Rs...)
+    {
+        pragma(msg, Rs);
+        Rs r;
+
+        // Rs[0] == RBRange!(RBNode!int*)
+        // Rs[1] == int[]
+
+        // size_t toHash() is implicitly generated by buildXtoHash.
+        // And from that,
+        //  typeid(const RBRange!(RBNode!int*))
+        // and
+        //  typeid(const int[])
+        // are referenced to invoke TypeInfo.getHash().
+    }
+
+    SetUnion!(Rs) setUnion(Rs...)(Rs )
+    {
+        return typeof(return)();
+    }
+}
+
+// std.container.rbtree
+
+struct RBNode(V) {}
+
+struct RBRange(N) {}
+
+class RedBlackTree(Elem)
+{
+    alias Range = RBRange!(RBNode!Elem*);
+
+    Range opSlice()
+    {
+        return Range();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link2500a.d b/gcc/testsuite/gdc.test/runnable/imports/link2500a.d
new file mode 100644
index 00000000000..59c3f24a04f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link2500a.d
@@ -0,0 +1,9 @@
+module imports.link2500a;
+
+import link2500;
+import imports.link2500b;
+
+class B
+{
+    S!A t;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link2500b.d b/gcc/testsuite/gdc.test/runnable/imports/link2500b.d
new file mode 100644
index 00000000000..537bf30a86e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link2500b.d
@@ -0,0 +1,6 @@
+module imports.link2500b;
+
+struct S(T)
+{
+    void foo() {}
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link2644a.d b/gcc/testsuite/gdc.test/runnable/imports/link2644a.d
new file mode 100644
index 00000000000..18eedddd22b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link2644a.d
@@ -0,0 +1,9 @@
+module imports.link2644a;
+
+import imports.link2644c;
+import imports.link2644b;
+
+version(X)
+    struct X { alias C!(bool) CA; }
+else
+    alias C!(bool) CA;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link2644b.d b/gcc/testsuite/gdc.test/runnable/imports/link2644b.d
new file mode 100644
index 00000000000..95fd7f0140c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link2644b.d
@@ -0,0 +1,9 @@
+module imports.link2644b;
+
+import imports.link2644c;
+import imports.link2644a;
+
+version(X)
+    struct X { alias C!(bool) CB; }
+else
+    alias C!(bool) CB;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link2644c.d b/gcc/testsuite/gdc.test/runnable/imports/link2644c.d
new file mode 100644
index 00000000000..7cadf7fa044
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link2644c.d
@@ -0,0 +1,5 @@
+module imports.link2644c;
+
+class C(T)
+{
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link7745b.d b/gcc/testsuite/gdc.test/runnable/imports/link7745b.d
new file mode 100644
index 00000000000..2782782a5f0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link7745b.d
@@ -0,0 +1,7 @@
+module imports.link7745b;
+struct C { auto asdfg() {} }
+
+// extreme test of bug 4820
+void nextis(W)(void delegate() dg = {}) {}
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link8023b.d b/gcc/testsuite/gdc.test/runnable/imports/link8023b.d
new file mode 100644
index 00000000000..ba9e82f0911
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link8023b.d
@@ -0,0 +1,2 @@
+module imports.link8023b;
+import link8023;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/link9571a.d b/gcc/testsuite/gdc.test/runnable/imports/link9571a.d
new file mode 100644
index 00000000000..191bf8ffa03
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/link9571a.d
@@ -0,0 +1,11 @@
+module imports.link9571a;
+struct MapResult(alias fun)
+{
+    void bar() { fun(0); }
+}
+auto foo()
+{
+    alias MapResult!(function(int c) => 0) M;
+    M m;
+    m.bar();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/linktypeinfo_file.d b/gcc/testsuite/gdc.test/runnable/imports/linktypeinfo_file.d
new file mode 100644
index 00000000000..797881b7147
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/linktypeinfo_file.d
@@ -0,0 +1,33 @@
+module imports.linktypeinfo_file;
+
+auto filter(alias pred, R)(R r)
+{
+    return FilterResult!(pred, R)(r);
+}
+
+struct FilterResult(alias pred, R)
+{
+    R r;
+    bool empty() { return r.empty; }
+    auto front() { return r.front; }
+    void popFront()
+    {
+        while (!r.empty && pred(r.front))
+            r.popFront();
+    }
+}
+
+struct DirIterator
+{
+    int[] r;
+    @property bool empty() { return r.length == 0; }
+    @property auto front() { return r[0]; }
+    void popFront() { r = r[1..$]; }
+
+}
+
+auto dirEntries(string path)
+{
+    bool f(int de) { return 1; }
+    return filter!f(DirIterator());
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/m1a.d b/gcc/testsuite/gdc.test/runnable/imports/m1a.d
new file mode 100644
index 00000000000..7489160ced8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/m1a.d
@@ -0,0 +1,11 @@
+module imports.m1a;
+
+import m1;
+
+A aFunc( aliasM1 f )
+{
+  return f(); // line 7
+}
+
+//A aFunc( A function() f );
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/m8668a.d b/gcc/testsuite/gdc.test/runnable/imports/m8668a.d
new file mode 100644
index 00000000000..a0f778bf389
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/m8668a.d
@@ -0,0 +1,6 @@
+module imports.m8668a;
+
+void split8668(T)(T k)
+    if(is(T : string))
+{
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/m8668b.d b/gcc/testsuite/gdc.test/runnable/imports/m8668b.d
new file mode 100644
index 00000000000..54d01437e00
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/m8668b.d
@@ -0,0 +1,6 @@
+module imports.m8668b;
+
+void split8668(T)(T k)
+    if(is(T : int))
+{
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/m8668c.d b/gcc/testsuite/gdc.test/runnable/imports/m8668c.d
new file mode 100644
index 00000000000..3e0ee375b36
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/m8668c.d
@@ -0,0 +1,4 @@
+//drop in another one to pull split from m2
+module imports.m8668c;
+
+public import imports.m8668b: split8668;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/mangle10077.d b/gcc/testsuite/gdc.test/runnable/imports/mangle10077.d
new file mode 100644
index 00000000000..c25e616edbc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/mangle10077.d
@@ -0,0 +1,9 @@
+module imports.mangle10077;
+
+//UTF-8 chars
+__gshared pragma(mangle, "test_эльфийские_письмена_9") ubyte test10077i_v;
+
+void setTest10077i()
+{
+    test10077i_v = 42;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/mod2.d b/gcc/testsuite/gdc.test/runnable/imports/mod2.d
new file mode 100644
index 00000000000..4933e0ac1c6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/mod2.d
@@ -0,0 +1,12 @@
+// mod2.d
+
+module imports.mod2;
+
+import mod1;
+
+extern(C) int printf(const char*, ...);
+
+void greet()
+{
+ printf(name().ptr);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ovs1528a.d b/gcc/testsuite/gdc.test/runnable/imports/ovs1528a.d
new file mode 100644
index 00000000000..90a60dcbf27
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ovs1528a.d
@@ -0,0 +1,12 @@
+module imports.ovs1528a;
+
+auto func1528() { return 1; }
+auto func1528(T)(T) if (is(T : real)) { return 2; }
+
+auto bunc1528(T)(T) if (is(T : real)) { return 2; }
+auto bunc1528() { return 1; }
+
+auto vunc1528(int) { return 1; }
+auto wunc1528(T)(T[]) { return 2; }
+
+auto opUnary1528(string op : "+")(int) { return 1; }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ovs1528b.d b/gcc/testsuite/gdc.test/runnable/imports/ovs1528b.d
new file mode 100644
index 00000000000..c711b1072f1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ovs1528b.d
@@ -0,0 +1,12 @@
+module imports.ovs1528b;
+
+auto func1528(string) { return 3; }
+auto func1528(T)(T[]) { return 4; }
+
+auto bunc1528(T)(T[]) { return 4; }
+auto bunc1528(string) { return 3; }
+
+auto vunc1528(T)(T[]) { return 2; }
+auto wunc1528(int) { return 1; }
+
+auto opUnary1528(string op : "-")(int) { return 2; }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std11069array.d b/gcc/testsuite/gdc.test/runnable/imports/std11069array.d
new file mode 100644
index 00000000000..561676d5281
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std11069array.d
@@ -0,0 +1,16 @@
+module imports.std11069array;
+
+@property bool empty(T)(in T[] a) @safe pure nothrow
+{
+    return !a.length;
+}
+
+void popFront(T)(ref T[] a) @safe pure nothrow
+{
+    a = a[1 .. $];
+}
+
+@property ref T front(T)(T[] a) @safe pure nothrow
+{
+    return a[0];
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std11069container.d b/gcc/testsuite/gdc.test/runnable/imports/std11069container.d
new file mode 100644
index 00000000000..060b29641be
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std11069container.d
@@ -0,0 +1,11 @@
+module imports.std11069container;
+
+import imports.std11069range, imports.std11069typecons;
+
+struct BinaryHeap(Store)
+if (isInputRange!Store)
+//if (isRandomAccessRange!Store)
+{
+    // The payload includes the support store and the effective length
+    private RefCounted!(Tuple!(Store)) _payload;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std11069range.d b/gcc/testsuite/gdc.test/runnable/imports/std11069range.d
new file mode 100644
index 00000000000..6eb9985d86e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std11069range.d
@@ -0,0 +1,15 @@
+module imports.std11069range;
+
+public import imports.std11069array;
+
+template isInputRange(R)
+{
+    enum bool isInputRange = is(typeof(
+    (inout int = 0)
+    {
+        R r = void;       // can define a range object
+        if (r.empty) {}   // can test for empty
+        r.popFront();     // can invoke popFront()
+        auto h = r.front; // can get the front of the range
+    }));
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std11069typecons.d b/gcc/testsuite/gdc.test/runnable/imports/std11069typecons.d
new file mode 100644
index 00000000000..2de5913c0d4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std11069typecons.d
@@ -0,0 +1,34 @@
+module imports.std11069typecons;
+
+import imports.std11069array;
+
+template Tuple(Specs...)
+{
+    struct Tuple
+    {
+        Specs expand;
+
+        string toString()
+        {
+            expand[0].empty;
+            expand[0].front;
+            expand[0].popFront();
+
+            return null;
+        }
+    }
+}
+
+
+struct RefCounted(T)
+{
+    T payload;
+
+    ~this()
+    {
+        //.destroy(_refCounted._store._payload);
+        //auto init = typeid(payload).init();
+        payload.toString(); // refer Tuple.toString symbol?
+    }
+
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std11863bitmanip.d b/gcc/testsuite/gdc.test/runnable/imports/std11863bitmanip.d
new file mode 100644
index 00000000000..4f8e33e500c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std11863bitmanip.d
@@ -0,0 +1,11 @@
+module imports.std11863bitmanip;
+
+import imports.std11863format : FormatSpec;
+
+struct BitArray
+{
+    void toString(scope void delegate(const(char)[]) sink,
+                  FormatSpec!char fmt) const
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std11863conv.d b/gcc/testsuite/gdc.test/runnable/imports/std11863conv.d
new file mode 100644
index 00000000000..d28a96320c8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std11863conv.d
@@ -0,0 +1,90 @@
+module imports.std11863conv;
+
+import imports.std11863format;
+
+template to(T)
+{
+    T to(A...)(A args)
+    {
+        return toImpl!T(args);
+    }
+}
+
+T toImpl(T, S)(S value)
+{
+    static if (is(S == int) && is(T == string))
+    {
+        // other integral-to-string conversions with default radix
+        return toImpl!(T, S)(value, 10);
+    }
+    else
+        static assert(0);
+}
+
+@trusted pure T toImpl(T, S)(S value, uint radix/*, LetterCase letterCase = LetterCase.upper*/)
+{
+    static assert(is(S == int) && is(T == string));
+
+    alias EEType = char/*Unqual!(typeof(T.init[0]))*/;
+
+    T toStringRadixConvert(size_t bufLen, uint radix = 0, bool neg = false)(uint runtimeRadix = 0)
+    {
+        static if (neg)
+            ulong div = void, mValue = cast(uint)(-value);
+        else
+            uint/*Unsigned!(Unqual!S)*/ div = void, mValue = cast(uint)(value);
+
+        size_t index = bufLen;
+        EEType[bufLen] buffer = void;
+        char baseChar = /*letterCase == LetterCase.lower ? 'a' : */'A';
+        char mod = void;
+
+        do
+        {
+            static if (radix == 0)
+            {
+                div = cast(S)(mValue / runtimeRadix );
+                mod = cast(ubyte)(mValue % runtimeRadix);
+                mod += mod < 10 ? '0' : baseChar - 10;
+            }
+            else static if (radix > 10)
+            {
+                div = cast(S)(mValue / radix );
+                mod = cast(ubyte)(mValue % radix);
+                mod += mod < 10 ? '0' : baseChar - 10;
+            }
+            else
+            {
+                div = cast(S)(mValue / radix);
+                mod = mValue % radix + '0';
+            }
+            buffer[--index] = cast(char)mod;
+            mValue = div;
+        } while (mValue);
+
+        static if (neg)
+        {
+            buffer[--index] = '-';
+        }
+        return cast(T)buffer[index .. $].dup;
+    }
+
+    //enforce(radix >= 2 && radix <= 36, new ConvException("Radix error"));
+
+    switch(radix)
+    {
+        case 10:
+            if (value < 0)
+                return toStringRadixConvert!(S.sizeof * 3 + 1, 10, true)();
+            else
+                return toStringRadixConvert!(S.sizeof * 3, 10)();
+        //case 16:
+        //    return toStringRadixConvert!(S.sizeof * 2, 16)();
+        //case 2:
+        //    return toStringRadixConvert!(S.sizeof * 8, 2)();
+        //case 8:
+        //    return toStringRadixConvert!(S.sizeof * 3, 8)();
+        default:
+            assert(0);//return toStringRadixConvert!(S.sizeof * 6)(radix);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std11863format.d b/gcc/testsuite/gdc.test/runnable/imports/std11863format.d
new file mode 100644
index 00000000000..9ae720928d5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std11863format.d
@@ -0,0 +1,13 @@
+module imports.std11863format;
+
+import imports.std11863bitmanip;
+import imports.std11863conv;
+
+struct FormatSpec(Char)
+{
+    string toString()
+    {
+        // text(width)
+        return to!string(1);    // instantiate toImpl!(string, int)
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std12010container.d b/gcc/testsuite/gdc.test/runnable/imports/std12010container.d
new file mode 100644
index 00000000000..a2288059927
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std12010container.d
@@ -0,0 +1,70 @@
+module imports.std12010container;
+struct Array(T)
+{
+    private struct Payload
+    {
+        size_t _capacity;
+        T[] _payload;
+
+        ~this()
+        {
+        }
+
+        this(this)
+        {
+        }
+    }
+    private alias RefCounted!(Payload) Data;
+    private Data _data;
+
+    bool opEquals(ref const Array rhs) const
+    {
+        return true;
+    }
+}
+
+
+struct BinaryHeap(Store)
+{
+    private static struct Data
+    {
+        Store _store;
+        size_t _length;
+    }
+    private RefCounted!(Data) _payload;
+}
+
+
+struct RefCounted(T)
+{
+    struct RefCountedStore
+    {
+        private struct Impl
+        {
+            T _payload;
+            size_t _count;
+        }
+
+        private Impl* _store;
+
+    }
+    RefCountedStore _refCounted;
+
+    this(this)
+    {
+    }
+
+    ~this()
+    {
+        .destroy(_refCounted._store._payload);
+    }
+
+    void opAssign(typeof(this) rhs)
+    {
+    }
+
+    void opAssign(T rhs)
+    {
+        typeid(T).destroy(&rhs);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std15017variant.d b/gcc/testsuite/gdc.test/runnable/imports/std15017variant.d
new file mode 100644
index 00000000000..f6f7f5ea404
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std15017variant.d
@@ -0,0 +1,25 @@
+module imports.std15017variant;
+
+struct VariantN(size_t maxDataSize)
+{
+    VariantN opAssign() { return this; }
+
+    bool opEquals(T)(T) { return true; }
+
+    bool opEquals(T)(ref const T) const { return true; }
+
+    size_t toHash() const nothrow @trusted { return 0;  }
+
+    ~this() {}
+}
+
+alias Variant1 = VariantN!(1);
+alias Variant2 = VariantN!(2);
+alias Variant3 = VariantN!(3);
+alias Variant4 = VariantN!(4);
+alias Variant5 = VariantN!(5);
+alias Variant6 = VariantN!(6);
+alias Variant7 = VariantN!(7);
+alias Variant8 = VariantN!(8);
+alias Variant9 = VariantN!(9);
+alias Variant10 = VariantN!(10);
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std15021conv.d b/gcc/testsuite/gdc.test/runnable/imports/std15021conv.d
new file mode 100644
index 00000000000..b9be8bd8dd0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std15021conv.d
@@ -0,0 +1,13 @@
+module imports.std15021conv;
+
+T to(T, A...)(A args)
+{
+    return toImpl!T(args);
+}
+
+T toImpl(T, S)(S value)
+{
+    import imports.std15021format;
+    enforceValidFormatSpec!(S, char)('c');
+    return "";
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std15021format.d b/gcc/testsuite/gdc.test/runnable/imports/std15021format.d
new file mode 100644
index 00000000000..8493646d863
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std15021format.d
@@ -0,0 +1,12 @@
+module imports.std15021format;
+
+T enforceEx(T)(T value, lazy string msg = "")
+{
+    if (!value) throw new Exception(msg);
+    return value;
+}
+
+void enforceValidFormatSpec(T, Char)(int spec)
+{
+    enforceEx(spec == 's');
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/std15030algo.d b/gcc/testsuite/gdc.test/runnable/imports/std15030algo.d
new file mode 100644
index 00000000000..eb54c592f46
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/std15030algo.d
@@ -0,0 +1,35 @@
+module imports.std15030algo;
+
+template filter(alias pred)
+{
+    auto filter(R)(R r)
+    {
+        return FilterResult!(pred, R)(r);
+    }
+}
+
+private struct FilterResult(alias pred, R)
+{
+    R _input;
+
+    this(R r)
+    {
+        _input = r;
+        while (_input.length != 0 && !pred(_input[0]))
+        {
+            _input = _input[1..$];
+        }
+    }
+
+    @property bool empty() { return _input.length == 0; }
+
+    @property auto ref front() { return _input[0]; }
+
+    void popFront()
+    {
+        do
+        {
+            _input = _input[1..$];
+        } while (_input.length != 0 && !pred(_input[0]));
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/template13478a.d b/gcc/testsuite/gdc.test/runnable/imports/template13478a.d
new file mode 100644
index 00000000000..9fcecf3e382
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/template13478a.d
@@ -0,0 +1,9 @@
+module imports.template13478a;
+
+import gcc.attribute;
+
+@attribute("noinline") bool foo(T)() {
+    // Make sure this is not inlined so template13478.o actually
+    // needs to reference it.
+    return false;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/template13478b.d b/gcc/testsuite/gdc.test/runnable/imports/template13478b.d
new file mode 100644
index 00000000000..1107e6b7c0b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/template13478b.d
@@ -0,0 +1,7 @@
+import imports.template13478b;
+
+import imports.template13478a;
+
+// Note that foo is only used in the template constraint here.
+T barImpl(T)(T t) if (is(typeof({ foo!T(); }))) { return t; }
+int bar(int a) { return barImpl(a); }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/template2962a.d b/gcc/testsuite/gdc.test/runnable/imports/template2962a.d
new file mode 100644
index 00000000000..8cfb444b826
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/template2962a.d
@@ -0,0 +1,10 @@
+module imports.template2962a;
+import template2962;
+
+alias bug2962comment36!() bug2962_comment36_alias;
+
+void main() {
+    funcC!(bool)(1.0);
+    foo!int(0);
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/template_ovs1.d b/gcc/testsuite/gdc.test/runnable/imports/template_ovs1.d
new file mode 100644
index 00000000000..a4b2ecf2a60
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/template_ovs1.d
@@ -0,0 +1,58 @@
+module imports.template_ovs1;
+
+/***************************************************/
+// 1900 - template overload set
+
+auto foo1900a(int num) { return 1; }
+auto foo1900b(T)(T arg) if (is(T : const(char)[])) { return 2; }
+
+auto bar1900a(T)(T arg) if (is(T : double)) { return 1; }
+auto bar1900b(T)(T arg) if (is(T : const(char)[])) { return 2; }
+
+auto baz1900(T)(T arg) if (is(T : double)) { return 1; }
+auto baz1900(T)(T arg) if (is(T : int[int])) { return 2; }
+
+auto bad1900(string op)() if (op == "++") { return 1; }
+
+mixin template Mix1900_A()
+{
+    auto mixfooa() { return 1; }
+    auto mixfoob(T)(T) { return 2; }
+
+    mixin Mix1900_SubA;
+}
+
+mixin template Mix1900_SubA()
+{
+    auto mixsubfooa() { return 1; }
+    auto mixsubfoob(T)(T) { return 2; }
+}
+
+auto merge1900(T)(int)
+{
+    return 1;
+}
+
+/***************************************************/
+// 1900
+
+class AClass1900 {}
+template Traits1900(T : AClass1900) { enum name = "AClass"; }
+
+
+void Value1900a() {}
+template Value1900a(T) if (is(T == double)) { enum Value1900a = 1; }
+
+template Value1900b(T) if (is(T == double)) { enum Value1900b = 1; }
+void Value1900b() {}
+
+/***************************************************/
+// 8352
+
+Range remove8352a(alias pred, Range)(Range range) { return range; }
+void remove8352b(in char[] name) {}
+
+/***************************************************/
+// 10658
+
+template Val10658(int n) { enum Val10658 = 1; }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/template_ovs2.d b/gcc/testsuite/gdc.test/runnable/imports/template_ovs2.d
new file mode 100644
index 00000000000..5b925689e55
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/template_ovs2.d
@@ -0,0 +1,58 @@
+module imports.template_ovs2;
+
+/***************************************************/
+// 1900 - template overload set
+
+auto foo1900a(T)(T arg) if (is(T : const(char)[])) { return 2; }
+auto foo1900b(int num) { return 1; }
+
+auto bar1900a(T)(T arg) if (is(T : const(char)[])) { return 2; }
+auto bar1900b(T)(T arg) if (is(T : double)) { return 1; }
+
+auto baz1900(T)(T arg) if (is(T : Object)) { return 3; }
+auto baz1900(T)(T arg) if (is(T : const(char)[])) { return 4; }
+
+auto bad1900(string op)() if (op == "++") { return 2; }
+
+mixin template Mix1900_B()
+{
+    auto mixfooa(T)(T) { return 2; }
+    auto mixfoob() { return 1; }
+
+    mixin Mix1900_SubB;
+}
+
+mixin template Mix1900_SubB()
+{
+    auto mixsubfooa(T)(T) { return 2; }
+    auto mixsubfoob() { return 1; }
+}
+
+auto merge1900(T)(string)
+{
+    return 2;
+}
+
+/***************************************************/
+// 1900
+
+class BClass1900 {}
+template Traits1900(T : BClass1900) { enum name = "BClass"; }
+string func1900(BClass1900 b) { return "BClass"; }
+
+void Value1900a() {}
+template Value1900a(T) if (is(T == string)) { enum Value1900a = 2; }
+
+template Value1900b(T) if (is(T == string)) { enum Value1900b = 2; }
+void Value1900b() {}
+
+/***************************************************/
+// 8352
+
+void remove8352a(in char[] name) {}
+Range remove8352b(alias pred, Range)(Range range) { return range; }
+
+/***************************************************/
+// 10658
+
+template Val10658(long n) { enum Val10658 = 2; }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/template_ovs3.d b/gcc/testsuite/gdc.test/runnable/imports/template_ovs3.d
new file mode 100644
index 00000000000..ca76914e76b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/template_ovs3.d
@@ -0,0 +1,36 @@
+module imports.template_ovs3;
+
+/***************************************************/
+// 1900 - template overload set
+
+import imports.template_ovs1;
+import imports.template_ovs2;
+
+struct S1900
+{
+    alias .foo1900a foo1900a;
+    alias .foo1900b foo1900b;
+
+    alias .bar1900a bar1900a;
+    alias .bar1900b bar1900b;
+
+    alias .baz1900 baz1900;
+
+    alias .bad1900 bad1900;
+
+    // This is a kind of Issue 1528, cannot make overload contains both templates and functions
+    //void funcF() {}
+    //void funcT(T)(T) {}
+    //alias funcF funca;   // make overload with alias declaration
+    //alias funcT funca;
+    //alias funcT funcb;   // make overload with alias declaration
+    //alias funcF funcb;
+
+    mixin Mix1900_A a;
+    mixin Mix1900_B b;
+}
+
+/***************************************************/
+// 1900
+
+struct Traits1900(T) if (!is(T == class)) { enum name = "any"; }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test10441b.d b/gcc/testsuite/gdc.test/runnable/imports/test10441b.d
new file mode 100644
index 00000000000..1f9318caa31
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test10441b.d
@@ -0,0 +1,9 @@
+
+public import test10441c;
+
+auto foo()()
+    if (boo(1))
+{
+    return 1;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test10441c.d b/gcc/testsuite/gdc.test/runnable/imports/test10441c.d
new file mode 100644
index 00000000000..fa9686a6682
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test10441c.d
@@ -0,0 +1,6 @@
+
+auto boo(T)(T t)
+{
+    return 1;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test10573a.d b/gcc/testsuite/gdc.test/runnable/imports/test10573a.d
new file mode 100644
index 00000000000..2044853c52b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test10573a.d
@@ -0,0 +1,13 @@
+module imports.test10573a;
+
+abstract class base {}
+class mysql : base {}
+
+class handler
+{
+    private mysql[int] mysql_servers;
+    public void foo()
+    {
+        base[int] hServers = cast(base[int])mysql_servers;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test10736a.d b/gcc/testsuite/gdc.test/runnable/imports/test10736a.d
new file mode 100644
index 00000000000..70563fd8c78
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test10736a.d
@@ -0,0 +1,4 @@
+module imports.test10736a;
+
+version(A) import std.range;
+else       import imports.test10736c;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test10736b.d b/gcc/testsuite/gdc.test/runnable/imports/test10736b.d
new file mode 100644
index 00000000000..1aa49d837e5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test10736b.d
@@ -0,0 +1,13 @@
+module imports.test10736b;
+
+version(A) import std.range;
+else       import imports.test10736c;
+
+void main()
+{
+    int[] arr = [0, 1, 2, 3];
+    auto x = chunks(arr, 4);  // error
+
+    import core.stdc.stdio;
+    printf("success\n");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test10736c.d b/gcc/testsuite/gdc.test/runnable/imports/test10736c.d
new file mode 100644
index 00000000000..ca8a8e30a84
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test10736c.d
@@ -0,0 +1,24 @@
+module imports.test10736c;
+
+struct Chunks(Source)
+{
+    this(Source source, size_t chunkSize)
+    {
+        _source = source;
+        _chunkSize = chunkSize;
+    }
+
+    typeof(this) opSlice(size_t, size_t)
+    {
+        return chunks(_source, _chunkSize);
+    }
+
+private:
+    Source _source;
+    size_t _chunkSize;
+}
+
+Chunks!Source chunks(Source)(Source source, size_t chunkSize)
+{
+    return typeof(return)(source, chunkSize);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test10a.d b/gcc/testsuite/gdc.test/runnable/imports/test10a.d
new file mode 100644
index 00000000000..f75d3754b9b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test10a.d
@@ -0,0 +1,9 @@
+module imports.test10a;
+
+void init()
+{
+    it[0] = 32;
+}
+
+int[1] it;
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test11039b.d b/gcc/testsuite/gdc.test/runnable/imports/test11039b.d
new file mode 100644
index 00000000000..7a56f8a2b53
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test11039b.d
@@ -0,0 +1,7 @@
+
+module imports.test11039b;
+
+import test11039;
+
+static anotherGlobalField = SomeStruct!string("Hello Again!");
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test11745b.d b/gcc/testsuite/gdc.test/runnable/imports/test11745b.d
new file mode 100644
index 00000000000..c4e95e2c70d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test11745b.d
@@ -0,0 +1,17 @@
+module imports.test11745b;
+
+unittest 
+{
+		
+}
+
+private unittest 
+{
+	
+}
+
+private:
+unittest 
+{
+	
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test11931a.d b/gcc/testsuite/gdc.test/runnable/imports/test11931a.d
new file mode 100644
index 00000000000..152b38a67cd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test11931a.d
@@ -0,0 +1,14 @@
+module imports.test11931a;
+
+import std.stdio;
+
+import imports.test11931d;
+import imports.test11931b;
+
+final class Engine
+{
+package:
+    mixin GUIManager;
+public:
+    Signal!void onLeftUp;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test11931b.d b/gcc/testsuite/gdc.test/runnable/imports/test11931b.d
new file mode 100644
index 00000000000..2838278189c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test11931b.d
@@ -0,0 +1,21 @@
+module imports.test11931b;
+
+import imports.test11931c;
+import imports.test11931d;
+
+class GUIElement
+{
+public:
+    Signal!void onSubmit;
+}
+
+mixin template GUIManager()
+{
+public:
+    void foo()
+    {
+        onLeftUp.add(&guiUp);
+    }
+
+    void guiUp() {}
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test11931c.d b/gcc/testsuite/gdc.test/runnable/imports/test11931c.d
new file mode 100644
index 00000000000..bc6b8a7f8bd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test11931c.d
@@ -0,0 +1,3 @@
+module imports.test11931c;
+
+import imports.test11931a;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test11931d.d b/gcc/testsuite/gdc.test/runnable/imports/test11931d.d
new file mode 100644
index 00000000000..7a3ed39ed68
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test11931d.d
@@ -0,0 +1,30 @@
+module imports.test11931d;
+
+import std.array;
+import std.algorithm;
+
+struct ConnectionPoint
+{
+    void disconnect()
+    {
+        if(_f)
+        {
+            _f();
+            _f = null;
+        }
+    }
+    private void delegate() _f;
+}
+
+struct Signal(T, A...)
+{
+    ConnectionPoint add(D f)
+    {
+        auto rf = { _arr = _arr.filter!(a => a != f).array; };
+        return ConnectionPoint();
+    }
+
+private:
+    alias D = T delegate(A);
+    D _arr[];
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test13a.d b/gcc/testsuite/gdc.test/runnable/imports/test13a.d
new file mode 100644
index 00000000000..4b00277fba9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test13a.d
@@ -0,0 +1,55 @@
+module imports.test13a;
+
+extern(C) int printf(const char*, ...);
+
+public alias bool boolean;
+public alias int Order;
+public const Order LESS_THAN    = -1;
+public const Order EQUALS_TO    = 0;
+public const Order GREATER_THAN = +1;
+template Ordinal(T) {
+    public T min(T left, T right) {
+        return left < right ? left: right;
+    }
+    public T max(T left, T right) {
+        return left > right ? left: right;
+    }
+    public T clamp(T item, T lower, T upper)
+    in {
+        assert(lower <= upper);
+    } body {
+        return max(min(item, upper), lower);
+    }
+}
+template TPair(T, U) {
+    public class Pair {
+        private T _left;
+        private U _right;
+        public this(T left, U right) {
+            this._left = left;
+            this._right = right;
+        }
+        public T left() {
+            return this._left;
+        }
+        public U right() {
+            return this._right;
+        }
+        override public boolean opEquals(Object obj) {
+            Pair other = cast(Pair) obj;
+            if (other !is null) {
+                return (left() == other.left()) && (right() == other.right());
+            } else {
+                return false;
+            }
+        }
+    }
+}
+unittest {
+    alias TPair!(char, char) charPair;
+    charPair.Pair pairA = new charPair.Pair('a', 'b');
+    charPair.Pair pairB = new charPair.Pair('a', 'b');
+    assert(pairA == pairB);
+    printf("Pair tests passed!\r\n");
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test14901a.d b/gcc/testsuite/gdc.test/runnable/imports/test14901a.d
new file mode 100644
index 00000000000..29ac9dc8eac
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test14901a.d
@@ -0,0 +1,21 @@
+module imports.test14901a;
+
+//extern(C) int printf(const char*, ...);
+
+extern extern(C) __gshared static int initCount;
+
+int make(string s)()
+{
+    __gshared static int value;
+
+    struct WithCtor
+    {
+        shared static this()
+        {
+            //printf("%s\n", s.ptr);
+            initCount++;
+        }
+    }
+
+    return value;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test14901b.d b/gcc/testsuite/gdc.test/runnable/imports/test14901b.d
new file mode 100644
index 00000000000..995f5e6a05c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test14901b.d
@@ -0,0 +1,13 @@
+module imports.test14901b;
+
+import imports.test14901a;
+
+alias bar = make!"bar";
+
+struct User(int id)
+{
+    int foo()
+    {
+        return bar;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test14901c.d b/gcc/testsuite/gdc.test/runnable/imports/test14901c.d
new file mode 100644
index 00000000000..db36fc77f6f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test14901c.d
@@ -0,0 +1,10 @@
+module imports.test14901c;
+
+import imports.test14901b;
+
+shared static this() {}
+
+void caller1()
+{
+    User!1 u;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test14901d.d b/gcc/testsuite/gdc.test/runnable/imports/test14901d.d
new file mode 100644
index 00000000000..541de9d9b6f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test14901d.d
@@ -0,0 +1,8 @@
+module imports.test14901d;
+
+import imports.test14901b;
+
+void caller2()
+{
+    User!2 u;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test21a.d b/gcc/testsuite/gdc.test/runnable/imports/test21a.d
new file mode 100644
index 00000000000..7f40a5f5bfc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test21a.d
@@ -0,0 +1,21 @@
+module imports.test21a;
+
+struct TC(T)
+{
+ void method()
+ {
+     void inline_function()
+     {
+     }
+ }
+}
+
+template TB(T)
+{
+ alias TC!(T) tc_instance;
+}
+
+struct TA(T)
+{
+ mixin TB!(T);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test24a.d b/gcc/testsuite/gdc.test/runnable/imports/test24a.d
new file mode 100644
index 00000000000..e606f1c517c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test24a.d
@@ -0,0 +1,3 @@
+module imports.test24a;
+
+public import std.string;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test24b.d b/gcc/testsuite/gdc.test/runnable/imports/test24b.d
new file mode 100644
index 00000000000..dcb380f0323
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test24b.d
@@ -0,0 +1,3 @@
+module imports.test24b;
+
+public import std.string;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test27a.d b/gcc/testsuite/gdc.test/runnable/imports/test27a.d
new file mode 100644
index 00000000000..75c945d0798
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test27a.d
@@ -0,0 +1,11 @@
+module imports.test27a;
+
+import std.variant;
+
+class myClass(T) {
+public:
+    void func(T v) {
+        Variant b = Variant(v);
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test29a.d b/gcc/testsuite/gdc.test/runnable/imports/test29a.d
new file mode 100644
index 00000000000..fe3ab97c5b2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test29a.d
@@ -0,0 +1,6 @@
+module imports.test29a;
+
+private import imports.test29b;
+
+deprecated alias imports.test29b.qwert qwert;
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test29b.d b/gcc/testsuite/gdc.test/runnable/imports/test29b.d
new file mode 100644
index 00000000000..462d7787bad
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test29b.d
@@ -0,0 +1,3 @@
+module imports.test29b;
+
+const int qwert = 42;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test31a.d b/gcc/testsuite/gdc.test/runnable/imports/test31a.d
new file mode 100644
index 00000000000..3d882803ed7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test31a.d
@@ -0,0 +1,6 @@
+module imports.test31a;
+
+template Baz() {
+    private void privfunc(){ }
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test32a.d b/gcc/testsuite/gdc.test/runnable/imports/test32a.d
new file mode 100644
index 00000000000..4d3ef36c97e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test32a.d
@@ -0,0 +1,10 @@
+module imports.test32a;
+
+struct S{
+  int i;
+}
+
+int f(){
+  return S.sizeof; // OK
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test35a.d b/gcc/testsuite/gdc.test/runnable/imports/test35a.d
new file mode 100644
index 00000000000..b0119340761
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test35a.d
@@ -0,0 +1,39 @@
+module imports.test35a;
+
+template ElemTypeOf( T )
+{
+    alias typeof(T.init[0]) ElemTypeOf;
+}
+
+template removeIf_( Elem, Pred )
+{
+    size_t fn( Elem[] buf, Pred pred )
+    {
+	void exch( size_t p1, size_t p2 )
+	{
+	    Elem t  = buf[p1];
+	    buf[p1] = buf[p2];
+	    buf[p2] = t;
+	}
+
+	size_t cnt = 0;
+
+	for( size_t pos = 0, len = buf.length; pos < len; ++pos )
+	{
+	    if( pred( buf[pos] ) )
+		++cnt;
+	    else
+		exch( pos, pos - cnt );
+	}
+	return buf.length - cnt;
+    }
+}
+
+template removeIf( Buf, Pred )
+{
+    size_t removeIf( Buf buf, Pred pred )
+    {
+	return removeIf_!(ElemTypeOf!(Buf), Pred).fn( buf, pred );
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test38a.d b/gcc/testsuite/gdc.test/runnable/imports/test38a.d
new file mode 100644
index 00000000000..6ea46a17d9d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test38a.d
@@ -0,0 +1,6 @@
+module imports.test38a;
+
+int bar(int i)
+{
+    return i * i;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test39a.d b/gcc/testsuite/gdc.test/runnable/imports/test39a.d
new file mode 100644
index 00000000000..84a1530c214
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test39a.d
@@ -0,0 +1,13 @@
+module imports.test39a;
+
+extern (C) int printf (const char*, ...);
+
+class Test (T)
+{
+        final void show (in T[] msg)
+        {
+                printf ("%.*s\n", msg.length, msg.ptr);
+        }
+}
+
+Test!(char) Global;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test3a.d b/gcc/testsuite/gdc.test/runnable/imports/test3a.d
new file mode 100644
index 00000000000..7a00c58df68
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test3a.d
@@ -0,0 +1,13 @@
+module imports.test3a;
+
+import imports.test3b;
+
+extern(C) int printf(const char*, ...);
+
+class Afoo
+{
+    static this()
+    {
+	printf("Afoo()\n");
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test3b.d b/gcc/testsuite/gdc.test/runnable/imports/test3b.d
new file mode 100644
index 00000000000..0205d0059d5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test3b.d
@@ -0,0 +1,7 @@
+module imports.test3b;
+
+import imports.test3a;
+
+class Bfoo
+{
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test40a.d b/gcc/testsuite/gdc.test/runnable/imports/test40a.d
new file mode 100644
index 00000000000..b688b9f3161
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test40a.d
@@ -0,0 +1,41 @@
+module imports.test40a;
+
+import std.stdio;
+
+template Mix()
+{
+    static void foobar()
+    {
+	auto context = new Context;
+        auto ts = context.toString;
+	printf("context: %.*s %p\n", ts.length, ts.ptr, context);
+	context.func!(typeof(this))();
+	printf("returning from opCall\n");
+    }
+}
+
+
+class Bar
+{
+    mixin Mix;
+}
+
+
+void someFunc(string z)
+{
+    printf("str length: %d\n", z.length);
+    printf("str: '%.*s'\n", z.length, z.ptr);
+}
+
+
+class Context
+{
+    void func(T)()
+    {
+	printf("<context.func\n");
+	printf("thisptr: %p\n", this);
+	someFunc(`a`);
+	printf("context.func>\n");
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test41a.d b/gcc/testsuite/gdc.test/runnable/imports/test41a.d
new file mode 100644
index 00000000000..20750c913c0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test41a.d
@@ -0,0 +1,12 @@
+module imports.test41a;
+
+void foo()
+{
+        assert(false, "GO");
+}
+
+public void func(T)()
+{
+        assert(false, "Blah");
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test44a.d b/gcc/testsuite/gdc.test/runnable/imports/test44a.d
new file mode 100644
index 00000000000..eefa7a5f9e2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test44a.d
@@ -0,0 +1,5 @@
+module imports.test44a;
+
+import test44;
+
+enum DAY { SUN, MON, TUE, WED, THU, FRI, SAT }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test45a.d b/gcc/testsuite/gdc.test/runnable/imports/test45a.d
new file mode 100644
index 00000000000..df3b8525597
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test45a.d
@@ -0,0 +1,17 @@
+module imports.test45a;
+
+import std.stdio;
+
+int foo()
+{
+    printf("foo()\n");
+    return 1;
+}
+
+
+int bar(T)(T t)
+{
+    printf("bar(t)\n");
+    return 3;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test45b.d b/gcc/testsuite/gdc.test/runnable/imports/test45b.d
new file mode 100644
index 00000000000..371a162b114
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test45b.d
@@ -0,0 +1,16 @@
+module imports.test45b;
+
+import std.stdio;
+
+int foo(int i)
+{
+    printf("foo(int)\n");
+    return 2;
+}
+
+int bar(T)(T t, int i)
+{
+    printf("bar(t,i)\n");
+    return 4;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test46a.d b/gcc/testsuite/gdc.test/runnable/imports/test46a.d
new file mode 100644
index 00000000000..913a08553ee
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test46a.d
@@ -0,0 +1,15 @@
+module imports.test46a;
+
+private import imports.test46c;
+
+interface I
+{
+    void anything();
+}
+
+class A : I
+{
+    private C!(char) c;
+    this() { c = new C!(char) (); }
+    void anything() {}
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test46b.d b/gcc/testsuite/gdc.test/runnable/imports/test46b.d
new file mode 100644
index 00000000000..e73122a6270
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test46b.d
@@ -0,0 +1,10 @@
+module imports.test46b;
+
+private import imports.test46c;
+
+class B
+{
+    private C!(char) c;
+    this() { c = new C!(char); }
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test46c.d b/gcc/testsuite/gdc.test/runnable/imports/test46c.d
new file mode 100644
index 00000000000..c0f3e9f8efa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test46c.d
@@ -0,0 +1,7 @@
+module imports.test46c;
+
+class C(T)
+{
+    void foo() { }
+} 
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test48a.d b/gcc/testsuite/gdc.test/runnable/imports/test48a.d
new file mode 100644
index 00000000000..77e151f33a6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test48a.d
@@ -0,0 +1,9 @@
+module imports.test48a;
+
+struct S
+{
+    int a = 1;
+    int b = 2;
+  private:
+    int c = 3;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test49a.d b/gcc/testsuite/gdc.test/runnable/imports/test49a.d
new file mode 100644
index 00000000000..57baf4be00a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test49a.d
@@ -0,0 +1,28 @@
+module imports.test49a;
+
+import std.stdio;
+
+int x;
+
+template Foo(T)
+{
+   static this()
+   {
+	printf("static this()\n");
+	assert(x == 0);
+	x++;
+   }
+
+   static ~this()
+   {
+	printf("static ~this()\n");
+	assert(x == 1);
+	x--;
+   }
+}
+
+void baz()
+{
+    alias Foo!(int) bar;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test57a.d b/gcc/testsuite/gdc.test/runnable/imports/test57a.d
new file mode 100644
index 00000000000..8da955f5f17
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test57a.d
@@ -0,0 +1,10 @@
+module imports.test57a;
+import imports.test57b;
+
+// works - even fixes the error from below!
+// C!(int) x;
+
+// doesn't work
+void foo() { C!(int) x; }
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test57b.d b/gcc/testsuite/gdc.test/runnable/imports/test57b.d
new file mode 100644
index 00000000000..e667de5bc04
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test57b.d
@@ -0,0 +1,3 @@
+module imports.test57b;
+class C(T) { struct X {} }
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test58a.d b/gcc/testsuite/gdc.test/runnable/imports/test58a.d
new file mode 100644
index 00000000000..1f3c6d45e16
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test58a.d
@@ -0,0 +1,7 @@
+module imports.test58a;
+
+void foo(T)() {
+   long[] a;
+   a[] = -a[];
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test61a.d b/gcc/testsuite/gdc.test/runnable/imports/test61a.d
new file mode 100644
index 00000000000..65d7e4d2eb5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test61a.d
@@ -0,0 +1,6 @@
+module imports.test61a;
+
+int bar()
+{
+    return 12;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test7494a.d b/gcc/testsuite/gdc.test/runnable/imports/test7494a.d
new file mode 100644
index 00000000000..36b7bf3f2a4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test7494a.d
@@ -0,0 +1,13 @@
+module imports.test7494a;
+
+template map(alias fun)
+{
+    auto map(R)(R range) { return [4,5,6]; }
+}
+
+auto writeln(A...)(A args)
+{
+    return [7,8,9];
+}
+
+auto foo() {}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test8997a.d b/gcc/testsuite/gdc.test/runnable/imports/test8997a.d
new file mode 100644
index 00000000000..90ec12e0766
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test8997a.d
@@ -0,0 +1,6 @@
+module imports.test8997a;
+
+class A
+{
+    A[string] foobar;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/test9271a.d b/gcc/testsuite/gdc.test/runnable/imports/test9271a.d
new file mode 100644
index 00000000000..eff302c4805
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/test9271a.d
@@ -0,0 +1,6 @@
+module imports.test9271a;
+
+bool any(alias pred, Range)(Range range)
+{
+    return true;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/testkwd_file.d b/gcc/testsuite/gdc.test/runnable/imports/testkwd_file.d
new file mode 100644
index 00000000000..24b9f1af141
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/testkwd_file.d
@@ -0,0 +1,37 @@
+module imports.testkwd;
+
+/****************************************/
+
+version(Windows) enum sep = "\\";  else enum sep = "/";
+
+enum thatFile = "runnable"~sep~"imports"~sep~"testkwd_file.d";
+enum thatMod  = "imports.testkwd";
+//enum thatLine;
+enum thatFunc  = "imports.testkwd.getCalleeFunc";
+enum thatFunc2 = `string imports.testkwd.getCalleeFunc2(int x = 1, string s = "hello")`;
+
+string getCalleeFile() { return __FILE__; }
+ulong  getCalleeLine() { return __LINE__; }         enum thatLine = 14;
+string getCalleeMod()  { return __MODULE__; }
+string getCalleeFunc() { return __FUNCTION__; }
+string getCalleeFunc2(int x = 1, string s = "hello") { return __PRETTY_FUNCTION__; }
+
+/****************************************/
+
+string getFuncArgFile (string name = __FILE__           ) { return name; }
+ulong  getFuncArgLine (ulong  lnum = __LINE__           ) { return lnum; }
+string getFuncArgMod  (string name = __MODULE__         ) { return name; }
+string getFuncArgFunc (string name = __FUNCTION__       ) { return name; }
+string getFuncArgFunc2(string name = __PRETTY_FUNCTION__) { return name; }
+
+string getFuncTiargFile (string name = __FILE__           )() { return name; }
+ulong  getFuncTiargLine (ulong  lnum = __LINE__           )() { return lnum; }
+string getFuncTiargMod  (string name = __MODULE__         )() { return name; }
+string getFuncTiargFunc (string name = __FUNCTION__       )() { return name; }
+string getFuncTiargFunc2(string name = __PRETTY_FUNCTION__)() { return name; }
+
+template getInstTiargFile (string name = __FILE__           ) { enum getInstTiargFile  = name; }
+template getInstTiargLine (ulong  lnum = __LINE__           ) { enum getInstTiargLine  = lnum; }
+template getInstTiargMod  (string name = __MODULE__         ) { enum getInstTiargMod   = name; }
+template getInstTiargFunc (string name = __FUNCTION__       ) { enum getInstTiargFunc  = name; }
+template getInstTiargFunc2(string name = __PRETTY_FUNCTION__) { enum getInstTiargFunc2 = name; }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/testminitAA.d b/gcc/testsuite/gdc.test/runnable/imports/testminitAA.d
new file mode 100644
index 00000000000..0d5ddd85c72
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/testminitAA.d
@@ -0,0 +1,11 @@
+module imports.testminitAA;
+
+import core.stdc.stdio;
+int aa;
+
+static this()
+{
+    printf("AA\n");
+    aa = 1;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/testminitBB.d b/gcc/testsuite/gdc.test/runnable/imports/testminitBB.d
new file mode 100644
index 00000000000..72a750c722d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/testminitBB.d
@@ -0,0 +1,11 @@
+module imports.testminitBB;
+
+import core.stdc.stdio;
+int bb;
+
+static this()
+{
+    printf("BB\n");
+    bb = 1;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/testmod1a.d b/gcc/testsuite/gdc.test/runnable/imports/testmod1a.d
new file mode 100644
index 00000000000..2b5819fef6c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/testmod1a.d
@@ -0,0 +1,7 @@
+module imports.testmod1a;
+
+import testmod1;
+
+void bar2() {
+  Foo!(int) w;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/testmod1b.d b/gcc/testsuite/gdc.test/runnable/imports/testmod1b.d
new file mode 100644
index 00000000000..bedcbc6da25
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/testmod1b.d
@@ -0,0 +1,8 @@
+module imports.testmod1b;
+
+import testmod1;
+
+void bar3() {
+  Foo!(int) w;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/testmod2a.d b/gcc/testsuite/gdc.test/runnable/imports/testmod2a.d
new file mode 100644
index 00000000000..a59d12cf16d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/testmod2a.d
@@ -0,0 +1,11 @@
+module imports.testmod2a;
+
+/**********************************/
+// bug 1904
+
+// testmod.d
+private void bar(alias a)() {}
+
+void foo(alias a)() {
+    .bar!(a)();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/tlsa.d b/gcc/testsuite/gdc.test/runnable/imports/tlsa.d
new file mode 100644
index 00000000000..b9957d9da40
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/tlsa.d
@@ -0,0 +1,35 @@
+module imports.tlsa;
+
+import core.stdc.stdio;
+
+int foo()()
+{
+    static int z = 7;
+    return ++z;
+}
+
+/*************************************/
+
+
+int abc4(T)(T t)
+{
+    static T qqq;		// TLS comdef
+    static       T rrr;	// comdef
+    static T sss = 8;	// TLS comdat
+    static       T ttt = 9;	// comdat
+    printf("qqq = %d, rrr = %d, sss = %d, ttt = %d\n", qqq, rrr, sss, ttt);
+    qqq += 2;
+    rrr += 3;
+    sss += 4;
+    ttt += 5;
+    return t + qqq + rrr + sss + ttt;
+}
+
+int bar4()
+{
+    return abc4(4);
+}
+
+/*************************************/
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/imports/traits_getUnitTests_import.d b/gcc/testsuite/gdc.test/runnable/imports/traits_getUnitTests_import.d
new file mode 100644
index 00000000000..eeb974b824c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/traits_getUnitTests_import.d
@@ -0,0 +1,6 @@
+module imports.traits_getUnitTests_import;
+
+unittest
+{
+    assert(1);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ufcs5a.d b/gcc/testsuite/gdc.test/runnable/imports/ufcs5a.d
new file mode 100644
index 00000000000..9ca2e34b7db
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ufcs5a.d
@@ -0,0 +1,13 @@
+module imports.ufcs5a;
+
+auto f5a1(int)    { return 1; }
+auto f5a2(string) { return 2; }
+auto f5a3(double) { return 3; }
+alias f5a4 = f5a1, f5a4 = f5a2;
+alias f5a5 = f5a3, f5a5 = f5a4;
+
+@property p5a1(int)    { return 1; }    @property p5a1(int,    int) { return 1; }
+@property p5a2(string) { return 2; }    @property p5a2(string, int) { return 2; }
+@property p5a3(double) { return 3; }    @property p5a3(double, int) { return 3; }
+alias p5a4 = p5a1, p5a4 = p5a2;         alias p5a4 = p5a1, p5a4 = p5a2;
+alias p5a5 = p5a3, p5a5 = p5a4;         alias p5a5 = p5a3, p5a5 = p5a4;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ufcs5b.d b/gcc/testsuite/gdc.test/runnable/imports/ufcs5b.d
new file mode 100644
index 00000000000..4b360b62c03
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ufcs5b.d
@@ -0,0 +1,19 @@
+module imports.ufcs5b;
+
+auto f5b1(int)    { return 1; }
+auto f5b2(string) { return 2; }
+auto f5b3(double) { return 3; }
+alias f5b4 = f5b1, f5b4 = f5b2;
+alias f5b5 = f5b3, f5b5 = f5b4;
+
+@property p5b1(int)    { return 1; }    @property p5b1(int,    int) { return 1; }
+@property p5b2(string) { return 2; }    @property p5b2(string, int) { return 2; }
+@property p5b3(double) { return 3; }    @property p5b3(double, int) { return 3; }
+alias p5b4 = p5b1, p5b4 = p5b2;         alias p5b4 = p5b1, p5b4 = p5b2;
+alias p5b5 = p5b3, p5b5 = p5b4;         alias p5b5 = p5b3, p5b5 = p5b4;
+
+/***************************************/
+
+auto      f5ov(int)      { return 1; }
+@property p5ov(int)      { return 1; }
+@property p5ov(int, int) { return 1; }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ufcs5c.d b/gcc/testsuite/gdc.test/runnable/imports/ufcs5c.d
new file mode 100644
index 00000000000..f7a37f8a8c4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ufcs5c.d
@@ -0,0 +1,19 @@
+module imports.ufcs5c;
+
+auto f5c1(int)    { return 1; }
+auto f5c2(string) { return 2; }
+auto f5c3(double) { return 3; }
+alias f5c4 = f5c1, f5c4 = f5c2;
+alias f5c5 = f5c3, f5c5 = f5c4;
+
+@property p5c1(int)    { return 1; }    @property p5c1(int,    int) { return 1; }
+@property p5c2(string) { return 2; }    @property p5c2(string, int) { return 2; }
+@property p5c3(double) { return 3; }    @property p5c3(double, int) { return 3; }
+alias p5c4 = p5c1, p5c4 = p5c2;         alias p5c4 = p5c1, p5c4 = p5c2;
+alias p5c5 = p5c3, p5c5 = p5c4;         alias p5c5 = p5c3, p5c5 = p5c4;
+
+/***************************************/
+
+auto      f5ov(string)      { return 2; }
+@property p5ov(string)      { return 2; }
+@property p5ov(string, int) { return 2; }
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ufcs5d.d b/gcc/testsuite/gdc.test/runnable/imports/ufcs5d.d
new file mode 100644
index 00000000000..2eef35b4759
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ufcs5d.d
@@ -0,0 +1,13 @@
+module imports.ufcs5d;
+
+auto f5d1(int)    { return 1; }
+auto f5d2(string) { return 2; }
+auto f5d3(double) { return 3; }
+alias f5d4 = f5d1, f5d4 = f5d2;
+alias f5d5 = f5d3, f5d5 = f5d4;
+
+@property p5d1(int)    { return 1; }    @property p5d1(int,    int) { return 1; }
+@property p5d2(string) { return 2; }    @property p5d2(string, int) { return 2; }
+@property p5d3(double) { return 3; }    @property p5d3(double, int) { return 3; }
+alias p5d4 = p5d1, p5d4 = p5d2;         alias p5d4 = p5d1, p5d4 = p5d2;
+alias p5d5 = p5d3, p5d5 = p5d4;         alias p5d5 = p5d3, p5d5 = p5d4;
diff --git a/gcc/testsuite/gdc.test/runnable/imports/ufcs5e.d b/gcc/testsuite/gdc.test/runnable/imports/ufcs5e.d
new file mode 100644
index 00000000000..7a0b11fcfc3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/ufcs5e.d
@@ -0,0 +1,13 @@
+module imports.ufcs5e;
+
+auto f5e1(int)    { return 1; }
+auto f5e2(string) { return 2; }
+auto f5e3(double) { return 3; }
+alias f5e4 = f5e1, f5e4 = f5e2;
+alias f5e5 = f5e3, f5e5 = f5e4;
+
+@property p5e1(int)    { return 1; }    @property p5e1(int,    int) { return 1; }
+@property p5e2(string) { return 2; }    @property p5e2(string, int) { return 2; }
+@property p5e3(double) { return 3; }    @property p5e3(double, int) { return 3; }
+alias p5e4 = p5e1, p5e4 = p5e2;         alias p5e4 = p5e1, p5e4 = p5e2;
+alias p5e5 = p5e3, p5e5 = p5e4;         alias p5e5 = p5e3, p5e5 = p5e4;
diff --git a/gcc/testsuite/gdc.test/runnable/inline.d b/gcc/testsuite/gdc.test/runnable/inline.d
new file mode 100644
index 00000000000..b70d7e77e0c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/inline.d
@@ -0,0 +1,1006 @@
+
+import std.stdio;
+
+// Test function inlining
+
+debug = NRVO;
+
+/************************************/
+
+int foo(int i)
+{
+    return i;
+}
+
+int bar()
+{
+    return foo(3) + 4;
+}
+
+void test1()
+{
+    printf("%d\n", bar());
+    assert(bar() == 7);
+}
+
+
+/************************************/
+
+struct Foo2
+{
+    int a,b,c,e,f,g;
+}
+
+
+int foo2(Foo2 f)
+{
+    f.b += 73;
+    return f.b;
+}
+
+int bar2()
+{
+    Foo2 gg;
+
+    gg.b = 6;
+    return foo2(gg) + 4;
+}
+
+void test2()
+{
+    printf("%d\n", bar2());
+    assert(bar2() == 83);
+}
+
+
+/************************************/
+
+struct Foo3
+{
+    int bar() { return y + 3; }
+    int y = 4;
+}
+
+void test3()
+{
+    Foo3 f;
+
+    assert(f.bar() == 7);
+}
+
+
+/************************************/
+
+void func(void function () v)
+{
+}
+
+void test4()
+{
+   static void f1() { }
+
+   func(&f1);
+   //func(f1);
+}
+
+
+/************************************/
+
+void foo5(ubyte[16] array)
+{
+    bar5(array.ptr);
+}
+
+void bar5(ubyte *array)
+{
+}
+
+void abc5(ubyte[16] array)
+{
+    foo5(array);
+}
+
+void test5()
+{
+}
+
+/************************************/
+
+struct Struct
+{
+    real foo()
+    {
+        return 0;
+    }
+
+    void bar(out Struct Q)
+    {
+        if (foo() < 0)
+            Q = this;
+    }
+}
+
+void test6()
+{
+}
+
+/************************************/
+
+struct S7(T)
+{
+    immutable(T)[] s;
+}
+
+T foo7(T)(T t)
+{
+    enum S7!(T)[] i = [{"hello"},{"world"}];
+    auto x = i[0].s;
+    return t;
+}
+
+void test7()
+{
+    auto x = foo7('c');
+}
+
+/************************************/
+
+// 10833
+string fun10833(T...)()
+{
+    foreach (v ; T)
+        return v;
+    assert(0);
+}
+
+void test10833()
+{
+    auto a = fun10833!("bar")();
+}
+
+/************************************/
+// Bugzilla 4825
+
+int a8() {
+    int r;
+    return r;
+}
+
+int b8() {
+    return a8();
+}
+
+void test8() {
+    void d() {
+        auto e = b8();
+    }
+    static const int f = b8();
+}
+
+/************************************/
+// 4841
+
+auto fun4841a()
+{
+    int i = 42;
+    struct Result
+    {
+        this(int u) {}
+        auto bar()
+        {
+            // refer context of fun4841a
+            return i;
+        }
+    }
+    return Result();
+}
+void test4841a()
+{
+    auto t = fun4841a();
+    auto x = t.bar();
+    assert(x == 42);
+}
+
+auto fun4841b()
+{
+    int i = 40;
+    auto foo()  // hasNestedFrameRefs() == false
+    {
+        //
+        struct Result
+        {
+            this(int u) {}
+            auto bar()
+            {
+                // refer context of fun4841b
+                return i + 2;
+            }
+        }
+        return Result();
+    }
+    return foo();
+}
+void test4841b()
+{
+    auto t = fun4841b();
+    assert(cast(void*)t.tupleof[$-1] !is null);     // Result to fun4841b
+    auto x = t.bar();
+    assert(x == 42);
+}
+
+auto fun4841c()
+{
+    int i = 40;
+    auto foo()  // hasNestedFrameRefs() == true
+    {
+        int g = 2;
+        struct Result
+        {
+            this(int u) {}
+            auto bar()
+            {
+                // refer context of fun4841c and foo
+                return i + g;
+            }
+        }
+        return Result();
+    }
+    return foo();
+}
+void test4841c()
+{
+    auto t = fun4841c();
+    assert(  cast(void*)t.tupleof[$-1] !is null);   // Result to foo
+    assert(*cast(void**)t.tupleof[$-1] !is null);   // foo to fun4841c
+    auto x = t.bar();
+    assert(x == 42);
+}
+
+void test4841()
+{
+    test4841a();
+    test4841b();
+    test4841c();
+}
+
+/************************************/
+// 7261
+
+struct AbstractTask
+{
+    ubyte taskStatus;
+}
+
+struct Task
+{
+    AbstractTask base;
+    alias base this;
+
+    void opAssign(Task rhs)
+    {
+    }
+
+    ~this()
+    {
+        if (taskStatus != 3) { }
+    }
+}
+
+/************************************/
+// 9356
+
+void test9356()
+{
+    static inout(char)[] bar (inout(char)[] a)
+    {
+        return a;
+    }
+
+    string result;
+    result ~= bar("abc");
+    assert(result == "abc");
+}
+
+/************************************/
+// 12079
+
+void test12079()
+{
+    string[string][string] foo;
+
+    foo.get("bar", null).get("baz", null);
+}
+
+/************************************/
+// 12243
+
+char f12243() { return 'a'; }
+
+void test12243()
+{
+    string s;
+    s ~= f12243();
+}
+
+/************************************/
+// 11201
+
+struct Foo11201
+{
+    int a;
+    float b;
+
+    Foo11201 func()() const { return this; }
+}
+
+auto f11201()(Foo11201 a) { return a; }
+
+void test11201()
+{
+    auto a = Foo11201(0, 1);
+
+    assert(f11201(a.func!()()) == a);
+}
+
+/************************************/
+// 11223
+
+struct Tuple11223(T...)
+{
+    T values;
+
+    void opAssign(Tuple11223 rhs)
+    {
+        if (0)
+            values = rhs.values;
+        else
+            assert(1);
+    }
+}
+
+void test11223()
+{
+    Tuple11223!string tmp;
+    tmp = Tuple11223!string();
+}
+
+/************************************/
+
+
+void foo3918()
+{
+    import core.stdc.stdlib : alloca;
+    void[] mem = alloca(1024)[0..1024];
+}
+
+void test3918()
+{
+    foreach(i; 0 .. 10_000_000)
+    {
+        foo3918();
+    }
+}
+
+/************************************/
+// 11314
+
+struct Tuple11314(T...)
+{
+    T values;
+
+    void opAssign(typeof(this) rhs)
+    {
+        if (0)
+            values[] = rhs.values[];
+        else
+            assert(1);
+    }
+}
+
+struct S11314 {}
+
+void test11314()
+{
+    Tuple11314!S11314 t;
+    t = Tuple11314!S11314(S11314.init);
+}
+
+/************************************/
+// 11224
+
+S11224* ptr11224;
+
+struct S11224
+{
+    this(int)
+    {
+        ptr11224 = &this;
+        /*printf("ctor &this = %p\n", &this);*/
+    }
+    this(this)
+    {
+        /*printf("cpctor &this = %p\n", &this);*/
+    }
+    int num;
+}
+S11224 foo11224()
+{
+    S11224 s = S11224(1);
+    //printf("foo  &this = %p\n", &s);
+    assert(ptr11224 is &s);
+    return s;
+}
+void test11224()
+{
+    auto s = foo11224();
+    //printf("main &this = %p\n", &s);
+    assert(ptr11224 is &s);
+}
+
+/************************************/
+// 11322
+
+bool b11322;
+uint n11322;
+
+ref uint fun11322()
+{
+    if (b11322)
+        return n11322;
+    else
+        return n11322;
+}
+
+void test11322()
+{
+    fun11322()++;
+    assert(n11322 == 1);
+    fun11322() *= 5;
+    assert(n11322 == 5);
+}
+
+/************************************/
+// 11394
+
+debug(NRVO) static void* p11394a, p11394b, p11394c;
+
+static int[5] make11394(in int x) pure
+{
+    typeof(return) a;
+    a[0] = x;
+    a[1] = x + 1;
+    a[2] = x + 2;
+    a[3] = x + 3;
+    a[4] = x + 4;
+    debug(NRVO) p11394a = cast(void*)a.ptr;
+    return a;
+}
+
+struct Bar11394
+{
+    immutable int[5] arr;
+
+    this(int x)
+    {
+        this.arr = make11394(x);    // NRVO should work
+        debug(NRVO) p11394b = cast(void*)this.arr.ptr;
+    }
+}
+
+void test11394()
+{
+    auto b = Bar11394(5);
+    debug(NRVO) p11394c = cast(void*)b.arr.ptr;
+  //debug(NRVO) printf("p1 = %p\np2 = %p\np3 = %p\n", p11394a, p11394b, p11394c);
+    debug(NRVO) assert(p11394a == p11394b);
+    debug(NRVO) assert(p11394b == p11394c);
+}
+
+/**********************************/
+// 12080
+
+class TZ12080 {}
+
+struct ST12080
+{
+    ST12080 opBinary()() const pure nothrow
+    {
+        auto retval = ST12080();
+        return retval;  // NRVO
+    }
+
+    long  _stdTime;
+    immutable TZ12080 _timezone;
+}
+
+class Foo12080
+{
+
+    ST12080 bar;
+    bool quux;
+
+    public ST12080 sysTime()
+    out {}
+    body
+    {
+        if (quux)
+            return ST12080();
+
+        return bar.opBinary();
+        // returned value is set to __result
+        // --> Inliner wrongly created the second DeclarationExp for __result.
+    }
+}
+
+/**********************************/
+// 13503
+
+void f13503a(string[] s...)
+{
+    assert(s[0] == "Cheese");
+}
+
+auto f13503b(string arg)
+{
+    string result = arg;
+    return result;
+}
+
+string f13503c(string arg)
+{
+    string result = arg;
+    return result;
+}
+
+void test13503()
+{
+    f13503a(f13503b("Cheese"));
+    f13503a(f13503c("Cheese"));
+}
+
+/**********************************/
+// 14267
+
+// EXTRA_SOURCES: imports/a14267.d
+import imports.a14267;
+
+void test14267()
+{
+    foreach (m; __traits(allMembers, SysTime14267))
+    {
+        static if (is(typeof(__traits(getMember, SysTime14267, m))))
+        {
+            foreach (func; __traits(getOverloads, SysTime14267, m))
+            {
+                auto prot = __traits(getProtection, func);
+                static if (__traits(isStaticFunction, func))
+                {
+                    static assert(func.stringof == "min()");
+                    auto result = func;
+                }
+            }
+        }
+    }
+}
+
+/**********************************/
+// 14306
+
+struct MapResult(alias fun)
+{
+    void front()
+    {
+//  while (1) { break; }
+        fun(1);
+    }
+}
+
+void bar(R)(R r)
+{
+    foreach (i; 0..100)
+    {
+        r.front();
+    }
+}
+
+struct S
+{
+    int x;
+    int bump()
+    {
+        while (1) { break; }
+        ++x;
+        return x;
+    }
+}
+
+void fun(ref S s)
+{
+    MapResult!(y => s.bump())().bar;
+//  MapResult!((int x) => s.bump())().bar;
+
+    if (s.x != 100)
+        assert(0);
+}
+
+void test14306()
+{
+    S t;
+    fun(t);
+}
+
+/**********************************/
+// 14754
+
+auto aafunc14754(string k)
+{
+    enum aa = [ "K": "V" ];
+    auto p = k in aa;
+    return null;
+}
+
+struct MapResult14754(alias fun, R)
+{
+    R _input;
+
+    @property auto ref front()
+    {
+        return fun(_input[0]);
+    }
+}
+
+auto array14754(R)(R r)
+{
+    alias E = typeof(r.front);
+    E[] result;
+    result ~= r.front;
+    return result;
+}
+
+auto mapfun14754(R)(R words, string k)
+{
+    return array14754(MapResult14754!(s => aafunc14754(k), R)(words));
+}
+
+void test14754()
+{
+    auto r = mapfun14754([""], "");
+}
+
+/**********************************/
+// 14606
+
+struct S14606
+{
+    this(long stdTime)
+    {
+        _stdTime = stdTime;
+    }
+
+    long _stdTime;
+}
+
+S14606 getS14606()
+{
+    S14606 sysTime = S14606(0);
+    return sysTime;
+}
+
+struct T14606
+{
+    this(string)
+    {
+        uint[3] arr;
+        s = getS14606();
+    }
+
+    S14606 s;
+}
+
+void test14606()
+{
+    auto t = T14606(null);
+}
+
+/**********************************/
+// 14753
+
+pragma(inline)
+void test14753(string) { }
+
+/**********************************/
+
+struct S14975 {
+    int bar;
+
+    pragma(inline, true) this(int bar) {
+        this.bar = bar;
+    }
+}
+
+void test14975() {
+    S14975 baz = 1;
+    if (baz.bar != 1)
+       assert(0);
+}
+
+/**********************************/
+// 15210
+
+struct BigInt15210 {}
+
+struct Tuple15210(Types...)
+{
+    Types field;
+
+    void opAssign(R)(R rhs)
+    {
+        field = rhs.field;
+    }
+}
+
+void test15210()
+{
+    alias X = Tuple15210!BigInt15210;
+
+    X[BigInt15210] cache;
+
+    auto x = X();
+
+    cache[BigInt15210()] = x;
+}
+
+/**********************************/
+// 15207
+
+struct Vec15207
+{
+    float x, y, z;
+
+    this(float x_, float y_, float z_)
+    {
+        x = x_;
+        y = y_;
+        z = z_;
+    }
+
+    Vec15207 clone()
+    {
+        // When the variable 'res' is replaced with a STCref temporary,
+        // this line was accidentally changed to reference initialization.
+        Vec15207 res = this;
+
+        return res;
+    }
+}
+
+class C15207
+{
+    Vec15207 a;
+
+    this()
+    {
+        a = Vec15207(1, 2, 3).clone();
+
+        assert(a.x == 1);
+        assert(a.y == 2);
+        assert(a.z == 3);
+        printf("%f %f %f\n", a.x, a.y, a.z);
+    }
+}
+
+void test15207()
+{
+    auto c = new C15207();
+}
+
+/**********************************/
+// 15253
+
+struct MessageType15253
+{
+    MessageType15253[] messageTypes;
+
+    const void toString1(scope void delegate(const(char)[]) sink)
+    {
+        messageTypes[0].toString1(sink);
+    }
+}
+
+struct ProtoPackage15253
+{
+    MessageType15253[] messageTypes;
+
+    const void toString1(scope void delegate(const(char)[]) sink)
+    {
+        messageTypes[0].toString1(sink);
+    }
+}
+
+/**********************************/
+// 15296
+
+static int x15296;
+
+struct S15296
+{
+    // Can be expanded only as statements.
+    pragma(inline, true)
+    void bar(size_t , size_t )
+    {
+        for (size_t w = 0; w < 2; w++) { ++x15296; }
+    }
+
+    pragma(inline, true)
+    void foo(size_t a, size_t b)
+    {
+        bar(a, b);
+    }
+}
+
+pragma(inline, true)
+static void voidCall15296()
+{
+    for (size_t w = 0; w < 3; w++) { ++x15296; }
+}
+
+void test15296()
+{
+    bool cond = true;
+
+    S15296 s;
+
+    // CallExp at the top of ExpStatement
+    x15296 = 0;
+    s.foo(0, 0);
+    assert(x15296 == 2);
+
+    // CondExp at the top of ExpStatement
+    x15296 = 0;
+    (cond ? s.foo(0, 0) : voidCall15296());
+    assert(x15296 == 2);
+    (cond ? voidCall15296() : s.foo(0, 0));
+    assert(x15296 == 2 + 3);
+
+    // CommaExp at the top of ExpStatement
+    x15296 = 0;
+    (s.foo(0, 0), voidCall15296());
+    assert(x15296 == 3 + 2);
+}
+
+// ----
+
+struct File15296
+{
+    struct Impl {}
+    Impl* _p;
+
+    pragma(inline, true)
+    ~this() { _p = null; }
+
+    struct LockingTextWriter
+    {
+        pragma(inline, true)
+        this(ref File15296 f)
+        {
+            assert(f._p, "Attempting to write to closed File");
+        }
+    }
+
+    pragma(inline, true)
+    auto lockingTextWriter() { return LockingTextWriter(this); }
+
+    pragma(inline, true)
+    void write() { auto w = lockingTextWriter(); }
+
+    //pragma(inline, true)
+    static uint formattedWrite(Writer)(Writer w) { return 0; }
+
+    pragma(inline, true)
+    void writef() { formattedWrite(lockingTextWriter()); }
+}
+
+__gshared File15296 stdout15296 = {new File15296.Impl()};
+
+pragma(inline, true)
+@property File15296 trustedStdout15296() { return stdout15296; }
+
+// ----
+// reduced case from runnable/test34.d test34()
+
+void test15296b()
+{
+    // trustedStdout() returns a temporary File object. Its dtor call
+    // should be deferred till the end of expanded writef body statements.
+    trustedStdout15296().writef();
+}
+
+// ----
+// reduced case from runnable/xtest46.d test136()
+
+struct Perm15296c
+{
+    this(byte[] input)
+    {
+        foreach (elem; input)
+        {
+            // if vthis.isDataseg() is true in expandInline,
+            // its edtor should not be called.
+            stdout15296.write();
+        }
+    }
+}
+
+void test15296c()
+{
+    auto perm2 = Perm15296c([0, 1, 2]);
+}
+
+/**********************************/
+// https://issues.dlang.org/show_bug.cgi?id=17676
+__gshared bool bgEnable = 1;
+
+void test17676() nothrow
+{
+    fullcollect();
+}
+
+size_t fullcollect() nothrow
+{
+    if(bgEnable)
+       return fullcollectTrigger();
+
+    return fullcollectNow();
+}
+
+size_t fullcollectNow() nothrow
+{
+    if (bgEnable)
+        assert(0);
+    pragma(inline, false);
+    return 1;
+}
+
+size_t fullcollectTrigger() nothrow
+{
+    pragma(inline, false);
+    return 0;
+}
+
+/**********************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test3918();
+    test4();
+    test5();
+    test9356();
+    test6();
+    test7();
+    test8();
+    test4841();
+    test11201();
+    test11223();
+    test11314();
+    test11224();
+    test11322();
+    test11394();
+    test13503();
+    test14306();
+    test14754();
+    test14606();
+    test14975();
+    test15210();
+    test15207();
+    test15296();
+    test15296b();
+    test15296c();
+
+    test17676();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/inline14560.d b/gcc/testsuite/gdc.test/runnable/inline14560.d
new file mode 100644
index 00000000000..dc0b0f44576
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/inline14560.d
@@ -0,0 +1,17 @@
+// PERMUTE_ARGS: -inline -release -g -O
+
+auto serialize(T)(T value)
+{
+    foreach (i; value) { }
+
+    return;     // important
+    // By this ReturnStatement with NULL exp wrongly appears in the
+    // expanded result of serialize(["test"]) call in main(), it will
+    // return from main() without setting exit code.
+}
+
+int main()
+{
+    serialize(["test"]);
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/inline2.d b/gcc/testsuite/gdc.test/runnable/inline2.d
new file mode 100644
index 00000000000..fc7c43f9afc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/inline2.d
@@ -0,0 +1,21 @@
+// EXTRA_SOURCES: imports/inline2a.d
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -O -release -inline
+
+import imports.inline2a;
+
+class Foo
+{
+        this ()
+        {
+                Primes.lookup(2);       
+        }
+}
+
+
+int main()
+{
+        Primes.lookup(2);
+        return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/inner.d b/gcc/testsuite/gdc.test/runnable/inner.d
new file mode 100644
index 00000000000..592aaca2415
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/inner.d
@@ -0,0 +1,918 @@
+
+import std.stdio;
+
+/*******************************************************/
+
+class Outer
+{
+    int o;
+    static int os = 3;
+
+    static class StaticInner
+    {
+        int si;
+
+        int foo()
+        {
+            return si + os;
+        }
+    }
+
+    class Inner
+    {
+        int i;
+
+        int foo(int m)
+        {
+            return i * o + m;
+        }
+
+        this(int k)
+        {
+            i = k + 7;
+            os = 6;
+        }
+    }
+
+    Inner bar()
+    {
+        return new Inner(17);
+    }
+}
+
+void test1()
+{
+    Outer p = new Outer();
+
+    assert(p.o == 0);
+    assert(p.os == 3);
+    p.o = 9;
+
+    Outer.StaticInner s = new Outer.StaticInner;
+    s.si = 10;
+    assert(s.foo() == 13);
+
+    Outer.Inner q = p.bar();
+    assert(q.i == 24);
+    assert(q.foo(8) == 24*9+8);
+}
+
+/*******************************************************/
+
+class C1
+{
+    int c1;
+
+    this()
+    {
+        c1 = 2;
+    }
+
+    class C2
+    {
+        class C3
+        {
+            int c3;
+
+            this(int n)
+            {
+                c3 = n + c1 + c2;
+            }
+        }
+
+        int c2;
+
+        C3 foo()
+        {
+            return new C3(8);
+        }
+
+        this(int k)
+        {
+            c2 = k + 7;
+        }
+    }
+
+    C2 bar()
+    {
+        return new C2(17);
+    }
+}
+
+void test2()
+{
+   C1 p = new C1();
+   assert(p.c1 == 2);
+
+   C1.C2 q = p.bar();
+   assert(q.c2 == 24);
+
+   C1.C2.C3 r = q.foo();
+   assert(r.c3 == 2+24+8);
+}
+
+/*******************************************************/
+
+class C3
+{
+    int c1;
+
+    this()
+    {
+        c1 = 2;
+    }
+
+    class B { }
+
+    class C2 : B
+    {
+        int c2;
+
+        this(int k)
+        {
+            c2 = c1 + k + 7;
+        }
+    }
+
+    C2 bar()
+    {
+        return new C2(17);
+    }
+}
+
+void test3()
+{
+   C3 q = new C3();
+   assert(q.c1 == 2);
+   C3.C2 p = q.bar();
+   assert(p.c2 == 26);
+}
+
+
+/*******************************************************/
+
+void test4()
+{
+    int m = 3;
+
+    class C
+    {
+        void foo()
+        {
+            assert(m == 3);
+        }
+    }
+
+    void bar()
+    {
+        assert(m == 3);
+    }
+
+    bar();
+    C c = new C;
+    c.foo();
+}
+
+/*******************************************************/
+
+void test5()
+{
+    int m = 3;
+
+    void bar()
+    {
+        assert(m == 3);
+    }
+
+    class C
+    {
+        void foo()
+        {
+            assert(m == 3);
+            bar();
+        }
+    }
+
+    bar();
+    C c = new C;
+    c.foo();
+}
+
+
+/*******************************************************/
+
+void test6()
+{
+    int m = 3;
+
+    void bar()
+    {
+        assert(m == 3);
+    }
+
+    void abc()
+    {
+        class C
+        {
+            void foo()
+            {
+                assert(m == 3);
+                bar();
+            }
+        }
+
+        bar();
+        C c = new C;
+        c.foo();
+    }
+
+    abc();
+}
+
+/*******************************************************/
+
+void test7()
+{
+    int m = 3;
+
+    void bar()
+    {
+        assert(m == 3);
+    }
+
+    void ghi()
+    {
+        void abc()
+        {
+            class C
+            {
+                void foo()
+                {
+                    assert(m == 3);
+                    bar();
+                }
+            }
+
+            bar();
+            C c = new C;
+            c.foo();
+        }
+
+        abc();
+    }
+
+    ghi();
+}
+
+/*******************************************************/
+
+void test8()
+{
+    int m = 3;
+
+    void bar()
+    {
+        assert(m == 3);
+    }
+
+    void ghi()
+    {
+        void abc()
+        {
+            class C
+            {
+                void foo()
+                {
+                    void fooey()
+                    {
+                        assert(m == 3);
+                        bar();
+                    }
+
+                    fooey();
+                }
+            }
+
+            bar();
+            C c = new C;
+            c.foo();
+        }
+
+        abc();
+    }
+
+    ghi();
+}
+
+/*******************************************************/
+
+class C9
+{
+    int m;
+
+    void ccc()
+    {
+        assert(m == 3);
+    }
+
+    this()
+    {
+        m = 3;
+    }
+
+    class D
+    {
+        int n;
+
+        this() { n = 4; }
+
+        void abc()
+        {
+            assert(m == 3);
+            ccc();
+        }
+    }
+
+    D def()
+    {
+        return new D;
+    }
+}
+
+
+void test9()
+{
+    C9 c = new C9;
+    assert(c.m == 3);
+    c.ccc();
+
+    C9.D d = c.def();
+    assert(d.n == 4);
+    d.abc();
+}
+
+/*******************************************************/
+
+void test10()
+{
+    int m = 3;
+
+    class C
+    {
+        void foo()
+        {
+            assert(m == 3);
+        }
+    }
+
+    void abc()
+    {
+        C c = new C;
+        c.foo();
+    }
+
+    abc();
+}
+
+/*******************************************************/
+
+void test11()
+{
+    int m = 3;
+
+    class C
+    {
+        void foo()
+        {
+            assert(m == 3);
+        }
+    }
+
+    void abc()
+    {
+        void def()
+        {
+            C c = new C;
+            c.foo();
+        }
+
+        def();
+    }
+
+    abc();
+}
+
+/*******************************************************/
+
+void test12()
+{
+    int m = 3;
+
+    class C
+    {
+        void foo()
+        {
+            assert(m == 3);
+        }
+
+        void abc()
+        {
+            assert(m == 3);
+            C c = new C;
+            c.foo();
+        }
+    }
+
+    C d = new C;
+    d.abc();
+}
+
+/*******************************************************/
+
+void test13()
+{
+    int m = 3;
+
+    class C
+    {
+        void foo()
+        {
+            assert(m == 3);
+        }
+
+        void abc()
+        {
+            void def()
+            {
+                assert(m == 3);
+                C c = new C;
+                c.foo();
+            }
+
+            def();
+        }
+    }
+
+    C d = new C;
+    d.abc();
+}
+
+/*******************************************************/
+
+class C14
+{
+    void foo()
+    {
+        assert(0);
+    }
+}
+
+void test14()
+{
+    int m = 3;
+
+    C14 c = new class C14
+        {
+            override void foo()
+            {
+                printf("in inner class\n");
+                assert(m == 3);
+            }
+        };
+
+    c.foo();
+}
+
+/*******************************************************/
+
+class C15
+{
+    void foo()
+    {
+        assert(0);
+    }
+}
+
+void test15()
+{
+    int m = 3;
+
+    C15 c = new class(1,2) C15
+        {
+            this(int i, int j)
+            {
+                printf("in inner class ctor\n");
+                assert(i == 1);
+                assert(j == 2);
+            }
+
+            override void foo()
+            {
+                printf("in inner class\n");
+                assert(m == 3);
+            }
+        };
+
+    c.foo();
+}
+
+/*******************************************************/
+
+class C16
+{
+    int w = 3;
+
+    void iterator()
+    {
+        class Foo
+        {
+            void current()
+            {
+                assert(w == 3);
+            }
+        }
+
+        Foo f = new Foo();
+        f.current();
+    }
+}
+
+void test16()
+{
+    C16 s = new C16();
+
+    s.iterator();
+}
+
+/*******************************************************/
+
+class Owner
+{
+
+    this()
+    {
+        n = new Nested(this);
+    }
+
+    class Nested
+    {
+        this(Owner owner)
+        {
+            m = owner;
+        }
+
+        Owner foo()
+        {
+            return m;
+        }
+
+        Owner m;
+    }
+
+    Nested n;
+}
+
+class OwnerDerived : Owner
+{
+}
+
+void test17()
+{
+    OwnerDerived o = new OwnerDerived();
+
+    assert(o.n.foo() is o);
+}
+
+/*******************************************************/
+
+class Foo18
+{
+    class Bar
+    {
+        void doSayHello()
+        {
+            writefln("Betty");
+            sayHello();
+        }
+    }
+    Bar bar;
+
+    void sayHello()
+    {
+        writefln("Hello");
+    }
+}
+
+class Foo182 : Foo18
+{
+    this()
+    {
+        bar = new Bar();
+    }
+}
+
+void test18()
+{
+    Foo182 foo = new Foo182();
+    writefln("This should print Hello:");
+
+    foo.bar.doSayHello();
+}
+
+/*******************************************************/
+
+class Foo19
+{
+    class Bar
+    {
+        void doSayHello()
+        {
+            writefln("Betty");
+            sayHello();
+        }
+    }
+    Bar bar;
+
+    void sayHello()
+    {
+        writefln("Hello");
+    }
+
+    this()
+    {
+        bar = new Bar();
+    }
+}
+
+class Foo192 : Foo19
+{
+}
+
+void test19()
+{
+    Foo192 foo = new Foo192();
+    writefln("This should print Hello:");
+
+    foo.bar.doSayHello();
+}
+
+/*******************************************************/
+
+class Outer20
+{
+    int a;
+
+    class Inner
+    {
+        int foo()
+        {
+            return a;
+        }
+    }
+}
+
+void test20()
+{
+    Outer20 o = new Outer20;
+    o.a = 3;
+    Outer20.Inner oi = o.new Inner;
+    assert(oi.foo() == 3);
+}
+
+/*******************************************************/
+
+class Foo21{}
+
+static if (is(typeof(new class Foo21{}))) {}
+
+void test21()
+{
+}
+
+/*******************************************************/
+
+class Outer22
+{
+    class Inner
+    {
+        Outer22 foo()
+        {
+            return this.outer;
+        }
+    }
+
+    void bar()
+    {
+        Inner i = new Inner;
+        assert(this == i.foo());
+    }
+}
+
+void test22()
+{
+    Outer22 o = new Outer22;
+    o.bar();
+}
+
+/*******************************************************/
+
+class Adapter23
+{
+    void func() { }
+}
+
+class Foo23
+{
+    class AnonAdapter : Adapter23
+    {
+    }
+
+    void bar()
+    {
+        Adapter23 a = cast( Adapter23 )( new AnonAdapter() );
+    }
+}
+
+void test23()
+{
+    Foo23 f = new Foo23();
+    f.bar();
+    Adapter23 a = cast( Adapter23 )( f.new AnonAdapter() );
+    auto aa = f.new AnonAdapter();
+    Adapter23 ab = cast( Adapter23 )(aa);
+
+}
+
+/*******************************************************/
+
+class I24
+{
+    public abstract void callI();
+}
+
+C24 c24;
+
+class C24
+{
+    private int index;
+    void foo()
+    {
+        printf( "ok, this = %p\n", this);
+        assert(this == c24);
+    }
+    I24 bar()
+    {
+        auto i = new class() I24
+        {
+            override public void callI()
+            {
+                foo();
+            }
+        };
+        printf("bar.this = %p\n", this);
+        printf("  i.this = %p\n", (cast(void**)i)[2]);
+        assert(*cast(void**)&c24 == (cast(void**)i)[2]);
+        return i;
+    }
+}
+
+void test24()
+{
+    c24 = new C24;
+    printf("c = %p\n", c24);
+    auto i = c24.bar();
+    i.callI();
+}
+
+/*******************************************************/
+
+struct S7426
+{
+    static struct Inner
+    {
+        int x;
+        alias typeof(Inner.tupleof) T;
+    }
+}
+
+/*******************************************************/
+// 14046
+
+class A14046
+{
+    class NestedA { }
+}
+
+class B14046 : A14046
+{
+    int field;
+
+    class NestedB : NestedA
+    {
+        void foo()
+        {
+            this.outer.field = 1;  // ok <- disallowed
+
+            //(cast(B14046)this.outer).field = 1;  // workaround
+        }
+    }
+}
+
+void test14046()
+{
+    auto b = new B14046();
+    auto nb = b.new NestedB();
+    assert(b.field == 0);
+    nb.foo();
+    assert(b.field == 1);
+}
+
+/*******************************************************/
+// 15839
+
+class AnimatedProgress15839(bool makeClosure)
+{
+    static AnimatedProgress15839 saveThis;
+
+    interface Runnable {}
+
+    static class GC
+    {
+        this(AnimatedProgress15839 ap)
+        {
+            assert(ap is saveThis);
+        }
+    }
+
+    void start()
+    {
+        assert(this is saveThis);
+
+        static if (makeClosure) int a;
+
+        auto r = new class Runnable
+        {
+            void run()
+            {
+                static assert(is(typeof(this.outer) == AnimatedProgress15839));
+                assert(this.outer is saveThis);
+
+                GC gc = new GC(this.outer);
+
+                static if (makeClosure) int b = a;
+            }
+        };
+        r.run();
+    }
+}
+
+void test15839()
+{
+    auto ap1 = new AnimatedProgress15839!false();
+    ap1.saveThis = ap1;
+    ap1.start();
+
+    auto ap2 = new AnimatedProgress15839!true();
+    ap2.saveThis = ap2;
+    ap2.start();
+}
+
+/*******************************************************/
+
+int main()
+{
+
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+
+    test11();
+    test12();
+    test13();
+
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+
+    test21();
+    test22();
+    test23();
+    test24();
+
+    test14046();
+    test15839();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/integrate.d b/gcc/testsuite/gdc.test/runnable/integrate.d
new file mode 100644
index 00000000000..ea55e2dcaf7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/integrate.d
@@ -0,0 +1,164 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS:
+
+// NOTE: the shootout is under a BSD license
+// The Great Computer Language Shootout
+// http://shootout.alioth.debian.org/
+//
+// contributed by Sebastien Loisel
+
+import std.math, std.stdio, std.string, std.conv;
+
+alias fl F;
+struct fl
+{
+    double a;
+
+    static fl opCall() { fl f; f.a = 0; return f; }
+    static fl opCall(fl v) { fl f; f.a = v.a; return f; }
+    void set(double x)
+    {
+        if(x==0) { a=0; return; }
+        int k=cast(int)log(fabs(x));
+        a=round(x*exp(-k+6.0))*exp(k-6.0);
+    }
+    static fl opCall(int x) { fl f; f.set(x); return f; }
+    static fl opCall(double x) { fl f; f.set(x); return f; }
+    fl opAdd(fl y) { return fl(a+y.a); }
+    fl opAddAssign(fl y) { this=(this)+y; return this; }
+    fl opSub(fl y) { return fl(a-y.a); }
+    fl opSubAssign(fl y) { this=(this)-y; return this; }
+    fl opMul(fl y) { return fl(a*y.a); }
+    fl opDiv(fl y) { return fl(a/y.a); }
+
+    fl opAdd(int y) { return fl(a+y); }
+    fl opSub(int y) { return fl(a-y); }
+    fl opMul(int y) { return fl(a*y); }
+    fl opDiv(int y) { return fl(a/y); }
+
+    fl opAdd(double y) { return fl(a+y); }
+    fl opSub(double y) { return fl(a-y); }
+    fl opMul(double y) { return fl(a*y); }
+    fl opDiv(double y) { return fl(a/y); }
+}
+
+struct ad
+{
+    F x, dx;
+    static ad opCall() { ad t; t.x = F(0); t.dx = F(0); return t; }
+    static ad opCall(int y) { ad t; t.x = F(y); t.dx = F(0); return t; }
+    static ad opCall(F y) { ad t; t.x = y; t.dx = F(0); return t; }
+    static ad opCall(F X, F DX) { ad t; t.x = X; t.dx = DX; return t; }
+    ad opAdd(ad y) { return ad(x+y.x,dx+y.dx); }
+    ad opSub(ad y) { return ad(x-y.x,dx-y.dx); }
+    ad opMul(ad y) { return ad(x*y.x,dx*y.x+x*y.dx); }
+    ad opDiv(ad y) { return ad(x/y.x,(dx*y.x-x*y.dx)/(y.x*y.x)); }
+    ad opMul(F v) { return ad(x*v,dx*v); }
+    ad opAdd(F v) { return ad(x+v,dx); }
+}
+
+F sqr(F x) { return x * x; }
+ad sqr(ad x) { return x * x; }
+
+F pow(F x, int i)
+{
+    if(i < 1) return F(1);
+    if(i & 1) if(i == 1) return x; else return x * pow(x,i-1);
+    return sqr(pow(x,i/2));
+}
+ad pow(ad x, int i)
+{
+    if(i < 1) return ad(1);
+    if(i & 1) if(i == 1) return x; else return x * pow(x,i-1);
+    return sqr(pow(x,i/2));
+}
+
+F rat(F x)
+{
+    F t = (x * F(2) + pow(x,2) * F(3) + pow(x,6) * F(7) + pow(x,11) * F(5) + F(1))
+        / (x * F(5) - pow(x,3) * F(6) - pow(x,7) * F(3) + F(2));
+    return t;
+}
+ad rat(ad x)
+{
+    ad t = (x * ad(2) + pow(x,2) * ad(3) + pow(x,6) * ad(7) + pow(x,11) * ad(5) + ad(1))
+        / (x * ad(5) - pow(x,3) * ad(6) - pow(x,7) * ad(3) + ad(2));
+    return t;
+}
+
+F newton(F x0, int n, trapezoid_method_rooter g)
+{
+
+    for(int i=0 ; i<n; i++)
+    {
+        ad val = g( ad(x0,F(1)) );    // ad = trapezoid_method_rooter(ad);
+//**
+        x0 = x0 - val.x / val.dx;
+/+
+        F t0 = val.x;
+        F t1 = val.dx;
+        x0 = x0 - t0 / t1;
++/
+    }
+
+    return x0;
+}
+
+struct trapezoid_method_rooter
+{
+    sqrintegrand g;
+    ad g0;
+    F y0, t0, t1;
+    trapezoid_method_rooter opCall(sqrintegrand G, F Y0, F T0, F T1)
+    {
+        g = G;
+        y0 = Y0;
+        t0 = T0;
+        t1 = T1;
+        g0 = G(T0,Y0);              // ad = sqr/ratintegrand(float,float);
+        return this;
+    }
+    ad opCall(ad y1)
+    {
+        return (g(ad(t1),y1) + g0) * ((t1-t0)/F(2)) + y0 - y1;        // ad = sqr/ratintegrand(ad,ad);
+    }
+}
+
+F trapezoid_method(F t0, F dt, F y0, sqrintegrand g, int numsteps)
+{
+  for(int i = 0; i < numsteps; i++)
+  {
+      trapezoid_method_rooter solver;
+      y0 = newton(y0,10,solver(g,y0,t0,t0+dt));
+      t0 = t0 + dt;
+  }
+  return y0;
+}
+
+struct sqrintegrand
+{
+      ad opCall(F t, F y) { return ad(sqr(y)); }
+      ad opCall(ad t, ad y) { return sqr(y); }
+}
+
+struct ratintegrand
+{
+    ad opCall(F t, F y) { return ad(rat(y) - t); }
+    ad opCall(ad t, ad y) { return rat(y) - t; }
+}
+
+void integrate_functions(F x0, int n)
+{
+    sqrintegrand   i1;
+    writeln("i1 ",pr(trapezoid_method(F(1), F(1)/F(n), x0, i1 ,n)));
+}
+
+char[] pr(fl x) { char[] s = new char[100]; int len = sprintf(s.ptr,"%.2e",x.a); return s[0..len]; }
+
+int main(string[] args)
+{
+  int N = args.length > 1 ? to!int(args[1]) : 50;
+
+  integrate_functions(F(0.02),N);
+  return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/interface.d b/gcc/testsuite/gdc.test/runnable/interface.d
new file mode 100644
index 00000000000..2700c6512dd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/interface.d
@@ -0,0 +1,90 @@
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+/*******************************************/
+
+interface IStream
+{
+    int read();
+}
+
+interface OStream
+{
+    int write();
+}
+
+class IO : IStream, OStream
+{
+    int read() { return 7; }
+    int write() { return 267; }
+}
+
+void foo(IStream i, OStream o)
+{
+    printf("foo(i = %p, o = %p)\n", i, o);
+    assert(i.read() == 7);
+    assert(o.write() == 267);
+}
+
+void test1()
+{
+    IO io = new IO();
+    printf("io = %p\n", io);
+    foo(io, io);
+    delete io;
+}
+
+/*******************************************/
+
+interface I { }
+class C : I
+{
+    ~this() { printf("~C()\n"); }
+}
+
+void test2()
+{
+    I i = new C();
+    delete i;
+
+  {
+    scope I j = new C();
+  }
+}
+
+/*******************************************/
+
+interface I3 {
+    void h();
+}
+interface K3 {
+    void f();
+}
+
+interface J3 : I3, K3 {}
+
+class A3 : J3 {
+    void f(){ }
+    void h(){ }
+}
+
+void test3()
+{
+    auto a = new A3();
+    J3 b = a;
+    K3 c = a;
+    assert(&b.f == &c.f); // Bugzilla 3706
+}
+
+/*******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/interface1.d b/gcc/testsuite/gdc.test/runnable/interface1.d
new file mode 100644
index 00000000000..1168ba88778
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/interface1.d
@@ -0,0 +1,203 @@
+
+extern(C) int printf(const char*, ...);
+
+/*******************************************/
+
+interface D {
+        int foo();
+}
+
+class A : D {
+        int foo() { return 1; }
+}
+
+class B : A, D
+{
+        override int foo() { return 2; }
+}
+
+class C : B, D {
+        override int foo() { return 3; }
+}
+
+void test1()
+{
+        C c = new C;
+        A a = cast(A) c;
+        int j = a.foo();
+        printf("%d\n", j);
+        assert(j == 3);
+
+        B b = cast(B) c;
+        int k = b.foo();
+        printf("%d\n", k);
+        assert(k == 3);
+
+        D d1 = cast(D) c;
+        int l = d1.foo();
+        printf("%d\n", l);
+        assert(l == 3);
+
+        D d2 = cast(D) b;
+        int m = d2.foo();
+        printf("%d\n", m);
+        assert(m == 3);
+}
+
+
+/*******************************************/
+
+interface D2 {
+        int foo();
+}
+
+class A2 : D2 {
+        int foo() { printf("A2\n"); return 1; }
+}
+
+class B2 : A2 {
+        override int foo() { printf("B2\n"); return 2; }
+}
+
+class C2 : B2, D2 {
+        override int foo() { printf("C2\n"); return 3; }
+}
+
+void test2()
+{
+    int i;
+
+    C2 c = new C2;
+    D2 d = cast(D2)c;
+    i = c.foo();
+    assert(i == 3);
+
+    i = d.foo();
+    assert(i == 3);
+
+    B2 b = new B2;
+    if (cast(D2) b)
+    {
+        D2 e = cast(D2) b;
+        i = e.foo();
+        assert(i == 2);
+    }
+    else
+        assert(0);
+
+    A2 a;
+    if (cast(D2) a)
+        assert(0);
+}
+
+
+/*******************************************/
+
+interface C3
+{
+    int doLayout();
+}
+
+class A3
+{
+    void print() { printf("A3::print\n"); }
+}
+
+class B3 : A3, C3
+{
+    int doLayout() { printf( "B3::doLayout\n" ); return 17; }
+}
+
+void callLayout(A3 b)
+{
+    printf("b = %p\n", b);
+    C3 cl = cast(C3)b;
+    printf("cl = %p\n", cl);
+    if (cl)
+    {   int i;
+
+        i = cl.doLayout();
+        assert(i == 17);
+    }
+    else
+    {   printf("the 'A3' you passed did not implement 'C3'\n" );
+        assert(0);
+    }
+}
+
+void test3()
+{
+    callLayout(new B3());
+}
+
+
+/*******************************************/
+
+
+template IContainer(T)
+{
+        interface IContainer
+        {
+                alias   Container!(int) selected_type;
+                bool    isEmpty();
+                int     enumerate();
+        }
+}
+
+template Container(T)
+{
+        class Container : IContainer!(int)
+        {
+            bool isEmpty() { return false; }
+            int enumerate() { return 3; }
+        }
+}
+
+void Vector_test_IContainer_int()
+{
+    alias IContainer!(int) icontainer_t;
+}
+
+void test4()
+{
+}
+
+/*******************************************/
+
+
+interface Italy(T)
+{
+        alias   Foo5!(int) selected_type;
+        bool    isempty();
+        int     enumerate();
+}
+
+class Foo5(T) : Italy!(int)
+{
+        bool    isempty() { return false; }
+        int     enumerate() { return 3; }
+}
+
+void test5()
+{
+    alias Italy!(int) Ic;
+    Foo5!(int) f = new Foo5!(int);
+    Ic i = cast(Ic)f;
+    assert(i.isempty() == false);
+    assert(i.enumerate() == 3);
+}
+
+
+/*******************************************/
+
+int main (char[][] args)
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/interface2.d b/gcc/testsuite/gdc.test/runnable/interface2.d
new file mode 100644
index 00000000000..85adf65b481
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/interface2.d
@@ -0,0 +1,1233 @@
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+/*******************************************************/
+
+interface Foo { int bar(); }
+
+void* p1;
+
+class Bar : Foo
+{
+    int bar()
+    {
+        printf("Bar.bar(this = %p)\n", this);
+        p1 = cast(void*)this;
+        return 0;
+    }
+}
+
+void test1()
+{
+    Bar b = new Bar();
+    Foo f = b;
+
+    printf("b = %p\n", b);
+    printf("f = %p\n", f);
+    assert(cast(void*)b !is cast(void*)f);
+
+    printf("f.class = '%.*s'\n", f.classinfo.name.length, f.classinfo.name.ptr);
+    assert(f.classinfo.name == "interface2.Foo");
+
+    f.bar();
+    assert(p1 is cast(void*)b);
+
+    Bar b2 = cast(Bar)f;
+    printf("cast(Bar)f = %p\n", b2);
+    assert(b is b2);
+
+    delete f;
+}
+
+/*******************************************************/
+
+interface A {}
+interface B:A {}
+interface C {}
+class D:B,C {}
+
+void test2()
+{
+    D x = new D();
+    printf("D: %p\n",x);
+    Object o = x;
+    printf("o: %p\n",o);
+    B b = cast(B)o;
+    printf("B: %p\n",b);
+    C c = cast(C)o;    // boom
+    printf("C: %p\n",c);
+}
+
+/*******************************************************/
+
+interface B3
+{
+    void close();
+}
+
+interface C3 : B3
+{
+}
+
+class A3 : B3
+{
+    void close()
+    {
+    }
+}
+
+class D3 : A3
+{
+}
+
+class E3 : D3, C3
+{
+}
+
+void test3()
+{
+    C3 c = new E3();
+    delete c;
+}
+
+
+/*******************************************************/
+
+interface K
+{
+}
+
+interface X
+{
+}
+
+interface Y : X
+{
+}
+
+class Z : Y
+{
+}
+
+void test4()
+{
+    Z z = new Z();
+    if (cast(K) z)
+    {
+        printf("not ok\n");
+        assert(0);
+    }
+}
+
+/*******************************************************/
+
+interface I5
+{
+    char M ();
+}
+
+interface J5 : I5
+{
+    char N ();
+}
+
+class A5 : I5
+{
+    char M () { printf("M()\n"); return 'M'; }
+}
+
+class B5 : A5, J5
+{
+    char N () { printf("N()\n"); return 'N'; }
+}
+
+void test5()
+{
+    I5 f = new B5 ();
+
+    char c = f.M();
+    assert(c == 'M');
+}
+
+/*******************************************************/
+
+interface A6
+{
+    void ma ();
+}
+
+interface B6
+{
+    void mb ();
+}
+
+class C6 : A6, B6
+{
+    void ma () { }
+    void mb () { }
+}
+
+void test6()
+{
+    A6 x = new C6 ();
+
+    assert (cast (B6) x);
+}
+
+/*******************************************************/
+
+interface D7 { int foo(); }
+
+class A7 : D7 { int foo() { return 1; } }
+
+class B7 : A7
+{
+    override int foo() { return 2; }
+    D7 me() { return this; }
+}
+
+void test7()
+{
+    A7 a = new A7;
+    B7 b = new B7;
+    assert(b.me().foo() != a.foo());
+}
+
+/*******************************************************/
+
+interface D8 { void foo(); }
+
+class A8 : D8 { void foo() { printf("A8.foo()\n"); } }
+
+class B8 : A8 {}
+
+void test8()
+{
+    B8 b = new B8();
+    D8 d = cast(D8) b;
+    d.foo();
+}
+
+/*******************************************************/
+
+interface IA9
+{
+    int i1();
+}
+
+interface IB9
+{
+    int i2();
+}
+
+interface IC9 : IA9, IB9
+{
+}
+
+class C9 : IC9
+{
+    int i1() { printf("i1\n"); return 1; }
+    int i2() { printf("i2\n"); return 2; }
+}
+
+void f9(IA9 i1, IB9 i2)
+{
+    int i;
+
+    printf("f9\n");
+    i = i1.i1();
+    assert(i == 1);
+    i = i2.i2();
+    assert(i == 2);
+}
+
+void test9()
+{
+    IC9 i3 = new C9();
+    C9 c = new C9();
+    f9(c, c);
+    //printf("c = %p, IC9 = %p, IA9 = %p, IB9 = %p\n", c, i3, cast(IA9)i3, cast(IB9)i3);
+    f9(i3, i3);
+}
+
+
+/*******************************************************/
+
+interface IOne
+{
+    int one ();
+}
+
+interface ITwo
+{
+    int two ();
+}
+
+interface IThree : IOne, ITwo
+{
+    int three ();
+}
+
+class Three : IThree
+{
+    int one ()   { printf ("one\n"); return 1; }
+    int two ()   { printf ("two\n"); return 2; }
+    int three () { printf ("three\n"); return 3; }
+}
+
+
+void test10()
+{
+    int i;
+    IThree three = new Three;
+
+    i = three.one();
+    assert(i == 1);
+    i = three.two();
+    assert(i == 2);
+    i = three.three();
+    assert(i == 3);
+
+    ITwo two = cast(ITwo) three;
+    i = two.two();
+    assert(i == 2);
+}
+
+
+/*******************************************************/
+
+interface A11{
+}
+
+interface B11 : A11{
+}
+
+class MyClass : B11{
+}
+
+void test11()
+{
+    B11 b = new MyClass();
+    Object o = cast(Object)b;
+    printf("o = %p\n", o);
+}
+
+/*******************************************************/
+
+interface I12
+{
+    int foo();
+}
+
+class IA12 : I12
+{
+    int foo() { return 1; }
+}
+
+class A12
+{
+    I12 i;
+
+    I12 clone() { return i; }
+}
+
+class B12 : A12
+{
+    IA12 ia;
+
+    override IA12 clone()   // covariant return value
+    out (result)
+    {
+        printf("B12.clone()\n");
+    }
+    body
+    {
+        return ia;
+    }
+}
+
+void test12()
+{
+    IA12 ia = new IA12;
+    assert(ia.foo() == 1);
+
+    I12 i = ia;
+    assert(i.foo() == 1);
+
+    A12 a = new A12;
+    a.i = i;
+    assert(a.clone().foo() == 1);
+
+    B12 b = new B12;
+    b.ia = ia;
+    assert(b.clone().foo() == 1);
+
+    a = b;
+    assert(a.clone().foo() == 1);
+}
+
+/*******************************************************/
+
+class I13
+{
+    int foo() { return 0; }
+}
+
+class IA13 : I13
+{
+    override int foo() { return 1; }
+}
+
+class A13
+{
+    I13 i;
+
+    I13 clone() { return i; }
+}
+
+class B13 : A13
+{
+    IA13 ia;
+
+    override IA13 clone()
+    out (result)
+    {
+        printf("B13.clone()\n");
+    }
+    body { return ia; }
+}
+
+void test13()
+{
+    IA13 ia = new IA13;
+    assert(ia.foo() == 1);
+
+    I13 i = ia;
+    assert(i.foo() == 1);
+
+    A13 a = new A13;
+    a.i = i;
+    assert(a.clone().foo() == 1);
+
+    B13 b = new B13;
+    b.ia = ia;
+    assert(b.clone().foo() == 1);
+
+    a = b;
+    assert(a.clone().foo() == 1);
+
+    bar(&b.clone);
+}
+
+void bar(IA13 delegate() dg)
+{
+}
+
+/*******************************************************/
+
+interface I14
+{
+        I14 clone();
+}
+
+interface BabyI14: I14
+{
+}
+
+class A14: BabyI14
+{
+    int x;
+    BabyI14 clone()
+    {
+        A14 a = new A14;
+        a.x = x;
+        return a;
+    }
+}
+
+I14 foo14(I14 i)
+{
+    return i.clone();
+}
+
+void test14()
+{
+    A14 a = new A14;
+    a.x = 3;
+    a = cast(A14)a.clone();
+    assert(a.x == 3);
+
+    A14 b = cast(A14)foo14(a);
+    a.x = 4;
+    assert(b.x == 3);
+}
+
+/*******************************************************/
+
+interface I15
+{
+        Object clone();
+}
+
+class A15 : I15
+{
+    int x;
+    A15 clone() { return this; }
+}
+
+void test15()
+{
+    A15 a = new A15;
+    a.x = 3;
+
+    A15 a1 = a.clone();
+    assert(a1.x == 3);
+
+    I15 i = a1;
+    Object o = i.clone();
+    A15 a2 = cast(A15) o;
+    assert(a2.x == 3);
+}
+
+/*******************************************************/
+
+interface I16 {}
+
+class A16
+{
+    I16 foo()
+    {
+        printf("Called A.foo\n");
+        return new B16(42);
+    }
+}
+
+class B16 : A16, I16
+{
+    int data;
+
+    this(int d) { data = d; }
+
+    override B16 foo()
+    {
+        printf("Called B.foo\n");
+        return new B16(69);
+    }
+}
+
+void test16()
+{
+    B16 b = new B16(105);
+    b.foo();
+    A16 a = b;
+    a.foo();
+    printf("foo\n");
+    B16 b2 = cast(B16) a.foo();
+}
+
+
+/*******************************************************/
+
+interface Father
+{
+    int showData();
+}
+
+class Mother
+{
+    Father test() {
+        printf("Called Mother.test\n");
+        return new Child(42);
+    }
+}
+
+class Child : Mother, Father {
+    int data;
+
+    this(int d) { data = d; }
+
+    override Child test()
+    {
+        printf("Called Child.test\n");
+        return new Child(69);
+    }
+
+    int showData() {
+        printf("%d\n", data);
+        return data;
+    }
+}
+
+void test17()
+{
+    Child aChild = new Child(105);
+    Mother childsMum = aChild;
+
+    aChild.test();
+    Father mumTest = childsMum.test();
+    int i;
+    i = aChild.showData();
+    assert(i == 105);
+    i = mumTest.showData();
+    assert(i == 69);
+}
+
+
+/*******************************************************/
+
+int status18;
+
+interface I18 {
+    int showData();
+}
+
+class Parent18 {
+    I18 test() {
+        status18 += 7;
+        return new Child18(42);
+    }
+}
+
+class Child18 : Parent18, I18 {
+    int data;
+
+    this(int d) {
+        data = d;
+    }
+
+    override Child18 test() {
+        status18 += 1;
+        return new Child18(69);
+    }
+
+    override
+     int showData(){
+        return data;
+    }
+}
+
+void test18()
+{
+    Child18 a = new Child18(105);
+    assert(a);
+    assert(status18 == 0);
+    assert(a.data == 105);
+
+    Parent18 p = a;
+    assert(a);
+    assert(status18 == 0);
+
+    a.test();
+    assert(status18 == 1);
+
+    I18 i = p.test();
+    assert(i);
+    assert(status18 == 2);
+
+    assert(a.data == 105);
+    assert(a.showData() == 105);
+    assert(i.showData() == 69);
+}
+
+/*******************************************************/
+
+
+interface IFoo19 {
+}
+
+interface ICov19 {
+    IFoo19 covfunc();
+}
+
+class Child19 : ICov19, IFoo19 {
+    Child19 covfunc() {
+        printf("in Child19.covfunc()\n");
+        return this;
+    }
+}
+
+void test19()
+{
+    Child19 c = new Child19();
+    ICov19 icov = c;
+
+    IFoo19 ifoo = icov.covfunc();
+
+    printf("c = %p\n", c);
+    printf("icov = %p\n", icov);
+    printf("ifoo = %p\n", ifoo);
+
+    assert(cast(void*)c + (2*(void*).sizeof) == cast(void*)icov);
+    assert(cast(void*)c + (3*(void*).sizeof) == cast(void*)ifoo);
+
+    string s = ifoo.classinfo.name;
+    printf("%.*s\n", s.length, s.ptr);
+    assert(s == "interface2.IFoo19");
+
+    s = (cast(Object)ifoo).toString;
+    printf("%.*s\n", s.length, s.ptr);
+    assert(s == "interface2.Child19");
+}
+
+/*******************************************************/
+
+interface Iface1
+{
+    Iface2 func1();
+}
+
+interface Iface2
+{
+    Iface1 func2();
+}
+
+class C1_20 : Iface1
+{
+    C2_20 func1(){ return null; }
+}
+
+class C2_20 : Iface2
+{
+    C1_20 func2(){ return null; }
+}
+
+void test20()
+{
+    C1_20 c1 = new C1_20();
+    printf("c1.func1() == %p\n", c1.func1());
+    assert(c1.func1() is null);
+    printf("test1\n");
+
+    C2_20 c2 = new C2_20();
+    printf("c2.func2() == %p\n", c2.func2());
+    assert(c2.func2() is null);
+}
+
+/*******************************************************/
+
+interface I21
+{
+    int test(int);
+}
+
+class C21 : I21
+{
+    int test(int i){
+        return i+1;
+    }
+}
+
+void test21()
+{
+    C21[I21] aa;
+
+    C21 o = new C21();
+
+    aa[o] = o;
+
+    I21 i = aa[o];
+    assert(i.test(3) == 4);
+}
+
+
+/*******************************************************/
+
+interface IFoo22
+{
+   int foo();
+}
+
+class Foo22: IFoo22
+{
+   final int foo() { return 7; }
+}
+
+void test22()
+{
+    Foo22 f = new Foo22;
+    assert(f.foo() == 7);
+
+    IFoo22 i = f;
+    assert(i.foo() == 7);
+}
+
+/*******************************************************/
+
+interface IFoo23
+{
+   int foo();
+}
+
+class Foo23: IFoo23
+{
+   final int foo() { return 7; }
+}
+
+class Baz23 : Foo23
+{
+}
+
+void test23()
+{
+    Baz23 f = new Baz23;
+    assert(f.foo() == 7);
+
+    IFoo23 i = f;
+    assert(i.foo() == 7);
+}
+
+/*******************************************************/
+
+interface I24B() : I24A
+{
+}
+
+interface I24A
+{
+    I24B!() func ();
+}
+
+class Foo24 : I24B!()
+{
+    I24B!() func()
+    {
+        return null;
+    }
+}
+
+void test24()
+{
+    auto foo = new Foo24();
+
+    foo.func();
+    printf("foo.func() call passed\n");
+
+    I24A ifA = foo;
+    assert(ifA !is null);
+    ifA.func();
+}
+
+/*******************************************************/
+
+interface IA25
+{
+    char a();
+}
+
+interface IB25
+{
+    char b();
+}
+
+interface IC25 : IA25, IB25
+{
+    char c();
+}
+
+interface ID25
+{
+    char d();
+}
+
+interface IE25 : IC25, ID25
+{
+    char e();
+}
+
+class Foo25 : IE25
+{
+    char a() { return('a'); }
+    char b() { return('b'); }
+    char c() { return('c'); }
+    char d() { return('d'); }
+    char e() { return('e'); }
+}
+
+void test25()
+{
+    auto foo = new Foo25;
+    printf("Foo: %c %c %c %c %c\n", foo.a, foo.b, foo.c, foo.d, foo.e);
+    IA25 a = foo;
+    printf("A: %c\n", a.a);
+    assert(a.a == 'a');
+    IB25 b = foo;
+    printf("B: %c\n", b.b);
+    assert(b.b == 'b');
+    IC25 c = foo;
+    printf("C: %c %c %c\n", c.a, c.b, c.c);
+    assert(c.a == 'a');
+    assert(c.b == 'b');
+    assert(c.c == 'c');
+    ID25 d = foo;
+    printf("D: %c\n", d.d);
+    assert(d.d == 'd');
+    IE25 e = foo;
+    printf("E: %c %c %c %c %c\n", e.a, e.b, e.c, e.d, e.e);
+    assert(e.a == 'a');
+    assert(e.b == 'b');
+    assert(e.c == 'c');
+    assert(e.d == 'd');
+    assert(e.e == 'e');
+
+    b = e;
+    printf("IB25: %c\n", b.b);
+    assert(b.b == 'b');
+}
+
+/*******************************************************/
+
+interface VisualElement {
+   void draw();
+}
+
+interface Actor {
+}
+
+interface VisualActor : Actor, VisualElement {
+}
+
+class Sprite3 : Actor, VisualActor {
+    override void draw() { }
+}
+
+void test26()
+{
+}
+
+/*******************************************************/
+
+interface I27
+{
+    static int foo() { return 3; }
+
+    final int bar() { return 7 + abc(); }
+
+    int abc();
+}
+
+class C27 : I27
+{
+    int x;
+    int abc() { return x * 10; }
+}
+
+void test27()
+{
+    C27 c = new C27();
+    c.x = 8;
+    I27 i = c;
+    assert(i.foo() == 3);
+    assert(I27.foo() == 3);
+    assert(i.bar() == 87);
+}
+
+/*******************************************************/
+// 1747 & 2013
+
+void test1747()
+{
+    interface IA          { int mA(); }
+    interface IB : IA     { int mB(); }
+    interface IC : IB     { }
+    interface ID : IA, IC { int mD(); }
+
+    // offset:   0   +n  +n + ptrsize
+    //                  (IA)
+    //                   IB
+    //               IA, IC
+    static class C : ID
+    {
+        int mA() { return 1; }
+        int mB() { return 2; }
+        int mD() { return 3; }
+    }
+
+    C c = new C;    void* pc  = *cast(void**)&c;
+    ID id = c;      void* pid = *cast(void**)&id;
+    IC ic = c;      void* pic = *cast(void**)&ic;
+    IB ib = c;      void* pib = *cast(void**)&ib;
+    IA ia = c;      void* pia = *cast(void**)&ia;
+
+    //printf(" c = %p\n", pc);
+    //printf("id = %p\n", pid);
+    //printf("ic = %p\n", pic);
+    //printf("ib = %p\n", pib);
+    //printf("ia = %p\n", pia);
+
+    size_t n = pid - pc;
+    assert(pic == pc + n + (void*).sizeof);
+    assert(pib == pc + n + (void*).sizeof);     // OK <- NG
+    assert(pia == pc + n);
+
+    assert(id.mA() == 1);
+    assert(id.mB() == 2);   // OK <- NG (bugzilla 2013 case)
+    assert(id.mD() == 3);
+
+    assert(ic.mA() == 1);
+    assert(ic.mB() == 2);   // OK <- NG (bugzilla 2013 case)
+
+    assert(ib.mA() == 1);
+    assert(ib.mB() == 2);   // OK <- NG
+
+    assert(ia.mA() == 1);
+}
+
+/*******************************************************/
+
+private interface IFoo
+{
+   void foo();
+}
+
+void test2553()
+{
+    IFoo foo;
+    if (0)
+        foo.foo;
+}
+
+/*******************************************************/
+
+interface I2524
+{
+    void foo();
+}
+
+class C2524 : I2524
+{
+    final override void foo() { }
+}
+
+/*******************************************************/
+
+interface Test4088 {}
+
+bool foo4088(Test4088 x, Test4088 y)
+{
+    return x == y;
+}
+
+/*******************************************************/
+// 7950
+
+template TypeTuple7950(T...){alias T TypeTuple7950;}
+interface I7950a {} // ok
+interface I7950b : I7950a, TypeTuple7950!() {} // fail
+
+/*******************************************************/
+// 10007
+
+struct A10007 {}
+
+interface IFoo10007
+{
+    void bar(ref const A10007);
+}
+
+class Foo10007 : IFoo10007
+{
+    void bar(ref const A10007 a) {}
+    void bar(    const A10007 a) { return this.bar(a); }
+}
+
+/*******************************************************/
+// 10744
+
+interface A10744
+{
+    int x();
+    Foo10744 foo();
+}
+
+class B10744 : A10744
+{
+    int x() { return 0; }
+    Bar10744 foo() { return null; }
+}
+
+class Foo10744 { }
+class Bar10744 : Foo10744 { }
+
+interface C10744
+{
+    int x();
+    Baz10744 foo();
+}
+
+class D10744 : C10744
+{
+    int x() { return 0; }
+    Qux10744 foo() { return null; }
+}
+
+interface Baz10744 { }
+interface Qux10744 : Baz10744 { }
+
+/*******************************************************/
+// 11034
+
+class A11034(T)
+{
+    A11034!int view() { return null; }
+}
+class B11034(T) : A11034!int
+{
+override:
+    C11034!int view() { return null; }
+}
+class C11034(T) : B11034!int {}
+
+void test11034()
+{
+    auto b = new B11034!int;
+
+    // Check that B!int.view() overrides A!int.view()
+    auto tiobj = typeid(Object);
+    assert(typeid(A11034!int).vtbl.length == tiobj.vtbl.length + 1);
+    assert(typeid(B11034!int).vtbl.length == tiobj.vtbl.length + 1);
+}
+
+/*******************************************************/
+
+void testTypeid()
+{
+    interface I
+    {
+    }
+
+    interface J : I
+    {
+    }
+
+    class C : J
+    {
+    }
+
+    class D : C
+    {
+    }
+
+    D d = new D();
+    Object o = d;
+    I i = d;
+
+    assert(typeid(typeof(o)) is typeid(Object));
+    assert(typeid(o) is typeid(D));
+    assert(o.classinfo is typeid(D));
+    assert(typeid(typeof(i)) is typeid(I));
+    assert(typeid(i) !is typeid(J));
+    assert(i.classinfo !is typeid(J));
+}
+
+/*******************************************************/
+
+extern (C++)
+{
+    interface IA47
+    {
+        char a();
+    }
+
+    interface IB47
+    {
+        char b();
+    }
+
+    interface IC47 : IA47, IB47
+    {
+        char c();
+    }
+
+    interface ID47
+    {
+        char d();
+    }
+
+    interface IE47 : IC47, ID47
+    {
+        char e();
+    }
+
+    class Foo47 : IE47
+    {
+        int x = 9;
+        char a() { printf("a.this = %p\n", this); return('a'); }
+        char b() { printf("b.this = %p\n", this); return('b'); }
+        char c() { printf("c.this = %p\n", this); return('c'); }
+        char d() { printf("d.this = %p\n", this); return('d'); }
+        char e() { printf("e.this = %p\n", this); return('e'); }
+    }
+}
+
+void test15647()
+{
+    auto foo = new Foo47;
+    printf("Foo: %p %c %c %c %c %c\n", foo, foo.a, foo.b, foo.c, foo.d, foo.e);
+    IA47 a = foo;
+    printf("A: %c\n", a.a);
+    assert(a.a == 'a');
+    IB47 b = foo;
+    printf("B: %c\n", b.b);
+    assert(b.b == 'b');
+    IC47 c = foo;
+    printf("C: %p %c %c %c\n", c, c.a, c.b, c.c);
+    assert(c.a == 'a');
+    assert(c.b == 'b');
+    assert(c.c == 'c');
+    ID47 d = foo;
+    printf("D: %c\n", d.d);
+    assert(d.d == 'd');
+    IE47 e = foo;
+    printf("E: %c %c %c %c %c\n", e.a, e.b, e.c, e.d, e.e);
+    assert(e.a == 'a');
+    assert(e.b == 'b');
+    assert(e.c == 'c');
+    assert(e.d == 'd');
+    assert(e.e == 'e');
+
+    b = e;
+    printf("IB47: %c\n", b.b);
+    assert(b.b == 'b');
+}
+
+/*******************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test1747();
+    test2553();
+    test11034();
+    testTypeid();
+    test15647();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/interface3.d b/gcc/testsuite/gdc.test/runnable/interface3.d
new file mode 100644
index 00000000000..f748f72b08d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/interface3.d
@@ -0,0 +1,75 @@
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+interface IWriter
+{
+        IWriter put (I1 x);
+}
+
+interface I1
+{
+        void write (IWriter writer);
+}
+
+interface I2 : I1 {}
+
+interface I3 : I2 {}
+
+class Newline : I3
+{
+        static int OKset;
+
+        void write (IWriter writer)
+        {
+                printf ("OK\n");
+                OKset += 1;
+        }
+}
+
+
+
+class Writer : IWriter
+{
+        IWriter put (I1 x)
+        {
+                x.write (this);
+                return this;
+        }
+}
+
+class FlushWriter : Writer
+{
+        override IWriter put (I1 x)
+        {
+               // have superclass handle the I1
+                super.put (x);
+
+                // flush output when we see a newline
+                if (cast(Newline) x)
+                   {
+                   }
+
+                return this;
+        }
+}
+
+
+
+void test (IWriter w)
+{
+        //w.put (new Newline);
+
+        I3 NL = new Newline;
+        w.put (NL);
+}
+
+
+int main()
+{
+        test (new FlushWriter);
+        assert(Newline.OKset == 1);
+        return 0;
+}
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/interpret.d b/gcc/testsuite/gdc.test/runnable/interpret.d
new file mode 100644
index 00000000000..a33d46e735a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/interpret.d
@@ -0,0 +1,3548 @@
+
+import std.stdio;
+
+template Tuple(A...)
+{
+    alias A Tuple;
+}
+
+template eval(A...)
+{
+    const typeof(A[0]) eval = A[0];
+}
+
+/************************************************/
+
+int Foo1(int i)
+{
+    if (i == 0)
+        return 1;
+    else
+        return i * Foo1(i - 1);
+}
+
+void test1()
+{
+    static int f = Foo1(5);
+    printf("%d %d\n", f, 5*4*3*2);
+    assert(f == 120);
+}
+
+/************************************************/
+
+int find2(string s, char c)
+{
+    if (s.length == 0)
+        return -1;
+    else if (c == s[0])
+        return 0;
+    else
+        return 1 + find2(s[1..$], c);
+}
+
+void test2()
+{
+    static int f = find2("hello", 'l');
+    printf("%d\n", f);
+    assert(f == 2);
+}
+
+/************************************************/
+
+int bar3(int i)
+{
+    int j;
+    while (i)
+    {
+        j += i;
+        i--;
+    }
+    return j;
+}
+
+void test3()
+{
+    static b = bar3(7);
+    printf("b = %d, %d\n", b, bar3(7));
+    assert(b == 28);
+}
+
+/************************************************/
+
+int bar4(int i)
+{
+    for (int j = 0; j < 10; j++)
+        i += j;
+    return i;
+}
+
+void test4()
+{
+    static b = bar4(7);
+    printf("b = %d, %d\n", b, bar4(7));
+    assert(b == 52);
+}
+
+/************************************************/
+
+int bar5(int i)
+{
+    int j;
+    do
+    {
+        i += j;
+        j++;
+    } while (j < 10);
+    return i;
+}
+
+void test5()
+{
+    static b = bar5(7);
+    printf("b = %d, %d\n", b, bar5(7));
+    assert(b == 52);
+}
+
+/************************************************/
+
+int bar6(int i)
+{
+    int j;
+    do
+    {
+        i += j;
+        j++;
+        if (j == 4)
+            break;
+    } while (j < 10);
+    return i;
+}
+
+void test6()
+{
+    static b = bar6(7);
+    printf("b = %d, %d\n", b, bar6(7));
+    assert(b == 13);
+}
+
+/************************************************/
+
+int bar7(int i)
+{
+    int j;
+    do
+    {
+        i += j;
+        j++;
+        if (j == 4)
+            return 80;
+    } while (j < 10);
+    return i;
+}
+
+void test7()
+{
+    static b = bar7(7);
+    printf("b = %d, %d\n", b, bar7(7));
+    assert(b == 80);
+}
+
+/************************************************/
+
+int bar8(int i)
+{
+    int j;
+    do
+    {
+        j++;
+        if (j == 4)
+            continue;
+        i += j;
+    } while (j < 10);
+    return i;
+}
+
+void test8()
+{
+    static b = bar8(7);
+    printf("b = %d, %d\n", b, bar8(7));
+    assert(b == 58);
+}
+
+/************************************************/
+
+int bar9(int i)
+{
+    int j;
+    while (j < 10)
+    {
+        j++;
+        if (j == 4)
+            continue;
+        i += j;
+    }
+    return i;
+}
+
+void test9()
+{
+    static b = bar9(7);
+    printf("b = %d, %d\n", b, bar9(7));
+    assert(b == 58);
+}
+
+/************************************************/
+
+int bar10(int i)
+{
+    int j;
+    while (j < 10)
+    {
+        j++;
+        if (j == 4)
+            break;
+        i += j;
+    }
+    return i;
+}
+
+void test10()
+{
+    static b = bar10(7);
+    printf("b = %d, %d\n", b, bar10(7));
+    assert(b == 13);
+}
+
+/************************************************/
+
+int bar11(int i)
+{
+    int j;
+    while (j < 10)
+    {
+        j++;
+        if (j == 4)
+            return i << 3;
+        i += j;
+    }
+    return i;
+}
+
+void test11()
+{
+    static b = bar11(7);
+    printf("b = %d, %d\n", b, bar11(7));
+    assert(b == 104);
+}
+
+/************************************************/
+
+int bar12(int i)
+{
+    for (int j; j < 10; j++)
+    {
+        if (j == 4)
+            return i << 3;
+        i += j;
+    }
+    return i;
+}
+
+void test12()
+{
+    static b = bar12(7);
+    printf("b = %d, %d\n", b, bar12(7));
+    assert(b == 104);
+}
+
+/************************************************/
+
+int bar13(int i)
+{
+    for (int j; j < 10; j++)
+    {
+        if (j == 4)
+            break;
+        i += j;
+    }
+    return i;
+}
+
+void test13()
+{
+    static b = bar13(7);
+    printf("b = %d, %d\n", b, bar13(7));
+    assert(b == 13);
+}
+
+/************************************************/
+
+int bar14(int i)
+{
+    for (int j; j < 10; j++)
+    {
+        if (j == 4)
+            continue;
+        i += j;
+    }
+    return i;
+}
+
+void test14()
+{
+    static b = bar14(7);
+    printf("b = %d, %d\n", b, bar14(7));
+    assert(b == 48);
+}
+
+/************************************************/
+
+int bar15(int i)
+{
+    foreach (k, v; "hello")
+    {
+        i <<= 1;
+        if (k == 4)
+            continue;
+        i += v;
+    }
+    return i;
+}
+
+void test15()
+{
+    static b = bar15(7);
+    printf("b = %d, %d\n", b, bar15(7));
+    assert(b == 3344);
+}
+
+/************************************************/
+
+int bar16(int i)
+{
+    foreach_reverse (k, v; "hello")
+    {
+        i <<= 1;
+        if (k == 4)
+            continue;
+        i += v;
+    }
+    return i;
+}
+
+void test16()
+{
+    static b = bar16(7);
+    printf("b = %d, %d\n", b, bar16(7));
+    assert(b == 1826);
+}
+
+/************************************************/
+
+int bar17(int i)
+{
+    foreach (k, v; "hello")
+    {
+        i <<= 1;
+        if (k == 2)
+            break;
+        i += v;
+    }
+    return i;
+}
+
+void test17()
+{
+    static b = bar17(7);
+    printf("b = %d, %d\n", b, bar17(7));
+    assert(b == 674);
+}
+
+/************************************************/
+
+int bar18(int i)
+{
+    foreach_reverse (k, v; "hello")
+    {
+        i <<= 1;
+        if (k == 2)
+            break;
+        i += v;
+    }
+    return i;
+}
+
+void test18()
+{
+    static b = bar18(7);
+    printf("b = %d, %d\n", b, bar18(7));
+    assert(b == 716);
+}
+
+/************************************************/
+
+int bar19(int i)
+{
+    assert(i > 0);
+    foreach_reverse (k, v; "hello")
+    {
+        i <<= 1;
+        if (k == 2)
+            return 8;
+        i += v;
+    }
+    return i;
+}
+
+void test19()
+{
+    static b = bar19(7);
+    printf("b = %d, %d\n", b, bar19(7));
+    assert(b == 8);
+}
+
+/************************************************/
+
+int bar20(int i)
+{
+    assert(i > 0);
+    foreach (k, v; "hello")
+    {
+        i <<= 1;
+        if (k == 2)
+            return 8;
+        i += v;
+    }
+    return i;
+}
+
+void test20()
+{
+    static b = bar20(7);
+    printf("b = %d, %d\n", b, bar20(7));
+    assert(b == 8);
+}
+
+/************************************************/
+
+int bar21(int i)
+{
+    assert(i > 0);
+    foreach (v; Tuple!(57, 23, 8))
+    {
+        i <<= 1;
+        i += v;
+    }
+    return i;
+}
+
+void test21()
+{
+    static b = bar21(7);
+    printf("b = %d, %d\n", b, bar21(7));
+    assert(b == 338);
+}
+
+/************************************************/
+
+int bar22(int i)
+{
+    assert(i > 0);
+    foreach_reverse (v; Tuple!(57, 23, 8))
+    {
+        i <<= 1;
+        i += v;
+    }
+    return i;
+}
+
+void test22()
+{
+    static b = bar22(7);
+    printf("b = %d, %d\n", b, bar22(7));
+    assert(b == 191);
+}
+
+/************************************************/
+
+int bar23(int i)
+{
+    assert(i > 0);
+    foreach_reverse (v; Tuple!(57, 23, 8))
+    {
+        i <<= 1;
+        if (v == 23)
+            return i + 1;
+        i += v;
+    }
+    return i;
+}
+
+void test23()
+{
+    static b = bar23(7);
+    printf("b = %d, %d\n", b, bar23(7));
+    assert(b == 45);
+}
+
+/************************************************/
+
+int bar24(int i)
+{
+    assert(i > 0);
+    foreach (v; Tuple!(57, 23, 8))
+    {
+        i <<= 1;
+        if (v == 23)
+            return i + 1;
+        i += v;
+    }
+    return i;
+}
+
+void test24()
+{
+    static b = bar24(7);
+    printf("b = %d, %d\n", b, bar24(7));
+    assert(b == 143);
+}
+
+/************************************************/
+
+int bar25(int i)
+{
+    assert(i > 0);
+    foreach_reverse (v; Tuple!(57, 23, 8))
+    {
+        i <<= 1;
+        if (v == 23)
+            break;
+        i += v;
+    }
+    return i;
+}
+
+void test25()
+{
+    static b = bar25(7);
+    printf("b = %d, %d\n", b, bar25(7));
+    assert(b == 44);
+}
+
+/************************************************/
+
+int bar26(int i)
+{
+    assert(i > 0);
+    foreach (v; Tuple!(57, 23, 8))
+    {
+        i <<= 1;
+        if (v == 23)
+            break;
+        i += v;
+    }
+    return i;
+}
+
+void test26()
+{
+    static b = bar26(7);
+    printf("b = %d, %d\n", b, bar26(7));
+    assert(b == 142);
+}
+
+/************************************************/
+
+int bar27(int i)
+{
+    foreach_reverse (v; Tuple!(57, 23, 8))
+    {
+        i <<= 1;
+        if (v == 23)
+            continue;
+        i += v;
+    }
+    return i;
+}
+
+void test27()
+{
+    static b = bar27(7);
+    printf("b = %d, %d\n", b, bar27(7));
+    assert(b == 145);
+}
+
+/************************************************/
+
+int bar28(int i)
+{
+    foreach (v; Tuple!(57, 23, 8))
+    {
+        i <<= 1;
+        if (v == 23)
+            continue;
+        i += v;
+    }
+    return i;
+}
+
+void test28()
+{
+    static b = bar28(7);
+    printf("b = %d, %d\n", b, bar28(7));
+    assert(b == 292);
+}
+
+/************************************************/
+
+int bar29(int i)
+{
+    switch (i)
+    {
+        case 1:
+            i = 4;
+            break;
+        case 7:
+            i = 3;
+            break;
+        default: assert(0);
+    }
+    return i;
+}
+
+void test29()
+{
+    static b = bar29(7);
+    printf("b = %d, %d\n", b, bar29(7));
+    assert(b == 3);
+}
+
+/************************************************/
+
+int bar30(int i)
+{
+    switch (i)
+    {
+        case 1:
+            i = 4;
+            break;
+        case 8:
+            i = 2;
+            break;
+        default:
+            i = 3;
+            break;
+    }
+    return i;
+}
+
+void test30()
+{
+    static b = bar30(7);
+    printf("b = %d, %d\n", b, bar30(7));
+    assert(b == 3);
+}
+
+/************************************************/
+
+int bar31(string s)
+{   int i;
+
+    switch (s)
+    {
+        case "hello":
+            i = 4;
+            break;
+        case "betty":
+            i = 2;
+            break;
+        default:
+            i = 3;
+            break;
+    }
+    return i;
+}
+
+void test31()
+{
+    static b = bar31("betty");
+    printf("b = %d, %d\n", b, bar31("betty"));
+    assert(b == 2);
+}
+
+/************************************************/
+
+int bar32(int i)
+{
+    switch (i)
+    {
+        case 7:
+            i = 4;
+            goto case;
+        case 5:
+            i = 2;
+            break;
+        default:
+            i = 3;
+            break;
+    }
+    return i;
+}
+
+void test32()
+{
+    static b = bar32(7);
+    printf("b = %d, %d\n", b, bar32(7));
+    assert(b == 2);
+}
+
+/************************************************/
+
+int bar33(int i)
+{
+    switch (i)
+    {
+        case 5:
+            i = 2;
+            break;
+        case 7:
+            i = 4;
+            goto case 5;
+        default:
+            i = 3;
+            break;
+    }
+    return i;
+}
+
+void test33()
+{
+    static b = bar33(7);
+    printf("b = %d, %d\n", b, bar33(7));
+    assert(b == 2);
+}
+
+/************************************************/
+
+int bar34(int i)
+{
+    switch (i)
+    {
+        default:
+            i = 3;
+            break;
+        case 5:
+            i = 2;
+            break;
+        case 7:
+            i = 4;
+            goto default;
+    }
+    return i;
+}
+
+void test34()
+{
+    static b = bar34(7);
+    printf("b = %d, %d\n", b, bar34(7));
+    assert(b == 3);
+}
+
+/************************************************/
+
+int bar35(int i)
+{
+  L1:
+    switch (i)
+    {
+        default:
+            i = 3;
+            break;
+        case 5:
+            i = 2;
+            break;
+        case 3:
+            return 8;
+        case 7:
+            i = 4;
+            goto default;
+    }
+    goto L1;
+}
+
+void test35()
+{
+    static b = bar35(7);
+    printf("b = %d, %d\n", b, bar35(7));
+    assert(b == 8);
+}
+
+/************************************************/
+
+int square36(int x)
+{
+    return x * x;
+}
+
+const int foo36 = square36(5);
+
+void test36()
+{
+    assert(foo36 == 25);
+}
+
+/************************************************/
+
+string someCompileTimeFunction()
+{
+    return "writefln(\"Wowza!\");";
+}
+
+void test37()
+{
+    mixin(someCompileTimeFunction());
+}
+
+/************************************************/
+
+string NReps(string x, int n)
+{
+    string ret = "";
+    for (int i = 0; i < n; i++)
+    {
+        ret ~= x;
+    }
+    return ret;
+}
+
+void test38()
+{
+    static x = NReps("3", 6);
+    assert(x == "333333");
+}
+
+/************************************************/
+
+bool func39() { return true; }
+
+static if (func39())
+{
+    pragma(msg, "true");
+}
+else
+{
+    pragma(msg, "false");
+}
+
+void test39()
+{
+}
+
+/************************************************/
+
+string UpToSpace(string x)
+{
+    int i = 0;
+    while (i < x.length && x[i] != ' ')
+    {
+        i++;
+    }
+    return x[0..i];
+}
+
+void test40()
+{
+    const y = UpToSpace("first space was after first");
+    writeln(y);
+    assert(y == "first");
+}
+
+/************************************************/
+
+int bar41(ref int j)
+{
+    return 5;
+}
+
+int foo41(int i)
+{
+    int x;
+    x = 3;
+    bar41(x);
+    return i + x;
+}
+
+void test41()
+{
+    const y = foo41(3);
+    writeln(y);
+    assert(y == 6);
+}
+
+/************************************************/
+
+int bar42(ref int j)
+{
+    return 5;
+}
+
+int foo42(int i)
+{
+    int x;
+    x = 3;
+    bar42(x);
+    return i + x;
+}
+
+void test42()
+{
+    const y = foo42(3);
+    writeln(y);
+    assert(y == 6);
+}
+
+/************************************************/
+
+int bar(string a)
+{
+    int v;
+    for (int i = 0; i < a.length; i++)
+    {
+        if (a[i] != ' ')
+        {
+            v += a.length;
+        }
+    }
+    return v;
+}
+
+void test43()
+{
+    const int foo = bar("a b c d");
+    writeln(foo);
+    assert(foo == 28);
+}
+
+/************************************************/
+
+string foo44() { return ("bar"); }
+
+void test44()
+{
+    const string bar = foo44();
+    assert(bar == "bar");
+}
+
+/************************************************/
+
+int square45(int n) { return (n * n); }
+
+void test45()
+{
+    int bar = eval!(square45(5));
+    assert(bar == 25);
+}
+
+/************************************************/
+
+const int foo46[5] = [0,1,2,3,4];
+
+void test46()
+{
+    writeln(eval!(foo46[3]));
+}
+
+/************************************************/
+
+string foo47()
+{
+    string s;
+    s = s ~ 't';
+    return s ~ "foo";
+}
+
+void test47()
+{
+    static const x = foo47();
+    pragma(msg, x);
+    assert(x == "tfoo");
+}
+
+/************************************************/
+
+string foo48()
+{
+    string s;
+    s = s ~ 't';
+    s = s.idup;
+    return s ~ "foo";
+}
+
+void test48()
+{
+    static const x = foo48();
+    pragma(msg, x);
+    assert(x == "tfoo");
+}
+
+/************************************************/
+
+dstring testd49(dstring input)
+{
+    if (input[3..5] != "rt")
+    {
+        return input[1..3];
+    }
+    return "my";
+}
+
+void test49()
+{
+    static x = testd49("hello");
+    writeln(x);
+    assert(x == "el");
+}
+
+/************************************************/
+
+string makePostfix50(int x)
+{
+    string first;
+    first = "bad";
+    if (x)
+    {
+        first = "ok";
+        makePostfix50(0);
+    }
+    return first;
+}
+
+void test50()
+{
+    static const char [] q2 = makePostfix50(1);
+    static assert(q2 == "ok", q2);
+}
+
+/************************************************/
+
+int exprLength(string s)
+{
+    int numParens=0;
+    for (int i = 0; i < s.length; ++i)
+    {
+        if (s[i] == '(') { numParens++; }
+        if (s[i] == ')') { numParens--; }
+        if (numParens == 0) { return i; }
+    }
+    assert(0);
+}
+
+string makePostfix51(string operations)
+{
+    if (operations.length < 2)
+        return "x";
+    int x = exprLength(operations);
+    string first="bad";
+    if (x > 0)
+    {
+        first = "ok";
+        string ignore = makePostfix51(operations[1..x]);
+    }
+    return first;
+}
+
+
+void test51()
+{
+    string q = makePostfix51("(a+b)*c");
+    assert(q == "ok");
+    static const string q2 = makePostfix51("(a+b)*c");
+    static assert(q2 == "ok");
+    static assert(makePostfix51("(a+b)*c") == "ok");
+}
+
+/************************************************/
+
+int foo52(ref int x)
+{
+    x = 7;
+    return 3;
+}
+
+int bar52(int y)
+{
+    y = 4;
+    foo52(y);
+    return y;
+}
+
+void test52()
+{
+    printf("%d\n", bar52(2));
+    static assert(bar52(2) == 7);
+}
+
+/************************************************/
+
+void bar53(out int x) { x = 2; }
+
+int foo53() { int y; bar53(y); return y; }
+
+void test53()
+{
+    const int z = foo53();
+    assert(z == 2);
+}
+
+/************************************************/
+
+void test54()
+{
+    static assert(equals54("alphabet", "alphabet"));
+}
+
+bool equals54(string a, string b)
+{
+    return (a == b);
+}
+
+/************************************************/
+
+const string foo55[2] = ["a", "b"];
+string retsth55(int i) { return foo55[i]; }
+
+void test55()
+{
+    writeln(eval!(foo55[0]));
+    writeln(eval!(retsth55(0)));
+}
+
+/************************************************/
+
+string retsth56(int i)
+{
+    static const string foo[2] = ["a", "b"];
+    return foo[i];
+}
+
+void test56()
+{
+    writeln(eval!(retsth56(0)));
+}
+
+/************************************************/
+
+int g57()
+{
+    pragma(msg, "g");
+    return 2;
+}
+
+const int a57 = g57();
+
+void test57()
+{
+    assert(a57 == 2);
+}
+
+/************************************************/
+
+int[] Fun58(int x)
+{
+    int[] result;
+    result ~= x + 1;
+    return result;
+}
+
+void test58()
+{
+    static b = Fun58(1) ~ Fun58(2);
+    assert(b.length == 2);
+    assert(b[0] == 2);
+    assert(b[1] == 3);
+    writeln(b);
+}
+
+/************************************************/
+
+int Index59()
+{
+    int[] data = [1];
+    return data[0];
+}
+
+void test59()
+{
+    static assert(Index59() == 1);
+}
+
+/************************************************/
+
+string[int] foo60()
+{
+    return [3:"hello", 4:"betty"];
+}
+
+void test60()
+{
+    static assert(foo60()[3] == "hello");
+    static assert(foo60()[4] == "betty");
+}
+
+/************************************************/
+
+string[int] foo61()
+{
+    return [3:"hello", 4:"betty", 3:"world"];
+}
+
+void test61()
+{
+    static assert(foo61()[3] == "world");
+    static assert(foo61()[4] == "betty");
+}
+
+/************************************************/
+
+string foo62(int k)
+{
+    string[int] aa;
+    aa = [3:"hello", 4:"betty"];
+    return aa[k];
+}
+
+void test62()
+{
+    static assert(foo62(3) == "hello");
+    static assert(foo62(4) == "betty");
+}
+
+/************************************************/
+
+void test63()
+{
+    static auto x = foo63();
+}
+
+int foo63()
+{
+    pragma(msg, "Crash!");
+    return 2;
+}
+
+/************************************************/
+
+dstring testd64(dstring input)
+{
+    debug int x = 10;
+    return "my";
+}
+
+void test64()
+{
+    static x = testd64("hello");
+}
+
+/************************************************/
+
+struct S65
+{
+    int i;
+    int j = 3;
+}
+
+int foo(S65 s1, S65 s2)
+{
+    return s1 == s2;
+}
+
+void test65()
+{
+    static assert(foo(S65(1, 5), S65(1, 5)) == 1);
+    static assert(foo(S65(1, 5), S65(1, 4)) == 0);
+}
+
+/************************************************/
+
+struct S66
+{
+    int i;
+    int j = 3;
+}
+
+int foo66(S66 s1)
+{
+    return s1.j;
+}
+
+void test66()
+{
+    static assert(foo66(S66(1, 5)) == 5);
+}
+
+/************************************************/
+
+struct S67
+{
+    int i;
+    int j = 3;
+}
+
+int foo67(S67 s1)
+{
+    s1.j = 3;
+    int i = (s1.j += 2);
+    assert(i == 5);
+    return s1.j + 4;
+}
+
+void test67()
+{
+    static assert(foo67(S67(1, 5)) == 9);
+}
+
+/************************************************/
+
+int foo68(int[] a)
+{
+    a[1] = 3;
+    int x = (a[0] += 7);
+    assert(x == 8);
+    return a[0] + a[1];
+}
+
+void test68()
+{
+    static assert(foo68( [1,5] ) == 11);
+}
+
+/************************************************/
+
+int foo69(char[] a)
+{
+    a[1] = 'c';
+    char x = (a[0] += 7);
+    assert(x == 'h');
+    assert(x == a[0]);
+    return a[0] + a[1] - 'a';
+}
+
+void test69()
+{
+    static assert(foo69(['a', 'b']) == 'j');
+}
+
+/************************************************/
+
+int foo70(int[string] a)
+{
+    a["world"] = 5;
+    auto x = (a["hello"] += 7);
+    assert(x == 10);
+    assert(x == a["hello"]);
+    return a["hello"] + a["betty"] + a["world"];
+}
+
+void test70()
+{
+    static assert(foo70(["hello":3, "betty":4]) == 19);
+}
+
+/************************************************/
+
+size_t foo71(int[string] a)
+{
+    return a.length;
+}
+
+void test71()
+{
+    static assert(foo71(["hello":3, "betty":4]) == 2);
+}
+
+/************************************************/
+
+string[] foo72(int[string] a)
+{
+    return a.keys;
+}
+
+void test72()
+{
+    static assert(foo72(["hello":3, "betty":4]) == ["hello", "betty"]);
+}
+
+/************************************************/
+
+int[] foo73(int[string] a)
+{
+    return a.values;
+}
+
+void test73()
+{
+    static assert(foo73(["hello":3, "betty":4]) == [3, 4]);
+}
+
+/************************************************/
+
+bool b74()
+{
+    string a = "abc";
+    return (a[$-1] == 'c');
+}
+
+const c74 = b74();
+
+void test74()
+{
+    assert(c74 == true);
+}
+
+/************************************************/
+
+struct FormatSpec
+{
+    uint leading;
+    bool skip;
+    uint width;
+    char modifier;
+    char format;
+    uint formatStart;
+    uint formatLength;
+    uint length;
+}
+
+FormatSpec GetFormat(string s)
+{
+    FormatSpec result;
+    return result;
+}
+
+FormatSpec GetFormat2(string s)
+{
+    FormatSpec result = FormatSpec();
+    result.length = 0;
+    assert(result.length < s.length);
+    while (result.length < s.length)
+    {
+        ++result.length;
+    }
+    return result;
+}
+
+void test75()
+{
+    static FormatSpec spec = GetFormat("asd");
+
+    assert(spec.leading == 0);
+    assert(spec.modifier == char.init);
+
+    static FormatSpec spec2 = GetFormat2("asd");
+    assert(spec2.length == 3);
+}
+
+/************************************************/
+
+int f76()
+{
+    int[3] a = void;
+    a[0] = 1;
+    assert(a[0] == 1);
+    return 1;
+}
+
+const i76 = f76();
+
+void test76()
+{
+}
+
+/************************************************/
+
+struct V77
+{
+    int a;
+    int b;
+}
+
+V77 f77()
+{
+    int q = 0;
+    int unused;
+    int unused2;
+    return V77(q, 0);
+}
+
+void test77()
+{
+    const w = f77();
+    const v = f77().b;
+}
+
+/************************************************/
+
+struct Bar78
+{
+    int x;
+}
+
+int foo78()
+{
+    Bar78 b = Bar78.init;
+    Bar78 c;
+    b.x = 1;
+    b = bar(b);
+    return b.x;
+}
+
+Bar78 bar(Bar78 b)
+{
+    return b;
+}
+
+void test78()
+{
+    static x = foo78();
+}
+
+/************************************************/
+
+struct Bar79
+{
+    int y,x;
+}
+
+int foo79()
+{
+    Bar79 b = Bar79.init;
+
+    b.x = 100;
+
+    for (size_t i = 0; i < b.x; i++) { }
+
+    b.x++;
+    b.x = b.x + 1;
+
+    return b.x;
+}
+
+void test79()
+{
+    static x = foo79();
+    printf("x = %d\n", x);
+    assert(x == 102);
+}
+
+/************************************************/
+
+void test80()
+{
+}
+
+/************************************************/
+
+string foo81()
+{
+    return "";
+}
+
+string rod81(string[] a)
+{
+    return a[0];
+}
+
+void test81()
+{
+    static x = rod81([foo81(), ""]);
+    assert(x == "");
+}
+
+
+/************************************************/
+
+struct S82
+{
+    string name;
+}
+
+const S82 item82 = {"item"};
+
+string mixItemList82()
+{
+    return item82.name;
+}
+
+const string s82 = mixItemList82();
+
+void test82()
+{
+    assert(s82 == "item");
+}
+
+/************************************************/
+
+struct S83
+{
+    string name;
+}
+
+const S83[] items83 =
+[
+    {"item"},
+];
+
+string mixItemList83()
+{
+    string s;
+    foreach (item; items83)
+        s ~= item.name;
+    return s;
+}
+
+const string s83 = mixItemList83();
+
+void test83()
+{
+    writeln(s83);
+    assert(s83 == "item");
+}
+
+/************************************************/
+
+struct S84 { int a; }
+
+int func84()
+{
+    S84 [] s = [S84(7)];
+    return s[0].a; // Error: cannot evaluate func() at compile time
+}
+
+void test84()
+{
+    const int x = func84();
+    assert(x == 7);
+}
+
+/************************************************/
+
+struct S85
+{
+    int a;
+}
+
+size_t func85()
+{
+    S85 [] s;
+    s ~= S85(7);
+    return s.length;
+}
+
+void test85()
+{
+    const size_t x = func85();
+    assert(x == 1);
+}
+
+/************************************************/
+
+struct Bar86
+{
+    int x;
+    char[] s;
+}
+
+char[] foo86()
+{
+    Bar86 bar;
+    return bar.s;
+}
+
+void test86()
+{
+    static x = foo86();
+    assert(x == null);
+}
+
+/************************************************/
+
+struct Bar87
+{
+    int x;
+}
+
+int foo87()
+{
+    Bar87 bar;
+    bar.x += 1;
+    bar.x++;
+    return bar.x;
+}
+
+void test87()
+{
+    static x = foo87();
+    assert(x == 2);
+}
+
+/************************************************/
+
+int foo88()
+{
+    char[] s;
+    int i;
+
+    if (s)
+    {
+        i |= 1;
+    }
+
+    if (s == null)
+    {
+        i |= 2;
+    }
+
+    if (s is null)
+    {
+        i |= 4;
+    }
+
+    if (s == "")
+    {
+        i |= 8;
+    }
+
+    if (s.length)
+    {
+        i |= 16;
+    }
+
+    if (s == ['c'][0..0])
+    {
+        i |= 32;
+    }
+
+
+    if (null == s)
+    {
+        i |= 64;
+    }
+
+    if (null is s)
+    {
+        i |= 128;
+    }
+
+    if ("" == s)
+    {
+        i |= 256;
+    }
+
+    if (['c'][0..0] == s)
+    {
+        i |= 512;
+    }
+
+    return i;
+}
+
+void test88()
+{
+    static x = foo88();
+    printf("x = %x\n", x);
+    assert(x == (2|4|8|32|64|128|256|512));
+}
+
+/************************************************/
+
+template Tuple89(T...)
+{
+    alias T val;
+}
+
+alias Tuple89!(int) Tup89;
+
+string gen89()
+{
+    foreach (i, type; Tup89.val)
+    {
+        assert(i == 0);
+        assert(is(type == int));
+    }
+    return null;
+}
+
+void test89()
+{
+    static const string text = gen89();
+    assert(text is null);
+}
+
+/************************************************/
+
+string bar90(string z)
+{
+    return z;
+}
+
+string foo90(string a, string b)
+{
+    string f = a.length == 1 ? a: foo90("B", "C");
+    string g = b.length == 1 ? b: bar90(foo90("YYY", "A"));
+    return  f;
+}
+
+void test90()
+{
+    static const string xxx = foo90("A", "xxx");
+    printf("%.*s\n", xxx.length, xxx.ptr);
+    assert(xxx == "A");
+}
+
+/************************************************/
+
+struct PR91
+{
+}
+
+int foo91()
+{
+    PR91 pr;
+    pr = PR91();
+    return 0;
+}
+
+void test91()
+{
+    static const i = foo91();
+}
+
+/************************************************/
+
+char find92(immutable(char)[7] buf)
+{
+    return buf[3];
+}
+
+
+void test92()
+{
+    static const pos = find92("abcdefg");
+    assert(pos == 'd');
+}
+
+/************************************************/
+
+static string hello93()
+{
+    string result = "";
+    int i = 0;
+    for (;;)
+    {
+        result ~= `abc`;
+        i += 1;
+        if (i == 3)
+            break;
+    }
+    return result;
+}
+
+void test93()
+{
+    static string s = hello93();
+    assert(s == "abcabcabc");
+}
+
+/************************************************/
+
+int foo94 (string[] list, string s)
+{
+    if (list.length == 0)
+        return 1;
+    else
+    {
+        return 2 + foo94(list[1..$], list[0]);
+    }
+}
+
+void test94()
+{
+    printf("test94\n");
+    static const int x = foo94(["a", "b"], "");
+    assert(x == 5);
+}
+
+/************************************************/
+
+char[] func95(immutable char[] s)
+{
+    char[] u = "".dup;
+    u ~= s;
+    u = u ~ s;
+    return u;
+}
+
+void test95()
+{
+    mixin(func95(";"));
+}
+
+/************************************************/
+
+char[] func96(string s)
+{
+    char[] u = "".dup;
+    u ~= s;
+    u = u ~ s;
+    return u;
+}
+
+void test96()
+{
+    mixin(func96(";"));
+}
+
+/************************************************/
+
+string foo97()
+{
+    string a;
+    a ~= "abc"; // ok
+    string[] b;
+    b ~= "abc"; // ok
+    string[][] c;
+    c ~= ["abc", "def"];
+    string[][] d = [];
+    d ~= ["abc", "def"]; // ok
+    return "abc";
+}
+
+void test97()
+{
+    static const xx97 = foo97();
+}
+
+/************************************************/
+
+immutable(int)[] foo98(immutable(int)[][] ss)
+{
+    immutable(int)[] r;
+    r ~= ss[0]; // problem here
+    return r;
+}
+
+void test98()
+{
+    const r = foo98([[1], [2]]);
+}
+
+/************************************************/
+
+struct Number
+{
+    public int value;
+    static Number opCall(int value)
+    {
+        Number n = void;
+        n.value = value;
+        return n;
+    }
+}
+
+class Crash
+{
+    Number number = Number(0);
+}
+
+void test99()
+{
+}
+
+/************************************************/
+
+int[] map100 = ([4:true, 5:true]).keys;
+bool[] foo100 = ([4:true, 5:true]).values;
+
+void test100()
+{
+}
+
+/************************************************/
+
+int foo101()
+{
+    immutable bool [int] map = [4:true, 5:true];
+    foreach (x; map.keys) {}
+    return 3;
+}
+
+static int x101 = foo101();
+
+void test101()
+{
+}
+
+/************************************************/
+
+int foo102()
+{
+    foreach (i; 0 .. 1)
+        return 1;
+    return 0;
+}
+static assert(foo102() == 1);
+
+int bar102()
+{
+    foreach_reverse (i; 0 .. 1)
+        return 1;
+    return 0;
+}
+static assert(bar102() == 1);
+
+void test102()
+{
+}
+
+/************************************************/
+
+int foo103()
+{
+    foreach (c; '0' .. '9') {  }
+    foreach_reverse (c; '9' .. '0') {  }
+    return 0;
+}
+
+enum x103 = foo103();
+
+void test103()
+{
+}
+
+/************************************************/
+
+struct S
+{
+    int x;
+    char y;
+}
+
+// Functions which should fail CTFE
+
+int badfoo()
+{
+    S[2] c;
+    int w = 4;
+    c[w].x = 6;  // array bounds error
+    return 7;
+}
+
+int badglobal = 1;
+
+int badfoo3()
+{
+    S[2] c;
+    c[badglobal].x = 6;  // global index error
+    return 7;
+}
+
+int badfoo4()
+{
+    static S[2] c;
+    c[0].x = 6;  // Cannot access static
+    return 7;
+}
+
+/+ // This doesn't compile at runtime
+int badfoo5()
+{
+    S[] c = void;
+    c[0].x = 6;  // c is uninitialized, and not a static array.
+    return 1;
+}
++/
+
+int badfoo6()
+{
+    S[] b = [S(7), S(15), S(56), S(12)];
+    b[-2..4] = S(17); // exceeding (negative) array bounds
+    return 1;
+}
+
+int badfoo7()
+{
+    S[] b = [S(7), S(15), S(56), S(12), S(67)];
+    S[] c = [S(17), S(4)];
+    b[1..4] = c[]; // slice mismatch in dynamic array
+    return 1;
+}
+
+int badfoo8()
+{
+    S[] b;
+    b[1..3] = [S(17), S(4)]; // slice assign to uninitialized dynamic array
+    return 1;
+}
+
+template Compileable(int z) { bool OK = true;}
+static assert(!is(typeof(Compileable!(badfoo()).OK)));
+static assert(!is(typeof(Compileable!(
+(){
+    S[] c;
+    return c[7].x;  // uninitialized error
+}()).OK
+)));
+static assert( is(typeof(Compileable!(0).OK)));
+static assert(!is(typeof(Compileable!(badfoo3()).OK)));
+static assert(!is(typeof(Compileable!(badfoo4()).OK)));
+//static assert(!is(typeof(Compileable!(badfoo5()).OK)));
+static assert(!is(typeof(Compileable!(badfoo6()).OK)));
+static assert(!is(typeof(Compileable!(badfoo7()).OK)));
+static assert(!is(typeof(Compileable!(badfoo8()).OK)));
+
+// Functions which should pass CTFE
+
+int goodfoo1()
+{
+    int[8] w;           // use static array in CTFE
+    w[] = 7;            // full slice assign
+    w[$ - 1] = 538;     // use of $ in index assignment
+    assert(w[6] == 7);
+    return w[7];
+}
+static assert(goodfoo1() == 538);
+
+int goodfoo2()
+{
+    S[4] w = S(101);    // Block-initialize array of structs
+    w[$ - 2].x = 917;   // use $ in index member assignment
+    w[$ - 2].y = 58;    // this must not clobber the prev assignment
+    return w[2].x;      // check we got the correct one
+}
+static assert(goodfoo2() == 917);
+
+static assert(is(typeof(Compileable!(
+(){
+    S[4] w = void;      // uninitialized array of structs
+    w[$ - 2].x = 217;   // initialize one member
+    return w[2].x;
+}()).OK
+)));
+
+int goodfoo4()
+{
+    S[4] b = [S(7), S(15), S(56), S(12)];   // assign from array literal
+    assert(b[3] == S(12));
+    return b[2].x - 55;
+}
+static assert(goodfoo4()==1);
+
+int goodfoo5()
+{
+    S[4] b = [S(7), S(15), S(56), S(12)];
+    b[0..2] = [S(2), S(6)];         // slice assignment from array literal
+    assert(b[3] == S(12));
+    assert(b[1] == S(6));
+    return b[0].x;
+}
+static assert(goodfoo5() == 2);
+static assert(goodfoo5() == 2);     // check for memory corruption
+
+int goodfoo6()
+{
+    S[6] b = void;
+    b[2..5] = [S(2), S(6), S(17)];  // slice assign to uninitialized var
+    assert(b[4] == S(17));
+    return b[3].x;
+}
+static assert(goodfoo6() == 6);
+
+int goodfoo7()
+{
+    S[8] b = void;
+    b[2..5] = S(217);   // slice assign to uninitialized var
+    assert(b[4] == S(217));
+    return b[3].x;
+}
+static assert(goodfoo7() == 217);
+
+int goodfoo8()
+{
+    S[] b = [S(7), S(15), S(56), S(12), S(67)];
+    b[2..4] = S(17);    // dynamic array block slice assign
+    assert(b[3] == S(17));
+    assert(b[4] == S(67));
+    return b[0].x;
+}
+static assert(goodfoo8() == 7);
+
+// --------- CTFE MEMBER FUNCTION TESTS --------
+struct Q
+{
+    int x;
+    char y;
+    int opAddAssign(int w)
+    {
+        x += w;
+        return x + w;
+    }
+    Q opSubAssign(int w)
+    {
+        x -= w;
+        version(D_Version2) { mixin("return this;"); } else { mixin("return *this;"); }
+    }
+    int boo()  { return 4; }
+    int coo()  { return x; }
+    int foo()  { return coo(); }
+    int doo(int a)
+    {
+        Q z = Q(a, 'x');
+        z.x += 5;
+        return z.coo() + 3 * x;
+    }
+    void goo(int z) { x = z; }
+    int hoo(int y, int z) { return y + z; }
+    void joo(int z)
+    {
+        x += z;
+    }
+}
+
+int memtest1()
+{
+    Q b = Q(15, 'a');
+    return b.hoo(3, 16);    // simple const function
+}
+
+static assert(memtest1() == 19);
+
+int memtest2()
+{
+    Q b = Q(15, 'x');
+    b.x -= 10;
+    return b.coo();
+}
+
+static assert(memtest2() == 5);
+
+int memtest3()
+{
+    Q b = Q(15, 'x');
+    b.x -= 10;
+    return b.foo();
+}
+
+static assert(memtest3() == 5);
+
+int memtest4()
+{
+    Q b = Q(12, 'x');
+    return b.doo(514);
+}
+static assert(memtest4() == 519 + 3 * 12);
+
+
+int memtest5()
+{
+    Q b = Q(132, 'x');
+    b.goo(4178);    // Call modifying member
+    return b.x;
+}
+static assert(memtest5() == 4178);
+
+int memtest6()
+{
+    Q q = Q(1);
+    q += 3;         // operator overloading
+    return q.x;
+}
+static assert(memtest6() == 4);
+
+static assert(!is(typeof(Compileable!(Q += 2).OK)));    // Mustn't cause segfault
+
+int memtest7()
+{
+    Q q = Q(57);
+    q -= 35;
+    return q.x;
+}
+
+static assert(memtest7() == 57 - 35);
+
+int memtest8()
+{
+    Q[3] w;
+    w[2].x = 17;
+    w[2].joo(6);    // Modify member of array
+    w[1].x += 18;
+    return w[2].coo();
+}
+
+static assert(memtest8() == 6 + 17);
+
+// --------- CTFE REF PASSING TESTS --------
+
+// Bugzilla 1950 - CTFE doesn't work correctly for structs passed by ref
+struct S1950
+{
+    int x;
+}
+
+int foo1950()
+{
+    S1950 s = S1950(5);     // explicitly initialized
+    bar1950(s);
+    return s.x;
+}
+
+void bar1950(ref S1950 w)
+{
+    w.x = 10;
+}
+
+static assert(foo1950() == 10); // OK <- Fails, x is 0
+
+int foo1950b()
+{
+    S1950 s;  // uninitialized
+    bar1950(s);
+    return s.x;
+}
+
+static assert(foo1950b() == 10); // OK <- Fails, x is 0
+
+
+// More extreme case, related to 1950
+
+void bar1950c(ref int w)
+{
+    w = 87;
+}
+
+int foo1950c()
+{
+    int[5] x;
+    x[] = 56;
+    bar1950c(x[1]);     // Non-trivial ref parameters
+    return x[1];
+}
+
+static assert(foo1950c() == 87);
+
+void bar1950d(ref int[] w)
+{
+    w[1..$] = 87;
+    w[0] += 15;
+}
+
+int foo1950d()
+{
+    int[] x = [1, 2, 3, 4, 5];
+    x[1..$] = 56;
+    bar1950d(x);    // Non-trivial ref parameters
+    assert(x[0] == 16);
+    return x[1];
+}
+
+static assert(foo1950d() == 87);
+
+// Nested functions
+int nested(int x)
+{
+    int y = 3;
+    int inner(int w)
+    {
+        int z = 2;
+        ++z;
+        y += w;
+        return x + 3;
+    }
+
+    int z = inner(14);
+    assert(y == 17);
+    inner(8);
+    assert(y == 17 + 8);
+    return z + y;
+}
+
+static assert(nested(7) == 17 + 8 + 10);
+static assert(nested(7) == 17 + 8 + 10);
+
+// Recursive nested functions
+
+int nested2(int x)
+{
+   int y = 3;
+   int inner(int w)
+    {
+        int z = 2;
+        ++z;
+        ++y;
+        if (w <= 1)
+            return x + 3;
+        else
+            return inner(w - 1);
+    }
+
+   int z = inner(14);
+   assert(y == 17);
+
+   inner(8);
+   assert(y == 17 + 8);
+   return z + y;
+}
+
+static assert(nested2(7) == 17 + 8 + 10);
+
+// 1605 D1 & D2. break in switch with goto breaks in ctfe
+int bug1605()
+{
+    int i = 0;
+    while (true)
+    {
+        goto LABEL;
+    LABEL:
+        if (i != 0)
+            return i;
+        i = 27;
+    }
+    assert(i == 27);
+    return 88; // unreachable
+}
+
+static assert(bug1605() == 27);
+
+// 2564. D2 only. CTFE: the index in a tuple foreach is uninitialized (bogus error)
+// NOTE: Beware of optimizer bug 3264.
+
+int bug2564()
+{
+    version(D_Version2) { mixin("enum int Q = 0;"); }else {mixin("int Q = 0;"); }
+    string [2] s = ["a", "b"];
+    assert(s[Q].dup == "a");
+    return 0;
+}
+
+static int bug2564b = bug2564();
+
+
+// 1461 D1 + D2. Local variable as template alias parameter breaks CTFE
+void bug1461()
+{
+    int x;
+    static assert(Gen1461!(x).generate() == null);
+}
+
+template Gen1461(alias A)
+{
+    string generate()
+    {
+        return null;
+    }
+}
+
+/************************************************/
+
+string foo104(string[] a...)
+{
+    string result = "";
+    foreach (s; a)
+        result ~= s;
+    return result;
+}
+
+mixin (foo104("int ", "x;"));
+
+/************************************************/
+
+struct SwineFlu
+{
+    int a;
+    int b;
+}
+
+struct Infection
+{
+    SwineFlu y;
+}
+
+struct IveGotSwineFlu
+{
+    Infection x;
+    int z;
+    int oink() { return x.y.a + 10; }
+}
+
+int quarantine()
+{
+    IveGotSwineFlu d;
+    return d.oink();
+}
+
+struct Mexico
+{
+    Infection x;
+    int z = 2;
+    int oink() { return z + x.y.b; }
+}
+
+int mediafrenzy()
+{
+    Mexico m;
+    return m.oink;
+}
+
+static assert(quarantine() == 10);
+static assert(mediafrenzy() == 2);
+
+/************************************************/
+
+int ctfeArrayTest(int z)
+{
+    int[] a = new int[z];
+    a[$ - 3] = 6;
+    assert(a.length == z);
+    return a[$ - 3];
+}
+static assert(ctfeArrayTest(15) == 6);
+
+/************************************************/
+
+char bugzilla1298()
+{
+    char [4] q = "abcd".dup;
+    char [4] r = ['a', 'b', 'c', 'd'];
+    assert(q == r);
+    q[0..2] = "xy";
+    q[2] += 3;
+    return q[2];
+}
+
+static assert(bugzilla1298() == 'f');
+
+int bugzilla1790(Types...)()
+{
+    foreach (T; Types)
+    {
+        ;
+    }
+    return 0;
+}
+
+const int bugs1790 = bugzilla1790!("")();
+
+char ctfeStrTest1()
+{
+    char [8] s = void;
+    s[2..4] = 'x';
+
+   assert(s.length == 8);
+   return s[3];
+}
+
+static assert(ctfeStrTest1() == 'x');
+
+//--------- DELEGATE TESTS ------
+
+// Function + delegate literals inside CTFE
+int delegtest1()
+{
+    assert(function int(int a){ return 7 + a; }(16) == 23);
+    return delegate int(int a){ return 7 + a; }(6);
+}
+
+int delegtest2()
+{
+    int innerfunc1()
+    {
+        return delegate int(int a){ return 7 + a; }(6);
+    }
+    int delegate() f = &innerfunc1;
+    return 3 * f();
+}
+
+int delegtest3()
+{
+    int function() f = &delegtest1;
+    return 3 * f();
+}
+
+struct DelegStruct
+{
+    int a;
+    int bar(int x) { return a + x; }
+}
+
+int delegtest4()
+{
+    DelegStruct s;
+    s.a = 5;
+    auto f = &s.bar;
+    return f(3);
+}
+
+alias int delegate(int) DelegType;
+
+// Test arrays of delegates
+int delegtest5()
+{
+    DelegStruct s;
+    s.a = 5;
+    DelegType[4] w;
+    w[] = &s.bar;
+    return w[2](3);
+}
+
+// Test arrays of structs of delegates
+struct FoolishStruct
+{
+    DelegType z;
+}
+
+int delegtest6()
+{
+    DelegStruct s;
+    s.a = 5;
+    FoolishStruct k[3];
+    DelegType u = &s.bar;
+    k[1].z = u;
+    return k[1].z(3);
+}
+
+static assert(delegtest1() == 13);
+static assert(delegtest2() == 39);
+static assert(delegtest3() == 39);
+static assert(delegtest4() == 8);
+static assert(delegtest5() == 8);
+static assert(delegtest6() == 8);
+
+// Function + delegate literals, module scope
+static assert(function int(int a){ return 17 + a; }(16) == 33);
+static assert(            (int a){ return  7 + a; }(16) == 23);
+
+// --- Test lazy ---
+int lazyTest1(lazy int y)
+{
+    return y + 1;
+}
+
+int lazyTest2(int x)
+{
+    return lazyTest1(x);
+}
+
+static assert(lazyTest1(7) == 8);
+static assert(lazyTest2(17) == 18);
+
+/************************************************/
+
+version(D_Version2)
+{
+// Bug 4020 and 4027 are D2 only
+
+struct PostblitCrash
+{
+    int x;
+    mixin("this(this) { ++x; }");
+}
+
+int bug4020()
+{
+    PostblitCrash f;
+    f.x = 3;
+    f = f;
+    f = f;
+    return f.x;
+}
+static assert(bug4020() == 5);
+
+string delegate() bug4027(string s)
+{
+    return { return s; };
+}
+
+// If it compiles, it must not generate wrong code on D2.
+static if (is(typeof((){ static const s = bug4027("aaa")(); }()))) {
+    static assert(bug4027("aaa")() == "aaa");
+    static assert(bug4027("bbb")() == "bbb");
+}
+}
+
+// ---
+
+void bug4004a(ref int a)
+{
+    assert(a == 7);
+    a += 3;
+}
+
+void bug4004b(ref int b)
+{
+    b = 7;
+    bug4004a(b);
+}
+
+int bug4004c()
+{
+    int offset = 5;
+    bug4004b(offset);
+    return offset;
+}
+
+static assert(bug4004c() == 10);
+
+// ---
+
+int bug4019()
+{
+    int[int] aa;
+    aa[1] = 2;
+    aa[4] = 6;
+    return aa[1] + aa[4];
+}
+static assert(bug4019() == 8);
+
+// ---
+
+string delegate() bug4029a()
+{
+    return { return "abc"[]; };
+}
+
+string bug4029()
+{
+   return bug4029a()();
+}
+
+static assert(bug4029() == "abc");
+
+/************************************************/
+
+int bug4078()
+{
+    int[] arr = new int[1];
+    return arr[0];
+}
+static assert(bug4078() == 0);
+
+int bug4052()
+{
+    int[] arr = new int[1];
+    int s;
+    foreach (x; arr)
+        s += x;
+    foreach (x; arr)
+        s += x * x;
+    return 4052;
+}
+static assert(bug4052() == 4052);
+
+int bug4252()
+{
+    char [] s = "abc".dup;
+    s[15] = 'd';    // Array bounds error
+    return 3;
+}
+
+static assert(!is(typeof(Compileable!(bug4252()))));
+
+size_t setlen1()
+{
+    int[] w = new int[4];
+    w[] = 7;
+    w.length = 6;
+    return 21 + w.length;
+}
+
+static assert(setlen1() == 27);
+
+size_t setlen2()
+{
+    int[] w;
+    w.length = 15;
+    assert(w[3] == 0);
+    w[2] = 8;
+    w[14] = 7;
+    w.length = 12;  // check shrinking
+    assert(w[2] == 8);
+    return 2 + w.length;
+}
+
+static assert(setlen2() == 14);
+
+/************************************************/
+
+int bug4257(ref int x)
+{
+    return 3;
+}
+
+int bug4257c(int x)
+{
+    return 3;
+}
+
+struct Struct4257
+{
+    int foo() { return 2; }
+}
+
+void bug4257b()
+{
+    int y;
+    static assert(!is(typeof(Compileable!(bug4257(y)))));
+    static assert(!is(typeof(Compileable!(bug4257c(y)))));
+    Struct4257 s;
+    static assert(!is(typeof(Compileable!(s.foo()))));
+}
+
+/************************************************/
+// 5117
+
+static int dummy5117 = test5117();
+
+int test5117()
+{
+    S5117 s;
+    s.change();
+    assert(s.value == 1);       // (7) succeeds
+
+    R5117 r;
+    r.s.change();
+    assert(r.s.value == 1);     // (11) fails, value == 0
+
+    return 0;
+}
+
+struct S5117
+{
+    int value;
+    void change() { value = 1; }
+}
+
+struct R5117
+{
+    S5117 s;
+}
+
+/************************************************/
+
+enum dummy5117b = test5117b();
+
+int test5117b()
+{
+    S5117b s;
+    getRef5117b(s).change();
+    assert(s.value == 1);     // fails, value == 0
+    return 0;
+}
+ref S5117b getRef5117b(ref S5117b s) { return s; }
+
+struct S5117b
+{
+    int value;
+    void change() { value = 1; }
+}
+
+/************************************************/
+// 6439
+
+struct A6439
+{
+    this(uint a, uint b)
+    {
+        begin = a;
+        end = b;
+    }
+    union
+    {
+        struct
+        {
+            uint begin, end;
+        }
+        uint[2] arr;
+    }
+}
+
+void test6439()
+{
+    enum y = A6439(10, 20);
+    A6439 y2 = A6439(10, 20);
+    assert(y2.begin == y.begin && y2.end == y.end);  //passes
+    assert(y.arr != [0,0]);
+    assert(y.arr == [10,20]);
+    assert(y.arr == y2.arr);
+}
+
+/************************************************/
+// from tests/fail_compilation/fail147
+
+static assert(!is(typeof(Compileable!(
+    (int i){
+        int x = void;
+        ++x; // used before initialization
+        return i + x;
+    }(3)
+))));
+
+// 6504 regression
+void test6504()
+{
+    for (int i = 0; i < 3; ++i)
+    {
+        char[] x2 = "xxx" ~ ['c'];
+        assert(x2[1] == 'x');
+        x2[1] = 'q';
+    }
+}
+
+// 8818 regression
+void test8818()
+{
+    static bool test()
+    {
+        string op1 = "aa";
+        string op2 = "b";
+        assert("b" >= "aa");
+        assert(op2 >= op1);
+        return true;
+    }
+    static assert(test());
+    assert(test());
+}
+
+/************************************************/
+
+struct Test104Node
+{
+    int val;
+    Test104Node* next;
+}
+
+Test104Node* CreateList(int[] arr)
+{
+    if (!arr.length)
+        return null;
+    Test104Node* ret = new Test104Node;
+    ret.val = arr[0];
+    ret.next = CreateList(arr[1..$]);
+    return ret;
+}
+
+const(Test104Node)* root = CreateList([1, 2, 3, 4, 5]);
+
+void test104()
+{
+    assert(root.val == 1);
+    assert(root.next.val == 2);
+    assert(root.next.next.val == 3);
+    assert(root.next.next.next.val == 4);
+    assert(root.next.next.next.next.val == 5);
+}
+
+/************************************************/
+
+interface ITest105a
+{
+    string test105a() const;
+}
+
+class Test105a : ITest105a
+{
+    char a;
+    int b;
+    char c = 'C';
+    int d = 42;
+    string test105a() const { return "test105a"; }
+}
+
+interface ITest105b
+{
+    string test105b() const;
+}
+
+class Test105b : Test105a, ITest105b
+{
+    char e;
+    int f;
+    this(char _e, int _f, char _a, int _b) pure
+    {
+        e = _e;
+        f = _f;
+        a = _a;
+        b = _b;
+    }
+    string test105b() const { return "test105b"; }
+}
+
+    const Test105b  t105b  = new Test105b('E', 88, 'A', 99);
+    const Test105a  t105a  = new Test105b('E', 88, 'A', 99);
+    const ITest105b t105ib = new Test105b('E', 88, 'A', 99);
+    const ITest105a t105ia = new Test105b('E', 88, 'A', 99);
+__gshared Test105b  t105gs = new Test105b('E', 88, 'A', 99);
+   shared Test105b  t105bs = new    shared(Test105b)('E', 88, 'A', 99);
+immutable Test105b  t105bi = new immutable(Test105b)('E', 88, 'A', 99);
+
+void test105()
+{
+    assert(t105b.a == 'A');
+    assert(t105b.b == 99);
+    assert(t105b.c == 'C');
+    assert(t105b.d == 42);
+    assert(t105b.e == 'E');
+    assert(t105b.f == 88);
+    assert(t105b.test105a() == "test105a");
+    assert(t105b.test105b() == "test105b");
+
+    assert(t105a.a == 'A');
+    assert(t105a.b == 99);
+    assert(t105a.c == 'C');
+    assert(t105a.d == 42);
+    assert(t105a.test105a() == "test105a");
+
+    assert(t105ia.test105a() == "test105a");
+    assert(t105ib.test105b() == "test105b");
+
+    assert(t105a.classinfo is Test105b.classinfo);
+    //t105b.d = -1;
+    //assert(t105b.d == -1);
+    //assert(t105a.d == 42);
+
+    assert(t105gs.a == 'A');
+    assert(t105gs.b == 99);
+    assert(t105gs.c == 'C');
+    assert(t105gs.d == 42);
+    assert(t105gs.e == 'E');
+    assert(t105gs.f == 88);
+    assert(t105gs.test105a() == "test105a");
+    assert(t105gs.test105b() == "test105b");
+
+    assert(t105bs.a == 'A');
+    assert(t105bs.b == 99);
+    assert(t105bs.c == 'C');
+    assert(t105bs.d == 42);
+    assert(t105bs.e == 'E');
+    assert(t105bs.f == 88);
+
+    assert(t105bi.a == 'A');
+    assert(t105bi.b == 99);
+    assert(t105bi.c == 'C');
+    assert(t105bi.d == 42);
+    assert(t105bi.e == 'E');
+    assert(t105bi.f == 88);
+    assert(t105bi.test105a() == "test105a");
+    assert(t105bi.test105b() == "test105b");
+}
+
+int bug9938()
+{
+    assert(t105ia.test105a() == "test105a");
+    return 1;
+}
+
+static assert(t105ia.test105a() == "test105a");
+static assert(bug9938());
+
+/************************************************/
+
+struct Test106
+{
+    Test106* f;
+    Test106* s;
+}
+
+Test106* ctfe106()
+{
+    auto s = new Test106;
+    auto s2 = new Test106;
+    s.f = s2;
+    s.s = s2;
+    assert(s.f is s.s);
+    return s;
+}
+
+const(Test106)* t106 = ctfe106();
+
+void test106()
+{
+    assert(t106.f is t106.s);
+}
+
+/************************************************/
+
+class Test107
+{
+    Test107 a;
+    Test107 b;
+
+    this()
+    {
+    }
+
+    this(int)
+    {
+        a = new Test107();
+        b = a;
+        assert(a is b);
+    }
+}
+
+const Test107 t107 = new Test107(1);
+
+void test107()
+{
+    assert(t107.a is t107.b);
+}
+
+/************************************************/
+
+/*
+interface Getter
+{
+    int getNum() const;
+}
+
+class Test108 : Getter
+{
+    int f;
+    this(int v) inout
+    {
+        f = v;
+    }
+
+    int getNum() const
+    {
+        return f;
+    }
+}
+
+enum const(Test108) t108 = new Test108(38);
+
+void test108()
+{
+    const Test108 obj = t108;
+    assert(obj.classinfo is Test108.classinfo);
+    assert(obj.f == 38);
+
+    const Getter iobj = t108;
+    assert(iobj.getNum() == 38);
+    assert((cast(Object)iobj).classinfo is Test108.classinfo);
+    assert(t108 is t108);
+}
+*/
+
+/***** Bug 5678 *********************************/
+
+/*
+struct Bug5678
+{
+    this(int) {}
+}
+
+enum const(Bug5678)* b5678 = new const(Bug5678)(0);
+
+void test5678()
+{
+    assert(b5678 is b5678);
+}*/
+
+/************************************************/
+
+class Test109C { this(){ this.c = this; } Test109C c; }
+const t109c = new Test109C();
+
+struct Test109S { this(int){ this.s = &this; } Test109S* s; }
+const t109s = new Test109S(0);
+pragma(msg, t109s); // Make sure there is no infinite recursion.
+
+void test109()
+{
+    assert(t109c.c is t109c);
+    assert(t109s.s is t109s);
+}
+
+/************************************************/
+
+struct Test110f { int f1; Test110s f2; }
+struct Test110s { this(int, int, int){} }
+auto test110 = [Test110f(1, Test110s(1, 2, 3))];
+
+/************************************************/
+// 9023
+
+bool test9023()
+{
+    string[][string] aas;
+    assert(aas.length == 0);
+    aas["a"] ~= "anything";
+    assert(aas.length == 1);
+    assert(aas["a"] == ["anything"]);
+    aas["a"] ~= "more";
+    assert(aas.length == 1);
+    assert(aas["a"] == ["anything", "more"]);
+
+    int[int] aan;
+    assert(aan.length == 0);
+    auto x = aan[0]++;
+    assert(x == 0);
+    assert(aan.length == 1);
+    assert(aan[0] == 1);
+
+    return true;
+}
+static assert(test9023());
+
+/************************************************/
+// 15817
+
+S[] split15817(S)(S s)
+{
+    size_t istart;
+    S[] result;
+
+    foreach (i, c ; s)
+        result ~= s[istart .. i];
+    return result;
+}
+
+int test15817()
+{
+    auto targets = `a1`.split15817;
+    uint[string] counts;
+    foreach (a; targets)
+        counts[a]++;
+    assert(counts == ["":1u, "a":1]);
+    return 1;
+}
+static assert(test15817());
+
+/************************************************/
+
+interface IBug9954
+{
+    string foo() const;
+}
+
+class Bug9954 : IBug9954
+{
+    string foo() const { return "hello"; }
+}
+
+IBug9954 makeIBug9954()
+{
+    return new Bug9954;
+}
+
+const IBug9954 b9954 = makeIBug9954();
+
+void test9954()
+{
+    assert(b9954.foo() == "hello");
+}
+
+/************************************************/
+// 10483
+
+struct Bug10483
+{
+    int val[3][4];
+}
+
+struct Outer10483
+{
+    Bug10483 p = Bug10483(67);
+}
+
+int k10483a = Outer10483.init.p.val[2][2];   // ICE(expression.c)
+
+void test10483()
+{
+    int k10483b = Outer10483.init.p.val[2][2]; // Segfault (backend/type.c)
+}
+
+/************************************************/
+
+struct S10669 { uint x; }
+
+static const S10669 iid0_10669 = S10669(0);
+
+class C10669
+{
+    static const S10669 iid1_10669 = S10669(1);
+};
+
+const S10669 IID0_10669 = iid0_10669;
+const S10669 IID1_10669 = C10669.iid1_10669;
+
+/************************************************/
+
+TypeInfo getTi()
+{
+    return typeid(int);
+}
+
+auto t112 = getTi();
+
+void test112()
+{
+    assert(t112.toString() == "int");
+}
+
+/************************************************/
+// 10687
+
+enum Foo10687 : uint { A, B, C, D, E }
+immutable uint[5][] m10687 = [[0, 1, 2, 3, 4]];
+
+void test10687()
+{
+    static immutable uint[5] a1 = [0, 1, 2, 3, 4];
+    auto   a2 = cast(immutable(Foo10687[5]))a1;
+    static a3 = cast(immutable(Foo10687[5]))a1;
+
+    auto   foos1 = cast(immutable(Foo10687[5][]))m10687;
+    static foos2 = cast(immutable(Foo10687[5][]))m10687;
+}
+
+/************************************************/
+
+void test113()
+{
+    import core.math;
+
+    static void compare(real a, real b)
+    {
+        writefln("compare(%30.30f, %30.30f);", a, b);
+        assert(fabs(a - b) < 128 * real.epsilon);
+    }
+
+    static if (__traits(compiles, (){ enum real ctval1 = yl2x(3.14, 1); }))
+    {
+        enum real ctval1 = yl2x(3.14, 1);
+        enum real ctval2 = yl2x(2e1500L, 3);
+        enum real ctval3 = yl2x(1, 5);
+
+        real rtval1 = yl2x(3.14, 1);
+        real rtval2 = yl2x(2e1500L, 3);
+        real rtval3 = yl2x(1, 5);
+
+        compare(ctval1, rtval1);
+        compare(ctval2, rtval2);
+        compare(ctval3, rtval3);
+    }
+
+    static if (__traits(compiles, (){ enum real ctval4 = yl2xp1(3.14, 1); }))
+    {
+        enum real ctval4 = yl2xp1(3.14, 1);
+        enum real ctval5 = yl2xp1(2e1500L, 3);
+        enum real ctval6 = yl2xp1(1, 5);
+
+        real rtval4 = yl2xp1(3.14, 1);
+        real rtval5 = yl2xp1(2e1500L, 3);
+        real rtval6 = yl2xp1(1, 5);
+
+        compare(ctval4, rtval4);
+        compare(ctval5, rtval5);
+        compare(ctval6, rtval6);
+    }
+}
+
+/************************************************/
+// 14140
+
+struct S14140
+{
+    union
+    {
+        float[3][1] A;
+        float[3] flat;
+    }
+
+    this(in float[] args...)
+    {
+        flat[] = args[];
+    }
+}
+
+class C14140
+{
+    union
+    {
+        float[3][1] A;
+        float[3] flat;
+    }
+
+    this(in float[] args...)
+    {
+        flat[] = args[];
+    }
+}
+
+immutable s14140 = S14140(0, 1, 0);
+const c14140 = new C14140(0, 1, 0);
+
+void test14140()
+{
+    auto s = s14140;
+    assert(s.flat == [0, 1, 0]);
+
+    auto c = c14140;
+    assert(c.flat == [0, 1, 0]);
+}
+
+/************************************************/
+// 15681
+
+void test15681()
+{
+    static struct A { float value; }
+
+    static struct S
+    {
+        A[2] values;
+
+        this(float)
+        {
+            values[0].value = 0;
+            values[1].value = 1;
+        }
+    }
+
+    auto s1 = S(1.0f);
+    assert(s1.values[0].value == 0);        // OK
+    assert(s1.values[1].value == 1);        // OK
+
+    enum s2 = S(1.0f);
+    static assert(s2.values[0].value == 0); // OK <- NG
+    static assert(s2.values[1].value == 1); // OK
+    assert(s2.values[0].value == 0);        // OK <- NG
+    assert(s2.values[1].value == 1);        // OK
+}
+
+/************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test56();
+    test57();
+    test58();
+    test59();
+    test60();
+    test61();
+    test62();
+    test63();
+    test64();
+    test65();
+    test66();
+    test67();
+    test68();
+    test69();
+    test70();
+    test71();
+    test72();
+    test73();
+    test74();
+    test75();
+    test76();
+    test77();
+    test78();
+    test79();
+    test80();
+    test81();
+    test82();
+    test83();
+    test84();
+    test85();
+    test86();
+    test87();
+    test88();
+    test89();
+    test90();
+    test91();
+    test92();
+    test93();
+    test94();
+    test95();
+    test96();
+    test97();
+    test98();
+    test99();
+    test100();
+    test101();
+    test102();
+    test103();
+    test104();
+    test105();
+    test106();
+    test107();
+    //test108();
+    test109();
+    test112();
+    test113();
+    test6439();
+    test6504();
+    test8818();
+    test9023();
+    test15817();
+    test9954();
+    test14140();
+    test15681();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/interpret2.d b/gcc/testsuite/gdc.test/runnable/interpret2.d
new file mode 100644
index 00000000000..38242a7f3ef
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/interpret2.d
@@ -0,0 +1,148 @@
+
+//import std.stdio;
+extern(C) int printf(const char*, ...);
+
+template Tuple(A...)
+{
+    alias A Tuple;
+}
+
+template eval(A...)
+{
+    const typeof(A[0]) eval = A[0];
+}
+
+/************************************************/
+
+int foo1()
+{
+    int x;
+    foreach (i; 0 .. 10)
+        x += i;
+    return x;
+}
+
+int bar1()
+{
+    int x;
+    foreach_reverse (i; 0 .. 10)
+    {
+        x <<= 1;
+        x += i;
+    }
+    return x;
+}
+
+void test1()
+{
+    const y = foo1();
+    //writeln(y);
+    assert(y == 45);
+
+    auto y1 = foo1();
+    //writeln(y1);
+    assert(y1 == 45);
+
+    const z = bar1();
+    //writeln(z);
+    assert(z == 8194);
+
+    auto z1 = bar1();
+    //writeln(z1);
+    assert(z1 == 8194);
+}
+
+/***** Bug 2850 *********************************/
+
+/* These tests are not passing, and shouldn't pass. A non-first field in a union
+being initialized cannot be converted to an expression, at least not until there are
+improvements to StructLiterals.
+ */
+
+version (none)
+{
+struct Bug2850
+{
+    union
+    {
+        int c;
+        double d;
+    }
+    int b;
+    int a;
+}
+
+static assert(is(typeof(
+ () { enum Bug2850 w = {b:47, 714, d:4}; return w; }
+)));
+static assert(is(typeof(
+ () { enum Bug2850 w = {b:47, d:4}; return w; }
+)));
+// union not initialized
+static assert(!is(typeof(
+ () { enum Bug2850 w = {b:47, 4}; return w; }
+)));
+// initializers for two fields in same union
+static assert(!is(typeof(
+ () { enum Bug2850 w = {b:47, 4, c:5, 9}; return w; }
+)));
+
+enum Bug2850 test2850 = {b:47, 714, d:23.1e-17};
+
+struct Horrid2850
+{
+    union
+    {
+        int a;
+        int b;
+        struct
+        {
+            int c;
+            int d;
+        }
+    }
+    int f;
+    double q;
+}
+
+enum Horrid2850 horrid2850 = {c:5,6};
+Horrid2850 m2850 = {47, f:6};
+Horrid2850 z2850 = {q:5, c:4, d:5};
+
+static assert(!is(typeof(
+ () { enum Horrid2850 w = {c:47, d:5, a:7}; return w; }
+)));
+
+void test2()
+{
+    assert(test2850.a == 714);
+    assert(test2850.b == 47);
+    assert(test2850.d == 23.1e-17);
+    assert(test2850.c != 0);
+}
+}
+
+/***** Bug 3779 *********************************/
+
+static const bug3779 = ["123"][0][$-1];
+
+/***** Bug 1880 *********************************/
+
+
+enum Property1880 {First=1,Second=2}
+
+struct CompileTimeCheck1880(Property1880 Prop)
+{
+    alias Prop prop;
+}
+Property1880 junkprop1880;
+static assert(!is(CompileTimeCheck1880!(junkprop1880)));
+
+int main()
+{
+    test1();
+//    test2();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/issue8671.d b/gcc/testsuite/gdc.test/runnable/issue8671.d
new file mode 100644
index 00000000000..f9fa013e918
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/issue8671.d
@@ -0,0 +1,5 @@
+import std.random;
+void main()
+{
+    double t = 1.0 - uniform(0.0, 1.0);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/lazy.d b/gcc/testsuite/gdc.test/runnable/lazy.d
new file mode 100644
index 00000000000..334627fcbae
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/lazy.d
@@ -0,0 +1,289 @@
+import core.vararg;
+import std.stdio;
+
+/*********************************************************/
+
+void ifthen(bool cond, lazy void dg)
+{
+    if (cond)
+        dg();
+}
+
+void ifthen(bool cond, lazy void dgthen, lazy void dgelse)
+{
+    if (cond)
+        dgthen();
+    else
+        dgelse();
+}
+
+void dotimes(int i, lazy int dg)
+{
+    for (int j = 0; j < i; j++)
+        dg();
+}
+
+void switcher(bool delegate()[] cases...)
+{
+    foreach (c; cases)
+    {
+        if (c())
+            break;
+    }
+}
+
+bool scase(bool b, lazy void dg)
+{
+    if (b)
+    {
+        dg();
+        return true;
+    }
+    return false;
+}
+
+bool sdefault(lazy void dg)
+{
+    dg();
+    return true;
+}
+
+void whiler(lazy bool cond, lazy void bdy)
+{
+    while (cond())
+        bdy();
+}
+
+void test1()
+{
+    int x = 3;
+    dotimes(5, printf("%d\n", ++x));
+
+    ifthen(true, printf("yes\n"));
+    ifthen(false, printf("no\n"));
+
+    ifthen(true, printf("yes\n"), printf("no\n"));
+    ifthen(false, printf("yes\n"), printf("no\n"));
+
+    int v = 2;
+    switcher(
+        scase(v == 1, printf("it is 1\n")),
+        scase(v == 2, printf("it is 2\n")),
+        scase(v == 3, printf("it is 3\n")),
+        sdefault( printf("it is default\n"))
+    );
+
+    whiler( x < 100,
+        (printf("%d\n", x), x *= 2)
+    );
+}
+
+/*********************************************************/
+
+void fooa(lazy void dg)
+{
+    dg();
+}
+
+void test2()
+{
+    fooa(cast(void)null);
+}
+
+/*********************************************************/
+
+void dotimes3(int count, lazy void exp)
+{
+    for (int i = 0; i < count; i++)
+       exp;
+}
+
+void bar3(...)
+{
+    assert(_arguments.length == 1);
+    assert(va_arg!int(_argptr) == 14);
+}
+
+void abc3(int* p)
+{
+    writeln(*p);
+    assert(*p == 3);
+}
+
+void test3()
+{
+    int x = 3;
+    dotimes3(10, abc3(&x));
+    dotimes3(10, write(++x));
+    writeln();
+    dotimes3(1, bar3(++x));
+
+    int[10] a = new int[10];
+    a[0] = 1;
+    a[$ - 1] = 9;
+    dotimes3(3, write(a[0..$]));
+    writeln();
+}
+
+/*********************************************************/
+
+int p4;
+
+void foo4(void* delegate()[] dgs...)
+{
+    assert(dgs.length == 4);
+    writefln("%s %s", dgs[0](), cast(void*)&p4);
+    assert(dgs[0]() == cast(void*)&p4);
+    assert(dgs[1]() == cast(void*)&p4);
+    assert(dgs[2]() == null);
+    assert(dgs[3] == null);
+}
+
+void test4()
+{
+    void *abc()
+    {
+        writeln(cast(void*)&p4);
+        return cast(void*)&p4;
+    }
+
+    foo4(&abc, cast(void* delegate())&abc, null, cast(void* delegate())null);
+}
+
+/*********************************************************/
+
+bool nextis(void delegate() dgpositive = {})
+{
+    return true;
+}
+
+bool looping(lazy bool condition)
+{
+    return true;
+}
+
+void test5()
+{
+    looping(nextis({}));
+    looping(nextis({}));
+}
+
+/*********************************************************/
+
+void foo6(lazy int expr, ...)
+{
+    char[] tmp_msg = va_arg!(char[])(_argptr);
+    if (cast(int)(tmp_msg.ptr)=="food_for_thought".length)
+         assert(0, "length is in the pointer!");
+    assert(tmp_msg=="food_for_thought");
+}
+
+int bar6() { return 3; }
+
+void test6()
+{
+    foo6(bar6(),"food_for_thought");
+}
+
+/*********************************************************/
+
+void foo7(long delegate()[] dg...)
+{
+    assert(dg[0]() == 1024);
+    assert(dg[1]() == 1024);
+}
+
+void bar7(lazy long n)
+{
+    assert(n == 1024);
+}
+
+void test7()
+{
+    int n = 1024;
+    foo7(n, n);
+    bar7(n);
+}
+
+/*********************************************************/
+
+struct Bug5750 { int a, b; }
+pure Bug5750 bug5750(lazy int y) {
+    Bug5750 retval;
+    retval.a = y;
+    retval.b = y;
+    return retval;
+}
+
+pure void test5750a() {
+    auto z1 = bug5750(3);
+    assert(z1 == Bug5750(3, 3));
+    auto z2 = bug5750(z1.a);
+    assert(z2 == Bug5750(3, 3));
+    auto z3 = bug5750(z1.a+z2.a+3);
+    assert(z3 == Bug5750(9, 9));
+    auto z4 = bug5750(++z1.a);    // expected???
+    assert(z4 == Bug5750(4, 5));
+    assert(z1 == Bug5750(5, 3));
+}
+
+int bug5750Global = 7;
+void test5750b() {
+    auto z4 = bug5750(bug5750Global);
+    assert(z4 == Bug5750(7, 7));
+    auto z5 = bug5750(++bug5750Global);
+    assert(z5 == Bug5750(8, 9));  // expected???
+    assert(bug5750Global == 9);
+}
+// Note: also need to make up some fail-compilation tests.
+
+/*********************************************************/
+
+T calcLazy6682(T)(lazy T n)
+{
+    return n;
+}
+int purefunc6682() pure
+{
+    return calcLazy6682(1);
+}
+void test6682()
+{
+    assert(purefunc6682() == 1);
+}
+
+/*********************************************************/
+// 9109
+
+void test9109()
+{
+    void foo(int delegate()[] dgs ...)
+    {
+        assert(dgs[0]() + dgs[1]() == 1 + 13);
+    }
+
+    int x = 10;
+    int delegate() dg;
+    foo({ return 1; }, { return 3+x; }, dg, null);
+}
+
+/*********************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+
+    test5750a();
+    test5750b();
+    test6682();
+    test9109();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/ldc_github_1677.d b/gcc/testsuite/gdc.test/runnable/ldc_github_1677.d
new file mode 100644
index 00000000000..77e58e1b4ff
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ldc_github_1677.d
@@ -0,0 +1,29 @@
+interface IBar(T)
+{
+    IFoo!T ownerDocument();
+}
+
+interface IFoo(T): IBar!T
+{
+    // un-commenting the following line solves the issue
+    //IList!T getList();
+}
+
+interface IList(T) {}
+
+class DOMImplementation(T)
+{
+    class BarImpl: IBar!T
+    {
+        FooImpl ownerDocument() { return null; }
+    }
+    class FooImpl: BarImpl, IFoo!T
+    {
+        IList!T getList() { return null; }
+    }
+}
+
+void main()
+{
+    auto impl = new DOMImplementation!string();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/lexer.d b/gcc/testsuite/gdc.test/runnable/lexer.d
new file mode 100644
index 00000000000..c16d7b3e240
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/lexer.d
@@ -0,0 +1,91 @@
+// REQUIRED_ARGS:
+
+
+/*********************************************************/
+
+void test6()
+{
+    string s = q"(foo(xxx))";
+    assert(s == "foo(xxx)");
+
+    s = q"[foo[xxx]]";
+    assert(s == "foo[xxx]");
+
+    s = q"{foo{xxx}}";
+    assert(s == "foo{xxx}");
+
+    s = q"<foo<xxx>>";
+    assert(s == "foo<xxx>");
+
+    s = q"[foo(]";
+    assert(s == "foo(");
+
+    s = q"/foo]/";
+    assert(s == "foo]");
+
+
+    s = q"HERE
+foo
+HERE";
+    //writefln("'%s'", s);
+    assert(s == "foo\n");
+
+
+    s = q{ foo(xxx) };
+    assert(s ==" foo(xxx) ");
+
+    s = q{foo(};
+    assert(s == "foo(");
+
+    s = q{{foo}/*}*/};
+    assert(s == "{foo}/*}*/");
+
+    s = q{{foo}"}"};
+    assert(s == "{foo}\"}\"");
+}
+
+/*********************************************************/
+
+void test7()
+{
+//    auto str = \xDB;
+//    assert(str.length == 1);
+}
+
+/*********************************************************/
+// 4633
+
+template Types(alias v)
+{
+    alias typeof(v) Types;
+}
+
+typeof({return 1;}()) a; // ok
+Types!({return 1;}()) x; // ok
+
+void test8()
+{
+    typeof({return 1;}()) b;
+    Types!({return 1;}()) y;
+}
+
+/*********************************************************/
+
+// bug 6584
+version(9223372036854775807){}
+debug(9223372036854775807){}
+
+/*********************************************************/
+
+enum e13102=184467440737095516153.6L;
+
+/*********************************************************/
+
+int main()
+{
+    test6();
+    test7();
+    test8();
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link10425.d b/gcc/testsuite/gdc.test/runnable/link10425.d
new file mode 100644
index 00000000000..95faf6f03da
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link10425.d
@@ -0,0 +1,22 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/bug10425.d
+
+import imports.bug10425;
+
+void main()
+{
+    auto ti = typeid(A!());
+    /* Today, taking TypeInfo object address by using `typeid` always generates
+     * the TypeInfo object on comdat section (done by TypeInfoDeclaration::toObjFile),
+     * even if the associated struct belongs *non-root modules*.
+     *
+     * And, from 2.062, issue 7511 is implemented.
+     * The attribute inference for member functions in instantiated struct may modify
+     * their actual mangled names. Then TypeInfo object compiled in this module would
+     * use wrong symbol names, to link non-template opEquals/opCmp/toHash/toString
+     * member functions.
+     *
+     * To fix the issue, we should run semantic3 to calculate the correct symbol names
+     * of the specific member functions.
+     */
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link10920.d b/gcc/testsuite/gdc.test/runnable/link10920.d
new file mode 100644
index 00000000000..29f3a47f44f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link10920.d
@@ -0,0 +1,19 @@
+// PERMUTE_ARGS: -version=A
+
+// It's imported but won't be linked.
+import imports.link10920a;
+
+void main()
+{
+    BitArray ba;
+    version(A)
+    {
+        // Run semantic3 of BitArray.toString()
+        // before the FormatSpec instantiation in main().
+        pragma(msg, typeof(ba.toString()));
+    }
+
+    // The instance codegen should be run always, unrelated with -version=A.
+    FormatSpec!char fs;
+    fs.func();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link11069a.d b/gcc/testsuite/gdc.test/runnable/link11069a.d
new file mode 100644
index 00000000000..01b923e7497
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link11069a.d
@@ -0,0 +1,13 @@
+// REQUIRED_ARGS: -noboundscheck
+// <-- To remove necessity of _D7imports13std11069array7__arrayZ
+
+class Bar
+{
+    import imports.std11069container;
+
+    BinaryHeap!(Foo[]) Heap;
+
+    struct Foo {}
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/runnable/link11069b.d b/gcc/testsuite/gdc.test/runnable/link11069b.d
new file mode 100644
index 00000000000..a6253504f98
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link11069b.d
@@ -0,0 +1,15 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/link11069x.d imports/link11069y.d imports/link11069z.d
+
+import imports.link11069y;
+import imports.link11069z;
+
+void foo()
+{
+    Vector2 rsm;
+    readWriteVariable(rsm);
+}
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link11127.d b/gcc/testsuite/gdc.test/runnable/link11127.d
new file mode 100644
index 00000000000..0ce963d2859
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link11127.d
@@ -0,0 +1,6 @@
+import imports.link11127a;
+
+void main()
+{
+    cycle([1, 2]);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link11395.d b/gcc/testsuite/gdc.test/runnable/link11395.d
new file mode 100644
index 00000000000..fe25be1ab7f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link11395.d
@@ -0,0 +1,13 @@
+// EXTRA_SOURCES: imports/link11395a.d
+// PERMUTE_ARGS:
+// COMPILE_SEPARATELY
+module link11395;
+import imports.link11395a;
+
+void main()
+{
+    SB s;
+    SB[] a;
+
+    a ~= s;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link11931.d b/gcc/testsuite/gdc.test/runnable/link11931.d
new file mode 100644
index 00000000000..4bd5b128f55
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link11931.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -g
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: imports/test11931a.d
+// EXTRA_SOURCES: imports/test11931b.d
+// EXTRA_SOURCES: imports/test11931c.d
+// EXTRA_SOURCES: imports/test11931d.d
+// COMPILE_SEPARATELY: -g
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link12010.d b/gcc/testsuite/gdc.test/runnable/link12010.d
new file mode 100644
index 00000000000..41fa719f799
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link12010.d
@@ -0,0 +1,7 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/a12010.d imports/std12010container.d
+// REQUIRED_ARGS: -release
+// -release is necessary to avoid __assert.
+
+import imports.a12010;
+void main() {}
diff --git a/gcc/testsuite/gdc.test/runnable/link12037.d b/gcc/testsuite/gdc.test/runnable/link12037.d
new file mode 100644
index 00000000000..ce5b17ff5e3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link12037.d
@@ -0,0 +1,8 @@
+import imports.a12037;
+
+alias CustomFloat!(10, 5) Float16;
+
+void main()
+{
+    Float16 f = 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link12144.d b/gcc/testsuite/gdc.test/runnable/link12144.d
new file mode 100644
index 00000000000..90925563e15
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link12144.d
@@ -0,0 +1,20 @@
+// COMPILE_SEPARATELY: -g
+// EXTRA_SOURCES: imports/link12144a.d
+
+import imports.link12144a;
+
+void main()
+{
+    fun();
+}
+
+struct A12146
+{
+    B12146[] tokens;
+    // implicitly generated
+    //   bool opEquals(const ref Appender rhs) const
+    // will make
+    //   tokens == rhs.tokens
+    // references TypeInfo of B12146
+    // and it references __xopCmp
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link13043.d b/gcc/testsuite/gdc.test/runnable/link13043.d
new file mode 100644
index 00000000000..296907442ab
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link13043.d
@@ -0,0 +1,5 @@
+// PERMUTE_ARGS: -g -inline -version=bug -release -O
+
+import imports.link13043a;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/runnable/link13350.d b/gcc/testsuite/gdc.test/runnable/link13350.d
new file mode 100644
index 00000000000..bceb4b8586b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link13350.d
@@ -0,0 +1,139 @@
+extern (C) int printf(const(char*) fmt, ...);
+
+static int foo();
+
+/**********************************/
+
+auto red()()
+{
+    return foo();
+}
+
+void test13350()
+{
+    int[] data;
+    assert(is(typeof(red())));
+}
+
+/**********************************/
+
+struct A1(T) { void f1() {} }
+struct B1(T) { void f2() {} }
+
+A1!(B1!int) func1()() { return typeof(return).init; }
+
+void test1()
+{
+    static if (is(typeof(func1()) R : X!(Y), alias X, Y))
+    {
+        R.init.f1();
+        Y.init.f2();
+    }
+    else
+        static assert(0);
+}
+
+/**********************************/
+
+struct A2(T) { void f1() { foo(); } }
+struct B2(T) { void f2() { foo(); } }
+
+A2!(B2!int) func2()() { return typeof(return).init; }
+
+void test2()
+{
+    static if (is(typeof(func2())))
+    {
+    }
+    else
+        static assert(0);
+}
+
+/**********************************/
+
+template A3() { void foo() { B3!().bar(); } }
+template B3() { void bar() {} }
+
+void test3()
+{
+    // A3!() and B3!() are marked as 'speculative'
+    static assert(is(typeof(A3!().foo())));
+
+    // A3!() is unspeculative, but B3!() isn't.
+    A3!().foo();
+
+    // in codegen phase, B3!() will generate its members, because
+    // the tinst chain contains unspeculative instance A3!().
+}
+
+/**********************************/
+
+struct S4(T)
+{
+    string toString() const { return "instantiated"; }
+}
+
+void test4()
+{
+    // inside typeof is not speculative context
+    alias X = typeof(S4!int());
+    assert(typeid(X).xtoString !is null);
+}
+
+/**********************************/
+
+struct S5(T)
+{
+    string toString() const { return "instantiated"; }
+}
+
+void test5()
+{
+    enum x = S5!int();
+    assert(x.toString() == "instantiated");
+}
+
+/**********************************/
+
+int foo6()() { return 0; }
+
+template A6() { alias f = foo6!(); }
+void testa6()() if (is(typeof(A6!().f))) {}
+
+template B6() { alias f = foo6!(); }
+void testb6()() if (is(typeof(B6!().f))) {}
+
+template C6() { void f() { B6!().f(); } }
+
+void test6()
+{
+    testa6();
+    // foo6!() is speculatively instantiated from A6!() [TemplateInstance a]
+    // -> foo6!() is instantiated in A6!(), so it should be inserted to the members of this module.
+
+    testb6();
+    // foo6!() is speculatively instantiated from B6!() [TemplateInstance b],
+    // but the tinst of cached [TemplateInstance a] is not changed.
+    // -> insert [b] to the tnext chain of [a]
+
+    C6!().f();
+    // foo6!() is used through C6!(), so it should be linked to the final executable.
+    // but its first instance does not link to any non-speculative instances.
+    // -> look for tnext chain and determine its codegen is really necessary.
+}
+
+/**********************************/
+
+int main()
+{
+    test13350();
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link13394.d b/gcc/testsuite/gdc.test/runnable/link13394.d
new file mode 100644
index 00000000000..aea86862a65
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link13394.d
@@ -0,0 +1,13 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/link13394a.d
+
+module link13394;
+import imports.link13394a;
+
+void main()
+{
+    auto b = new B();
+
+    auto s = S();
+    s.func();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link13400.d b/gcc/testsuite/gdc.test/runnable/link13400.d
new file mode 100644
index 00000000000..fbb9ec7574e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link13400.d
@@ -0,0 +1,13 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/link13400a.d
+
+import imports.link13400a;
+
+void main()
+{
+    BigInt r;
+
+    // This comparison will instantiate BigInt.opEquals!().opEquals(const BigInt y) const pure again.
+    // But here is non-speculative context, so this module compilation should generate its objcode.
+    bool b = r == BigInt("2");  // comparison with rvalue
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link13415.d b/gcc/testsuite/gdc.test/runnable/link13415.d
new file mode 100644
index 00000000000..00b39d1e8d6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link13415.d
@@ -0,0 +1,11 @@
+// EXTRA_SOURCES: imports/link13415a.d
+// REQUIRED_ARGS: -inline
+// PERMUTE_ARGS: -allinst -unittest -debug
+// COMPILE_SEPARATELY
+
+import imports.link13415a;
+
+void main()
+{
+    f();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link13843.d b/gcc/testsuite/gdc.test/runnable/link13843.d
new file mode 100644
index 00000000000..2e250bf8a9d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link13843.d
@@ -0,0 +1,44 @@
+template binaryFun(alias fun)
+{
+    static if (is(typeof(fun) : string))
+    {
+        auto binaryFun(E1, E2)(E1 a, E2 b)
+        {
+            return mixin(fun);
+        }
+    }
+    else
+    {
+        alias binaryFun = fun;
+    }
+}
+
+class Foo(int n, alias greater = "a > b")
+{
+    private alias binaryFun!(greater) compare;
+
+    public this()
+    {
+        //assert(compare(2, 1));
+        // 'compare' -> FuncExp
+
+        assert(this.compare(2, 1));
+        // old: 'this.compare' -> DotVarExp (e1: ThisExp, var: FuncLiteralDeclaration)
+        // new: 'this.compare' -> CommaExp (e1: ThisExp, e2: FuncExp)
+
+        // Then, in both cases lambda->toObjFile() will run via FuncExp::toElem().
+    }
+}
+
+void main()
+{
+    // OK
+    auto foo1 = new Foo!(1, "a > b");
+    auto foo2 = new Foo!(2, (a, b) => a > b);
+    auto foo3 = new Foo!(3, delegate(a, b){ return a > b; });
+
+    // OK <- NG
+    auto foo4 = new Foo!(4, (int a, int b) => a > b);
+    auto foo5 = new Foo!(5, function(int a, int b){ return a > b; });
+    auto foo6 = new Foo!(6, delegate(int a, int b){ return a > b; });
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link14074a.d b/gcc/testsuite/gdc.test/runnable/link14074a.d
new file mode 100644
index 00000000000..eaf1c89ef97
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link14074a.d
@@ -0,0 +1,21 @@
+// EXTRA_SOURCES: imports/link14074y.d
+import imports.link14074x;
+import imports.link14074y;
+
+struct Inner
+{
+}
+
+struct Test
+{
+    Inner inner;
+}
+
+
+void main()
+{
+    ubyte[] buffer;
+    Test test;
+
+    encodeArray(buffer, test);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link14074b.d b/gcc/testsuite/gdc.test/runnable/link14074b.d
new file mode 100644
index 00000000000..fea23697fb7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link14074b.d
@@ -0,0 +1,6 @@
+import imports.link14074z;
+
+void main()
+{
+    replaceAllWith!()(1);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link14425.d b/gcc/testsuite/gdc.test/runnable/link14425.d
new file mode 100644
index 00000000000..f35fa911736
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link14425.d
@@ -0,0 +1,9 @@
+struct SFoo(I) { I i; }
+struct SBar(I) { I i; }
+static assert(is(SFoo!(SBar!string)));
+
+class CFoo(I) { I i; }
+class CBar(I) { I i; }
+static assert(is(CFoo!(CBar!string)));
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/runnable/link14541.d b/gcc/testsuite/gdc.test/runnable/link14541.d
new file mode 100644
index 00000000000..433b9d73950
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link14541.d
@@ -0,0 +1,42 @@
+import imports.link14541traits;
+
+void main()
+{
+    Tuple!(int, int) result;
+
+    alias T = typeof(result);
+    static assert(hasElaborateAssign!T);
+    // hasElaborateAssign!(Tuple(int, int)):
+    // 1. instantiates Tuple!(int, int).opAssign!(Tuple!(int, int)) [auto ref = Rvalue]
+    //    2. instantiates swap!(Tuple!(int, int))
+    //       3. instantiates hasElaborateAssign!(Tuple!(int, int))
+    //          --> forward reference error
+    //       --> swap!(Tuple!(int, int)) fails to instantiate
+    //    --> Tuple!(int, int).opAssign!(Tuple!(int, int)) [auto ref = rvalue] fails to instantiate
+    // 4. instantiates Tuple!(int, int).opAssign!(Tuple!(int, int)) [auto ref = Lvalue]
+    //    --> succeeds
+    // hasElaborateAssign!(Tuple(int, int)) succeeds to instantiate (result is 'true')
+
+    // Instantiates Tuple!(int, int).opAssign!(Tuple!(int, int)) [auto ref = Rvalue], but
+    // it's already done in gagged context, so this is made an error reproduction instantiation.
+    // But, the forward reference of hasElaborateAssign!(Tuple(int, int)) is already resolved, so
+    // the instantiation will succeeds.
+    result = Tuple!(int, int)(0, 0);    // --> 1st error reproduction instantiation
+    result = Tuple!(int, int)(0, 0);    // --> 2nd error reproduction instantiation
+
+    // The two error reproduction instantiations generate the function:
+    //   Tuple!(int, int).opAssign!(Tuple!(int, int)) [auto ref = Rvalue]
+    // twice, then it will cause duplicate COMDAT error in Win64 platform.
+}
+
+/+
+The point is, if instantiated contexts are different, two instantiations may cause different result.
+
+- The 1st Tuple.opAssign instantiation is invoked from hasElaborateAssign template with gagging.
+  So it has failed, because of the circular reference of hasElaborateAssign template..
+
+- The 2nd Tuple.opAssign instantiation is invoked from main() without gagging.
+  It does not have circular reference, so the instantiation should succeed.
+
+Therefore, the gagged failure should be overridden by the ungagged success.
++/
diff --git a/gcc/testsuite/gdc.test/runnable/link14588.d b/gcc/testsuite/gdc.test/runnable/link14588.d
new file mode 100644
index 00000000000..2ca4b52f67d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link14588.d
@@ -0,0 +1,10 @@
+// EXTRA_SOURCES: imports/link14588a.d
+// PERMUTE_ARGS: -allinst -unittest -debug -inline
+// COMPILE_SEPARATELY
+
+import imports.link14588a;
+
+void main()
+{
+    new A().all();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link14814.d b/gcc/testsuite/gdc.test/runnable/link14814.d
new file mode 100644
index 00000000000..ed06500a9b3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link14814.d
@@ -0,0 +1,10 @@
+// EXTRA_SOURCES: imports/link14814a.d
+// PERMUTE_ARGS: -inline -release -g -O -fPIC
+// COMPILE_SEPARATELY
+
+import imports.link14814a;
+
+void main()
+{
+    fun4;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link14992.d b/gcc/testsuite/gdc.test/runnable/link14992.d
new file mode 100644
index 00000000000..2da97b9afa7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link14992.d
@@ -0,0 +1,22 @@
+import imports.a14992;  // do not link
+
+int test()
+{
+    S1 v1;      // OK
+    S1* p1;     // OK
+    S1[] da1;   // OK
+    S1[2] a1;   // OK <- NG
+
+    S2 v2;      // OK
+    S2* p2;     // OK
+    S2[] da2;   // OK
+    S2[2] a2;   // OK <- NG
+
+    return 1;
+}
+static assert(test());
+
+void main()
+{
+    test();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link15017.d b/gcc/testsuite/gdc.test/runnable/link15017.d
new file mode 100644
index 00000000000..ec3304ec793
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link15017.d
@@ -0,0 +1,45 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/std15017variant.d
+
+import imports.std15017variant;
+
+void test()
+{
+    // OK <- in IndexExp::semantic
+    Variant1[string] aa1;
+    aa1["abc"] = Variant1();
+
+    // already ok in CatExp::semantic with checkPostblit
+    Variant2[] a2;
+    a2 = a2 ~ Variant2();
+
+    // already ok in CatAssignExp::semantic with checkPostblit
+    Variant3[] a3;
+    a3 ~= Variant3();
+
+    // OK <- in CmpExp::semantic
+    Variant4[] a4;
+    assert(a4 < a4);
+
+    // already OK in needDirectEq from EqualExp::semantic
+    Variant5[] a5;
+    assert(a5 == a5);
+
+    // already OK in EqualExp::semantic
+    Variant6[Variant7] aa67;
+    assert(aa67 == aa67);
+
+    // OK <- in InExp::semantic
+    string[Variant8] aa8;
+    assert(Variant8() in aa8);
+
+    // OK <- in resolveUFCS with RemoveExp
+    string[Variant9] aa9;
+    aa9.remove(Variant9());
+
+    // OK <- in DeleteExp::semantic
+    Variant10* p10;
+    delete p10;
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/runnable/link15021.d b/gcc/testsuite/gdc.test/runnable/link15021.d
new file mode 100644
index 00000000000..62918a26e3e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link15021.d
@@ -0,0 +1,18 @@
+// PERMUTE_ARGS: -inline -g -debug -unittest
+
+import imports.std15021conv;
+
+class AliasDecl {}
+
+void aliasDecl(AliasDecl ad)
+{
+    AliasDecl* zis;
+
+    static if (is(typeof(to!string(*zis))))
+    {
+        pragma(msg, "hit!");
+        to!string(*zis);
+    }
+}
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/runnable/link15149.d b/gcc/testsuite/gdc.test/runnable/link15149.d
new file mode 100644
index 00000000000..6293ecf144e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link15149.d
@@ -0,0 +1,16 @@
+// REQUIRED_ARGS: -g
+// PERMUTE_ARGS: -inline -version=A
+// EXTRA_SOURCES: imports/link15194b.d imports/link15194std.d
+// COMPILE_SEPARATELY: -g
+
+import imports.link15194std;
+import imports.link15194b;
+
+void main()
+{
+    int[] foo;
+
+    // fun() returns new RedBlackTree!int. But it's instantiated in
+    // non-template non-root function, so it's left as speculative.
+    setUnion(fun()[], foo);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link2500.d b/gcc/testsuite/gdc.test/runnable/link2500.d
new file mode 100644
index 00000000000..80230f46000
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link2500.d
@@ -0,0 +1,19 @@
+// EXTRA_SOURCES: imports/link2500a.d
+// EXTRA_SOURCES: imports/link2500b.d
+// COMPILE_SEPARATELY:
+
+module link2500;
+
+import imports.link2500a;
+import imports.link2500b;
+
+public class A
+{
+    S!A c;
+}
+
+void main()
+{
+    A a = new A();
+    a.c.foo();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link2644.d b/gcc/testsuite/gdc.test/runnable/link2644.d
new file mode 100644
index 00000000000..bf656f7ef81
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link2644.d
@@ -0,0 +1,14 @@
+// PERMUTE_ARGS: -version=X -inline -release -g -O
+// EXTRA_SOURCES: imports/link2644a.d imports/link2644b.d imports/link2644c.d
+// COMPILE_SEPARATELY:
+
+module link2644;
+import imports.link2644a;
+
+void main()
+{
+  version(X)
+    auto c = new X.CA();
+  else
+    auto c = new CA();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link6574.d b/gcc/testsuite/gdc.test/runnable/link6574.d
new file mode 100644
index 00000000000..0f97ed716c2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link6574.d
@@ -0,0 +1,45 @@
+// PERMUTE_ARGS:
+module link6574;
+
+enum Method { A, B, }
+
+int foo(Method method = Method.A)()
+{
+    static assert(foo.mangleof == "_D8link657428__T3fooVE8link65746Methodi0Z3fooFZi");
+    return 10 * foo!method();
+}
+int foo(Method method : Method.A)()
+{
+    static assert(foo.mangleof == "_D8link657429__T3fooHVE8link65746Methodi0Z3fooFZi");
+    return 2;
+}
+int foo(Method method : Method.B)()
+{
+    static assert(0);
+    return 3;
+}
+
+int bar(Method method = Method.B)()
+{
+    static assert(bar.mangleof == "_D8link657428__T3barVE8link65746Methodi1Z3barFZi");
+    return 10 * bar!method();
+}
+int bar(Method method : Method.A)()
+{
+    static assert(0);
+    return 2;
+}
+int bar(Method method : Method.B)()
+{
+    static assert(bar.mangleof == "_D8link657429__T3barHVE8link65746Methodi1Z3barFZi");
+    return 3;
+}
+
+void main()
+{
+    assert(foo!() == 10 * 2);
+    assert(foo() == 10 * 2);
+
+    assert(bar!() == 10 * 3);
+    assert(bar() == 10 * 3);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link7745.d b/gcc/testsuite/gdc.test/runnable/link7745.d
new file mode 100644
index 00000000000..fb36a9aae9e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link7745.d
@@ -0,0 +1,20 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/link7745b.d
+// PERMUTE_ARGS:
+
+import imports.link7745b;
+
+bool forceSemantic7745()
+{
+   C c;
+   c.asdfg();
+  return true;
+}
+static assert(forceSemantic7745());
+
+void f(C c) { auto x = &c.asdfg; }
+
+void main() {
+    // extra test for bug 4820
+    nextis!(int)();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link7966.d b/gcc/testsuite/gdc.test/runnable/link7966.d
new file mode 100644
index 00000000000..ebb05b85101
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link7966.d
@@ -0,0 +1,17 @@
+enum E { i }
+
+struct S1 { bool opCast(T)() { return true; } }
+struct S2 { bool opCast(T)() { return true; } }
+
+import a = core.stdc.stdio;
+
+void main()
+{
+    with (E)            // exp == TOKtype
+        assert(S1());   // Doesn't enclose in ScopeStatement
+    assert(S1());
+
+    with (a)            // exp == TOKimport
+        assert(S2());   // Doesn't enclose in ScopeStatement
+    assert(S2());
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link8023.d b/gcc/testsuite/gdc.test/runnable/link8023.d
new file mode 100644
index 00000000000..d4c32cbaa8e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link8023.d
@@ -0,0 +1,19 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/link8023b.d
+// PERMUTE_ARGS: -inline -release
+
+import imports.link8023b;
+
+private void t(alias Code)()
+{
+  return Code();
+}
+
+void f()
+{
+  t!( () { } )();
+}
+
+void main() {
+  f();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/link9571.d b/gcc/testsuite/gdc.test/runnable/link9571.d
new file mode 100644
index 00000000000..1efdbdd46e3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/link9571.d
@@ -0,0 +1,9 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/link9571a.d
+
+import imports.link9571a;
+
+void main()
+{
+    foo();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/linktypeinfo.d b/gcc/testsuite/gdc.test/runnable/linktypeinfo.d
new file mode 100644
index 00000000000..04579a26c7a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/linktypeinfo.d
@@ -0,0 +1,34 @@
+// EXTRA_SOURCES: imports/linktypeinfo_file.d
+// PERMUTE_ARGS: -g -inline -unittest -debug
+// COMPILE_SEPARATELY
+
+import imports.linktypeinfo_file;
+
+struct Only(T)
+{
+    private T _val;
+}
+
+auto only(V)(V v)
+{
+    return Only!V(v);
+}
+
+static struct Chain(R...)
+{
+    R source;
+}
+
+auto chain(R...)(R rs)
+{
+    return Chain!R(rs);
+}
+
+void main()
+{
+    string docRoot;
+
+    const r = dirEntries(docRoot);
+    typeof(r)[] a;
+    a.length = 0;   // require TypeInfo for const(FilterResult!(DirIterator))
+}
diff --git a/gcc/testsuite/gdc.test/runnable/literal.d b/gcc/testsuite/gdc.test/runnable/literal.d
new file mode 100644
index 00000000000..60bac918ec8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/literal.d
@@ -0,0 +1,238 @@
+
+extern(C) int printf(const char*, ...);
+
+enum
+{
+    T_char,
+    T_wchar,
+    T_dchar,
+    T_bit,
+    T_byte,
+    T_ubyte,
+    T_short,
+    T_ushort,
+    T_int,
+    T_uint,
+    T_long,
+    T_ulong,
+}
+
+int dotype(char x) { return T_char; }
+int dotype(bool x) { return T_bit; }
+int dotype(byte x) { return T_byte; }
+int dotype(ubyte x) { return T_ubyte; }
+int dotype(wchar x) { return T_wchar; }
+int dotype(short x) { return T_short; }
+int dotype(ushort x) { return T_ushort; }
+int dotype(int x) { return T_int; }
+int dotype(uint x) { return T_uint; }
+int dotype(long x) { return T_long; }
+int dotype(ulong x) { return T_ulong; }
+
+void test1()
+{
+    /*
+     * 0x7FFF             077777                  32767
+     * 0x8000             0100000                 32768
+     * 0xFFFF             0177777                 65535
+     * 0x10000            0200000                 65536
+     * 0x7FFFFFFF         017777777777            2147483647
+     * 0x80000000         020000000000            2147483648
+     * 0xFFFFFFFF         037777777777            4294967295
+     * 0x100000000        040000000000            4294967296
+     * 0x7FFFFFFFFFFFFFFF 0777777777777777777777  9223372036854775807
+     * 0x8000000000000000 01000000000000000000000 9223372036854775808
+     * 0xFFFFFFFFFFFFFFFF 01777777777777777777777 18446744073709551615
+     */
+
+    assert(dotype(1) == T_int);
+
+    /***************** Hexadecimal ***********************/
+
+    assert(dotype(0) == T_int);
+    assert(dotype(0x7FFF) == T_int);
+    assert(dotype(0x8000) == T_int);
+    assert(dotype(0xFFFF) == T_int);
+    assert(dotype(0x10000) == T_int);
+    assert(dotype(0x7FFFFFFF) == T_int);
+    assert(dotype(0x80000000) == T_uint);
+    assert(dotype(0xFFFFFFFF) == T_uint);
+    assert(dotype(0x100000000) == T_long);
+    assert(dotype(0x7FFFFFFFFFFFFFFF) == T_long);
+    assert(dotype(0x8000000000000000) == T_ulong);
+    assert(dotype(0xFFFFFFFFFFFFFFFF) == T_ulong);
+
+    assert(dotype(0u) == T_uint);
+    assert(dotype(0x7FFFu) == T_uint);
+    assert(dotype(0x8000u) == T_uint);
+    assert(dotype(0xFFFFu) == T_uint);
+    assert(dotype(0x10000u) == T_uint);
+    assert(dotype(0x7FFFFFFFu) == T_uint);
+    assert(dotype(0x80000000u) == T_uint);
+    assert(dotype(0xFFFFFFFFu) == T_uint);
+    assert(dotype(0x100000000u) == T_ulong);
+    assert(dotype(0x7FFFFFFFFFFFFFFFu) == T_ulong);
+    assert(dotype(0x8000000000000000u) == T_ulong);
+    assert(dotype(0xFFFFFFFFFFFFFFFFu) == T_ulong);
+
+    assert(dotype(0L) == T_long);
+    assert(dotype(0x7FFFL) == T_long);
+    assert(dotype(0x8000L) == T_long);
+    assert(dotype(0xFFFFL) == T_long);
+    assert(dotype(0x10000L) == T_long);
+    assert(dotype(0x7FFFFFFFL) == T_long);
+    assert(dotype(0x80000000L) == T_long);
+    assert(dotype(0xFFFFFFFFL) == T_long);
+    assert(dotype(0x100000000L) == T_long);
+    assert(dotype(0x7FFFFFFFFFFFFFFFL) == T_long);
+    assert(dotype(0x8000000000000000L) == T_ulong);
+    assert(dotype(0xFFFFFFFFFFFFFFFFL) == T_ulong);
+
+    assert(dotype(0uL) == T_ulong);
+    assert(dotype(0x7FFFuL) == T_ulong);
+    assert(dotype(0x8000uL) == T_ulong);
+    assert(dotype(0xFFFFuL) == T_ulong);
+    assert(dotype(0x10000uL) == T_ulong);
+    assert(dotype(0x7FFFFFFFuL) == T_ulong);
+    assert(dotype(0x80000000uL) == T_ulong);
+    assert(dotype(0xFFFFFFFFuL) == T_ulong);
+    assert(dotype(0x100000000uL) == T_ulong);
+    assert(dotype(0x7FFFFFFFFFFFFFFFuL) == T_ulong);
+    assert(dotype(0x8000000000000000uL) == T_ulong);
+    assert(dotype(0xFFFFFFFFFFFFFFFFuL) == T_ulong);
+
+    /***************** Decimal ***********************/
+
+    assert(dotype(0) == T_int);
+    assert(dotype(32767) == T_int);
+    assert(dotype(32768) == T_int);
+    assert(dotype(65535) == T_int);
+    assert(dotype(65536) == T_int);
+    assert(dotype(2147483647) == T_int);
+    assert(dotype(2147483648) == T_long);
+    assert(dotype(4294967295) == T_long);
+    assert(dotype(4294967296) == T_long);
+    assert(dotype(9223372036854775807) == T_long);
+    //assert(dotype(9223372036854775808) == T_long);
+    //assert(dotype(18446744073709551615) == T_ulong);
+
+    assert(dotype(0u) == T_uint);
+    assert(dotype(32767u) == T_uint);
+    assert(dotype(32768u) == T_uint);
+    assert(dotype(65535u) == T_uint);
+    assert(dotype(65536u) == T_uint);
+    assert(dotype(2147483647u) == T_uint);
+    assert(dotype(2147483648u) == T_uint);
+    assert(dotype(4294967295u) == T_uint);
+    assert(dotype(4294967296u) == T_ulong);
+    assert(dotype(9223372036854775807u) == T_ulong);
+    assert(dotype(9223372036854775808u) == T_ulong);
+    assert(dotype(18446744073709551615u) == T_ulong);
+
+    assert(dotype(0L) == T_long);
+    assert(dotype(32767L) == T_long);
+    assert(dotype(32768L) == T_long);
+    assert(dotype(65535L) == T_long);
+    assert(dotype(65536L) == T_long);
+    assert(dotype(2147483647L) == T_long);
+    assert(dotype(2147483648L) == T_long);
+    assert(dotype(4294967295L) == T_long);
+    assert(dotype(4294967296L) == T_long);
+    assert(dotype(9223372036854775807L) == T_long);
+    //assert(dotype(9223372036854775808L) == T_ulong);
+    //assert(dotype(18446744073709551615L) == T_ulong);
+
+    assert(dotype(0uL) == T_ulong);
+    assert(dotype(32767uL) == T_ulong);
+    assert(dotype(32768uL) == T_ulong);
+    assert(dotype(65535uL) == T_ulong);
+    assert(dotype(65536uL) == T_ulong);
+    assert(dotype(2147483647uL) == T_ulong);
+    assert(dotype(2147483648uL) == T_ulong);
+    assert(dotype(4294967295uL) == T_ulong);
+    assert(dotype(4294967296uL) == T_ulong);
+    assert(dotype(9223372036854775807uL) == T_ulong);
+    assert(dotype(9223372036854775808uL) == T_ulong);
+    assert(dotype(18446744073709551615uL) == T_ulong);
+}
+
+void test2()
+{
+    ulong[] a = [ 2_463_534_242UL ];
+
+    foreach(e; a)
+        assert(e == 2_463_534_242UL);
+}
+
+/***************************************************/
+// 13907
+
+void f13907_1(wchar[1] a) {}
+void f13907_2(wchar[2] a) {}
+void f13907_3(wchar[3] a) {}
+
+auto f13907_12(char[1]) { return 1; }
+auto f13907_12(char[2]) { return 2; }
+
+auto f13907_123(char[1]) { return 1; }
+auto f13907_123(char[2]) { return 2; }
+auto f13907_123(char[3]) { return 3; }
+auto f13907_123(const(char)[]) { return 0; }
+
+void test13907()
+{
+    static assert(!__traits(compiles, { f13907_1("\U00010000"w); }));
+    static assert(!__traits(compiles, { f13907_1("\U00010000" ); }));
+    f13907_2("\U00010000"w);
+    f13907_2("\U00010000");
+    f13907_3("\U00010000"w);    // Re-enable implicit length extension, from issue 13999
+    f13907_3("\U00010000" );    // Re-enable implicit length extension, from issue 13999
+
+    assert(f13907_12("a") == 1);
+    assert(f13907_12("ab") == 2);
+    static assert(!__traits(compiles, { f13907_12("abc"); }));
+
+    assert(f13907_123("a") == 1);
+    assert(f13907_123("ab") == 2);
+    assert(f13907_123("abc") == 3);
+    assert(f13907_123("abcd") == 0);
+
+    // regression tests for the lengthen behavior in initializer
+    enum const(char*) p = "hello world";
+    static assert(!__traits(compiles, { static   char[5] a = "hello world"; }));  // truncation is not allowed
+    static assert(!__traits(compiles, { static  void[20] a = "hello world"; }));
+    static assert(!__traits(compiles, { static   int[20] a = "hello world"; }));
+    static assert(!__traits(compiles, { static  char[20] a = "hello world"w; }));
+    static assert(!__traits(compiles, { static wchar[20] a = "hello world"d; }));
+    static assert(!__traits(compiles, { static dchar[20] a = "hello world"c; }));
+    static assert(!__traits(compiles, { static  char[20] a = p; }));
+    static  char[20] csa = "hello world";  // extending is allowed
+    static wchar[20] wsa = "hello world";  // ok
+    static dchar[20] dsa = "hello world";  // ok
+
+    // Bugzilla 13966
+    string[1][] arr;
+    arr ~= ["class"];
+    enum immutable(char[5]) sarrstr = "class";
+    arr ~= [sarrstr];
+
+    // Bugzilla 13999
+    string[dchar[2]] aa13999 = ["あ": "bar"];
+    assert(aa13999["あ"] == "bar");
+    dchar[2] key13999 = "あ";
+    assert(key13999[0] == 'あ');
+    assert(key13999[1] == '\0');
+    assert(aa13999[key13999] == "bar");
+}
+
+/***************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test13907();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/m1.d b/gcc/testsuite/gdc.test/runnable/m1.d
new file mode 100644
index 00000000000..49a3d15bc3e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/m1.d
@@ -0,0 +1,22 @@
+// EXTRA_SOURCES: imports/m1a.d
+// PERMUTE_ARGS:
+
+module m1;
+
+import std.stdio;
+
+import imports.m1a;
+
+class A
+{
+}
+
+A createA() { return new A; }
+
+alias A function() aliasM1;
+
+void main()
+{
+  aFunc( &createA );
+  printf("Success\n");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/manboy.d b/gcc/testsuite/gdc.test/runnable/manboy.d
new file mode 100644
index 00000000000..038622668f2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/manboy.d
@@ -0,0 +1,20 @@
+// PERMUTE_ARGS:
+
+import std.stdio;
+
+int a(int k, lazy int x1, lazy int x2, lazy int x3, lazy int x4, lazy int x5)
+{
+    int delegate() b;
+    b = { k -= 1; return a(k, b(), x1, x2, x3, x4); };
+    if (k <= 0)
+        return x4 + x5;
+    else
+        return b();
+}
+
+int main()
+{
+    assert(a(10, 1, -1, -1, 1, 0) == -67);
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/mangle.d b/gcc/testsuite/gdc.test/runnable/mangle.d
new file mode 100644
index 00000000000..8820a6d1fb3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/mangle.d
@@ -0,0 +1,582 @@
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: imports/mangle10077.d
+
+/***************************************************/
+// 10077 - pragma(mangle)
+
+pragma(mangle, "_test10077a_") int test10077a;
+static assert(test10077a.mangleof == "_test10077a_");
+
+__gshared pragma(mangle, "_test10077b_") ubyte test10077b;
+static assert(test10077b.mangleof == "_test10077b_");
+
+pragma(mangle, "_test10077c_") void test10077c() {}
+static assert(test10077c.mangleof == "_test10077c_");
+
+pragma(mangle, "_test10077f_") __gshared char test10077f;
+static assert(test10077f.mangleof == "_test10077f_");
+
+pragma(mangle, "_test10077g_") @system { void test10077g() {} }
+static assert(test10077g.mangleof == "_test10077g_");
+
+template getModuleInfo(alias mod)
+{
+    pragma(mangle, "_D"~mod.mangleof~"12__ModuleInfoZ") static __gshared extern ModuleInfo mi;
+    enum getModuleInfo = &mi;
+}
+
+void test10077h()
+{
+    assert(getModuleInfo!(object).name == "object");
+}
+
+//UTF-8 chars
+__gshared extern pragma(mangle, "test_эльфийские_письмена_9") ubyte test10077i_evar;
+
+void test10077i()
+{
+    import imports.mangle10077;
+
+    setTest10077i();
+    assert(test10077i_evar == 42);
+}
+
+/***************************************************/
+// 13050
+
+void func13050(int);
+template decl13050(Arg)
+{
+    void decl13050(Arg);
+}
+template problem13050(Arg)
+{
+    pragma(mangle, "foobar")
+        void problem13050(Arg);
+}
+template workaround13050(Arg)
+{
+    pragma(mangle, "foobar")
+        void func(Arg);
+    alias workaround13050 = func;
+}
+
+static assert(is(typeof(&func13050) == void function(int)));
+static assert(is(typeof(&decl13050!int) == void function(int)));
+static assert(is(typeof(&problem13050!int) == void function(int)));
+static assert(is(typeof(&workaround13050!int) == void function(int)));
+
+/***************************************************/
+// 2774
+
+int foo2774(int n) { return 0; }
+static assert(foo2774.mangleof == "_D6mangle7foo2774FiZi");
+
+class C2774
+{
+    int foo2774() { return 0; }
+}
+static assert(C2774.foo2774.mangleof == "_D6mangle5C27747foo2774MFZi");
+
+template TFoo2774(T) {}
+static assert(TFoo2774!int.mangleof == "6mangle15__T8TFoo2774TiZ");
+
+void test2774()
+{
+    int foo2774(int n) { return 0; }
+    static assert(foo2774.mangleof == "_D6mangle8test2774FZ7foo2774MFNaNbNiNfiZi");
+}
+
+/*******************************************/
+// 8847
+
+auto S8847()
+{
+    static struct Result
+    {
+        inout(Result) get() inout { return this; }
+    }
+    return Result();
+}
+
+void test8847a()
+{
+    auto a = S8847();
+    auto b = a.get();
+    alias typeof(a) A;
+    alias typeof(b) B;
+    assert(is(A == B), A.stringof~ " is different from "~B.stringof);
+}
+
+// --------
+
+enum result8847a = "S6mangle9iota8847aFZ6Result";
+enum result8847b = "S6mangle9iota8847bFZ4iotaMFZ6Result";
+enum result8847c = "C6mangle9iota8847cFZ6Result";
+enum result8847d = "C6mangle9iota8847dFZ4iotaMFZ6Result";
+
+auto iota8847a()
+{
+    static struct Result
+    {
+        this(int) {}
+        inout(Result) test() inout { return cast(inout)Result(0); }
+    }
+    static assert(Result.mangleof == result8847a);
+    return Result.init;
+}
+auto iota8847b()
+{
+    auto iota()
+    {
+        static struct Result
+        {
+            this(int) {}
+            inout(Result) test() inout { return cast(inout)Result(0); }
+        }
+        static assert(Result.mangleof == result8847b);
+        return Result.init;
+    }
+    return iota();
+}
+auto iota8847c()
+{
+    static class Result
+    {
+        this(int) {}
+        inout(Result) test() inout { return cast(inout)new Result(0); }
+    }
+    static assert(Result.mangleof == result8847c);
+    return Result.init;
+}
+auto iota8847d()
+{
+    auto iota()
+    {
+        static class Result
+        {
+            this(int) {}
+            inout(Result) test() inout { return cast(inout)new Result(0); }
+        }
+        static assert(Result.mangleof == result8847d);
+        return Result.init;
+    }
+    return iota();
+}
+void test8847b()
+{
+    static assert(typeof(iota8847a().test()).mangleof == result8847a);
+    static assert(typeof(iota8847b().test()).mangleof == result8847b);
+    static assert(typeof(iota8847c().test()).mangleof == result8847c);
+    static assert(typeof(iota8847d().test()).mangleof == result8847d);
+}
+
+// --------
+
+struct Test8847
+{
+    enum result1 = "S6mangle8Test88478__T3fooZ3fooMFZ6Result";
+    enum result2 = "S6mangle8Test88478__T3fooZ3fooMxFiZ6Result";
+
+    auto foo()()
+    {
+        static struct Result
+        {
+            inout(Result) get() inout { return this; }
+        }
+        static assert(Result.mangleof == Test8847.result1);
+        return Result();
+    }
+    auto foo()(int n) const
+    {
+        static struct Result
+        {
+            inout(Result) get() inout { return this; }
+        }
+        static assert(Result.mangleof == Test8847.result2);
+        return Result();
+    }
+}
+void test8847c()
+{
+    static assert(typeof(Test8847().foo( ).get()).mangleof == Test8847.result1);
+    static assert(typeof(Test8847().foo(1).get()).mangleof == Test8847.result2);
+}
+
+// --------
+
+void test8847d()
+{
+    enum resultS = "S6mangle9test8847dFZ3fooMFZ3barMFZ3bazMFZ1S";
+    enum resultX = "S6mangle9test8847dFZ3fooMFZ1X";
+    // Return types for test8847d and bar are mangled correctly,
+    // and return types for foo and baz are not mangled correctly.
+
+    auto foo()
+    {
+        struct X { inout(X) get() inout { return inout(X)(); } }
+        string bar()
+        {
+            auto baz()
+            {
+                struct S { inout(S) get() inout { return inout(S)(); } }
+                return S();
+            }
+            static assert(typeof(baz()      ).mangleof == resultS);
+            static assert(typeof(baz().get()).mangleof == resultS);
+            return "";
+        }
+        return X();
+    }
+    static assert(typeof(foo()      ).mangleof == resultX);
+    static assert(typeof(foo().get()).mangleof == resultX);
+}
+
+// --------
+
+void test8847e()
+{
+    enum resultHere = "6mangle"~"9test8847eFZ"~"8__T3fooZ"~"3foo";
+    enum resultBar =  "S"~resultHere~"MFNaNfNgiZ3Bar";
+    enum resultFoo = "_D"~resultHere~"MFNaNbNiNfNgiZNg"~resultBar;   // added 'Nb'
+
+    // Make template function to infer 'nothrow' attributes
+    auto foo()(inout int) pure @safe
+    {
+        struct Bar {}
+        static assert(Bar.mangleof == resultBar);
+        return inout(Bar)();
+    }
+
+    auto bar = foo(0);
+    static assert(typeof(bar).stringof == "Bar");
+    static assert(typeof(bar).mangleof == resultBar);
+    static assert(foo!().mangleof == resultFoo);
+}
+
+// --------
+
+pure f8847a()
+{
+    struct S {}
+    return S();
+}
+
+pure
+{
+    auto f8847b()
+    {
+        struct S {}
+        return S();
+    }
+}
+
+static assert(typeof(f8847a()).mangleof == "S6mangle6f8847aFNaZ1S");
+static assert(typeof(f8847b()).mangleof == "S6mangle6f8847bFNaZ1S");
+
+/*******************************************/
+// 12352
+
+auto bar12352()
+{
+    struct S { int var; void func() {} }
+
+    static assert(!__traits(compiles, bar12352.mangleof));   // forward reference to bar
+    static assert(S     .mangleof ==  "S6mangle8bar12352FZ1S");
+    static assert(S.func.mangleof == "_D6mangle8bar12352FZ1S4funcMFZv");
+
+    return S();
+}
+static assert(       bar12352        .mangleof == "_D6mangle8bar12352FNaNbNiNfZS6mangle8bar12352FZ1S");
+static assert(typeof(bar12352())     .mangleof ==  "S6mangle8bar12352FZ1S");
+static assert(typeof(bar12352()).func.mangleof == "_D6mangle8bar12352FZ1S4funcMFZv");
+
+auto baz12352()
+{
+    class C { int var; void func() {} }
+
+    static assert(!__traits(compiles, baz12352.mangleof));   // forward reference to baz
+    static assert(C     .mangleof ==  "C6mangle8baz12352FZ1C");
+    static assert(C.func.mangleof == "_D6mangle8baz12352FZ1C4funcMFZv");
+
+    return new C();
+}
+static assert(       baz12352        .mangleof == "_D6mangle8baz12352FNaNbNfZC6mangle8baz12352FZ1C");
+static assert(typeof(baz12352())     .mangleof ==  "C6mangle8baz12352FZ1C");
+static assert(typeof(baz12352()).func.mangleof == "_D6mangle8baz12352FZ1C4funcMFZv");
+
+/*******************************************/
+// 9525
+
+void f9525(T)(in T*) { }
+
+void test9525()
+{
+    enum result1 = "S6mangle8test9525FZ26__T5test1S136mangle5f9525Z5test1MFZ1S";
+    enum result2 = "S6mangle8test9525FZ26__T5test2S136mangle5f9525Z5test2MFNaNbZ1S";
+
+    void test1(alias a)()
+    {
+        static struct S {}
+        static assert(S.mangleof == result1);
+        S s;
+        a(&s);  // Error: Cannot convert &S to const(S*) at compile time
+    }
+    static assert((test1!f9525(), true));
+
+    void test2(alias a)() pure nothrow
+    {
+        static struct S {}
+        static assert(S.mangleof == result2);
+        S s;
+        a(&s);  // Error: Cannot convert &S to const(S*) at compile time
+    }
+    static assert((test2!f9525(), true));
+}
+
+/******************************************/
+// 10249
+
+template Seq10249(T...) { alias Seq10249 = T; }
+
+mixin template Func10249(T)
+{
+    void func10249(T) {}
+}
+mixin Func10249!long;
+mixin Func10249!string;
+
+void f10249(long) {}
+
+class C10249
+{
+    mixin Func10249!long;
+    mixin Func10249!string;
+    static assert(Seq10249!(.func10249)[0].mangleof == "6mangle9func10249");           // <- 9func10249
+    static assert(Seq10249!( func10249)[0].mangleof == "6mangle6C102499func10249");    // <- 9func10249
+
+static: // necessary to make overloaded symbols accessible via __traits(getOverloads, C10249)
+    void foo(long) {}
+    void foo(string) {}
+    static assert(Seq10249!(foo)[0].mangleof                                   ==   "6mangle6C102493foo");         // <- _D6mangle6C102493fooFlZv
+    static assert(Seq10249!(__traits(getOverloads, C10249, "foo"))[0].mangleof == "_D6mangle6C102493fooFlZv");     // <-
+    static assert(Seq10249!(__traits(getOverloads, C10249, "foo"))[1].mangleof == "_D6mangle6C102493fooFAyaZv");   // <-
+
+    void g(string) {}
+    alias bar = .f10249;
+    alias bar =  g;
+    static assert(Seq10249!(bar)[0].mangleof                                   ==   "6mangle6C102493bar");         // <- _D6mangle1fFlZv
+    static assert(Seq10249!(__traits(getOverloads, C10249, "bar"))[0].mangleof == "_D6mangle6f10249FlZv");         // <-
+    static assert(Seq10249!(__traits(getOverloads, C10249, "bar"))[1].mangleof == "_D6mangle6C102491gFAyaZv");     // <-
+}
+
+/*******************************************/
+// 11718
+
+struct Ty11718(alias sym) {}
+
+auto fn11718(T)(T a)   { return Ty11718!(a).mangleof; }
+auto fn11718(T)() { T a; return Ty11718!(a).mangleof; }
+
+void test11718()
+{
+    string TyName(string tail)()
+    {
+        enum s = "__T7Ty11718" ~ tail;
+        enum int len = s.length;
+        return "S6mangle" ~ len.stringof ~ s;
+    }
+    string fnName(string paramPart)()
+    {
+        enum s = "_D6mangle35__T7fn11718T"~
+                 "S6mangle9test11718FZ1AZ7fn11718"~paramPart~"1a"~
+                 "S6mangle9test11718FZ1A";
+        enum int len = s.length;
+        return len.stringof ~ s;
+    }
+    enum result1 = TyName!("S" ~ fnName!("F"~"S6mangle9test11718FZ1A"~"Z") ~ "Z") ~ "7Ty11718";
+    enum result2 = TyName!("S" ~ fnName!("F"~""                      ~"Z") ~ "Z") ~ "7Ty11718";
+
+    struct A {}
+    static assert(fn11718(A.init) == result1);
+    static assert(fn11718!A()     == result2);
+}
+
+/*******************************************/
+// 11776
+
+struct S11776(alias fun) { }
+
+void test11776()
+{
+    auto g = ()
+    {
+        if (1)
+            return; // fill tf->next
+        if (1)
+        {
+            auto s = S11776!(a => 1)();
+            static assert(typeof(s).mangleof ==
+                "S"~"6mangle"~"56"~(
+                    "__T"~"6S11776"~"S42"~("6mangle"~"9test11776"~"FZ"~"9__lambda1MFZ"~"9__lambda1")~"Z"
+                )~"6S11776");
+        }
+    };
+}
+
+/***************************************************/
+// 12044
+
+struct S12044(T)
+{
+    void f()()
+    {
+        new T[1];
+    }
+
+    bool opEquals(O)(O)
+    {
+        f();
+    }
+}
+
+void test12044()
+{
+    ()
+    {
+        enum E { e }
+        auto arr = [E.e];
+        S12044!E s;
+    }
+    ();
+}
+
+/*******************************************/
+// 12217
+
+void test12217(int)
+{
+    static struct S {}
+    void bar() {}
+    int var;
+    template X(T) {}
+
+    static assert(    S.mangleof ==  "S6mangle9test12217FiZ1S");
+    static assert(  bar.mangleof == "_D6mangle9test12217FiZ3barMFNaNbNiNfZv");
+    static assert(  var.mangleof == "_D6mangle9test12217FiZ3vari");
+    static assert(X!int.mangleof ==   "6mangle9test12217FiZ8__T1XTiZ");
+}
+
+void test12217() {}
+
+/***************************************************/
+// 12231
+
+void func12231a()()
+if (is(typeof({
+        class C {}
+        static assert(C.mangleof ==
+            "C6mangle16__U10func12231aZ10func12231aFZ9__lambda1MFZ1C");
+            //         ###            L                       #
+    })))
+{}
+
+void func12231b()()
+if (is(typeof({
+        class C {}
+        static assert(C.mangleof ==
+            "C6mangle16__U10func12231bZ10func12231bFZ9__lambda1MFZ1C");
+            //         L__L           L                       LL
+    })) &&
+    is(typeof({
+        class C {}
+        static assert(C.mangleof ==
+            "C6mangle16__U10func12231bZ10func12231bFZ9__lambda2MFZ1C");
+            //         L__L           L                       LL
+    })))
+{}
+
+void func12231c()()
+if (is(typeof({
+        class C {}
+        static assert(C.mangleof ==
+            "C6mangle16__U10func12231cZ10func12231cFZ9__lambda1MFZ1C");
+            //         L__L           L                       LL
+    })))
+{
+    (){
+        class C {}
+        static assert(C.mangleof ==
+            "C6mangle16__T10func12231cZ10func12231cFZ9__lambda1MFZ1C");
+            //         L__L           L                       LL
+    }();
+}
+
+void func12231c(X)()
+if (is(typeof({
+        class C {}
+        static assert(C.mangleof ==
+            "C6mangle20__U10func12231cTAyaZ10func12231cFZ9__lambda1MFZ1C");
+            //         L__L           L___L                       LL
+    })))
+{
+    (){
+        class C {}
+        static assert(C.mangleof ==
+            "C6mangle20__T10func12231cTAyaZ10func12231cFZ9__lambda1MFZ1C");
+            //         L__L           L___L                       LL
+    }();
+}
+
+void test12231()
+{
+    func12231a();
+
+    func12231b();
+
+    func12231c();
+    func12231c!string();
+}
+
+/***************************************************/
+
+int test2a(scope int a) { return a; }
+
+static assert(test2a.mangleof == "_D6mangle6test2aFiZi");
+
+/***************************************************/
+
+class CC
+{
+    int* p;
+
+    int* member() scope
+    {
+        return p;
+    }
+}
+
+static assert(CC.member.mangleof == "_D6mangle2CC6memberMFNlZPi");
+
+/***************************************************/
+
+void fooA(void delegate (scope void delegate()) dg)
+{
+}
+void fooB(void delegate (void delegate()) scope dg)
+{
+}
+
+//pragma(msg, fooA.mangleof);
+//pragma(msg, fooB.mangleof);
+static assert(typeof(fooA).mangleof != typeof(fooB).mangleof);
+
+
+/***************************************************/
+
+void main()
+{
+    test10077h();
+    test10077i();
+    test12044();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/mars1.d b/gcc/testsuite/gdc.test/runnable/mars1.d
new file mode 100644
index 00000000000..81905c03823
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/mars1.d
@@ -0,0 +1,1551 @@
+
+import core.stdc.stdio;
+
+void testgoto()
+{
+    int i;
+
+    i = 3;
+    goto L4;
+L3: i++;
+    goto L5;
+L4: goto L3;
+L5: assert(i == 4);
+}
+
+int testswitch()
+{
+    int i;
+
+    i = 3;
+    switch (i)
+    {
+        case 0:
+        case 1:
+        default:
+            assert(0);
+        case 3:
+            break;
+    }
+    return 0;
+}
+
+void testdo()
+{
+    int x = 0;
+
+    do
+    {
+        x++;
+    } while (x < 10);
+    printf("x == %d\n", x);
+    assert(x == 10);
+}
+
+
+void testbreak()
+{   int i, j;
+
+  Louter:
+    for (i = 0; i < 10; i++)
+    {
+        for (j = 0; j < 10; j++)
+        {
+            if (j == 3)
+                break Louter;
+        }
+    }
+
+    printf("i = %d, j = %d\n", i, j);
+    assert(i == 0);
+    assert(j == 3);
+}
+
+///////////////////////
+
+int foo(string s)
+{
+    int i;
+
+    i = 0;
+    switch (s)
+    {
+        case "hello":
+            i = 1;
+            break;
+        case "goodbye":
+            i = 2;
+            break;
+        case "goodb":
+            i = 3;
+            break;
+        default:
+            i = 10;
+            break;
+    }
+    return i;
+}
+
+
+void teststringswitch()
+{   int i;
+
+    i = foo("hello");
+    printf("i = %d\n", i);
+    assert(i == 1);
+
+    i = foo("goodbye");
+    printf("i = %d\n", i);
+    assert(i == 2);
+
+    i = foo("goodb");
+    printf("i = %d\n", i);
+    assert(i == 3);
+
+    i = foo("huzzah");
+    printf("i = %d\n", i);
+    assert(i == 10);
+}
+
+
+///////////////////////
+
+struct Foo
+{
+    int a;
+    char b;
+    long c;
+}
+
+Foo test(Foo f)
+{
+    f.a += 1;
+    f.b += 3;
+    f.c += 4;
+    return f;
+}
+
+
+void teststrarg()
+{
+    Foo g;
+    g.a = 1;
+    g.b = 2;
+    g.c = 3;
+
+    Foo q;
+    q = test(g);
+    assert(q.a == 2);
+    assert(q.b == 5);
+    assert(q.c == 7);
+}
+
+///////////////////////
+
+align (1) struct Foo1
+{
+  align (1):
+    int a;
+    char b;
+    long c;
+}
+
+struct Foo2
+{
+    int a;
+    char b;
+    long c;
+}
+
+struct Foo3
+{
+    int a;
+    align (1) char b;
+    long c;
+}
+
+struct Foo4
+{
+    int a;
+    struct { char b; }
+    long c;
+}
+
+void testsizes()
+{
+    printf("%d\n", Foo1.sizeof);
+    assert(Foo1.a.offsetof == 0);
+    assert(Foo1.b.offsetof == 4);
+    assert(Foo1.c.offsetof == 5);
+    assert(Foo1.sizeof == 13);
+
+    assert(Foo2.a.offsetof == 0);
+    assert(Foo2.b.offsetof == 4);
+    assert(Foo2.c.offsetof == 8);
+    assert(Foo2.sizeof == 16);
+
+    assert(Foo3.a.offsetof == 0);
+    assert(Foo3.b.offsetof == 4);
+    assert(Foo3.c.offsetof == 8);
+    assert(Foo3.b.sizeof == 1);
+    assert(Foo3.sizeof == 16);
+
+    assert(Foo4.sizeof == 16);
+}
+
+///////////////////////
+
+size_t cond11565(size_t val)
+{
+    return val ? size_t.max : 0;
+}
+
+void test11565()
+{
+    assert(cond11565(true) == size_t.max);
+}
+
+///////////////////////
+
+int array1[3] = [1:1,2,0:3];
+
+void testarrayinit()
+{
+    assert(array1[0] == 3);
+    assert(array1[1] == 1);
+    assert(array1[2] == 2);
+}
+
+///////////////////////
+
+void test13023(ulong n)
+{
+    static void func(bool b) {}
+
+    ulong k = 0;
+
+    func(k >= n / 2);
+
+    if (k >= n / 2)
+        assert(0);
+}
+
+///////////////////////
+
+struct U { int a; union { char c; int d; } long b; }
+
+U f = { b:3, d:2, a:1 };
+
+void testU()
+{
+    assert(f.b == 3);
+    assert(f.d == 2);
+    assert(f.c == 2);
+    assert(f.a == 1);
+    assert(f.sizeof == 16);
+    assert(U.sizeof == 16);
+}
+
+
+///////////////////////
+
+void testulldiv()
+{
+    __gshared ulong[4][] vectors =
+    [
+        [10,3,3,1],
+        [10,1,10,0],
+        [3,10,0,3],
+        [10,10,1,0],
+        [10_000_000_000L, 11_000_000_000L, 0, 10_000_000_000L],
+        [11_000_000_000L, 10_000_000_000L, 1, 1_000_000_000L],
+        [11_000_000_000L, 11_000_000_000L, 1, 0],
+        [10_000_000_000L, 10, 1_000_000_000L, 0],
+        [0x8000_0000_0000_0000, 0x8000_0000_0000_0000, 1, 0],
+        [0x8000_0000_0000_0001, 0x8000_0000_0000_0001, 1, 0],
+        [0x8000_0001_0000_0000, 0x8000_0001_0000_0000, 1, 0],
+        [0x8000_0001_0000_0000, 0x8000_0000_0000_0000, 1, 0x1_0000_0000],
+        [0x8000_0001_0000_0000, 0x8000_0000_8000_0000, 1, 0x8000_0000],
+        [0x8000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF, 1, 1],
+        [0x8000_0000_0000_0000, 0x8000_0000_0000_0001, 0, 0x8000_0000_0000_0000],
+        [0x8000_0000_0000_0000, 0x8000_0001_0000_0000, 0, 0x8000_0000_0000_0000],
+    ];
+
+    for (size_t i = 0; i < vectors.length; i++)
+    {
+        ulong q = vectors[i][0] / vectors[i][1];
+        if (q != vectors[i][2])
+            printf("[%d] %lld / %lld = %lld, should be %lld\n",
+                vectors[i][0], vectors[i][1], q, vectors[i][2]);
+
+        ulong r = vectors[i][0] % vectors[i][1];
+        if (r != vectors[i][3])
+            printf("[%d] %lld %% %lld = %lld, should be %lld\n",
+                i, vectors[i][0], vectors[i][1], r, vectors[i][3]);
+    }
+}
+
+////////////////////////////////////////////////////////////////////////
+
+
+uint udiv10(uint x)
+{
+    return x / 10;
+}
+
+uint udiv14(uint x)
+{
+    return x / 14;
+}
+
+uint udiv14007(uint x)
+{
+    return x / 14007;
+}
+
+uint umod10(uint x)
+{
+    return x % 10;
+}
+
+uint umod14(uint x)
+{
+    return x % 14;
+}
+
+uint umod14007(uint x)
+{
+    return x % 14007;
+}
+
+uint uremquo10(uint x)
+{
+    return (x / 10) | (x % 10);
+}
+
+uint uremquo14(uint x)
+{
+    return (x / 14) | (x % 14);
+}
+
+uint uremquo14007(uint x)
+{
+    return (x / 14007) | (x % 14007);
+}
+
+
+
+ulong uldiv10(ulong x)
+{
+    return x / 10;
+}
+
+ulong uldiv14(ulong x)
+{
+    return x / 14;
+}
+
+ulong uldiv14007(ulong x)
+{
+    return x / 14007;
+}
+
+ulong ulmod10(ulong x)
+{
+    return x % 10;
+}
+
+ulong ulmod14(ulong x)
+{
+    return x % 14;
+}
+
+ulong ulmod14007(ulong x)
+{
+    return x % 14007;
+}
+
+ulong ulremquo10(ulong x)
+{
+    return (x / 10) | (x % 10);
+}
+
+ulong ulremquo14(ulong x)
+{
+    return (x / 14) | (x % 14);
+}
+
+ulong ulremquo14007(ulong x)
+{
+    return (x / 14007) | (x % 14007);
+}
+
+
+void testfastudiv()
+{
+  {
+    static uint x10 = 10;
+    static uint x14 = 14;
+    static uint x14007 = 14007;
+
+    uint u = 10000;
+    uint r;
+    r = udiv10(u);  assert(r == u/x10);
+    r = udiv14(u);  assert(r == u/x14);
+    r = udiv14007(u);  assert(r == u/x14007);
+    r = umod10(u);  assert(r == u%x10);
+    r = umod14(u);  assert(r == u%x14);
+    r = umod14007(u);  assert(r == u%x14007);
+    r = uremquo10(u);  assert(r == ((u/10)|(u%x10)));
+    r = uremquo14(u);  assert(r == ((u/14)|(u%x14)));
+    r = uremquo14007(u);  assert(r == ((u/14007)|(u%x14007)));
+  }
+  {
+    static ulong y10 = 10;
+    static ulong y14 = 14;
+    static ulong y14007 = 14007;
+
+    ulong u = 10000;
+    ulong r;
+    r = uldiv10(u);  assert(r == u/y10);
+    r = uldiv14(u);  assert(r == u/y14);
+    r = uldiv14007(u);  assert(r == u/y14007);
+    r = ulmod10(u);  assert(r == u%y10);
+    r = ulmod14(u);  assert(r == u%y14);
+    r = ulmod14007(u);  assert(r == u%y14007);
+    r = ulremquo10(u);  assert(r == ((u/10)|(u%y10)));
+    r = ulremquo14(u);  assert(r == ((u/14)|(u%y14)));
+    r = ulremquo14007(u);  assert(r == ((u/14007)|(u%y14007)));
+  }
+}
+
+
+////////////////////////////////////////////////////////////////////////
+
+void vfunc() {}
+
+void test12095(int k)
+{
+    int e = 0;
+    e ? k || assert(0) : !e || vfunc();
+    e ? k || assert(0) : e && vfunc();
+    !e ? !e || vfunc() : k || assert(0);
+}
+
+
+////////////////////////////////////////////////////////////////////////
+
+
+bool test3918a( float t, real u )
+{
+    printf("%f\n", u );
+    return t && u;
+}
+
+bool test3918b( real t, float u )
+{
+    printf("%f\n", t );
+    return t && u;
+}
+
+void test3918()
+{
+    assert(test3918a(float.nan, real.nan));
+    assert(test3918b(real.nan, float.nan));
+}
+
+////////////////////////////////////////////////////////////////////////
+
+
+int div10(int x)
+{
+    return x / 10;
+}
+
+int div14(int x)
+{
+    return x / 14;
+}
+
+int div14007(int x)
+{
+    return x / 14007;
+}
+
+int mod10(int x)
+{
+    return x % 10;
+}
+
+int mod14(int x)
+{
+    return x % 14;
+}
+
+int mod14007(int x)
+{
+    return x % 14007;
+}
+
+int remquo10(int x)
+{
+    return (x / 10) | (x % 10);
+}
+
+int remquo14(int x)
+{
+    return (x / 14) | (x % 14);
+}
+
+int remquo14007(int x)
+{
+    return (x / 14007) | (x % 14007);
+}
+
+////////////////////
+
+int mdiv10(int x)
+{
+    return x / -10;
+}
+
+int mdiv14(int x)
+{
+    return x / -14;
+}
+
+int mdiv14007(int x)
+{
+    return x / -14007;
+}
+
+int mmod10(int x)
+{
+    return x % -10;
+}
+
+int mmod14(int x)
+{
+    return x % -14;
+}
+
+int mmod14007(int x)
+{
+    return x % -14007;
+}
+
+int mremquo10(int x)
+{
+    return (x / -10) | (x % -10);
+}
+
+int mremquo14(int x)
+{
+    return (x / -14) | (x % -14);
+}
+
+int mremquo14007(int x)
+{
+    return (x / -14007) | (x % -14007);
+}
+
+////////////////////
+
+
+long ldiv10(long x)
+{
+    return x / 10;
+}
+
+long ldiv14(long x)
+{
+    return x / 14;
+}
+
+long ldiv14007(long x)
+{
+    return x / 14007;
+}
+
+long lmod10(long x)
+{
+    return x % 10;
+}
+
+long lmod14(long x)
+{
+    return x % 14;
+}
+
+long lmod14007(long x)
+{
+    return x % 14007;
+}
+
+long lremquo10(long x)
+{
+    return (x / 10) | (x % 10);
+}
+
+long lremquo14(long x)
+{
+    return (x / 14) | (x % 14);
+}
+
+long lremquo14007(long x)
+{
+    return (x / 14007) | (x % 14007);
+}
+
+
+////////////////////
+
+
+long mldiv10(long x)
+{
+    return x / -10;
+}
+
+long mldiv14(long x)
+{
+    return x / -14;
+}
+
+long mldiv14007(long x)
+{
+    return x / -14007;
+}
+
+long mlmod10(long x)
+{
+    return x % -10;
+}
+
+long mlmod14(long x)
+{
+    return x % -14;
+}
+
+long mlmod14007(long x)
+{
+    return x % -14007;
+}
+
+long mlremquo10(long x)
+{
+    return (x / -10) | (x % -10);
+}
+
+long mlremquo14(long x)
+{
+    return (x / -14) | (x % -14);
+}
+
+long mlremquo14007(long x)
+{
+    return (x / -14007) | (x % -14007);
+}
+
+
+
+void testfastdiv()
+{
+  {
+    static int x10 = 10;
+    static int x14 = 14;
+    static int x14007 = 14007;
+
+    int u = 10000;
+    int r;
+    r = div10(u);  assert(r == u/x10);
+    r = div14(u);  assert(r == u/x14);
+    r = div14007(u);  assert(r == u/x14007);
+    r = mod10(u);  assert(r == u%x10);
+    r = mod14(u);  assert(r == u%x14);
+    r = mod14007(u);  assert(r == u%x14007);
+    r = remquo10(u);  assert(r == ((u/x10)|(u%x10)));
+    r = remquo14(u);  assert(r == ((u/x14)|(u%x14)));
+    r = remquo14007(u);  assert(r == ((u/x14007)|(u%x14007)));
+  }
+  {
+    static int t10 = -10;
+    static int t14 = -14;
+    static int t14007 = -14007;
+
+    int u = 10000;
+    int r;
+    r = mdiv10(u);  assert(r == u/t10);
+    r = mdiv14(u);  assert(r == u/t14);
+    r = mdiv14007(u);  assert(r == u/t14007);
+    r = mmod10(u);  assert(r == u%t10);
+    r = mmod14(u);  assert(r == u%t14);
+    r = mmod14007(u);  assert(r == u%t14007);
+    r = mremquo10(u);  assert(r == ((u/t10)|(u%t10)));
+    r = mremquo14(u);  assert(r == ((u/t14)|(u%t14)));
+    r = mremquo14007(u);  assert(r == ((u/t14007)|(u%t14007)));
+  }
+  {
+    static long y10 = 10;
+    static long y14 = 14;
+    static long y14007 = 14007;
+
+    long u = 10000;
+    long r;
+    r = ldiv10(u);  assert(r == u/y10);
+    r = ldiv14(u);  assert(r == u/y14);
+    r = ldiv14007(u);  assert(r == u/y14007);
+    r = lmod10(u);  assert(r == u%y10);
+    r = lmod14(u);  assert(r == u%y14);
+    r = lmod14007(u);  assert(r == u%y14007);
+    r = lremquo10(u);  assert(r == ((u/y10)|(u%y10)));
+    r = lremquo14(u);  assert(r == ((u/y14)|(u%y14)));
+    r = lremquo14007(u);  assert(r == ((u/y14007)|(u%y14007)));
+  }
+  {
+    static long z10 = -10;
+    static long z14 = -14;
+    static long z14007 = -14007;
+
+    long u = 10000;
+    long r;
+    r = mldiv10(u);  assert(r == u/z10);
+    r = mldiv14(u);  assert(r == u/z14);
+    r = mldiv14007(u);  assert(r == u/z14007);
+    r = mlmod10(u);  assert(r == u%z10);
+    r = mlmod14(u);  assert(r == u%z14);
+    r = mlmod14007(u);  assert(r == u%z14007);
+    r = mlremquo10(u);  assert(r == ((u/z10)|(u%z10)));
+    r = mlremquo14(u);  assert(r == ((u/z14)|(u%z14)));
+    r = mlremquo14007(u);  assert(r == ((u/z14007)|(u%z14007)));
+  }
+}
+
+////////////////////////////////////////////////////////////////////////
+
+
+T docond1(T)(T l, ubyte thresh, ubyte val) {
+    l += (thresh < val);
+    return l;
+}
+
+T docond2(T)(T l, ubyte thresh, ubyte val) {
+    l -= (thresh >= val);
+    return l;
+}
+
+T docond3(T)(T l, ubyte thresh, ubyte val) {
+    l += (thresh >= val);
+    return l;
+}
+
+T docond4(T)(T l, ubyte thresh, ubyte val) {
+    l -= (thresh < val);
+    return l;
+}
+
+void testdocond()
+{
+    assert(docond1!ubyte(10,3,5)  == 11);
+    assert(docond1!ushort(10,3,5) == 11);
+    assert(docond1!uint(10,3,5)   == 11);
+    assert(docond1!ulong(10,3,5)  == 11);
+
+    assert(docond2!ubyte(10,3,5)  == 10);
+    assert(docond2!ushort(10,3,5) == 10);
+    assert(docond2!uint(10,3,5)   == 10);
+    assert(docond2!ulong(10,3,5)  == 10);
+
+    assert(docond3!ubyte(10,3,5)  == 10);
+    assert(docond3!ushort(10,3,5) == 10);
+    assert(docond3!uint(10,3,5)   == 10);
+    assert(docond3!ulong(10,3,5)  == 10);
+
+    assert(docond4!ubyte(10,3,5)  == 9);
+    assert(docond4!ushort(10,3,5) == 9);
+    assert(docond4!uint(10,3,5)   == 9);
+    assert(docond4!ulong(10,3,5)  == 9);
+
+
+    assert(docond1!ubyte(10,5,3)  == 10);
+    assert(docond1!ushort(10,5,3) == 10);
+    assert(docond1!uint(10,5,3)   == 10);
+    assert(docond1!ulong(10,5,3)  == 10);
+
+    assert(docond2!ubyte(10,5,3)  == 9);
+    assert(docond2!ushort(10,5,3) == 9);
+    assert(docond2!uint(10,5,3)   == 9);
+    assert(docond2!ulong(10,5,3)  == 9);
+
+    assert(docond3!ubyte(10,5,3)  == 11);
+    assert(docond3!ushort(10,5,3) == 11);
+    assert(docond3!uint(10,5,3)   == 11);
+    assert(docond3!ulong(10,5,3)  == 11);
+
+    assert(docond4!ubyte(10,5,3)  == 10);
+    assert(docond4!ushort(10,5,3) == 10);
+    assert(docond4!uint(10,5,3)   == 10);
+    assert(docond4!ulong(10,5,3)  == 10);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+struct S8658
+{
+    int[16385] a;
+}
+
+void foo8658(S8658 s)
+{
+    int x;
+}
+
+void test8658()
+{
+    S8658 s;
+    for(int i = 0; i < 1000; i++)
+        foo8658(s);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+uint neg(uint i)
+{
+    return ~i + 1;
+}
+
+uint com(uint i)
+{
+    return -i - 1;
+}
+
+float com(float i)
+{
+    return -i - 1;
+}
+
+uint com2(uint i)
+{
+    return -(i + 1);
+}
+
+void testnegcom()
+{
+    assert(neg(3) == -3);
+    assert(com(3) == -4);
+    assert(com(3.0f) == -4.0f);
+    assert(com2(3) == -4);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+int oror1(char c)
+{
+    return ((((((((((cast(int) c <= 32 || cast(int) c == 46) || cast(int) c == 44)
+                 || cast(int) c == 58) || cast(int) c == 59) || cast(int) c == 60)
+              || cast(int) c == 62) || cast(int) c == 34) || cast(int) c == 92)
+           || cast(int) c == 39) != 0);
+}
+
+int oror2(char c)
+{
+    return ((((((((((c <= 32 || c == 46) || c == 44)
+                 || c == 58) || c == 59) || c == 60)
+                 || c == 62) || c == 34) || c == 92)
+                 || c == 39) != 0);
+}
+
+void testoror()
+{
+    assert(oror1(0) == 1);
+    assert(oror1(32) == 1);
+    assert(oror1(46) == 1);
+    assert(oror1(44) == 1);
+    assert(oror1(58) == 1);
+    assert(oror1(59) == 1);
+    assert(oror1(60) == 1);
+    assert(oror1(62) == 1);
+    assert(oror1(34) == 1);
+    assert(oror1(92) == 1);
+    assert(oror1(39) == 1);
+    assert(oror1(33) == 0);
+    assert(oror1(61) == 0);
+    assert(oror1(93) == 0);
+    assert(oror1(255) == 0);
+
+    assert(oror2(0) == 1);
+    assert(oror2(32) == 1);
+    assert(oror2(46) == 1);
+    assert(oror2(44) == 1);
+    assert(oror2(58) == 1);
+    assert(oror2(59) == 1);
+    assert(oror2(60) == 1);
+    assert(oror2(62) == 1);
+    assert(oror2(34) == 1);
+    assert(oror2(92) == 1);
+    assert(oror2(39) == 1);
+    assert(oror2(33) == 0);
+    assert(oror2(61) == 0);
+    assert(oror2(93) == 0);
+    assert(oror2(255) == 0);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+bool bt1(int p, int a, int b)
+{
+    return p && ((1 << b) & a);
+}
+
+bool bt2(int p, long a, long b)
+{
+    return p && ((1L << b) & a);
+}
+
+void testbt()
+{
+    assert(bt1(1,7,2) == 1);
+    assert(bt1(1,7,3) == 0);
+
+    assert(bt2(1,0x7_0000_0000,2+32) == 1);
+    assert(bt2(1,0x7_0000_0000,3+32) == 0);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void test13383()
+{
+    foreach (k; 32..33)
+    {
+        if (1L & (1L << k))
+        {
+            assert(0);
+        }
+    }
+}
+
+////////////////////////////////////////////////////////////////////////
+
+int andand1(int c)
+{
+    return (c > 32 && c != 46 && c != 44
+                   && c != 58 && c != 59
+                   && c != 60 && c != 62
+                   && c != 34 && c != 92
+                   && c != 39) != 0;
+}
+
+bool andand2(long c)
+{
+    return (c > 32 && c != 46 && c != 44
+                   && c != 58 && c != 59
+                   && c != 60 && c != 62
+                   && c != 34 && c != 92
+                   && c != 39) != 0;
+}
+
+int foox3() { return 1; }
+
+int andand3(uint op)
+{
+    if (foox3() &&
+        op != 7 &&
+        op != 3 &&
+        op != 18 &&
+        op != 30 &&
+        foox3())
+        return 3;
+    return 4;
+}
+
+
+void testandand()
+{
+    assert(andand1(0) == 0);
+    assert(andand1(32) == 0);
+    assert(andand1(46) == 0);
+    assert(andand1(44) == 0);
+    assert(andand1(58) == 0);
+    assert(andand1(59) == 0);
+    assert(andand1(60) == 0);
+    assert(andand1(62) == 0);
+    assert(andand1(34) == 0);
+    assert(andand1(92) == 0);
+    assert(andand1(39) == 0);
+    assert(andand1(33) == 1);
+    assert(andand1(61) == 1);
+    assert(andand1(93) == 1);
+    assert(andand1(255) == 1);
+
+    assert(andand2(0) == false);
+    assert(andand2(32) == false);
+    assert(andand2(46) == false);
+    assert(andand2(44) == false);
+    assert(andand2(58) == false);
+    assert(andand2(59) == false);
+    assert(andand2(60) == false);
+    assert(andand2(62) == false);
+    assert(andand2(34) == false);
+    assert(andand2(92) == false);
+    assert(andand2(39) == false);
+    assert(andand2(33) == true);
+    assert(andand2(61) == true);
+    assert(andand2(93) == true);
+    assert(andand2(255) == true);
+
+    assert(andand3(6) == 3);
+    assert(andand3(30) == 4);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+bool bittest11508(char c)
+{
+    return c=='_' || c=='-' || c=='+' || c=='.';
+}
+
+void testbittest()
+{
+    assert(bittest11508('_'));
+}
+
+////////////////////////////////////////////////////////////////////////
+
+uint or1(ubyte x)
+{
+    return x | (x<<8) | (x<<16) | (x<<24) | (x * 3);
+}
+
+void testor_combine()
+{
+    printf("%x\n", or1(1));
+    assert(or1(5) == 5 * (0x1010101 | 3));
+}
+
+////////////////////////////////////////////////////////////////////////
+
+
+int shrshl(int i) {
+  return ((i+1)>>1)<<1;
+}
+
+void testshrshl()
+{
+    assert(shrshl(6) == 6);
+    assert(shrshl(7) == 8);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+struct S1
+{
+    cdouble val;
+}
+
+void formatTest(S1 s, double re, double im)
+{
+    assert(s.val.re == re);
+    assert(s.val.im == im);
+}
+
+void test10639()
+{
+    S1 s = S1(3+2.25i);
+    formatTest(s, 3, 2.25);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+bool bt10715(in uint[] ary, size_t bitnum)
+{
+    return !!(ary[bitnum >> 5] & 1 << (bitnum & 31)); // uses bt
+}
+
+bool neg_bt10715(in uint[] ary, size_t bitnum)
+{
+    return !(ary[bitnum >> 5] & 1 << (bitnum & 31)); // does not use bt
+}
+
+void test10715()
+{
+    static uint[2]  a1 = [0x1001_1100, 0x0220_0012];
+
+    if ( bt10715(a1,30)) assert(0);
+    if (!bt10715(a1,8))  assert(0);
+    if ( bt10715(a1,30+32)) assert(0);
+    if (!bt10715(a1,1+32))  assert(0);
+
+    if (!neg_bt10715(a1,30)) assert(0);
+    if ( neg_bt10715(a1,8))  assert(0);
+    if (!neg_bt10715(a1,30+32)) assert(0);
+    if ( neg_bt10715(a1,1+32))  assert(0);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+ptrdiff_t compare12164(A12164* rhsPA, A12164* zis)
+{
+    if (*rhsPA == *zis)
+        return 0;
+    return ptrdiff_t.min;
+}
+
+struct A12164
+{
+    int a;
+}
+
+void test12164()
+{
+    auto a = A12164(3);
+    auto b = A12164(2);
+    assert(compare12164(&a, &b));
+}
+
+////////////////////////////////////////////////////////////////////////
+
+int foo10678(char[5] txt)
+{
+    return txt[0] + txt[1] + txt[4];
+}
+
+void test10678()
+{
+    char[5] hello = void;
+    hello[0] = 8;
+    hello[1] = 9;
+    hello[4] = 10;
+    int i = foo10678(hello);
+    assert(i == 27);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+struct S12051
+{
+    this(char c)
+    {
+        assert(c == 'P' || c == 'M');
+    }
+}
+
+void test12051()
+{
+    auto ip = ["abc"];
+    foreach (i, s; ip)
+    {
+        S12051(i < ip.length ? 'P' : 'M');
+    }
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void bug7565( double x) { assert(x == 3); }
+
+void test7565()
+{
+   double y = 3;
+   bug7565( y++ );
+   assert(y == 4);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+int bug8525(int[] devt)
+{
+    return devt[$ - 1];
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void func13190(int) {}
+
+struct Struct13190
+{
+    ulong a;
+    uint b;
+};
+
+__gshared Struct13190* table13190 =
+[
+    Struct13190(1, 1),
+    Struct13190(0, 2)
+];
+
+void test13190()
+{
+    for (int i = 0; table13190[i].a; i++)
+    {
+        ulong tbl = table13190[i].a;
+        func13190(i);
+        if (1 + tbl)
+        {
+            if (tbl == 0x80000)
+                return;
+        }
+    }
+}
+
+////////////////////////////////////////////////////////////////////////
+
+double foo13485(double c, double d)
+{
+    // This must not be optimized to c += (d + d)
+    c += d;
+    c += d;
+    return c;
+}
+
+void test13485()
+{
+    enum double d = 0X1P+1023;
+    assert(foo13485(-d, d) == d);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void test12833a(int a)
+{
+    long x = cast(long)a;
+
+    switch (cast(int)(cast(ushort)(x >> 16 & 65535L)))
+    {
+        case 1:
+        {
+            break;
+        }
+        default:
+        {
+            assert(0);
+        }
+    }
+}
+
+void test12833()
+{
+    test12833a(0x1_0000);
+}
+
+/***********************************************/
+
+struct Point9449
+{
+    double f = 3.0;
+    double g = 4.0;
+}
+
+void test9449()
+{
+    Point9449[1] arr;
+    if (arr[0].f != 3.0) assert(0);
+    if (arr[0].g != 4.0) assert(0);
+}
+
+////////////////////////////////////////////////////////////////////////
+// https://issues.dlang.org/show_bug.cgi?id=12057
+
+bool prop12057(real x) { return false; }
+double f12057(real) { return double.init; }
+void test12057()
+{
+    real fc = f12057(real.init);
+    if (fc == 0 || fc.prop12057) {}
+}
+
+
+////////////////////////////////////////////////////////////////////////
+
+long modulo24 (long ticks)
+{
+    ticks %= 864000000000;
+    if (ticks < 0)
+        ticks += 864000000000;
+    return ticks;
+}
+
+void test13784()
+{
+    assert (modulo24(-141600000000) == 722400000000);
+}
+
+
+////////////////////////////////////////////////////////////////////////
+
+struct S13969 {
+    int x, y;
+}
+
+int test13969(const S13969* f) {
+    return 0 % ((f.y > 0) ? f.x / f.y : f.x / -f.y);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+int[] arr14436;
+void test14436()
+{
+    assert(arr14436 == null);
+    arr14436 = [1, 2, 3];
+    assert(arr14436 != null);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void test14220()
+{
+    auto a = toString(14);
+
+    printf("a.ptr = %p, a.length = %d\n", a.ptr, cast(int)a.length);
+    return;
+}
+
+auto toString(int value)
+{
+    uint mValue = value;
+
+    char[int.sizeof * 3] buffer = void;
+    size_t index = buffer.length;
+
+    do
+    {
+        uint div = cast(int)(mValue / 10);
+        char mod = mValue % 10 + '0';
+        buffer[--index] = mod;        // Line 22
+        mValue = div;
+    } while (mValue);
+
+    //printf("buffer.ptr = %p, index = %d\n", buffer.ptr, cast(int)index);
+    return dup(buffer[index .. $]);
+}
+
+char[] dup(char[] a)
+{
+    //printf("a.ptr = %p, a.length = %d\n", a.ptr, cast(int)a.length);
+    a[0] = 1;       // segfault
+    return a;
+}
+
+////////////////////////////////////////////////////////////////////////
+
+int stripLeft(int str, int dc)
+{
+    while (true)
+    {
+        int a = str;
+        int s = a;
+        str += 1;
+        if (dc) return s;
+    }
+}
+
+void test14829()
+{
+    if (stripLeft(3, 1) != 3) // fails with -O
+        assert(0);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void test2()
+{
+    void test(cdouble v)
+    {
+            auto x2 = cdouble(v);
+            assert(x2 == v);
+    }
+    test(1.2+3.4i);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+// 14782
+
+
+void test14782()
+{
+    static struct Foo
+    {
+        long a = 8;
+        int b = 7;
+    }
+
+    static Foo[1] fun() { Foo[1] a; return a; }
+
+    auto result = fun();
+    assert(result[0].a == 8);
+    assert(result[0].b == 7);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void test14987()
+{
+    static struct Foo
+    {
+        int b = 7;
+    }
+    static assert((Foo[4]).sizeof == 16);
+
+    static Foo[4] fun() { Foo[4] a; return a; }
+
+    auto result = fun();
+    assert(result[0].b == 7);
+    assert(result[1].b == 7);
+    assert(result[2].b == 7);
+    assert(result[3].b == 7);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void test3()
+{
+    int[6] a;
+    int[] b;
+    b = a;
+    b = (b.ptr + b.length - 5)[0 .. b.ptr + b.length - 1 - a.ptr];
+    assert(b.ptr == a.ptr + 1);
+    assert(b.length == 5);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void[] calloc15272(size_t bc) nothrow pure
+{
+    assert(bc == 1);
+    return new void[1];
+}
+
+void test15272()
+{
+    void[] scache = cast(void[])"abc";
+    size_t count = 1;
+    void[]* buckets = &scache;
+    *buckets = calloc15272(count)[0 .. count];
+}
+
+/*****************************************
+ * https://issues.dlang.org/show_bug.cgi?id=15861
+ */
+
+void test15861()
+{
+    double val = 4286853117.;
+
+    (){
+        assert(val == 4286853117.);
+    }();
+}
+
+////////////////////////////////////////////////////////////////////////
+
+// https://issues.dlang.org/show_bug.cgi?id=15629 comment 3
+// -O
+
+void test15629()
+{
+    int[] a = [3];
+    int value = a[0] >= 0 ? a[0] : -a[0];
+    assert(a[0] == 3);
+    writeln(value, a);
+}
+
+void writeln(int v, int[] a)
+{
+}
+
+////////////////////////////////////////////////////////////////////////
+
+// https://issues.dlang.org/show_bug.cgi?id=16699
+
+ulong[1] parseDateRange()
+{
+    try
+    {
+        ulong[1] result;
+        result[0] = 6;
+        return result;
+    }
+    finally
+    {
+    }
+}
+
+void test16699()
+{
+    ulong[1] range = parseDateRange();
+    assert(range[0] == 6);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+// https://issues.dlang.org/show_bug.cgi?id=16102
+
+struct S16102 { ~this() { } }
+
+long[1] f16102()
+{
+    S16102 a;
+    return [1];
+}
+
+void test16102()
+{
+    assert( f16102() == [1] );
+}
+
+////////////////////////////////////////////////////////////////////////
+
+int main()
+{
+    testgoto();
+    testswitch();
+    testdo();
+    testbreak();
+    teststringswitch();
+    teststrarg();
+    test12164();
+    testsizes();
+    testarrayinit();
+    testU();
+    testulldiv();
+    testbittest();
+    test8658();
+    testfastudiv();
+    testfastdiv();
+    test3918();
+    test12051();
+    testdocond();
+    testnegcom();
+    test11565();
+    testoror();
+    testbt();
+    test12095(0);
+    testandand();
+    testor_combine();
+    testshrshl();
+    test13383();
+    test13190();
+    test13485();
+    test14436();
+    test10639();
+    test10715();
+    test10678();
+    test7565();
+    test13023(0x10_0000_0000);
+    test12833();
+    test9449();
+    test12057();
+    test13784();
+    test14220();
+    test14829();
+    test2();
+    test14782();
+    test14987();
+    test3();
+    test15272();
+    test15861();
+    test15629();
+    test16699();
+    test16102();
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/mixin1.d b/gcc/testsuite/gdc.test/runnable/mixin1.d
new file mode 100644
index 00000000000..5332ebbfecb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/mixin1.d
@@ -0,0 +1,1470 @@
+
+module mixin1;
+
+import std.stdio;
+
+alias TypeTuple(T...) = T;
+
+/*******************************************/
+
+mixin template Foo(T)
+{
+    T x;
+}
+
+mixin Foo!(uint);
+
+struct Bar
+{
+    template Abc(T)
+    {
+        T y;
+    }
+
+    template Def(T)
+    {
+        T z;
+    }
+}
+
+mixin Bar.Abc!(int);
+
+Bar b;
+mixin typeof(b).Def!(int);
+
+void test1()
+{
+    x = 3;
+    assert(x == 3);
+    y = 4;
+    assert(y == 4);
+    z = 5;
+    assert(z == 5);
+}
+
+/*******************************************/
+
+template Foo2(T)
+{
+    T x2 = T.sizeof;
+}
+
+mixin Foo2!(uint) B2;
+mixin Foo2!(long) C2;
+mixin Foo2!(int);
+
+void test2()
+{
+    B2.x2 = 3;
+    assert(B2.x2 == 3);
+    assert(C2.x2 == long.sizeof);
+//    assert(x2 == int.sizeof);
+}
+
+/*******************************************/
+
+template Foo3(T)
+{
+    int func() { printf("Foo3.func()\n"); return 1; }
+}
+
+class Bar3
+{
+    mixin Foo3!(int);
+}
+
+class Code3 : Bar3
+{
+    override int func() { printf("Code3.func()\n"); return 2; }
+}
+
+void test3()
+{
+    int i;
+
+    Bar3 b = new Bar3();
+    i = b.func();
+    assert(i == 1);
+
+    b = new Code3();
+    i = b.func();
+    assert(i == 2);
+}
+
+/*******************************************/
+
+template Foo4(T)
+{
+    int func() { printf("Foo4.func()\n"); return 1; }
+}
+
+struct Bar4
+{
+    mixin Foo4!(int);
+}
+
+void test4()
+{
+    int i;
+
+    Bar4 b;
+    i = b.func();
+    assert(i == 1);
+}
+
+/*******************************************/
+
+template Foo5()
+{
+    int func() { printf("Foo5.func()\n"); return 1; }
+}
+
+struct Bar5
+{
+    mixin Foo5;
+}
+
+void test5()
+{
+    int i;
+
+    Bar5 b;
+    i = b.func();
+    assert(i == 1);
+}
+
+/*******************************************/
+
+template Foo6()
+{
+    int x = 5;
+}
+
+struct Bar6
+{
+    mixin Foo6;
+}
+
+void test6()
+{
+    int i;
+
+    Bar6 b;
+    i = b.x;
+    assert(i == 5);
+    assert(b.sizeof == int.sizeof);
+}
+
+/*******************************************/
+
+template Foo7()
+{
+    int x = 5;
+}
+
+class Bar7
+{
+    int y = 6;
+    mixin Foo7;
+}
+
+void test7()
+{
+    int i;
+
+    Bar7 b = new Bar7();
+    i = b.x;
+    printf("b.x = %d\n", b.x);
+    assert(i == 5);
+}
+
+/*******************************************/
+
+template Foo8()
+{
+    int x = 5;
+    int bar() { return 7; }
+}
+
+void test8()
+{
+    mixin Foo8;
+    printf("x = %d\n", x);
+    assert(x == 5);
+    assert(bar() == 7);
+}
+
+/*******************************************/
+
+template Foo9()
+{
+    int abc() { return y; }
+}
+
+void test9()
+{
+    int y = 8;
+    mixin Foo9;
+    assert(abc() == 8);
+}
+
+/*******************************************/
+
+template Foo10(alias b)
+{
+    typeof(b) abc() { return b; }
+}
+
+void test10()
+{
+    int y = 8;
+    mixin Foo10!(y);
+    assert(abc() == 8);
+}
+
+
+/*******************************************/
+
+template Foo11(alias b)
+{
+    int abc() { return b; }
+}
+
+void test11()
+{
+    int y = 8;
+    mixin Foo11!(y) B;
+    assert(B.abc() == 8);
+}
+
+/*******************************************/
+
+template duff_for(alias id1, alias id2, alias s)
+{
+
+    void duff_for()
+    {
+        printf("duff_for(%d, %d)\n", id1, id2);
+        typeof(id1) id = id1;
+        printf("fid = %d, %d\n", id, (id2 - id) % 8);
+        switch ((id2 - id) % 8)
+        {
+        case 0:
+         while (id != id2)
+         {
+             printf("wid = %d\n", id);
+             s(); ++id;
+             goto case;
+        case 7: s(); ++id; goto case;
+        case 6: s(); ++id; goto case;
+        case 5: s(); ++id; goto case;
+        case 4: s(); ++id; goto case;
+        case 3: s(); ++id; goto case;
+        case 2: s(); ++id; goto case;
+        case 1: s(); ++id;
+             break;
+        default: assert(0);
+         }
+        }
+    }
+}
+
+void foo12() { printf("foo12\n"); }
+
+void test12()
+{
+    int i = 1;
+    int j = 11;
+
+    mixin duff_for!(i, j, delegate void() { foo12(); });
+    duff_for();
+}
+
+/*******************************************/
+
+template duff(alias id1, alias id2, alias s)
+{
+
+    void duff()
+    {
+        s();
+        s();
+    }
+}
+
+void foo13(int j)
+{
+    printf("foo13 j = %d\n", j);
+    assert(j == 1);
+}
+
+void test13()
+{
+    int i = 1;
+    int j = 11;
+
+    mixin duff!(i, j, delegate { foo13(i); });
+    duff();
+}
+
+/*******************************************/
+
+template Foo14()
+{
+    int x14 = 5;
+}
+
+void test14()
+{
+    int x14 = 6;
+    mixin Foo14;
+    printf("x14 = %d\n", x14);
+    assert(x14 == 6);
+}
+
+/*******************************************/
+
+template Foo15()
+{
+    int x15 = 5;
+
+    int bar15() { return x15; }
+}
+
+int x15 = 6;
+mixin Foo15;
+
+void test15()
+{
+
+    printf("x15 = %d\n", x15);
+    printf("bar15() = %d\n", bar15());
+    assert(x15 == 6);
+    assert(bar15() == 5);
+}
+
+/*******************************************/
+
+template Foo16()
+{
+    int x16 = 5;
+
+    int bar() { return x16; }
+}
+
+mixin Foo16 A16;
+int x16 = 6;
+mixin Foo16 B16;
+
+void test16()
+{
+
+    printf("x16 = %d\n", x16);
+    printf("bar() = %d\n", A16.bar());
+    assert(x16 == 6);
+    assert(A16.x16 == 5);
+    assert(B16.x16 == 5);
+    assert(A16.bar() == 5);
+    assert(B16.bar() == 5);
+}
+
+/*******************************************/
+
+template Foo17()
+{
+    int x17 = 5;
+}
+
+mixin Foo17;
+
+struct Bar17
+{
+    mixin Foo17;
+}
+
+void test17()
+{
+    printf("x17 = %d\n", x17);          // prints 5
+    assert(x17 == 5);
+    {   Bar17 b;
+        int x17 = 3;
+
+        printf("b.x17 = %d\n", b.x17);  // prints 5
+        assert(b.x17 == 5);
+        printf("x17 = %d\n", x17);      // prints 3
+        assert(x17 == 3);
+        {
+            mixin Foo17;
+            printf("x17 = %d\n", x17);  // prints 5
+            assert(x17 == 5);
+            x17 = 4;
+            printf("x17 = %d\n", x17);  // prints 4
+            assert(x17 == 4);
+        }
+        printf("x17 = %d\n", x17);      // prints 3
+        assert(x17 == 3);
+    }
+    printf("x17 = %d\n", x17);          // prints 5
+    assert(x17 == 5);
+}
+
+/*******************************************/
+
+template Foo18() { int z = 3; }
+
+struct Bar18(alias Tmpl)
+{
+    mixin Tmpl;
+}
+
+Bar18!(Foo18) b18;
+
+void test18()
+{
+    assert(b18.z == 3);
+}
+
+/*******************************************/
+
+template Mix1(T)
+{
+    int foo19(T a) { return 2*a; }
+}
+
+template Mix2(T)
+{
+    mixin Mix1!(T);
+
+    int bar19(T a) { return foo19(a); }
+}
+
+mixin Mix2!(int);
+
+void test19()
+{
+    int i;
+
+    i = bar19(7);
+    assert(i == 14);
+}
+
+/*******************************************/
+
+interface A20 { int f(); }
+
+template Foo20()
+{
+    int f()
+    {
+        printf("in C20.f()\n");
+        return 6;
+    }
+}
+
+class C20 : A20
+{
+    mixin Foo20;
+//    void f() { printf("in C20.f()\n"); }
+}
+
+void test20()
+{
+    C20 c = new C20();
+    int i = c.f();
+    assert(i == 6);
+}
+
+/*******************************************/
+
+template Mix21() { this(int x) { printf("mix1\n"); }}
+
+class Bar21
+{
+     int myx;
+     mixin Mix21; // wouldn't compile
+
+     this() { myx = 15; }
+
+//     mixin Mix21; // placing it here compiles
+}
+
+void test21()
+{
+     Bar21 bar = new Bar21();
+}
+
+/*******************************************/
+
+template A22(T)
+{
+    this()
+    {   int i;
+        i = super.foo();
+        assert(i == 67);
+    }
+}
+
+
+class B22
+{
+    int foo() { printf("B22.foo()\n"); return 67; }
+}
+
+class C22 : B22
+{
+    mixin A22!(C22);
+}
+
+void test22()
+{
+    C22 c = new C22;
+}
+
+
+/*******************************************/
+
+template Foo23()
+{
+     const int x = 5;
+}
+
+class C23
+{
+     mixin Foo23 F;
+}
+
+struct D23
+{
+     mixin Foo23 F;
+}
+
+void test23()
+{
+     C23 c = new C23;
+
+     printf("%d\n",c.F.x);
+     assert(c.F.x == 5);
+
+     D23 d;
+
+     printf("%d\n",d.F.x);
+     assert(d.F.x == 5);
+}
+
+/*******************************************/
+
+template T24()
+{
+   void foo24() { return cast(void)0; }
+//   alias foo24 foo24;
+}
+
+mixin T24;
+
+void test24()
+{
+   foo24();
+}
+
+
+/*******************************************/
+
+template ctor25()
+{
+ this() { this(null); }
+ this( Object o ) {}
+}
+
+class Foo25
+{
+ mixin ctor25;
+}
+
+void test25()
+{
+ Foo25 foo = new Foo25();
+}
+
+
+/*******************************************/
+
+template Get26(T)
+{
+    Reader get (ref T x)
+    {
+        return this;
+    }
+}
+
+class Reader
+{
+    mixin Get26!(byte) bar;
+    alias bar.get get;
+    mixin Get26!(int) beq;
+    alias beq.get get;
+}
+
+void test26()
+{
+    Reader r = new Reader;
+    Reader s;
+    byte q;
+    s = r.get (q);
+    assert(s == r);
+}
+
+/*******************************************/
+
+template Template(int L)
+{
+    int i = L;
+    int foo(int b = Template!(9).i) {
+        return b;
+    }
+}
+
+void test27()
+{
+    int i = 10;
+    int foo(int b = Template!(9).i) {
+        return b;
+    }
+    assert(foo()==9);
+}
+
+/*******************************************/
+
+template Blah28(int a, alias B)
+{
+   mixin Blah28!(a-1, B);
+   //mixin Blah28!(0, B);
+}
+
+template Blah28(int a:0, alias B)
+{
+}
+
+void test28()
+{
+   int a;
+   mixin Blah28!(5,a);
+   printf("a = %d\n", a);
+}
+
+/*******************************************/
+
+template T29()
+{
+    int x;
+}
+
+struct S29
+{
+    mixin T29;
+    int y;
+}
+
+const S29 s29 = { x:2, y:3 };
+
+void test29()
+{
+    assert(s29.x == 2);
+    assert(s29.y == 3);
+}
+
+/*******************************************/
+
+class A30
+{
+    template ctor(Type)
+    {
+        this(Type[] arr)
+        {
+            foreach(Type v; arr) writeln(typeid(typeof(v)));
+        }
+    }
+
+    mixin ctor!(int);
+}
+
+void test30()
+{
+    static int[] ints = [0,1,2,3];
+    A30 a = new A30(ints);
+}
+
+/*******************************************/
+
+template Share(T) {
+  const bool opEquals(ref const T x) { return true; }
+}
+
+struct List31(T) {
+
+    //int opEquals(List31 x) { return 0; }
+    mixin Share!(List31);
+}
+
+void test31()
+{
+  List31!(int) x;
+  List31!(int) y;
+  int i = x == y;
+  assert(i == 1);
+}
+
+/*******************************************/
+
+template Blah(int a, alias B)
+{
+   mixin Blah!(a-1, B);
+}
+
+template Blah(int a:0, alias B)
+{
+    int foo()
+    {   return B + 1;
+    }
+}
+
+void test32()
+{
+   int a = 3;
+   mixin Blah!(5,a);
+
+   assert(foo() == 4);
+}
+
+/*******************************************/
+
+template T33( int i )
+{
+    int foo()
+    {
+        printf("foo %d\n", i );
+        return i;
+    }
+    int opCall()
+    {
+        printf("opCall %d\n", i );
+        return i;
+    }
+}
+
+
+class C33
+{
+    mixin T33!( 1 ) t1;
+    mixin T33!( 2 ) t2;
+}
+
+void test33()
+{
+    int i;
+    C33 c1 = new C33;
+    i = c1.t1.foo();
+    assert(i == 1);
+    i = c1.t2.foo();
+    assert(i == 2);
+    i = c1.t1();
+    assert(i == 1);
+    i = c1.t2();
+    assert(i == 2);
+}
+
+
+/*******************************************/
+
+template mix34()
+{
+    int i;
+    void print()
+    {
+        printf( "%d %d\n", i, j );
+        assert(i == 0);
+        assert(j == 0);
+    }
+}
+
+void test34()
+{
+    int j;
+    mixin mix34!();
+
+    print();
+    //printf( "%i\n", i );
+}
+
+/*******************************************/
+
+mixin T35!(int) m35;
+
+template T35(t)
+{
+    t a;
+}
+
+void test35()
+{
+   m35.a = 3;
+}
+
+/*******************************************/
+
+struct Foo36
+{
+    int a;
+    mixin T!(int) m;
+    template T(t)
+    {
+        t b;
+    }
+    int c;
+}
+
+void test36()
+{
+   Foo36 f;
+   printf("f.sizeof = %d\n", f.sizeof);
+   assert(f.sizeof == 12);
+
+   f.a = 1;
+   f.m.b = 2;
+   f.c = 3;
+
+   assert(f.a == 1);
+   assert(f.m.b == 2);
+   assert(f.c == 3);
+}
+
+/*******************************************/
+
+template Foo37()
+{
+    template func() {
+        int func() {
+            return 6;
+        }
+    }
+}
+
+class Baz37
+{
+    mixin Foo37 bar;
+}
+
+void test37()
+{
+    Baz37 b = new Baz37;
+    auto i = b.bar.func!()();
+    assert(i == 6);
+    i = (new Baz37).bar.func!()();
+    assert(i == 6);
+}
+
+/*******************************************/
+
+template Foo38()
+{
+    int a = 4;
+
+    ~this()
+    {
+        printf("one\n");
+        assert(a == 4);
+        assert(b == 5);
+        c++;
+    }
+}
+
+class Outer38
+{   int b = 5;
+
+    static int c;
+
+    mixin Foo38!() bar;
+    mixin Foo38!() abc;
+
+    ~this()
+    {
+        printf("two\n");
+        assert(b == 5);
+        assert(c == 0);
+        c++;
+    }
+}
+
+void test38()
+{
+    Outer38 o = new Outer38();
+    delete o;
+    assert(Outer38.c == 3);
+}
+
+/*******************************************/
+
+template TDtor()
+{
+    ~this()
+    {
+        printf("Mixed-in dtor\n");
+    }
+}
+
+class Base39
+{
+    ~this()
+    {
+        printf("Base39 dtor\n");
+    }
+}
+
+class Class39 : Base39
+{
+    mixin TDtor A;
+    mixin TDtor B;
+
+    ~this()
+    {
+        printf("Class39 dtor\n");
+    }
+}
+
+void test39()
+{
+    auto test = new Class39;
+}
+
+
+/*******************************************/
+
+template Mix40()
+{
+  int  i;
+}
+
+struct Z40
+{
+  union { mixin Mix40; }
+}
+
+void test40()
+{
+    Z40 z;
+    z.i = 3;
+}
+
+/*******************************************/
+
+
+class X41(P...)
+{
+    alias P[0] Q;
+    mixin Q!();
+}
+
+template MYP()
+{
+    void foo() { }
+}
+
+void test41()
+{
+    X41!(MYP) x;
+}
+
+/*******************************************/
+// 2245
+
+template TCALL2245a(ARGS...)
+{
+    int makecall(ARGS args)
+    {
+        return args.length;
+    }
+}
+
+template TCALL2245b(int n)
+{
+    int makecall2(ARGS...)(ARGS args) if (ARGS.length == n)
+    {
+        return args.length;
+    }
+}
+
+class C2245
+{
+    mixin TCALL2245a!();
+    mixin TCALL2245a!(int);
+    mixin TCALL2245a!(int,int);
+
+    mixin TCALL2245b!(0);
+    mixin TCALL2245b!(1);
+    mixin TCALL2245b!(2);
+}
+
+struct S2245
+{
+    mixin TCALL2245a!();
+    mixin TCALL2245a!(int);
+    mixin TCALL2245a!(int,int);
+
+    mixin TCALL2245b!(0);
+    mixin TCALL2245b!(1);
+    mixin TCALL2245b!(2);
+}
+
+void test2245()
+{
+    auto c = new C2245;
+    assert(c.makecall() == 0);
+    assert(c.makecall(0) == 1);
+    assert(c.makecall(0,1) == 2);
+
+    assert(c.makecall2() == 0);
+    assert(c.makecall2(0) == 1);
+    assert(c.makecall2(0,1) == 2);
+
+    assert(c.makecall2!()() == 0);
+    assert(c.makecall2!(int)(0) == 1);
+    assert(c.makecall2!(int, int)(0,1) == 2);
+
+    auto s = S2245();
+    assert(s.makecall() == 0);
+    assert(s.makecall(0) == 1);
+    assert(s.makecall(0,1) == 2);
+
+    assert(s.makecall2() == 0);
+    assert(s.makecall2(0) == 1);
+    assert(s.makecall2(0,1) == 2);
+
+    assert(s.makecall2!()() == 0);
+    assert(s.makecall2!(int)(0) == 1);
+    assert(s.makecall2!(int, int)(0,1) == 2);
+}
+
+/*******************************************/
+// 2481
+
+template M2481() { int i; }
+class Z2481a { struct { mixin M2481!(); } }
+class Z2481b { struct { int i; } }
+
+void test2481()
+{
+    Z2481a z1;
+    Z2481b z2;
+    static assert(z1.i.offsetof == z2.i.offsetof);
+}
+
+/*******************************************/
+// 2740
+
+interface IFooable2740
+{
+    bool foo();
+}
+abstract class CFooable2740
+{
+    bool foo();
+}
+
+mixin template MFoo2740()
+{
+    override bool foo() { return true; }
+}
+
+class Foo2740i1 : IFooable2740
+{
+    override bool foo() { return false; }
+    mixin MFoo2740;
+}
+class Foo2740i2 : IFooable2740
+{
+    mixin MFoo2740;
+    override bool foo() { return false; }
+}
+
+class Foo2740c1 : CFooable2740
+{
+    override bool foo() { return false; }
+    mixin MFoo2740;
+}
+class Foo2740c2 : CFooable2740
+{
+    mixin MFoo2740;
+    override bool foo() { return false; }
+}
+
+void test2740()
+{
+    {
+        auto p = new Foo2740i1();
+        IFooable2740 i = p;
+        assert(p.foo() == false);
+        assert(i.foo() == false);
+    }
+    {
+        auto p = new Foo2740i2();
+        IFooable2740 i = p;
+        assert(p.foo() == false);
+        assert(i.foo() == false);
+    }
+
+    {
+        auto p = new Foo2740c1();
+        CFooable2740 i = p;
+        assert(p.foo() == false);
+        assert(i.foo() == false);
+    }
+    {
+        auto p = new Foo2740c2();
+        CFooable2740 i = p;
+        assert(p.foo() == false);
+        assert(i.foo() == false);
+    }
+}
+
+/*******************************************/
+
+mixin template MTestFoo()
+{
+    int foo(){ return 2; }
+}
+class TestFoo
+{
+    mixin MTestFoo!() test;
+    int foo(){ return 1; }
+}
+void test42()
+{
+    auto p = new TestFoo();
+    assert(p.foo() == 1);
+    assert(p.test.foo() == 2);
+}
+
+/*******************************************/
+// 7744
+
+class ZeroOrMore7744(Expr)
+{
+    enum name = "ZeroOrMore7744!("~Expr.name~")";
+}
+class Range7744(char begin, char end)
+{
+    enum name = "Range7744!("~begin~","~end~")";
+}
+
+mixin(q{
+    class RubySource7744 : ZeroOrMore7744!(DecLiteral7744)
+    {
+    }
+    class DecLiteral7744 : Range7744!('0','9')
+    {
+    }
+});
+
+/*******************************************/
+// 8032
+
+mixin template T8032()
+{
+    void f() { }
+}
+
+class A8032a
+{
+    mixin T8032; // Named mixin causes the error too
+    void f() { }
+}
+class B8032a : A8032a
+{
+    override void f() { }
+}
+
+class A8032b
+{
+    void f() { }
+    mixin T8032; // Named mixin causes the error too
+}
+class B8032b : A8032b
+{
+    override void f() { }
+}
+
+/*********************************************/
+// 9417
+
+mixin template Foo9417()
+{
+    void foo() {}
+}
+
+void test9417()
+{
+    struct B
+    {
+        mixin Foo9417;
+    }
+}
+
+/*******************************************/
+// 11487
+
+template X11487()
+{
+    struct R()
+    {
+        C11487 c;
+
+        ~this()
+        {
+            static assert(is(typeof(c.front) == void));
+        }
+    }
+    template Mix(alias R)
+    {
+        R!() range;
+        @property front() inout {}
+    }
+}
+
+class C11487
+{
+    alias X11487!() M;
+    mixin M.Mix!(M.R);
+}
+
+/*******************************************/
+// 11767
+
+mixin template M11767()
+{
+    struct S11767 {}
+}
+mixin M11767!();
+mixin M11767!();    // OK
+static assert(!__traits(compiles, S11767));
+
+void test11767()
+{
+    mixin M11767!();
+    alias S1 = S11767;
+    {
+        mixin M11767!();
+        alias S2 = S11767;
+        static assert(!is(S1 == S2));
+        static assert(S1.mangleof == "S6mixin19test11767FZ8__mixin16S11767");
+        static assert(S2.mangleof == "S6mixin19test11767FZ8__mixin26S11767");
+    }
+    mixin M11767!();
+    static assert(!__traits(compiles, S11767));
+}
+
+/*******************************************/
+// 12023
+
+void Delete12023(Object obj) {}
+
+template MessageCode12023()
+{
+    alias typeof(this) C;
+
+    struct MessageDeinitHelper
+    {
+        C m_outer;
+
+        ~this()
+        {
+            m_outer.DoDeinitMessaging();
+        }
+    }
+
+    CToClient toClient = null;
+    TypeTuple!(CToClient) toClients;
+
+    class CToClient {}
+
+    void DoDeinitMessaging()
+    {
+        Delete12023(toClient);
+        Delete12023(toClients);
+    }
+}
+
+class TurretCannon12023(ProjectileClass)
+{
+    mixin MessageCode12023;
+}
+
+void test12023()
+{
+    auto tc = new TurretCannon12023!Object();
+}
+
+/*******************************************/
+// 14243
+
+mixin template Mix14243a(int n)
+{
+    static assert(n > 0);
+    import core.stdc.stdio;
+    enum { enumMember = 1 }
+
+    auto a = A14243(n);
+}
+
+mixin template Mix14243b(int n)
+{
+    static if (n > 0)
+    {
+        auto b = A14243(n);
+    }
+}
+
+template foo14243(alias v) { auto bar() { return &v; } }
+mixin template Mix14243c(alias v)
+{
+    // instantiate template in TemplateMixin
+    auto c = foo14243!v.bar();
+}
+
+mixin template Mix14243d(int n)
+{
+    // Type declaration in TemplateMixin
+    struct NS { int x = n; }
+    mixin("auto d" ~ ('0' + n) ~ " = NS();");
+}
+
+mixin template Mix14243e(int n)
+{
+@safe:
+nothrow:
+    int foo() { return var; }
+
+static:
+    struct S { int x; void f() {} }
+    int bar() { return n; }
+}
+
+int test14243()
+{
+    int[] ctor;
+    int[] dtor;
+    struct A14243
+    {
+        int x;
+        this(int x) { ctor ~= x; this.x = x; }
+        ~this()     { dtor ~= x; }
+    }
+
+    {
+        /**/
+        assert(ctor == [] && dtor == []);         mixin Mix14243a!(1);
+        assert(ctor == [1] && dtor == []);        mixin Mix14243b!(12) b1;
+        assert(ctor == [1,12] && dtor == []);     mixin Mix14243b!(24) b2;
+        assert(ctor == [1,12,24] && dtor == []);
+        assert(a.x == 1);
+        static assert(!__traits(compiles, b > 0));  // ambiguous symbol access
+        assert(b1.b.x == 12);
+        assert(b2.b.x == 24);
+
+        int x;
+        mixin Mix14243c!(x);
+        assert(c == &x);
+
+        mixin Mix14243d!(1);
+        mixin Mix14243d!(2);
+        static assert(!is(typeof(d1) == typeof(d2)));
+        assert(d1.x == 1);
+        assert(d2.x == 2);
+
+        assert(ctor == [1,12,24] && dtor == []);
+    }
+    assert(ctor == [1,12,24] && dtor == [24,12,1]);
+
+    {
+        int var = 1;
+        mixin Mix14243e!12;
+        static assert(is(typeof(&foo) == int delegate() @safe nothrow pure @nogc));
+        static assert(is(typeof(&bar) == int function() @safe nothrow pure @nogc));
+        static assert(S.sizeof == int.sizeof);  // s is static struct
+        assert(foo() == 1);
+        assert(bar() == 12);
+    }
+    return 1;
+}
+static assert(test14243()); // changed to be workable
+
+/*******************************************/
+// 10492
+
+class TestClass10492 {}
+
+mixin template mix10492(string name)
+{
+    mixin("scope " ~ name ~ " = new TestClass10492;" );
+}
+
+void test10492()
+{
+    mixin mix10492!("var");
+}
+
+/*******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test2245();
+    test2740();
+    test42();
+    test9417();
+    test11767();
+    test12023();
+    test14243();
+    test10492();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/mixin2.d b/gcc/testsuite/gdc.test/runnable/mixin2.d
new file mode 100644
index 00000000000..245e71ccc99
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/mixin2.d
@@ -0,0 +1,363 @@
+import std.stdio;
+
+/*********************************************/
+
+int foo(int x)
+{
+    return mixin("x + 1"w);
+}
+
+void test1()
+{
+    assert(foo(3) == 4);
+}
+
+/*********************************************/
+
+void test2()
+{
+    int j;
+    mixin("
+        int x = 3;
+        for (int i = 0; i < 10; i++)
+            writeln(x + i, ++j);
+        ");
+    assert(j == 10);
+}
+
+/*********************************************/
+
+mixin("int abc3 = 5;");
+
+void test3()
+{
+    writeln(abc3);
+    assert(abc3 == 5);
+}
+
+/*********************************************/
+
+mixin("
+void test4()
+{
+    writeln(\"test4\");
+" ~ "}");
+
+/*********************************************/
+
+int x5;
+
+scope class Foo5
+{
+        this ()
+        {
+                writeln ("Constructor");
+                assert(x5 == 0);
+                x5++;
+        }
+        ~this ()
+        {
+                writeln ("Destructor");
+                assert(x5 == 2);
+                x5++;
+        }
+}
+
+void test5()
+{
+    {
+        mixin ("scope Foo5 f = new Foo5;\n");
+        writeln ("  Inside Scope");
+        assert(x5 == 1);
+        x5++;
+    }
+    assert(x5 == 3);
+}
+
+/*********************************************/
+
+void test6()
+{
+    static const b = "printf(`hey\n`);";
+
+    if (true)
+        mixin(b);
+}
+
+/*********************************************/
+
+template Foo7(alias f)
+{
+}
+
+class Bar7
+{
+        mixin Foo7!( function {} );
+}
+
+void test7()
+{
+}
+
+/*********************************************/
+
+template TupleDecls(T, R ...) {
+    T value;
+    static if (R.length)
+        mixin TupleDecls!(R) Inner;
+}
+
+struct TupleStruct(T ...) { mixin TupleDecls!(T); }
+
+void test8() {
+    alias TupleStruct!(char[], char[]) twoStrings;
+}
+
+/*********************************************/
+
+template Magic()
+{
+    void* magic = null;
+}
+
+struct Item
+{
+    mixin Magic A;
+}
+
+struct Foo9(alias S)
+{
+}
+
+void test9()
+{
+    Foo9!(Item.A) bar;
+}
+
+/*********************************************/
+
+pragma(msg, "hello");
+pragma(msg, ['h', 'e', 'l', 'l', 'o']);
+pragma(msg, "");
+pragma(msg, []);
+pragma(msg, null);
+mixin("string hello;");
+mixin(['i', 'n', 't', ' ', 't', 'e', 's', 't', '1', '0', 'x', ';']);
+mixin("");
+mixin([]);
+mixin(null);
+void test10()
+{
+    pragma(msg, "hello");
+    pragma(msg, ['h', 'e', 'l', 'l', 'o']);
+    pragma(msg, "");
+    pragma(msg, []);
+    pragma(msg, null);
+    mixin("string hello;");
+    mixin(['i', 'n', 't', ' ', 'a', ';']);
+    mixin("");
+    mixin([]);
+    mixin(null);
+}
+
+/*********************************************/
+// 7560
+
+class Base7560
+{
+    template getter(T)
+    {
+        void get(ref T[] i, uint n) {}
+    }
+    mixin getter!uint;
+    mixin getter!char;
+}
+
+class Derived7560 : Base7560
+{
+    alias Base7560.get get;
+    void get(ref char[] x) {}
+}
+
+/*********************************************/
+// 10577
+
+enum sync10577;
+
+public template get_sync10577(size_t I, A...)
+{
+    static if (I == A.length)               enum bool get_sync10577 = false;
+    else static if (is(A[I] == sync10577))  enum bool get_sync10577 = true;
+    else                                    enum bool get_sync10577 = get_sync!10577(I+1, A);
+}
+
+template add_sync10577(T, size_t ITER=0)
+{
+    static if (ITER == (__traits(derivedMembers, T).length))
+    {
+        enum string add_sync10577 = "";
+    }
+    else
+    {
+        enum string mem = __traits(derivedMembers, T)[ITER];
+        enum string add_sync10577 =
+            "static if (! __traits(isVirtualMethod, " ~ mem ~ ")) {" ~
+            "mixin(add_sync10577!(get_sync10577!(0, __traits(getAttributes, "
+            ~ mem ~ ")), \"" ~ mem ~ "\"));} " ~ add_sync10577!(T, ITER+1);
+    }
+}
+
+template add_sync10577(bool A, string M)
+{
+    static if (A)
+    {
+        enum string add_sync10577 = " auto " ~ M[1..$] ~
+            "() { synchronized(this) return " ~ M ~ "; }";
+    }
+    else
+    {
+        enum string add_sync10577 = "";
+    }
+}
+
+class base10577
+{
+    public void foo() {}
+}
+
+class derived10577 : base10577
+{
+    mixin(add_sync10577!(derived10577));
+    @sync10577 private bool _bar;
+
+    public override void foo() {}
+}
+
+/*********************************************/
+// 10583
+
+enum sync10583;
+
+public template get_sync10583(size_t I, A...)
+{
+    static if (I == A.length)
+        enum bool get_sync10583 = false;
+    else static if (is(A[I] == sync10583))
+        enum bool get_sync10583 = true;
+    else
+        enum bool get_sync10583 = get_sync10583!(I+1, A);
+}
+
+template add_sync10583(T, size_t ITER = 0)
+{
+    static if (ITER == (__traits(derivedMembers, T).length))
+    {
+        enum string add_sync10583 = "";
+    }
+    else
+    {
+        enum string mem = __traits(derivedMembers, T)[ITER];
+        enum string add_sync10583 =
+            "mixin(add_sync10583!(get_sync10583!(0, __traits(getAttributes, "
+            ~ mem ~ ")), __traits(getProtection, "
+            ~ mem ~ "), \"" ~ mem ~ "\"));\n" ~ add_sync10583!(T, ITER+1);
+    }
+}
+
+template add_sync10583(bool A, string P, string M)
+{
+    static if (A)
+    {
+        enum string add_sync10583 = " auto " ~ M[1..$] ~
+            "() { synchronized(this) return " ~ M ~ "; }";
+    }
+    else
+        enum string add_sync10583 = "";
+}
+
+class derived10583
+{
+    mixin(add_sync10583!(derived10583));
+    @sync10583 private bool _bar;
+    void frop() {}
+}
+
+/*********************************************/
+
+string rep(string s, int n)
+{
+    return n > 1 ? s ~ rep(s, n-1) : s;
+}
+
+void test7156()
+{
+    int i;
+    mixin(rep("++i;", 200));
+}
+
+/*********************************************/
+// 7553
+
+template Foo7553()
+{
+    struct Range7553 {}
+}
+template Biz7553()
+{
+    struct Range7553 {}
+}
+
+class Bar7553
+{
+    mixin Foo7553!() index0;
+    mixin Biz7553!() index1;
+
+    auto to_range(Range)(Range r)
+    {
+        return r;
+    }
+
+}
+
+void test7553()
+{
+    auto r2 = new Bar7553().to_range(1);
+}
+
+/*********************************************/
+// 13479
+
+mixin template F13479()
+{
+    void t()()
+    {
+    }
+
+    alias t!() a;
+}
+
+void test13479()
+{
+    mixin F13479!();
+    a();
+}
+
+/*********************************************/
+
+void main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test7156();
+    test13479();
+
+    writeln("Success");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/mod1.d b/gcc/testsuite/gdc.test/runnable/mod1.d
new file mode 100644
index 00000000000..3efb0cf9308
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/mod1.d
@@ -0,0 +1,17 @@
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: imports/mod2.d
+
+// mod1.d
+
+import imports.mod2;
+
+string name()
+{
+  return "EvilOne";
+}
+
+int main(string[] args)
+{
+  greet();
+  return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/nan.d b/gcc/testsuite/gdc.test/runnable/nan.d
new file mode 100644
index 00000000000..b229fd571f3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/nan.d
@@ -0,0 +1,57 @@
+import core.stdc.stdio;
+
+enum real er1 = real.nan;
+enum real er2 = 1;
+static assert(er1 != er2);
+static assert(!(er1 == er2));
+static assert(!(er1 < er2));
+static assert(!(er1 > er2));
+static assert(!(er1 >= er2));
+static assert(!(er1 <= er2));
+
+enum double ed1 = real.nan;
+enum double ed2 = 1;
+static assert(ed1 != ed2);
+static assert(!(ed1 == ed2));
+static assert(!(ed1 < ed2));
+static assert(!(ed1 > ed2));
+static assert(!(ed1 >= ed2));
+static assert(!(ed1 <= ed2));
+
+bool b;
+
+bool test()
+{
+        real r1 = real.nan;
+        real r2 = 1;
+        b = (r1 != r2); assert(b);
+        b = (r1 == r2); assert(!b);
+        b = (r1 <  r2); assert(!b);
+        b = (r1 >  r2); assert(!b);
+        b = (r1 <= r2); assert(!b);
+        b = (r1 >= r2); assert(!b);
+
+        double d1 = double.nan;
+        double d2 = 1;
+        b = (d1 != d2); assert(b);
+        b = (d1 == d2); assert(!b);
+        b = (d1 <  d2); assert(!b);
+        b = (d1 >  d2); assert(!b);
+        b = (d1 <= d2); assert(!b);
+        b = (d1 >= d2); assert(!b);
+
+        float f1 = float.nan;
+        float f2 = 1;
+        b = (f1 != f2); assert(b);
+        b = (f1 == f2); assert(!b);
+        b = (f1 <  f2); assert(!b);
+        b = (f1 >  f2); assert(!b);
+        b = (f1 <= f2); assert(!b);
+        b = (f1 >= f2); assert(!b);
+        return true;
+}
+
+void main()
+{
+        assert(test());
+}
diff --git a/gcc/testsuite/gdc.test/runnable/nested.d b/gcc/testsuite/gdc.test/runnable/nested.d
new file mode 100644
index 00000000000..33282916c1d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/nested.d
@@ -0,0 +1,2741 @@
+// REQUIRED_ARGS:
+
+import core.stdc.stdio;
+
+/*******************************************/
+
+int bar(int a)
+{
+    int foo(int b) { return b + 1; }
+
+    return foo(a);
+}
+
+void test1()
+{
+    assert(bar(3) == 4);
+}
+
+/*******************************************/
+
+int bar2(int a)
+{
+    static int c = 4;
+
+    int foo(int b) { return b + c + 1; }
+
+    return foo(a);
+}
+
+void test2()
+{
+    assert(bar2(3) == 8);
+}
+
+
+/*******************************************/
+
+int bar3(int a)
+{
+    static int foo(int b) { return b + 1; }
+
+    return foo(a);
+}
+
+void test3()
+{
+    assert(bar3(3) == 4);
+}
+
+/*******************************************/
+
+int bar4(int a)
+{
+    static int c = 4;
+
+    static int foo(int b) { return b + c + 1; }
+
+    return foo(a);
+}
+
+void test4()
+{
+    assert(bar4(3) == 8);
+}
+
+
+/*******************************************/
+
+int bar5(int a)
+{
+    int c = 4;
+
+    int foo(int b) { return b + c + 1; }
+
+    return c + foo(a);
+}
+
+void test5()
+{
+    assert(bar5(3) == 12);
+}
+
+
+/*******************************************/
+
+int bar6(int a)
+{
+    int c = 4;
+
+    int foob(int b) { return b + c + 1; }
+    int fooa(int b) { return foob(c + b) * 7; }
+
+    return fooa(a);
+}
+
+void test6()
+{
+    assert(bar6(3) == 84);
+}
+
+
+/*******************************************/
+
+int bar7(int a)
+{
+    static int c = 4;
+
+    static int foob(int b) { return b + c + 1; }
+
+    int function(int) fp = &foob;
+
+    return fp(a);
+}
+
+void test7()
+{
+    assert(bar7(3) == 8);
+}
+
+/*******************************************/
+
+int bar8(int a)
+{
+    int c = 4;
+
+    int foob(int b) { return b + c + 1; }
+
+    int delegate(int) fp = &foob;
+
+    return fp(a);
+}
+
+void test8()
+{
+    assert(bar8(3) == 8);
+}
+
+
+/*******************************************/
+
+struct Abc9
+{
+    int a;
+    int b;
+    int c = 7;
+
+    int bar(int x)
+    {
+        Abc9 *foo() { return &this; }
+
+        Abc9 *p = foo();
+        assert(p == &this);
+        return p.c + x;
+    }
+}
+
+void test9()
+{
+    Abc9 x;
+
+    assert(x.bar(3) == 10);
+}
+
+/*******************************************/
+
+class Abc10
+{
+    int a;
+    int b;
+    int c = 7;
+
+    int bar(int x)
+    {
+        Abc10 foo() { return this; }
+
+        Abc10 p = foo();
+        assert(p == this);
+        return p.c + x;
+    }
+
+}
+
+void test10()
+{
+    Abc10 x = new Abc10();
+
+    assert(x.bar(3) == 10);
+}
+
+
+/*******************************************/
+
+class Collection
+{
+    int[3] array;
+
+    void opApply(void delegate(int) fp)
+    {
+        for (int i = 0; i < array.length; i++)
+            fp(array[i]);
+    }
+}
+
+int func11(Collection c)
+{
+    int max = int.min;
+
+    void comp_max(int i)
+    {
+        if (i > max)
+            max = i;
+    }
+
+    c.opApply(&comp_max);
+    return max;
+}
+
+void test11()
+{
+    Collection c = new Collection();
+
+    c.array[0] = 7;
+    c.array[1] = 26;
+    c.array[2] = 25;
+
+    int m = func11(c);
+    assert(m == 26);
+}
+
+
+/*******************************************/
+
+void SimpleNestedFunction ()
+{
+    int nest () { return 432; }
+
+    assert (nest () == 432);
+    int delegate () func = &nest;
+    assert (func () == 432);
+}
+
+void AccessParentScope ()
+{
+    int value = 9;
+
+    int nest () { assert (value == 9); return 9; }
+
+    assert (nest () == 9);
+}
+
+void CrossNestedScope ()
+{
+    int x = 45;
+
+    void foo () { assert (x == 45); }
+    void bar () { int z = 16; foo (); }
+    bar ();
+}
+
+void BadMultipleNested ()
+{
+    int x;
+
+    void foo ()
+    {
+       void bar ()
+       {
+           //erroneous x = 4; // Should fail.
+       }
+    }
+}
+
+/* This one kind of depends upon memory layout.  GlobalScopeSpoof should
+be called with no "this" pointer; this is trying to ensure that
+everything is working properly.  Of course, in the DMD calling
+convention it'll fail if the caller passes too much/little data. */
+
+void GlobalScopeSpoof (int x, int y)
+{
+    assert (x == y && y == 487);
+}
+
+void GlobalScope ()
+{
+    void bar () { GlobalScopeSpoof (487, 487); }
+    bar ();
+}
+
+class TestClass
+{
+    int x = 6400;
+
+    void foo ()
+    {
+       void bar () { assert (x == 6400); }
+       bar ();
+    }
+}
+
+void test12()
+{
+    SimpleNestedFunction ();
+    AccessParentScope ();
+    CrossNestedScope ();
+    GlobalScope ();
+    (new TestClass).foo ();
+}
+
+
+/*******************************************/
+
+void test13()
+{
+    struct Abc
+    {
+        int x = 3;
+        int y = 4;
+    }
+
+    Abc a;
+
+    assert(a.x == 3 && a.y == 4);
+}
+
+
+/*******************************************/
+
+void test14()
+{
+    struct Abc
+    {
+        int x = 3;
+        int y = 4;
+
+        int foo() { return y; }
+    }
+
+    Abc a;
+
+    assert(a.foo() == 4);
+}
+
+
+/*******************************************/
+
+void test15()
+{
+    static int z = 5;
+
+    struct Abc
+    {
+        int x = 3;
+        int y = 4;
+
+        int foo() { return y + z; }
+    }
+
+    Abc a;
+
+    assert(a.foo() == 9);
+}
+
+
+/*******************************************/
+
+void test16()
+{
+    static int z = 5;
+
+    static class Abc
+    {
+        int x = 3;
+        int y = 4;
+
+        int foo() { return y + z; }
+    }
+
+    Abc a = new Abc();
+
+    assert(a.foo() == 9);
+}
+
+
+/*******************************************/
+
+void test17()
+{
+    int function(int x) fp;
+
+    fp = function int(int y) { return y + 3; };
+    assert(fp(7) == 10);
+}
+
+/*******************************************/
+
+void test18()
+{
+    static int a = 3;
+    int function(int x) fp;
+
+    fp = function int(int y) { return y + a; };
+    assert(fp(7) == 10);
+}
+
+/*******************************************/
+
+void test19()
+{
+    int a = 3;
+
+    int delegate(int x) fp;
+
+    fp = delegate int(int y) { return y + a; };
+    assert(fp(7) == 10);
+}
+
+
+/*******************************************/
+
+class Collection20
+{
+    int[3] array;
+
+    void opApply(void delegate(int) fp)
+    {
+        for (int i = 0; i < array.length; i++)
+            fp(array[i]);
+    }
+}
+
+int func20(Collection20 c)
+{
+    int max = int.min;
+
+    c.opApply(delegate(int i) { if (i > max) max = i; });
+    return max;
+}
+
+void test20()
+{
+    Collection20 c = new Collection20();
+
+    c.array[0] = 7;
+    c.array[1] = 26;
+    c.array[2] = 25;
+
+    int m = func20(c);
+    assert(m == 26);
+}
+
+
+/*******************************************/
+
+int bar21(int a)
+{
+    int c = 3;
+
+    int foo(int b)
+    {
+        b += c;         // 4 is added to b
+        c++;            // bar.c is now 5
+        return b + c;   // 12 is returned
+    }
+    c = 4;
+    int i = foo(a);     // i is set to 12
+    return i + c;       // returns 17
+}
+
+void test21()
+{
+    int i = bar21(3);   // i is assigned 17
+    assert(i == 17);
+}
+
+/*******************************************/
+
+void foo22(void delegate() baz)
+{
+  baz();
+}
+
+void bar22(int i)
+{
+  int j = 14;
+  printf("%d,%d\n",i,j);
+
+  void fred()
+  {
+    printf("%d,%d\n",i,j);
+    assert(i == 12 && j == 14);
+  }
+
+  fred();
+  foo22(&fred);
+}
+
+void test22()
+{
+  bar22(12);
+}
+
+
+/*******************************************/
+
+void frelled(void delegate() baz)
+{
+  baz();
+}
+
+class Foo23
+{
+  void bar(int i)
+  {
+    int j = 14;
+    printf("%d,%d\n",i,j);
+
+    void fred()
+    {
+        printf("%d,%d\n",i,j);
+        assert(i == 12);
+        assert(j == 14);
+    }
+
+    frelled(&fred);
+  }
+}
+
+void test23()
+{
+    Foo23 f = new Foo23();
+
+    f.bar(12);
+}
+
+
+/*******************************************/
+
+void delegate () function (int x) store24;
+
+void delegate () zoom24(int x)
+{
+   return delegate void () { };
+}
+
+void test24()
+{
+   store24 = &zoom24;
+   store24 (1) ();
+}
+
+
+/*******************************************/
+
+void test25()
+{
+    delegate() { printf("stop the insanity!\n"); }();
+    delegate() { printf("stop the insanity! 2\n"); }();
+}
+
+/*******************************************/
+
+alias bool delegate(int) callback26;
+
+
+bool foo26(callback26 a)
+{
+    return a(12);
+}
+
+class Bar26
+{
+    int func(int v)
+    {
+        printf("func(v=%d)\n", v);
+        foo26(delegate bool(int a)
+        {
+            printf("%d %d\n",a,v); return true;
+            assert(a == 12);
+            assert(v == 15);
+            assert(0);
+        } );
+        return v;
+    }
+}
+
+
+void test26()
+{
+    Bar26 b = new Bar26();
+
+    b.func(15);
+}
+
+
+/*******************************************/
+
+class A27
+{
+    uint myFunc()
+    {
+        uint myInt = 13;
+        uint mySubFunc()
+        {
+            return myInt;
+        }
+        return mySubFunc();
+    }
+}
+
+void test27()
+{
+    A27 myInstance = new A27;
+    int i = myInstance.myFunc();
+    printf("%d\n", i);
+    assert(i == 13);
+}
+
+
+/*******************************************/
+
+void Foo28(void delegate() call)
+{
+    call();
+}
+
+class Bar28
+{
+    int func()
+    {
+        int count = 0;
+
+        Foo28(delegate void() { ++count; } );
+        return count;
+    }
+}
+
+void test28()
+{
+    Bar28 b = new Bar28();
+    int i = b.func();
+    assert(i == 1);
+}
+
+
+/*******************************************/
+
+class Foo29
+{
+  void Func(void delegate() call)
+  {
+    for(int i = 0; i < 10; ++i)
+      call();
+  }
+}
+
+class Bar29
+{
+    int Func()
+    {
+        int count = 0;
+        Foo29 ic = new Foo29();
+
+        ic.Func(delegate void() { ++count; } );
+        return count;
+    }
+}
+
+void test29()
+{
+    Bar29 b = new Bar29();
+    int i = b.Func();
+    assert(i == 10);
+}
+
+/*******************************************/
+
+struct Foo30
+{
+  int[] arr;
+}
+
+void Func30(Foo30 bar)
+{
+    void InnerFunc(int x, int y)
+    {
+        int a = bar.arr[y]; // Ok
+
+        if(bar.arr[y]) // Access violation
+        {
+        }
+    }
+
+    InnerFunc(5,5);
+}
+
+
+void test30()
+{
+  Foo30 abc;
+
+  abc.arr.length = 10;
+  Func30(abc);
+}
+
+
+/*******************************************/
+
+void call31(int d, void delegate(int d) f)
+{
+    assert(d == 100 || d == 200);
+    printf("d = %d\n", d);
+    f(d);
+}
+
+void test31()
+{
+    call31(100, delegate void(int d1)
+    {
+        printf("d1 = %d\n", d1);
+        assert(d1 == 100);
+        call31(200, delegate void(int d2)
+        {
+            printf("d1 = %d\n", d1);
+            printf("d2 = %d\n", d2);
+            assert(d1 == 100);
+            assert(d2 == 200);
+        });
+    });
+}
+
+
+/*******************************************/
+
+void call32(int d, void delegate(int d) f)
+{
+    assert(d == 100 || d == 200);
+    printf("d = %d\n", d);
+    f(d);
+}
+
+void test32()
+{
+    call32(100, delegate void(int d1)
+    {
+        int a = 3;
+        int b = 4;
+        printf("d1 = %d, a = %d, b = %d\n", d1, a, b);
+        assert(a == 3);
+        assert(b == 4);
+        assert(d1 == 100);
+
+        call32(200, delegate void(int d2)
+        {
+            printf("d1 = %d, a = %d\n", d1, a);
+            printf("d2 = %d, b = %d\n", d2, b);
+            assert(a == 3);
+            assert(b == 4);
+            assert(d1 == 100);
+            assert(d2 == 200);
+        });
+    });
+}
+
+
+/*******************************************/
+
+void test33()
+{
+    extern (C) int Foo1(int a, int b, int c)
+    {
+        assert(a == 1);
+        assert(b == 2);
+        assert(c == 3);
+        return 1;
+    }
+
+    extern (D) int Foo2(int a, int b, int c)
+    {
+        assert(a == 1);
+        assert(b == 2);
+        assert(c == 3);
+        return 2;
+    }
+
+    extern (Windows) int Foo3(int a, int b, int c)
+    {
+        assert(a == 1);
+        assert(b == 2);
+        assert(c == 3);
+        return 3;
+    }
+
+    extern (Pascal) int Foo4(int a, int b, int c)
+    {
+        assert(a == 1);
+        assert(b == 2);
+        assert(c == 3);
+        return 4;
+    }
+
+    assert(Foo1(1, 2, 3) == 1);
+    assert(Foo2(1, 2, 3) == 2);
+    assert(Foo3(1, 2, 3) == 3);
+    assert(Foo4(1, 2, 3) == 4);
+
+    printf("test33 success\n");
+}
+
+/*******************************************/
+
+class Foo34
+{
+    int x;
+
+    class Bar
+    {
+        int y;
+
+        int delegate() getDelegate()
+        {
+            assert(y == 8);
+            auto i = sayHello();
+            assert(i == 23);
+            return &sayHello;
+        }
+    }
+    Bar bar;
+
+    int sayHello()
+    {
+        printf("Hello\n");
+        assert(x == 47);
+        return 23;
+    }
+
+    this()
+    {
+        x = 47;
+        bar = new Bar();
+        bar.y = 8;
+    }
+}
+
+void test34()
+{
+    Foo34 foo = new Foo34();
+    int delegate() saydg = foo.bar.getDelegate();
+    printf("This should print Hello:\n");
+    auto i = saydg();
+    assert(i == 23);
+}
+
+/*******************************************/
+
+class Foo35
+{
+    int x = 42;
+    void bar()
+    {
+        int y = 43;
+        new class Object
+        {
+            this()
+            {
+                //writefln("x = %s", x);
+                //writefln("y = %s", y);
+                assert(x == 42);
+                assert(y == 43);
+              //static assert(is(typeof(this.outer) == void*)); // Bugzilla 14442
+                static assert(is(typeof(this.outer) == Foo35)); // Bugzilla 15839
+            }
+        };
+    }
+}
+
+void test35()
+{
+    Foo35 f = new Foo35();
+    f.bar();
+}
+
+/*******************************************/
+
+class Foo36
+{
+    int x = 42;
+    this()
+    {
+        int y = 43;
+        new class Object
+        {
+            this()
+            {
+                //writefln("x = %s", x);
+                //writefln("y = %s", y);
+                assert(x == 42);
+                assert(y == 43);
+            }
+        };
+    }
+}
+
+void test36()
+{
+    Foo36 f = new Foo36();
+}
+
+/*******************************************/
+
+class Foo37
+{
+    int x = 42;
+    void bar()
+    {
+        int y = 43;
+        void abc()
+        {
+            new class Object
+            {
+                this()
+                {
+                    //writefln("x = %s", x);
+                    //writefln("y = %s", y);
+                    assert(x == 42);
+                    assert(y == 43);
+                }
+            };
+        }
+
+        abc();
+    }
+}
+
+void test37()
+{
+    Foo37 f = new Foo37();
+    f.bar();
+}
+
+/*******************************************/
+
+void test38()
+{
+    int status = 3;
+
+    int delegate() foo()
+    {
+        class C
+        {
+            int dg()
+            {
+                return ++status;
+            }
+        }
+
+        C c = new C();
+
+        return &c.dg;
+    }
+
+    int delegate() bar = foo();
+
+    if(status != 3)
+    {
+        assert(0);
+    }
+
+    if(bar() != 4)
+    {
+        assert(0);
+    }
+
+    if(status != 4)
+    {
+        assert(0);
+    }
+}
+
+/*******************************************/
+
+void test39()
+{
+    int status;
+
+    int delegate() foo()
+    {
+        return &(new class
+            {
+                int dg()
+                {
+                    return ++status;
+                }
+            }
+        ).dg;
+    }
+
+    int delegate() bar = foo();
+
+    if(status != 0)
+    {
+        assert(0);
+    }
+
+    if(bar() != 1)
+    {
+        assert(0);
+    }
+
+    if(status != 1)
+    {
+        assert(0);
+    }
+}
+
+/*******************************************/
+
+interface I40
+{
+    void get( string s );
+}
+
+class C40
+{
+    int a = 4;
+
+    void init()
+    {
+        I40 i = new class() I40
+        {
+            void get( string s )
+            {
+                func();
+            }
+        };
+        i.get("hello");
+    }
+    void func( ){ assert(a == 4); }
+}
+
+void test40()
+{
+    C40 c = new C40();
+    c.init();
+}
+
+/*******************************************/
+
+class C41
+{   int a = 3;
+
+    void init()
+    {
+        class N
+        {
+            void get()
+            {
+                func();
+            }
+        }
+        N n = new N();
+        n.get();
+    }
+    void func()
+    {
+        assert(a == 3);
+    }
+}
+
+
+void test41()
+{
+   C41 c = new C41();
+   c.init();
+}
+
+/*******************************************/
+
+class C42
+{   int a = 3;
+
+    void init()
+    {
+        class N
+        {
+            void init()
+            {
+                class M
+                {
+                    void get()
+                    {
+                        func();
+                    }
+                }
+                M m = new M();
+                m.get();
+            }
+        }
+        N n = new N();
+        n.init();
+    }
+    void func()
+    {
+        assert(a == 3);
+    }
+}
+
+void test42()
+{
+   C42 c = new C42();
+   c.init();
+}
+
+
+/*******************************************/
+
+int foo43(alias X)() { return X; }
+
+void test43()
+{
+    int x = 3;
+
+    void bar()
+    {
+        int y = 4;
+        assert(foo43!(x)() == 3);
+        assert(foo43!(y)() == 4);
+    }
+
+    bar();
+
+    assert(foo43!(x)() == 3);
+}
+
+
+/*******************************************/
+
+class Comb
+{
+}
+
+Comb Foo44(Comb delegate()[] c...)
+{
+    Comb ec = c[0]();
+    printf("1ec = %p\n", ec);
+    ec.toString();
+    printf("2ec = %p\n", ec);
+    return ec;
+}
+
+Comb c44;
+
+static this()
+{
+    c44 = new Comb;
+}
+
+void test44()
+{
+    c44 = Foo44(Foo44(c44));
+}
+
+/*******************************************/
+
+class Bar45
+{
+    void test()
+    {
+        a = 4;
+        Inner i = new Inner;
+        i.foo();
+    }
+
+    class Inner
+    {
+        void foo()
+        {
+            assert(a == 4);
+            Inner i = new Inner;
+            i.bar();
+        }
+
+        void bar()
+        {
+            assert(a == 4);
+        }
+    }
+    int a;
+}
+
+void test45()
+{
+    Bar45 b = new Bar45;
+    assert(b.a == 0);
+    b.test();
+}
+
+/*******************************************/
+
+class Adapter
+{
+    int a = 2;
+
+    int func()
+    {
+        return 73;
+    }
+}
+
+class Foo46
+{
+    int b = 7;
+
+    class AnonAdapter : Adapter
+    {
+        int aa = 8;
+
+        this()
+        {
+            assert(b == 7);
+            assert(aa == 8);
+        }
+    }
+
+    void func()
+    {
+        Adapter a = cast( Adapter )( new AnonAdapter() );
+        assert(a.func() == 73);
+        assert(a.a == 2);
+    }
+}
+
+void test46()
+{
+    Foo46 f = new Foo46();
+    f.func();
+}
+
+
+/*******************************************/
+
+void test47()
+{
+    void delegate() test =
+    {
+        struct Foo {int x=3;}
+        Foo f;
+        assert(f.x == 3);
+    };
+    test();
+}
+
+/*******************************************/
+
+struct Outer48
+{
+    class Inner
+    {
+        this(int i) { b = i; }
+        int b;
+    }
+
+    int a = 6;
+
+    void f()
+    {
+        int nested()
+        {
+            auto x = new Inner(a);
+            return x.b + 1;
+        }
+        int i = nested();
+        assert(i == 7);
+    }
+}
+
+
+void test48()
+{
+    Outer48 s;
+    s.f();
+}
+
+/*******************************************/
+
+void test49()
+{
+    int j = 10;
+    void mainlocal(int x)
+    {
+        printf("mainlocal: j = %d, x = %d\n", j, x);
+        assert(j == 10);
+        assert(x == 1);
+    }
+
+    void fun2()
+    {
+        int k = 20;
+        void fun2local(int x)
+        {
+            printf("fun2local: k = %d, x = %d\n", k, x);
+            assert(j == 10);
+            assert(k == 20);
+            assert(x == 2);
+        }
+
+        void fun1()
+        {
+            mainlocal(1);
+            fun2local(2);
+        }
+
+        fun1();
+    }
+
+    fun2();
+}
+
+/*******************************************/
+
+void funa50(alias pred1, alias pred2)()
+{
+    pred1(1);
+    pred2(2);
+}
+
+void funb50(alias pred1)()
+{   int k = 20;
+    void funb50local(int x)
+    {
+        printf("funb50local: k = %d, x = %d\n", k, x);
+        assert(k == 20);
+        assert(x == 2);
+    }
+    funa50!(pred1, funb50local)();
+}
+
+void test50()
+{
+    int j = 10;
+    void mainlocal(int x)
+    {
+        printf("mainlocal: j = %d, x = %d\n", j, x);
+        assert(j == 10);
+        assert(x == 1);
+    }
+    funb50!(mainlocal)();
+}
+
+/*******************************************/
+
+void funa51(alias pred1, alias pred2)()
+{
+    pred1(2);
+    pred2(1);
+}
+
+void funb51(alias pred1)()
+{   int k = 20;
+    void funb51local(int x)
+    {
+        printf("funb51local: k = %d, x = %d\n", k, x);
+        assert(k == 20);
+        assert(x == 2);
+    }
+    funa51!(funb51local, pred1)();
+}
+
+void test51()
+{
+    int j = 10;
+    void mainlocal(int x)
+    {
+        printf("mainlocal: j = %d, x = %d\n", j, x);
+        assert(j == 10);
+        assert(x == 1);
+    }
+    funb51!(mainlocal)();
+}
+
+/*******************************************/
+
+C52 c52;
+
+class C52
+{
+    int index = 7;
+    void test1(){
+        printf( "this = %p, index = %d\n", this, index );
+        assert(index == 7);
+        assert(this == c52);
+    }
+    void test()
+    {
+        class N
+        {
+            void callI()
+            {
+                printf("test1\n");
+                test1();
+                printf("test2\n");
+                if (index is -1)
+                {   // Access to the outer-super-field triggers the bug
+                    printf("test3\n");
+                }
+            }
+        }
+        auto i = new N();
+        i.callI();
+    }
+}
+
+void test52()
+{
+    auto c = new C52;
+    printf("c = %p\n", c);
+    c52 = c;
+    c.test();
+}
+
+/*******************************************/
+
+void foo53(int i)
+{
+    struct SS
+    {
+        int x,y;
+        int bar() { return x + i + 1; }
+    }
+    SS s;
+    s.x = 3;
+    assert(s.bar() == 11);
+}
+
+void test53()
+{
+    foo53(7);
+}
+
+/*******************************************/
+
+void test54()
+{
+    int x = 40;
+    int fun(int i) { return x + i; }
+
+    struct A
+    {
+        int bar(int i) { return fun(i); }
+    }
+
+    A makeA()
+    {
+        // A a; return a;
+        return A();
+    }
+
+    A makeA2()
+    {
+         A a;   return a;
+        //return A();
+    }
+
+    A a = makeA();
+    assert(a.bar(2) == 42);
+
+    A b = makeA2();
+    assert(b.bar(3) == 43);
+
+    auto c = new A;
+    assert(c.bar(4) == 44);
+}
+/*******************************************/
+
+void test55()
+{
+    int localvar = 7;
+
+    int inner(int delegate(ref int) dg) {
+        int k = localvar;
+        return 0;
+    }
+
+    int a = localvar * localvar; // This modifies the EAX register
+
+    foreach (entry; &inner)
+    {
+    }
+}
+
+/*******************************************/
+// 4401
+
+void test4401()
+{
+    auto foo() {
+        return 3;
+    }
+
+    auto bar() nothrow pure {
+        return 3;
+    }
+
+    auto baz() @property pure @safe {
+        return 3;
+    }
+
+    auto zoo()() @property pure @safe nothrow {
+        return 3;
+    }
+}
+
+/*******************************************/
+
+alias void delegate() dg_t;
+
+void Y(dg_t delegate (dg_t) y)
+{
+    struct F { void delegate(F) f; };
+
+  version (all)
+  { // generates error
+    (dg_t delegate(F) a){return a(F((F b){return y(a(b))();})); }
+    ((F b){return (){return b.f(b);};});
+  }
+  else
+  {
+    auto abc(dg_t delegate(F) a)
+    {
+        return a(F((F b){return y(a(b))();}));
+    }
+
+    abc((F b){return (){return b.f(b);};});
+  }
+}
+
+
+void test7428(){
+    dg_t foo(dg_t self)
+    {
+        void bar() { self(); }
+        return &bar;
+    }
+
+    Y(&foo);
+}
+
+/*******************************************/
+// 4612
+
+struct S4612a(alias x)
+{
+    void* func() { void* p = &x; return p; }
+}
+
+struct S4612b(alias x)
+{
+    int i;
+    void* func() { void* p = &x; return p; }
+}
+
+void test4612()
+{
+    int a;
+
+    auto sa = S4612a!a();
+    assert(sa.func() == &a);
+
+    auto sb = S4612b!(a)();
+    assert(sb.func() == &a);
+}
+
+/*******************************************/
+
+struct S4841(alias pred)
+{
+    void unused_func();
+}
+
+void abc4841() {
+   int w;
+   S4841!(w) m;
+}
+
+void test4841() {
+   abc4841();
+}
+
+/*******************************************/
+
+
+void index7199()
+{
+    void find()
+    {
+        bool hay()
+        {
+            return true;
+        }
+    }
+
+    find();
+}
+
+void test7199()
+{
+    index7199();
+}
+
+/*******************************************/
+// 7965
+
+void test7965()
+{
+    int x;
+    static int* px;
+    px = &x;
+
+    printf("&x = %p in main()\n", &x);
+    struct S1
+    {
+        char y;
+        void boom() {
+            printf("&x = %p in S1.boom()\n", &x);
+            assert(&x == px);
+            //x = 42; // makes the struct nested
+        }
+    }
+    S1 s1;
+    s1.boom();
+
+    struct S2
+    {
+        this(int n) {
+            printf("&x = %p in S2.this()\n", &x);
+            assert(&x == px);
+        }
+        char y;
+    }
+    S2 s2 = S2(10);
+}
+
+struct S7965
+{
+    string str;
+    uint unused1, unused2 = 0;
+}
+
+auto f7965(alias fun)()
+{
+    struct Result
+    {
+        S7965 s;
+        this(S7965 _s) { s = _s; }  // required for the problem
+        void g() { assert(fun(s.str) == "xa"); }
+    }
+
+    return Result(S7965("a"));
+}
+
+void test7965a()
+{
+    string s = "x";
+    f7965!(a => s ~= a)().g();
+    assert(s == "xa");
+}
+
+/*******************************************/
+// 8188
+
+mixin template Print8188(b...)
+{
+    int doprint()
+    {
+        return b[0] * b[1];
+    }
+}
+
+class A8188
+{
+    int x, y;
+    mixin Print8188!(x, y);
+}
+
+void test8188()
+{
+    auto a = new A8188;
+    a.x = 2;
+    a.y = 5;
+    assert(a.doprint() == 10);
+}
+
+/*******************************************/
+// 5082
+
+struct S5082 { float x; }
+
+struct Map5082a(alias fun)
+{
+    typeof({ return fun(int.init); }()) cache;
+}
+
+struct Map5082b(alias fun)
+{
+    typeof({ return fun(int.init); }()) cache;
+
+    S5082 front(int i) { return fun(i); }
+}
+
+void test5082()
+{
+    auto temp = S5082(1);
+    auto func = (int v){ return temp; };
+    auto map1 = Map5082a!func();
+    auto map2 = Map5082b!func();
+    assert(map2.front(1) == temp);
+}
+
+
+/*******************************************/
+// 8194
+
+void test8194()
+{
+    int foo;
+    static void bar()
+    {
+        typeof(foo) baz;
+        static assert(is(typeof(baz) == int));
+    }
+}
+
+/*******************************************/
+// 8339
+
+template map8339a(fun...)
+{
+    auto map8339a(Range)(Range r) {
+        struct Result {
+            this(double[] input) {}
+        }
+        return Result(r);
+    }
+}
+template map8339b(fun...)
+{
+    auto map8339b(Range)(Range r) {
+        struct Result {
+            this(double[] input) { fun[0](input.length); }
+        }
+        return Result(r);
+    }
+}
+template map8339c(fun...)
+{
+    auto map8339c(Range)(Range r) {
+        static struct Result {
+            this(double[] input) {}
+        }
+        return Result(r);
+    }
+}
+template map8339d(fun...)
+{
+    auto map8339d(Range)(Range r) {
+        static struct Result {
+            this(double[] input) { fun[0](input.length); }
+        }
+        return Result(r);
+    }
+}
+void copy8339(T)(T x)
+{
+    T xSaved;
+}
+void test8339a()
+{
+    double[] x;
+    int n;
+
+    // Result has context pointer, so cannot copy
+    static assert (!is(typeof({ copy8339(map8339a!(a=>a)(x)); })));
+    static assert (!is(typeof({ copy8339(map8339a!(a=>n)(x)); })));
+
+    // same as
+    static assert (!is(typeof({ copy8339(map8339b!(a=>a)(x)); })));
+    static assert (!is(typeof({ copy8339(map8339b!(a=>n)(x)); })));
+
+    // fun is never instantiated
+    copy8339(map8339c!(a=>a)(x));
+    copy8339(map8339c!(a=>n)(x));
+
+    // static nested struct doesn't have contest pointer
+    copy8339(map8339d!(a=>a)(x));
+  //copy8339(map8339d!(a=>n)(x));   // too strict case
+
+}
+
+template filter8339(alias pred)
+{
+    auto filter8339(R)(R r) {
+        struct Result {
+            R range;
+            this(R r) { range = r; }
+            auto front() { return pred(0); }
+        }
+        return Result(r);
+    }
+}
+void test8339b()
+{
+    static makefilter() { int n; return filter8339!(a=>n)([]); }
+
+    auto r1 = makefilter();
+    filter8339!(a=>a)(r1);
+}
+
+void test8339c()
+{
+    class C(X) { X x; }
+    class C1 { C!C1 x; }
+    alias C!C1 C2;
+
+    struct Pair { C1 t; C2 u; void func(){} }
+    Pair pair;
+}
+
+/*******************************************/
+// 8704
+
+void check8704(T, int num)()
+{
+    static if (num == 1) T t0;
+    static if (num == 2) T t1 = T();
+    static if (num == 3) T t2 = T(1);
+}
+
+void test8704()
+{
+    struct S
+    {
+        int n;
+        void foo(){}
+    }
+
+    static assert(!is(typeof(check8704!(S, 1)())));
+    static assert(!is(typeof(check8704!(S, 2)())));
+    static assert(!is(typeof(check8704!(S, 3)())));
+
+    static assert(!__traits(compiles, check8704!(S, 1)()));
+    static assert(!__traits(compiles, check8704!(S, 2)()));
+    static assert(!__traits(compiles, check8704!(S, 3)()));
+}
+
+/*******************************************/
+// 8923
+
+void test8923a()
+{
+    int val;
+
+    struct S  // is nested struct
+    {
+        void foo() { val = 1; }  // access to val through the hidden frame pointer
+    }
+    S    s1a;           s1a.foo();
+    S    s1b = S();     s1b.foo();
+    S[1] s2a;           s2a[0].foo();
+    S[1] s2b = S();     s2b[0].foo();
+
+    static struct U { S s; }
+    U    u1a;           u1a.s.foo();
+    U    u1b = U();     u1b.s.foo();
+    U    u1c = U(s1a);  u1c.s.foo();
+    U[1] u2a;           u2a[0].s.foo();
+    U[1] u2b = U();     u2b[0].s.foo();
+    U[1] u2c = U(s1a);  u2c[0].s.foo();
+    static struct V { S[1] s; }
+    V    v1a;           v1a.s[0].foo();
+    V    v1b = V();     v1b.s[0].foo();
+    V    v1c = V(s1a);  v1c.s[0].foo();
+    V[1] v2a;           v2a[0].s[0].foo();
+    V[1] v2b = V();     v2b[0].s[0].foo();
+    V[1] v2c = V(s1a);  v2c[0].s[0].foo();
+
+    static struct W { S s; this(S s){ this.s = s; } }
+    W    w1a;           w1a.s.foo();
+    W    w1b = W();     w1b.s.foo();
+    W    w1c = W(s1a);  w1c.s.foo();
+    W[1] w2a;           w2a[0].s.foo();
+    W[1] w2b = W();     w2b[0].s.foo();
+    W[1] w2c = W(s1a);  w2c[0].s.foo();
+    static struct X { S[1] s; this(S s){ this.s[] = s; } }
+    X    x1a;           x1a.s[0].foo();
+    X    x1b = X();     x1b.s[0].foo();
+    X    x1c = X(s1a);  x1c.s[0].foo();
+    X[1] x2a;           x2a[0].s[0].foo();
+    X[1] x2b = X();     x2b[0].s[0].foo();
+    X[1] x2c = X(s1a);  x2c[0].s[0].foo();
+
+    // Both declarations, Y and Z should raise errors,
+    // because their ctors don't initialize their field 's'.
+  static assert(!__traits(compiles, {
+    static struct Y { S s; this(S){} }
+  }));
+/+  Y    y1a;         //y1a.s.foo();
+    Y    y1b = Y();     y1b.s.foo();
+    Y    y1c = Y(s1a);//y1c.s.foo();
+    Y[1] y2a;         //y2a[0].s.foo();
+    Y[1] y2b = Y();     y2b[0].s.foo();
+    Y[1] y2c = Y(s1a);//y2c[0].s.foo();  +/
+  static assert(!__traits(compiles, {
+    static struct Z { S[1] s; this(S){} }
+  }));
+/+  Z    z1a;         //z1a.s[0].foo();
+    Z    z1b = Z();     z1b.s[0].foo();
+    Z    z1c = Z(s1a);//z1c.s[0].foo();
+    Z[1] z2a;         //z1a.s[0].foo();
+    Z[1] z2b = Z();     z1b.s[0].foo();
+    Z[1] z2c = Z(s1a);//z1c.s[0].foo();  // +/
+}
+
+struct Tuple8923(int v, T...)
+{
+    T field;
+    static if (v == 1) this(T args) { }    // should be an error
+    static if (v == 2) this(T args) { field = args; }
+    static if (v == 3) this(U...)(U args) { }    // should be an error
+    static if (v == 4) this(U...)(U args) { field = args; }
+    //alias field this;
+}
+void test8923b()
+{
+    int val;
+    struct S { void foo() { val = 1; } }
+
+  static assert(!__traits(compiles, Tuple8923!(1, S)(S()) ));
+  static assert(!__traits(compiles, Tuple8923!(3, S)(S()) ));
+
+    auto tup2 = Tuple8923!(2, S)(S());
+    tup2.field[0].foo();    // correctly initialized
+
+    auto tup4 = Tuple8923!(4, S)(S());
+    tup4.field[0].foo();    // correctly initialized
+}
+
+void test8923c()
+{
+    int val;
+
+    struct S  // is nested struct
+    {
+        void foo() { val = 1; }  // access to val through the hidden frame pointer
+    }
+    S    s1a;           s1a.foo();
+    S    s1b = S();     s1b.foo();
+    S[1] s2a;           s2a[0].foo();
+    S[1] s2b = S();     s2b[0].foo();
+
+    // U,V,W,X are nested struct, but should work same as non-nested.
+    // 1: bare struct object.  2: static array of structs.
+    // a: default construction.
+    // b: construction by literal syntax which has no argument.
+    // c: construction by literal syntax which has one or more arguments.
+
+    struct U
+    {
+        S s;
+        void foo() { val = 2; }
+    }
+    U    u1a;           u1a.foo();      u1a.s.foo();
+    U    u1b = U();     u1b.foo();      u1b.s.foo();
+    U    u1c = U(s1a);  u1c.foo();      u1c.s.foo();
+    U[1] u2a;           u2a[0].foo();   u2a[0].s.foo();
+    U[1] u2b = U();     u2b[0].foo();   u2b[0].s.foo();
+    U[1] u2c = U(s1a);  u2c[0].foo();   u2c[0].s.foo();
+
+    struct V
+    {
+        S[1] s;
+        void foo() { val = 2; }
+    }
+    V    v1a;           v1a.foo();      v1a.s[0].foo();
+    V    v1b = V();     v1b.foo();      v1b.s[0].foo();
+    V    v1c = V(s1a);  v1c.foo();      v1c.s[0].foo();
+    V[1] v2a;           v2a[0].foo();   v2a[0].s[0].foo();
+    V[1] v2b = V();     v2b[0].foo();   v2b[0].s[0].foo();
+    V[1] v2c = V(s1a);  v2c[0].foo();   v2c[0].s[0].foo();
+
+    struct W
+    {
+        S s;
+        this(S s) { this.s = s; }
+        void foo() { val = 2; }
+    }
+    W    w1a;           w1a.foo();      w1a.s.foo();
+    W    w1b = W();     w1b.foo();      w1b.s.foo();
+    W    w1c = W(s1a);  w1c.foo();      w1c.s.foo();
+    W[1] w2a;           w2a[0].foo();   w2a[0].s.foo();
+    W[1] w2b = W();     w2b[0].foo();   w2b[0].s.foo();
+    W[1] w2c = W(s1a);  w2c[0].foo();   w2c[0].s.foo();
+
+    struct X
+    {
+        S[1] s;
+        this(S s) { this.s[] = s; }
+        void foo() { val = 2; }
+    }
+    X    x1a;           x1a.foo();      x1a.s[0].foo();
+    X    x1b = X();     x1b.foo();      x1b.s[0].foo();
+    X    x1c = X(s1a);  x1c.foo();      x1c.s[0].foo();
+    X[1] x2a;           x2a[0].foo();   x2a[0].s[0].foo();
+    X[1] x2b = X();     x2b[0].foo();   x2b[0].s[0].foo();
+    X[1] x2c = X(s1a);  x2c[0].foo();   x2c[0].s[0].foo();
+
+    // Both declarations, Y and Z should raise errors,
+    // because their ctors don't initialize their field 's'.
+  static assert(!__traits(compiles, {
+    struct Y1 { S s; this(S){} void foo() { val = 2; } }
+  }));
+  static assert(!__traits(compiles, {
+    struct Y2 { S s; this(T)(S){} void foo() { val = 2; } }
+    auto y2 = Y2!S(S());    // instantiate ctor
+  }));
+
+  static assert(!__traits(compiles, {
+    struct Z1 { S[1] s; this(S){} void foo() { val = 2; } }
+  }));
+  static assert(!__traits(compiles, {
+    struct Z2 { S[1] s; this(T)(S){} void foo() { val = 2; } }
+    auto z2 = Z2!S(S());    // instantiate ctor
+  }));
+}
+
+/*******************************************/
+// 9003
+
+void test9003()
+{
+    int i;
+    struct NS {
+        int n1;    // Comment to pass all asserts
+        int n2;    // Uncomment to fail assert on line 19
+        int f() { return i; }
+    }
+
+    static struct SS1 {
+        NS ns;
+    }
+    SS1 ss1;
+    assert(ss1.ns != NS.init);
+
+    static struct SS2 {
+        NS ns1, ns2;
+    }
+    SS2 ss2;
+    assert(ss2.ns1 != NS.init); // line 19
+    assert(ss2.ns2 != NS.init);
+
+    static struct SS3 {
+        int i;
+        NS ns;
+    }
+
+    SS3 ss3;
+    assert(ss3.ns != NS.init);
+
+    static struct SS4 {
+        int i;
+        NS ns1, ns2;
+    }
+
+    SS4 ss4;
+    assert(ss4.ns1 != NS.init); // fails
+    assert(ss4.ns2 != NS.init); // fails
+}
+
+/*******************************************/
+// 9006
+
+void test9006()
+{
+    int i;
+    struct NS
+    {
+        int n;
+        int[3] a; // Uncomment to fail assert on line 20 and pass on line 23
+        int f() { return i; }
+    }
+    NS ns;
+    assert(ns != NS.init);
+    ns = NS.init;
+    assert(ns == NS.init);
+
+    static struct SS { NS ns; }
+    assert(SS.init.ns == NS.init); // fails
+    assert(SS.init.ns != NS());    // fails
+
+    SS s;
+    assert(s.ns != NS.init); // line 20
+    assert(s != SS.init);    // fails
+    s = SS.init;
+    assert(s.ns == NS.init); // line 23, fails
+    assert(s == SS.init);
+}
+
+/*******************************************/
+// 9035
+
+void test9035()
+{
+    static struct S {}
+
+    void f(T)(auto ref T t)
+    {
+        static assert(!__traits(isRef, t));
+    }
+
+    f(S.init); // ok, rvalue
+    f(S());    // ok, rvalue
+
+    int i;
+    struct Nested
+    {
+        int j = 0; void f() { ++i; }
+    }
+
+    f(Nested());    // ok, rvalue
+    f(Nested.init); // fails, lvalue
+
+    assert(Nested.init.j == 0);
+    //(ref n) { n.j = 5; }(Nested.init);
+    assert(Nested.init.j == 0); // fails, j is 5
+}
+
+void test9035a()
+{
+    int x;
+    struct S {
+        // no field
+        void foo() { x = 1; }
+    }
+    S s1;
+    S s2 = S();
+    assert(s1  != S.init);  // OK
+    assert(s2  != S.init);  // OK
+    assert(S() != S.init);  // NG -> OK
+}
+
+/*******************************************/
+// 9036
+
+void test9036()
+{
+    static int i;
+    static struct S
+    {
+        this(this) { ++i; }
+    }
+
+    S s = S.init;
+    assert(i == 0); // postblit not called
+    s = S.init;
+    assert(i == 0); // postblit not called
+
+    int k;
+    static int j = 0;
+    struct N
+    {
+        this(this)
+        {
+            ++j;
+            assert(this.tupleof[$-1] != null); // fails
+        }
+        void f() { ++k; }
+    }
+
+    N n = N.init;
+    assert(j == 0); // fails, j = 1, postblit called
+    n = N.init;
+    assert(j == 0); // fails, j = 2, postblit called
+}
+
+/*******************************************/
+
+/+
+auto fun8863(T)(T* ret) { *ret = T(); }
+
+void test8863()
+{
+    int x = 1;
+    struct A
+    {
+        auto f()
+        {
+            assert(x == 1);
+        }
+    }
+
+    A a;
+    a.f();
+    fun8863!A(&a);
+    a.f();
+}
++/
+
+/*******************************************/
+// 8774
+
+void popFront8774()
+{
+    int[20] abc;    // smash stack
+}
+
+struct MapResult8774(alias fun)
+{
+    void delegate() front()
+    {
+        return fun(1);
+    }
+}
+
+void test8774() {
+
+    int sliceSize = 100;
+
+    void delegate() foo( int i )
+    {
+        void delegate() closedPartialSum()
+        {
+            int ii = i ;
+            void bar()
+            {
+                printf("%d\n", sliceSize);
+                assert(sliceSize == 100);
+            }
+            return &bar;
+        }
+        return closedPartialSum();
+    }
+
+    auto threads = MapResult8774!foo();
+
+    auto dg = threads.front();
+    popFront8774();
+
+    printf("calling dg()\n");
+    dg();
+}
+
+/*******************************************/
+
+int Bug8832(alias X)()
+{
+    return X();
+}
+
+int delegate() foo8832()
+{
+  int stack;
+  int heap = 3;
+
+  int nested_func()
+  {
+    ++heap;
+    return heap;
+  }
+  return delegate int() { return Bug8832!(nested_func); };
+}
+
+void test8832()
+{
+  auto z = foo8832();
+  auto p = foo8832();
+  assert(z() == 4);
+  p();
+  assert(z() == 5);
+}
+
+/*******************************************/
+// 9315
+
+auto test9315()
+{
+    struct S
+    {
+        int i;
+        void bar() {}
+    }
+    pragma(msg, S.init.tupleof[$-1]);
+}
+
+/*******************************************/
+// 9244
+
+void test9244()
+{
+    union U {
+        int i;
+        @safe int x() { return i; }
+    }
+}
+
+/*******************************************/
+// 10495
+
+struct X10495
+{
+    @disable this();
+}
+
+struct Y10495(alias f)
+{
+    void g() {}
+}
+
+class C10495
+{
+    X10495 s = X10495.init;
+
+    void h()
+    {
+        Y10495!(a => a) st;
+    }
+}
+
+/*******************************************/
+// 11385
+
+auto map11385(alias fun, R)(R range)
+{
+    return MapResult11385!(fun, R)(range);
+}
+struct MapResult11385(alias fun, R)
+{
+    R range;
+    auto front() { return fun(range[0]); }
+}
+void test11385()
+{
+    //import std.algorithm;
+    static auto fun1(T)(T a) { return a * 2; }
+           auto fun2(T)(T a) { return a * 2; }
+    [1].map11385!(a=>fun1(a));   // OK
+    [1].map11385!(a=>fun2(a));   // NG:XXX is a nested function and cannot be accessed from XXX
+}
+
+/*******************************************/
+
+void xmap(alias g)(int t)
+{
+    g(t);
+}
+
+enum foo11297 = function (int x)
+   {
+        //int bar(int y) { return x; } xmap!bar(7);
+        xmap!(y => x)(7);
+   };
+
+void xreduce(alias f)()
+{
+    f(4);
+}
+
+void test11297() {
+    xreduce!foo11297();
+}
+
+/*******************************************/
+// 12234
+
+void test12234()
+{
+    class B
+    {
+        int a;
+        this(int aa) { a = aa; }
+    }
+    auto foo = {
+        return new B(1);
+    };
+    static assert(is(typeof(foo) == delegate));
+
+    auto b = foo();
+    assert(b.a == 1);
+}
+
+/*******************************************/
+// 12981
+
+template Mix12981(T)
+{
+    class A
+    {
+        alias typeof(this.outer) x;
+    }
+}
+
+class B12981
+{
+    mixin Mix12981!(int);
+
+    static assert(is(A.x == B12981));
+}
+
+/*******************************************/
+// 13861
+
+struct Foo13861(alias f)
+{
+    struct Bar
+    {
+        Bar func()
+        {
+            return Bar();   // OK <- Segfault
+        }
+    }
+}
+
+void test13861()
+{
+    Foo13861!(n => n) a;
+}
+
+/*******************************************/
+// 14398
+
+void test14398()
+{
+    int outer;
+
+    struct Inner
+    {
+        this(this)
+        {
+            outer += 42;
+        }
+    }
+
+    struct Outer
+    {
+        Inner inner;
+
+        this(int dummy)
+        {
+            inner = Inner();
+
+            // hidden fields correctly set
+            assert(this.tupleof[$-1] !is null);
+            assert(inner.tupleof[$-1] !is null);
+        }
+    }
+
+    Outer[1] arr1 = [Outer(0)];
+    assert(outer == 0);     // no postblit called on arr1 construction
+    auto arr2 = arr1;
+    assert(outer == 42);    // inner is copied successfully
+}
+
+/*******************************************/
+// 14846
+
+void foo14846(Dg)(scope Dg code)
+{
+    static assert(is(Dg == delegate));
+    code();
+}
+
+void test14846()
+{
+    int x;
+
+    struct S
+    {
+        this(int n) { x = n; }
+        ~this() { x = 99; }
+    }
+
+    foo14846({ S s; });
+    foo14846({ S s = S(); });
+    foo14846({ S s = S(1); });
+    foo14846({ S[3] s; });
+
+    foo14846({ S* p = new S(); });
+    foo14846({ S* p = new S(1); });
+    foo14846({ S[] a = [S()]; });
+    foo14846({ S[] a = [S(1)]; });
+}
+
+/*******************************************/
+// 15422
+
+class App15422(T)
+{
+    this() {}
+
+    auto test1(T val)
+    in {} body      // necessary to reproduce the crash
+    {
+        struct Foo
+        {
+            this(int k) {}
+            T a;
+        }
+
+        Foo foo;
+        foo.a = val;
+
+        // Frame of test2 function, allocated on heap.
+        assert(foo.tupleof[$-1] !is null);
+
+        //printf("&foo = %p\n", &foo);                  // stack
+        //printf("&this = %p\n", &this);                // stack?
+        //printf("foo.vthis = %p\n", foo.tupleof[$-1]); // stack...!?
+        //assert(cast(void*)&this !is *cast(void**)&foo.tupleof[$-1], "bad");
+        // BUG: currently foo.vthis set to the address of 'this' variable on the stack.
+        // It's should be stomped to null, because Foo.vthis is never be used.
+
+        int[Foo] map;
+        map[foo] = 1;   // OK <- crash
+
+        return foo;
+    }
+
+    auto test2(T val)
+    //in {} body
+    {
+        int closVar;
+        struct Foo
+        {
+            this(int k) { closVar = k; }
+            // Make val a closure variable.
+
+            T a;
+        }
+
+        Foo foo;
+        foo.a = val;
+
+        // Frame of test2 function, allocated on heap.
+        assert(foo.tupleof[$-1] !is null);
+
+        return foo;
+    }
+}
+
+void test15422a()
+{
+    alias App = App15422!int;
+    App app1 = new App;
+    {
+        auto x = app1.test1(1);
+        auto y = app1.test1(1);
+        static assert(is(typeof(x) == typeof(y)));
+
+        // int (bitwise comparison)
+        assert(x.a == y.a);
+
+        assert(*cast(void**)&x.tupleof[$-1] is *cast(void**)&y.tupleof[$-1]);
+
+        // bitwise equality (needOpEquals() and needToHash() returns false)
+        assert(x == y);
+
+        // BUG
+        //assert(*cast(void**)&x.tupleof[$-1] is null);
+        //assert(*cast(void**)&y.tupleof[$-1] is null);
+        auto getZ() { auto z = app1.test1(1); return z; }
+        auto z = getZ();
+        assert(x.a == z.a);
+        //assert(x.tupleof[$-1] is z.tupleof[$-1]);   // should pass
+        //assert(x == z);                             // should pass
+
+        x = y;  // OK, x.tupleof[$-1] = y.tupleof[$-1] is a blit copy.
+    }
+    App app2 = new App;
+    {
+        auto x = app1.test2(1);
+        auto y = app2.test2(1);
+        static assert(is(typeof(x) == typeof(y)));
+
+        // int (bitwise comparison)
+        assert(x.a == y.a);
+
+        // closure envirionments
+        assert(*cast(void**)&x.tupleof[$-1] !is *cast(void**)&y.tupleof[$-1]);
+
+        // Changed to bitwise equality (needOpEquals() and needToHash() returns false)
+        assert(x != y);         // OK <- crash
+
+        x = y;  // OK, x.tupleof[$-1] = y.tupleof[$-1] is a blit copy.
+    }
+}
+
+void test15422b()
+{
+    alias App = App15422!string;
+    App app1 = new App;
+    {
+        auto x = app1.test1("a".idup);
+        auto y = app1.test1("a".idup);
+        static assert(is(typeof(x) == typeof(y)));
+
+        // string (element-wise comparison)
+        assert(x.a == y.a);
+
+        assert(*cast(void**)&x.tupleof[$-1] is *cast(void**)&y.tupleof[$-1]);
+
+        // memberwise equality (needToHash() returns true)
+        assert(x == y);
+        // Lowered to: x.a == y.a && x.tupleof[$-1] is y.tupleof[$-1]
+
+        // BUG
+        //assert(*cast(void**)&x.tupleof[$-1] is null);
+        //assert(*cast(void**)&y.tupleof[$-1] is null);
+        auto getZ() { auto z = app1.test1("a".idup); return z; }
+        auto z = getZ();
+        assert(x.a == z.a);
+        //assert(x.tupleof[$-1] is z.tupleof[$-1]);   // should pass
+        //assert(x == z);                             // should pass
+
+        x = y;  // OK, x.tupleof[$-1] = y.tupleof[$-1] is a blit copy.
+    }
+    App app2 = new App;
+    {
+        auto x = app1.test2("a".idup);
+        auto y = app2.test2("a".idup);
+        static assert(is(typeof(x) == typeof(y)));
+
+        // string (element-wise comparison)
+        assert(x.a == y.a);
+
+        // closure envirionments
+        assert(*cast(void**)&x.tupleof[$-1] !is *cast(void**)&y.tupleof[$-1]);
+
+        // Changed to memberwise equality (needToHash() returns true)
+        // Lowered to: x.a == y.a && x.tupleof[$-1] is y.tupleof[$-1]
+        assert(x != y);         // OK <- crash
+
+        x = y;  // OK, x.tupleof[$-1] = y.tupleof[$-1] is a blit copy.
+    }
+}
+
+/*******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test4401();
+    test7428();
+    test4612();
+    test4841();
+    test7199();
+    test7965();
+    test7965a();
+    test8188();
+
+    test5082();
+    test8194();
+    test8339a();
+    test8339b();
+    test8339c();
+    test8923a();
+    test8923b();
+    test8923c();
+    test9003();
+    test9006();
+    test9035();
+    test9035a();
+    test9036();
+//    test8863();
+    test8774();
+    test8832();
+    test9315();
+    test9244();
+    test11385();
+    test11297();
+    test12234();
+    test13861();
+    test14398();
+    test14846();
+    test15422a();
+    test15422b();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/newdel.d b/gcc/testsuite/gdc.test/runnable/newdel.d
new file mode 100644
index 00000000000..21f7809c684
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/newdel.d
@@ -0,0 +1,110 @@
+// PERMUTE_ARGS:
+
+import core.stdc.stdio;
+import core.stdc.stdlib;
+
+/*********************************************/
+
+class Foo
+{
+    static uint flags;
+
+    new(size_t sz, int x)
+    {   void* p;
+
+        printf("Foo.new(sz = %d, x = %d)\n", sz, x);
+        assert(sz == Foo.classinfo.initializer.length);
+        assert(x == 5);
+
+        p = core.stdc.stdlib.malloc(sz);
+        flags |= 4;
+        return p;
+    }
+
+    this()
+    {
+        printf("this() %p\n", this);
+        a = 36;
+    }
+
+    ~this()
+    {
+        printf("~this() %p\n", this);
+        a = -5;
+        flags |= 1;
+    }
+
+    delete(void* p)
+    {
+        printf("delete %p\n", p);
+        free(p);
+        flags |= 2;
+    }
+
+    int a = 3;
+    int b = 4;
+    int d = 56;
+}
+
+void test1()
+{
+    Foo f;
+
+    f = new(5) Foo;
+    assert(f.a == 36);
+    assert(f.b == 4);
+    assert(f.d == 56);
+    assert(Foo.flags == 4);
+
+    delete f;
+    assert(Foo.flags == 7);
+}
+
+
+/*********************************************/
+
+struct Foo2
+{
+    static uint flags;
+
+    new(size_t sz, int x)
+    {   void* p;
+
+        printf("Foo2.new(sz = %d, x = %d)\n", sz, x);
+        assert(sz == Foo2.sizeof);
+        assert(x == 5);
+
+        p = core.stdc.stdlib.malloc(sz);
+        flags |= 4;
+        return p;
+    }
+
+    delete(void *p)
+    {
+        printf("p = %p\n", p);
+        flags |= 2;
+        core.stdc.stdlib.free(p);
+    }
+}
+
+void test2()
+{
+    Foo2 *f = new(5) Foo2();
+
+    printf("f = %p\n", f);
+    delete f;
+    assert(Foo2.flags == 6);
+}
+
+
+/*********************************************/
+
+int main()
+{
+    test1();
+    test2();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/nogc.d b/gcc/testsuite/gdc.test/runnable/nogc.d
new file mode 100644
index 00000000000..bb917376c03
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/nogc.d
@@ -0,0 +1,56 @@
+
+extern(C) int printf(const char*, ...);
+
+/***********************/
+
+@nogc int test1()
+{
+    return 3;
+}
+
+/***********************/
+// 3032
+
+void test3032() @nogc
+{
+    scope o1 = new Object();        // on stack
+    scope o2 = new class Object {}; // on stack
+
+    int n = 1;
+    scope fp = (){ n = 10; };       // no closure
+    fp();
+    assert(n == 10);
+}
+
+/***********************/
+// 12642
+
+__gshared int[1] data12642;
+
+int[1] foo12642() @nogc
+{
+    int x;
+    return [x];
+}
+
+void test12642() @nogc
+{
+    int x;
+    data12642 = [x];
+    int[1] data2;
+    data2 = [x];
+
+    data2 = foo12642();
+}
+
+/***********************/
+
+int main()
+{
+    test1();
+    test3032();
+    test12642();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/nulltype.d b/gcc/testsuite/gdc.test/runnable/nulltype.d
new file mode 100644
index 00000000000..32d117468ee
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/nulltype.d
@@ -0,0 +1,185 @@
+extern (C) int printf(const(char*) fmt, ...);
+
+alias typeof(null) null_t;
+
+/**********************************************/
+
+void test1()
+{
+    null_t null1;
+    typeof(null) null2;
+
+    static assert(is(typeof(null1) == typeof(null)));
+    static assert(is(typeof(null2) == typeof(null)));
+
+    static assert(is(typeof(null1) == null_t));
+    static assert(is(typeof(null2) == null_t));
+}
+
+/**********************************************/
+
+interface I{}
+class C{}
+
+int f(null_t)   { return 1; }
+int f(int[])    { return 2; }
+int f(C)        { return 3; }
+
+void test2()
+{
+    static assert(is(null_t : C));
+    static assert(is(null_t : I));
+    static assert(is(null_t : int[]));
+    static assert(is(null_t : void*));
+    static assert(is(null_t : int**));
+
+    static assert(!is(null_t == C));
+    static assert(!is(null_t == I));
+    static assert(!is(null_t == int[]));
+    static assert(!is(null_t == void*));
+    static assert(!is(null_t == int**));
+
+    static assert(is(null_t == null_t));
+
+    assert(f(null) == 1);
+}
+
+/**********************************************/
+// 5899
+
+auto f5899(bool b)
+{
+    if (b)
+        return new Object;
+    else
+        return null;
+}
+static assert(is(typeof(f5899) R == return) && is(R == Object));
+pragma(msg, typeof(f5899));
+
+auto g5899(bool b)
+{
+    if (b)
+        return new int;
+    else
+        return null;
+}
+static assert(is(typeof(g5899) R == return) && is(R == int*));
+pragma(msg, typeof(g5899));
+
+auto h5899(bool b)
+{
+    if (b)
+        return [1];
+    else
+        return null;
+}
+static assert(is(typeof(h5899) R == return) && is(R == int[]));
+pragma(msg, typeof(h5899));
+
+/**********************************************/
+// 7278
+
+struct Foo7278(string s)
+{
+    string var;
+    void func()
+    {
+        string local = var;
+    }
+}
+
+void test7278()
+{
+    Foo7278!null a;
+    Foo7278!null b;
+}
+
+/**********************************************/
+// 8221
+
+class A8221
+{
+    A8221 foo() { return this; }
+}
+class B8221: A8221
+{
+    override typeof(null) foo() { return null; } // error
+}
+void test8221()
+{
+    auto a = new A8221();
+    assert(a.foo() is a);
+    auto b = new B8221();
+    assert(b.foo() is null);
+    a = b;
+    assert(a.foo() is null);
+}
+
+/***************************************************/
+// 8589
+
+void test8589()
+{
+    static typeof(null) retnull() { return null; }
+
+    void test(bool result, T)()
+    {
+        void f(T function() dg) { assert(!dg()); }
+
+        static assert((T.sizeof == typeof(null).sizeof) == result);
+        static assert(is(typeof( f(&retnull) )) == result);
+        static assert(is(typeof( f(()=>null) )) == result);
+        static if (result)
+        {
+            f(&retnull);
+            f(()=>null);
+        }
+    }
+    test!(true,  int*)();
+    test!(true,  Object)();
+    test!(true,  int[int])();
+    test!(false, int[])();
+    test!(false, void delegate())();
+}
+
+/**********************************************/
+// 9385
+
+void test9385()
+{
+    assert((null ? true : false) == false);
+    if (null) assert(0);
+    assert(!null);
+}
+
+/**********************************************/
+// 12203
+
+void test12203()
+{
+    typeof(null) v;
+    void foo(float) {}
+    void delegate(float) dg = &foo;
+    assert(dg !is null);
+
+    dg = v; // Error: e2ir: cannot cast v of type typeof(null) to type void delegate(float)
+
+    assert(dg  is null);
+}
+
+/**********************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test7278();
+    test8221();
+    test8589();
+    test9385();
+    test12203();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/opdisp.d b/gcc/testsuite/gdc.test/runnable/opdisp.d
new file mode 100644
index 00000000000..f84a0ec794c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/opdisp.d
@@ -0,0 +1,297 @@
+extern (C) int printf(const char* fmt, ...);
+
+int pass(int n){ return n; }
+
+struct X
+{
+    int m;
+
+    int opIndex(int m, int n)
+    {
+        return n;
+    }
+}
+
+/**********************************************/
+
+struct S1f
+{
+    int opDispatch(string name, A...)(A args)
+    {
+      static if (args.length)
+        return args[0];
+      else
+        return 0;
+    }
+}
+struct S1p
+{
+    @property int opDispatch(string name, A...)(A args)
+    {
+      static if (args.length)
+        return args[0];
+      else
+        return 0;
+    }
+}
+void test1()
+{
+    S1f s1f;
+    assert(s1f.func() == 0);            // ok -> ok
+    assert(s1f.func(1) == 1);           // ok -> ok
+    assert(pass(s1f.func()) == 0);      // ok -> ok
+    assert(pass(s1f.func(1)) == 1);     // ok -> ok
+    assert(X(s1f.func()).m == 0);
+    assert(X()[0, s1f.func()] == 0);
+
+    S1p s1p;
+    assert(s1p.prop == 0);              // ok   -> ok
+    assert((s1p.prop = 1) == 1);        // CTng -> CTng
+    assert(pass(s1p.prop) == 0);        // ok   -> ok
+    assert(pass(s1p.prop = 2) == 2);    // CTng -> CTng
+    assert(X(s1p.prop).m == 0);
+    assert(X()[0, s1p.prop] == 0);
+}
+
+/**********************************************/
+
+struct S2f
+{
+    template opDispatch(string name)
+    {
+        int opDispatch(A...)(A args)
+        {
+          static if (args.length)
+            return args[0];
+          else
+            return 0;
+        }
+    }
+}
+struct S2p
+{
+    template opDispatch(string name)
+    {
+        @property int opDispatch(A...)(A args)
+        {
+          static if (args.length)
+            return args[0];
+          else
+            return 0;
+        }
+    }
+}
+void test2()
+{
+    S2f s2f;
+    assert(s2f.func() == 0);            // ok -> ok
+    assert(s2f.func(1) == 1);           // ok -> ok
+    assert(pass(s2f.func()) == 0);      // ok -> ok
+    assert(pass(s2f.func(1)) == 1);     // ok -> ok
+    assert(X(s2f.func()).m == 0);
+    assert(X()[0, s2f.func()] == 0);
+
+    S2p s2p;
+    assert(s2p.prop == 0);              // CTng -> ok
+    assert((s2p.prop = 1) == 1);        // ok   -> ok
+    assert(pass(s2p.prop) == 0);        // CTng -> ok
+    assert(pass(s2p.prop = 2) == 2);    // ok   -> ok
+    assert(X(s2p.prop).m == 0);
+    assert(X()[0, s2p.prop] == 0);
+}
+
+/**********************************************/
+
+struct S3f
+{
+    template opDispatch(string name)
+    {
+        template opDispatch(T)
+        {
+            int opDispatch(A...)(A args)
+            {
+              static if (args.length)
+                return args[0];
+              else
+                return 0;
+            }
+        }
+    }
+}
+struct S3p
+{
+    template opDispatch(string name)
+    {
+        template opDispatch(T)
+        {
+            @property int opDispatch(A...)(A args)
+            {
+              static if (args.length)
+                return args[0];
+              else
+                return 0;
+            }
+        }
+    }
+}
+void test3()
+{
+    S3f s3f;
+    assert(s3f.func!int() == 0);            // ok -> ok
+    assert(s3f.func!int(1) == 1);           // ok -> ok
+    assert(pass(s3f.func!int()) == 0);      // ok -> ok
+    assert(pass(s3f.func!int(1)) == 1);     // ok -> ok
+    assert(X(s3f.func!int()).m == 0);
+    assert(X()[0, s3f.func!int()] == 0);
+
+    S3p s3p;
+    assert(s3p.prop!int == 0);              // CTng -> ok
+    assert((s3p.prop!int = 1) == 1);        // ok   -> ok
+    assert(pass(s3p.prop!int) == 0);        // CTng -> ok
+    assert(pass(s3p.prop!int = 2) == 2);    // ok   -> ok
+    assert(X(s3p.prop!int).m == 0);
+    assert(X()[0, s3p.prop!int] == 0);
+}
+
+/**********************************************/
+
+struct S4f
+{
+    ref int opDispatch(string name, A...)(A args)
+    {
+        static int n;
+        n = args.length;
+        return n;
+    }
+}
+struct S4p
+{
+    @property ref int opDispatch(string name, A...)(A args)
+    {
+        static int n;
+        n = args.length;
+        return n;
+    }
+}
+void test4()
+{
+    S4f s4f;
+    assert(s4f.func == 0);          // getter
+    assert((s4f.func = 1) == 1);    // setter
+
+    S4p s4p;
+    assert(s4p.prop == 0);          // getter
+    assert((s4p.prop = 1) == 1);    // setter
+}
+
+/**********************************************/
+
+struct S5f
+{
+    template opDispatch(string name)
+    {
+        ref int opDispatch(A...)(A args)
+        {
+            static int n;
+            n = args.length;
+            return n;
+        }
+    }
+}
+struct S5p
+{
+    template opDispatch(string name)
+    {
+        @property ref int opDispatch(A...)(A args)
+        {
+            static int n;
+            n = args.length;
+            return n;
+        }
+    }
+}
+void test5()
+{
+    S5f s5f;
+    assert(s5f.prop == 0);          // getter   ng -> ok
+    assert((s5f.prop = 1) == 1);    // setter
+
+    S5p s5p;
+    assert(s5p.prop == 0);          // getter   ng -> ok
+    assert((s5p.prop = 1) == 1);    // setter
+}
+
+/**********************************************/
+
+struct S6f
+{
+    template opDispatch(string name)
+    {
+        template opDispatch(T)
+        {
+            ref int opDispatch(A...)(A args)
+            {
+                static int n;
+                n = args.length;
+                return n;
+            }
+        }
+    }
+}
+struct S6p
+{
+    template opDispatch(string name)
+    {
+        template opDispatch(T)
+        {
+            @property ref int opDispatch(A...)(A args)
+            {
+                static int n;
+                n = args.length;
+                return n;
+            }
+        }
+    }
+}
+void test6()
+{
+    S6f s6f;
+    assert(s6f.prop!int == 0);          // getter   ng -> ok
+    assert((s6f.prop!int = 1) == 1);    // setter
+
+    S6p s6p;
+    assert(s6p.prop!int == 0);          // getter   ng -> ok
+    assert((s6p.prop!int = 1) == 1);    // setter
+}
+
+/**********************************************/
+// 7578
+
+struct Foo7578
+{
+    static int[] opDispatch(string op, Args...)(Args)
+    {
+        return [0];
+    }
+}
+
+void test7578()
+{
+    Foo7578.attrs[0] = 1;
+}
+
+/**********************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7578();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/opover.d b/gcc/testsuite/gdc.test/runnable/opover.d
new file mode 100644
index 00000000000..66270f4f0bd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/opover.d
@@ -0,0 +1,1111 @@
+
+// Test operator overloading
+
+import core.stdc.stdio;
+
+/**************************************/
+
+class A1
+{
+    int opAdd(int i) { return 7 + i; }
+}
+
+void test1()
+{
+    A1 a = new A1();
+    int i;
+
+    i = a + 3;
+    assert(i == 10);
+
+    i = 4 + a;
+    assert(i == 11);
+}
+
+/**************************************/
+
+class A2
+{
+    int opDiv(int i)   { return 9 + i; }
+    int opDiv_r(int i) { return 17 + i; }
+}
+
+void test2()
+{
+    A2 a = new A2();
+    int i;
+
+    i = a / 3;
+    assert(i == 12);
+
+    i = 4 / a;
+    assert(i == 21);
+}
+
+/**************************************/
+
+class C1
+{
+}
+
+class C2
+{
+    int opAdd(D1 d)   { return 1; }
+    int opAdd(D2 d)   { return 2; }
+    int opAdd(D3 d)   { return 3; }
+    int opAdd(D4 d)   { return 4; }
+}
+
+class C3
+{
+    int opAdd_r(D1 d) { return 5; }
+    int opAdd_r(D2 d) { return 6; }
+    int opAdd_r(D3 d) { return 7; }
+    int opAdd_r(D4 d) { return 8; }
+}
+
+class C4
+{
+    int opAdd(D1 d)   { return 9; }
+    int opAdd(D2 d)   { return 10; }
+    int opAdd(D3 d)   { return 11; }
+    int opAdd(D4 d)   { return 12; }
+
+    int opAdd_r(D1 d) { return 13; }
+    int opAdd_r(D2 d) { return 14; }
+    int opAdd_r(D3 d) { return 15; }
+    int opAdd_r(D4 d) { return 16; }
+}
+
+class D1
+{
+}
+
+class D2
+{
+    int opAdd(C1 c)   { return 17; }
+    int opAdd(C2 d)   { return 18; }
+    int opAdd(C3 d)   { return 19; }
+    int opAdd(C4 d)   { return 20; }
+}
+
+class D3
+{
+    int opAdd_r(C1 d) { return 21; }
+    int opAdd_r(C2 d) { return 22; }
+    int opAdd_r(C3 d) { return 23; }
+    int opAdd_r(C4 d) { return 24; }
+}
+
+class D4
+{
+    int opAdd(C1 d)   { return 25; }
+    int opAdd(C2 d)   { return 26; }
+    int opAdd(C3 d)   { return 27; }
+    int opAdd(C4 d)   { return 28; }
+
+    int opAdd_r(C1 d) { return 29; }
+    int opAdd_r(C2 d) { return 30; }
+    int opAdd_r(C3 d) { return 31; }
+    int opAdd_r(C4 d) { return 32; }
+}
+
+
+
+void test3()
+{
+    C1 c1 = new C1();
+    C2 c2 = new C2();
+    C3 c3 = new C3();
+    C4 c4 = new C4();
+    D1 d1 = new D1();
+    D2 d2 = new D2();
+    D3 d3 = new D3();
+    D4 d4 = new D4();
+
+    int i;
+
+  version (ADD_R)
+  {
+    //i = c1 + d1;    assert(i == );
+    i = c1 + d2;    assert(i == 17);
+    i = c1 + d3;    assert(i == 21);
+    i = c1 + d4;    assert(i == 29);
+
+    i = c2 + d1;    assert(i == 1);
+    i = c2 + d2;    assert(i == 2);
+    i = c2 + d3;    assert(i == 3);
+    i = c2 + d4;    assert(i == 4);
+
+    //i = c3 + d1;    assert(i == );
+    i = c3 + d2;    assert(i == 19);
+    i = c3 + d3;    assert(i == 23);
+    i = c3 + d4;    assert(i == 31);
+
+    i = c4 + d1;    assert(i == 9);
+    i = c4 + d2;    assert(i == 10);
+    i = c4 + d3;    assert(i == 11);
+    i = c4 + d4;    assert(i == 12);
+
+    //i = d1 + c1;    assert(i == );
+    i = d1 + c2;    assert(i == 1);
+    i = d1 + c3;    assert(i == 5);
+    i = d1 + c4;    assert(i == 13);
+
+    i = d2 + c1;    assert(i == 17);
+    i = d2 + c2;    assert(i == 18);
+    i = d2 + c3;    assert(i == 19);
+    i = d2 + c4;    assert(i == 20);
+
+    //i = d3 + c1;    assert(i == );
+    i = d3 + c2;    assert(i == 3);
+    i = d3 + c3;    assert(i == 7);
+    i = d3 + c4;    assert(i == 15);
+
+    i = d4 + c1;    assert(i == 25);
+    i = d4 + c2;    assert(i == 26);
+    i = d4 + c3;    assert(i == 27);
+    i = d4 + c4;    assert(i == 28);
+  }
+  else
+  {
+    //i = c1 + d1;    assert(i == );
+    i = c1 + d2;    assert(i == 17);
+//    i = c1 + d3;    assert(i == 21);
+    i = c1 + d4;    assert(i == 29);
+
+    i = c2 + d1;    assert(i == 1);
+    i = c2 + d2;    assert(i == 2);
+//    i = c2 + d3;    assert(i == 3);
+//    i = c2 + d4;    assert(i == 4);
+
+    //i = c3 + d1;    assert(i == );
+//    i = c3 + d2;    printf("i = %d\n", i); assert(i == 19);
+//    i = c3 + d3;    assert(i == 23);
+    i = c3 + d4;    assert(i == 31);
+
+    i = c4 + d1;    assert(i == 9);
+    i = c4 + d2;    assert(i == 10);
+//    i = c4 + d3;    assert(i == 11);
+//    i = c4 + d4;    assert(i == 12);
+
+    //i = d1 + c1;    assert(i == );
+    i = d1 + c2;    assert(i == 1);
+//    i = d1 + c3;    assert(i == 5);
+    i = d1 + c4;    assert(i == 13);
+
+    i = d2 + c1;    assert(i == 17);
+    i = d2 + c2;    assert(i == 18);
+//    i = d2 + c3;    assert(i == 19);
+//    i = d2 + c4;    assert(i == 20);
+
+    //i = d3 + c1;    assert(i == );
+//    i = d3 + c2;    assert(i == 3);
+//    i = d3 + c3;    assert(i == 7);
+    i = d3 + c4;    assert(i == 15);
+
+    i = d4 + c1;    assert(i == 25);
+    i = d4 + c2;    assert(i == 26);
+//    i = d4 + c3;    assert(i == 27);
+//    i = d4 + c4;    assert(i == 28);
+  }
+}
+
+/**************************************/
+
+struct Foo4
+{
+    int a;
+    int opCmp(Foo4 b)
+    {
+        return a < b.a;
+    }
+}
+
+void test4()
+{
+   Foo4 a;
+   Foo4 b;
+
+   assert(a <= b);
+}
+
+/**************************************/
+
+class A5
+{
+    int opNeg()     { return 10; }
+    int opCom()     { return 11; }
+    int opPostInc() { return 12; }
+    int opPostDec() { return 13; }
+
+    int opAdd(int j)     { return 14; }
+    int opSub(int j)     { return 15; }
+    int opSub_r(int j)   { return 16; }
+    int opMul(int j)     { return 17; }
+    int opDiv(int j)     { return 18; }
+    int opDiv_r(int j)   { return 19; }
+    int opMod(int j)     { return 20; }
+    int opMod_r(int j)   { return 21; }
+    int opAnd(int j)     { return 22; }
+    int opOr(int j)      { return 23; }
+    int opXor(int j)     { return 24; }
+    int opShl(int j)     { return 25; }
+    int opShl_r(int j)   { return 26; }
+    int opShr(int j)     { return 27; }
+    int opShr_r(int j)   { return 28; }
+    int opUShr(int j)    { return 29; }
+    int opUShr_r(int j)  { return 30; }
+    int opCat(int j)     { return 31; }
+    int opCat_r(int j)   { return 32; }
+    int opEquals(int j)  { return 33; }
+    int opCmp(int j)     { return 34; }
+    int opAddAssign(int j)  { return 35; }
+    int opSubAssign(int j)  { return 36; }
+    int opMulAssign(int j)  { return 37; }
+    int opDivAssign(int j)  { return 38; }
+    int opModAssign(int j)  { return 39; }
+    int opAndAssign(int j)  { return 40; }
+    int opOrAssign(int j)   { return 41; }
+    int opXorAssign(int j)  { return 42; }
+    int opShlAssign(int j)  { return 43; }
+    int opShrAssign(int j)  { return 44; }
+    int opUShrAssign(int j) { return 45; }
+    int opCatAssign(int j)  { return 46; }
+}
+
+void test5()
+{
+    A5 a = new A5();
+    int i;
+
+    i = -a;
+    assert(i == 10);
+
+    i = ~a;
+    assert(i == 11);
+
+    i = a++;
+    assert(i == 12);
+
+    i = a--;
+    assert(i == 13);
+
+    i = a + 1;
+    assert(i == 14);
+
+    i = a - 1;
+    assert(i == 15);
+
+    i = 1 - a;
+    assert(i == 16);
+
+    i = a * 1;
+    assert(i == 17);
+
+    i = a / 1;
+    assert(i == 18);
+
+    i = 1 / a;
+    assert(i == 19);
+
+    i = a % 1;
+    assert(i == 20);
+
+    i = 1 % a;
+    assert(i == 21);
+
+    i = a & 1;
+    assert(i == 22);
+
+    i = a | 1;
+    assert(i == 23);
+
+    i = a ^ 1;
+    assert(i == 24);
+
+    i = a << 1;
+    assert(i == 25);
+
+    i = 1 << a;
+    assert(i == 26);
+
+    i = a >> 1;
+    assert(i == 27);
+
+    i = 1 >> a;
+    assert(i == 28);
+
+    i = a >>> 1;
+    assert(i == 29);
+
+    i = 1 >>> a;
+    assert(i == 30);
+
+    i = a ~ 1;
+    assert(i == 31);
+
+    i = 1 ~ a;
+    assert(i == 32);
+
+    i = a == 1;
+    assert(i == 33);
+    i = 1 == a;
+    assert(i == 33);
+    i = a != 1;
+    assert(i == 0);
+    i = 1 != a;
+    assert(i == 0);
+
+    i = a < 1;
+    assert(i == 0);
+    i = a <= 1;
+    assert(i == 0);
+    i = a > 1;
+    assert(i == 1);
+    i = a >= 1;
+    assert(i == 1);
+
+    i = 1 < a;
+printf("i = %d\n", i);
+    assert(i == 1);
+    i = 1 <= a;
+    assert(i == 1);
+    i = 1 > a;
+    assert(i == 0);
+    i = 1 >= a;
+    assert(i == 0);
+
+    i = (a += 1);
+    assert(i == 35);
+    i = ++a;
+    assert(i == 35);
+
+    i = (a -= 1);
+    assert(i == 36);
+    i = --a;
+    assert(i == 36);
+
+    i = (a *= 1);
+    assert(i == 37);
+
+    i = (a /= 1);
+    assert(i == 38);
+
+    i = (a %= 1);
+    assert(i == 39);
+
+    i = (a &= 1);
+    assert(i == 40);
+
+    i = (a |= 1);
+    assert(i == 41);
+
+    i = (a ^= 1);
+    assert(i == 42);
+
+    i = (a <<= 1);
+    assert(i == 43);
+
+    i = (a >>= 1);
+    assert(i == 44);
+
+    i = (a >>>= 1);
+    assert(i == 45);
+
+    i = (a ~= 1);
+    assert(i == 46);
+}
+
+/*********************************/
+
+struct A6
+{
+    int opNeg()     { return 10; }
+    int opCom()     { return 11; }
+    int opPostInc() { return 12; }
+    int opPostDec() { return 13; }
+
+    int opAdd(int j)     { return 14; }
+    int opSub(int j)     { return 15; }
+    int opSub_r(int j)   { return 16; }
+    int opMul(int j)     { return 17; }
+    int opDiv(int j)     { return 18; }
+    int opDiv_r(int j)   { return 19; }
+    int opMod(int j)     { return 20; }
+    int opMod_r(int j)   { return 21; }
+    int opAnd(int j)     { return 22; }
+    int opOr(int j)      { return 23; }
+    int opXor(int j)     { return 24; }
+    int opShl(int j)     { return 25; }
+    int opShl_r(int j)   { return 26; }
+    int opShr(int j)     { return 27; }
+    int opShr_r(int j)   { return 28; }
+    int opUShr(int j)    { return 29; }
+    int opUShr_r(int j)  { return 30; }
+    int opCat(int j)     { return 31; }
+    int opCat_r(int j)   { return 32; }
+    int opEquals(int j)      { return 33; }
+    const bool opEquals(const ref A6)      { return false; }
+    int opCmp(int j)     { return 34; }
+    int opAddAssign(int j)  { return 35; }
+    int opSubAssign(int j)  { return 36; }
+    int opMulAssign(int j)  { return 37; }
+    int opDivAssign(int j)  { return 38; }
+    int opModAssign(int j)  { return 39; }
+    int opAndAssign(int j)  { return 40; }
+    int opOrAssign(int j)   { return 41; }
+    int opXorAssign(int j)  { return 42; }
+    int opShlAssign(int j)  { return 43; }
+    int opShrAssign(int j)  { return 44; }
+    int opUShrAssign(int j) { return 45; }
+    int opCatAssign(int j)  { return 46; }
+}
+
+void test6()
+{
+    A6 a;
+    int i;
+
+    i = -a;
+    assert(i == 10);
+
+    i = ~a;
+    assert(i == 11);
+
+    i = a++;
+    assert(i == 12);
+
+    i = a--;
+    assert(i == 13);
+
+    i = a + 1;
+    assert(i == 14);
+
+    i = a - 1;
+    assert(i == 15);
+
+    i = 1 - a;
+    assert(i == 16);
+
+    i = a * 1;
+    assert(i == 17);
+
+    i = a / 1;
+    assert(i == 18);
+
+    i = 1 / a;
+    assert(i == 19);
+
+    i = a % 1;
+    assert(i == 20);
+
+    i = 1 % a;
+    assert(i == 21);
+
+    i = a & 1;
+    assert(i == 22);
+
+    i = a | 1;
+    assert(i == 23);
+
+    i = a ^ 1;
+    assert(i == 24);
+
+    i = a << 1;
+    assert(i == 25);
+
+    i = 1 << a;
+    assert(i == 26);
+
+    i = a >> 1;
+    assert(i == 27);
+
+    i = 1 >> a;
+    assert(i == 28);
+
+    i = a >>> 1;
+    assert(i == 29);
+
+    i = 1 >>> a;
+    assert(i == 30);
+
+    i = a ~ 1;
+    assert(i == 31);
+
+    i = 1 ~ a;
+    assert(i == 32);
+
+    i = a == 1;
+    assert(i == 33);
+    i = 1 == a;
+    assert(i == 33);
+    i = a != 1;
+    assert(i == 0);
+    i = 1 != a;
+    assert(i == 0);
+
+    i = a < 1;
+    assert(i == 0);
+    i = a <= 1;
+    assert(i == 0);
+    i = a > 1;
+    assert(i == 1);
+    i = a >= 1;
+    assert(i == 1);
+
+    i = 1 < a;
+    assert(i == 1);
+    i = 1 <= a;
+    assert(i == 1);
+    i = 1 > a;
+    assert(i == 0);
+    i = 1 >= a;
+    assert(i == 0);
+
+    i = (a += 1);
+    assert(i == 35);
+    i = ++a;
+    assert(i == 35);
+
+    i = (a -= 1);
+    assert(i == 36);
+    i = --a;
+    assert(i == 36);
+
+    i = (a *= 1);
+    assert(i == 37);
+
+    i = (a /= 1);
+    assert(i == 38);
+
+    i = (a %= 1);
+    assert(i == 39);
+
+    i = (a &= 1);
+    assert(i == 40);
+
+    i = (a |= 1);
+    assert(i == 41);
+
+    i = (a ^= 1);
+    assert(i == 42);
+
+    i = (a <<= 1);
+    assert(i == 43);
+
+    i = (a >>= 1);
+    assert(i == 44);
+
+    i = (a >>>= 1);
+    assert(i == 45);
+
+    i = (a ~= 1);
+    assert(i == 46);
+}
+
+
+/**************************************/
+
+struct Foo7
+{
+    int opSlice() { return 7; }
+    int opSlice(int i, int j) { return i * (j + 1); }
+}
+
+void test7()
+{
+    Foo7 f;
+    int i;
+
+    i = f[];
+    assert(i == 7);
+    i = f[3..4];
+    assert(i == 15);
+}
+
+/**************************************/
+
+interface IWriter
+{
+        int opShl (string i);
+        int opShl (int i);
+}
+
+class Writer : IWriter
+{
+    int opShl (string i)
+    {
+        printf("Writer.opShl(char[])\n");
+        return 1;
+    }
+
+    int opShl (int i)
+    {
+        printf("Writer.opShl(int)\n");
+        return 2;
+    }
+}
+
+class BinaryWriter : Writer
+{
+    alias Writer.opShl opShl;
+
+    override int opShl (int i)
+    {
+        printf("BinaryWriter.opShl(int)\n");
+        return 3;
+    }
+}
+
+void test8()
+{
+    BinaryWriter bw = new BinaryWriter();
+    int i;
+
+    i = bw << "test";
+    assert(i == 1);
+    i = bw << 1;
+    assert(i == 3);
+}
+
+/**************************************/
+
+struct A9
+{
+    int opCast() { return 28; }
+}
+
+void test9()
+{
+    A9 a;
+
+    long i = cast(long)a;
+    assert(i == 28);
+}
+
+/**************************************/
+
+class A10
+{
+    int opAdd(int i) { return i + 1; }
+}
+
+class B10
+{
+    int opAdd_r(A10 a) { return 3; }
+}
+
+void test10()
+{
+    int i;
+    A10 a = new A10();
+
+    i = a + 1;
+    printf("a + 1 = %d\n", i);
+    assert(i == 2);
+
+    i = 1 + a;
+    printf("1 + a = %d\n", i);
+    assert(i == 2);
+
+    B10 b = new B10();
+    i = a + b;
+    printf("a + b = %d\n", i);
+    assert(i == 3);
+
+    i = b + a;
+    printf("b + a = %d\n", i);
+    assert(i == 3);
+
+//    i = b + 3;
+}
+
+/**************************************/
+
+class A11
+{
+    int opIndex(int i) { return i; }
+    int opIndexAssign(int value, int i) { return value * 10 + i; }
+}
+
+void test11()
+{
+    int i;
+    A11 a = new A11();
+
+    i = a[5];
+    assert(i == 5);
+    i = (a[4] = 6);
+    printf("i = %d\n", i);
+    assert(i == 64);
+}
+
+/**************************************/
+
+class A12
+{
+    int opIndex(int i1, int i2) { return i1 * 10 + i2; }
+    int opIndexAssign(int value, int i1, int i2) { return value * 100 + i1 * 10 + i2; }
+}
+
+
+void test12()
+{
+   A12 a = new A12();
+   int i;
+
+   printf("%d\n", a[1, 2]);
+   assert(a[1, 2] == 12);
+
+   i = (a[3, 4] = 5);
+   printf("%d\n", i);
+   assert(i == 534);
+}
+
+/**************************************/
+
+class A13
+{
+ A13 opShl(int x)
+ {
+    printf("A::opShl(int %d)\n", x);
+    printf("%d",x);
+    return this;
+ }
+ A13 opShl(string x)
+ {
+    printf("A::opShl(char[])\n");
+    printf("%.*s", x.length, x.ptr);
+    return this;
+ }
+}
+
+class B13
+{
+ A13 opShl_r(A13 a)
+ {
+    printf("B::opShl_r(A)\n");
+    return a;
+ }
+}
+
+void test13()
+{
+    A13 a = new A13();
+    a << 4 << " " << 12 << "\n";
+
+    B13 b = new B13();
+    a << b;
+}
+
+
+/**************************************/
+
+class Foo14
+{   int a;
+
+    int opIn(int x)
+    {
+        return a + x;
+    }
+}
+
+void test14()
+{
+    auto f = new Foo14;
+    f.a = 3;
+    auto i = f in 7;
+    assert(i == 10);
+}
+
+/**************************************/
+
+// 3983
+
+struct Fug
+{
+    bool opEquals(ref const Fug y) const {
+        return false;
+    }
+}
+
+struct Fig
+{
+   Fug f;
+   bool opEquals(Tdummy=void)(ref const Fig y) const {
+      return false;
+   }
+
+   bool opEquals(T: int)(T y) const {
+      return false;
+   }
+}
+
+void test15()
+{
+  Fig fx, fy;
+  if (fx==2) {}
+}
+
+/**************************************/
+// 4953
+
+struct S4953a
+{
+    short _x;
+    bool opBinaryRight(string op)(short x) if (op == "in")
+    {
+        return x == _x;
+    }
+}
+void test4953a()
+{
+    S4953a s;
+    5 in s;
+}
+
+struct S4953b
+{
+    void opBinary(string op)(short x)
+    {}
+}
+void test4953b()
+{
+    S4953b s;
+    s + 5;
+}
+
+
+struct S4953c
+{
+    void funOpAssign(float[1u] data) { }
+    void opOpAssign(string op)(float[1u] data) if(op=="<<") { }
+}
+void test4953c()
+{
+    // dmd v2.054, v2.055
+    S4953c s;
+    float[1u] a = [1.0f]; // OK: Implicit cast from float[] compiles
+    s.funOpAssign([1.0f]); // OK: Implicit cast from float[] compiles
+    s <<= [1.0f]; // Issue: Implicit cast from float[] does not compile
+    s <<= cast(float[1u])[1.0f]; // OK: Explicit cast from float[] compiles
+}
+
+void f4953d1  (dstring d) { dstring e = d; }
+void f4953d2()(dstring d) { dstring e = d; }
+void f4953d3  ( byte[] b) { byte[] c = b; }
+void f4953d4()( byte[] b) { byte[] c = b; }
+void test4953d()
+{
+    f4953d1("abc");  // OK
+    f4953d2("abc");  // OK
+    f4953d3([1,2,3]); // OK
+    f4953d4([1,2,3]);
+    // Error: template test2.f() does not match any function template declaration
+    // Error: template test2.f() cannot deduce template function from argument types !()(int[])
+}
+
+/**************************************/
+// 4993
+
+// reduced from the bug report
+struct Bar4993
+{
+    void opIndexAssign(int value, size_t index) {}
+}
+@property auto bar4993()
+{
+    return Bar4993();
+}
+void test4993()
+{
+    bar4993[3] = 42;
+}
+
+/**************************************/
+// 8133
+
+void test8133()
+{
+    struct S
+    {
+        int opCall() { return 1; }
+    }
+    struct A
+    {
+        S s;
+        alias s this;
+    }
+    A f = A();
+    assert(f() == 1);
+}
+
+/**************************************/
+// 8522
+
+struct Point8522
+{
+    bool opEquals(R)(R rhs) { return true; }
+    bool opEquals(R)(R rhs) const { return true; }
+}
+
+void test8522()
+{
+    Point8522 mp;
+    const Point8522 cp;
+    assert(mp == mp);
+    assert(mp == cp);
+    assert(cp == mp);   // doesn't work
+    assert(cp == cp);   // doesn't work
+}
+
+/**************************************/
+// 12778
+
+struct Vec12778X
+{
+    Vec12778X opBinary(string op)(Vec12778X b) const
+    if (op == "+")
+    {
+        mixin("return Vec12778X(this.x " ~ op ~ " b.x, this.y " ~ op ~ " b.y);");
+    }
+    alias opBinaryRight = opBinary;
+
+    float x = 0, y = 0;
+}
+
+struct Vec12778Y
+{
+    Vec12778Y opAdd()(Vec12778Y b) const
+    {
+        enum op = "+";
+        mixin("return Vec12778Y(this.x " ~ op ~ " b.x, this.y " ~ op ~ " b.y);");
+    }
+    alias opAdd_r = opAdd;
+
+    float x = 0, y = 0;
+}
+
+void test12778()
+{
+    struct S
+    {
+        void test1()
+        {
+            Vec12778X vx = vx1 + vx2;   // ok
+            Vec12778Y vy = vy1 + vy2;   // ok
+        }
+
+        void test2() const
+        {
+            Vec12778X vx = vx1 + vx2;   // ok <- error
+            Vec12778Y vy = vy1 + vy2;   // ok <- error
+        }
+
+        Vec12778X vx1, vx2;
+        Vec12778Y vy1, vy2;
+    }
+}
+
+/**************************************/
+// 14343
+
+struct S14343a
+{
+    int i;
+    immutable(Object) o;
+
+    S14343a opUnary(string op)() { return this; }
+    void opAssign(S14343a other) {}
+}
+
+struct S14343b
+{
+    int i;
+    immutable(Object) o;
+
+    void opAddAssign(int j) { i += j; }
+    S14343b opPostInc() { ++i; return this; }
+    void opAssign(S14343b other) {}
+}
+
+void test14343()
+{
+    {
+        S14343a s, t;
+
+        t = s;  // OK
+        ++s;    // OK
+        s++;    // OK <- Error: cannot modify struct s S with immutable members
+    }
+    {
+        S14343b s;
+        ++s;
+        assert(s.i == 1);
+        s++;
+        assert(s.i == 2);
+    }
+}
+
+/**************************************/
+// 14344
+
+struct S14344
+{
+    S14344 opBinary(string op)(S14344 v)
+    {
+        static assert(0);
+    }
+    S14344 opAssign()(S14344 v)
+    {
+        static assert(0);
+    }
+}
+
+struct S14344Mix
+{
+    S14344 s;
+    alias s this;
+}
+
+class C14344
+{
+    S14344Mix height() { return S14344Mix(); }
+
+    void update()
+    {
+        S14344 height = this.height;
+    }
+}
+
+/**************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test4953a();
+    test4953b();
+    test4953c();
+    test4953d();
+    test4993();
+    test8133();
+    test8522();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/opover2.d b/gcc/testsuite/gdc.test/runnable/opover2.d
new file mode 100644
index 00000000000..78fa04c4b23
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/opover2.d
@@ -0,0 +1,2064 @@
+// PERMUTE_ARGS: -inline -O -property
+// REQUIRED_ARGS: -dip25
+
+// Test operator overloading
+
+extern (C) int printf(const(char*) fmt, ...);
+
+template Seq(T...){ alias T Seq; }
+
+bool thrown(E, T)(lazy T val)
+{
+    try { val(); return false; }
+    catch (E e) { return true; }
+}
+
+void stompStack() { int[256] sa = 0xdeadbeef; }
+
+/**************************************/
+
+class A
+{
+    string opUnary(string s)()
+    {
+        printf("A.opUnary!(%.*s)\n", s.length, s.ptr);
+        return s;
+    }
+}
+
+void test1()
+{
+    auto a = new A();
+
+    +a;
+    -a;
+    ~a;
+    *a;
+    ++a;
+    --a;
+
+    auto x = a++;
+    assert(x == a);
+    auto y = a--;
+    assert(y == a);
+}
+
+/**************************************/
+
+class A2
+{
+    T opCast(T)()
+    {
+        auto s = T.stringof;
+        printf("A.opCast!(%.*s)\n", s.length, s.ptr);
+        return T.init;
+    }
+}
+
+
+void test2()
+{
+    auto a = new A2();
+
+    auto x = cast(int)a;
+    assert(x == 0);
+
+    auto y = cast(char)a;
+    assert(y == char.init);
+}
+
+/**************************************/
+
+struct A3
+{
+    int opBinary(string s)(int i)
+    {
+        printf("A.opBinary!(%.*s)\n", s.length, s.ptr);
+        return 0;
+    }
+
+    int opBinaryRight(string s)(int i) if (s == "/" || s == "*")
+    {
+        printf("A.opBinaryRight!(%.*s)\n", s.length, s.ptr);
+        return 0;
+    }
+
+    T opCast(T)()
+    {
+        auto s = T.stringof;
+        printf("A.opCast!(%.*s)\n", s.length, s.ptr);
+        return T.init;
+    }
+}
+
+
+void test3()
+{
+    A3 a;
+
+    a + 3;
+    4 * a;
+    4 / a;
+    a & 5;
+}
+
+/**************************************/
+
+struct A4
+{
+    int opUnary(string s)()
+    {
+        printf("A.opUnary!(%.*s)\n", s.length, s.ptr);
+        return 0;
+    }
+
+    T opCast(T)()
+    {
+        auto s = T.stringof;
+        printf("A.opCast!(%.*s)\n", s.length, s.ptr);
+        return T.init;
+    }
+}
+
+
+void test4()
+{
+    A4 a;
+
+    if (a)
+        int x = 3;
+    if (!a)
+        int x = 3;
+    if (!!a)
+        int x = 3;
+}
+
+/**************************************/
+
+class A5
+{
+    override bool opEquals(Object o)
+    {
+        printf("A.opEquals!(%p)\n", o);
+        return 1;
+    }
+
+    int opUnary(string s)()
+    {
+        printf("A.opUnary!(%.*s)\n", s.length, s.ptr);
+        return 0;
+    }
+
+    T opCast(T)()
+    {
+        auto s = T.stringof;
+        printf("A.opCast!(%.*s)\n", s.length, s.ptr);
+        return T.init;
+    }
+}
+
+class B5 : A5
+{
+    override bool opEquals(Object o)
+    {
+        printf("B.opEquals!(%p)\n", o);
+        return 1;
+    }
+}
+
+
+void test5()
+{
+    A5 a = new A5();
+    A5 a2 = new A5();
+    B5 b = new B5();
+    A n = null;
+
+    if (a == a)
+        int x = 3;
+    if (a == a2)
+        int x = 3;
+    if (a == b)
+        int x = 3;
+    if (a == n)
+        int x = 3;
+    if (n == a)
+        int x = 3;
+    if (n == n)
+        int x = 3;
+}
+
+/**************************************/
+
+struct S6
+{
+    const bool opEquals(ref const S6 b)
+    {
+        printf("S.opEquals(S %p)\n", &b);
+        return true;
+    }
+
+    const bool opEquals(ref const T6 b)
+    {
+        printf("S.opEquals(T %p)\n", &b);
+        return true;
+    }
+}
+
+struct T6
+{
+    const bool opEquals(ref const T6 b)
+    {
+        printf("T.opEquals(T %p)\n", &b);
+        return true;
+    }
+/+
+    const bool opEquals(ref const S6 b)
+    {
+        printf("T.opEquals(S %p)\n", &b);
+        return true;
+    }
++/
+}
+
+
+void test6()
+{
+    S6 s1;
+    S6 s2;
+
+    if (s1 == s2)
+        int x = 3;
+
+    T6 t;
+
+    if (s1 == t)
+        int x = 3;
+
+    if (t == s2)
+        int x = 3;
+}
+
+/**************************************/
+
+struct S7
+{
+    const int opCmp(ref const S7 b)
+    {
+        printf("S.opCmp(S %p)\n", &b);
+        return -1;
+    }
+
+    const int opCmp(ref const T7 b)
+    {
+        printf("S.opCmp(T %p)\n", &b);
+        return -1;
+    }
+}
+
+struct T7
+{
+    const int opCmp(ref const T7 b)
+    {
+        printf("T.opCmp(T %p)\n", &b);
+        return -1;
+    }
+/+
+    const int opCmp(ref const S7 b)
+    {
+        printf("T.opCmp(S %p)\n", &b);
+        return -1;
+    }
++/
+}
+
+
+void test7()
+{
+    S7 s1;
+    S7 s2;
+
+    if (s1 < s2)
+        int x = 3;
+
+    T7 t;
+
+    if (s1 < t)
+        int x = 3;
+
+    if (t < s2)
+        int x = 3;
+}
+
+/**************************************/
+
+struct A8
+{
+    int opUnary(string s)()
+    {
+        printf("A.opUnary!(%.*s)\n", s.length, s.ptr);
+        return 0;
+    }
+
+    int opIndexUnary(string s, T)(T i)
+    {
+        printf("A.opIndexUnary!(%.*s)(%d)\n", s.length, s.ptr, i);
+        return 0;
+    }
+
+    int opIndexUnary(string s, T)(T i, T j)
+    {
+        printf("A.opIndexUnary!(%.*s)(%d, %d)\n", s.length, s.ptr, i, j);
+        return 0;
+    }
+
+    int opSliceUnary(string s)()
+    {
+        printf("A.opSliceUnary!(%.*s)()\n", s.length, s.ptr);
+        return 0;
+    }
+
+    int opSliceUnary(string s, T)(T i, T j)
+    {
+        printf("A.opSliceUnary!(%.*s)(%d, %d)\n", s.length, s.ptr, i, j);
+        return 0;
+    }
+}
+
+
+void test8()
+{
+    A8 a;
+
+    -a;
+    -a[3];
+    -a[3, 4];
+    -a[];
+    -a[5 .. 6];
+    --a[3];
+}
+
+/**************************************/
+
+struct A9
+{
+    int opOpAssign(string s)(int i)
+    {
+        printf("A.opOpAssign!(%.*s)\n", s.length, s.ptr);
+        return 0;
+    }
+
+    int opIndexOpAssign(string s, T)(int v, T i)
+    {
+        printf("A.opIndexOpAssign!(%.*s)(%d, %d)\n", s.length, s.ptr, v, i);
+        return 0;
+    }
+
+    int opIndexOpAssign(string s, T)(int v, T i, T j)
+    {
+        printf("A.opIndexOpAssign!(%.*s)(%d, %d, %d)\n", s.length, s.ptr, v, i, j);
+        return 0;
+    }
+
+    int opSliceOpAssign(string s)(int v)
+    {
+        printf("A.opSliceOpAssign!(%.*s)(%d)\n", s.length, s.ptr, v);
+        return 0;
+    }
+
+    int opSliceOpAssign(string s, T)(int v, T i, T j)
+    {
+        printf("A.opSliceOpAssign!(%.*s)(%d, %d, %d)\n", s.length, s.ptr, v, i, j);
+        return 0;
+    }
+}
+
+
+void test9()
+{
+    A9 a;
+
+    a += 8;
+    a -= 8;
+    a *= 8;
+    a /= 8;
+    a %= 8;
+    a &= 8;
+    a |= 8;
+    a ^= 8;
+    a <<= 8;
+    a >>= 8;
+    a >>>= 8;
+    a ~= 8;
+    a ^^= 8;
+
+    a[3] += 8;
+    a[3] -= 8;
+    a[3] *= 8;
+    a[3] /= 8;
+    a[3] %= 8;
+    a[3] &= 8;
+    a[3] |= 8;
+    a[3] ^= 8;
+    a[3] <<= 8;
+    a[3] >>= 8;
+    a[3] >>>= 8;
+    a[3] ~= 8;
+    a[3] ^^= 8;
+
+    a[3, 4] += 8;
+    a[] += 8;
+    a[5 .. 6] += 8;
+}
+
+/**************************************/
+
+struct BigInt
+{
+    int opEquals(T)(T n) const
+    {
+        return 1;
+    }
+
+    int opEquals(T:int)(T n) const
+    {
+        return 1;
+    }
+
+    int opEquals(T:const(BigInt))(T n) const
+    {
+        return 1;
+    }
+
+}
+
+int decimal(BigInt b, const BigInt c)
+{
+    while (b != c) {
+    }
+    return 1;
+}
+
+/**************************************/
+
+struct Foo10
+{
+    int opUnary(string op)() { return 1; }
+}
+
+void test10()
+{
+    Foo10 foo;
+    foo++;
+}
+
+/**************************************/
+
+struct S4913
+{
+    bool opCast(T : bool)() { return true; }
+}
+
+int bug4913()
+{
+    if (S4913 s = S4913()) { return 83; }
+    return 9;
+}
+
+static assert(bug4913() == 83);
+
+/**************************************/
+// 5551
+
+struct Foo11 {
+    Foo11 opUnary(string op:"++")() {
+        return this;
+    }
+    Foo11 opBinary(string op)(int y) {
+        return this;
+    }
+}
+
+void test11()
+{
+    auto f = Foo11();
+    f++;
+}
+
+/**************************************/
+// 4099
+
+struct X4099
+{
+    int x;
+    alias x this;
+
+    typeof(this) opUnary (string operator) ()
+    {
+        printf("operator called\n");
+        return this;
+    }
+}
+
+void test4099()
+{
+    X4099 x;
+    X4099 r1 = ++x; //operator called
+    X4099 r2 = x++; //BUG! (alias this used. returns int)
+}
+
+/**************************************/
+
+void test12()
+{
+    static int opeq;
+
+    // xopEquals OK
+    static struct S1a { const bool opEquals(    const typeof(this) rhs) { ++opeq; return false; } }
+    static struct S1b { const bool opEquals(ref const typeof(this) rhs) { ++opeq; return false; } }
+    static struct S1c { const bool opEquals(          typeof(this) rhs) { ++opeq; return false; } }
+
+    // xopEquals NG
+    static struct S2a {       bool opEquals(          typeof(this) rhs) { ++opeq; return false; } }
+
+    foreach (S; Seq!(S1a, S1b, S1c))
+    {
+        S s;
+        opeq = 0;
+        assert(s != s);                     // call opEquals directly
+        assert(!typeid(S).equals(&s, &s));  // -> xopEquals (-> __xopEquals) -> opEquals
+        assert(opeq == 2);
+    }
+
+    foreach (S; Seq!(S2a))
+    {
+        S s;
+        opeq = 0;
+        assert(s != s);
+        assert(thrown!Error(!typeid(S).equals(&s, &s)));
+            // Error("notImplemented") thrown
+        assert(opeq == 1);
+    }
+}
+
+/**************************************/
+
+void test13()
+{
+    static int opeq;
+
+    struct X
+    {
+        const bool opEquals(const X){ ++opeq; return false; }
+    }
+    struct S
+    {
+        X x;
+    }
+
+    S makeS(){ return S(); }
+
+    S s;
+    opeq = 0;
+    assert(s != s);
+    assert(makeS() != s);
+    assert(s != makeS());
+    assert(makeS() != makeS());
+    assert(opeq == 4);
+
+    // built-in opEquals == const bool opEquals(const S rhs);
+    assert(s != s);
+    assert(opeq == 5);
+
+    // xopEquals
+    assert(!typeid(S).equals(&s, &s));
+    assert(opeq == 6);
+}
+
+/**************************************/
+
+void test14()
+{
+    static int opeq;
+
+    struct S
+    {
+        const bool opEquals(T)(const T rhs) { ++opeq; return false; }
+    }
+
+    S makeS(){ return S(); }
+
+    S s;
+    opeq = 0;
+    assert(s != s);
+    assert(makeS() != s);
+    assert(s != makeS());
+    assert(makeS() != makeS());
+    assert(opeq == 4);
+
+    // xopEquals (-> __xxopEquals) -> template opEquals
+    assert(!typeid(S).equals(&s, &s));
+    assert(opeq == 5);
+}
+
+/**************************************/
+
+void test15()
+{
+    struct S
+    {
+        const bool opEquals(T)(const(T) rhs)
+        if (!is(T == S))
+        { return false; }
+
+        @disable const bool opEquals(T)(const(T) rhs)
+        if (is(T == S))
+        { return false; }
+    }
+
+    S makeS(){ return S(); }
+
+    S s;
+    static assert(!__traits(compiles, s != s));
+    static assert(!__traits(compiles, makeS() != s));
+    static assert(!__traits(compiles, s != makeS()));
+    static assert(!__traits(compiles, makeS() != makeS()));
+
+    // xopEquals (-> __xxopEquals) -> Error thrown
+    assert(thrown!Error(!typeid(S).equals(&s, &s)));
+}
+
+/**************************************/
+
+void test16()
+{
+    struct X
+    {
+        int n;
+        const bool opEquals(T)(T t)
+        {
+            return false;
+        }
+    }
+    struct S
+    {
+        X x;
+    }
+
+    S s1, s2;
+    assert(s1 != s2);
+        // field template opEquals should call
+}
+
+/**************************************/
+
+void test17()
+{
+    static int opeq = 0;
+
+    struct S
+    {
+        bool opEquals(ref S rhs) { ++opeq; return false; }
+    }
+    S[] sa1 = new S[3];
+    S[] sa2 = new S[3];
+    assert(sa1 != sa2);     // isn't used TypeInfo.equals
+    assert(opeq == 1);
+
+    const(S)[] csa = new const(S)[3];
+    static assert(!__traits(compiles, csa == sa1));
+    static assert(!__traits(compiles, sa1 == csa));
+    static assert(!__traits(compiles, csa == csa));
+}
+
+/**************************************/
+// 3789
+
+bool test3789()
+{
+    static struct Float
+    {
+        double x;
+    }
+    Float f;
+    assert(f.x != f.x); // NaN != NaN
+    assert(f != f);
+
+    static struct Array
+    {
+        int[] x;
+    }
+    Array a1 = Array([1,2,3].dup);
+    Array a2 = Array([1,2,3].dup);
+    if (!__ctfe)
+    {   // Currently doesn't work this in CTFE - may or may not a bug.
+        assert(a1.x !is a2.x);
+    }
+    assert(a1.x == a2.x);
+    assert(a1 == a2);
+
+    static struct AA
+    {
+        int[int] x;
+    }
+    AA aa1 = AA([1:1,2:2,3:3]);
+    AA aa2 = AA([1:1,2:2,3:3]);
+    if (!__ctfe)
+    {   // Currently doesn't work this in CTFE - may or may not a bug.
+        assert(aa1.x !is aa2.x);
+    }
+    if (!__ctfe)
+    {   // This is definitely a bug. Should work in CTFE.
+        assert(aa1.x == aa2.x);
+        assert(aa1 == aa2);
+    }
+
+    if (!__ctfe)
+    {   // Currently union operation is not supported in CTFE.
+        union U1
+        {
+            double x;
+        }
+        static struct UnionA
+        {
+            int[] a;
+            U1 u;
+        }
+        auto ua1 = UnionA([1,2,3]);
+        auto ua2 = UnionA([1,2,3]);
+        assert(ua1.u.x is ua2.u.x);
+        assert(ua1.u.x != ua2.u.x);
+        assert(ua1 == ua2);
+        ua1.u.x = 1.0;
+        ua2.u.x = 1.0;
+        assert(ua1.u.x is ua2.u.x);
+        assert(ua1.u.x == ua2.u.x);
+        assert(ua1 == ua2);
+        ua1.u.x = double.nan;
+        assert(ua1.u.x !is ua2.u.x);
+        assert(ua1.u.x !=  ua2.u.x);
+        assert(ua1 != ua2);
+
+        union U2
+        {
+            int[] a;
+        }
+        static struct UnionB
+        {
+            double x;
+            U2 u;
+        }
+        auto ub1 = UnionB(1.0);
+        auto ub2 = UnionB(1.0);
+        assert(ub1 == ub2);
+        ub1.u.a = [1,2,3].dup;
+        ub2.u.a = [1,2,3].dup;
+        assert(ub1.u.a !is ub2.u.a);
+        assert(ub1.u.a  == ub2.u.a);
+        assert(ub1 != ub2);
+        ub2.u.a = ub1.u.a;
+        assert(ub1.u.a is ub2.u.a);
+        assert(ub1.u.a == ub2.u.a);
+        assert(ub1 == ub2);
+    }
+
+    if (!__ctfe)
+    {   // This is definitely a bug. Should work in CTFE.
+        static struct Class
+        {
+            Object x;
+        }
+        static class X
+        {
+            override bool opEquals(Object o){ return true; }
+        }
+
+        Class c1a = Class(new Object());
+        Class c2a = Class(new Object());
+        assert(c1a.x !is c2a.x);
+        assert(c1a.x != c2a.x);
+        assert(c1a != c2a); // Pass, Object.opEquals works like bitwise compare
+
+        Class c1b = Class(new X());
+        Class c2b = Class(new X());
+        assert(c1b.x !is c2b.x);
+        assert(c1b.x == c2b.x);
+        assert(c1b == c2b); // Fails, should pass
+    }
+    return true;
+}
+static assert(test3789());
+
+/**************************************/
+// 10037
+
+struct S10037
+{
+    bool opEquals(ref const S10037) { assert(0); }
+}
+
+struct T10037
+{
+    S10037 s;
+    // Compiler should not generate 'opEquals' here implicitly:
+}
+
+struct Sub10037(TL...)
+{
+    TL data;
+    int value;
+    alias value this;
+}
+
+void test10037()
+{
+    S10037 s;
+    T10037 t;
+    static assert( __traits(hasMember, S10037, "opEquals"));
+    static assert(!__traits(hasMember, T10037, "opEquals"));
+    assert(thrown!Error(s == s));
+    assert(thrown!Error(t == t));
+
+    Sub10037!(S10037) lhs;
+    Sub10037!(S10037) rhs;
+    static assert(!__traits(hasMember, Sub10037!(S10037), "opEquals"));
+    assert(lhs == rhs);     // lowered to: lhs.value == rhs.value
+}
+
+/**************************************/
+// 5810
+
+struct Bug5810
+{
+    void opUnary(string op)() {}
+}
+
+struct Foo5810
+{
+    Bug5810 x;
+    void bar() { x++; }
+}
+
+/**************************************/
+// 6798
+
+struct Tuple6798(T...)
+{
+    T field;
+    alias field this;
+
+    bool opEquals(Tuple6798 rhs)
+    {
+        foreach (i, _; T)
+        {
+            if (this[i] != rhs[i])
+                return false;
+        }
+        return true;
+    }
+}
+auto tuple6798(T...)(T args)
+{
+    return Tuple6798!T(args);
+}
+
+int test6798a()
+{
+    //import std.typecons;
+    alias tuple6798 tuple;
+
+    static struct S1
+    {
+        auto opDollar(size_t dim)()
+        {
+            return 99;
+        }
+        auto opSlice(int dim)(int lwr, int upr)
+        {
+            return [dim, lwr, upr];
+        }
+
+        auto opIndex(A...)(A indices)
+        {
+            return tuple(" []", indices);
+        }
+        auto opIndexUnary(string op, A...)(A indices)
+        {
+            return tuple(op~"[]", indices);
+        }
+        auto opIndexAssign(A...)(string s, A indices)
+        {
+            return tuple("[] =", s, indices);
+        }
+        auto opIndexOpAssign(string op, A...)(string s, A indices)
+        {
+            return tuple("[]"~op~"=", s, indices);
+        }
+    }
+    S1 s1;
+    assert( s1[]       == tuple(" []"));
+    assert( s1[10]     == tuple(" []", 10));
+    assert( s1[10, 20] == tuple(" []", 10, 20));
+    assert( s1[10..20] == tuple(" []", [0, 10, 20]));
+    assert(+s1[]       == tuple("+[]"));
+    assert(-s1[10]     == tuple("-[]", 10));
+    assert(*s1[10, 20] == tuple("*[]", 10, 20));
+    assert(~s1[10..20] == tuple("~[]", [0, 10, 20]));
+    assert((s1[]       ="x") == tuple("[] =", "x"));
+    assert((s1[10]     ="x") == tuple("[] =", "x", 10));
+    assert((s1[10, 20] ="x") == tuple("[] =", "x", 10, 20));
+    assert((s1[10..20] ="x") == tuple("[] =", "x", [0, 10, 20]));
+    assert((s1[]      +="x") == tuple("[]+=", "x"));
+    assert((s1[10]    -="x") == tuple("[]-=", "x", 10));
+    assert((s1[10, 20]*="x") == tuple("[]*=", "x", 10, 20));
+    assert((s1[10..20]~="x") == tuple("[]~=", "x", [0, 10, 20]));
+    assert( s1[20..30, 10]           == tuple(" []", [0, 20, 30], 10));
+    assert( s1[10, 10..$, $-4, $..2] == tuple(" []", 10, [1,10,99], 99-4, [3,99,2]));
+    assert(+s1[20..30, 10]           == tuple("+[]", [0, 20, 30], 10));
+    assert(-s1[10, 10..$, $-4, $..2] == tuple("-[]", 10, [1,10,99], 99-4, [3,99,2]));
+    assert((s1[20..30, 10]           ="x") == tuple("[] =", "x", [0, 20, 30], 10));
+    assert((s1[10, 10..$, $-4, $..2] ="x") == tuple("[] =", "x", 10, [1,10,99], 99-4, [3,99,2]));
+    assert((s1[20..30, 10]          +="x") == tuple("[]+=", "x", [0, 20, 30], 10));
+    assert((s1[10, 10..$, $-4, $..2]-="x") == tuple("[]-=", "x", 10, [1,10,99], 99-4, [3,99,2]));
+
+    // opIndex exist, but opSlice for multi-dimensional doesn't.
+    static struct S2
+    {
+        auto opSlice(size_t dim)() { return [dim]; }
+        auto opSlice()(size_t lwr, size_t upr) { return [lwr, upr]; }
+
+        auto opIndex(A...)(A indices){ return [[indices]]; }
+    }
+    S2 s2;
+    assert(s2[] == [[]]);
+    assert(s2[1] == [[1]]);
+    assert(s2[1, 2] == [[1, 2]]);
+    assert(s2[1..2] == [1, 2]);
+    static assert(!__traits(compiles, s2[1, 2..3] ));
+    static assert(!__traits(compiles, s2[1..2, 2..3] ));
+
+    // opSlice for multi-dimensional exists, but opIndex for that doesn't.
+    static struct S3
+    {
+        auto opSlice(size_t dim)(size_t lwr, size_t upr) { return [lwr, upr]; }
+
+        auto opIndex(size_t n){ return [[n]]; }
+        auto opIndex(size_t n, size_t m){ return [[n, m]]; }
+    }
+    S3 s3;
+    static assert(!__traits(compiles, s3[] ));
+    assert(s3[1]    == [[1]]);
+    assert(s3[1, 2] == [[1, 2]]);
+    static assert(!__traits(compiles, s3[1..2] ));
+    static assert(!__traits(compiles, s3[1, 2..3] ));
+    static assert(!__traits(compiles, s3[1..2, 2..3] ));
+
+    return 0;
+}
+
+int test6798b()
+{
+    static struct Typedef(T)
+    {
+        private T Typedef_payload = T.init;
+
+        alias a = Typedef_payload;
+
+        auto ref opIndex(this X, D...)(auto ref D i)    { return a[i]; }
+        auto ref opSlice(this X      )()                { return a[]; }
+        auto ref opSlice(this X, B, E)(auto ref B b, auto ref E e)
+        {
+            assert(b == 0 && e == 3);
+            return a[b..e];
+        }
+
+        template opDispatch(string name)
+        {
+            // field or property function
+            @property auto ref opDispatch(this X)()                { return mixin("a."~name);        }
+            @property auto ref opDispatch(this X, V)(auto ref V v) { return mixin("a."~name~" = v"); }
+        }
+
+        static if (is(typeof(a) : E[], E))
+        {
+            auto opDollar() const { return a.length; }
+        }
+    }
+
+    Typedef!(int[]) dollar2;
+    dollar2.length = 3;
+    assert(dollar2.Typedef_payload.length == 3);
+    assert(dollar2[0 .. $] is dollar2[0 .. 3]);
+
+    return 0;
+}
+
+int test6798c()
+{
+    alias T = Tuple6798!(int, int);
+    auto n = T[].init;
+    static assert(is(typeof(n[0]) == Tuple6798!(int, int)));
+
+    return 0;
+}
+
+void test6798()
+{
+    static assert(test6798a() == 0);    // CTFE check
+    test6798a();
+    static assert(test6798b() == 0);
+    test6798b();
+    static assert(test6798c() == 0);
+    test6798c();
+}
+
+/**************************************/
+// 12382
+
+struct S12382
+{
+    size_t opDollar() { return 0; }
+    size_t opIndex(size_t) { return 0; }
+}
+
+S12382 func12382() { return S12382(); }
+
+static assert(S12382.init[$] == 0);
+static assert(func12382()[$] == 0);
+enum e12382a = S12382.init[$];
+enum e12382b = func12382()[$];
+static v12382a = S12382.init[$];
+static v12382b = func12382()[$];
+
+void test12382()
+{
+    static assert(S12382.init[$] == 0);
+    static assert(func12382()[$] == 0);
+    enum e12382a = S12382.init[$];
+    enum e12382b = func12382()[$];
+    static v12382a = S12382.init[$];
+    static v12382b = func12382()[$];
+}
+
+/**************************************/
+// 12904
+
+struct S12904
+{
+    void opIndexAssign(U, A...)(U value, A args)
+    {
+        static assert(0);
+    }
+    void opSliceAssign(int n)
+    {
+        assert(n == 10);
+    }
+
+    size_t opDollar(size_t dim)()
+    {
+        return 7;
+    }
+
+    int opSlice(size_t dim)(size_t, size_t to)
+    {
+        assert(to == 7);
+        return 1;
+    }
+
+    int opIndex(int i1, int i2)
+    {
+        assert(i1 == 1 && i2 == 1);
+        return 10;
+    }
+}
+
+void test12904()
+{
+    S12904 s;
+    s[] = s[0..$, 1];
+    s[] = s[0..$, 0..$];
+}
+
+/**************************************/
+// 7641
+
+mixin template Proxy7641(alias a)
+{
+    auto ref opBinaryRight(string op, B)(auto ref B b)
+    {
+        return mixin("b "~op~" a");
+    }
+}
+struct Typedef7641(T)
+{
+    private T Typedef_payload;
+
+    this(T init)
+    {
+        Typedef_payload = init;
+    }
+
+    mixin Proxy7641!Typedef_payload;
+}
+
+void test7641()
+{
+    class C {}
+    C c1 = new C();
+    auto a = Typedef7641!C(c1);
+    static assert(!__traits(compiles, { C c2 = a; }));
+}
+
+/**************************************/
+// 8434
+
+void test8434()
+{
+    static class Vector2D(T)
+    {
+        T x, y;
+
+        this(T x, T y) {
+            this.x = x;
+            this.y = y;
+        }
+
+        U opCast(U)() const { assert(0); }
+    }
+
+    alias Vector2D!(short) Vector2s;
+    alias Vector2D!(float) Vector2f;
+
+    Vector2s vs1 = new Vector2s(42, 23);
+    Vector2s vs2 = new Vector2s(42, 23);
+
+    assert(vs1 != vs2);
+}
+
+/**************************************/
+
+void test18()
+{
+    // one dimensional indexing
+    static struct IndexExp
+    {
+        int[] opIndex(int a)
+        {
+            return [a];
+        }
+
+        int[] opIndexUnary(string op)(int a)
+        {
+            return [a];
+        }
+
+        int[] opIndexAssign(int val, int a)
+        {
+            return [val, a];
+        }
+
+        int[] opIndexOpAssign(string op)(int val, int a)
+        {
+            return [val, a];
+        }
+
+        int opDollar()
+        {
+            return 8;
+        }
+    }
+
+    IndexExp index;
+    // opIndex
+    assert(index[8]     == [8]);
+    assert(index[$]     == [8]);
+    assert(index[$-1]   == [7]);
+    assert(index[$-$/2] == [4]);
+    // opIndexUnary
+    assert(-index[8]     == [8]);
+    assert(-index[$]     == [8]);
+    assert(-index[$-1]   == [7]);
+    assert(-index[$-$/2] == [4]);
+    // opIndexAssign
+    assert((index[8]     = 2) == [2, 8]);
+    assert((index[$]     = 2) == [2, 8]);
+    assert((index[$-1]   = 2) == [2, 7]);
+    assert((index[$-$/2] = 2) == [2, 4]);
+    // opIndexOpAssign
+    assert((index[8]     += 2) == [2, 8]);
+    assert((index[$]     += 2) == [2, 8]);
+    assert((index[$-1]   += 2) == [2, 7]);
+    assert((index[$-$/2] += 2) == [2, 4]);
+
+    // opDollar is only one-dimensional
+    static assert(!is(typeof(index[$, $])));
+    static assert(!is(typeof(-index[$, $])));
+    static assert(!is(typeof(index[$, $] = 2)));
+    static assert(!is(typeof(index[$, $] += 2)));
+
+    // multi dimensional indexing
+    static struct ArrayExp
+    {
+        int[] opIndex(int a, int b)
+        {
+            return [a, b];
+        }
+
+        int[] opIndexUnary(string op)(int a, int b)
+        {
+            return [a, b];
+        }
+
+        int[] opIndexAssign(int val, int a, int b)
+        {
+            return [val, a, b];
+        }
+
+        int[] opIndexOpAssign(string op)(int val, int a, int b)
+        {
+            return [val, a, b];
+        }
+
+        int opDollar(int dim)()
+        {
+            return dim;
+        }
+    }
+
+    ArrayExp array;
+    // opIndex
+    assert(array[8, 8]     == [8, 8]);
+    assert(array[$, $]     == [0, 1]);
+    assert(array[$, $-1]   == [0, 0]);
+    assert(array[2, $-$/2] == [2, 1]);
+    // opIndexUnary
+    assert(-array[8, 8]     == [8, 8]);
+    assert(-array[$, $]     == [0, 1]);
+    assert(-array[$, $-1]   == [0, 0]);
+    assert(-array[2, $-$/2] == [2, 1]);
+    // opIndexAssign
+    assert((array[8, 8]      = 2) == [2, 8, 8]);
+    assert((array[$, $]      = 2) == [2, 0, 1]);
+    assert((array[$, $-1]    = 2) == [2, 0, 0]);
+    assert((array[2, $-$/2]  = 2) == [2, 2, 1]);
+    // opIndexOpAssign
+    assert((array[8, 8]      += 2) == [2, 8, 8]);
+    assert((array[$, $]      += 2) == [2, 0, 1]);
+    assert((array[$, $-1]    += 2) == [2, 0, 0]);
+    assert((array[2, $-$/2]  += 2) == [2, 2, 1]);
+
+    // one dimensional slicing
+    static struct SliceExp
+    {
+        int[] opSlice(int a, int b)
+        {
+            return [a, b];
+        }
+
+        int[] opSliceUnary(string op)(int a, int b)
+        {
+            return [a, b];
+        }
+
+        int[] opSliceAssign(int val, int a, int b)
+        {
+            return [val, a, b];
+        }
+
+        int[] opSliceOpAssign(string op)(int val, int a, int b)
+        {
+            return [val, a, b];
+        }
+
+        int opDollar()
+        {
+            return 8;
+        }
+    }
+
+    SliceExp slice;
+    // opSlice
+    assert(slice[0 .. 8]     == [0, 8]);
+    assert(slice[0 .. $]     == [0, 8]);
+    assert(slice[0 .. $-1]   == [0, 7]);
+    assert(slice[$-3 .. $-1] == [5, 7]);
+    // opSliceUnary
+    assert(-slice[0 .. 8]     == [0, 8]);
+    assert(-slice[0 .. $]     == [0, 8]);
+    assert(-slice[0 .. $-1]   == [0, 7]);
+    assert(-slice[$-3 .. $-1] == [5, 7]);
+    // opSliceAssign
+    assert((slice[0 .. 8]     = 2) == [2, 0, 8]);
+    assert((slice[0 .. $]     = 2) == [2, 0, 8]);
+    assert((slice[0 .. $-1]   = 2) == [2, 0, 7]);
+    assert((slice[$-3 .. $-1] = 2) == [2, 5, 7]);
+    // opSliceOpAssign
+    assert((slice[0 .. 8]     += 2) == [2, 0, 8]);
+    assert((slice[0 .. $]     += 2) == [2, 0, 8]);
+    assert((slice[0 .. $-1]   += 2) == [2, 0, 7]);
+    assert((slice[$-3 .. $-1] += 2) == [2, 5, 7]);
+
+    // test different kinds of opDollar
+    auto dollar(string opDollar)()
+    {
+        static struct Dollar
+        {
+            size_t opIndex(size_t a) { return a; }
+            mixin(opDollar);
+        }
+        Dollar d;
+        return d[$];
+    }
+    assert(dollar!q{@property size_t opDollar() { return 8; }}() == 8);
+    assert(dollar!q{template opDollar(size_t dim) { enum opDollar = dim; }}() == 0);
+    assert(dollar!q{static const size_t opDollar = 8;}() == 8);
+    assert(dollar!q{enum opDollar = 8;}() == 8);
+    assert(dollar!q{size_t length() { return 8; } alias length opDollar;}() == 8);
+}
+
+/**************************************/
+
+void test19()
+{
+    static struct Foo
+    {
+        int[] opSlice(int a, int b)
+        {
+            return [a, b];
+        }
+
+        int opDollar(int dim)()
+        {
+            return dim;
+        }
+    }
+
+    Foo foo;
+    assert(foo[0 .. $] == [0, 0]);
+}
+
+/**************************************/
+// 9453
+
+struct Foo9453
+{
+    static int ctor = 0;
+
+    this(string bar) { ++ctor; }
+
+    void opIndex(size_t i) const {}
+    void opSlice(size_t s, size_t e) const {}
+
+    size_t opDollar(int dim)() const if (dim == 0) { return 1; }
+}
+
+void test9453()
+{
+    assert(Foo9453.ctor == 0);  Foo9453("bar")[$-1];
+    assert(Foo9453.ctor == 1);  Foo9453("bar")[0..$];
+    assert(Foo9453.ctor == 2);
+}
+
+/**************************************/
+// 9496
+
+struct S9496
+{
+    static S9496* ptr;
+
+    size_t opDollar()
+    {
+        assert(ptr is &this);
+        return 10;
+    }
+    void opSlice(size_t , size_t)
+    {
+        assert(ptr is &this);
+    }
+    void getSlice()
+    {
+        assert(ptr is &this);
+        this[1 .. opDollar()];
+        this[1 .. $];
+    }
+}
+
+void test9496()
+{
+    S9496 s;
+    S9496.ptr = &s;
+    s.getSlice();
+    s[1 .. $];
+}
+
+/**************************************/
+// 9689
+
+struct B9689(T)
+{
+    T val;
+    @disable this(this);
+
+    bool opEquals(this X, B)(auto ref B b)
+    {
+        //pragma(msg, "+", X, ", B = ", B, ", ref = ", __traits(isRef, b));
+        return this.val == b.val;
+        //pragma(msg, "-", X, ", B = ", B, ", ref = ", __traits(isRef, b));
+    }
+}
+
+struct S9689
+{
+    B9689!int num;
+}
+
+void test9689()
+{
+    B9689!S9689 b;
+}
+
+/**************************************/
+// 9694
+
+struct S9694
+{
+    bool opEquals(ref S9694 rhs)
+    {
+        assert(0);
+    }
+}
+struct T9694
+{
+    S9694 s;
+}
+void test9694()
+{
+    T9694 t;
+    assert(thrown!Error(typeid(T9694).equals(&t, &t)));
+}
+
+/**************************************/
+// 10064
+
+void test10064()
+{
+    static struct S
+    {
+        int x = 3;
+
+        @disable this();
+
+        this(int)
+        { x = 7; }
+
+        int opSlice(size_t, size_t)
+        { return 0; }
+
+        @property size_t opDollar()
+        {
+            assert(x == 7 || x == 3); // fails
+            assert(x == 7);
+            return 0;
+        }
+    }
+    auto x = S(0)[0 .. $];
+}
+
+/**************************************/
+// 12585
+
+void test12585()
+{
+    struct Bar
+    {
+        int opIndex(size_t index)
+        {
+            return 0;
+        }
+    }
+
+    struct Foo
+    {
+        Bar opIndex(size_t index)
+        {
+            throw new Exception("Fail");
+        }
+    }
+
+    Foo foo()
+    {
+        return Foo();
+    }
+
+    void catchStuff(E)(lazy E expression)
+    {
+        try
+            expression();
+        catch (Exception e) {}
+    }
+
+    catchStuff(foo()[0][0]);          // OK <- NG
+    catchStuff(foo().opIndex(0)[0]);  // OK
+    catchStuff(foo()[0].opIndex(0));  // OK
+    Foo f; catchStuff(f[0][0]);       // OK
+}
+
+/**************************************/
+// 10394
+
+void test10394()
+{
+    alias Seq!(int, int) Pair;
+    Pair pair;
+
+    struct S1
+    {
+        int opBinary(string op)(Pair) { return 1;  }
+        bool opEquals(Pair) { return true; }
+        int opOpAssign(string op)(Pair) { return 1; }
+    }
+    S1 s1;
+    assert((s1 + pair) == 1);
+    assert((s1 == pair) == true);
+    assert((s1 *= pair) == 1);
+
+    struct S2
+    {
+        int opBinaryRight(string op)(Pair lhs) { return 1;  }
+        int opCmp(Pair) { return -1; }
+    }
+    S2 s2;
+    assert((pair in s2) == 1);
+    assert(s2 < pair);
+}
+
+/**************************************/
+// 10597
+
+struct R10597
+{
+    void opIndex(int) {}
+    void opSlice(int, int) {}
+    int opDollar();
+}
+R10597 r;
+
+struct S10597
+{
+    static assert(is(typeof(r[0]))); //ok
+    static assert(is(typeof(r[$]))); //fails
+
+    static assert(is(typeof(r[0..0]))); //ok
+    static assert(is(typeof(r[$..$]))); //fails
+
+    void foo()
+    {
+        static assert(is(typeof(r[0]))); //ok
+        static assert(is(typeof(r[$]))); //ok
+
+        static assert(is(typeof(r[0..0]))); //ok
+        static assert(is(typeof(r[$..$]))); //ok
+    }
+}
+
+static assert(is(typeof(r[0]))); //ok
+static assert(is(typeof(r[$]))); //fails
+
+static assert(is(typeof(r[0..0]))); //ok
+static assert(is(typeof(r[$..$]))); //fails
+
+void test10597()
+{
+    static assert(is(typeof(r[0]))); //ok
+    static assert(is(typeof(r[$]))); //ok
+
+    static assert(is(typeof(r[0..0]))); //ok
+    static assert(is(typeof(r[$..$]))); //ok
+}
+
+/**************************************/
+// 10567
+
+// doesn't require thunk
+struct S10567x1n { int value; int opCmp(ref const S10567x1n rhs) const { return 0; } }
+
+// requires thunk
+struct S10567y1n { int value; int opCmp(const S10567y1n rhs) const { return 0; } }
+struct S10567y1t { int value; int opCmp(S)(const S rhs) const { return 0; } }
+
+// doesn't support const comparison
+struct S10567z1n { int value; int opCmp(const S10567z1n rhs) { return 0; } }
+struct S10567z1t { int value; int opCmp(S)(const S rhs) { return 0; } }
+
+/+
+struct S10567x2n { S10567x1n s; this(int n) { s = typeof(s)(n); } alias s this; }
+
+struct S10567y2n { S10567y1n s; this(int n) { s = typeof(s)(n); } alias s this; }
+struct S10567y2t { S10567y1t s; this(int n) { s = typeof(s)(n); } alias s this; }
+
+struct S10567z2n { S10567z1n s; this(int n) { s = typeof(s)(n); } alias s this; }
+struct S10567z2t { S10567z1t s; this(int n) { s = typeof(s)(n); } alias s this; }
+
+struct S10567d1
+{
+    int value;
+    int opDispatch(string name, S)(const S rhs) const if (name == "opCmp")
+    { assert(0); }
+}
+struct S10567d2
+{
+    int value;
+    template opDispatch(string name) if (name == "opCmp")
+    {
+        int opDispatch(const S rhs) const
+        { assert(0); }
+    }
+}
+
+// recursive alias this + opCmp searching
+struct S10567r1
+{
+    static S10567r2 t;
+    ref S10567r2 payload() { return t; }
+    alias payload this;
+
+    int opCmp(const S10567r1 s) const { return 0; }
+}
+struct S10567r2
+{
+    static S10567r1 s;
+    ref S10567r1 payload() { return s; }
+    alias payload this;
+}
++/
+
+void test10567()
+{
+    foreach (S; Seq!(S10567x1n/+, S10567x2n+/))
+    {
+        S sx = S(1);
+        S sy = S(2);
+        assert(!(sx < sy) && !(sx > sy));
+        assert(sx.opCmp(sy) == 0);
+
+        assert(typeid(S).compare(&sx, &sy) == 0);
+        static if (is(S == S10567x1n))
+            assert(cast(void*)typeid(S).xopCmp == cast(void*)&S.opCmp, S.stringof);
+    }
+
+    foreach (S; Seq!(S10567y1n, S10567y1t/+, S10567y2n, S10567y2t+/))
+    {
+        S sx = S(1);
+        S sy = S(2);
+        assert(!(sx < sy) && !(sx > sy));
+        assert(sx.opCmp(sy) == 0);
+
+        assert(typeid(S).compare(&sx, &sy) == 0);
+    }
+
+    foreach (S; Seq!(S10567z1n, S10567z1t/+, S10567z2n, S10567z2t+/))
+    {
+        S sx = S(1);
+        S sy = S(2);
+        assert(!(sx < sy) && !(sx > sy));
+        assert(sx.opCmp(sy) == 0);
+
+        try
+        {
+            auto x = typeid(S).compare(&sx, &sy);
+            assert(0);
+        }
+        catch (Error e) { assert(e.msg[$-15 .. $] == "not implemented"); }
+    }
+/+
+    foreach (S; Seq!(S10567d1, S10567d2))
+    {
+        int[S] aa;
+        aa[S(1)] = 10;  aa[S(1)] = 1;
+        aa[S(2)] = 20;  aa[S(2)] = 2;
+        assert(aa.length == 2);
+        foreach (k, v; aa)
+            assert(k.value == v);
+
+        S sx = S(1);
+        S sy = S(2);
+
+        // Don't invoke opDispatch!"opCmp"
+        assert(typeid(S).compare(&sx, &sy) != 0);
+    }
++/
+}
+
+/**************************************/
+// 11062
+
+struct S11062ia
+{
+    struct S1
+    {
+        void opIndexAssign(int val, int key) {}
+    }
+    struct S2
+    {
+        S1 headers;
+    }
+
+    private S2 m_obj;
+    @property S2 get() { return m_obj; }
+    alias get this;
+}
+
+struct S11062sa
+{
+    struct S1
+    {
+        void opSliceAssign(int val, int lwr, int upr) {}
+    }
+    struct S2
+    {
+        S1 headers;
+    }
+
+    private S2 m_obj;
+    @property S2 get() { return m_obj; }
+    alias get this;
+}
+
+void test11062()
+{
+    auto sia = S11062ia();
+    sia.headers[1] = 1;     // bug
+
+    auto ssa = S11062sa();
+    ssa.headers[1..2] = 1;  // bug
+}
+
+/**************************************/
+// 11311
+
+void test11311()
+{
+    static int ctor, cpctor, dtor;
+
+    static struct S
+    {
+        this(int)  { ++ctor; }
+        this(this) { ++cpctor; }
+        ~this()    { ++dtor; }
+    }
+    static struct Arr
+    {
+        S data;
+        ref S opIndex(int) return { return data; }
+        ref S opSlice(int, int) return { return data; }
+    }
+
+    {
+        Arr a = Arr(S(1));
+        assert(ctor == 1);
+        assert(cpctor == 0);
+        assert(dtor == 0);
+
+        auto getA1() { return a; }
+      //getA1().opIndex(1);  // OK
+        getA1()[1];          // NG
+
+        assert(ctor == 1);
+        assert(cpctor == 1);  // getA() returns a copy of a
+        assert(dtor == 1);    // temporary returned by getA() should be destroyed
+    }
+    assert(dtor == 2);
+    assert(ctor + cpctor == dtor);
+
+    ctor = cpctor = dtor = 0;
+
+    {
+        Arr a = Arr(S(1));
+        assert(ctor == 1);
+        assert(cpctor == 0);
+        assert(dtor == 0);
+
+        auto getA2() { return a; }
+      //getA2().opSlice(1, 2);  // OK
+        getA2()[1..2];          // NG
+
+        assert(ctor == 1);
+        assert(cpctor == 1);  // getA() returns a copy of a
+        assert(dtor == 1);    // temporary returned by getA() should be destroyed
+    }
+    assert(dtor == 2);
+    assert(ctor + cpctor == dtor);
+}
+
+/**************************************/
+// 12193
+
+void test12193()
+{
+    struct Foo
+    {
+        bool bar;
+        alias bar this;
+        void opOpAssign(string op)(size_t x)
+        {
+            bar = false;
+        }
+    }
+
+    Foo foo;
+    foo <<= 1;
+}
+
+/**************************************/
+// 14057
+
+struct W14057
+{
+    int[] subType;
+    alias subType this;
+
+    W14057 opSlice(size_t, size_t)
+    {
+        return this;
+    }
+}
+
+void test14057()
+{
+    auto w = W14057();
+    W14057 w2 = w[0 .. 1337];
+}
+
+/**************************************/
+
+struct Tuple20(T...) { T field; alias field this; }
+
+void test20a()
+{
+    // ae1save in in AssignExp::semantic
+    int a, b;
+
+    struct A1
+    {
+        void opIndexAssign(int v, Tuple20!(int, int) ) { a = v; }
+        Tuple20!(int, int) opSlice(size_t dim)(int, int) { return typeof(return).init; }
+    }
+    struct A2
+    {
+        A1 a1;
+        alias a1 this;
+        int opIndexAssign(int) { return b; }
+    }
+
+    stompStack();
+    A2 foo() { return A2(); }
+    foo()[1..2] = 1;
+    // ref A1 __tmp = foo().a1; __tmp.opIndexAssign(1, __tmp.opSlice!0(1, 2));
+    assert(a == 1);     // should work
+    assert(b == 0);
+}
+
+void test20b()
+{
+    // ae1save in UnaExp::op_overload()
+    int a, b;
+
+    struct A1
+    {
+        void opIndexUnary(string op)(Tuple20!(int, int) ) { a = 1; }
+        Tuple20!(int, int) opSlice(size_t dim)(int, int) { return typeof(return).init; }
+        void dummy() {} // nessary to make A1 nested struct
+    }
+    struct A2
+    {
+        A1 a1;
+        alias a1 this;
+        int opIndexUnary(string op)(int) { return 0; }
+    }
+
+    stompStack();
+    A2 foo() { return A2(); }
+    +foo()[1..2];
+    // ref A1 __tmp = foo().a1; __tmp.opIndexUnary!"+"(__tmp.opSlice!0(1, 2));
+    assert(a == 1);     // should pass
+    assert(b == 0);
+}
+
+void test20c()
+{
+    // ae1save in ArrayExp::op_overload()
+    int a, b;
+
+    struct A1
+    {
+        void opIndex(Tuple20!(int, int) ) { a = 1; }
+        Tuple20!(int, int) opSlice(size_t dim)(int, int) { return typeof(return).init; }
+    }
+    struct A2
+    {
+        A1 a1;
+        alias a1 this;
+        int opIndex(int) { return 0; }
+    }
+
+    stompStack();
+    A2 foo() { return A2(); }
+    foo()[1..2];
+    // ref A1 __tmp = foo().a1; __tmp.opIndex(__tmp.opSlice!0(1, 2));
+    assert(a == 1);     // should pass
+    assert(b == 0);
+}
+
+void test20d()
+{
+    // ae1save in BinAssignExp::op_overload()
+    int a, b;
+
+    struct A1
+    {
+        void opIndexOpAssign(string op)(int v, Tuple20!(int, int) ) { a = v; }
+        Tuple20!(int, int) opSlice(size_t dim)(int, int) { return typeof(return).init; }
+        void dummy() {} // nessary to make A1 nested struct
+    }
+    struct A2
+    {
+        A1 a1;
+        alias a1 this;
+        ref int opIndexOpAssign(alias op)(int) { return b; }
+    }
+
+    stompStack();
+    A2 foo() { return A2(); }
+    foo()[1..2] += 1;
+    // ref A1 __tmp = foo().a1; __tmp.opIndexOpAssign!"+"(1, __tmp.opSlice!0(1, 2));
+    assert(a == 1);     // should pass
+    assert(b == 0);
+}
+
+/**************************************/
+// 14624
+
+void test14624()
+{
+    struct A1
+    {
+        int x;
+        ref int opIndex() return { return x; }
+        ref int opSlice() { assert(0); }
+    }
+    {
+        A1 a = A1(1);
+        auto x = a[];       // a.opIndex()
+        assert(x == a.x);
+        auto y = -a[];      // -a.opIndex()        <-- not found: a.opIndexUnary!"-"
+        assert(y == -a.x);
+        a[] = 1;            // a.opIndex() = 1;    <-- not found: a.opIndexAssign(int)
+        assert(a.x == 1);
+        a[] += 1;           // a.opIndex() += 1;   <-- not found: a.opIndexOpAssign!"+"(int)
+        assert(a.x == 2);
+    }
+
+    struct A2
+    {
+        int x;
+        ref int opIndex() return               { x = 10; return x; }
+        ref int opSlice() { assert(0); }
+        ref int opSliceUnary(alias op)()       { x = 11; return x; }
+        ref int opSliceAssign(int) return      { x = 12; return x; }
+        ref int opSliceOpAssign(alias op)(int) { x = 13; return x; }
+    }
+    {
+        A2 a = A2(1);
+        auto x = a[];       // a.opIndex()
+        assert(a.x == 10);
+        auto y = -a[];      // a.opSliceUnary!"-"()     is preferred than: -a.opIndex()
+        assert(a.x == 11);
+        a[] = 1;            // a.opSliceAssign(1)       is preferred than: a.opIndex() = 1;
+        assert(a.x == 12);
+        a[] += 1;           // a.opSliceOpAssign!"+"(1) is preferred than: a.opIndex() += 1;
+        assert(a.x == 13);
+    }
+}
+
+/**************************************/
+// 14625
+
+void test14625()
+{
+    struct R
+    {
+        @property bool empty() { return true; }
+        @property int front() { return 0; }
+        void popFront() {}
+    }
+
+    struct C1
+    {
+        R opIndex() { return R(); }
+        R opSlice() { assert(0); }
+    }
+    C1 c1;
+    foreach (e; c1) {}      // OK <- asserts in opSlice()
+    foreach (e; c1[]) {}    // OK, opIndex()
+
+    struct C2
+    {
+        R opIndex() { return R(); }
+    }
+    C2 c2;
+    foreach (e; c2) {}      // OK <- rejected
+    foreach (e; c2[]) {}    // OK, opIndex()
+}
+
+/**************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test4099();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test3789();
+    test10037();
+    test6798();
+    test12904();
+    test7641();
+    test8434();
+    test18();
+    test19();
+    test9453();
+    test9496();
+    test9689();
+    test9694();
+    test10064();
+    test12585();
+    test10394();
+    test10567();
+    test11062();
+    test11311();
+    test14057();
+    test20a();
+    test20b();
+    test20c();
+    test20d();
+    test14624();
+    test14625();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/opover3.d b/gcc/testsuite/gdc.test/runnable/opover3.d
new file mode 100644
index 00000000000..c6de5d757e2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/opover3.d
@@ -0,0 +1,184 @@
+
+void test1()
+{
+    static struct Foo1
+    {
+    }
+
+    Foo1 foo1;
+    Foo1 foo1_2 = Foo1();       // literal syntax
+
+    static assert(!__traits(compiles, foo1()));
+}
+
+/**************************************/
+
+void test2()
+{
+    static struct Foo2
+    {
+        this(int n){}
+    }
+
+    Foo2 foo2;
+    Foo2 foo2_2 = Foo2(1);      // user ctor call
+    Foo2 foo2_3 = Foo2();       // literal syntax
+
+    static assert(!__traits(compiles, foo2(1)));
+    static assert(!__traits(compiles, foo2()));
+}
+
+/**************************************/
+
+void test2a()
+{
+    static struct Foo2a // alternation of Foo2
+    {
+        static Foo2a opCall(int n){ Foo2a foo2a; return foo2a; }
+    }
+
+    Foo2a foo2a;
+    Foo2a foo2a_3 = Foo2a(1);                       // static opCall
+    static assert(!__traits(compiles, Foo2a()));    // static opCall hides literal syntax.
+
+    foo2a(1);                                       // static opCall from instance
+    static assert(!__traits(compiles, foo2a()));
+}
+
+/**************************************/
+
+void test2c()
+{
+    static struct Foo2c // conflict version
+    {
+        this(int n){}
+        static Foo2c opCall(int n, int m){ Foo2c foo2c; return foo2c; }
+    }
+
+    Foo2c foo2c;
+    Foo2c foo2c_2 = Foo2c(1);                       // user ctor call
+    static assert(!__traits(compiles, Foo2c(1,2))); // user ctor hides static opCall.
+    Foo2c foo2c_3 = Foo2c();                        // literal syntax
+
+    static assert(!__traits(compiles, foo2c(1)));
+    foo2c(1,2);                                     // static opCall from instance
+    static assert(!__traits(compiles, foo2c()));
+}
+
+/**************************************/
+
+void test3()
+{
+    static struct Foo3
+    {
+        this(int n){}
+        int opCall(int n){ return 0; }
+    }
+
+    Foo3 foo3;
+    Foo3 foo3_2 = Foo3();                           // literal syntax (default construction)
+    Foo3 foo3_3 = Foo3(1);                          // user ctor call
+
+    assert(foo3(1) == 0);                           // instance opCall
+    static assert(!__traits(compiles, foo3()));
+}
+
+/**************************************/
+
+void test3c()
+{
+    static struct Foo3c
+    {
+        this(int n){}
+        static Foo3c opCall(int n, int m){ Foo3c foo3c; return foo3c; }
+        int opCall(int n){ return 0; }
+    }
+
+    Foo3c foo3c;
+    Foo3c foo3c_2 = Foo3c();                        // literal syntax (default construction)
+    Foo3c foo3c_3 = Foo3c(1);                       // user ctor call
+    static assert(!__traits(compiles, Foo3c(1,2))); // user ctor hides static opCall
+
+    assert(foo3c(1,2) == Foo3c.init);               // static opCall from instance
+    assert(foo3c(1) == 0);                          // instance opCall
+    static assert(!__traits(compiles, foo3c()));
+}
+
+/**************************************/
+
+void test4()
+{
+    static struct Foo4
+    {
+        static Foo4 opCall(int n, int m){ Foo4 foo4; return foo4; }
+        int opCall(int n){ return 0; }
+    }
+
+    Foo4 foo4;
+    Foo4 foo4_4 = Foo4(1,2);                        // static opCall
+    static assert(!__traits(compiles, Foo4(1)));
+    static assert(!__traits(compiles, Foo4()));     // static opCall without constructor hides literal syntax
+
+    assert(foo4(1,2) == Foo4.init);                 // static opCall from instance
+    assert(foo4(1) == 0);                           // instance opCall
+    static assert(!__traits(compiles, foo4()));
+}
+
+/**************************************/
+// 12070
+
+void test12070()
+{
+    static string result;
+
+    struct S
+    {
+        this(T...)(T)
+        {
+            result ~= "c" ~ cast(char)('0' + T.length);
+        }
+
+        void opCall(A...)(A)
+        {
+            result ~= "x" ~ cast(char)('0' + A.length);
+        }
+    }
+
+    auto s0 = S();
+    s0();
+    s0(1);
+    s0(1, 2);
+    assert(result == "x0x1x2");
+
+    result = null;
+
+    auto s1 = S(1);
+    s1();
+    s1('a');
+    s1('a', 'b');
+    assert(result == "c1x0x1x2");
+}
+
+/**************************************/
+// 12124
+
+struct S12124
+{
+    this(int) {}
+    S12124 opCall()() { static assert(0); }
+    // speculative opCall instantiation for diagnostic message should not cause false errors
+}
+
+/**************************************/
+
+void main()
+{
+    test1();
+    test2();
+    test2a();
+    test2c();
+    test3();
+    test3c();
+    test4();
+    test12070();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/overload.d b/gcc/testsuite/gdc.test/runnable/overload.d
new file mode 100644
index 00000000000..73354281df4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/overload.d
@@ -0,0 +1,1252 @@
+// EXTRA_SOURCES: imports/ovs1528a.d imports/ovs1528b.d imports/template_ovs1.d imports/template_ovs2.d imports/template_ovs3.d
+
+import imports.template_ovs1;
+import imports.template_ovs2;
+import imports.template_ovs3;
+
+extern(C) int printf(const char* fmt, ...);
+
+template TypeTuple(T...){ alias T TypeTuple; }
+template Id(      T){ alias T Id; }
+template Id(alias A){ alias A Id; }
+
+/***************************************************/
+// 1528
+
+int foo1528(long){ return 1; }
+int foo1528(int[]){ return 2; }
+int foo1528(T)(T) if ( is(T:real)) { return 3; }
+int foo1528(T)(T) if (!is(T:real)) { return 4; }
+int bar1528(T)(T) if (!is(T:real)) { return 4; }
+int bar1528(T)(T) if ( is(T:real)) { return 3; }
+int bar1528(int[]){ return 2; }
+int bar1528(long){ return 1; }
+
+@property auto getfoo1528   () { return 1; }
+@property auto getfoo1528(T)() { return 2; }
+@property auto getbar1528(T)() { return 2; }
+@property auto getbar1528   () { return 1; }
+
+@property auto setfoo1528   (int) { return 1; }
+@property auto setfoo1528(T)(int) { return 2; }
+@property auto setbar1528(T)(int) { return 2; }
+@property auto setbar1528   (int) { return 1; }
+
+struct S1528
+{
+    int foo(long){ return 1; }
+    int foo(int[]){ return 2; }
+    int foo(T)(T) if ( is(T:real)) { return 3; }
+    int foo(T)(T) if (!is(T:real)) { return 4; }
+    int bar(T)(T) if (!is(T:real)) { return 4; }
+    int bar(T)(T) if ( is(T:real)) { return 3; }
+    int bar(int[]){ return 2; }
+    int bar(long){ return 1; }
+
+    @property auto getfoo   () { return 1; }
+    @property auto getfoo(T)() { return 2; }
+    @property auto getbar(T)() { return 2; }
+    @property auto getbar   () { return 1; }
+
+    @property auto setfoo   (int) { return 1; }
+    @property auto setfoo(T)(int) { return 2; }
+    @property auto setbar(T)(int) { return 2; }
+    @property auto setbar   (int) { return 1; }
+
+    @property auto propboo   ()    { return 1; }
+    @property auto propboo(T)(T)   { return 2; }
+    @property auto propbaz(T)(T)   { return 2; }
+    @property auto propbaz   ()    { return 1; }
+}
+
+auto ufoo1528   (S1528) { return 1; }
+auto ufoo1528(T)(S1528) { return 2; }
+auto ubar1528(T)(S1528) { return 2; }
+auto ubar1528   (S1528) { return 1; }
+
+@property auto ugetfoo1528   (S1528) { return 1; }
+@property auto ugetfoo1528(T)(S1528) { return 2; }
+@property auto ugetbar1528(T)(S1528) { return 2; }
+@property auto ugetbar1528   (S1528) { return 1; }
+
+@property auto usetfoo1528   (S1528, int) { return 1; }
+@property auto usetfoo1528(T)(S1528, int) { return 2; }
+@property auto usetbar1528(T)(S1528, int) { return 2; }
+@property auto usetbar1528   (S1528, int) { return 1; }
+
+@property auto upropboo1528   (S1528)      { return 1; }
+@property auto upropboo1528(T)(S1528, T)   { return 2; }
+@property auto upropbaz1528(T)(S1528, T)   { return 2; }
+@property auto upropbaz1528   (S1528)      { return 1; }
+
+void test1528a()
+{
+    // global
+    assert(foo1528(100) == 1);
+    assert(foo1528(10L) == 1);
+    assert(foo1528([1]) == 2);
+    assert(foo1528(1.0) == 3);
+    assert(foo1528("a") == 4);
+    assert(bar1528(100) == 1);
+    assert(bar1528(10L) == 1);
+    assert(bar1528([1]) == 2);
+    assert(bar1528(1.0) == 3);
+    assert(bar1528("a") == 4);
+
+    assert(getfoo1528        == 1);
+    assert(getfoo1528!string == 2);
+    assert(getbar1528        == 1);
+    assert(getbar1528!string == 2);
+
+    assert((setfoo1528        = 1) == 1);
+    assert((setfoo1528!string = 1) == 2);
+    assert((setbar1528        = 1) == 1);
+    assert((setbar1528!string = 1) == 2);
+
+    S1528 s;
+
+    // member
+    assert(s.foo(100) == 1);
+    assert(s.foo(10L) == 1);
+    assert(s.foo([1]) == 2);
+    assert(s.foo(1.0) == 3);
+    assert(s.foo("a") == 4);
+    assert(s.bar(100) == 1);
+    assert(s.bar(10L) == 1);
+    assert(s.bar([1]) == 2);
+    assert(s.bar(1.0) == 3);
+    assert(s.bar("a") == 4);
+
+    assert(s.getfoo        == 1);
+    assert(s.getfoo!string == 2);
+    assert(s.getbar        == 1);
+    assert(s.getbar!string == 2);
+
+    assert((s.setfoo        = 1) == 1);
+    assert((s.setfoo!string = 1) == 2);
+    assert((s.setbar        = 1) == 1);
+    assert((s.setbar!string = 1) == 2);
+
+    assert((s.propboo = 1) == 2);
+    assert( s.propboo      == 1);
+    assert((s.propbaz = 1) == 2);
+    assert( s.propbaz      == 1);
+
+    // UFCS
+    assert(s.ufoo1528       () == 1);
+    assert(s.ufoo1528!string() == 2);
+    assert(s.ubar1528       () == 1);
+    assert(s.ubar1528!string() == 2);
+
+    assert(s.ugetfoo1528        == 1);
+    assert(s.ugetfoo1528!string == 2);
+    assert(s.ugetbar1528        == 1);
+    assert(s.ugetbar1528!string == 2);
+
+    assert((s.usetfoo1528        = 1) == 1);
+    assert((s.usetfoo1528!string = 1) == 2);
+    assert((s.usetbar1528        = 1) == 1);
+    assert((s.usetbar1528!string = 1) == 2);
+
+    assert((s.upropboo1528 = 1) == 2);
+    assert( s.upropboo1528      == 1);
+    assert((s.upropbaz1528 = 1) == 2);
+    assert( s.upropbaz1528      == 1);
+
+    // overload set
+    import imports.ovs1528a, imports.ovs1528b;
+    assert(func1528()    == 1);
+    assert(func1528(1.0) == 2);
+    assert(func1528("a") == 3);
+    assert(func1528([1.0]) == 4);
+    assert(bunc1528()    == 1);
+    assert(bunc1528(1.0) == 2);
+    assert(bunc1528("a") == 3);
+    assert(bunc1528([1.0]) == 4);
+
+    assert(vunc1528(100) == 1);
+    assert(vunc1528("a") == 2);
+    assert(wunc1528(100) == 1);
+    assert(wunc1528("a") == 2);
+
+    //assert(opUnary1528!"+"(10) == 1);
+    //assert(opUnary1528!"-"(10) == 2);
+}
+
+// ----
+
+int doo1528a(int a, double=10) { return 1; }
+int doo1528a(int a, string="") { return 2; }
+
+int doo1528b(int a) { return 1; }
+int doo1528b(T:int)(T b) { return 2; }
+
+int doo1528c(T:int)(T b, double=10) { return 2; }
+int doo1528c(T:int)(T b, string="") { return 2; }
+
+int doo1528d(int a) { return 1; }
+int doo1528d(T)(T b) { return 2; }
+
+void test1528b()
+{
+    // MatchLevel by tiargs     / by fargs
+    static assert(!__traits(compiles, doo1528a(1)));
+            // 1: MATCHexact    / MATCHexact
+            // 2: MATCHexact    / MATCHexact
+    static assert(!__traits(compiles, doo1528a(1L)));
+            // 1: MATCHexact    / MATCHconvert
+            // 2: MATCHexact    / MATCHconvert
+
+    static assert(!__traits(compiles, doo1528b(1)));
+            // 1: MATCHexact    / MATCHexact
+            // 2: MATCHexact    / MATCHexact
+    assert(doo1528b(1L) == 1);
+            // 1: MATCHexact    / MATCHconvert
+            // 2: MATCHnomatch  / -
+
+    static assert(!__traits(compiles, doo1528c(1)));
+            // 1: MATCHexact    / MATCHexact
+            // 2: MATCHexact    / MATCHexact
+    static assert(!__traits(compiles, doo1528c(1L)));
+            // 1: MATCHnomatch  / -
+            // 2: MATCHnomatch  / -
+
+    assert(doo1528d(1) == 1);
+            // 1: MATCHexact    / MATCHexact
+            // 2: MATCHconvert  / MATCHexact
+    assert(doo1528d(1L) == 1);
+            // 1: MATCHexact    / MATCHconvert
+            // 2: MATCHconvert  / MATCHexact
+            // -> not sure, may be ambiguous...?
+}
+
+// ----
+
+char[num*2] toHexString1528(int order, size_t num)(in ubyte[num] digest) { return typeof(return).init; }
+     string toHexString1528(int order)(in ubyte[] digest) { assert(0); }
+
+char[8] test1528c()
+{
+    ubyte[4] foo() { return typeof(return).init; }
+    return toHexString1528!10(foo);
+}
+
+// ----
+
+int f1528d1(int a, double=10) { return 1; }
+int f1528d1(int a, string="") { return 2; }
+
+int f1528d2(T:int)(T b, double=10) { return 1; }
+int f1528d2(T:int)(T b, string="") { return 2; }
+
+// vs deduced parameter
+int f1528d3(int a) { return 1; }
+int f1528d3(T)(T b) { return 2; }
+
+// vs specialized parameter
+int f1528d4(int a) { return 1; }
+int f1528d4(T:int)(T b) { return 2; }
+
+// vs deduced parameter + template constraint (1)
+int f1528d5(int a) { return 1; }
+int f1528d5(T)(T b) if (is(T == int)) { return 2; }
+
+// vs deduced parameter + template constraint (2)
+int f1528d6(int a) { return 1; }
+int f1528d6(T)(T b) if (is(T : int)) { return 2; }
+
+// vs nallowing conversion
+int f1528d7(ubyte a) { return 1; }
+int f1528d7(T)(T b) if (is(T : int)) { return 2; }
+
+int f1528d10(int, int) { return 1; }
+int f1528d10(T)(T, int) { return 2; }
+
+void test1528d()
+{
+    static assert(!__traits(compiles, f1528d1(1)));  // ambiguous
+    static assert(!__traits(compiles, f1528d1(1L))); // ambiguous
+
+    static assert(!__traits(compiles, f1528d2(1)));  // ambiguous
+    static assert(!__traits(compiles, f1528d2(1L))); // no match
+
+    assert(f1528d3(1) == 1);
+    assert(f1528d3(1L) == 1);    // '1L' matches int
+    short short_val = 42;
+    assert(f1528d3(cast(short) 42) == 1);
+    assert(f1528d3(short_val) == 1);
+
+    static assert(!__traits(compiles, f1528d4(1)));
+    assert(f1528d4(1L) == 1);
+
+    assert(f1528d5(1) == 1);
+    assert(f1528d5(1L) == 1);
+
+    assert(f1528d6(1) == 1);
+    assert(f1528d6(1L) == 1);
+    static assert(!__traits(compiles, f1528d6(ulong.max))); // no match
+                                          // needs to fix bug 9617
+    ulong ulval = 1;
+    static assert(!__traits(compiles, f1528d6(ulval)));     // no match
+
+    assert(f1528d7(200u) == 1);  // '200u' matches ubyte
+    assert(f1528d7(400u) == 2);
+    uint uival = 400;       // TDPL-like range knowledge lost here.
+    assert(f1528d7(uival) == 2);
+    uival = 200;            // Ditto.
+    assert(f1528d7(uival) == 2);
+
+
+    assert(f1528d10(        1, 9) == 1);
+    assert(f1528d10(       1U, 9) == 1);
+    assert(f1528d10(       1L, 9) == 1);
+    assert(f1528d10(      1LU, 9) == 1);
+    assert(f1528d10( long.max, 9) == 2);
+    assert(f1528d10(ulong.max, 9) == 2);
+    assert(f1528d10(        1, 9L) == 1);
+    assert(f1528d10(       1U, 9L) == 1);
+    assert(f1528d10(       1L, 9L) == 1);
+    assert(f1528d10(      1LU, 9L) == 1);
+    assert(f1528d10( long.max, 9L) == 2);
+    assert(f1528d10(ulong.max, 9L) == 2);
+}
+
+/***************************************************/
+// 1680
+
+struct S1680
+{
+    ulong _y;
+
+           ulong blah1()        { return _y; }
+    static S1680 blah1(ulong n) { return S1680(n); }
+
+    static S1680 blah2(ulong n)  { return S1680(n); }
+    static S1680 blah2(char[] n) { return S1680(n.length); }
+}
+
+class C1680
+{
+    ulong _y;
+    this(ulong n){}
+
+           ulong blah1()        { return _y; }
+    static C1680 blah1(ulong n) { return new C1680(n); }
+
+    static C1680 blah2(ulong n)  { return new C1680(n); }
+    static C1680 blah2(char[] n) { return new C1680(n.length); }
+}
+
+void test1680()
+{
+    // OK
+    S1680 s = S1680.blah1(5);
+    void fs()
+    {
+        S1680 s1 = S1680.blah2(5);              // OK
+        S1680 s2 = S1680.blah2("hello".dup);    // OK
+        S1680 s3 = S1680.blah1(5);
+        // Error: 'this' is only allowed in non-static member functions, not f
+    }
+
+    C1680 c = C1680.blah1(5);
+    void fc()
+    {
+        C1680 c1 = C1680.blah2(5);
+        C1680 c2 = C1680.blah2("hello".dup);
+        C1680 c3 = C1680.blah1(5);
+    }
+}
+
+/***************************************************/
+// 7418
+
+int foo7418(uint a)   { return 1; }
+int foo7418(char[] a) { return 2; }
+
+alias foo7418 foo7418a;
+template foo7418b(T = void) { alias foo7418 foo7418b; }
+
+void test7418()
+{
+    assert(foo7418a(1U) == 1);
+    assert(foo7418a("a".dup) == 2);
+
+    assert(foo7418b!()(1U) == 1);
+    assert(foo7418b!()("a".dup) == 2);
+}
+
+/***************************************************/
+// 7552
+
+struct S7552
+{
+    static void foo(){}
+    static void foo(int){}
+}
+
+struct T7552
+{
+    alias TypeTuple!(__traits(getOverloads, S7552, "foo")) FooInS;
+    alias FooInS[0] foo;    // should be S7552.foo()
+    static void foo(string){}
+}
+
+struct U7552
+{
+    alias TypeTuple!(__traits(getOverloads, S7552, "foo")) FooInS;
+    alias FooInS[1] foo;    // should be S7552.foo(int)
+    static void foo(string){}
+}
+
+void test7552()
+{
+    alias TypeTuple!(__traits(getOverloads, S7552, "foo")) FooInS;
+    static assert(FooInS.length == 2);
+                                      FooInS[0]();
+    static assert(!__traits(compiles, FooInS[0](0)));
+    static assert(!__traits(compiles, FooInS[1]()));
+                                      FooInS[1](0);
+
+                                      Id!(FooInS[0])();
+    static assert(!__traits(compiles, Id!(FooInS[0])(0)));
+    static assert(!__traits(compiles, Id!(FooInS[1])()));
+                                      Id!(FooInS[1])(0);
+
+    alias TypeTuple!(__traits(getOverloads, T7552, "foo")) FooInT;
+    static assert(FooInT.length == 2);                  // fail
+                                      FooInT[0]();
+    static assert(!__traits(compiles, FooInT[0](0)));
+    static assert(!__traits(compiles, FooInT[0]("")));
+    static assert(!__traits(compiles, FooInT[1]()));
+    static assert(!__traits(compiles, FooInT[1](0)));   // fail
+                                      FooInT[1]("");    // fail
+
+    alias TypeTuple!(__traits(getOverloads, U7552, "foo")) FooInU;
+    static assert(FooInU.length == 2);
+    static assert(!__traits(compiles, FooInU[0]()));
+                                      FooInU[0](0);
+    static assert(!__traits(compiles, FooInU[0]("")));
+    static assert(!__traits(compiles, FooInU[1]()));
+    static assert(!__traits(compiles, FooInU[1](0)));
+                                      FooInU[1]("");
+}
+
+/***************************************************/
+// 8668
+
+import imports.m8668a;
+import imports.m8668c; //replace with m8668b to make it work
+
+void test8668()
+{
+    split8668("abc");
+    split8668(123);
+}
+
+/***************************************************/
+// 8943
+
+void test8943()
+{
+    struct S
+    {
+        void foo();
+    }
+
+    alias TypeTuple!(__traits(getOverloads, S, "foo")) Overloads;
+    alias TypeTuple!(__traits(parent, Overloads[0])) P; // fail
+    static assert(is(P[0] == S));
+}
+
+/***************************************************/
+// 9410
+
+struct S {}
+int foo(float f, ref S s) { return 1; }
+int foo(float f,     S s) { return 2; }
+void test9410()
+{
+    S s;
+    assert(foo(1, s  ) == 1); // works fine. Print: ref
+    assert(foo(1, S()) == 2); // Fails with: Error: S() is not an lvalue
+}
+
+/***************************************************/
+// 10171
+
+struct B10171(T) { static int x; }
+
+void test10171()
+{
+    auto mp = &B10171!(B10171!int).x;
+}
+
+/***************************************************/
+// 1900 - template overload set
+
+void test1900a()
+{
+    // function vs function template with IFTI call
+    assert(foo1900a(100) == 1);
+    assert(foo1900a("s") == 2);
+    assert(foo1900b(100) == 1);
+    assert(foo1900b("s") == 2);
+    // function template call with explicit template arguments
+    assert(foo1900a!string("s") == 2);
+    assert(foo1900b!string("s") == 2);
+
+    // function template overloaded set call with IFTI
+    assert(bar1900a(100) == 1);
+    assert(bar1900a("s") == 2);
+    assert(bar1900b(100) == 1);
+    assert(bar1900b("s") == 2);
+    // function template overloaded set call with explicit template arguments
+    assert(bar1900a!double(100) == 1);
+    assert(bar1900a!string("s") == 2);
+    assert(bar1900b!double(100) == 1);
+    assert(bar1900b!string("s") == 2);
+
+    // function template overloaded set call with IFTI
+    assert(baz1900(1234567890) == 1);
+    assert(baz1900([1:1, 2:2]) == 2);
+    assert(baz1900(new Object) == 3);
+    assert(baz1900("deadbeaf") == 4);
+    // function template overloaded set call with explicit template arguments
+    assert(baz1900!(double)(14142135) == 1);
+    assert(baz1900!(int[int])([12:34]) == 2);
+    assert(baz1900!(Object)(new Object) == 3);
+    assert(baz1900!(string)("cafe babe") == 4);
+
+    static assert(!__traits(compiles, bad1900!"++"()));
+}
+
+void test1900b()
+{
+    S1900 s;
+
+    // function vs function template with IFTI call
+    assert(s.foo1900a(100) == 1);
+    assert(s.foo1900a("s") == 2);
+    assert(s.foo1900b(100) == 1);
+    assert(s.foo1900b("s") == 2);
+    // function template call with explicit template arguments
+    assert(s.foo1900a!string("s") == 2);
+    assert(s.foo1900b!string("s") == 2);
+
+    // function template overloaded set call with IFTI
+    assert(s.bar1900a(100) == 1);
+    assert(s.bar1900a("s") == 2);
+    assert(s.bar1900b(100) == 1);
+    assert(s.bar1900b("s") == 2);
+    // function template overloaded set call with explicit template arguments
+    assert(s.bar1900a!double(100) == 1);
+    assert(s.bar1900a!string("s") == 2);
+    assert(s.bar1900b!double(100) == 1);
+    assert(s.bar1900b!string("s") == 2);
+
+    // function template overloaded set call with IFTI
+    assert(s.baz1900(1234567890) == 1);
+    assert(s.baz1900([1:1, 2:2]) == 2);
+    assert(s.baz1900(new Object) == 3);
+    assert(s.baz1900("deadbeaf") == 4);
+    // function template overloaded set call with explicit template arguments
+    assert(s.baz1900!(double)(14142135) == 1);
+    assert(s.baz1900!(int[int])([12:34]) == 2);
+    assert(s.baz1900!(Object)(new Object) == 3);
+    assert(s.baz1900!(string)("cafe babe") == 4);
+
+    static assert(!__traits(compiles, s.bad1900!"++"()));
+}
+
+void test1900c()
+{
+    S1900 s;
+
+    // This is a kind of Issue 1528 - [tdpl] overloading template and non-template functions
+    //s.funca();
+    //s.funca(10);
+    //s.funcb();
+    //s.funcb(10);
+
+    // Call function template overload set through mixin member lookup
+    assert(s.mixfooa() == 1);
+    assert(s.mixfooa(10) == 2);
+    assert(s.mixfoob() == 1);
+    assert(s.mixfoob(10) == 2);
+
+    // Call function template overload set through mixin^2 member lookup
+    assert(s.mixsubfooa() == 1);
+    assert(s.mixsubfooa(10) == 2);
+    assert(s.mixsubfoob() == 1);
+    assert(s.mixsubfoob(10) == 2);
+
+    // Using mixin identifier can limit overload set
+    assert(s.a.mixfooa() == 1);     static assert(!__traits(compiles, s.a.mixfooa(10)));
+    assert(s.b.mixfooa(10) == 2);   static assert(!__traits(compiles, s.b.mixfooa()));
+    assert(s.b.mixfoob() == 1);     static assert(!__traits(compiles, s.b.mixfoob(10)));
+    assert(s.a.mixfoob(10) == 2);   static assert(!__traits(compiles, s.a.mixfoob()));
+}
+
+alias merge1900 = imports.template_ovs1.merge1900;
+alias merge1900 = imports.template_ovs2.merge1900;
+
+void test1900d()
+{
+    assert( merge1900!double(100) == 1);
+    assert(.merge1900!double(100) == 1);
+}
+
+mixin template Foo1900e(T)
+{
+    void foo(U : T)() { v++;}
+}
+void test1900e()
+{
+    struct S
+    {
+        int v;
+        mixin Foo1900e!double;
+        mixin Foo1900e!string;
+        void test()
+        {
+            foo!(int);          // ScopeExp(ti->tempovers != NULL)
+            foo!(typeof(null)); // ScopeExp(ti->tempovers != NULL)
+        }
+    }
+
+    S s;
+    assert(s.v == 0);
+    s.test();
+    assert(s.v == 2);
+}
+
+/***************************************************/
+// 1900
+
+void test1900()
+{
+    AClass1900 a;
+    BClass1900 b;
+
+    static assert(Traits1900!(AClass1900).name == "AClass");
+    static assert(Traits1900!(BClass1900).name == "BClass");
+    static assert(Traits1900!(int).name == "any");
+
+    Traits1900!(long) obj;
+
+    static assert(Value1900a!double == 1);
+    static assert(Value1900b!double == 1);
+    static assert(Value1900a!string == 2);
+    static assert(Value1900b!string == 2);
+}
+
+alias imports.template_ovs1.Traits1900 Traits1900X;
+alias imports.template_ovs2.Traits1900 Traits1900X;
+alias imports.template_ovs3.Traits1900 Traits1900X;
+static assert(Traits1900X!(AClass1900).name == "AClass");
+static assert(Traits1900X!(BClass1900).name == "BClass");
+static assert(Traits1900X!(int).name == "any");
+
+// Traits1900Y is exact same as imports.template_ovs1.Traits1900.
+alias imports.template_ovs1.Traits1900 Traits1900Y1;
+alias imports.template_ovs1.Traits1900 Traits1900Y2;
+alias Traits1900Y1 Traits1900Y;
+alias Traits1900Y2 Traits1900Y;
+static assert(Traits1900Y!(AClass1900).name == "AClass");
+static assert(!__traits(compiles, Traits1900Y!(BClass1900)));
+static assert(!__traits(compiles, Traits1900Y!(int)));
+
+template Foo1900(T)
+{
+    template Bar1900(U : T)
+    {
+    }
+}
+mixin Foo1900!(int) A1900;
+mixin Foo1900!(char) B1900;
+alias Bar1900!(int) bar1900;    // error
+
+/***************************************************/
+// 7780
+
+mixin template A7780()
+{
+    template C(int n : 0) { int C = 0; }
+}
+mixin template B7780()
+{
+    template C(int n : 1) { int C = 1; }
+}
+
+class Foo7780
+{
+    mixin A7780!();
+    mixin B7780!();
+}
+
+void test7780()
+{
+    assert(Foo7780.C!0 == 0);
+}
+
+/***************************************************/
+
+auto foo7849(string) { return 1; }
+auto foo7849(dstring) { return 2; }
+
+enum str7849a = "string";
+immutable str7849ai = "string";
+immutable str7849bi = str7849ai;
+enum str7849b = str7849ai;
+enum str7849c = str7849bi;
+
+void test7849()
+{
+    assert(foo7849(str7849a) == 1);
+    assert(foo7849(str7849b) == 1);
+    assert(foo7849(str7849c) == 1);
+}
+
+/***************************************************/
+// 8352
+
+void test8352()
+{
+    [1, 2].remove8352a!(x => x == 2)();
+    [1, 2].remove8352b!(x => x == 2)();
+    remove8352a("deleteme");
+    remove8352b("deleteme");
+}
+
+/***************************************************/
+// 8441
+
+mixin template T8441a(string i)
+{
+    auto j(string s = "a", U)(U u1, U u2)
+    {
+        return 0;
+    }
+    auto j(int i,string s = "a", W)(W u1, W u2)
+    {
+        return i;
+    }
+
+    mixin("
+        class F" ~ i ~ "
+        {
+            auto j(string s = \"a\", U)(U u1, U u2)
+            {
+                return this.outer.t" ~ i ~ ".j!(s, U)(u1, u2);
+            }
+            auto j(int i, string s = \"a\", W)(W u1, W u2)
+            {
+                return this.outer.t" ~ i ~ ".j!(i, s, W)(u1, u2);   // <- dmd is giving error for j!(...).j's type
+            }
+        }
+        auto f" ~ i ~ "()
+        {
+            return new F" ~ i ~ "();
+        }
+    ");
+}
+class X8441a
+{
+    mixin T8441a!("1") t0;
+    alias t0 t1;
+}
+void test8441a()
+{
+    auto x = new X8441a();
+    x.f1().j!(3,"a")(2.2, 3.3);
+}
+
+// ----
+
+mixin template T8441b()
+{
+    void k()() {}
+
+    void j()() {}
+    void j(int i)() {}
+}
+class X8441b
+{
+    mixin T8441b t0;
+}
+void test8441b()
+{
+    auto x = new X8441b();
+    x.k!()();    // Fine
+    x.j!()();    // Fine
+    x.t0.k!()(); // Fine
+    x.t0.j!()(); // Derp
+}
+
+// ----
+
+mixin template Signal8441c(Args...)
+{
+    bool call = false;
+    final void connect(string method, ClassType)(ClassType obj)
+    if (is(ClassType == class) && __traits(compiles, { void delegate(Args) dg = mixin("&obj."~method); }))
+    {
+        call = true;
+    }
+}
+void test8441c()
+{
+    class Observer
+    {
+        void watchInt(string str, int i) {}
+    }
+    class Bar
+    {
+        mixin Signal8441c!(string, int)  s1;
+        mixin Signal8441c!(string, int)  s2;
+        mixin Signal8441c!(string, long) s3;
+    }
+    auto a = new Bar;
+    auto o1 = new Observer;
+
+    a.s1.connect!"watchInt"(o1);
+
+    assert( a.s1.call);
+    assert(!a.s2.call);
+    assert(!a.s3.call);
+}
+
+/***************************************************/
+// 9235
+
+template FlowEvaluator9235()
+{
+    // if control flow
+    bool execute(Command cmd)()
+        if (cmd == Command.Jump ||
+            cmd == Command.Fork)
+    {
+        return false;
+    }
+}
+template MatchEvaluator9235()
+{
+    // if operation
+    bool execute(Command cmd)()
+        if (cmd == Command.Char ||
+            cmd == Command.Any ||
+            cmd == Command.End)
+    {
+        return true;
+    }
+}
+void test9235a()
+{
+    enum Command
+    {
+        Char, Any, Fork, Jump, End
+    }
+    struct Machine
+    {
+        mixin FlowEvaluator9235;
+        mixin MatchEvaluator9235;
+
+        bool exec_flow()
+        {
+            return execute!(Command.Jump)();
+        }
+        bool exec_match()
+        {
+            return execute!(Command.Any)();
+        }
+    }
+
+    Machine m;
+    assert(!m.exec_flow());
+    assert( m.exec_match());
+}
+
+// ----
+
+mixin template mixA9235()
+{
+    int foo(string s)() if (s == "a") { return 1; }
+}
+mixin template mixB9235()
+{
+    int foo(string s)() if (s == "b") { return 2; }
+}
+struct Foo9235
+{
+    mixin mixA9235 A;
+    mixin mixB9235 B;
+    alias A.foo foo;
+    alias B.foo foo;
+}
+void test9235b()
+{
+    Foo9235 f;
+    assert(f.foo!"a"() == 1);
+    assert(f.foo!"b"() == 2);
+}
+
+/***************************************************/
+// 10658
+
+alias Val10658 = imports.template_ovs1.Val10658;
+alias Val10658 = imports.template_ovs2.Val10658;
+static assert(Val10658!1 == 1);
+static assert(Val10658!1L == 2);
+
+// ----
+
+template Foo10658(T) if (is(T == double)) { enum Foo10658 = 1; }
+template Bar10658(T) if (is(T == string)) { enum Bar10658 = 2; }
+alias Baz10658 = Foo10658;
+alias Baz10658 = Bar10658;
+
+template Voo10658(T) if (is(T == cfloat)) { enum Voo10658 = 5; }
+template Voo10658(T) if (is(T == Object)) { enum Voo10658 = 6; }
+
+alias Vaz10658 = Baz10658;  // OvarDeclaration
+alias Vaz10658 = Voo10658;  // TemplateDeclaration (overnext != NULL)
+
+template Merge10658a(alias A)
+{
+    enum Merge10658a = A!double + A!string;
+}
+template Merge10658b(alias A)
+{
+    enum Merge10658b = A!double + A!string + A!cfloat + A!Object;
+}
+
+void test10658a()
+{
+    static assert(Baz10658!double == 1);
+    static assert(Baz10658!string == 2);
+    static assert(Voo10658!cfloat == 5);
+    static assert(Voo10658!Object == 6);
+
+    // pass OverDeclaration through TemplateAliasParameter
+    static assert(Merge10658a!Baz10658 == 1 + 2);
+    static assert(Merge10658b!Vaz10658 == 1 + 2 + 5 + 6);
+}
+
+// ----
+
+mixin template mix10658A()
+{
+    int f10658(string s)() if (s == "a") { return 1; }
+}
+mixin template mix10658B()
+{
+    int f10658(string s)() if (s == "b") { return 2; }
+}
+mixin mix10658A A10658;
+mixin mix10658B B10658;
+alias A10658.f10658 foo10658;
+alias B10658.f10658 foo10658;
+
+mixin template mix10658C()
+{
+    int f10658(string s, T)(T arg) if (s == "c") { return 3; }
+}
+mixin template mix10658D()
+{
+    int f10658(string s, T)(T arg) if (s == "d") { return 4; }
+}
+struct S10658
+{
+    mixin mix10658C C10658;
+    mixin mix10658D D10658;
+    alias C10658.f10658 foo10658;
+    alias D10658.f10658 foo10658;
+}
+
+void test10658b()
+{
+    assert( foo10658!"a"() == 1);
+    assert(.foo10658!"b"() == 2);
+
+    S10658 s;
+    assert(s.foo10658!"c"(0) == 3);
+    assert(s.foo10658!"d"(0) == 4);
+}
+
+/***************************************************/
+
+class InputStream11785
+{
+    long read(ubyte* bytes, long len)
+    {
+        return 0;
+    }
+    void read(T)(ref T val)
+    {
+        read(cast(ubyte*)&val, cast(long)val.sizeof);
+    }
+}
+
+long read11785(ubyte* bytes, long len)
+{
+    return 0;
+}
+void read11785(T)(ref T val)
+{
+    read11785(cast(ubyte*)&val, cast(long)val.sizeof);
+}
+
+void test11785()
+{
+    int v;
+
+    read11785(v);
+
+    auto input = new InputStream11785();
+    input.read(v);
+}
+
+/***************************************************/
+// 11915
+
+int f11915(    int) { return 1; }
+int f11915(ref int) { return 2; }
+
+int g11915(    int) { return 1; }
+int g11915(out int) { return 2; }
+
+void test11915()
+{
+    const int n = 1;
+    assert(f11915(n) == 1);
+    assert(g11915(n) == 1);
+}
+
+/***************************************************/
+// 11916
+
+auto f11916(T)(    T)            { return 1; }
+auto f11916(T)(out T) if (false) { return 2; }
+
+auto g11916(T)(    T) { return 1; }
+auto g11916(T)(out T) { return 2; }
+
+void test11916()
+{
+    const int c = 1;
+    int m = 2;
+
+    // 'out const int' is invalid function parameter, so (out T) version will be dropped
+    // from overload candidates before template constraint evaluated.
+    assert(f11916(c) == 1);
+
+    // Both (T) and (out T) have valid signatures with T == int, but the 2nd overload will be
+    // dropped from overload candidates because of the template constraint.
+    assert(f11916(m) == 1);
+
+    // 'out const int' parameter is invalid, so non-out version is selected.
+    assert(g11916(c) == 1);
+
+    // MATCHconst for (T) version, and MATCHexact for (out T) version.
+    assert(g11916(m) == 2);
+}
+
+/***************************************************/
+// 13783
+
+enum E13783 { a = 5 }
+
+    inout(int) f(    inout(int) t) { return t * 2; }
+ref inout(int) f(ref inout(int) t) { return t; }
+
+void test13783()
+{
+    const E13783 e = E13783.a;
+    assert(f(e) == 10);
+}
+
+/***************************************************/
+// 14858
+
+int foo14858()() { return 1; }
+int bar14858(int) { return 2; }
+
+alias foobar14858 = foo14858;
+alias foobar14858 = bar14858;
+
+void test14858()
+{
+    assert(foobar14858() == 1);
+    assert(foobar14858(1) == 2); // OK <- NG
+}
+
+/***************************************************/
+// 14989
+
+template Foo14989(T) if (is(T == int))    { enum Foo14989 = 1; }
+template Bar14989(T) if (is(T == double)) { enum Bar14989 = 2; }
+template Baz14989(T) if (is(T == string)) { enum Baz14989 = 3; }
+
+alias X14989 = Foo14989;
+alias X14989 = Bar14989;
+// X is an alias to is OverDeclaration
+alias A14989 = X14989;
+// first, A->aliassym == X
+static if (true)
+{
+    alias A14989 = Baz14989;
+    // A->aliassym = new OverDeclaration('A')
+    // then, A->aliassym->overloadInsert(Baz)
+}
+
+template Mix14989a() { alias M14989 = Foo14989; }
+template Mix14989b() { alias M14989 = Bar14989; }
+mixin Mix14989a;
+mixin Mix14989b;
+alias Y14989 = M14989;
+// Y is an alias to OverloadSet
+alias B14989 = Y14989;
+// first, B->aliassym == Y
+static if (true)
+{
+    alias B14989 = Baz14989;
+    // (B->aliassym = new OverloadSet('B')
+    // then, B->aliassym->overloadInsert(Baz)
+}
+
+void test14989()
+{
+    static assert(X14989!int    == 1);
+    static assert(X14989!double == 2);
+    static assert(!__traits(compiles, X14989!string));  // Baz is not in X
+
+    static assert(A14989!int    == 1);
+    static assert(A14989!double == 2);
+    static assert(A14989!string == 3);  // OK <- error
+
+    static assert(Y14989!int    == 1);
+    static assert(Y14989!double == 2);
+    static assert(!__traits(compiles, Y14989!string));  // Baz is not in Y
+
+    static assert(B14989!int    == 1);
+    static assert(B14989!double == 2);
+    static assert(B14989!string == 3);  // OK <- error
+}
+
+/***************************************************/
+// 14965
+
+auto f14965a1() { return f14965a1(123); }
+int f14965a1(int x) { return x; }
+
+int f14965a2(int x) { return x; }
+auto f14965a2() { return f14965a2(123); }
+
+auto f14965b1() { int function(int) fp = &f14965b1; return fp(123); }
+int f14965b1(int x) { return x; }
+
+int f14965b2(int x) { return x; }
+auto f14965b2() { int function(int) fp = &f14965b2; return fp(123); }
+
+auto f14965c1() { auto fp = cast(int function(int))&f14965c1; return fp(123); }
+int f14965c1(int x) { return x; }
+
+int f14965c2(int x) { return x; }
+auto f14965c2() { auto fp = cast(int function(int))&f14965c2; return fp(123); }
+
+int function(int) f14965d1() { return &f14965d1; }
+int f14965d1(int n) { return 10 + n; }
+
+int f14965d2(int n) { return 10 + n; }
+int function(int) f14965d2() { return &f14965d2; }
+
+class C
+{
+    auto fa1() { return this.fa1(123); }
+    int fa1(int x) { return x; }
+
+    int fa2(int x) { return x; }
+    auto fa2() { return this.fa2(123); }
+
+    auto fb1() { int delegate(int) dg = &this.fb1; return dg(123); }
+    int fb1(int x) { return x; }
+
+    int fb2(int x) { return x; }
+    auto fb2() { int delegate(int) dg = &this.fb2; return dg(123); }
+
+    auto fc1() { auto dg = cast(int delegate(int))&this.fc1; return dg(123); }
+    int fc1(int x) { return x; }
+
+    int fc2(int x) { return x; }
+    auto fc2() { auto dg = cast(int delegate(int))&this.fc2; return dg(123); }
+
+    int delegate(int) fd1() { return &fd1; }
+    int fd1(int n) { return 10 + n; }
+
+    int fd2(int n) { return 10 + n; }
+    int delegate(int) fd2() { return &fd2; }
+}
+
+void test14965()
+{
+    assert(f14965a1() == 123);
+    assert(f14965b1() == 123);
+    assert(f14965c1() == 123);
+    assert(f14965d1()(113) == 123);
+    assert(f14965a2() == 123);
+    assert(f14965b2() == 123);
+    assert(f14965c2() == 123);
+    assert(f14965d2()(113) == 123);
+
+    auto c = new C();
+    assert(c.fa1() == 123);
+    assert(c.fb1() == 123);
+    assert(c.fc1() == 123);
+    assert(c.fd1()(113) == 123);
+    assert(c.fa2() == 123);
+    assert(c.fb2() == 123);
+    assert(c.fc2() == 123);
+    assert(c.fd2()(113) == 123);
+}
+
+/***************************************************/
+
+int main()
+{
+    test1528a();
+    test1528b();
+    test1528c();
+    test1528d();
+    test1680();
+    test7418();
+    test7552();
+    test8668();
+    test8943();
+    test9410();
+    test10171();
+    test1900a();
+    test1900b();
+    test1900c();
+    test1900d();
+    test1900e();
+    test7780();
+    test7849();
+    test8352();
+    test8441a();
+    test8441b();
+    test8441c();
+    test9235a();
+    test9235b();
+    test10658a();
+    test10658b();
+    test11785();
+    test11915();
+    test11916();
+    test13783();
+    test14858();
+    test14965();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/pi.d b/gcc/testsuite/gdc.test/runnable/pi.d
new file mode 100644
index 00000000000..bb5f0d07763
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/pi.d
@@ -0,0 +1,174 @@
+// PERMUTE_ARGS:
+// EXECUTE_ARGS: 1000
+
+import core.stdc.stdio;
+import core.stdc.time;
+
+const int LONG_TIME=4000;
+
+byte[] p;
+byte[] t;
+int q;
+
+int main(char[][] args)
+{
+        time_t startime, endtime;
+        int i;
+
+        if (args.length == 2) {
+                sscanf(&args[1][0],"%d",&q);
+        } else {
+                printf("Usage: pi [precision]\n");
+                return 1;
+        }
+
+        if (q < 0)
+        {
+                printf("Precision was too low, running with precision of 0.\n");
+                q = 0;
+        }
+
+        if (q > LONG_TIME)
+        {
+            printf("Be prepared to wait a while...\n");
+        }
+
+        // Compute one more digit than we display to compensate for rounding
+        q++;
+
+        p.length = q + 1;
+        t.length = q + 1;
+
+        /* compute pi */
+
+        time(&startime);
+        arctan(2);
+        arctan(3);
+        mul4();
+        time(&endtime);
+
+        // Return to the number of digits we want to display
+        q--;
+
+        /* print pi */
+
+        printf("pi = %d.",cast(int)(p[0]));
+        for (i = 1; i <= q; i++)
+        printf("%d",cast(int)(p[i]));
+        printf("\n");
+        printf("%lld seconds to compute pi with a precision of %d digits.\n", cast(long)(endtime-startime),q);
+
+        return 0;
+}
+
+void arctan(int s)
+{
+        int n;
+
+        t[0] = 1;
+        div(s); /* t[] = 1/s */
+        add();
+        n = 1;
+        do {
+                mul(n);
+                div(s * s);
+                div(n += 2);
+                if (((n-1) / 2) % 2 == 0)
+                        add();
+                else
+                        sub();
+        } while (!tiszero());
+}
+
+void add()
+{
+        int j;
+
+        for (j = q; j >= 0; j--)
+        {
+                if (t[j] + p[j] > 9) {
+                        p[j] += t[j] - 10;
+                        p[j-1] += 1;
+                } else
+                        p[j] += t[j];
+        }
+}
+
+void sub()
+{
+        int j;
+
+        for (j = q; j >= 0; j--)
+                if (p[j] < t[j]) {
+                        p[j] -= t[j] - 10;
+                        p[j-1] -= 1;
+                } else
+                        p[j] -= t[j];
+}
+
+void mul(int multiplier)
+{
+        int b;
+        int i;
+        int carry = 0, digit = 0;
+
+        for (i = q; i >= 0; i--) {
+                b = (t[i] * multiplier + carry);
+                digit = b % 10;
+                carry = b / 10;
+                t[i] = cast(byte)digit;
+        }
+}
+
+/* t[] /= l */
+
+void div(int divisor)
+{
+        int i, b;
+        int quotient, remainder = 0;
+
+        foreach (ref x; t)
+        {
+                b = (10 * remainder + x);
+                quotient = b / divisor;
+                remainder = b % divisor;
+                x = cast(byte)quotient;
+        }
+}
+
+void div4()
+{
+        int i, c, d = 0;
+
+        for (i = 0; i <= q; i++) {
+                c = (10 * d + p[i]) / 4;
+                d = (10 * d + p[i]) % 4;
+                p[i] = cast(byte)c;
+        }
+}
+
+void mul4()
+{
+        int i, c, d;
+
+        d = c = 0;
+
+        for (i = q; i >= 0; i--) {
+                d = (p[i] * 4 + c) % 10;
+                c = (p[i] * 4 + c) / 10;
+                p[i] = cast(byte)d;
+        }
+}
+
+int tiszero()
+{
+        int k;
+
+        for (k = 0; k <= q; k++)
+                if (t[k] != 0)
+                        return false;
+        return true;
+}
+
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/polysemous.d b/gcc/testsuite/gdc.test/runnable/polysemous.d
new file mode 100644
index 00000000000..fc201aaf882
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/polysemous.d
@@ -0,0 +1,71 @@
+// PERMUTE_ARGS:
+
+// Prefer immutable(char)[] to all others
+int foo(           char[] a) { return 11; }
+int foo(    const  char[] a) { return 12; }
+int foo(immutable  char[] a) { return 13; }
+int foo(          wchar[] a) { return 21; }
+int foo(    const wchar[] a) { return 22; }
+int foo(immutable wchar[] a) { return 23; }
+int foo(          dchar[] a) { return 31; }
+int foo(    const dchar[] a) { return 32; }
+int foo(immutable dchar[] a) { return 33; }
+
+// Prefer const conversion over polysemous conversion
+int bar(           char[] a) { return 11; }
+int bar(    const  char[] a) { return 12; }
+//  bar(immutable  char[] a);
+int bar(          wchar[] a) { return 21; }
+int bar(    const wchar[] a) { return 22; }
+//  bar(immutable wchar[] a);
+int bar(          dchar[] a) { return 31; }
+int bar(    const dchar[] a) { return 32; }
+//  bar(immutable dchar[] a);
+
+// No conversion to mutable
+int baz(           char[] a) { return 11; }
+//  baz(    const  char[] a);
+//  baz(immutable  char[] a);
+int baz(          wchar[] a) { return 21; }
+//  baz(    const wchar[] a);
+//  baz(immutable wchar[] a);
+int baz(          dchar[] a) { return 31; }
+//  baz(    const dchar[] a);
+//  baz(immutable dchar[] a);
+
+int main()
+{
+    auto strn = "a";
+    auto strc = "a"c;
+    auto strw = "a"w;
+    auto strd = "a"d;
+
+    assert(foo("a" ) == 13);
+    assert(foo(strn) == 13);
+    assert(foo("a"c) == 13);
+    assert(foo(strc) == 13);
+    assert(foo("a"w) == 23);
+    assert(foo(strw) == 23);
+    assert(foo("a"d) == 33);
+    assert(foo(strd) == 33);
+
+    assert(bar("a" ) == 12);
+    assert(bar(strn) == 12);
+    assert(bar("a"c) == 12);
+    assert(bar(strc) == 12);
+    assert(bar("a"w) == 22);
+    assert(bar(strw) == 22);
+    assert(bar("a"d) == 32);
+    assert(bar(strd) == 32);
+
+    static assert(!__traits(compiles, baz("a" ) ));
+    static assert(!__traits(compiles, baz(strn) ));
+    static assert(!__traits(compiles, baz("a"c) ));
+    static assert(!__traits(compiles, baz(strc) ));
+    static assert(!__traits(compiles, baz("a"w) ));
+    static assert(!__traits(compiles, baz(strw) ));
+    static assert(!__traits(compiles, baz("a"d) ));
+    static assert(!__traits(compiles, baz(strd) ));
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/printargs.d b/gcc/testsuite/gdc.test/runnable/printargs.d
new file mode 100644
index 00000000000..f4fc703163c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/printargs.d
@@ -0,0 +1,18 @@
+// PERMUTE_ARGS:
+// EXECUTE_ARGS: A B C
+
+extern(C) int printf(const char*, ...);
+
+int main(char args[][])
+{
+    int i;
+
+    for (i = 0; i < args.length; i++)
+        printf("args[%d] = '%.*s'\n", i, args[i].length, args[i].ptr);
+
+    assert(args[1] == "A");
+    assert(args[2] == "B");
+    assert(args[3] == "C");
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/property.d b/gcc/testsuite/gdc.test/runnable/property.d
new file mode 100644
index 00000000000..4fd3af4347b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/property.d
@@ -0,0 +1,50 @@
+
+
+/******************************************/
+
+struct Foo
+{
+    int v;
+
+    int bar(int value) { return v = value + 2; }
+    int bar() { return 73; }
+}
+
+int test1()
+{
+    Foo f;
+    int i;
+
+    i = (f.bar = 6);
+    assert(i == 8);
+    assert(f.v == 8);
+
+    i = f.bar;
+    assert(i == 73);
+
+    return 0;
+}
+
+/******************************************/
+// 6259
+
+struct S6259
+{
+    private int m_prop;
+    ref const(int) prop() { return m_prop; }
+    void prop(int v) { m_prop = v; }
+}
+
+void test6259()
+{
+    S6259 s;
+    s.prop = 1;
+}
+
+/******************************************/
+
+void main()
+{
+    test1();
+    test6259();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/property2.d b/gcc/testsuite/gdc.test/runnable/property2.d
new file mode 100644
index 00000000000..0735b93509d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/property2.d
@@ -0,0 +1,611 @@
+// PERMUTE_ARGS: -property
+
+extern (C) int printf(const char* fmt, ...);
+
+// Is -property option specified?
+enum enforceProperty = !__traits(compiles, {
+    int prop(){ return 1; }
+    int n = prop;
+});
+
+/*******************************************/
+
+template select(alias v1, alias v2)
+{
+    static if (enforceProperty)
+        enum select = v1;
+    else
+        enum select = v2;
+}
+
+struct Test(int N)
+{
+    int value;
+    int getset;
+
+    static if (N == 0)
+    {
+        ref foo(){ getset = 1; return value; }
+
+        enum result = select!(0, 1);
+        // -property    test.d(xx): Error: not a property foo
+        // (no option)  prints "getter"
+    }
+    static if (N == 1)
+    {
+        ref foo(int x){ getset = 2; value = x; return value; }
+
+        enum result = select!(0, 2);
+        // -property    test.d(xx): Error: not a property foo
+        // (no option)  prints "setter"
+    }
+    static if (N == 2)
+    {
+        @property ref foo(){ getset = 1; return value; }
+
+        enum result = select!(1, 1);
+        // -property    prints "getter"
+        // (no option)  prints "getter"
+    }
+    static if (N == 3)
+    {
+        @property ref foo(int x){ getset = 2; value = x; return value; }
+
+        enum result = select!(2, 2);
+        // -property    prints "setter"
+        // (no option)  prints "setter"
+    }
+
+
+    static if (N == 4)
+    {
+        ref foo()     { getset = 1; return value; }
+        ref foo(int x){ getset = 2; value = x; return value; }
+
+        enum result = select!(0, 2);
+        // -property    test.d(xx): Error: not a property foo
+        // (no option)  prints "setter"
+    }
+    static if (N == 5)
+    {
+        @property ref foo()     { getset = 1; return value; }
+                  ref foo(int x){ getset = 2; value = x; return value; }
+
+        enum result = select!(0, 0);
+        // -property    test.d(xx): Error: cannot overload both property and non-property functions
+        // (no option)  test.d(xx): Error: cannot overload both property and non-property functions
+    }
+    static if (N == 6)
+    {
+                  ref foo()     { getset = 1; return value; }
+        @property ref foo(int x){ getset = 2; value = x; return value; }
+
+        enum result = select!(0, 0);
+        // -property    test.d(xx): Error: cannot overload both property and non-property functions
+        // (no option)  test.d(xx): Error: cannot overload both property and non-property functions
+    }
+    static if (N == 7)
+    {
+        @property ref foo()     { getset = 1; return value; }
+        @property ref foo(int x){ getset = 2; value = x; return value; }
+
+        enum result = select!(2, 2);
+        // -property    prints "setter"
+        // (no option)  prints "setter"
+    }
+}
+
+template seq(T...)
+{
+    alias T seq;
+}
+template iota(int begin, int end)
+    if (begin <= end)
+{
+    static if (begin == end)
+        alias seq!() iota;
+    else
+        alias seq!(begin, iota!(begin+1, end)) iota;
+}
+
+void test1()
+{
+    foreach (N; iota!(0, 8))
+    {
+        printf("%d: ", N);
+
+        Test!N s;
+        static if (Test!N.result == 0)
+        {
+            static assert(!is(typeof({ s.foo = 1; })));
+            printf("compile error\n");
+        }
+        else
+        {
+            s.foo = 1;
+            if (s.getset == 1)
+                printf("getter\n");
+            else
+                printf("setter\n");
+            assert(s.getset == Test!N.result);
+        }
+    }
+}
+
+/*******************************************/
+// 7722
+
+class Foo7722 {}
+void spam7722(Foo7722 f) {}
+
+void test7722()
+{
+    auto f = new Foo7722;
+    static if (enforceProperty)
+        static assert(!__traits(compiles, f.spam7722));
+    else
+        f.spam7722;
+}
+
+/*******************************************/
+
+@property void check(alias v1, alias v2, alias dg)()
+{
+    void checkImpl(alias v)()
+    {
+        static if (v == 0)
+            static assert(!__traits(compiles, dg(0)));
+        else
+            assert(dg(0) == v);
+    }
+
+    static if (enforceProperty)
+        checkImpl!(v1)();
+    else
+        checkImpl!(v2)();
+}
+
+struct S {}
+
+int foo(int n)          { return 1; }
+int foo(int n, int m)   { return 2; }
+int goo(int[] a)        { return 1; }
+int goo(int[] a, int m) { return 2; }
+int bar(S s)            { return 1; }
+int bar(S s, int n)     { return 2; }
+
+int baz(X)(X x)         { return 1; }
+int baz(X)(X x, int n)  { return 2; }
+
+int temp;
+ref int boo(int n)      { return temp; }
+ref int coo(int[] a)    { return temp; }
+ref int mar(S s)        { return temp; }
+
+ref int maz(X)(X x)     { return temp; }
+
+void test7722a()
+{
+    int n;
+    int[] a;
+    S s;
+
+    check!(1, 1, x =>    foo(4)     );      check!(1, 1, x =>    baz(4)     );
+    check!(1, 1, x =>  4.foo()      );      check!(1, 1, x =>  4.baz()      );
+    check!(0, 1, x =>  4.foo        );      check!(0, 1, x =>  4.baz        );
+    check!(2, 2, x =>    foo(4, 2)  );      check!(2, 2, x =>    baz(4, 2)  );
+    check!(2, 2, x =>  4.foo(2)     );      check!(2, 2, x =>  4.baz(2)     );
+    check!(0, 2, x => (4.foo = 2)   );      check!(0, 2, x => (4.baz = 2)   );
+
+    check!(1, 1, x =>    goo(a)     );      check!(1, 1, x =>    baz(a)     );
+    check!(1, 1, x =>  a.goo()      );      check!(1, 1, x =>  a.baz()      );
+    check!(0, 1, x =>  a.goo        );      check!(0, 1, x =>  a.baz        );
+    check!(2, 2, x =>    goo(a, 2)  );      check!(2, 2, x =>    baz(a, 2)  );
+    check!(2, 2, x =>  a.goo(2)     );      check!(2, 2, x =>  a.baz(2)     );
+    check!(0, 2, x => (a.goo = 2)   );      check!(0, 2, x => (a.baz = 2)   );
+
+    check!(1, 1, x =>    bar(s)     );      check!(1, 1, x =>    baz(s)     );
+    check!(1, 1, x =>  s.bar()      );      check!(1, 1, x =>  s.baz()      );
+    check!(0, 1, x =>  s.bar        );      check!(0, 1, x =>  s.baz        );
+    check!(2, 2, x =>    bar(s, 2)  );      check!(2, 2, x =>    baz(s, 2)  );
+    check!(2, 2, x =>  s.bar(2)     );      check!(2, 2, x =>  s.baz(2)     );
+    check!(0, 2, x => (s.bar = 2)   );      check!(0, 2, x => (s.baz = 2)   );
+
+    check!(2, 2, x => (  boo(4) = 2));      check!(2, 2, x => (  maz(4) = 2));
+    check!(0, 2, x => (4.boo    = 2));      check!(0, 2, x => (4.maz    = 2));
+    check!(2, 2, x => (  coo(a) = 2));      check!(2, 2, x => (  maz(a) = 2));
+    check!(0, 2, x => (a.coo    = 2));      check!(0, 2, x => (a.maz    = 2));
+    check!(2, 2, x => (  mar(s) = 2));      check!(2, 2, x => (  maz(s) = 2));
+    check!(0, 2, x => (s.mar    = 2));      check!(0, 2, x => (s.maz    = 2));
+}
+
+int hoo(T)(int n)          { return 1; }
+int hoo(T)(int n, int m)   { return 2; }
+int koo(T)(int[] a)        { return 1; }
+int koo(T)(int[] a, int m) { return 2; }
+int var(T)(S s)            { return 1; }
+int var(T)(S s, int n)     { return 2; }
+
+int vaz(T, X)(X x)         { return 1; }
+int vaz(T, X)(X x, int n)  { return 2; }
+
+//int temp;
+ref int voo(T)(int n)      { return temp; }
+ref int woo(T)(int[] a)    { return temp; }
+ref int nar(T)(S s)        { return temp; }
+
+ref int naz(T, X)(X x)     { return temp; }
+
+void test7722b()
+{
+    int n;
+    int[] a;
+    S s;
+
+    check!(1, 1, x =>    hoo!int(4)     );  check!(1, 1, x =>    vaz!int(4)     );
+    check!(1, 1, x =>  4.hoo!int()      );  check!(1, 1, x =>  4.vaz!int()      );
+    check!(0, 1, x =>  4.hoo!int        );  check!(0, 1, x =>  4.vaz!int        );
+    check!(2, 2, x =>    hoo!int(4, 2)  );  check!(2, 2, x =>    vaz!int(4, 2)  );
+    check!(2, 2, x =>  4.hoo!int(2)     );  check!(2, 2, x =>  4.vaz!int(2)     );
+    check!(0, 2, x => (4.hoo!int = 2)   );  check!(0, 2, x => (4.vaz!int = 2)   );
+
+    check!(1, 1, x =>    koo!int(a)     );  check!(1, 1, x =>    vaz!int(a)     );
+    check!(1, 1, x =>  a.koo!int()      );  check!(1, 1, x =>  a.vaz!int()      );
+    check!(0, 1, x =>  a.koo!int        );  check!(0, 1, x =>  a.vaz!int        );
+    check!(2, 2, x =>    koo!int(a, 2)  );  check!(2, 2, x =>    vaz!int(a, 2)  );
+    check!(2, 2, x =>  a.koo!int(2)     );  check!(2, 2, x =>  a.vaz!int(2)     );
+    check!(0, 2, x => (a.koo!int = 2)   );  check!(0, 2, x => (a.vaz!int = 2)   );
+
+    check!(1, 1, x =>    var!int(s)     );  check!(1, 1, x =>    vaz!int(s)     );
+    check!(1, 1, x =>  s.var!int()      );  check!(1, 1, x =>  s.vaz!int()      );
+    check!(0, 1, x =>  s.var!int        );  check!(0, 1, x =>  s.vaz!int        );
+    check!(2, 2, x =>    var!int(s, 2)  );  check!(2, 2, x =>    vaz!int(s, 2)  );
+    check!(2, 2, x =>  s.var!int(2)     );  check!(2, 2, x =>  s.vaz!int(2)     );
+    check!(0, 2, x => (s.var!int = 2)   );  check!(0, 2, x => (s.vaz!int = 2)   );
+
+    check!(2, 2, x => (  voo!int(4) = 2));  check!(2, 2, x => (  naz!int(4) = 2));
+    check!(0, 2, x => (4.voo!int    = 2));  check!(0, 2, x => (4.naz!int    = 2));
+    check!(2, 2, x => (  woo!int(a) = 2));  check!(2, 2, x => (  naz!int(a) = 2));
+    check!(0, 2, x => (a.woo!int    = 2));  check!(0, 2, x => (a.naz!int    = 2));
+    check!(2, 2, x => (  nar!int(s) = 2));  check!(2, 2, x => (  naz!int(s) = 2));
+    check!(0, 2, x => (s.nar!int    = 2));  check!(0, 2, x => (s.naz!int    = 2));
+}
+
+/*******************************************/
+// 7174
+
+void test7174()
+{
+    @property bool foo7174() { return true; }
+    static if (foo7174) {}
+}
+
+/***************************************************/
+// 7274
+
+@property foo7274(){ return "test"; }
+@property bar7274(){ return "kernel32.lib"; }
+
+pragma(msg, "decl: ", foo7274);   // print "decl: foo", not "decl: test"
+version(Windows) pragma(lib, bar7274); // Error: pragma lib string expected for library name, not 'bar'
+
+void test7274()
+{
+    pragma(msg, "stmt: ", foo7274);  // print "stmt: foo", not "stmt: test"
+    //pragma(lib, bar);   // Error: pragma(lib) not allowed as statement
+}
+
+/***************************************************/
+// 7275
+
+void test7275()
+{
+    @property int bar1() { return 0; }
+    @property int bar2() { return 1; }
+    @property int bar3() { return 2; }
+
+    switch (0){
+        case bar1:  break;
+        case bar2: ..
+        case bar3:  break;
+        default:    break;
+    }
+}
+
+/*****************************************/
+// 7538
+
+void test7538()
+{
+    struct P
+    {
+        @property long pr() { return 1; }
+        @property void pr(int) {}
+
+        @property long a1()() { return 1; }
+        @property void a1()(int) {}
+        template a2() { @property long a2() { return 1; } }
+        template a2() { @property void a2(int) {} }
+        template a3() { long a3() @property { return 1; } }
+        template a3() { void a3(int) @property {} }
+
+      static
+      {
+        @property long b1()() { return 1; }
+        @property void b1()(int) {}
+        template b2() { @property long b2() { return 1; } }
+        template b2() { @property void b2(int) {} }
+        template b3() { long b3() @property { return 1; } }
+        template b3() { void b3(int) @property {} }
+      }
+
+        @property long c1(T)()    { return 1; }
+        @property long c1(T)(int) { return 1; }
+        template c2(T) { @property long c2() { return 1; } }
+        template c2(T) { @property void c2(int) {} }
+        template c3(T) { long c3() @property { return 1; } }
+        template c3(T) { void c3(int) @property {} }
+
+      static
+      {
+        @property long d1(T)() { return 1; }
+        @property void d1(T)(int) {}
+        template d2(T) { @property long d2() { return 1; } }
+        template d2(T) { @property void d2(int) {} }
+        template d3(T) { long d3() @property { return 1; } }
+        template d3(T) { void d3(int) @property {} }
+      }
+
+        void test()
+        {
+            // TOKvar
+            static assert(is(typeof(pr) == long));
+
+            // TOKtemplate
+            static assert(is(typeof(b1) == long));
+            static assert(is(typeof(b2) == long));
+            static assert(is(typeof(b3) == long));
+
+            // TOKimport
+            static assert(is(typeof(d1!int) == long));
+            static assert(is(typeof(d2!int) == long));
+            static assert(is(typeof(d3!int) == long));
+        }
+    }
+    P p;
+    {
+        // TOKdotvar
+        static assert(is(typeof(p.pr) == long));
+
+        // TOKdottd
+        static assert(is(typeof(p.a1) == long));
+        static assert(is(typeof(p.a2) == long));
+        static assert(is(typeof(p.a3) == long));
+
+        // TOKimport
+        static assert(is(typeof(P.b1) == long));
+        static assert(is(typeof(P.b2) == long));
+        static assert(is(typeof(P.b3) == long));
+
+        // TOKdotti;
+        static assert(is(typeof(p.c1!int) == long));
+        static assert(is(typeof(p.c2!int) == long));
+        static assert(is(typeof(p.c3!int) == long));
+    }
+
+    struct F
+    {
+        long fn() { return 1; }
+        void fn(int) {}
+
+        long a1()() { return 1; }
+        void a1()(int) {}
+        template a2() { long a2() { return 1; } }
+        template a2() { void a2(int) {} }
+
+      static
+      {
+        long b1()() { return 1; }
+        void b1()(int) {}
+        template b2() { long b2() { return 1; } }
+        template b2() { void b2(int) {} }
+      }
+
+        long c1(T)()    { return 1; }
+        long c1(T)(int) { return 1; }
+        template c2(T) { long c2() { return 1; } }
+        template c2(T) { void c2(int) {} }
+
+      static
+      {
+        long d1(T)() { return 1; }
+        void d1(T)(int) {}
+        template d2(T) { long d2() { return 1; } }
+        template d2(T) { void d2(int) {} }
+      }
+
+        void test()
+        {
+            // TOKvar
+            static assert( is(typeof(fn) == function));
+
+            // TOKtemplate
+            static assert(!is(typeof(b1) == long));
+            static assert(!is(typeof(b2) == long));
+
+            // TOKimport
+            static assert(!is(typeof(d1!int) == long));
+            static assert(!is(typeof(d2!int) == long));
+        }
+    }
+    F f;
+    {
+        // TOKdotvar
+        static assert(is( typeof(f.fn) == function));
+
+        // TOKdottd
+        static assert(!is(typeof(f.a1) == long));
+        static assert(!is(typeof(f.a2) == long));
+
+        // TOKimport
+        static assert(!is(typeof(F.b1) == long));
+        static assert(!is(typeof(F.b2) == long));
+
+        // TOKdotti;
+        static assert(!is(typeof(f.c1!int) == long));
+        static assert(!is(typeof(f.c2!int) == long));
+    }
+}
+
+/*****************************************/
+// 8251
+
+struct S8251
+{
+    static @property int min() { return 123; }
+}
+@property int T8251_Min() { return 456; }
+
+template T8251a (int v)             { int T8251a  = v; }
+
+template T8251b1(int v = S8251.min) { int T8251b1 = v; }
+template T8251b2(int v = T8251_Min) { int T8251b2 = v; }
+
+template T8251c1(int v : S8251.min) { int T8251c1 = v; }
+template T8251c2(int v : T8251_Min) { int T8251c2 = v; }
+
+void test8251()
+{
+    static assert(S8251.min == 123);    // OK
+    static assert(T8251_Min == 456);    // OK
+    int a0 = T8251a!(S8251.min());      // OK
+    int b0 = T8251a!(T8251_Min());      // OK
+
+    // TemplateValueParameter
+    int a1 = T8251a!(S8251.min);        // NG
+    int b1 = T8251a!(T8251_Min);        // NG
+
+    // TemplateValueParameterDefault
+    int a2 = T8251b1!();                // NG
+    int b2 = T8251b2!();                // NG
+
+    // TemplateValueParameterSpecialization
+    int a3 = T8251c1!(123);             // NG
+    int b3 = T8251c2!(456);             // NG
+}
+
+/*****************************************/
+// 9063
+
+@property bool foo9063(){ return true; }
+static assert(foo9063);
+
+/*****************************************/
+// 9234
+
+class Fizz9234
+{
+    void bar() {}
+    Foo9234!bar foobar;
+}
+
+struct Foo9234(alias F) {}
+struct Foo9234(string thunk) {}
+
+/*****************************************/
+// 10103
+
+mixin template Getter10103()
+{
+    @property auto foo() { return v; }
+    @property auto bar()() { return v; }
+    @property auto baz(T)() { return v; }
+
+    static @property auto goo() { return 1; }
+}
+
+mixin template Setter10103()
+{
+    @property void foo(int x) { v = x; }
+    @property void bar()(int x) { v = x; }
+    @property void baz(T)(int x) { v = x; }
+
+    static @property void goo(int x) {}
+}
+
+struct Foo10103
+{
+    int v;
+    mixin Getter10103!();
+    mixin Setter10103!();
+}
+
+void test10103()
+{
+    auto f = Foo10103(4);
+
+    f.foo;
+    f.foo = 3;
+
+    f.bar;
+    f.bar = 3;
+
+    f.baz!int;
+    f.baz!int = 3;
+
+    Foo10103.goo = 3;
+}
+
+/*****************************************/
+// 10197
+
+template OriginalType10197(T)
+{
+    static if (is(T U == enum))
+        alias OriginalType10197 = U;
+    else
+        static assert(0);
+}
+
+void test10197()
+{
+    enum E : int { F = -20 }
+    struct S
+    {
+        int val;
+        @trusted @property T as(T)()
+        if (is(T == int) && !is(T == enum))
+        {
+            return cast(T)(val);
+        }
+        @trusted @property T as(T)()
+        if (is(T == enum))
+        {
+            return cast(T)as!(OriginalType10197!T);
+        }
+    }
+
+    S val = S(-20);
+    assert(val.as!int == -20);
+    assert(val.as!E == E.F);
+}
+
+/*****************************************/
+
+int main()
+{
+    test1();
+    test7722();
+    test7722a();
+    test7722b();
+    test7174();
+    test7274();
+    test7275();
+    test7538();
+    test8251();
+    test10103();
+    test10197();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/s2ir.d b/gcc/testsuite/gdc.test/runnable/s2ir.d
new file mode 100644
index 00000000000..ca832d262d0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/s2ir.d
@@ -0,0 +1,97 @@
+
+import std.stdio;
+
+/***********************************/
+
+void test1()
+{
+    int i;
+    __gshared int j;
+
+    version (D_InlineAsm_X86)
+    {
+        asm
+        {
+            naked       ;
+            mov EAX, i  ;
+        }
+      version(D_PIC)
+      {}
+      else
+      {
+        asm
+        {
+            mov EAX, j  ;
+        }
+      }
+    }
+}
+
+/***********************************/
+
+int main()
+{
+    for (int i = 0; ; i++)
+    {
+        if (i == 10)
+            break;
+    }
+
+    string[] a = new string[3];
+    a[0] = "hello";
+    a[1] = "world";
+    a[2] = "foo";
+
+    foreach (string s; a)
+        writefln(s);
+
+    switch (1)
+    {
+        default:
+            break;
+    }
+
+    switch ("foo"w)
+    {
+        case "foo":
+            break;
+        default: assert(0);
+    }
+
+    switch (1)
+    {
+        case 1:
+            try
+            {
+                goto default;
+            }
+            catch (Throwable o)
+            {
+            }
+            break;
+
+        default:
+            break;
+    }
+
+    switch (1)
+    {
+        case 1:
+            try
+            {
+                goto case 2;
+            }
+            catch (Throwable o)
+            {
+            }
+            break;
+
+        case 2:
+            break;
+
+        default: assert(0);
+    }
+
+    writefln("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/sctor.d b/gcc/testsuite/gdc.test/runnable/sctor.d
new file mode 100644
index 00000000000..8918d911e64
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/sctor.d
@@ -0,0 +1,382 @@
+// REQUIRED_ARGS:
+// PERMUTE_ARGS: -w -d -de -dw
+
+extern(C) int printf(const char*, ...);
+
+/***************************************************/
+// mutable field
+
+struct S1A
+{
+    int v;
+    this(int)
+    {
+        v = 1;
+        v = 2;  // multiple initialization
+    }
+}
+
+struct S1B
+{
+    int v;
+    this(int)
+    {
+        if (true) v = 1; else v = 2;
+        v = 3;  // multiple initialization
+    }
+    this(long)
+    {
+        if (true) v = 1;
+        v = 3;  // multiple initialization
+    }
+    this(string)
+    {
+        if (true) {} else v = 2;
+        v = 3;  // multiple initialization
+    }
+}
+
+struct S1C
+{
+    int v;
+    this(int)
+    {
+        true ? (v = 1) : (v = 2);
+        v = 3;  // multiple initialization
+    }
+    this(long)
+    {
+        auto x = true ? (v = 1) : 2;
+        v = 3;  // multiple initialization
+    }
+    this(string)
+    {
+        auto x = true ? 1 : (v = 2);
+        v = 3;  // multiple initialization
+    }
+}
+
+/***************************************************/
+// with control flow
+
+struct S2
+{
+    immutable int v;
+    immutable int w;
+    int x;
+    this(int)
+    {
+        if (true) v = 1;
+        else      v = 2;
+
+        true ? (w = 1) : (w = 2);
+
+        x = 1;  // initialization
+    L:  x = 2;  // assignment after labels
+    }
+    this(long n)
+    {
+        if (n > 0)
+            return;
+        v = 1;  // skipped initialization
+
+        // w skipped initialization
+
+        x = 1;  // initialization
+        foreach (i; 0..1) x = 2;  // assignment in loops
+    }
+}
+
+/***************************************************/
+// with immutable constructor
+
+struct S3
+{
+    int v;
+    int w;
+    this(int) immutable
+    {
+        if (true) v = 1;
+        else      v = 2;
+
+        true ? (w = 1) : (w = 2);
+    }
+}
+
+/***************************************************/
+// in typeof
+
+struct S4
+{
+    immutable int v;
+    this(int)
+    {
+        static assert(is(typeof(v = 1)));
+        v = 1;
+    }
+}
+
+/***************************************************/
+// 8117
+
+struct S8117
+{
+    @disable this();
+    this(int) {}
+}
+
+class C8117
+{
+    S8117 s = S8117(1);
+}
+
+void test8117()
+{
+    auto t = new C8117();
+}
+
+/***************************************************/
+// 9665
+
+struct X9665
+{
+    static uint count;
+    ulong payload;
+    this(int n) { payload = n; count += 1; }
+    this(string s) immutable { payload = s.length; count += 10; }
+    void opAssign(X9665 x) { payload = 100; count += 100; }
+}
+
+struct S9665
+{
+              X9665 mval;
+    immutable X9665 ival;
+    this(int n)
+    {
+        X9665.count = 0;
+        mval = X9665(n);                // 1st, initializing
+        ival = immutable X9665("hi");   // 1st, initializing
+        mval = X9665(1);                // 2nd, assignment
+        static assert(!__traits(compiles, ival = immutable X9665(1)));  // 2nd, assignment
+        //printf("X9665.count = %d\n", X9665.count);
+        assert(X9665.count == 112);
+    }
+    this(int[])
+    {
+        X9665.count = 0;
+        mval = 1;       // 1st, initializing (implicit constructor call)
+        ival = "hoo";   // ditto
+        assert(X9665.count == 11);
+    }
+}
+
+void test9665()
+{
+    S9665 s1 = S9665(1);
+    assert(s1.mval.payload == 100);
+    assert(s1.ival.payload == 2);
+
+    S9665 s2 = S9665([]);
+    assert(s2.mval.payload == 1);
+    assert(s2.ival.payload == 3);
+}
+
+/***************************************************/
+// 11246
+
+struct Foo11246
+{
+    static int ctor = 0;
+    static int dtor = 0;
+    this(int i)
+    {
+        ++ctor;
+    }
+
+    ~this()
+    {
+        ++dtor;
+    }
+}
+
+struct Bar11246
+{
+    Foo11246 foo;
+
+    this(int)
+    {
+        foo = Foo11246(5);
+        assert(Foo11246.ctor == 1);
+        assert(Foo11246.dtor == 0);
+    }
+}
+
+void test11246()
+{
+    {
+        auto bar = Bar11246(1);
+        assert(Foo11246.ctor == 1);
+        assert(Foo11246.dtor == 0);
+    }
+    assert(Foo11246.ctor == 1);
+    assert(Foo11246.dtor == 1);
+}
+
+/***************************************************/
+// 13515
+
+Object[string][100] aa13515;
+
+static this()
+{
+    aa13515[5]["foo"] = null;
+}
+
+struct S13515
+{
+    Object[string][100] aa;
+
+    this(int n)
+    {
+        aa[5]["foo"] = null;
+    }
+}
+
+void test13515()
+{
+    assert(aa13515[5].length == 1);
+    assert(aa13515[5]["foo"] is null);
+
+    auto s = S13515(1);
+    assert(s.aa[5].length == 1);
+    assert(s.aa[5]["foo"] is null);
+}
+
+/***************************************************/
+// 14409
+
+class B14409 { this(int) {} }
+class C14409 : B14409
+{
+    this(int n)
+    {
+        if (true)
+            super(n);
+        else
+            assert(0);
+    }
+}
+
+/***************************************************/
+// 14376
+
+auto map14376()
+{
+    return MapResult14376!(e => 0)();
+}
+
+struct MapResult14376(alias pred)
+{
+    @property int front() { return pred(0); }
+}
+
+struct S14376
+{
+    typeof(map14376()) x;
+
+    this(int dummy)
+    {
+        if (true)
+            this.x = map14376();
+        else
+            assert(0);
+    }
+}
+
+/***************************************************/
+// 14351
+
+class B14351
+{
+    this(inout int[]) inout { }
+}
+
+class D14351a : B14351
+{
+    this(int[] arr) { super(arr); }
+}
+
+class D14351b : B14351
+{
+    this(const int[] arr) const { super(arr); }
+}
+
+class D14351c : B14351
+{
+    this(inout int[] arr) inout { super(arr); }
+}
+
+/***************************************************/
+// 14944
+
+static int[2] tbl14944;
+
+static this()
+{
+    foreach (ref v; tbl14944)
+    {
+        // This is an initialization of referenced memory
+        // rather than the initialization of the reference.
+        v = 1;
+    }
+}
+
+void test14944()
+{
+    assert(tbl14944[0] == 1);
+}
+
+/***************************************************/
+// 15258 - a field initialization affects other overlapped fields
+
+class C15258
+{
+    this(const char* result)
+    {
+        this.result = result;
+    }
+
+    union
+    {
+        const char** results;
+        const char* result;
+    }
+}
+
+/***************************************************/
+// 15665
+
+scope class C15665 (V)
+{
+    this () {}
+}
+
+void test15665()
+{
+    scope foo = new C15665!int;
+}
+
+/***************************************************/
+
+int main()
+{
+    test8117();
+    test9665();
+    test11246();
+    test13515();
+    test14944();
+    test15665();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/sdtor.d b/gcc/testsuite/gdc.test/runnable/sdtor.d
new file mode 100644
index 00000000000..dc0fb9df54a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/sdtor.d
@@ -0,0 +1,4522 @@
+
+import core.vararg;
+
+extern (C) int printf(const(char*) fmt, ...);
+
+template TypeTuple(T...) { alias TypeTuple = T; }
+
+/**********************************/
+
+int sdtor;
+
+struct S1
+{
+    ~this() { printf("~S()\n"); sdtor++; }
+}
+
+void test1()
+{
+    S1* s = new S1();
+    delete s;
+    assert(sdtor == 1);
+}
+
+/**********************************/
+
+int sdtor2;
+
+struct S2
+{
+    ~this() { printf("~S2()\n"); sdtor2++; }
+    delete(void* p) { assert(sdtor2 == 1); printf("S2.delete()\n"); sdtor2++; }
+}
+
+void test2()
+{
+    S2* s = new S2();
+    delete s;
+    assert(sdtor2 == 2);
+}
+
+/**********************************/
+
+int sdtor3;
+
+struct S3
+{   int a;
+    ~this() { printf("~S3()\n"); sdtor3++; assert(a == 3); }
+}
+
+struct T3
+{
+    int i;
+    S3 s;
+}
+
+void test3()
+{
+    T3* s = new T3();
+    s.s.a = 3;
+    delete s;
+    assert(sdtor3 == 1);
+}
+
+/**********************************/
+
+int sdtor4;
+
+struct S4
+{   int a = 3;
+    ~this()
+    {   printf("~S4()\n");
+        if (a == 4)
+            assert(sdtor4 == 2);
+        else
+        {   assert(a == 3);
+            assert(sdtor4 == 1);
+        }
+        sdtor4++;
+    }
+}
+
+struct T4
+{
+    int i;
+    S4 s;
+    ~this() { printf("~T4()\n"); assert(sdtor4 == 0); sdtor4++; }
+    S4 t;
+}
+
+void test4()
+{
+    T4* s = new T4();
+    s.s.a = 4;
+    delete s;
+    assert(sdtor4 == 3);
+}
+
+/**********************************/
+
+int sdtor5;
+
+template M5()
+{  ~this()
+   {
+        printf("~M5()\n"); assert(sdtor5 == 1); sdtor5++;
+   }
+}
+
+struct T5
+{
+    mixin M5 m;
+    ~this() { printf("~T5()\n"); assert(sdtor5 == 0); sdtor5++; }
+}
+
+void test5()
+{
+    T5* s = new T5();
+    delete s;
+    assert(sdtor5 == 2);
+}
+
+/**********************************/
+
+int sdtor6;
+
+struct S6
+{   int b = 7;
+    ~this()
+    {
+        printf("~S6()\n"); assert(b == 7); assert(sdtor6 == 1); sdtor6++;
+    }
+}
+
+class T6
+{
+    int a = 3;
+    S6 s;
+    ~this() { printf("~T6()\n"); assert(a == 3); assert(sdtor6 == 0); sdtor6++; }
+}
+
+void test6()
+{
+    T6 s = new T6();
+    delete s;
+    assert(sdtor6 == 2);
+}
+
+/**********************************/
+
+int sdtor7;
+
+struct S7
+{   int b = 7;
+    ~this()
+    {
+        printf("~S7()\n");
+        assert(b == 7);
+        assert(sdtor7 >= 1 && sdtor7 <= 3);
+        sdtor7++;
+    }
+}
+
+struct T7
+{
+    int a = 3;
+    S7[3] s;
+    ~this()
+    {   printf("~T7() %d\n", sdtor7);
+        assert(a == 3);
+        assert(sdtor7 == 0);
+        sdtor7++;
+    }
+}
+
+void test7()
+{
+    T7* s = new T7();
+    delete s;
+    assert(sdtor7 == 4);
+}
+
+/**********************************/
+
+int sdtor8;
+
+struct S8
+{   int b = 7;
+    int c;
+    ~this()
+    {
+        printf("~S8() %d\n", sdtor8);
+        assert(b == 7);
+        assert(sdtor8 == c);
+        sdtor8++;
+    }
+}
+
+void test8()
+{
+    S8[] s = new S8[3];
+    s[0].c = 2;
+    s[1].c = 1;
+    s[2].c = 0;
+    delete s;
+    assert(sdtor8 == 3);
+}
+
+/**********************************/
+
+int sdtor9;
+
+struct S9
+{   int b = 7;
+    ~this()
+    {
+        printf("~S9() %d\n", sdtor9);
+        assert(b == 7);
+        sdtor9++;
+    }
+}
+
+void test9()
+{
+    {
+    S9 s;
+    }
+    assert(sdtor9 == 1);
+}
+
+/**********************************/
+
+int sdtor10;
+
+struct S10
+{   int b = 7;
+    int c;
+    ~this()
+    {
+        printf("~S10() %d\n", sdtor10);
+        assert(b == 7);
+        assert(sdtor10 == c);
+        sdtor10++;
+    }
+}
+
+void test10()
+{
+    {
+    S10[3] s;
+    s[0].c = 2;
+    s[1].c = 1;
+    s[2].c = 0;
+    }
+    assert(sdtor10 == 3);
+}
+
+/**********************************/
+
+int sdtor11;
+
+template M11()
+{   ~this()
+    {
+        printf("~M11()\n"); assert(sdtor11 == 1); sdtor11++;
+    }
+}
+
+class T11
+{
+    mixin M11 m;
+    ~this() { printf("~T11()\n"); assert(sdtor11 == 0); sdtor11++; }
+}
+
+void test11()
+{
+    T11 s = new T11();
+    delete s;
+    assert(sdtor11 == 2);
+}
+
+/**********************************/
+
+int sdtor12;
+
+struct S12
+{   int a = 3;
+    ~this() { printf("~S12() %d\n", sdtor12); sdtor12++; }
+}
+
+void foo12(S12 s)
+{
+}
+
+void test12()
+{
+    {
+    S12 s;
+    foo12(s);
+    s.a = 4;
+    }
+    assert(sdtor12 == 2);
+}
+
+/**********************************/
+
+struct S13
+{   int a = 3;
+    int opAssign(S13 s)
+    {
+        printf("S13.opAssign(%p)\n", &this);
+        a = 4;
+        return s.a + 2;
+    }
+}
+
+void test13()
+{
+    S13 s;
+    S13 t;
+    assert((s = t) == 5);
+    assert(s.a == 4);
+}
+
+/**********************************/
+
+struct S14
+{   int a = 3;
+    int opAssign(ref S14 s)
+    {
+        printf("S14.opAssign(%p)\n", &this);
+        a = 4;
+        return s.a + 2;
+    }
+}
+
+void test14()
+{
+    S14 s;
+    S14 t;
+    assert((s = t) == 5);
+    assert(s.a == 4);
+}
+
+/**********************************/
+
+struct S15
+{   int a = 3;
+    int opAssign(ref const S15 s)
+    {
+        printf("S15.opAssign(%p)\n", &this);
+        a = 4;
+        return s.a + 2;
+    }
+}
+
+void test15()
+{
+    S15 s;
+    S15 t;
+    assert((s = t) == 5);
+    assert(s.a == 4);
+}
+
+/**********************************/
+
+struct S16
+{   int a = 3;
+    int opAssign(S16 s, ...)
+    {
+        printf("S16.opAssign(%p)\n", &this);
+        a = 4;
+        return s.a + 2;
+    }
+}
+
+void test16()
+{
+    S16 s;
+    S16 t;
+    assert((s = t) == 5);
+    assert(s.a == 4);
+}
+
+/**********************************/
+
+struct S17
+{   int a = 3;
+    int opAssign(...)
+    {
+        printf("S17.opAssign(%p)\n", &this);
+        a = 4;
+        return 5;
+    }
+}
+
+void test17()
+{
+    S17 s;
+    S17 t;
+    assert((s = t) == 5);
+    assert(s.a == 4);
+}
+
+/**********************************/
+
+struct S18
+{   int a = 3;
+    int opAssign(S18 s, int x = 7)
+    {
+        printf("S18.opAssign(%p)\n", &this);
+        a = 4;
+        assert(x == 7);
+        return s.a + 2;
+    }
+}
+
+void test18()
+{
+    S18 s;
+    S18 t;
+    assert((s = t) == 5);
+    assert(s.a == 4);
+}
+
+/**********************************/
+
+struct S19
+{
+    int a,b,c,d;
+    this(this) { printf("this(this) %p\n", &this); }
+    ~this() { printf("~this() %p\n", &this); }
+}
+
+S19 foo19()
+{
+    S19 s;
+    void bar() { s.a++; }
+    bar();
+    return s;
+}
+
+void test19()
+{
+    S19 t = foo19();
+    printf("-main()\n");
+}
+
+/**********************************/
+
+struct S20
+{
+    static char[] r;
+    int a,b,c=2,d;
+    this(this) { printf("this(this) %p\n", &this); r ~= '='; }
+    ~this() { printf("~this() %p\n", &this); r ~= '~'; }
+}
+
+void foo20()
+{
+    S20 s;
+    S20[3] a;
+    assert(S20.r == "");
+    a = s;
+    assert(S20.r == "=~=~=~");
+}
+
+void test20()
+{
+    foo20();
+    assert(S20.r == "=~=~=~~~~~");
+    printf("-main()\n");
+}
+
+/**********************************/
+
+struct S21
+{
+    static char[] r;
+    int a,b,c=2,d;
+    this(this) { printf("this(this) %p\n", &this); r ~= '='; }
+    ~this() { printf("~this() %p\n", &this); r ~= '~'; }
+}
+
+void foo21()
+{
+    S21 s;
+    S21[3] a = s;
+    assert(S21.r == "===");
+    S21.r = null;
+    S21[3][2] b = s;
+    assert(S21.r == "======");
+    S21.r = null;
+}
+
+void test21()
+{
+    foo21();
+    assert(S21.r == "~~~~~~~~~~");
+    printf("-main()\n");
+}
+
+/**********************************/
+
+struct S22
+{
+    static char[] r;
+    int a,b,c=2,d;
+    this(this) { printf("this(this) %p\n", &this); r ~= '='; }
+    ~this() { printf("~this() %p\n", &this); r ~= '~'; }
+}
+
+void foo22()
+{
+    S22[3] s;
+    S22[3][2] a;
+    assert(S22.r == "");
+    a = s;
+    assert(S22.r == "===~~~===~~~");
+    S22.r = null;
+}
+
+void test22()
+{
+    foo22();
+    assert(S22.r == "~~~~~~~~~");
+    printf("-main()\n");
+}
+
+
+/************************************************/
+
+struct S23
+{
+    int m = 4, n, o, p, q;
+
+    this(int x)
+    {
+        printf("S23(%d)\n", x);
+        assert(x == 3);
+        assert(m == 4 && n == 0 && o == 0 && p == 0 && q == 0);
+        q = 7;
+    }
+}
+
+void test23()
+{
+  {
+    auto s = S23(3);
+    printf("s.m = %d, s.n = %d, s.q = %d\n", s.m, s.n, s.q);
+    assert(s.m == 4 && s.n == 0 && s.o == 0 && s.p == 0 && s.q == 7);
+  }
+  {
+    auto s = new S23(3);
+    printf("s.m = %d, s.n = %d, s.q = %d\n", s.m, s.n, s.q);
+    assert(s.m == 4 && s.n == 0 && s.o == 0 && s.p == 0 && s.q == 7);
+  }
+  {
+    S23 s;
+    s = S23(3);
+    printf("s.m = %d, s.n = %d, s.q = %d\n", s.m, s.n, s.q);
+    assert(s.m == 4 && s.n == 0 && s.o == 0 && s.p == 0 && s.q == 7);
+  }
+}
+
+/************************************************/
+
+struct S24
+{
+    int m, n, o, p, q;
+
+    this(int x)
+    {
+        printf("S24(%d)\n", x);
+        assert(x == 3);
+        assert(m == 0 && n == 0 && o == 0 && p == 0 && q == 0);
+        q = 7;
+    }
+}
+
+void test24()
+{
+  {
+    auto s = S24(3);
+    printf("s.m = %d, s.n = %d, s.q = %d\n", s.m, s.n, s.q);
+    assert(s.m == 0 && s.n == 0 && s.o == 0 && s.p == 0 && s.q == 7);
+  }
+  {
+    auto s = new S24(3);
+    printf("s.m = %d, s.n = %d, s.q = %d\n", s.m, s.n, s.q);
+    assert(s.m == 0 && s.n == 0 && s.o == 0 && s.p == 0 && s.q == 7);
+  }
+  {
+    S24 s;
+    s = S24(3);
+    printf("s.m = %d, s.n = %d, s.q = %d\n", s.m, s.n, s.q);
+    assert(s.m == 0 && s.n == 0 && s.o == 0 && s.p == 0 && s.q == 7);
+  }
+}
+
+/**********************************/
+
+struct S25
+{
+    this(int s) {}
+}
+
+void test25()
+{
+    auto a = S25();
+}
+
+/**********************************/
+
+int z26;
+
+struct A26
+{
+    int id;
+    this(int x) { id = x; printf("Created A from scratch: %d\n", x); z26++; }
+    this(this) { printf("Copying A: %d\n", id); z26 += 10; }
+    ~this() { printf("Destroying A: %d\n", id); z26 += 100; }
+}
+
+struct B26
+{
+    A26 member;
+    this(this) { printf("Copying B: %d\n", member.id); assert(0); }
+}
+
+B26 foo26()
+{
+    A26 a = A26(45);
+    printf("1\n");
+    assert(z26 == 1);
+    return B26(a);
+}
+
+void test26()
+{
+    {
+    auto b = foo26();
+    assert(z26 == 111);
+    printf("2\n");
+    }
+    assert(z26 == 211);
+}
+
+/**********************************/
+
+int z27;
+
+struct A27
+{
+    int id;
+    this(int x) { id = x; printf("Ctor A27: %d\n", x); z27++; }
+    this(this) { printf("Copying A27: %d\n", id); z27 += 10; }
+    ~this() { printf("Destroying A27: %d\n", id); z27 += 100; }
+}
+
+struct B27
+{
+    A27[2][3] member;
+}
+
+void test27()
+{
+  {
+    A27[2][3] a;
+    assert(z27 == 0);
+    B27 b = B27(a);
+    assert(z27 == 60);
+  }
+  assert(z27 == 1260);
+}
+
+
+/**********************************/
+
+string s28;
+
+struct A28
+{
+    this(this)
+    {
+        printf("A's copy\n");
+        s28 ~= "A";
+    }
+}
+
+struct B28
+{
+    A28 member;
+    this(this)
+    {
+        printf("B's copy\n");
+        s28 ~= "B";
+    }
+}
+
+void test28()
+{
+    B28 b1;
+    B28 b2 = b1;
+    assert(s28 == "AB");
+}
+
+
+/**********************************/
+
+string s29;
+
+template Templ29 ()
+{
+    this(int i) { this(0.0); s29 ~= "i"; }
+    this(double d) { s29 ~= "d"; }
+}
+
+class C29 { mixin Templ29; }
+struct S29 { mixin Templ29; }
+
+void test29()
+{
+    auto r = S29(1);
+    assert(s29 == "di");
+
+    r = S29(2.0);
+    assert(s29 == "did");
+
+    auto c = new C29(2);
+    assert(s29 == "diddi");
+
+    auto c2 = new C29(2.0);
+    assert(s29 == "diddid");
+}
+
+/**********************************/
+
+struct S30
+{
+    int x;
+    this(T)(T args) { x = args + 1; }
+}
+
+void test30()
+{
+    auto s = S30(3);
+    assert(s.x == 4);
+}
+
+/**********************************/
+
+struct S31
+{
+    int x;
+    this(T...)(T args) { x = args[0] + 1; }
+}
+
+void test31()
+{
+    auto s = S31(3);
+    assert(s.x == 4);
+}
+
+/**********************************/
+
+struct S32
+{
+    static int x;
+
+    this(int i)
+    {
+        printf("ctor %p(%d)\n", &this, i);
+        x += 1;
+    }
+
+    this(this)
+    {
+        printf("postblit %p\n", &this);
+        x += 0x10;
+    }
+
+    ~this()
+    {
+        printf("dtor %p\n", &this);
+        x += 0x100;
+    }
+}
+
+S32 foo32()
+{
+    printf("test1\n");
+    return S32(1);
+}
+
+S32 bar32()
+{
+    printf("test1\n");
+    S32 f = S32(1);
+    printf("test2\n");
+    return f;
+}
+
+void test32()
+{
+  {
+    S32 s = foo32();
+  }
+  assert(S32.x == 0x101);
+
+  S32.x = 0;
+  {
+    S32 s = bar32();
+  }
+  assert(S32.x == 0x101);
+}
+
+/**********************************/
+
+struct S33
+{
+    static int x;
+
+    this(int i)
+    {
+        printf("ctor %p(%d)\n", &this, i);
+        x += 1;
+    }
+
+    this(this)
+    {
+        printf("postblit %p\n", &this);
+        x += 0x10;
+    }
+
+    ~this()
+    {
+        printf("dtor %p\n", &this);
+        x += 0x100;
+    }
+}
+
+struct T33
+{
+    S33 foo()
+    {
+        return t;
+    }
+
+    S33 t;
+}
+
+void test33()
+{
+    {
+        T33 t;
+        S33 s = t.foo();
+    }
+    printf("S.x = %x\n", S33.x);
+    assert(S33.x == 0x210);
+}
+
+/**********************************/
+
+struct X34 {
+    int i;
+    this(this) {
+        printf("postblit %p\n", &this);
+        ++i;
+    }
+
+    ~this() {
+        printf("dtor %p\n", &this);
+    }
+}
+
+void test34()
+{
+    X34[2] xs;
+//  xs[0][0] = X34();
+    printf("foreach\n");
+    for (int j = 0; j < xs.length; j++) { auto x = (j++,j--,xs[j]);
+        //foreach(x; xs) {
+        //printf("foreach x.i = %d\n", x[0].i);
+        //assert(x[0].i == 1);
+        printf("foreach x.i = %d\n", x.i);
+        assert(x.i == 1);
+    }
+    printf("loop done\n");
+}
+
+/**********************************/
+
+struct X35 {
+    __gshared int k;
+    int i;
+    this(this) {
+        printf("postblit %p\n", &this);
+        ++i;
+    }
+
+    ~this() {
+        printf("dtor %p\n", &this);
+        k++;
+    }
+}
+
+void test35()
+{
+    {
+        X35[2] xs;
+        printf("foreach\n");
+        foreach(ref x; xs) {
+            printf("foreach x.i = %d\n", x.i);
+            assert(x.i == 0);
+        }
+        printf("loop done\n");
+    }
+    assert(X35.k == 2);
+}
+
+/**********************************/
+
+struct X36 {
+    __gshared int k;
+    int i;
+    this(this) {
+        printf("postblit %p\n", &this);
+        ++i;
+    }
+
+    ~this() {
+        printf("dtor %p\n", &this);
+        k++;
+    }
+}
+
+void test36()
+{
+    {
+        X36[2] xs;
+        printf("foreach\n");
+        foreach(x; xs) {
+            printf("foreach x.i = %d\n", x.i);
+            assert(x.i == 1);
+        }
+        printf("loop done\n");
+    }
+    assert(X36.k == 4);
+}
+
+/**********************************/
+
+struct X37 {
+    __gshared int k;
+    int i;
+    this(this) {
+        printf("postblit %p\n", &this);
+        ++i;
+    }
+
+    ~this() {
+        printf("dtor %p\n", &this);
+        k++;
+    }
+}
+
+void test37() {
+    {
+        X37[2][3] xs;
+        printf("foreach\n");
+        foreach(ref x; xs) {
+            printf("foreach x.i = %d\n", x[0].i);
+            assert(x[0].i == 0);
+        }
+        printf("loop done\n");
+    }
+  assert(X37.k == 6);
+}
+
+/**********************************/
+
+struct S38 {
+    __gshared int count;
+    __gshared int postblit;
+
+    this(int x) {
+        printf("this(%d)\n", x);
+        assert(this.x == 0);
+        this.x = x;
+        count++;
+    }
+    this(this) {
+        printf("this(this) with %d\n", x);
+        assert(x == 1 || x == 2);
+        count++;
+        postblit++;
+    }
+    ~this() {
+        printf("~this(%d)\n", x);
+        assert(x == 1 || x == 2);
+        x = 0;
+        count--;
+    }
+    int x;
+}
+
+S38 foo38() {
+    auto s = S38(1);
+    return s;
+}
+
+S38 bar38() {
+    return S38(2);
+}
+
+void test38()
+{
+  {
+    auto s1 = foo38();
+    assert(S38.count == 1);
+    assert(S38.postblit == 0);
+  }
+  assert(S38.count == 0);
+  S38.postblit = 0;
+
+  {
+    auto s2 = bar38();
+    assert(S38.count == 1);
+    assert(S38.postblit == 0);
+  }
+  assert(S38.count == 0);
+}
+
+
+/**********************************/
+
+struct Foo39
+{
+    int x;
+    this(int v){ x = v + 1; }
+    void opAssign(int v){
+        x = v + 3;
+    }
+}
+
+void test39()
+{
+    int y = 5;
+    Foo39 f = y;
+    assert(f.x == 6);
+    f = y;
+    assert(f.x == 8);
+//  f = Foo39(y);
+
+}
+
+/**********************************/
+
+bool approxEqual(float a, float b)
+{
+    return a < b ? b-a < .001 : a-b < .001;
+}
+
+struct Point {
+    float x = 0, y = 0;
+    const bool opEquals(const ref Point rhs)
+    {
+        return approxEqual(x, rhs.x) && approxEqual(y, rhs.y);
+    }
+}
+
+struct Rectangle {
+   Point leftBottom, rightTop;
+}
+
+void test40()
+{
+   Rectangle a, b;
+   assert(a == b);
+   a.leftBottom.x = 1e-8;
+   assert(a == b);
+   a.rightTop.y = 5;
+   assert(a != b);
+}
+
+/**********************************/
+
+struct S41 {
+   this(int) immutable {   }
+}
+
+void test41()
+{
+    auto s = new immutable S41(3);
+    //writeln(typeid(typeof(s)));
+    static assert(is(typeof(s) == immutable(S41)*));
+
+    auto t = immutable S41(3);
+    //writeln(typeid(typeof(t)));
+    static assert(is(typeof(t) == immutable(S41)));
+}
+
+/**********************************/
+
+class C42 {
+   this(int) immutable {
+   }
+}
+
+void test42()
+{
+    static assert(!__traits(compiles, new C42(3)));
+    //writeln(typeid(typeof(c)));
+    //static assert(is(typeof(c) == immutable(C42)));
+
+    auto d = new immutable(C42)(3);
+    //writeln(typeid(typeof(d)));
+    static assert(is(typeof(d) == immutable(C42)));
+}
+
+/**********************************/
+
+struct S43 {
+    int i;
+    int* p;
+//  this(int i, int* t) immutable { this.i = i; p = t;  }
+}
+
+void test43()
+{
+    int i;
+    assert(!__traits(compiles, immutable(S43)(3, &i)));
+    immutable int j = 4;
+    auto s = immutable(S43)(3, &j);
+    //writeln(typeid(typeof(s)));
+    static assert(is(typeof(s) == immutable(S43)));
+}
+
+/**********************************/
+
+struct S44 {
+    int i;
+    immutable(int)* p;
+    this(int i, immutable(int)* t) immutable { this.i = i; this.p = t;  }
+}
+
+void test44()
+{
+    int i;
+    assert(!__traits(compiles, immutable(S44)(3, &i)));
+    immutable int j = 4;
+    auto s = immutable(S44)(3, &j);
+    //writeln(typeid(typeof(s)));
+    static assert(is(typeof(s) == immutable(S44)));
+}
+
+/**********************************/
+
+class C45 {
+    C45 next;
+    this(int[] data) immutable {
+        next = new immutable(C45)(data[1 .. $]);
+    }
+}
+
+void test45()
+{
+}
+
+/**********************************/
+// 3986
+
+struct SiberianHamster
+{
+   int rat = 813;
+   this(string z) { }
+}
+
+void test46()
+{
+   SiberianHamster basil = "cybil";
+   assert(basil.rat == 813);
+}
+
+/**********************************/
+// 8741
+
+struct Vec8741
+{
+    this(float x)
+    {
+        m[0] = x;
+        m[1] = 58;
+    }
+    float[2] m;
+    static Vec8741 zzz = Vec8741(7);
+}
+
+void test8741()
+{
+    assert(Vec8741.zzz.m[0] == 7);
+    assert(Vec8741.zzz.m[1] == 58);
+}
+
+/**********************************/
+
+struct Segfault3984
+{
+    int a;
+    this(int x){
+        a = x;
+    }
+}
+
+void test47()
+{
+    //static
+    assert(Segfault3984(3).a == 3);
+}
+
+/**********************************/
+
+void test48()
+{
+    struct B {
+        void foo()  {   }
+    }
+    B x = B.init;
+}
+
+/**********************************/
+
+struct Foo49 {
+   int z;
+   this(int a){z=a;}
+}
+
+void bar49(Foo49 a = Foo49(1))
+{
+    assert(a.z == 1);
+}
+
+void test49()
+{
+    bar49();
+    bar49();
+}
+
+/**********************************/
+
+struct aStruct{
+    int    m_Int;
+
+    this(int a){
+        m_Int = a;
+    }
+}
+
+class aClass{
+    void aFunc(aStruct a = aStruct(44))
+    {
+        assert(a.m_Int == 44);
+    }
+}
+
+void test50()
+{
+    aClass a = new aClass();
+    a.aFunc();
+    a.aFunc();
+}
+
+/**********************************/
+
+int A51_a;
+
+struct A51
+{
+    ~this() { ++A51_a; }
+}
+
+void test51()
+{
+  A51_a = 0; { while(0) A51 a;                      } assert(A51_a == 0);
+  A51_a = 0; { if(0) A51 a;                         } assert(A51_a == 0);
+  A51_a = 0; { if(1){} else A51 a;                  } assert(A51_a == 0);
+  A51_a = 0; { for(;0;) A51 a;                      } assert(A51_a == 0);
+  A51_a = 0; { if (1) { A51 a; }                    } assert(A51_a == 1);
+  A51_a = 0; { if (1) A51 a;                        } assert(A51_a == 1);
+  A51_a = 0; { if(0) {} else A51 a;                 } assert(A51_a == 1);
+  A51_a = 0; { if (0) for(A51 a;;) {}               } assert(A51_a == 0);
+  A51_a = 0; { if (0) for(;;) A51 a;                } assert(A51_a == 0);
+  A51_a = 0; { do A51 a; while(0);                  } assert(A51_a == 1);
+  A51_a = 0; { if (0) while(1) A51 a;               } assert(A51_a == 0);
+  A51_a = 0; { try A51 a; catch(Error e) {}         } assert(A51_a == 1);
+  A51_a = 0; { if (0) final switch(1) A51 a;        } assert(A51_a == 0); // should fail to build
+//  A51_a = 0; { if (0) switch(1) { A51 a; default: } } assert(A51_a == 0);
+  A51_a = 0; { if (0) switch(1) { default: A51 a; } } assert(A51_a == 0);
+//  A51_a = 0; { if (1) switch(1) { A51 a; default: } } assert(A51_a == 1); // should be 0, right?
+  A51_a = 0; { if (1) switch(1) { default: A51 a; } } assert(A51_a == 1);
+//  A51_a = 0; { final switch(0) A51 a;               } assert(A51_a == 0);
+  A51_a = 0; { A51 a; with(a) A51 b;                } assert(A51_a == 2);
+}
+
+/**********************************/
+
+string s52;
+
+struct A52
+{
+    int m;
+    this(this)
+    {
+        printf("this(this) %p\n", &this);
+        s52 ~= 'a';
+    }
+    ~this()
+    {
+        printf("~this() %p\n", &this);
+        s52 ~= 'b';
+    }
+    A52 copy()
+    {
+        s52 ~= 'c';
+        A52 another = this;
+        return another;
+    }
+}
+
+void test52()
+{
+  {
+    A52 a;
+    A52 b = a.copy();
+    printf("a: %p, b: %p\n", &a, &b);
+  }
+    printf("s = '%.*s'\n", s52.length, s52.ptr);
+    assert(s52 == "cabb");
+}
+
+/**********************************/
+// 4339
+
+struct A53 {
+    invariant() {   }
+    ~this() { }
+    void opAssign(A53 a) {}
+    int blah(A53 a) { return 0; }
+}
+
+/**********************************/
+
+struct S54
+{
+    int x = 1;
+
+    int bar() { return x; }
+
+    this(int i)
+    {
+        printf("ctor %p(%d)\n", &this, i);
+        t ~= "a";
+    }
+
+    this(this)
+    {
+        printf("postblit %p\n", &this);
+        t ~= "b";
+    }
+
+    ~this()
+    {
+        printf("dtor %p\n", &this);
+        t ~= "c";
+    }
+
+    static string t;
+}
+
+void bar54(S54 s) { }
+
+S54 abc54() { return S54(1); }
+
+void test54()
+{
+    {   S54.t = null;
+        S54 s = S54(1);
+    }
+    assert(S54.t == "ac");
+
+    {   S54.t = null;
+        S54 s = S54();
+    }
+    assert(S54.t == "c");
+
+    {   S54.t = null;
+        int b = 1 && (bar54(S54(1)), 1);
+    }
+    assert(S54.t == "ac");
+
+    {   S54.t = null;
+        int b = 0 && (bar54(S54(1)), 1);
+    }
+    assert(S54.t == "");
+
+    {   S54.t = null;
+        int b = 0 || (bar54(S54(1)), 1);
+    }
+    assert(S54.t == "ac");
+
+    {   S54.t = null;
+        int b = 1 || (bar54(S54(1)), 1);
+    }
+    assert(S54.t == "");
+
+    {
+    S54.t = null;
+    { const S54 s = S54(1); }
+        assert(S54.t == "ac");
+    }
+    {
+        S54.t = null;
+        abc54();
+        assert(S54.t == "ac");
+    }
+    {
+        S54.t = null;
+        abc54().x += 1;
+        assert(S54.t == "ac");
+    }
+}
+
+/**********************************/
+
+void test55()
+{
+    S55 s;
+    auto t = s.copy();
+    assert(t.count == 1);   // (5)
+}
+
+struct S55
+{
+    int count;
+    this(this) { ++count; }
+    S55 copy() { return this; }
+}
+
+/**********************************/
+
+struct S56
+{
+    int x = 1;
+
+    int bar() { return x; }
+
+    this(int i)
+    {
+        printf("ctor %p(%d)\n", &this, i);
+        t ~= "a";
+    }
+
+    this(this)
+    {
+        printf("postblit %p\n", &this);
+        t ~= "b";
+    }
+
+    ~this()
+    {
+        printf("dtor %p\n", &this);
+        t ~= "c";
+    }
+
+    static string t;
+}
+
+int foo56()
+{
+    throw new Throwable("hello");
+    return 5;
+}
+
+
+void test56()
+{
+    int i;
+    int j;
+    try
+    {
+        j |= 1;
+        i = S56(1).x + foo56() + 1;
+        j |= 2;
+    }
+    catch (Throwable o)
+    {
+        printf("caught\n");
+        j |= 4;
+    }
+    printf("i = %d, j = %d\n", i, j);
+    assert(i == 0);
+    assert(j == 5);
+}
+
+/**********************************/
+// 5859
+
+int dtor_cnt = 0;
+struct S57
+{
+    int v;
+    this(int n){ v = n; printf("S.ctor v=%d\n", v); }
+    ~this(){ ++dtor_cnt; printf("S.dtor v=%d\n", v); }
+    bool opCast(T:bool)(){ printf("S.cast v=%d\n", v); return true; }
+}
+S57 f(int n){ return S57(n); }
+
+void test57()
+{
+    printf("----\n");
+    dtor_cnt = 0;
+    if (auto s = S57(10))
+    {
+        printf("ifbody\n");
+    }
+    else assert(0);
+    assert(dtor_cnt == 1);
+
+    printf("----\n");    //+
+    dtor_cnt = 0;
+    if (auto s = (S57(1), S57(2), S57(10)))
+    {
+        assert(dtor_cnt == 2);
+        printf("ifbody\n");
+    }
+    else assert(0);
+    assert(dtor_cnt == 3);  // +/
+
+    printf("----\n");
+    dtor_cnt = 0;
+    try{
+        if (auto s = S57(10))
+        {
+            printf("ifbody\n");
+            throw new Exception("test");
+        }
+        else assert(0);
+    }catch (Exception e){}
+    assert(dtor_cnt == 1);
+
+
+
+    printf("----\n");
+    dtor_cnt = 0;
+    if (auto s = f(10))
+    {
+        printf("ifbody\n");
+    }
+    else assert(0);
+    assert(dtor_cnt == 1);
+
+    printf("----\n");    //+
+    dtor_cnt = 0;
+    if (auto s = (f(1), f(2), f(10)))
+    {
+        assert(dtor_cnt == 2);
+        printf("ifbody\n");
+    }
+    else assert(0);
+    assert(dtor_cnt == 3);  // +/
+
+    printf("----\n");
+    dtor_cnt = 0;
+    try{
+        if (auto s = f(10))
+        {
+            printf("ifbody\n");
+            throw new Exception("test");
+        }
+        else assert(0);
+    }catch (Exception e){}
+    assert(dtor_cnt == 1);
+
+
+
+
+    printf("----\n");
+    dtor_cnt = 0;
+    if (S57(10))
+    {
+        assert(dtor_cnt == 1);
+        printf("ifbody\n");
+    }
+    else assert(0);
+
+    printf("----\n");
+    dtor_cnt = 0;
+    if ((S57(1), S57(2), S57(10)))
+    {
+        assert(dtor_cnt == 3);
+        printf("ifbody\n");
+    }
+    else assert(0);
+
+    printf("----\n");
+    dtor_cnt = 0;
+    try{
+        if (auto s = S57(10))
+        {
+            printf("ifbody\n");
+            throw new Exception("test");
+        }
+        else assert(0);
+    }catch (Exception e){}
+    assert(dtor_cnt == 1);
+
+
+
+    printf("----\n");
+    dtor_cnt = 0;
+    if (f(10))
+    {
+        assert(dtor_cnt == 1);
+        printf("ifbody\n");
+    }
+    else assert(0);
+
+    printf("----\n");
+    dtor_cnt = 0;
+    if ((f(1), f(2), f(10)))
+    {
+        assert(dtor_cnt == 3);
+        printf("ifbody\n");
+    }
+    else assert(0);
+
+    printf("----\n");
+    dtor_cnt = 0;
+    try{
+        if (auto s = f(10))
+        {
+            printf("ifbody\n");
+            throw new Exception("test");
+        }
+        else assert(0);
+    }catch (Exception e){}
+    assert(dtor_cnt == 1);
+}
+
+/**********************************/
+// 5574
+
+struct foo5574a
+{
+    ~this() {}
+}
+class bar5574a
+{
+    foo5574a[1] frop;
+}
+
+struct foo5574b
+{
+    this(this){}
+}
+struct bar5574b
+{
+    foo5574b[1] frop;
+}
+
+/**********************************/
+// 5777
+
+int sdtor58 = 0;
+S58* ps58;
+
+struct S58
+{
+    @disable this(this);
+    ~this(){ ++sdtor58; }
+}
+
+S58 makeS58()
+{
+    S58 s;
+    ps58 = &s;
+    return s;
+}
+
+void test58()
+{
+    auto s1 = makeS58();
+    assert(ps58 == &s1);
+    assert(sdtor58 == 0);
+}
+
+/**********************************/
+// 6308
+
+struct C59
+{
+    void oops()
+    {
+        throw new Throwable("Oops!");
+    }
+
+    ~this()
+    {
+    }
+}
+
+void foo59()
+{
+    C59().oops();
+//  auto c = C(); c.oops();
+}
+
+
+void test59()
+{
+    int i = 0;
+    try
+        foo59();
+    catch (Throwable)
+    {   i = 1;
+    }
+    assert(i == 1);
+}
+
+/**********************************/
+// 5737
+
+void test5737()
+{
+    static struct S
+    {
+        static int destroyed;
+        static int copied;
+
+        this(this)
+        {
+            copied++;
+        }
+
+        ~this()
+        {
+            destroyed++;
+        }
+    }
+
+    static S s;
+
+    ref S foo()
+    {
+        return s;
+    }
+
+    {
+        auto s2 = foo();
+    }
+
+    assert(S.copied == 1); // fail, s2 was not copied;
+    assert(S.destroyed == 1); // ok, s2 was destroyed
+}
+
+/**********************************/
+// 6119
+
+void test6119()
+{
+    int postblit = 0;
+    int dtor = 0;
+
+    struct Test
+    {
+        this(this) { ++postblit; }
+        ~this()    { ++dtor; }
+    }
+
+    void takesVal(Test x) {}
+    ref Test returnsRef(ref Test x) { return x; }
+
+    void f(ref Test x) { takesVal( x ); }
+
+    Test x;
+
+    postblit = dtor = 0;
+    takesVal(returnsRef(x));
+    assert(postblit == 1);
+    assert(dtor == 1);
+
+    postblit = dtor = 0;
+    f(x);
+    assert(postblit == 1);
+    assert(dtor == 1);
+}
+
+/**********************************/
+// 6364
+
+struct Foo6364
+{
+    int state = 1;
+
+    ~this()
+    {
+        state = 0;
+    }
+}
+
+void testfoo6364()
+{
+    static Foo6364 foo;
+    printf("%d\n", foo.state);
+    assert(foo.state == 1);
+}
+
+void test6364()
+{
+    testfoo6364();
+    testfoo6364();
+}
+
+/**********************************/
+// 6499
+
+struct S6499
+{
+    string m = "<not set>";
+
+    this(string s)
+    {
+        m = s;
+        printf("Constructor - %.*s\n", m.length, m.ptr);
+        if (m == "foo") { ++sdtor; assert(sdtor == 1); }
+        if (m == "bar") { ++sdtor; assert(sdtor == 2); }
+    }
+    this(this)
+    {
+        printf("Postblit    - %.*s\n", m.length, m.ptr);
+        assert(0);
+    }
+    ~this()
+    {
+        printf("Destructor  - %.*s\n", m.length, m.ptr);
+        if (m == "bar") { assert(sdtor == 2); --sdtor; }
+        if (m == "foo") { assert(sdtor == 1); --sdtor; }
+    }
+    S6499 bar()     { return S6499("bar"); }
+    S6499 baz()()   { return S6499("baz"); }
+}
+
+void test6499()
+{
+    S6499 foo() { return S6499("foo"); }
+
+    {
+        sdtor = 0;
+        scope(exit) assert(sdtor == 0);
+        foo().bar();
+    }
+    {
+        sdtor = 0;
+        scope(exit) assert(sdtor == 0);
+        foo().baz();
+    }
+}
+
+/**********************************/
+
+template isImplicitlyConvertible(From, To)
+{
+    enum bool isImplicitlyConvertible = is(typeof({
+                        void fun(ref From v) {
+                            void gun(To) {}
+                            gun(v);
+                        }
+                    }()));
+}
+
+void test60()
+{
+    static struct X1
+    {
+        void* ptr;
+        this(this){}
+    }
+    static struct S1
+    {
+        X1 x;
+    }
+
+    static struct X2
+    {
+        int ptr;
+        this(this){}
+    }
+    static struct S2
+    {
+        X2 x;
+    }
+
+    {
+              S1  ms;
+              S1  ms2 = ms; // mutable to mutable
+        const(S1) cs2 = ms; // mutable to const                         // NG -> OK
+    }
+    {
+        const(S1) cs;
+        static assert(!__traits(compiles,{                              // NG -> OK
+              S1 ms2 = cs;  // field has reference, then const to mutable is invalid
+        }));
+        const(S1) cs2 = cs; // const to const                           // NG -> OK
+    }
+    static assert( isImplicitlyConvertible!(      S1 ,       S1 ) );
+    static assert( isImplicitlyConvertible!(      S1 , const(S1)) );    // NG -> OK
+    static assert(!isImplicitlyConvertible!(const(S1),       S1 ) );
+    static assert( isImplicitlyConvertible!(const(S1), const(S1)) );    // NG -> OK
+
+
+    {
+              S2  ms;
+              S2  ms2 = ms; // mutable to mutable
+        const(S2) cs2 = ms; // mutable to const                         // NG -> OK
+    }
+    {
+        const(S2) cs;
+              S2  ms2 = cs; // all fields are value, then const to mutable is OK
+        const(S2) cs2 = cs; // const to const                           // NG -> OK
+    }
+
+    static assert( isImplicitlyConvertible!(      S2 ,       S2 ) );
+    static assert( isImplicitlyConvertible!(      S2 , const(S2)) );    // NG -> OK
+    static assert( isImplicitlyConvertible!(const(S2),       S2 ) );
+    static assert( isImplicitlyConvertible!(const(S2), const(S2)) );    // NG -> OK
+}
+
+/**********************************/
+// 4316
+
+struct A4316
+{
+    this(this) @safe { }
+}
+
+@safe void test4316()
+{
+    A4316 a;
+    auto b = a; // Error: safe function 'main' cannot call system function'__cpctor'
+}
+
+/**********************************/
+
+struct F6177
+{
+    ~this()    {}
+}
+
+struct G6177
+{
+    this(F6177[] p...) {}
+}
+
+void test6177()
+{
+    F6177 c;
+    auto g = G6177(c);
+}
+
+
+/**********************************/
+// 6470
+
+struct S6470
+{
+    static int spblit;
+
+    this(this){ ++spblit; }
+}
+
+void test6470()
+{
+    S6470[] a1;
+    S6470[] a2;
+    a1.length = 3;
+    a2.length = 3;
+    a1[] = a2[];
+    assert(S6470.spblit == 3);
+
+    S6470 s;
+
+    S6470[] a3;
+    a3.length = 3;
+    a3 = [s, s, s];
+    assert(S6470.spblit == 6);
+
+    void func(S6470[] a){}
+    func([s, s, s]);
+    assert(S6470.spblit == 9);
+}
+
+/**********************************/
+// 6636
+
+struct S6636
+{
+    ~this()
+    {
+        ++sdtor;
+    }
+}
+
+void func6636(S6636[3] sa) {}
+
+void test6636()
+{
+    sdtor = 0;
+
+    S6636[3] sa;
+    func6636(sa);
+    assert(sdtor == 3);
+}
+
+/**********************************/
+// 6637
+
+struct S6637
+{
+    static int spblit;
+
+    this(this){ ++spblit; }
+}
+
+void test6637()
+{
+    void func(S6637[3] sa){}
+
+    S6637[3] sa;
+    func(sa);
+    assert(S6637.spblit == 3);
+}
+
+/**********************************/
+// 7353
+
+struct S7353
+{
+    static uint ci = 0;
+    uint i;
+
+    this(int x) { i = ci++; /*writeln("new: ", i);*/ }
+    this(this)  { i = ci++; /*writeln("copy ", i);*/ }
+    ~this()     {           /*writeln("del ", i);*/ }
+
+    S7353 save1() // produces 2 copies in total
+    {
+        S7353 s = this;
+        return s;
+    }
+    auto save2() // produces 3 copies in total
+    {
+        S7353 s = this;
+        return s;
+        pragma(msg, typeof(return));
+    }
+}
+void test7353()
+{
+    {
+        auto s = S7353(1), t = S7353(1);
+        t = s.save1();
+        assert(S7353.ci == 3);
+    }
+    S7353.ci = 0; //writeln("-");
+    {
+        auto s = S7353(1), t = S7353(1);
+        t = s.save2();
+        assert(S7353.ci == 3);
+    }
+}
+
+/**********************************/
+// 8036
+
+struct S8036a
+{
+    ~this() {}
+}
+struct S8036b // or class
+{
+    S8036a[0] s;
+}
+
+/**********************************/
+
+struct S61
+{
+    this(long length)
+    {
+        this.length = length;
+    }
+
+    long length;
+}
+
+
+const(S61) copy(const S61 s)
+{
+    return s;
+}
+
+
+void test61()
+{
+    S61 t = S61(42);
+    const S61 u = t;
+
+    assert(t == u);
+    assert(copy(t) == u);
+    assert(t == copy(u));
+}
+
+/**********************************/
+// 7506
+
+void test7506()
+{
+    static struct S
+    {
+        static uint ci = 0;
+        static uint di = 0;
+        uint i;
+
+        this(int x) { i = ci++; /*writeln("new: ", i);*/ }
+        this(this)  { i = ci++; /*writeln("copy ", i);*/ }
+        ~this()     { ++di;     /*writeln("del: ", i);*/ }
+
+        S save3()
+        {
+            return this;
+        }
+    }
+
+    {
+        auto s = S(1), t = S(1);
+        assert(S.ci == 2);
+        t = s.save3();
+        assert(S.ci == 3);  // line 23
+    }
+    assert(S.di == 3);
+}
+
+/**********************************/
+// 7516
+
+struct S7516
+{
+    int val;
+
+    this(int n) { val = n; }
+    this(this) { val *= 3; }
+}
+
+// CondExp on return statement
+void test7516a()
+{
+    alias S = S7516;
+    S s1 = S(1);
+    S s2 = S(2);
+
+    S foo(bool f) { return f ?  s1  :  s2;  }
+    S hoo(bool f) { return f ? S(1) : S(2); }
+    S bar(bool f) { return f ?  s1  : S(2); }
+    S baz(bool f) { return f ? S(1) :  s2;  }
+
+    auto r1 = foo(true);    assert(r1.val == 3);
+    auto r2 = foo(false);   assert(r2.val == 6);
+    auto r3 = hoo(true);    assert(r3.val == 1);
+    auto r4 = hoo(false);   assert(r4.val == 2);
+    auto r5 = bar(true);    assert(r5.val == 3);
+    auto r6 = bar(false);   assert(r6.val == 2);
+    auto r7 = baz(true);    assert(r7.val == 1);
+    auto r8 = baz(false);   assert(r8.val == 6);
+}
+
+// CondExp on function argument
+void test7516b()
+{
+    alias S = S7516;
+    S s1 = S(1);
+    S s2 = S(2);
+    S func(S s) { return s; }
+
+    S foo(bool f) { return func(f ?  s1  :  s2 ); }
+    S hoo(bool f) { return func(f ? S(1) : S(2)); }
+    S bar(bool f) { return func(f ?  s1  : S(2)); }
+    S baz(bool f) { return func(f ? S(1) :  s2 ); }
+
+    auto r1 = foo(true);    assert(r1.val == 3 * 3);
+    auto r2 = foo(false);   assert(r2.val == 6 * 3);
+    auto r3 = hoo(true);    assert(r3.val == 1 * 3);
+    auto r4 = hoo(false);   assert(r4.val == 2 * 3);
+    auto r5 = bar(true);    assert(r5.val == 3 * 3);
+    auto r6 = bar(false);   assert(r6.val == 2 * 3);
+    auto r7 = baz(true);    assert(r7.val == 1 * 3);
+    auto r8 = baz(false);   assert(r8.val == 6 * 3);
+}
+
+// CondExp on array literal
+void test7516c()
+{
+    alias S = S7516;
+    S s1 = S(1);
+    S s2 = S(2);
+
+    S[] foo(bool f) { return [f ?  s1  :  s2 ]; }
+    S[] hoo(bool f) { return [f ? S(1) : S(2)]; }
+    S[] bar(bool f) { return [f ?  s1  : S(2)]; }
+    S[] baz(bool f) { return [f ? S(1) :  s2 ]; }
+
+    auto r1 = foo(true);    assert(r1[0].val == 3);
+    auto r2 = foo(false);   assert(r2[0].val == 6);
+    auto r3 = hoo(true);    assert(r3[0].val == 1);
+    auto r4 = hoo(false);   assert(r4[0].val == 2);
+    auto r5 = bar(true);    assert(r5[0].val == 3);
+    auto r6 = bar(false);   assert(r6[0].val == 2);
+    auto r7 = baz(true);    assert(r7[0].val == 1);
+    auto r8 = baz(false);   assert(r8[0].val == 6);
+}
+
+// CondExp on rhs of cat assign
+void test7516d()
+{
+    alias S = S7516;
+    S s1 = S(1);
+    S s2 = S(2);
+
+    S[] foo(bool f) { S[] a; a ~= f ?  s1  :  s2 ; return a; }
+    S[] hoo(bool f) { S[] a; a ~= f ? S(1) : S(2); return a; }
+    S[] bar(bool f) { S[] a; a ~= f ?  s1  : S(2); return a; }
+    S[] baz(bool f) { S[] a; a ~= f ? S(1) :  s2 ; return a; }
+
+    auto r1 = foo(true);    assert(r1[0].val == 3);
+    auto r2 = foo(false);   assert(r2[0].val == 6);
+    auto r3 = hoo(true);    assert(r3[0].val == 1);
+    auto r4 = hoo(false);   assert(r4[0].val == 2);
+    auto r5 = bar(true);    assert(r5[0].val == 3);
+    auto r6 = bar(false);   assert(r6[0].val == 2);
+    auto r7 = baz(true);    assert(r7[0].val == 1);
+    auto r8 = baz(false);   assert(r8[0].val == 6);
+}
+
+// CondExp on struct literal element
+void test7516e()
+{
+    alias S = S7516;
+    S s1 = S(1);
+    S s2 = S(2);
+    struct X { S s; }
+
+    X foo(bool f) { return X(f ?  s1  :  s2 ); }
+    X hoo(bool f) { return X(f ? S(1) : S(2)); }
+    X bar(bool f) { return X(f ?  s1  : S(2)); }
+    X baz(bool f) { return X(f ? S(1) :  s2 ); }
+
+    auto r1 = foo(true);    assert(r1.s.val == 3);
+    auto r2 = foo(false);   assert(r2.s.val == 6);
+    auto r3 = hoo(true);    assert(r3.s.val == 1);
+    auto r4 = hoo(false);   assert(r4.s.val == 2);
+    auto r5 = bar(true);    assert(r5.s.val == 3);
+    auto r6 = bar(false);   assert(r6.s.val == 2);
+    auto r7 = baz(true);    assert(r7.s.val == 1);
+    auto r8 = baz(false);   assert(r8.s.val == 6);
+}
+
+/**********************************/
+// 7530
+
+void test7530()
+{
+    static struct S
+    {
+        int val;
+
+        this(int n) { val = n; }
+        this(this) { val *= 3; }
+    }
+
+    S[] sa = new S[](1);
+    sa[0].val = 1;
+    S foo()
+    {
+        return sa[0];
+    }
+    auto s = foo();
+    assert(s.val == 3);
+}
+
+/**********************************/
+
+struct S62
+{
+    this(int length)
+    {
+        _length = length;
+    }
+
+    int opBinary(string op)(in S62 rhs) const
+        if(op == "-")
+    {
+        return this.length - rhs.length;
+    }
+
+    @property int length() const
+    {
+        return _length;
+    }
+
+    invariant()
+    {
+        assert(_length == 1);
+    }
+
+    int _length  = 1;
+}
+
+
+void test62()
+{
+    immutable result = S62.init - S62.init;
+}
+
+/**********************************/
+// 7579
+
+void test7579a()
+{
+    static struct S
+    {
+        // postblit can also have no body because isn't called
+        @disable this(this) { assert(0); }
+    }
+
+    @property S fs() { return S(); }
+    @property S[3] fsa() { return [S(), S(), S()]; }
+
+    S s0;
+    S s1 = S();
+    static assert(!__traits(compiles, { S s2 = s1; }));         // OK
+    S s2 = fs;
+    static assert(!__traits(compiles, { s2 = s1; }));           // OK
+
+    // static array
+    S[3] sa0;
+    S[3] sa1 = [S(), S(), S()];
+    static assert(!__traits(compiles, { S[3] sa2 = sa1; }));    // fixed
+    S[3] sa2 = fsa;
+    static assert(!__traits(compiles, { sa2 = sa1; }));         // fixed
+    sa2 = [S(), S(), S()];
+    sa2 = fsa;
+
+    S[] da1 = new S[3];
+    S[] da2 = new S[3];
+    static assert(!__traits(compiles, { da2[] = da1[]; }));     // fixed
+
+    // concatenation and appending
+    static assert(!__traits(compiles, { da1 ~= s1; }));         // fixed
+    static assert(!__traits(compiles, { da1 ~= S(); }));
+    static assert(!__traits(compiles, { da1 ~= fsa; }));
+    static assert(!__traits(compiles, { da1 ~= fsa[]; }));
+    static assert(!__traits(compiles, { da1 = da1 ~ s1; }));    // fixed
+    static assert(!__traits(compiles, { da1 = s1 ~ da1; }));    // fixed
+    static assert(!__traits(compiles, { da1 = da1 ~ S(); }));
+    static assert(!__traits(compiles, { da1 = da1 ~ fsa; }));
+    static assert(!__traits(compiles, { da1 = da1 ~ da; }));
+}
+
+void test7579b()
+{
+    static struct S
+    {
+        // postblit asserts in runtime
+        this(this) { assert(0); }
+    }
+
+    @property S fs() { return S(); }
+    @property S[3] fsa() { return [S(), S(), S()]; }
+
+    S s0;
+    S s1 = S();
+    S s2 = fs;
+
+    // static array
+    S[3] sa0;
+    S[3] sa1 = [S(), S(), S()];
+    S[3] sa2 = fsa;
+    sa2 = [S(), S(), S()];
+    sa2 = fsa;
+
+    S[] da1 = new S[3];
+    S[] da2 = new S[3];
+
+    // concatenation and appending always run postblits
+}
+
+/**********************************/
+// 8335
+
+struct S8335
+{
+    static int postblit;
+
+    int i;
+    this(this) { ++postblit; }
+}
+
+void f8335(ref S8335[3] arr)
+{
+    arr[0].i = 7;
+}
+
+void g8335(lazy S8335[3] arr)
+{
+    assert(S8335.postblit == 0);
+    auto x = arr;
+    assert(S8335.postblit == 3);
+}
+
+void h8335(lazy S8335 s)
+{
+    assert(S8335.postblit == 0);
+    auto x = s;
+    assert(S8335.postblit == 1);
+}
+
+void test8335()
+{
+    S8335[3] arr;
+    f8335(arr);
+    assert(S8335.postblit == 0);
+    assert(arr[0].i == 7);
+
+    g8335(arr);
+    assert(S8335.postblit == 3);
+
+    S8335.postblit = 0;
+    S8335 s;
+    h8335(s);
+    assert(S8335.postblit == 1);
+}
+
+/**********************************/
+// 8356
+
+void test8356()
+{
+    static struct S
+    {
+        @disable this(this) { assert(0); }
+    }
+
+    S s;
+    S[3] sa;
+
+  static assert(!__traits(compiles, {
+    S fs() { return s; }
+  }));
+
+  static assert(!__traits(compiles, {
+    S[3] fsa() { return sa; }
+  }));
+}
+
+/**********************************/
+// 8475
+
+T func8475(T)(T x) @safe pure
+{
+    return T();
+}
+
+template X8475(bool something)
+{
+    struct XY
+    {
+        this(this) @safe pure {}
+        void func(XY x) @safe pure
+        {
+            XY y = x; //Error: see below
+            func8475(x);
+            func8475(y);
+        }
+    }
+}
+
+alias X8475!(true).XY Xtrue;
+
+/**********************************/
+
+struct Foo9320 {
+    real x;
+
+    this(real x) {
+        this.x = x;
+    }
+
+    Foo9320 opBinary(string op)(Foo9320 other) {
+        return Foo9320(mixin("x" ~ op ~ "other.x"));
+    }
+}
+
+Foo9320 test9320(Foo9320 a, Foo9320 b, Foo9320 c) {
+    return (a + b) / (a * b) - c;
+}
+
+/**********************************/
+// 9386
+
+struct Test9386
+{
+    string name;
+    static char[25] op;
+    static size_t i;
+
+    static @property string sop() { return cast(string)op[0..i]; }
+
+    this(string name)
+    {
+        this.name = name;
+        printf("Created %.*s...\n", name.length, name.ptr);
+        assert(i + 1 < op.length);
+        op[i++] = 'a';
+    }
+
+    this(this)
+    {
+        printf("Copied %.*s...\n", name.length, name.ptr);
+        assert(i + 1 < op.length);
+        op[i++] = 'b';
+    }
+
+    ~this()
+    {
+        printf("Deleted %.*s\n", name.length, name.ptr);
+        assert(i + 1 < op.length);
+        op[i++] = 'c';
+    }
+
+    const int opCmp(ref const Test9386 t)
+    {
+        return op[0] - t.op[0];
+    }
+}
+
+void test9386()
+{
+    {
+        Test9386.op[] = 0;
+        Test9386.i = 0;
+
+        Test9386[] tests =
+            [ Test9386("one"),
+              Test9386("two"),
+              Test9386("three"),
+              Test9386("four") ];
+
+        assert(Test9386.sop == "aaaa");
+        Test9386.op[] = 0;
+        Test9386.i = 0;
+
+        printf("----\n");
+        foreach (Test9386 test; tests)
+        {
+            printf("\tForeach %.*s\n", test.name.length, test.name.ptr);
+            Test9386.op[Test9386.i++] = 'x';
+        }
+
+        assert(Test9386.sop == "bxcbxcbxcbxc");
+        Test9386.op[] = 0;
+        Test9386.i = 0;
+
+        printf("----\n");
+        foreach (ref Test9386 test; tests)
+        {
+            printf("\tForeach %.*s\n", test.name.length, test.name.ptr);
+            Test9386.op[Test9386.i++] = 'x';
+        }
+        assert(Test9386.sop == "xxxx");
+    }
+    printf("====\n");
+    {
+        Test9386.op[] = 0;
+        Test9386.i = 0;
+
+        Test9386[Test9386] tests =
+            [ Test9386("1") : Test9386("one"),
+              Test9386("2") : Test9386("two"),
+              Test9386("3") : Test9386("three"),
+              Test9386("4") : Test9386("four") ];
+
+        Test9386.op[] = 0;
+        Test9386.i = 0;
+
+        printf("----\n");
+        foreach (Test9386 k, Test9386 v; tests)
+        {
+            printf("\tForeach %.*s : %.*s\n", k.name.length, k.name.ptr,
+                                              v.name.length, v.name.ptr);
+            Test9386.op[Test9386.i++] = 'x';
+        }
+
+        assert(Test9386.sop == "bbxccbbxccbbxccbbxcc");
+        Test9386.op[] = 0;
+        Test9386.i = 0;
+
+        printf("----\n");
+        foreach (Test9386 k, ref Test9386 v; tests)
+        {
+            printf("\tForeach %.*s : %.*s\n", k.name.length, k.name.ptr,
+                                              v.name.length, v.name.ptr);
+            Test9386.op[Test9386.i++] = 'x';
+        }
+        assert(Test9386.sop == "bxcbxcbxcbxc");
+        Test9386.op[] = 0;
+        Test9386.i = 0;
+    }
+}
+
+/**********************************/
+// 9441
+
+auto x9441 = X9441(0.123);
+
+struct X9441
+{
+    int a;
+    this(double x) { a = cast(int)(x * 100); }
+}
+
+void test9441()
+{
+    assert(x9441.a == 12);
+}
+
+/**********************************/
+
+struct Payload
+{
+    size_t _capacity; //Comment me
+    int[] _pay;       //Comment me
+
+    size_t insertBack(Data d)
+    {
+        immutable newLen   = _pay.length + 3;
+        _pay.length = newLen;
+        _pay = _pay[0 .. newLen]; //Comment me
+        return 3;
+    }
+}
+
+struct Impl
+{
+    Payload _payload;
+    size_t _count;
+}
+
+struct Data
+{
+    Impl* _store;
+
+    this(int i)
+    {
+        _store = new Impl;
+        _store._payload = Payload.init;
+    }
+
+    ~this()
+    {
+        printf("%d\n", _store._count);
+        --_store._count;
+    }
+}
+
+
+void test9720()
+{
+    auto a = Data(1);
+    auto b = Data(1);
+    a._store._payload.insertBack(b); //Fails
+}
+
+/**********************************/
+// 9899
+
+struct S9899
+{
+    @safe pure nothrow ~this() {}
+}
+
+struct MemberS9899
+{
+    S9899 s;
+}
+
+void test9899() @safe pure nothrow
+{
+    MemberS9899 s; // 11
+}
+
+/**********************************/
+// 9907
+
+void test9907()
+{
+    static struct SX(bool hasCtor, bool hasDtor)
+    {
+        int i;
+        static size_t assign;
+        static size_t dtor;
+
+        static if (hasCtor)
+        {
+            this(int i) { this.i = i; }
+        }
+
+        void opAssign(SX rhs)
+        {
+            printf("%08X(%d) from Rvalue %08X(%d)\n", &this.i, this.i, &rhs.i, rhs.i);
+            ++assign;
+        }
+
+        void opAssign(ref SX rhs)
+        {
+            printf("%08X(%d) from Lvalue %08X(%d)\n", &this.i, this.i, &rhs.i, rhs.i);
+            assert(0);
+        }
+
+        static if (hasDtor)
+        {
+            ~this()
+            {
+                printf("destroying %08X(%d)\n", &this.i, this.i);
+                ++dtor;
+            }
+        }
+    }
+
+    S test(S)(int i)
+    {
+        return S(i);
+    }
+
+    foreach (hasCtor; TypeTuple!(false, true))
+    foreach (hasDtor; TypeTuple!(false, true))
+    {
+        alias S = SX!(hasCtor, hasDtor);
+        alias test!S foo;
+
+        printf("----\n");
+        auto s = S(1);
+
+        // Assignment from two kinds of rvalues
+        assert(S.assign == 0);
+        s = foo(2);
+        static if (hasDtor) assert(S.dtor == 1);
+        assert(S.assign == 1);
+        s = S(3);
+        assert(S.assign == 2);
+        static if (hasDtor) assert(S.dtor == 2);
+    }
+    printf("----\n");
+}
+
+/**********************************/
+// 9985
+
+struct S9985
+{
+    ubyte* b;
+    ubyte buf[128];
+    this(this) { assert(0); }
+
+    static void* ptr;
+}
+auto ref makeS9985() @system
+{
+    S9985 s;
+    s.b = s.buf.ptr;
+    S9985.ptr = &s;
+    return s;
+}
+void test9985()
+{
+    S9985 s = makeS9985();
+    assert(S9985.ptr == &s);    // NRVO
+
+    static const int n = 1;
+    static auto ref retN()
+    {
+        return n;
+    }
+    auto p = &(retN());        // OK
+    assert(p == &n);
+    alias pure nothrow @nogc @safe ref const(int) F1();
+    static assert(is(typeof(retN) == F1));
+
+    enum const(int) x = 1;
+    static auto ref retX()
+    {
+        return x;
+    }
+    static assert(!__traits(compiles, { auto q = &(retX()); }));
+    alias pure nothrow @nogc @safe const(int) F2();
+    static assert(is(typeof(retX) == F2));
+}
+
+/**********************************/
+// 9994
+
+void test9994()
+{
+    static struct S
+    {
+        static int dtor;
+        ~this() { ++dtor; }
+    }
+
+    S s;
+    static assert( __traits(compiles, s.opAssign(s)));
+    static assert(!__traits(compiles, s.__postblit()));
+
+    assert(S.dtor == 0);
+    s = s;
+    assert(S.dtor == 1);
+}
+
+/**********************************/
+// 10053
+
+struct S10053A
+{
+    pure ~this() {}
+}
+
+struct S10053B
+{
+    S10053A sa;
+    ~this() {}
+}
+
+/**********************************/
+// 10055
+
+void test10055a()
+{
+    static struct SX { pure nothrow @safe ~this() {} }
+    static struct SY { pure nothrow @safe ~this() {} }
+    static struct SZ {           @disable ~this() {} }
+
+    // function to check merge result of the dtor attributes
+    static void check(S)() { S s; }
+
+    static struct S1 {                                             }
+    static struct S2 {                                  ~this() {} }
+    static struct SA { SX sx; SY sy;                               }
+    static struct SB { SX sx; SY sy; pure nothrow @safe ~this() {} }
+    static struct SC { SX sx; SY sy;      nothrow @safe ~this() {} }
+    static struct SD { SX sx; SY sy; pure         @safe ~this() {} }
+    static struct SE { SX sx; SY sy; pure nothrow       ~this() {} }
+    static struct SF { SX sx; SY sy;              @safe ~this() {} }
+    static struct SG { SX sx; SY sy;      nothrow       ~this() {} }
+    static struct SH { SX sx; SY sy; pure               ~this() {} }
+    static struct SI { SX sx; SY sy;                    ~this() {} }
+    static assert(is( typeof(&check!S1) == void function() pure nothrow @nogc @safe ));
+    static assert(is( typeof(&check!S2) == void function()                    ));
+    static assert(is( typeof(&check!SA) == void function() pure nothrow @safe ));
+    static assert(is( typeof(&check!SB) == void function() pure nothrow @safe ));
+    static assert(is( typeof(&check!SC) == void function()      nothrow @safe ));
+    static assert(is( typeof(&check!SD) == void function() pure         @safe ));
+    static assert(is( typeof(&check!SE) == void function() pure nothrow       ));
+    static assert(is( typeof(&check!SF) == void function()              @safe ));
+    static assert(is( typeof(&check!SG) == void function()      nothrow       ));
+    static assert(is( typeof(&check!SH) == void function() pure               ));
+    static assert(is( typeof(&check!SI) == void function()                    ));
+
+    static struct S1x {                                             SZ sz; }
+    static struct S2x {                                  ~this() {} SZ sz; }
+    static struct SAx { SX sx; SY sy;                               SZ sz; }
+    static struct SBx { SX sx; SY sy; pure nothrow @safe ~this() {} SZ sz; }
+    static struct SCx { SX sx; SY sy;      nothrow @safe ~this() {} SZ sz; }
+    static struct SDx { SX sx; SY sy; pure         @safe ~this() {} SZ sz; }
+    static struct SEx { SX sx; SY sy; pure nothrow       ~this() {} SZ sz; }
+    static struct SFx { SX sx; SY sy;              @safe ~this() {} SZ sz; }
+    static struct SGx { SX sx; SY sy;      nothrow       ~this() {} SZ sz; }
+    static struct SHx { SX sx; SY sy; pure               ~this() {} SZ sz; }
+    static struct SIx { SX sx; SY sy;                    ~this() {} SZ sz; }
+    foreach (Sx; TypeTuple!(S1x, S2x, SAx, SBx, SCx, SDx, SEx, SFx, SGx, SHx, SIx))
+    {
+        static assert(!__traits(compiles, &check!Sx));
+    }
+}
+
+void test10055b()
+{
+    static struct SX { pure nothrow @safe this(this) {} }
+    static struct SY { pure nothrow @safe this(this) {} }
+    static struct SZ {           @disable this(this) {} }
+
+    // function to check merge result of the postblit attributes
+    static void check(S)() { S s; S s2 = s; }
+
+    static struct S1 {                                               }
+    static struct S2 {                                  this(this) {} }
+    static struct SA { SX sx; SY sy;                                  }
+    static struct SB { SX sx; SY sy; pure nothrow @safe this(this) {} }
+    static struct SC { SX sx; SY sy;      nothrow @safe this(this) {} }
+    static struct SD { SX sx; SY sy; pure         @safe this(this) {} }
+    static struct SE { SX sx; SY sy; pure nothrow       this(this) {} }
+    static struct SF { SX sx; SY sy;              @safe this(this) {} }
+    static struct SG { SX sx; SY sy;      nothrow       this(this) {} }
+    static struct SH { SX sx; SY sy; pure               this(this) {} }
+    static struct SI { SX sx; SY sy;                    this(this) {} }
+    static assert(is( typeof(&check!S1) == void function() pure nothrow @nogc @safe ));
+    static assert(is( typeof(&check!S2) == void function()                    ));
+    static assert(is( typeof(&check!SA) == void function() pure nothrow @safe ));
+    static assert(is( typeof(&check!SB) == void function() pure nothrow @safe ));
+    static assert(is( typeof(&check!SC) == void function()      nothrow @safe ));
+    static assert(is( typeof(&check!SD) == void function() pure         @safe ));
+    static assert(is( typeof(&check!SE) == void function() pure nothrow       ));
+    static assert(is( typeof(&check!SF) == void function()              @safe ));
+    static assert(is( typeof(&check!SG) == void function()      nothrow       ));
+    static assert(is( typeof(&check!SH) == void function() pure               ));
+    static assert(is( typeof(&check!SI) == void function()                    ));
+
+    static struct S1x {                                                SZ sz; }
+    static struct S2x {                                  this(this) {} SZ sz; }
+    static struct SAx { SX sx; SY sy;                                  SZ sz; }
+    static struct SBx { SX sx; SY sy; pure nothrow @safe this(this) {} SZ sz; }
+    static struct SCx { SX sx; SY sy;      nothrow @safe this(this) {} SZ sz; }
+    static struct SDx { SX sx; SY sy; pure         @safe this(this) {} SZ sz; }
+    static struct SEx { SX sx; SY sy; pure nothrow       this(this) {} SZ sz; }
+    static struct SFx { SX sx; SY sy;              @safe this(this) {} SZ sz; }
+    static struct SGx { SX sx; SY sy;      nothrow       this(this) {} SZ sz; }
+    static struct SHx { SX sx; SY sy; pure               this(this) {} SZ sz; }
+    static struct SIx { SX sx; SY sy;                    this(this) {} SZ sz; }
+    foreach (Sx; TypeTuple!(S1x, S2x, SAx, SBx, SCx, SDx, SEx, SFx, SGx, SHx, SIx))
+    {
+        static assert(!__traits(compiles, &check!Sx));
+    }
+}
+
+/**********************************/
+// 10160
+
+struct S10160 { this(this) {} }
+
+struct X10160a { S10160 s; const int x;     }
+struct X10160b { S10160 s; enum int x = 1; }
+
+void test10160()
+{
+    X10160a xa;
+    X10160b xb;
+}
+
+/**********************************/
+// 10094
+
+void test10094()
+{
+    static void* p;
+    const string[4] i2s = ()
+    {
+        string[4] tmp;
+        p = &tmp[0];
+        for (int i = 0; i < 4; ++i)
+        {
+            char[1] buf = [cast(char)('0' + i)];
+            string str = buf.idup;
+            tmp[i] = str;
+        }
+        return tmp; // NRVO should work
+    }();
+    assert(p == cast(void*)&i2s[0]);
+    assert(i2s == ["0", "1", "2", "3"]);
+}
+
+/**********************************/
+// 10079
+
+// dtor || postblit
+struct S10079a
+{
+    this(this) pure nothrow @safe {}
+}
+struct S10079b
+{
+    ~this() pure nothrow @safe {}
+}
+struct S10079c
+{
+    this(this) pure nothrow @safe {}
+    ~this() pure nothrow @safe {}
+}
+struct S10079d
+{
+    this(this) {}
+}
+struct S10079e
+{
+    this(this) {}
+    ~this() pure nothrow @safe {}
+}
+
+// memberwise
+struct S10079f
+{
+    S10079a a;
+    S10079b b;
+    S10079c c;
+    S10079d d;
+    S10079e e;
+}
+
+void check10079(S)(ref S s) pure nothrow @safe { s = S(); }
+
+// Assignment is pure, nothrow, and @safe in all cases.
+static assert(__traits(compiles, &check10079!S10079a));
+static assert(__traits(compiles, &check10079!S10079b));
+static assert(__traits(compiles, &check10079!S10079c));
+static assert(__traits(compiles, &check10079!S10079d));
+static assert(__traits(compiles, &check10079!S10079e));
+static assert(__traits(compiles, &check10079!S10079f));
+
+/**********************************/
+// 10244
+
+void test10244()
+{
+    static struct Foo
+    {
+        string _str;
+        long _num;
+
+        template DeclareConstructor(string fieldName)
+        {
+            enum code =
+                `this(typeof(_` ~ fieldName ~ `) value)` ~
+                `{ this._` ~ fieldName ~ ` = value; }`;
+            mixin(code);
+        }
+
+        mixin DeclareConstructor!"str";
+        mixin DeclareConstructor!"num";
+    }
+
+    Foo value1 = Foo("D");
+    Foo value2 = Foo(128);
+    assert(value1._str == "D");
+    assert(value2._num == 128);
+}
+
+/**********************************/
+// 10694
+
+struct Foo10694 { ~this() { } }
+
+void test10694() pure
+{
+    static Foo10694 i1;
+    __gshared Foo10694 i2;
+    void foo() pure
+    {
+        static Foo10694 j1;
+        __gshared Foo10694 j2;
+    }
+}
+
+/**********************************/
+// 10787
+
+int global10787;
+
+static ~this() nothrow pure @safe
+{
+    int* p;
+    static assert(!__traits(compiles, ++p));
+    static assert(!__traits(compiles, ++global10787));
+}
+
+shared static ~this() nothrow pure @safe
+{
+    int* p;
+    static assert(!__traits(compiles, ++p));
+    static assert(!__traits(compiles, ++global10787));
+}
+
+/**********************************/
+// 10789
+
+struct S10789
+{
+    static int count;
+    int value;
+
+    this(int)  { value = ++count; }
+    ~this()    { --count; }
+    this(this) { value = ++count; assert(value == 3); }
+}
+
+S10789 fun10789a(bool isCondExp)(bool cond)
+{
+    S10789 s1 = S10789(42), s2 = S10789(24);
+    assert(S10789.count == 2);
+    static if (isCondExp)
+    {
+        return cond ? s1 : s2;
+    }
+    else
+    {
+        if (cond)
+            return s1;
+        else
+            return s2;
+    }
+}
+
+auto fun10789b(bool isCondExp)(bool cond)
+{
+    S10789 s1 = S10789(42), s2 = S10789(24);
+    assert(S10789.count == 2);
+    static if (isCondExp)
+    {
+        return cond ? s1 : s2;
+    }
+    else
+    {
+        if (cond)
+            return s1;
+        else
+            return s2;
+    }
+}
+
+void test10789()
+{
+    foreach (fun; TypeTuple!(fun10789a, fun10789b))
+    foreach (isCondExp; TypeTuple!(false, true))
+    {
+        {
+            S10789 s = fun!isCondExp(true);
+            assert(S10789.count == 1);
+            assert(s.value == 3);
+        }
+        assert(S10789.count == 0);
+        {
+            S10789 s = fun!isCondExp(false);
+            assert(S10789.count == 1);
+            assert(s.value == 3);
+        }
+        assert(S10789.count == 0);
+    }
+}
+
+/**********************************/
+// 10972
+
+int test10972()
+{
+    string result;
+
+    struct A
+    {
+        this(this)  { result ~= "pA"; version(none) printf("copied A\n"); }
+        ~this()     { result ~= "dA"; version(none) printf("destroy A\n"); }
+    }
+    struct B
+    {
+        this(this)
+        {
+            result ~= "(pB)"; version(none) printf("B says what?\n");
+            throw new Exception("BOOM!");
+        }
+        ~this() { result ~= "dB"; version(none) printf("destroy B\n"); }
+    }
+    struct S
+    {
+        A a;
+        B b;
+    }
+
+    result = "{";
+    {
+        S s1;
+        result ~= "[";
+        try
+        {
+            S s3 = s1;
+            assert(0);
+        }
+        catch (Exception e)
+        {}
+        result ~= "]";
+    }
+    result ~= "}";
+    assert(result == "{[pA(pB)dA]dBdA}", result);
+
+    result = "{";
+    {
+        S s1;
+        S s2;
+        result ~= "[";
+        try
+        {
+            s2 = s1;
+            assert(0);
+        }
+        catch (Exception e)
+        {}
+        result ~= "]";
+    }
+    result ~= "}";
+    assert(result == "{[pA(pB)dA]dBdAdBdA}", result);
+
+    return 1;
+}
+static assert(test10972()); // CTFE
+
+/**********************************/
+// 11134
+
+void test11134()
+{
+    void test(S)()
+    {
+        S s;
+        S[2] sa;
+        S[2][] dsa = [[S(), S()]];
+        dsa.reserve(dsa.length + 2);    // avoid postblit calls by GC
+
+        S.count = 0;
+        dsa ~= sa;
+        assert(S.count == 2);
+
+        S.count = 0;
+        dsa ~= [s, s];
+        assert(S.count == 2);
+    }
+
+    static struct SS
+    {
+        static int count;
+        this(this) { ++count; }
+    }
+    test!SS();
+
+    struct NS
+    {
+        static int count;
+        this(this) { ++count; }
+    }
+    test!NS();
+}
+
+/**********************************/
+// 11197
+
+struct S11197a
+{
+    this(bool) {}
+    this(this) {}
+}
+
+struct S11197b
+{
+    //this(bool) {}
+    this(this) {}
+}
+
+void test11197()
+{
+    S11197a[][string] aa1;
+    aa1["test"] ~= S11197a.init;
+
+    S11197b[][string] aa2;
+    aa2["test"] ~= S11197b.init;
+}
+
+/**********************************/
+
+struct S7474 {
+  float x;
+  ~this() {}
+}
+
+void fun7474(T...)() { T x; }
+void test7474() { fun7474!S7474(); }
+
+/**********************************/
+// 11286
+
+struct A11286
+{
+    ~this() {}
+}
+
+A11286 getA11286() pure nothrow
+{
+    return A11286();
+}
+
+void test11286()
+{
+    A11286 a = getA11286();
+}
+
+/**********************************/
+// 11505
+
+struct Foo11505
+{
+    Bar11505 b;
+}
+
+struct Bar11505
+{
+    ~this() @safe { }
+    void* p;
+}
+
+void test11505()
+{
+    Foo11505 f;
+    f = Foo11505();
+}
+
+/**********************************/
+// 12045
+
+bool test12045()
+{
+    string dtor;
+    void* ptr;
+
+    struct S12045
+    {
+        string val;
+
+        this(this) { assert(0); }
+        ~this() { dtor ~= val; }
+    }
+
+    auto makeS12045(bool thrown)
+    {
+        auto s1 = S12045("1");
+        auto s2 = S12045("2");
+        ptr = &s1;
+
+        if (thrown)
+            throw new Exception("");
+
+        return s1;  // NRVO
+    }
+
+    dtor = null, ptr = null;
+    try
+    {
+        S12045 s = makeS12045(true);
+        assert(0);
+    }
+    catch (Exception e)
+    {
+        assert(dtor == "21", dtor);
+    }
+
+    dtor = null, ptr = null;
+    {
+        S12045 s = makeS12045(false);
+        assert(dtor == "2");
+        if (!__ctfe) assert(ptr is &s);   // NRVO
+    }
+    assert(dtor == "21");
+
+    return true;
+}
+static assert(test12045());
+
+/**********************************/
+// 12591
+
+struct S12591(T)
+{
+    this(this)
+    {}
+}
+
+struct Tuple12591(Types...)
+{
+    Types expand;
+    this(Types values)
+    {
+        expand[] = values[];
+    }
+}
+
+void test12591()
+{
+    alias T1 = Tuple12591!(S12591!int);
+}
+
+/**********************************/
+// 12660
+
+struct X12660
+{
+    this(this) @nogc {}
+    ~this() @nogc {}
+    void opAssign(X12660) @nogc {}
+    @nogc invariant() {}
+}
+struct Y12660
+{
+    X12660 x;
+
+    this(this) @nogc {}
+    ~this() @nogc {}
+    @nogc invariant() {}
+}
+struct Z12660
+{
+    Y12660 y;
+}
+
+class C12660
+{
+    this() @nogc {}
+    @nogc invariant() {}
+}
+
+void test12660() @nogc
+{
+    X12660 x;
+    x = x;
+
+    Y12660 y = { x };
+    y = y;
+
+    Z12660 z = { y };
+    z = z;
+}
+
+/**********************************/
+// 12686
+
+struct Foo12686
+{
+    static int count;
+
+    invariant() { ++count; }
+
+    @disable this(this);
+
+    Foo12686 bar()
+    {
+        Foo12686 f;
+        return f;
+    }
+}
+
+void test12686()
+{
+    Foo12686 f;
+    Foo12686 f2 = f.bar();
+    version (unittest)
+    { }
+    else
+        assert(Foo12686.count == 2);
+}
+
+/**********************************/
+// 13089
+
+struct S13089
+{
+    @disable this(this);    // non nothrow
+}
+
+void* p13089;
+
+S13089[1000] foo13089() nothrow
+{
+    typeof(return) data;
+    p13089 = &data;
+    return data;
+}
+
+void test13089() nothrow
+{
+    immutable data = foo13089();
+    assert(p13089 == &data);
+}
+
+/**********************************/
+
+struct NoDtortest11763 {}
+
+struct HasDtortest11763
+{
+    NoDtortest11763 func()
+    {
+        return NoDtortest11763();
+    }
+    ~this() {}
+}
+
+void test11763()
+{
+    HasDtortest11763().func();
+}
+
+/**********************************/
+
+struct Buf { }
+
+struct Variant
+{
+    ~this() { }
+
+    Buf get() { Buf b; return b; }
+}
+
+Variant value() { Variant v; return v; }
+
+void test13303()
+{
+    value.get();
+}
+
+/**********************************/
+
+struct S13673
+{
+    string _name;
+    ~this() {}
+}
+
+string name13673;
+
+void test13673()
+{
+    S13673(name13673);
+    S13673(name13673);
+}
+
+/**********************************/
+
+void test13586()
+{
+    static struct S {
+        __gshared int count;
+        ~this() { ++count; printf("~S\n"); }
+    }
+
+    static struct T {
+        __gshared int count;
+        ~this() { ++count; printf("~T\n"); }
+    }
+
+    static int foo(bool flag)
+    {
+        if (flag)
+            throw new Exception("hello");
+        return 1;
+    }
+
+    static void func(S s, int f, T t)
+    {
+        printf("func()\n");
+    }
+
+    static class C
+    {
+        this(S s, int f, T t)
+        {
+            printf("C()\n");
+        }
+    }
+
+  {
+    bool threw = false;
+    try
+    {
+        func(S(), foo(true), T());
+        printf("not reach\n");
+    }
+    catch (Exception e)
+    {
+        threw = true;
+    }
+    printf("threw %d S %d T %d\n", threw, S.count, T.count);
+    assert(threw && S.count == 1 && T.count == 0);
+    S.count = 0;
+    T.count = 0;
+  }
+  {
+    bool threw = false;
+    try
+    {
+        func(S(), foo(false), T());
+        printf("reached\n");
+    }
+    catch (Exception e)
+    {
+        threw = true;
+    }
+    printf("threw %d S %d T %d\n", threw, S.count, T.count);
+    assert(!threw && S.count == 1 && T.count == 1);
+    S.count = 0;
+    T.count = 0;
+  }
+  {
+    bool threw = false;
+    try
+    {
+        new C(S(), foo(true), T());
+        printf("not reach\n");
+    }
+    catch (Exception e)
+    {
+        threw = true;
+    }
+    printf("threw %d S %d T %d\n", threw, S.count, T.count);
+    assert(threw && S.count == 1 && T.count == 0);
+    S.count = 0;
+    T.count = 0;
+  }
+}
+
+/**********************************/
+// 14443
+
+T enforce14443(E : Throwable = Exception, T)(T value)
+{
+    if (!value)
+        throw new E("Enforcement failed");
+    return value;
+}
+
+struct RefCounted14443(T)
+if (!is(T == class) && !(is(T == interface)))
+{
+    struct RefCountedStore
+    {
+        private struct Impl
+        {
+            T _payload;
+            size_t _count;
+        }
+
+        private Impl* _store;
+
+        private void initialize(A...)(auto ref A args)
+        {
+            import core.stdc.stdlib : malloc;
+
+            // enforce is necessary
+            _store = cast(Impl*) enforce14443(malloc(Impl.sizeof));
+
+            // emulate 'emplace'
+            static if (args.length > 0)
+                _store._payload.tupleof = args;
+            else
+                _store._payload = T.init;
+
+            _store._count = 1;
+        }
+
+        @property bool isInitialized() const nothrow @safe
+        {
+            return _store !is null;
+        }
+
+        void ensureInitialized()
+        {
+            if (!isInitialized) initialize();
+        }
+
+    }
+    RefCountedStore _refCounted;
+
+    this(A...)(auto ref A args) if (A.length > 0)
+    {
+        _refCounted.initialize(args);
+    }
+
+    this(this)
+    {
+        if (!_refCounted.isInitialized)
+            return;
+        ++_refCounted._store._count;
+        //printf("RefCounted count = %d (inc)\n", _refCounted._store._count);
+    }
+
+    ~this()
+    {
+        if (!_refCounted.isInitialized)
+            return;
+        assert(_refCounted._store._count > 0);
+        if (--_refCounted._store._count)
+        {
+            //printf("RefCounted count = %u\n", _refCounted._store._count);
+            return;
+        }
+
+        import core.stdc.stdlib : free;
+        free(_refCounted._store);
+        _refCounted._store = null;
+    }
+
+    void opAssign(typeof(this) rhs) { assert(0); }
+    void opAssign(T rhs) { assert(0); }
+
+    @property ref T refCountedPayload()
+    {
+        _refCounted.ensureInitialized();
+        return _refCounted._store._payload;
+    }
+
+    alias refCountedPayload this;
+}
+
+struct Path14443
+{
+    struct Payload
+    {
+        int p;
+    }
+    RefCounted14443!Payload data;
+}
+
+struct PathRange14443
+{
+    Path14443 path;
+    size_t i;
+
+    @property PathElement14443 front()
+    {
+        return PathElement14443(this, path.data.p);
+    }
+}
+
+struct PathElement14443
+{
+    PathRange14443 range;
+
+    this(PathRange14443 range, int)
+    {
+        this.range = range;
+    }
+}
+
+void test14443()
+{
+    auto path = Path14443(RefCounted14443!(Path14443.Payload)(12));
+    assert(path.data.p == 12);
+
+    @property refCount() { return path.data._refCounted._store._count; }
+    assert(refCount == 1);
+
+    {
+        auto _r = PathRange14443(path);
+        assert(refCount == 2);
+        // foreach
+        {
+            auto element = _r.front;
+            assert(refCount == 3);  // fail with 2.067
+        }
+        assert(refCount == 2);
+    }
+    assert(refCount == 1);
+}
+
+/**********************************/
+// 13661, 14022, 14023 - postblit/dtor call on static array assignment
+
+bool test13661()
+{
+    string op;
+
+    struct S
+    {
+        char x = 'x';
+        this(this) { op ~= x-0x20; }    // upper case
+        ~this()    { op ~= x; }         // lower case
+
+        ref auto opAssign(T)(T arg)
+        {
+            assert(0);
+            return this;
+        }
+    }
+
+    {
+        S[2] a;
+
+        a[0].x = 'a';
+        a[1].x = 'b';
+        a = a.init;
+        assert(op == "ab");
+        assert(a[0].x == 'x' && a[1].x == 'x');
+
+        a[0].x = 'c';
+        a[1].x = 'd';
+        a = [S(), S()];   // equivalent a = a.init
+        assert(op == "abcd");
+        assert(a[0].x == 'x' && a[1].x == 'x');
+    }
+    assert(op == "abcdxx");
+
+    return true;
+}
+bool test13661a()
+{
+    string op;
+
+    struct S
+    {
+        char x = 'x';
+        this(this) { op ~= x-0x20; }    // upper case
+        ~this()    { op ~= x; }         // lower case
+    }
+
+    {
+        S[3] sa = [S('a'), S('b'), S('c')];
+        S[2] sb = sa[1..3];
+        assert(sa == [S('a'), S('b'), S('c')]);
+        assert(sb == [S('b'), S('c')]);
+        sb[0].x = 'x';
+        sb[1].x = 'y';
+        assert(sa != [S('a'), S('x'), S('y')]); // OK <- incorrectly fails
+        assert(sa == [S('a'), S('b'), S('c')]); // OK <- incorrectly fails
+        assert(sb == [S('x'), S('y')]);
+    }
+    return true;
+}
+static assert(test13661());     // CTFE
+static assert(test13661a());
+
+bool test14022()
+{
+    string op;
+
+    struct S
+    {
+        char x = 'x';
+        this(this) { op ~= x-0x20; }    // upper case
+        ~this()    { op ~= x; }         // lower case
+    }
+
+    S[2] makeSA() { return [S('p'), S('q')]; }
+
+    struct T
+    {
+        S[2] sb;
+
+        this(ref S[2] sa)
+        {
+            assert(op == "");
+            this.sb = sa;   // TOKconstruct
+            assert(op == "BC", op);
+            assert(sb == [S('b'), S('c')]);
+        }
+        void test(ref S[2] sa)
+        {
+            this.sb = sa;    // dotvar: resolveSlice(newva)
+            assert(op == "BxCy");
+        }
+    }
+
+    op = null;
+    {
+        S[2] sa = [S('a'), S('b')];
+        T t;    t.sb[0].x = 'x';
+                t.sb[1].x = 'y';
+        assert(op == "");
+        t.sb = sa;
+        assert(op == "AxBy");
+        t.sb = makeSA();
+        assert(op == "AxByab");
+    }
+    assert(op == "AxByabqpba");
+
+    op = null;
+    {
+        S[3] sa = [S('a'), S('b'), S('c')];
+        T t = T(sa[1..3]);
+        t.sb[0].x = 'x';
+        t.sb[1].x = 'y';
+        assert(sa == [S('a'), S('b'), S('c')]);
+        assert(t.sb == [S('x'), S('y')]);
+        assert(op == "BC");
+    }
+    assert(op == "BCyxcba");
+
+    op = null;
+    {
+        S[3] sx = [S('a'), S('b'), S('c')];
+        T t;    t.sb[0].x = 'x';
+                t.sb[1].x = 'y';
+        t.test(sx[1..3]);
+        assert(op == "BxCy");
+        assert(t.sb == [S('b'), S('c')]);
+    }
+    assert(op == "BxCycbcba");
+
+    return true;
+}
+static assert(test14022());
+
+bool test14023()
+{
+    string op;
+
+    struct S
+    {
+        char x = 'x';
+        this(this) { op ~= x-0x20; }    // upper case
+        ~this()    { op ~= x; }         // lower case
+    }
+
+    S[2] makeSA() { return [S('p'), S('q')]; }
+
+    struct T
+    {
+        S[2][1] sb;
+        this(ref S[2] sa)
+        {
+            assert(op == "");
+            this.sb[0] = sa;   // TOKconstruct
+            assert(sa    == [S('b'), S('c')]);
+            assert(sb[0] == [S('b'), S('c')]);
+        }
+    }
+
+    void test(ref S[2] sa)
+    {
+        S[2][] a;
+        //a.length = 1; // will cause runtine AccessViolation
+        a ~= (S[2]).init;
+        assert(op == "");
+        a[0] = sa;      // index <-- resolveSlice(newva)
+        assert(op == "BxCx");
+        assert(a[0] == [S('b'), S('c')]);
+    }
+
+    op = null;
+    {
+        S[3] sa = [S('a'), S('b'), S('c')];
+        T t = T(sa[1..3]);
+        t.sb[0][0].x = 'x';
+        t.sb[0][1].x = 'y';
+        assert(sa      != [S('a'), S('x'), S('y')]);    // OK <- incorrectly fails
+        assert(sa      == [S('a'), S('b'), S('c')]);    // OK <- incorrectly fails
+        assert(t.sb[0] == [S('x'), S('y')]);
+    }
+
+    op = null;
+    {
+        S[2] sa = [S('a'), S('b')];
+        S[2][] a = [[S('x'), S('y')]];
+        assert(op == "");
+        a[0] = sa;
+        assert(op == "AxBy");
+        a[0] = makeSA();
+        assert(op == "AxByab");
+    }
+    assert(op == "AxByabba");
+
+    op = null;
+    {
+        S[3] sa = [S('a'), S('b'), S('c')];
+        test(sa[1..3]);
+        assert(op == "BxCx");
+    }
+    assert(op == "BxCxcba");
+
+    return true;
+}
+static assert(test14023());
+
+/************************************************/
+// 13669 - dtor call on static array variable
+
+bool test13669()
+{
+    string dtor;
+
+    struct S
+    {
+        char x = 'x';
+        ~this() { dtor ~= x; }
+    }
+
+    { S[2] a; }
+    assert(dtor == "xx");
+    dtor = "";
+
+    { S[2] a = [S('a'), S('b')]; }
+    assert(dtor == "ba");   // reverse order. See also: TypeInfo_StaticArray.destroy()
+
+    return true;
+}
+static assert(test13669());
+
+/**********************************/
+
+__gshared bool b13095 = false;
+
+void bar13095() { throw new Exception(""); }
+
+struct S13095
+{
+    this(int) { printf("ctor %p\n", &this); bar13095(); }
+
+    ~this() { b13095 = true; printf("dtor %p\n", &this); }
+}
+
+void test13095()
+{
+    try {
+        S13095(0);
+    } catch(Exception) { printf("catch\n"); }
+    assert(!b13095);
+}
+
+/**********************************/
+// 14264
+
+void test14264()
+{
+    static int dtor;
+    static struct Foo
+    {
+        ~this() { ++dtor; }
+        T opCast(T:bool)() { return true; }
+    }
+
+    Foo makeFoo()
+    {
+        return Foo();
+    }
+
+    assert(dtor == 0);
+
+    makeFoo();
+    assert(dtor == 1);
+
+    makeFoo;
+    assert(dtor == 2);
+
+    if (makeFoo()) {}
+    assert(dtor == 3);
+
+    if (makeFoo) {}
+    assert(dtor == 4);
+}
+
+/**********************************/
+// 14815
+
+int test14815()
+{
+    uint dtorCount;
+
+    struct S
+    {
+        uint x;
+        ~this() { ++dtorCount; }
+    }
+
+    S[2] sa1;
+    sa1[0].x = 42;
+    sa1 = (S[2]).init;      // S[2] <- rvalue
+    assert(sa1[0].x == 0);
+    assert(dtorCount == 2);
+
+    S[2] sa2;
+    sa2[0].x = 42;
+    S[] da2 = sa2[];
+    da2[] = (S[2]).init[];  // S[] <- rvalue slice
+    assert(sa2[0].x == 0);
+    assert(dtorCount == 4);
+
+    S[2] sa3;
+    S[2] sa4;
+    sa3[0].x = 42;
+    sa3 = sa4;              // S[2] <- lvalue
+    assert(sa3[0].x == 0);
+    assert(dtorCount == 6);
+
+    S[2] sa5;
+    S[] da4 = sa4[];
+    da4[] = sa5[];          // S[] <- lvalue slice
+    assert(sa4[0].x == 0);
+    assert(dtorCount == 8);
+
+    return 1;
+}
+static assert(test14815());
+
+/**********************************/
+// 14860
+
+int test14860()
+{
+    uint dtorCount;
+
+    struct S
+    {
+        uint x;
+        ~this() { ++dtorCount; }
+    }
+
+    S[] a = [S(42)];
+    a[] = S();
+
+    assert(a[0].x == 0);
+    assert(dtorCount == 1);
+
+    return 1;
+}
+static assert(test14860());
+
+/**********************************/
+// 14696
+
+void test14696(int len = 2)
+{
+    string result;
+
+    struct S
+    {
+        int n;
+
+        void* get(void* p = null)
+        {
+            result ~= "get(" ~ cast(char)(n+'0') ~ ").";
+            return null;
+        }
+
+        ~this()
+        {
+            result ~= "dtor(" ~ cast(char)(n+'0') ~ ").";
+        }
+    }
+
+    S makeS(int n)
+    {
+        result ~= "makeS(" ~ cast(char)(n+'0') ~ ").";
+        return S(n);
+    }
+    void foo(void* x, void* y = null)
+    {
+        result ~= "foo.";
+    }
+    void fooThrow(void* x, void* y = null)
+    {
+        result ~= "fooThrow.";
+        throw new Exception("fail!");
+    }
+
+    void check(void delegate() dg, string r, string file = __FILE__, size_t line = __LINE__)
+    {
+        import core.exception;
+
+        result = null;
+        try { dg(); } catch (Exception e) {}
+        if (result != r)
+            throw new AssertError(result, file, line);
+    }
+
+    // temporary in condition
+    check({ foo(len == 2 ?        makeS(1).get() : null); }, "makeS(1).get(1).foo.dtor(1).");
+    check({ foo(len == 2 ? null : makeS(1).get()       ); }, "foo.");
+    check({ foo(len != 2 ?        makeS(1).get() : null); }, "foo.");
+    check({ foo(len != 2 ? null : makeS(1).get()       ); }, "makeS(1).get(1).foo.dtor(1).");
+
+    // temporary in nesting conditions
+    check({ foo(len >= 2 ?        (len == 2 ?        makeS(1).get() : null) : null); }, "makeS(1).get(1).foo.dtor(1).");
+    check({ foo(len >= 2 ?        (len == 2 ? null : makeS(1).get()       ) : null); }, "foo.");
+    check({ foo(len >= 2 ?        (len != 2 ?        makeS(1).get() : null) : null); }, "foo.");
+    check({ foo(len >= 2 ?        (len != 2 ? null : makeS(1).get()       ) : null); }, "makeS(1).get(1).foo.dtor(1).");
+    check({ foo(len >= 2 ? null : (len == 2 ?        makeS(1).get() : null)       ); }, "foo.");
+    check({ foo(len >= 2 ? null : (len == 2 ? null : makeS(1).get()       )       ); }, "foo.");
+    check({ foo(len >= 2 ? null : (len != 2 ?        makeS(1).get() : null)       ); }, "foo.");
+    check({ foo(len >= 2 ? null : (len != 2 ? null : makeS(1).get()       )       ); }, "foo.");
+    check({ foo(len >  2 ?        (len == 2 ?        makeS(1).get() : null) : null); }, "foo.");
+    check({ foo(len >  2 ?        (len == 2 ? null : makeS(1).get()       ) : null); }, "foo.");
+    check({ foo(len >  2 ?        (len != 2 ?        makeS(1).get() : null) : null); }, "foo.");
+    check({ foo(len >  2 ?        (len != 2 ? null : makeS(1).get()       ) : null); }, "foo.");
+    check({ foo(len >  2 ? null : (len == 2 ?        makeS(1).get() : null)       ); }, "makeS(1).get(1).foo.dtor(1).");
+    check({ foo(len >  2 ? null : (len == 2 ? null : makeS(1).get()       )       ); }, "foo.");
+    check({ foo(len >  2 ? null : (len != 2 ?        makeS(1).get() : null)       ); }, "foo.");
+    check({ foo(len >  2 ? null : (len != 2 ? null : makeS(1).get()       )       ); }, "makeS(1).get(1).foo.dtor(1).");
+
+    // temporary in condition and throwing callee
+    // check({ fooThrow(len == 2 ?        makeS(1).get() : null); }, "makeS(1).get(1).fooThrow.dtor(1).");
+    // check({ fooThrow(len == 2 ? null : makeS(1).get()       ); }, "fooThrow.");
+    // check({ fooThrow(len != 2 ?        makeS(1).get() : null); }, "fooThrow.");
+    // check({ fooThrow(len != 2 ? null : makeS(1).get()       ); }, "makeS(1).get(1).fooThrow.dtor(1).");
+
+    // temporary in nesting condititions and throwing callee
+    // check({ fooThrow(len >= 2 ?        (len == 2 ?        makeS(1).get() : null) : null); }, "makeS(1).get(1).fooThrow.dtor(1).");
+    // check({ fooThrow(len >= 2 ?        (len == 2 ? null : makeS(1).get()       ) : null); }, "fooThrow.");
+    // check({ fooThrow(len >= 2 ?        (len != 2 ?        makeS(1).get() : null) : null); }, "fooThrow.");
+    // check({ fooThrow(len >= 2 ?        (len != 2 ? null : makeS(1).get()       ) : null); }, "makeS(1).get(1).fooThrow.dtor(1).");
+    // check({ fooThrow(len >= 2 ? null : (len == 2 ?        makeS(1).get() : null)       ); }, "fooThrow.");
+    // check({ fooThrow(len >= 2 ? null : (len == 2 ? null : makeS(1).get()       )       ); }, "fooThrow.");
+    // check({ fooThrow(len >= 2 ? null : (len != 2 ?        makeS(1).get() : null)       ); }, "fooThrow.");
+    // check({ fooThrow(len >= 2 ? null : (len != 2 ? null : makeS(1).get()       )       ); }, "fooThrow.");
+    // check({ fooThrow(len >  2 ?        (len == 2 ?        makeS(1).get() : null) : null); }, "fooThrow.");
+    // check({ fooThrow(len >  2 ?        (len == 2 ? null : makeS(1).get()       ) : null); }, "fooThrow.");
+    // check({ fooThrow(len >  2 ?        (len != 2 ?        makeS(1).get() : null) : null); }, "fooThrow.");
+    // check({ fooThrow(len >  2 ?        (len != 2 ? null : makeS(1).get()       ) : null); }, "fooThrow.");
+    // check({ fooThrow(len >  2 ? null : (len == 2 ?        makeS(1).get() : null)       ); }, "makeS(1).get(1).fooThrow.dtor(1).");
+    // check({ fooThrow(len >  2 ? null : (len == 2 ? null : makeS(1).get()       )       ); }, "fooThrow.");
+    // check({ fooThrow(len >  2 ? null : (len != 2 ?        makeS(1).get() : null)       ); }, "fooThrow.");
+    // check({ fooThrow(len >  2 ? null : (len != 2 ? null : makeS(1).get()       )       ); }, "makeS(1).get(1).fooThrow.dtor(1).");
+
+    // temporaries in each conditions
+    check({ foo(len == 2 ? makeS(1).get() : null, len == 2 ? makeS(2).get() : null); }, "makeS(1).get(1).makeS(2).get(2).foo.dtor(2).dtor(1).");
+    check({ foo(len == 2 ? makeS(1).get() : null, len != 2 ? makeS(2).get() : null); }, "makeS(1).get(1).foo.dtor(1).");
+    check({ foo(len != 2 ? makeS(1).get() : null, len == 2 ? makeS(2).get() : null); }, "makeS(2).get(2).foo.dtor(2).");
+    check({ foo(len != 2 ? makeS(1).get() : null, len != 2 ? makeS(2).get() : null); }, "foo.");
+
+    // nesting temporaries in conditions
+    check({ foo(len == 2 ? makeS(1).get(len == 2 ? makeS(2).get() : null) : null); }, "makeS(1).makeS(2).get(2).get(1).foo.dtor(2).dtor(1).");
+    check({ foo(len == 2 ? makeS(1).get(len != 2 ? makeS(2).get() : null) : null); }, "makeS(1).get(1).foo.dtor(1).");
+    check({ foo(len != 2 ? makeS(1).get(len == 2 ? makeS(2).get() : null) : null); }, "foo.");
+    check({ foo(len != 2 ? makeS(1).get(len != 2 ? makeS(2).get() : null) : null); }, "foo.");
+}
+
+/**********************************/
+// 14838
+
+int test14838() pure nothrow @safe
+{
+    int dtor;
+
+    struct S14838(T)
+    {
+        ~this() { ++dtor; }
+    }
+    struct X14838
+    {
+              S14838!int ms;
+        const S14838!int cs;
+
+              S14838!int[2] ma;
+        const S14838!int[2] ca;
+
+              S14838!int[2][2] ma2x2;
+        const S14838!int[2][2] ca2x2;
+
+        // number of S14838 = 1*2 + 2*2 + 4*2 = 14
+    }
+
+    void test(Dg)(scope Dg code)
+    {
+        dtor = 0;
+        code();
+    }
+
+    test(delegate{       S14838!int a; }); assert(dtor == 1);
+    test(delegate{ const S14838!int a; }); assert(dtor == 1);
+
+    test(delegate{       S14838!int[2] a; }); assert(dtor == 2);
+    test(delegate{ const S14838!int[2] a; }); assert(dtor == 2);
+
+    test(delegate{       S14838!int[2][2] a; }); assert(dtor == 4);
+    test(delegate{ const S14838!int[2][2] a; }); assert(dtor == 4);
+
+    test(delegate{       X14838 a; }); assert(dtor == 1 * 14);
+    test(delegate{ const X14838 a; }); assert(dtor == 1 * 14);
+
+    test(delegate{       X14838[2] a; }); assert(dtor == 2 * 14);
+    test(delegate{ const X14838[2] a; }); assert(dtor == 2 * 14);
+
+    test(delegate{       X14838[2][2] a; }); assert(dtor == 4 * 14);
+    test(delegate{ const X14838[2][2] a; }); assert(dtor == 4 * 14);
+
+    return 1;
+}
+static assert(test14838());
+
+/**********************************/
+
+struct S63
+{
+    private long p = 87;
+
+    this(int x)
+    {
+        assert(p == 87);
+        p += x;
+    }
+
+    ~this() { }
+
+    this(this) { }
+
+    void funky() { assert(p == 90); }
+
+    static void tester()
+    {
+        S63(3).funky();
+    }
+}
+
+void test63()
+{
+    S63.tester();
+}
+
+/**********************************/
+
+struct X64
+{
+    static int dtor;
+
+    ~this() { ++dtor; }
+}
+
+struct S64
+{
+    int n;
+    long[10] dummy;     // S64 needs to be passed by stack
+}
+
+S64 foo64()
+{
+    return S64((X64(), 1));
+}
+
+void test64()
+{
+    auto s = foo64();
+    assert(X64.dtor == 1);
+}
+
+/**********************************/
+// 15661
+
+struct X15661
+{
+    ~this() {}
+}
+
+X15661 createX15661() { return X15661(); }
+
+struct Y15661
+{
+    static int dtor;
+
+    @disable this();
+    @disable this(this);
+    this(X15661 a1, X15661 a2) {}
+    ~this() { ++dtor; }
+}
+
+struct Z15661
+{
+    this(int)
+    {
+        b = Y15661(createX15661(), createX15661());
+        assert(Y15661.dtor == 0);
+    }
+
+    private Y15661 b;
+}
+
+void test15661()
+{
+    {
+        auto v = Z15661(5);
+        assert(Y15661.dtor == 0);
+    }
+    assert(Y15661.dtor == 1);
+}
+
+/**********************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+
+    test54();
+    test55();
+    test56();
+    test57();
+    test58();
+    test59();
+    test5737();
+    test6119();
+    test8741();
+    test6364();
+    test6499();
+    test60();
+    test4316();
+    test6177();
+    test6470();
+    test6636();
+    test6637();
+    test7353();
+    test61();
+    test7506();
+    test7530();
+    test7516a();
+    test7516b();
+    test7516c();
+    test7516d();
+    test7516e();
+    test62();
+    test7579a();
+    test7579b();
+    test8335();
+    test8356();
+    test9386();
+    test9441();
+    test9720();
+    test9899();
+    test9907();
+    test9985();
+    test9994();
+    test10094();
+    test10244();
+    test10694();
+    test10789();
+    test10972();
+    test11134();
+    test11197();
+    test7474();
+    test11505();
+    test12045();
+    test12591();
+    test12660();
+    test12686();
+    test13089();
+    test11763();
+    test13303();
+    test13673();
+    test13586();
+    test14443();
+    test13661();
+    test13661a();
+    test14022();
+    test14023();
+    test13669();
+    test13095();
+    test14264();
+    test14815();
+    test14860();
+    test14696();
+    test14838();
+    test63();
+    test64();
+    test15661();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/statictor.d b/gcc/testsuite/gdc.test/runnable/statictor.d
new file mode 100644
index 00000000000..e378966ae57
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/statictor.d
@@ -0,0 +1,66 @@
+// PERMUTE_ARGS:
+// POST_SCRIPT: runnable/extra-files/statictor-postscript.sh
+
+private import std.stdio;
+
+class Foo
+{
+        static this() {printf("Foo static ctor\n");}
+        static ~this() {printf("Foo static dtor\n");}
+}
+
+static this() {printf("static ctor\n");}
+static ~this() {printf("static dtor\n");}
+
+shared static this()
+{
+    printf("shared static this()\n");
+}
+
+shared static ~this()
+{
+    printf("shared static this()\n");
+}
+
+class Bar
+{
+        static this() {printf("Bar static ctor\n");}
+        static ~this() {printf("Bar static dtor\n");}
+}
+
+/***********************************************/
+// 6677
+
+int global6677;
+
+static this() nothrow pure @safe
+{
+    int* p;
+    static assert(!__traits(compiles, ++p));
+    static assert(!__traits(compiles, ++global6677));
+    auto throwit = { throw new Exception("sup"); };
+    static assert(!__traits(compiles, throwit() ));
+}
+
+shared static this() nothrow pure @safe
+{
+    int* p;
+    static assert(!__traits(compiles, ++p));
+    static assert(!__traits(compiles, ++global6677));
+}
+
+/***********************************************/
+// 7533
+struct Foo7533(int n)
+{
+    pure static this() { }
+}
+
+alias Foo7533!5 Bar7533;
+
+/***********************************************/
+
+void main()
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/stress.d b/gcc/testsuite/gdc.test/runnable/stress.d
new file mode 100644
index 00000000000..28291ea4f23
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/stress.d
@@ -0,0 +1,735 @@
+// PERMUTE_ARGS:
+
+import core.stdc.stdio : printf;
+import std.string : splitLines;
+import std.utf : toUTF16, toUTF32;
+
+/***********************************************/
+
+void test3()
+{
+    char[] str;
+    str ~= "test"; // segfault
+}
+
+/***********************************************/
+
+class A {
+private:
+    int _i;
+public:
+    this(int i) { _i = i; }
+    int i() { return _i; };
+}
+
+class B : A {
+private:
+    char[] s;
+public:
+    this(int i) { super(i); }
+}
+
+int main()
+{
+    printf("Testing array of Chars\n");
+    CHAR();
+    printf("Testing array of WChars\n");
+    WCHAR();
+    printf("Testing array of DChars\n");
+    DCHAR();
+
+    printf("Testing array of Bytes\n");
+    BYTE();
+    printf("Testing array of UBytes\n");
+    UBYTE();
+    printf("Testing array of Shorts\n");
+    SHORT();
+    printf("Testing array of UShorts\n");
+    USHORT();
+    printf("Testing array of Ints\n");
+    INT();
+    printf("Testing array of UInts\n");
+    UINT();
+    printf("Testing array of Longs\n");
+    LONG();
+    printf("Testing array of ULongs\n");
+    ULONG();
+    printf("Testing array of Floats\n");
+    FLOAT();
+    printf("Testing array of Doubles\n");
+    DOUBLE();
+    printf("Testing array of Reals\n");
+    REAL();
+
+    printf("Testing multi-dim array of Chars\n");
+    MDCHAR();
+
+    printf("Testing array of Objects\n");
+    CLASS();
+
+    test3();
+    return 0;
+}
+
+void MDCHAR()
+{
+    const int ITERS = 100;
+    alias char typ;
+    typ[][] str;
+
+    str.length = ITERS;
+    for(int idx = 0; idx < ITERS; idx++) {
+        str[idx] = str[idx] ~ "TEST LINE\n";
+    }
+
+    if(str.length != ITERS) printf("Length Error: %d\n",str.length);
+    if(str[0].length != 10) printf("Length Error: %d\n",str[0].length);
+    if(str[ITERS-1].sizeof != (typ[]).sizeof) printf("Size Error: %d\n",str[ITERS-1].sizeof);
+    if(str[ITERS-1][0].sizeof != (typ).sizeof) printf("Size Error: %d\n",str[ITERS-1][0].sizeof);
+
+    foreach(s; str) {
+        int lstart;
+        foreach(int idx, char c; s) {
+            if(c == '\n') {
+                typ[] t = s[lstart..idx];
+                if(t != "TEST LINE") {
+                    printf("Error testing character array\n");
+                    break;
+                }
+                lstart = idx + 1;
+            }
+        }
+    }
+
+    typ[] tmp;
+    foreach(char[] s; str) {
+        tmp = tmp ~ s;
+    }
+
+    foreach(s; splitLines(cast(string)tmp)) {
+        int lstart;
+        foreach(int idx, char c; s) {
+            if(c == '\n') {
+                if(s[lstart..idx] != "TEST LINE") {
+                    printf("Error testing character array\n");
+                    break;
+                }
+                lstart = idx + 1;
+            }
+        }
+    }
+}
+
+void CHAR()
+{
+    const int ITERS = 1000;
+    alias char typ;
+    typ[] str;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        str = str ~ "TEST LINE\n";
+    }
+
+    if(str.length != (ITERS * 10)) printf("Length Error: %d\n",str.length);
+    if(str.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",str.sizeof);
+
+    int lstart;
+    foreach(int idx, char c; str) {
+        if(c == '\n') {
+            if(str[lstart..idx] != "TEST LINE") {
+                printf("Error testing character array\n");
+                break;
+            }
+            lstart = idx + 1;
+        }
+    }
+}
+
+void WCHAR()
+{
+    const int ITERS = 1000;
+    alias wchar typ;
+    typ[] str;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        str = str ~ toUTF16(cast(char[])"TEST LINE\n");
+    }
+
+    if(str.length != (ITERS * 10)) printf("Length Error: %d\n",str.length);
+    if(str.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",str.sizeof);
+
+    int lstart;
+    foreach(int idx, char c; str) {
+        if(c == '\n') {
+            if(str[lstart..idx] != toUTF16(cast(char[])"TEST LINE")) {
+                printf("Error testing character array\n");
+                break;
+            }
+            lstart = idx + 1;
+        }
+    }
+}
+
+void DCHAR()
+{
+    const int ITERS = 1000;
+    alias dchar typ;
+    typ[] str;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        str = str ~ toUTF32(cast(char[])"TEST LINE\n");
+    }
+
+    if(str.length != (ITERS * 10)) printf("Length Error: %d\n",str.length);
+    if(str.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",str.sizeof);
+
+    int lstart;
+    foreach(int idx, char c; str) {
+        if(c == '\n') {
+            if(str[lstart..idx] != toUTF32(cast(char[])"TEST LINE")) {
+                printf("Error testing character array\n");
+                break;
+            }
+            lstart = idx + 1;
+        }
+    }
+}
+
+void BYTE()
+{
+    const int ITERS = 100;
+    alias byte typ;
+    typ[] a;
+
+    for(typ idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void UBYTE()
+{
+    const int ITERS = 100;
+    alias ubyte typ;
+    typ[] a;
+
+    for(typ idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void SHORT()
+{
+    const int ITERS = 10000;
+    alias short typ;
+    typ[] a;
+
+    for(typ idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void USHORT()
+{
+    const int ITERS = 10000;
+    alias ushort typ;
+    typ[] a;
+
+    for(typ idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void INT()
+{
+    const int ITERS = 1000000;
+    alias int typ;
+    typ[] a;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void UINT()
+{
+    const int ITERS = 1000000;
+    alias uint typ;
+    typ[] a;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void LONG()
+{
+    const int ITERS = 1000000;
+    alias long typ;
+    typ[] a;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void ULONG()
+{
+    const int ITERS = 1000000;
+    alias ulong typ;
+    typ[] a;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void FLOAT()
+{
+    const int ITERS = 1000000;
+    alias float typ;
+    typ[] a;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void DOUBLE()
+{
+    const int ITERS = 1000000;
+    alias double typ;
+    typ[] a;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void REAL()
+{
+    const int ITERS = 1000000;
+    alias real typ;
+    typ[] a;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        a ~= idx;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx] != idx) {
+            printf("a Data Error: %d\n",a[idx]);
+            break;
+        }
+    }
+
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx] != idx) {
+            printf("b Data Error: %d\n",b[idx]);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx] != idx) {
+            printf("c Data Error: %d\n",c[idx]);
+            break;
+        }
+    }
+}
+
+void CLASS()
+{
+    const int ITERS = 1000000;
+    alias B typ;
+    typ[] a;
+
+    for(int idx = 0; idx < ITERS; idx++) {
+        typ tc = new typ(idx);
+        a ~= tc;
+    }
+
+    if(a.length != ITERS) printf("Length Error: %d\n",a.length);
+    if(a.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",a.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(a[idx].i != idx) {
+            printf("a Data Error: %d\n",a[idx].i);
+            break;
+        }
+    }
+
+    typ[] b = a[];
+
+    if(b.length != ITERS) printf("Length Error: %d\n",b.length);
+    if(b.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",b.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(b[idx].i != idx) {
+            printf("b Data Error: %d\n",b[idx].i);
+            break;
+        }
+    }
+
+    typ[] c;
+    c = a[0..ITERS/2] ~ b[ITERS/2..$];
+
+    if(c.length != ITERS) printf("Length Error: %d\n",c.length);
+    if(c.sizeof != (typ[]).sizeof) printf("Size Error: %d\n",c.sizeof);
+    for(int idx = 0; idx < ITERS; idx++) {
+        if(c[idx].i != idx) {
+            printf("c Data Error: %d\n",c[idx].i);
+            break;
+        }
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/structlit.d b/gcc/testsuite/gdc.test/runnable/structlit.d
new file mode 100644
index 00000000000..29ad07feeb1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/structlit.d
@@ -0,0 +1,1481 @@
+import std.stdio;
+
+struct S
+{
+    int x;
+    int y;
+}
+
+/********************************************/
+
+void test1()
+{
+    S s = S(1,2);
+    assert(s.x == 1);
+    assert(s.y == 2);
+}
+
+/********************************************/
+
+void foo2(S s)
+{
+    assert(s.x == 1);
+    assert(s.y == 2);
+}
+
+void test2()
+{
+    foo2( S(1,2) );
+}
+
+/********************************************/
+
+S foo3()
+{
+    return S(1, 2);
+}
+
+void test3()
+{
+    S s = foo3();
+    assert(s.x == 1);
+    assert(s.y == 2);
+}
+
+/********************************************/
+
+struct S4
+{
+    long x;
+    long y;
+    long z;
+}
+
+S4 foo4()
+{
+    return S4(1, 2, 3);
+}
+
+void test4()
+{
+    S4 s = foo4();
+    assert(s.x == 1);
+    assert(s.y == 2);
+    assert(s.z == 3);
+}
+
+/********************************************/
+
+struct S5
+{
+    long x;
+    char y;
+    long z;
+}
+
+S5 foo5()
+{
+    return S5(1, 2, 3);
+}
+
+void test5()
+{
+    S5 s = foo5();
+    assert(s.x == 1);
+    assert(s.y == 2);
+    assert(s.z == 3);
+}
+
+/********************************************/
+
+struct S6
+{
+    long x;
+    char y;
+    long z;
+}
+
+void test6()
+{
+    S6 s1 = S6(1,2,3);
+    S6 s2 = S6(1,2,3);
+    assert(s1 == s2);
+
+    s1 = S6(4,5,6);
+    s2 = S6(4,5,6);
+    assert(s1 == s2);
+
+    S6* p1 = &s1;
+    S6* p2 = &s2;
+    *p1 = S6(7,8,9);
+    *p2 = S6(7,8,9);
+    assert(*p1 == *p2);
+}
+
+/********************************************/
+
+struct S7
+{
+    long x;
+    char y;
+    long z;
+}
+
+void test7()
+{
+    static S7 s1 = S7(1,2,3);
+    static S7 s2 = S7(1,2,3);
+    assert(s1 == s2);
+}
+
+/********************************************/
+
+struct S8
+{
+    int i;
+    string s;
+}
+
+void test8()
+{
+    S8 s = S8(3, "hello");
+    assert(s.i == 3);
+    assert(s.s == "hello");
+
+    static S8 t = S8(4, "betty");
+    assert(t.i == 4);
+    assert(t.s == "betty");
+
+    S8 u = S8(3, ['h','e','l','l','o']);
+    assert(u.i == 3);
+    assert(u.s == "hello");
+
+    static S8 v = S8(4, ['b','e','t','t','y']);
+    assert(v.i == 4);
+    assert(v.s == "betty");
+}
+
+/********************************************/
+
+struct S9
+{
+    int i;
+    char[5] s;
+}
+
+void test9()
+{
+    S9 s = S9(3, "hello");
+    assert(s.i == 3);
+    assert(s.s == "hello");
+
+    static S9 t = S9(4, "betty");
+    assert(t.i == 4);
+    assert(t.s == "betty");
+
+    S9 u = S9(3, ['h','e','l','l','o']);
+    assert(u.i == 3);
+    assert(u.s == "hello");
+
+    static S9 v = S9(4, ['b','e','t','t','y']);
+    assert(v.i == 4);
+    assert(v.s == "betty");
+}
+
+/********************************************/
+
+alias int myint10;
+
+struct S10
+{
+    int i;
+    union
+    {
+        int x = 2;
+        int y;
+    }
+    int j = 3;
+    myint10 k = 4;
+}
+
+void test10()
+{
+    S10 s = S10( 1 );
+    assert(s.i == 1);
+    assert(s.x == 2);
+    assert(s.y == 2);
+    assert(s.j == 3);
+    assert(s.k == 4);
+
+    static S10 t = S10( 1 );
+    assert(t.i == 1);
+    assert(t.x == 2);
+    assert(t.y == 2);
+    assert(t.j == 3);
+    assert(t.k == 4);
+
+    S10 u = S10( 1, 5 );
+    assert(u.i == 1);
+    assert(u.x == 5);
+    assert(u.y == 5);
+    assert(u.j == 3);
+    assert(u.k == 4);
+
+    static S10 v = S10( 1, 6 );
+    assert(v.i == 1);
+    assert(v.x == 6);
+    assert(v.y == 6);
+    assert(v.j == 3);
+    assert(v.k == 4);
+}
+
+/********************************************/
+
+struct S11
+{
+    int i;
+    int j = 3;
+}
+
+
+void test11()
+{
+    static const s = S11( 1, 5 );
+    static const i = s.i;
+    assert(i == 1);
+    static assert(s.j == 5);
+}
+
+/********************************************/
+
+struct S12
+{
+    int[5] x;
+    int[5] y = 3;
+}
+
+void test12()
+{
+    S12 s = S12();
+    foreach (v; s.x)
+        assert(v == 0);
+    foreach (v; s.y)
+        assert(v == 3);
+}
+
+/********************************************/
+
+struct S13
+{
+    int[5] x;
+    int[5] y;
+    int[6][3] z;
+}
+
+void test13()
+{
+    S13 s = S13(0,3,4);
+    foreach (v; s.x)
+        assert(v == 0);
+    foreach (v; s.y)
+        assert(v == 3);
+    for (int i = 0; i < 6; i++)
+    {
+        for (int j = 0; j < 3; j++)
+        {
+            assert(s.z[j][i] == 4);
+        }
+    }
+}
+
+/********************************************/
+
+struct S14a { int n; }
+struct S14b { this(int n){} }
+
+void foo14(ref S14a s) {}
+void foo14(ref S14b s) {}
+void hoo14()(ref S14a s) {}
+void hoo14()(ref S14b s) {}
+void poo14(S)(ref S s) {}
+
+void bar14(S14a s) {}
+void bar14(S14b s) {}
+void var14()(S14a s) {}
+void var14()(S14b s) {}
+void war14(S)(S s) {}
+
+int baz14(    S14a s) { return 1; }
+int baz14(ref S14a s) { return 2; }
+int baz14(    S14b s) { return 1; }
+int baz14(ref S14b s) { return 2; }
+int vaz14()(    S14a s) { return 1; }
+int vaz14()(ref S14a s) { return 2; }
+int vaz14()(    S14b s) { return 1; }
+int vaz14()(ref S14b s) { return 2; }
+int waz14(S)(    S s) { return 1; }
+int waz14(S)(ref S s) { return 2; }
+
+void test14()
+{
+    // can not bind rvalue-sl with ref
+    static assert(!__traits(compiles, foo14(S14a(0))));
+    static assert(!__traits(compiles, foo14(S14b(0))));
+    static assert(!__traits(compiles, hoo14(S14a(0))));
+    static assert(!__traits(compiles, hoo14(S14b(0))));
+    static assert(!__traits(compiles, poo14(S14a(0))));
+    static assert(!__traits(compiles, poo14(S14b(0))));
+
+    // still can bind rvalue-sl with non-ref
+    bar14(S14a(0));
+    bar14(S14b(0));
+    var14(S14a(0));
+    var14(S14b(0));
+    war14(S14a(0));
+    war14(S14b(0));
+
+    // preferred binding of rvalue-sl in overload resolution
+    assert(baz14(S14a(0)) == 1);
+    assert(baz14(S14b(0)) == 1);
+    assert(vaz14(S14a(0)) == 1);
+    assert(vaz14(S14b(0)) == 1);
+    assert(waz14(S14a(0)) == 1);
+    assert(waz14(S14b(0)) == 1);
+}
+
+/********************************************/
+
+void check15(T, ubyte results, A...)(A args)
+{
+                         // m c i s sc
+    enum m  = (results & 0b_1_0_0_0_0) != 0;
+    enum c  = (results & 0b_0_1_0_0_0) != 0;
+    enum i  = (results & 0b_0_0_1_0_0) != 0;
+    enum s  = (results & 0b_0_0_0_1_0) != 0;
+    enum sc = (results & 0b_0_0_0_0_1) != 0;
+
+    // allocation on stack
+    static assert((is(typeof(                  T(args) ) U) && is(U ==              T  )) == m);
+    static assert((is(typeof(            const T(args) ) U) && is(U ==        const(T) )) == c);
+    static assert((is(typeof(        immutable T(args) ) U) && is(U ==    immutable(T) )) == i);
+    static assert((is(typeof(           shared T(args) ) U) && is(U ==       shared(T) )) == s);
+    static assert((is(typeof(     shared const T(args) ) U) && is(U == shared(const T) )) == sc);
+
+    // allocation on heap
+    static assert((is(typeof( new              T(args) ) U) && is(U ==              T *)) == m);
+    static assert((is(typeof( new        const T(args) ) U) && is(U ==        const(T)*)) == c);
+    static assert((is(typeof( new    immutable T(args) ) U) && is(U ==    immutable(T)*)) == i);
+    static assert((is(typeof( new       shared T(args) ) U) && is(U ==       shared(T)*)) == s);
+    static assert((is(typeof( new shared const T(args) ) U) && is(U == shared(const T)*)) == sc);
+}
+void test15a()
+{
+    static struct Foo1 { this(int v) {}                int value; }
+    static struct Boo1 { this(int v) const {}          int[] value; }
+    static struct Bar1 { this(int[] v) {}              int[] value; }
+    static struct Baz1 { this(const int[] v) pure {}   int[] value; }  // unique ctor
+    static struct Coo1 { this(int[] v) immutable {}    int[] value; }
+    static struct Car1 { this(int[] v) immutable {}    immutable(int)[] value; }
+    check15!(Foo1, 0b_1_1_0_0_0)(1);
+    check15!(Boo1, 0b_0_1_0_0_0)(1);
+    check15!(Bar1, 0b_1_1_0_0_0)(null);
+    check15!(Baz1, 0b_1_1_1_1_1)(null);
+    check15!(Coo1, 0b_0_1_1_0_1)(null);
+    check15!(Car1, 0b_0_1_1_0_1)(null);
+                   // m c i s sc
+
+    // Template constructor should work as same as non-template ones
+    static struct Foo2 { this()(int v) {}              int value; }
+    static struct Boo2 { this()(int v) const {}        int[] value; }
+    static struct Bar2 { this()(int[] v) {}            int[] value; }  // has mutable indieection
+    static struct Baz2 { this()(const int[] v) pure {} int[] value; }  // unique ctor
+    static struct Coo2 { this()(int[] v) immutable {}  int[] value; }
+    static struct Car2 { this()(int[] v) immutable {}  immutable(int)[] value; }
+    check15!(Foo2, 0b_1_1_0_0_0)(1);
+    check15!(Boo2, 0b_0_1_0_0_0)(1);
+    check15!(Bar2, 0b_1_1_0_0_0)(null);
+    check15!(Baz2, 0b_1_1_1_1_1)(null);
+    check15!(Coo2, 0b_0_1_1_0_1)(null);
+    check15!(Car2, 0b_0_1_1_0_1)(null);
+                   // m c i s sc
+
+    // Except Bar!().__ctor, their constructors are inferred to pure, then they become unique ctors.
+    static struct Foo3() { this(int v) {}              int value; }
+    static struct Boo3() { this(int v) const {}        int[] value; }
+    static struct Bar3() { this(int[] v) {}            int[] value; }  // has mutable indieection
+    static struct Baz3() { this(const int[] v) pure {} int[] value; }  // unique ctor
+    static struct Coo3() { this(int[] v) immutable {}  int[] value; }
+    static struct Car3() { this(int[] v) immutable {}  immutable(int)[] value; }
+    check15!(Foo3!(), 0b_1_1_1_1_1)(1);
+    check15!(Boo3!(), 0b_1_1_1_1_1)(1);
+    check15!(Bar3!(), 0b_1_1_0_0_0)(null);
+    check15!(Baz3!(), 0b_1_1_1_1_1)(null);
+    check15!(Coo3!(), 0b_1_1_1_1_1)(null);
+    check15!(Car3!(), 0b_1_1_1_1_1)(null);
+                      // m c i s sc
+}
+
+// inout constructor works as like unique constructor in many cases
+void test15b()
+{
+    static struct Nullable1
+    {
+        private int[] _value;
+        private bool _isNull = true;
+        this(inout int[] v) inout //pure
+        {
+            _value = v;
+            //static int g; auto x = g; // impure access
+            _isNull = false;
+        }
+    }
+    static assert( __traits(compiles,           Nullable1([1,2,3])));
+    static assert(!__traits(compiles,           Nullable1([1,2,3].idup)));
+    static assert(!__traits(compiles, immutable Nullable1([1,2,3])));
+    static assert( __traits(compiles, immutable Nullable1([1,2,3].idup)));
+    static assert(!__traits(compiles,    shared Nullable1([1,2,3])));
+    static assert(!__traits(compiles,    shared Nullable1([1,2,3].idup)));
+
+    static struct Nullable2(T)
+    {
+        private T _value;
+        private bool _isNull = true;
+        this(inout T v) inout //pure
+        {
+            _value = v;
+            //static int g; auto x = g; // impure access
+            _isNull = false;
+        }
+    }
+    static assert( __traits(compiles,           Nullable2!(int[])([1,2,3])));
+    static assert(!__traits(compiles,           Nullable2!(int[])([1,2,3].idup)));
+    static assert(!__traits(compiles, immutable Nullable2!(int[])([1,2,3])));
+    static assert( __traits(compiles, immutable Nullable2!(int[])([1,2,3].idup)));
+    static assert(!__traits(compiles,    shared Nullable2!(int[])([1,2,3])));
+    static assert(!__traits(compiles,    shared Nullable2!(int[])([1,2,3].idup)));
+
+    // ctor is inout pure, but cannot create unique object.
+    struct S
+    {
+        int[] marr;
+        const int[] carr;
+        immutable int[] iarr;
+        this(int[] m, const int[] c, immutable int[] i) inout pure
+        {
+            static assert(!__traits(compiles, marr = m));
+            static assert(!__traits(compiles, carr = c));  // cannot implicitly convertible const(int[]) to inout(const(int[]))
+            iarr = i;
+        }
+    }
+    static assert(!__traits(compiles, { int[] ma; immutable int[] ia; auto m =           S(ma, ma, ia); }));
+    static assert( __traits(compiles, { int[] ma; immutable int[] ia; auto c =     const S(ma, ma, ia); }));
+    static assert(!__traits(compiles, { int[] ma; immutable int[] ia; auto i = immutable S(ma, ma, ia); }));
+}
+
+// TemplateThisParameter with constructor should work
+void test15c()
+{
+    static class C
+    {
+        this(this This)()
+        {
+            static assert(is(This == immutable C));
+        }
+
+        this(T = void, this This)(int)
+        {
+            static assert(is(This == immutable C));
+        }
+    }
+    auto c1 = new immutable C;
+    auto c2 = new immutable C(1);
+}
+
+void test15d()  // Bugzilla 9974
+{
+    class CM { this() {} }
+    auto cm = new CM();
+
+    const class CC { this() {} }
+    const cc = new const CC();
+
+    immutable class CI { this() {} }
+    immutable ci = new immutable CI();
+
+    shared class CS { this() {} }
+    shared cs = new shared CS();
+
+    shared const class CSC { this() {} }
+    shared const csc = new shared const CSC();
+
+
+    struct SM { this(int) {} }
+    auto sm = new SM(1);
+
+    const struct SC { this(int) {} }
+    const sc = new const SC(1);
+
+    immutable struct SI { this(int) {} }
+    immutable si = new immutable SI(1);
+
+    shared struct SS { this(int) {} }
+    shared ss = new shared SS(1);
+
+    shared const struct SSC { this(int) {} }
+    shared const ssc = new shared const SSC(1);
+}
+
+void test15e()  // Bugzilla 10005
+{
+    // struct literal
+    static struct S
+    {
+        int[] a;
+    }
+    int[] marr = [1,2,3];
+    static assert( __traits(compiles, {           S m =           S(marr); }));
+    static assert( __traits(compiles, {     const S c =           S(marr); }));
+    static assert(!__traits(compiles, { immutable S i =           S(marr); }));
+    immutable int[] iarr = [1,2,3];
+    static assert(!__traits(compiles, {           S m = immutable S(iarr); }));
+    static assert( __traits(compiles, {     const S c = immutable S(iarr); }));
+    static assert( __traits(compiles, { immutable S i = immutable S(iarr); }));
+
+    // mutable constructor
+    static struct MS
+    {
+        int[] a;
+        this(int n) { a = new int[](n); }
+    }
+    static assert( __traits(compiles, {           MS m =           MS(3); }));
+    static assert( __traits(compiles, {     const MS c =           MS(3); }));
+    static assert(!__traits(compiles, { immutable MS i =           MS(3); }));
+    static assert(!__traits(compiles, {           MS m = immutable MS(3); }));
+    static assert(!__traits(compiles, {     const MS c = immutable MS(3); }));
+    static assert(!__traits(compiles, { immutable MS i = immutable MS(3); }));
+
+    // immutable constructor
+    static struct IS
+    {
+        int[] a;
+        this(int n) immutable { a = new int[](n); }
+    }
+    static assert(!__traits(compiles, {           IS m =           IS(3); }));
+    static assert(!__traits(compiles, {     const IS c =           IS(3); }));
+    static assert(!__traits(compiles, { immutable IS i =           IS(3); }));
+    static assert(!__traits(compiles, {           IS m = immutable IS(3); }));
+    static assert( __traits(compiles, {     const IS c = immutable IS(3); }));
+    static assert( __traits(compiles, { immutable IS i = immutable IS(3); }));
+}
+
+struct Foo9984
+{
+    int[] p;
+    // Prefix storage class and tempalte constructor
+    inout this()(inout int[] a) { p = a; }
+    auto foo() inout { return inout(Foo9984)(p); }
+}
+
+void test9993a()
+{
+    static class A
+    {
+        int x;
+        this()           { x = 13; }
+        this() immutable { x = 42; }
+    }
+              A ma = new           A;   assert(ma.x == 13);
+    immutable A ia = new immutable A;   assert(ia.x == 42);
+    static assert(!__traits(compiles, { immutable A ia = new A; }));
+
+    static class B
+    {
+        int x;
+        this()       { x = 13; }
+        this() const { x = 42; }
+    }
+    const B mb = new       B;           assert(mb.x == 13);
+    const B cb = new const B;           assert(cb.x == 42);
+    static assert(!__traits(compiles, { immutable B ib = new B; }));
+
+    static class C
+    {
+        int x;
+        this() const     { x = 13; }
+        this() immutable { x = 42; }
+    }
+        const C cc = new     const C;   assert(cc.x == 13);
+    immutable C ic = new immutable C;   assert(ic.x == 42);
+    static assert(!__traits(compiles, { C mc = new C; }));
+}
+void test9993b()
+{
+    static class A
+    {
+        int x;
+        this()()           { x = 13; }
+        this()() immutable { x = 42; }
+    }
+              A ma = new           A;   assert(ma.x == 13);
+    immutable A ia = new immutable A;   assert(ia.x == 42);
+    static assert(__traits(compiles, { immutable A ia = new A; }));
+
+    static class B
+    {
+        int x;
+        this()()       { x = 13; }
+        this()() const { x = 42; }
+    }
+    const B mb = new       B;           assert(mb.x == 13);
+    const B cb = new const B;           assert(cb.x == 42);
+    static assert(__traits(compiles, { immutable B ib = new B; }));
+
+    static class C
+    {
+        int x;
+        this()() const     { x = 13; }
+        this()() immutable { x = 42; }
+    }
+        const C cc = new     const C;   assert(cc.x == 13);
+    immutable C ic = new immutable C;   assert(ic.x == 42);
+    static assert(!__traits(compiles, { C mc = new C; }));
+}
+
+/********************************************/
+// 1914
+
+struct Bug1914a
+{
+    const char[10] i = [1,0,0,0,0,0,0,0,0,0];
+    char[10] x = i;
+    int y=5;
+}
+
+struct Bug1914b
+{
+    const char[10] i = [0,0,0,0,0,0,0,0,0,0];
+    char[10] x = i;
+    int y=5;
+}
+
+struct Bug1914c
+{
+    const char[2] i = ['a', 'b'];
+    const char[2][3] j = [['x', 'y'], ['p', 'q'], ['r', 's']];
+    const char[2][3] k = ["cd", "ef", "gh"];
+    const char[2][3] l = [['x', 'y'], ['p'], ['h', 'k']];
+    char[2][3] x = i;
+    int y = 5;
+    char[2][3] z = j;
+    char[2][3] w = k;
+    int v=27;
+    char[2][3] u = l;
+    int t = 718;
+}
+
+struct T3198 {
+   int g = 1;
+}
+
+class Foo3198 {
+   int[5] x = 6;
+   T3198[5] y = T3198(4);
+}
+
+void test3198and1914()
+{
+    Bug1914a a;
+    assert(a.y==5, "bug 1914, non-zero init");
+    Bug1914b b;
+    assert(b.y==5, "bug 1914, zero init");
+    Bug1914c c;
+    assert(c.y==5, "bug 1914, multilevel init");
+    assert(c.v==27, "bug 1914, multilevel init2");
+    assert(c.x[2][1]=='b');
+    assert(c.t==718, "bug 1914, multi3");
+    assert(c.u[1][0]=='p');
+    assert(c.u[1][1]==char.init);
+    auto f = new Foo3198();
+    assert(f.x[0]==6);
+    assert(f.y[0].g==4, "bug 3198");
+}
+
+/********************************************/
+// 2427
+
+void test2427()
+{
+    struct S
+    {
+        int x;
+    }
+
+    int foo(int i)
+    {
+        return i;
+    }
+
+    int i;
+    S s = { foo(i) };
+}
+
+/********************************************/
+
+struct T5885 {
+    uint a, b;
+}
+
+double mulUintToDouble(T5885 t, double m) {
+    return t.a * m;
+}
+
+void test5885()
+{
+    enum ae = mulUintToDouble(T5885(10, 0), 10.0);
+    enum be = mulUintToDouble(T5885(10, 20), 10.0);
+    static assert(ae == be);
+
+    auto a = mulUintToDouble(T5885(10, 0), 10.0);
+    auto b = mulUintToDouble(T5885(10, 20), 10.0);
+    assert(a == b);
+}
+
+/********************************************/
+// 5889
+
+struct S5889a { int n; }
+struct S5889b { this(int n){} }
+
+bool isLvalue(S)(auto ref S s){ return __traits(isRef, s); }
+
+int foo(ref S5889a s) { return 1; }
+int foo(    S5889a s) { return 2; }
+int foo(ref S5889b s) { return 1; }
+int foo(    S5889b s) { return 2; }
+
+int goo(ref const(S5889a) s) { return 1; }
+int goo(    const(S5889a) s) { return 2; }
+int goo(ref const(S5889b) s) { return 1; }
+int goo(    const(S5889b) s) { return 2; }
+
+int too(S)(ref S s) { return 1; }
+int too(S)(    S s) { return 2; }
+
+S makeRvalue(S)(){ S s; return s; }
+
+void test5889()
+{
+    S5889a sa;
+    S5889b sb;
+
+    assert( isLvalue(sa));
+    assert( isLvalue(sb));
+    assert(!isLvalue(S5889a(0)));
+    assert(!isLvalue(S5889b(0)));
+    assert(!isLvalue(makeRvalue!S5889a()));
+    assert(!isLvalue(makeRvalue!S5889b()));
+
+    assert(foo(sa) == 1);
+    assert(foo(sb) == 1);
+    assert(foo(S5889a(0)) == 2);
+    assert(foo(S5889b(0)) == 2);
+    assert(foo(makeRvalue!S5889a()) == 2);
+    assert(foo(makeRvalue!S5889b()) == 2);
+
+    assert(goo(sa) == 1);
+    assert(goo(sb) == 1);
+    assert(goo(S5889a(0)) == 2);
+    assert(goo(S5889b(0)) == 2);
+    assert(goo(makeRvalue!S5889a()) == 2);
+    assert(goo(makeRvalue!S5889b()) == 2);
+
+    assert(too(sa) == 1);
+    assert(too(sb) == 1);
+    assert(too(S5889a(0)) == 2);
+    assert(too(S5889b(0)) == 2);
+    assert(too(makeRvalue!S5889a()) == 2);
+    assert(too(makeRvalue!S5889b()) == 2);
+}
+
+/********************************************/
+// 4147
+
+struct S4247
+{
+    int n = 1024;
+    this(int x) { n = x; }
+}
+void test4247()
+{
+    auto p1 = S4247();
+    assert(p1.n == 1024);
+
+    auto p2 = S4247(1);
+    assert(p2.n == 1);
+}
+
+/********************************************/
+// 6937
+
+void test6937()
+{
+    static struct S
+    {
+        int x, y;
+    }
+
+    auto s1 = S(1, 2);
+    auto ps1 = new S(1, 2);
+    assert(ps1.x == 1);
+    assert(ps1.y == 2);
+    assert(*ps1 == s1);
+
+    auto ps2 = new S(1);
+    assert(ps2.x == 1);
+    assert(ps2.y == 0);
+    assert(*ps2 == S(1, 0));
+
+    static assert(!__traits(compiles, new S(1,2,3)));
+
+    int v = 0;
+    struct NS
+    {
+        int x;
+        void foo() { v = x; }
+    }
+    auto ns = NS(1);
+    ns.foo();
+    assert(ns.x == 1);
+    assert(v == 1);
+    auto pns = new NS(2);
+    assert(pns.x == 2);
+    pns.foo();
+    assert(v == 2);
+    pns.x = 1;
+    assert(*pns == ns);
+
+    static struct X {
+        int v;
+        this(this) { ++v; }
+    }
+    static struct Y {
+        X x;
+    }
+    Y y = Y(X(1));
+    assert(y.x.v == 1);
+    auto py1 = new Y(X(1));
+    assert(py1.x.v == 1);
+    assert(*py1 == y);
+    auto py2 = new Y(y.x);
+    assert(py2.x.v == 2);
+}
+
+/********************************************/
+// 12681
+
+struct HasUnion12774
+{
+    union
+    {
+        int a, b;
+    }
+}
+
+bool test12681()
+{
+    immutable int x = 42;
+
+    static struct S1
+    {
+        immutable int *p;
+    }
+    immutable s1 = new S1(&x);
+    assert(s1.p == &x);
+
+    struct S2
+    {
+        immutable int *p;
+        void foo() {}
+    }
+    auto s2 = new S2(&x);
+    assert(s2.p == &x);
+
+    struct S3
+    {
+        immutable int *p;
+        int foo() { return x; }
+    }
+    auto s3 = new S3(&x);
+    assert(s3.p == &x);
+    assert(s3.foo() == 42);
+
+    auto x12774 = new HasUnion12774();
+
+    return true;
+}
+static assert(test12681());
+
+/********************************************/
+// 3991
+
+union X3991
+{
+    int   a = void;
+    dchar b = void;
+}
+
+union Y3991
+{
+    int   a = void;
+    dchar b = 'a';
+}
+
+union Z3991
+{
+    int   a = 123;
+    dchar b = void;
+}
+
+void test3991()
+{
+    X3991 x;
+
+    Y3991 y;
+    assert(y.b == 'a');
+
+    Z3991 z;
+    assert(z.a == 123);
+}
+
+/********************************************/
+// 7727
+
+union U7727A1 { int i;       double d;       }
+union U7727A2 { int i = 123; double d;       }
+//union U7727A3 { int i;       double d = 2.5; }
+
+union U7727B1 { double d;       int i;       }
+union U7727B2 { double d = 2.5; int i;       }
+//union U7727B3 { double d;       int i = 123; }
+
+void test7727()
+{
+    import core.stdc.math : isnan;
+
+    { U7727A1 u;                assert(u.i == 0); }
+    { U7727A1 u = { i: 1024 };  assert(u.i == 1024); }
+    { U7727A1 u = { d: 1.225 }; assert(u.d == 1.225); }
+  static assert(!__traits(compiles,
+    { U7727A1 u = { i: 1024, d: 1.225 }; }
+  ));
+
+    { U7727A2 u;                assert(u.i == 123); }
+    { U7727A2 u = { i: 1024 };  assert(u.i == 1024); }
+    { U7727A2 u = { d: 1.225 }; assert(u.d == 1.225); }
+  static assert(!__traits(compiles,
+    { U7727A2 u = { i: 1024, d: 1.225 }; }
+  ));
+
+// Blocked by issue 1432
+//    { U7727A3 u;                assert(u.d == 2.5); }
+//    { U7727A3 u = { i: 1024 };  assert(u.i == 1024); }
+//    { U7727A3 u = { d: 1.225 }; assert(u.d == 1.225); }
+//  static assert(!__traits(compiles,
+//    { U7727A3 u = { i: 1024, d: 1.225 }; }
+//  ));
+
+    { U7727B1 u;                assert(isnan(u.d)); }
+    { U7727B1 u = { i: 1024 };  assert(u.i == 1024); }
+    { U7727B1 u = { d: 1.225 }; assert(u.d == 1.225); }
+  static assert(!__traits(compiles,
+    { U7727B1 u = { i: 1024, d: 1.225 }; }
+  ));
+
+    { U7727B2 u;                assert(u.d == 2.5); }
+    { U7727B2 u = { i: 1024 };  assert(u.i == 1024); }
+    { U7727B2 u = { d: 1.225 }; assert(u.d == 1.225); }
+  static assert(!__traits(compiles,
+    { U7727B2 u = { i: 1024, d: 1.225 }; }
+  ));
+
+// Blocked by issue 1432
+//    { U7727B3 u;                assert(u.i == 123); }
+//    { U7727B3 u = { i: 1024 };  assert(u.i == 1024); }
+//    { U7727B3 u = { d: 1.225 }; assert(u.d == 1.225); }
+//  static assert(!__traits(compiles,
+//    { U7727B3 u = { i: 1024, d: 1.225 }; }
+//  ));
+
+
+    test7727a();
+    test7727b();
+}
+
+// --------
+
+struct Foo7727a
+{
+    ushort bar2;
+}
+struct Foo7727b
+{
+    union
+    {
+        ubyte[2] bar1;
+        ushort bar2;
+    }
+}
+
+void test7727a()
+{
+    immutable Foo7727a foo1 = { bar2: 100 }; // OK
+    immutable Foo7727b foo2 = { bar2: 100 }; // OK <-- error
+}
+
+// --------
+
+struct S7727 { int i; double d; }
+union U7727 { int i; double d; }
+
+void test7727b()
+{
+    S7727 s = { d: 5 }; // OK
+    U7727 u = { d: 5 }; // OK <-- Error: is not a static and cannot have static initializer
+}
+
+/********************************************/
+// 7929
+
+void test7929()
+{
+    static struct S
+    {
+        int [] numbers;
+    }
+
+    const int [] numbers = new int[2];
+    const S si = {numbers};
+    // Error: cannot implicitly convert expression (numbers) of type const(int[]) to int[]
+
+    const S se = const(S)(numbers);
+    // OK
+}
+
+/********************************************/
+// 7021
+
+struct S7021
+{
+    @disable this();
+}
+
+void test7021()
+{
+  static assert(!is(typeof({
+    auto s = S7021();
+  })));
+}
+
+/********************************************/
+// 8738
+
+void test8738()
+{
+    int[3] a = [1, 2, 3];
+
+    struct S { int a, b, c; }
+    S s = S(1, 2, 3);
+
+    a = [4, a[0], 6];
+    s = S(4, s.a, 6);
+
+    assert(a == [4, 1, 6]);
+    assert(s == S(4, 1, 6));
+}
+
+/********************************************/
+// 8763
+
+void test8763()
+{
+    struct S
+    {
+        this(int) {}
+    }
+
+    void foo(T, Args...)(Args args)
+    {
+        T t = T(args);
+        // Error: constructor main.S.this (int) is not callable using argument types ()
+    }
+
+    S t = S(); // OK, initialize to S.init
+    foo!S();
+}
+
+/********************************************/
+// 8902
+
+union U8902 { int a, b; }
+
+enum U8902 u8902a = U8902.init; // No errors
+U8902 u8902b;                   // No errors
+U8902 u8902c = U8902.init;      // Error: duplicate union initialization for b
+
+void test8902()
+{
+    U8902 u8902d = U8902.init;                  // No errors
+    immutable U8902 u8902e = U8902.init;        // No errors
+    immutable static U8902 u8902f = U8902.init; // Error: duplicate union...
+    static U8902 u8902g = u8902e;               // Error: duplicate union...
+    static U8902 u8902h = U8902.init;           // Error: duplicate union...
+}
+
+/********************************************/
+// 9116
+
+void test9116()
+{
+    static struct X
+    {
+        int v;
+        this(this) { ++v; }
+    }
+    static struct Y
+    {
+        X x;
+    }
+    X x = X(1);
+    assert(x.v == 1);
+    Y y = Y(X(1));
+    //printf("y.x.v = %d\n", y.x.v);  // print 2, but should 1
+    assert(y.x.v == 1); // fails
+}
+
+/********************************************/
+// 9293
+
+void test9293()
+{
+    static struct A
+    {
+    //  enum A zero = A(); // This works as expected
+        enum A zero = {};  // Note the difference here
+
+        int opCmp(const ref A a) const
+        {
+            assert(0);
+        }
+
+        int opCmp(const A a) const
+        {
+            return 0;
+        }
+    }
+
+    A a;
+    auto b = a >= A.zero;  // Error: A() is not an lvalue
+}
+
+/********************************************/
+// 9566
+
+void test9566()
+{
+    static struct ExpandData
+    {
+        ubyte[4096] window = 0;
+    }
+    ExpandData a;
+    auto b = ExpandData.init;   // bug
+}
+
+/********************************************/
+// 9775
+
+enum Month9775 : ubyte { jan = 1, }
+struct Date9775
+{
+    this(int year, int month, int day) pure
+    {
+        _year  = cast(short)year;
+        _month = cast(Month9775)month;
+        _day   = cast(ubyte)day;
+    }
+    short     _year  = 1;
+    Month9775 _month = Month9775.jan;
+    ubyte     _day   = 1;
+}
+
+const Date9775 date9775c1 = Date9775(2012, 12, 21);
+const          date9775c2 = Date9775(2012, 12, 21);
+enum  Date9775 date9775e1 = Date9775(2012, 12, 21);
+enum           date9775e2 = Date9775(2012, 12, 21);
+
+/********************************************/
+// 11105
+
+struct S11105
+{
+    int[2][1] a21;
+}
+
+void test11105()
+{
+    S11105 s = S11105([1, 2]);
+}
+
+/********************************************/
+// 11147
+
+struct V11147
+{
+    union
+    {
+        struct
+        {
+            float x = 0;
+            float y = 0;
+            float z = 0;
+        }
+        struct
+        {
+            float r;
+            float g;
+            float b;
+        }
+    }
+}
+
+void test11147()
+{
+    auto v = V11147.init;
+    assert(v.x == 0f);
+    assert(v.y == 0f);
+    assert(v.z == 0f);
+    assert(v.r == 0f);
+    assert(v.g == 0f);
+    assert(v.b == 0f);
+}
+
+/********************************************/
+// 11256
+
+struct S11256 { @disable this(); }
+
+struct Z11256a(Ranges...)
+{
+    Ranges ranges;
+    this(Ranges rs) { ranges = rs; }
+}
+struct Z11256b(Ranges...)
+{
+    Ranges ranges = Ranges.init;    // Internal error: e2ir.c 5321
+    this(Ranges rs) { ranges = rs; }
+}
+struct Z11256c(Ranges...)
+{
+    Ranges ranges = void;           // todt.c(475) v->type->ty == Tsarray && vsz == 0
+    this(Ranges rs) { ranges = rs; }
+}
+
+struct F11256(alias pred)
+{
+    this(int[] = null) { }
+}
+
+Z!Ranges z11256(alias Z, Ranges...)(Ranges ranges)
+{
+    return Z!Ranges(ranges);
+}
+
+void test11256()
+{
+    z11256!Z11256a(S11256.init, F11256!(gv => true)());
+    z11256!Z11256b(S11256.init, F11256!(gv => true)());
+    z11256!Z11256c(S11256.init, F11256!(gv => true)());
+}
+
+/********************************************/
+// 11269
+
+struct Atom
+{
+    union
+    {
+        int i;
+        struct
+        {
+            ulong first, rest;
+        }
+        struct
+        {
+            uint a, b;
+        }
+    }
+}
+
+void test11269()
+{
+    Atom a1;
+    Atom a2 = {i:1, rest:10, b:2};
+}
+
+/********************************************/
+// 11427
+
+struct S11427
+{
+    union
+    {
+        ubyte a;
+        int x;
+    }
+    void[] arr;
+}
+
+int foo11427() @safe
+{
+    S11427 s1 = S11427();
+    S11427 s2;
+    return 0;
+}
+
+/********************************************/
+// 12011
+
+struct S12011a
+{
+    int f() { return i; }
+    enum e = this.init.f();
+    int i = 1, j = 2;
+}
+
+struct S12011b
+{
+    int f() { return i; }
+    enum e = S12011b().f();
+    int i = 1, j = 2;
+}
+
+void test12011()
+{
+    static assert(S12011a.e == 1);
+    static assert(S12011b.e == 1);
+}
+
+/********************************************/
+// 13021
+
+void test13021()
+{
+    static union U1
+    {
+        float a;
+        int b;
+    }
+
+    static union U2
+    {
+        double a;
+        long b;
+    }
+
+    static union U3
+    {
+        real a;
+        struct B { long b1, b2; } // ICE happens only if B.sizeof == real.sizeof
+        B b;
+    }
+
+    static union U4
+    {
+        real a;
+        long[2] b; // ditto
+    }
+
+    auto f = U1(1.0);  auto ok = f.b;
+
+    auto fail1 = U1(1.0).b; // OK <- Internal error: e2ir.c 1162
+    auto fail2 = U2(1.0).b; // OK <- Internal error: e2ir.c 1162
+    auto fail3 = U3(1.0).b; // OK <- Internal error: e2ir.c 1162
+    auto fail4 = U4(1.0).b; // OK <- Internal error: backend/el.c 2904
+}
+
+/********************************************/
+// 14556
+
+enum E14556 { a = 1 }
+
+struct S14556a
+{
+    this(int) {}
+    E14556[1] data;
+}
+
+struct S14556b
+{
+    this(int) {}
+    void[1] data;
+}
+
+void test14556()
+{
+    auto sa = S14556a(0);
+    assert(sa.data == [E14556.a]);
+
+    auto sb = S14556b(0);
+    assert(sb.data[] == cast(ubyte[1])[0]);
+}
+
+/********************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15a();
+    test15b();
+    test15c();
+    test15d();
+    test15e();
+    test9993a();
+    test9993b();
+    test3198and1914();
+    test2427();
+    test5885();
+    test5889();
+    test4247();
+    test6937();
+    test12681();
+    test3991();
+    test7727();
+    test7929();
+    test7021();
+    test8738();
+    test8763();
+    test8902();
+    test9116();
+    test9293();
+    test9566();
+    test11105();
+    test11147();
+    test11256();
+    test13021();
+    test14556();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/template1.d b/gcc/testsuite/gdc.test/runnable/template1.d
new file mode 100644
index 00000000000..9e7043d2f7e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/template1.d
@@ -0,0 +1,2131 @@
+// REQUIRED_ARGS:
+
+module template1;
+
+import core.stdc.stdio : printf;
+import core.vararg;
+
+/******************************************/
+
+template TFoo1(T,U)
+{
+    int foo(T t, U u)
+    {
+        return 3;
+    }
+}
+
+
+alias TFoo1!(int, char) Foo1;
+
+
+void test1()
+{
+    int i = Foo1.foo(1, 2);
+    assert(i == 3);
+}
+
+/******************************************/
+
+template TFoo2(T,U)
+{
+    T x = 4;
+    U y;
+}
+
+
+alias TFoo2!(int, char) Foo2;
+
+
+void test2()
+{
+    assert(Foo2.x + Foo2.y == 0x103);
+    Foo2.x = 3;
+    Foo2.y = 7;
+    assert(Foo2.x + Foo2.y == 10);
+}
+
+/******************************************/
+
+template TFoo3(T,U)
+{
+    class Bar
+    {
+        T x = 4;
+        U y;
+    }
+}
+
+
+alias TFoo3!(int, char) Foo3;
+
+
+void test3()
+{
+    Foo3.Bar b = new Foo3.Bar();
+
+    assert(b.x == 4);
+    assert(b.y == 0xFF);
+}
+
+/******************************************/
+
+template TFoo4(T,U)
+{
+    T x;
+    U y;
+}
+
+template TFoo4(T:T,U:T)
+{
+    T a;
+    U b;
+}
+
+template TFoo4(T:uint, U:uint)
+{
+    T c;
+    U d;
+}
+
+alias TFoo4!(int, char) Foo4x;
+
+void test4()
+{
+    alias TFoo4!(int, char) Foo4;
+    int* x = &Foo4.c;
+    char* y = &Foo4.d;
+
+    alias TFoo4!(uint, char**) Foo4_2;
+    uint* x2 = &Foo4_2.x;
+    char*** y2 = &Foo4_2.y;
+
+    alias TFoo4!(int, int) Foo4_3;
+    int* x3 = &Foo4_3.a;
+    int* y3 = &Foo4_3.b;
+
+    alias TFoo4!(uint, uint) Foo4_4;
+    uint* x4 = &Foo4_4.c;
+    uint* y4 = &Foo4_4.d;
+}
+
+
+/******************************************/
+
+template TtoUx(T, U)
+{
+    T toUx(U[] s)
+    {
+        uint v = 0;
+
+        if (v != cast(T)v)
+            return 3;
+
+        return cast(T)v;
+    }
+
+}
+
+alias TtoUx!(ubyte, char).toUx toUbyte;
+alias TtoUx!(ushort, char).toUx toUshort;
+
+void test5()
+{
+}
+
+
+/******************************************/
+
+template TtoUx6(T, U)
+{
+    T toUx(U[] s)
+    {
+        uint v = 0;
+
+        if (v != cast(T)v)
+            return 3;
+
+        return cast(T)v;
+    }
+
+}
+
+alias TtoUx6!(ubyte, char) t6;
+
+void test6()
+{
+}
+
+/******************************************/
+
+template A7(T) {
+    T id(T t) {
+        return t;
+    }
+}
+
+alias A7!(int) a;
+
+void test7()
+{
+    printf("%d\r\n", a.id(3));
+    assert(a.id(3) == 3);
+}
+
+/******************************************/
+
+template Swapper(T)
+{
+    void Swap(ref T a, ref T b)
+    {
+        T temp = a; a = b; b = temp;
+    }
+}
+
+void test8()
+{
+    alias Swapper!(int) IntSwap;
+    int a=1,b=2;
+    IntSwap.Swap(a,b);
+    printf("a=%d,b=%d\n",a,b); // prints 2,1
+    assert(a == 2);
+    assert(b == 1);
+}
+
+
+/******************************************/
+
+template Foo9(T)
+{
+    class B
+    {
+        T data;
+    }
+}
+
+void test9()
+{
+    (new Foo9!(int).B).data += 4;
+}
+
+
+/******************************************/
+
+template A10(T) {
+}
+
+template B10(T) {
+    alias A10!(int) a;
+}
+
+void test10()
+{
+    alias B10!(int) b;
+}
+
+/******************************************/
+
+template A11(T) {
+    T idf(T t) {
+        return t;
+    }
+}
+
+template B11(T) {
+    private alias A11!(T) a;
+    T same(T t) {
+        return a.idf(t);
+    }
+}
+
+void test11()
+{
+    alias B11!(int) b;
+    //printf("%d\r\n", b.same(10));
+    assert(b.same(10) == 10);
+}
+
+
+/******************************************/
+
+template A12(T) {
+    class B {
+        invariant() {
+            assert(1);
+        }
+    T ide(T t) {
+        return t;
+    }
+    }
+}
+
+void test12()
+{
+    alias A12!(int) a;
+    a.B b = new a.B();
+    printf("%d\r\n", b.ide(10));
+    assert(b.ide(10) == 10);
+}
+
+
+/******************************************/
+
+template A13(T) {
+    public interface I {
+        public T i();
+    }
+}
+
+class B13 : A13!(int).I {
+    public int i() {
+        return 42;
+    }
+}
+
+void test13()
+{
+    B13 b = new B13();
+    A13!(int).I i = b;
+    assert(b.i() == 42);
+    assert(i.i() == 42);
+}
+
+
+/******************************************/
+
+class B14
+{
+}
+
+template A14(T, U) {
+
+    private U u;
+
+    static this()
+    {
+        u = new U();
+    }
+}
+
+alias A14!(int, B14) t14;
+
+void test14()
+{
+}
+
+
+/******************************************/
+
+template A15(T) {
+    public interface Init {
+        public T init();
+    }
+}
+template A15(T : int) {
+    public class Init {
+        public T init() {
+            return 42;
+        };
+    }
+}
+template A15(T : float) {
+    public class Init {
+        public T init() {
+            return 3.25;
+        };
+    }
+}
+
+template TB15(T, U) {
+    private U initializer;
+    private void setInitializer(U init) {
+        initializer = init;
+    }
+    public class B {
+        private T _value;
+        public this() {
+            this._value = initializer.init();
+        }
+        public T value() {
+            return this._value;
+        }
+    }
+}
+template TB15(T) {
+    private alias TB15!(T, A15!(T).Init) tb;
+    private void setInitializer(A15!(T).Init init) {
+        tb.setInitializer(init);
+    }
+    public class B : tb.B {
+    }
+}
+
+void test15()
+{
+    alias TB15!(int, A15!(int).Init) tb;
+    tb.setInitializer(new A15!(int).Init());
+    tb.B b = new tb.B();
+    int i;
+    i = b.value();
+    assert(i == 42);
+
+    alias TB15!(float) tb2;
+    tb2.setInitializer(new A15!(float).Init());
+    tb2.B b2 = new tb2.B();
+    assert(b2.value() == 3.25);
+}
+
+/******************************************/
+
+template foo16(U : int, int T : 9+1)
+{
+    U x = T;
+}
+
+alias foo16!(int, 10) bar16;
+
+void test16()
+{
+    int i;
+
+    i = bar16.x;
+    assert(i == 10);
+    assert(foo16!(int, 10).x == 10);
+}
+
+/******************************************/
+
+template VecTemplate(tfloat)
+{
+    struct Vector
+    {
+        tfloat d;
+    }
+}
+
+void test17()
+{
+    with (VecTemplate!(int)) // crash DMD
+    {
+    }
+}
+
+/******************************************/
+
+template Bomb (T)
+{
+   void foo (T *parm)
+   {
+   }
+}
+
+template Name (T)
+{
+   T y;
+
+   void test ()
+   {
+      Bomb!(T).foo (&y);
+   }
+}
+
+alias Name!(int) a18;
+alias Name!(ubyte) b18;
+
+void test18()
+{
+}
+
+/******************************************/
+
+template one20( T )
+{
+  alias T function () safeptr;
+}
+
+template one20( T1, T2 )
+{
+  alias int function(int) safeptr;
+}
+
+alias one20!( int ) A;
+A.safeptr foo20;
+
+alias one20!( int, int ) B;
+B.safeptr bar20;
+
+
+int func_bar(int i) { return 2; }
+
+void test20()
+{
+    bar20 = &func_bar;
+}
+
+/******************************************/
+
+class A21 { int x; }
+class B21 : A21 { int y; }
+
+void abc21(B21* b) { }
+
+template TFoo21(T : A21, U : T*)
+{
+    void test()
+    {
+        assert(T.sizeof == B21.sizeof);
+        U u;
+        abc21(u);
+    }
+}
+
+alias TFoo21!(B21, B21*) bar21;
+
+void test21()
+{
+    bar21.test();
+}
+
+/******************************************/
+
+template Bug22(T : Object) {
+    int print() {
+        printf("Bug22(T : Object).print()\r\n");
+        return 1;
+    }
+}
+template Bug22(T) {
+    int print() {
+        printf("Bug22(T).print()\r\n");
+        return 2;
+    }
+}
+template TTest22(T) {
+    private alias Bug22!(T) bug;
+    class Test {
+        int test() {
+            return bug.print();
+        }
+    }
+}
+
+void test22()
+{
+    alias TTest22!(int).Test Test1;
+    alias TTest22!(Test1).Test Test2;
+    alias TTest22!(Object).Test Test3;
+    Test1 test1 = new Test1();
+    Test2 test2 = new Test2();
+    Test3 test3 = new Test3();
+    int i;
+
+    i = test1.test();
+    assert(i == 2);
+    i = test2.test();
+    assert(i == 1);
+    i = test3.test();
+    assert(i == 1);
+}
+
+
+/******************************************/
+
+template T23()
+{
+     struct Rank
+     {
+     }
+}
+
+template A23()
+{
+    struct Array
+    {
+        alias T23!().Rank Rank1;
+
+        Rank1 data;
+    }
+}
+
+alias A23!().Array Array_int23;
+
+void test23()
+{
+}
+
+
+/******************************************/
+
+template TList24(T)
+{
+    class Node
+    {
+    }
+    class List
+    {
+        Node m_first = null;
+    }
+}
+
+void test24()
+{
+  alias TList24!(uint).List UIntList;
+}
+
+
+/******************************************/
+
+template TList25(T)
+{
+    class Node
+    {
+        Node prev;
+        Node next;
+        T Value;
+    }
+    class List
+    {
+        Node m_first = null;
+        Node m_last = null;
+        void AddFront(T _Value)
+        {
+            Node cur = new Node;
+            with (cur)
+            {
+                next = m_first;
+                prev = null;
+                Value = _Value;
+                if (next !is null)
+                    next.prev = cur;
+            }
+            m_first = null;
+            if (m_last is null)
+                m_last = cur;
+        }
+    }
+}
+
+void test25()
+{
+  alias TList25!(uint).List UIntList;
+  alias TList25!(uint).Node UIntNode;
+  UIntList list;
+  UIntNode node;
+  for (int i = 1; i <= 10; i++)
+        {} //list.AddFront(i);
+}
+
+
+/******************************************/
+
+template Foo26(T)
+{
+    void doIt() {
+        printf("Foo26(T)\r\n");
+    }
+}
+
+template Foo26(T : T[])
+{
+    private alias Foo26!(T) bug;
+    void doIt() {
+        printf("Foo26(T[])\r\n");
+        bug.doIt();
+    }
+}
+
+void test26()
+{
+    alias Foo26!(int[]) foo;
+    foo.doIt();
+}
+
+
+/******************************************/
+
+template Foo27(T)
+{
+    public const T[] empty = [];
+}
+
+void test27()
+{
+    alias Foo27!(int) bug;
+}
+
+
+/******************************************/
+
+template A28(T) {
+    public bool all(in T[] array, bool function (T) predicate) {
+        for (int i = 0; i < array.length; i++) {
+            if (!predicate(array[i])) {
+                return false;
+            }
+        }
+        return true;
+    }
+}
+
+void test28()
+{
+    static bool isVowel(char c) {
+        return (c == 'a') || (c == 'e') || (c == 'i') || (c == 'o') || (c == 'u');
+    }
+
+    alias A28!(char) arrays;
+    assert(arrays.all("aeiouoeieuiei", &isVowel));
+    assert(arrays.all("aeoiuaioeuioaeuiouoiaeu", &isVowel));
+    assert(!arrays.all("aaeiouioeujiurioue", &isVowel));
+    assert(!arrays.all("bjkqwkjbwqjbkwb", &isVowel));
+    assert(arrays.all("", &isVowel));
+    printf("A28(char).all tests passed!\r\n");
+}
+
+
+/******************************************/
+
+public template TRange29(T) {
+    debug private bool recursing = false;
+    public class Range {
+        private T _lower;
+        private T _upper;
+        public this(T lower, T upper) {
+            this._lower = lower;
+            this._upper = upper;
+        }
+        public T lower() {
+            return this._lower;
+        }
+        public T upper() {
+            return this._upper;
+        }
+        public bool contains(T item) {
+            return (lower() <= item) && (item <= upper());
+        }
+        public bool intersects(Range other)
+        in {
+            assert(other !is null);
+        } out (result) {
+            debug {
+                if (!recursing) {
+                    recursing = true;
+                    assert(result == other.intersects(this));
+                } else {
+                    recursing = false;
+                }
+            }
+        } body {
+            return contains(other.lower()) || contains(other.upper()) || other.includes(this);
+        }
+        public bool includes(Range other)
+        in {
+            assert(other !is null);
+        } out (result) {
+            assert(result == (contains(other.lower()) && contains(other.upper())));
+        } body {
+            return contains(other.lower()) && contains(other.upper());
+        }
+    }
+}
+
+void test29()
+{
+    alias TRange29!(int).Range Range;
+    Range r1 = new Range(1, 10);
+    Range r2 = new Range(5, 15);
+    assert(r1.intersects(r2) == 1);
+}
+
+
+/******************************************/
+
+template TCopy30(T)
+{
+    void copy(out T to, T from)
+    {
+        to = from;
+    }
+}
+
+template TCopy30(T : string)
+{
+    void copy(out string to, in string from)
+    {
+        printf("Specialization\n");
+        to = from;
+    }
+}
+
+void test30()
+{
+    int i = 0;
+    float f = 0;
+    string s;
+
+    alias TCopy30!(int) copyint;
+    alias TCopy30!(string) copystr;
+
+    copyint.copy(i, 3);
+    printf("%d\n", i);
+    assert(i == 3);
+
+    copystr.copy(s, "Here it comes");
+    printf("%.*s\n", s.length, s.ptr);
+    assert(s == "Here it comes");
+}
+
+/******************************************/
+
+import std.string;
+
+template Foo31(alias X)
+{
+        alias X.toStringz y;
+}
+
+void test31()
+{
+    alias Foo31!(std.string) bar;
+}
+
+
+/******************************************/
+
+shared int x32;
+
+template Foo32(alias X)
+{
+    static shared int* p = &X;
+}
+
+alias Foo32!(x32) abc32;
+
+void test32()
+{
+    alias Foo32!(x32) bar;
+
+    *bar.p = 3;
+    assert(x32 == 3);
+
+    *abc32.p = 4;
+    assert(x32 == 4);
+}
+
+/******************************************/
+
+shared int x33;
+
+template Foo33(alias X)
+{
+    static shared int* p = &X;
+}
+
+template Bar33(alias T)
+{
+    alias T!(x33) abc;
+}
+
+void test33()
+{
+    alias Bar33!(Foo33) bar;
+
+    *bar.abc.p = 3;
+    assert(x33 == 3);
+}
+
+/******************************************/
+
+shared int x34;
+
+template Foo34(alias X)
+{
+    static shared int* p = &X;
+}
+
+template Bar34(alias T)
+{
+    alias T.p q;
+}
+
+void test34()
+{
+    alias Foo34!(x34) foo;
+    alias Bar34!(foo) bar;
+
+    *bar.q = 3;
+    assert(x34 == 3);
+}
+
+/******************************************/
+
+class Foo35
+{
+    static int p;
+}
+
+template Bar35(alias T)
+{
+    alias T.p q;
+}
+
+void test35()
+{
+    alias Bar35!(Foo35) bar;
+
+    bar.q = 3;
+    assert(Foo35.p == 3);
+}
+
+/******************************************/
+
+template Bar36(T)
+{
+    class Bar36
+    {
+        static T x;
+    };
+}
+
+void test36()
+{
+    Bar36!(int).x = 3;
+}
+
+/******************************************/
+
+class Bar37(T)
+{
+    static T x;
+}
+
+
+void test37()
+{
+    Bar37!(int).x = 3;
+}
+
+/******************************************/
+
+class Bar38(T)
+{
+    static T x = 3;
+}
+
+
+void test38()
+{
+    int i = template1.Bar38!(int).x;
+    assert(i == 3);
+
+    int j = Bar38!(int).x;
+    assert(j == 3);
+}
+
+/******************************************/
+
+class Bar39(T)
+{
+    alias T x;
+}
+
+
+void test39()
+{
+    Bar39!(int).x y = 3;
+    assert(y == 3);
+}
+
+
+/******************************************/
+
+template Bar40(T)
+{
+    alias T Bar40;
+}
+
+
+void test40()
+{
+    Bar40!(int) y = 3;
+    assert(y == 3);
+}
+
+/******************************************/
+
+template Bar41(T)
+{
+    alias T Bar41;
+}
+
+
+void test41()
+{
+    template1.Bar41!(int) y = 3;
+    assert(y == 3);
+
+    assert(template1.Bar41!(int).sizeof == int.sizeof);
+}
+
+/******************************************/
+
+template Bar42(T) { T t; }
+
+typeof(Bar42!(int).t) bar42;
+
+void test42()
+{
+    bar42 = 5;
+}
+
+/******************************************/
+
+template factor43(int n : 1)
+{
+  enum { value = 1 }
+}
+
+template factor43(int n)
+{
+  enum { value = n*factor43!(n-1).value }
+}
+
+void test43()
+{
+
+  int i = factor43!(3).value;
+
+  printf("%d\n",i);
+  assert(i == 6);
+}
+
+
+/******************************************/
+
+template factorial1(int n : 1)
+{
+    const int x = 1;
+}
+
+template factorial1(int n)
+{
+    const int x = n*.factorial1!(n-1).x;
+}
+
+template factorial2(int n : 1)
+{
+    const int factorial2 = 1;
+}
+
+template factorial2(int n)
+{
+    const int factorial2 = n*.factorial2!(n-1);
+}
+
+template factorial3(int n : 1)
+{
+    enum { x = 1 }
+}
+
+template factorial3(int n)
+{
+    enum { x = n*.factorial3!(n-1).x }
+}
+
+template factorial4(int n : 1)
+{
+    enum { factorial4 = 1 }
+}
+
+template factorial4(int n)
+{
+    enum { factorial4 = n*.factorial4!(n-1) }
+}
+
+void test44()
+{
+
+  int i = factorial1!(4).x;
+  printf("%d\n",i);
+  assert(i == 24);
+
+  i = factorial2!(4);
+  printf("%d\n",i);
+  assert(i == 24);
+
+  i = factorial3!(4).x;
+  printf("%d\n",i);
+  assert(i == 24);
+
+  i = factorial4!(4);
+  printf("%d\n",i);
+  assert(i == 24);
+}
+
+
+/******************************************/
+
+template factor45(int n)
+{
+    int value()
+    {
+        if (n==0 || n==1)
+            return 1;
+        return n * factor45!(n-1).value();
+    }
+}
+
+template factor45(int n : 0)
+{
+    int value()
+    {
+        return 1;
+    }
+}
+
+template factor45(int n : 1)
+{
+    int value()
+    {
+        return 1;
+    }
+}
+
+void test45()
+{
+    int i;
+
+    i = factor45!(4).value();
+    printf( "%d\n", i);
+    assert(i == 24);
+}
+
+
+/******************************************/
+
+template sqrt46(int n, int lo, int hi : lo)
+{
+    enum { result = lo }
+}
+
+void test46()
+{
+    int i;
+
+    i = sqrt46!(1, 24, 24).result;
+    printf("i = %d\n", i);
+    assert(i == 24);
+}
+
+/******************************************/
+
+template sqrt47(int n, int lo, int hi)
+{
+    enum { mid = (lo + hi + 1) / 2 }
+
+    enum { result = (n < mid * mid) ? sqrt47!(n, lo, mid - 1).result
+                                    : sqrt47!(n, mid, hi).result }
+}
+
+template sqrt47(int n, int lo, int hi : lo)
+{
+    enum { result = lo }
+}
+
+template sqrt47(int n)
+{
+    enum { sqrt47 = .sqrt47!(n, 1, n).result }
+}
+
+void test47()
+{
+    int i;
+
+    i = sqrt47!(24);
+    printf("i = %d\n", i);
+}
+
+/******************************************/
+
+class Foo48 (T)
+{
+    alias T Type;
+
+    class Inner (U)
+    {
+        alias U Type;
+    };
+};
+
+struct Bar48 (alias TT)
+{
+    alias TT!(int).Type A;
+    alias TT!(int).Inner!(A).Type B;
+};
+
+void test48()
+{
+    Bar48!(Foo48).A x;
+    Bar48!(Foo48).B y;
+
+    int *p;
+
+    p = &x;
+    p = &y;
+}
+
+
+/******************************************/
+
+struct Foo49(T)
+{
+    static Foo49 bar(T c1)
+    {
+        Foo49 rtn; // Error here
+        return rtn;
+    }
+}
+
+void test49()
+{
+    alias Foo49!(double) vector;
+
+    vector.bar(1);
+}
+
+/******************************************/
+
+struct Foo50(T)
+{
+  T x = 0;
+
+  static Foo50 bar(T c1)
+  {
+    .Foo50!(typeof(c1)) rtn;
+    rtn.x = c1;
+    return rtn;
+  }
+
+  static .Foo50!(T) barx(T c1)
+  {
+    Foo50 rtn;
+    rtn.x = c1;
+    return rtn;
+  }
+}
+
+void test50()
+{
+  alias Foo50!(double) vector;
+
+  vector xAxis = vector.bar(1);
+}
+
+/******************************************/
+
+struct Foo51(T)
+{
+  T x = 0;
+  .Foo51!(long)* p;
+
+  static Foo51 bar(T c1)
+  {
+    .Foo51!(typeof(c1)) rtn;
+    rtn.x = c1;
+    return rtn;
+  }
+
+  static .Foo51!(T) barx(T c1)
+  {
+    Foo51 rtn;
+    .Foo51!(int)* c;
+    rtn.x = c1;
+    return rtn;
+  }
+}
+
+void test51()
+{
+  alias Foo51!(double) vector;
+
+  vector xAxis = vector.bar(1);
+}
+
+
+/******************************************/
+
+interface Interface(T)
+{
+    void foo52();
+}
+
+void bar52(Interface!(Object) i)
+{
+    i.foo52();
+}
+
+class Abstract(T) : Interface!(T)
+{
+    abstract void foo52();
+}
+
+class Concrete(T) : Abstract!(T)
+{
+    override void foo52() { printf("Concrete.foo52(this = %p)\n", this); }
+}
+
+class Sub(T) : Concrete!(T)
+{
+}
+
+void test52()
+{
+    Sub!(Object) s = new Sub!(Object)();
+    s.foo52();
+    bar52(s);
+}
+
+
+/******************************************/
+
+class Foo53
+{
+    template tmethod (T)
+    {
+        public static void tmethod (T param)
+        {
+            printf("param = %d\n", param);
+            assert(param == 42);
+        }
+    }
+}
+
+
+void test53()
+{
+    Foo53 foo = new Foo53;
+
+    Foo53.tmethod!(int)(42);
+}
+
+
+/******************************************/
+
+class Foo54
+{
+   template func(W) {
+     static void foo(W w) { printf("W_I %d\n", w); assert(w == 3); }
+     static int xx;
+   }
+}
+
+void test54() {
+
+   Foo54 c = new Foo54();
+   c.func!(int).foo(3);
+   c.func!(int).xx = 4;
+
+}
+
+/******************************************/
+
+template T55(S)
+{
+    struct Foo55
+    {
+        static Foo55 test(Foo55 f)
+        {
+            Foo55 a = f;
+            return f;
+        }
+    }
+}
+
+alias T55!(char).Foo55 Foo55;
+alias T55!(char).Foo55 Bar55;
+
+
+void test55()
+{
+    Bar55 a;
+    Foo55 b;
+    b.test(a);
+    Bar55.test(a);
+}
+
+/******************************************/
+
+template CT56(T)
+{
+  class C
+  {
+    const char[][1] arrArr=["foo" ];
+  }
+}
+
+void test56()
+{
+  alias CT56!(int) Ct;
+  Ct.C c= new Ct.C();
+  printf("%.*s\n", c.arrArr[0].length, c.arrArr[0].ptr);
+  assert(c.arrArr[0] == "foo");
+}
+
+
+/******************************************/
+
+template foo57(T : int = int)
+{
+    T x = 3;
+}
+
+void test57()
+{
+    printf("%d\n", foo57!().x);
+    assert(foo57!().x == 3);
+}
+
+/******************************************/
+
+template Foo58(T, U = T)
+{
+    U x = 3;
+}
+
+void test58()
+{
+    alias Foo58!(int) f;
+    assert(f.x == 3);
+    assert(f.x.sizeof == 4);
+}
+
+/******************************************/
+
+template Foo59(T, U = T*)
+{
+    shared T x = 3;
+    shared U px = &x;
+}
+
+void test59()
+{
+    alias Foo59!(uint) f;
+    assert(f.x == 3);
+    assert(f.x.sizeof == 4);
+    assert(*f.px == 3);
+
+    alias Foo59!(long) g;
+    assert(g.x == 3);
+    assert(g.x.sizeof == 8);
+    assert(*g.px == 3);
+}
+
+/******************************************/
+
+class A60
+{}
+
+template B60(T, U = short)
+{
+        struct Thing
+        {
+                T       t;
+                U       u;
+        };
+}
+
+template C60(T, U = A60)
+{
+        class C60
+                : U
+        {}
+
+        class C2
+        {};
+}
+
+void test60()
+{
+        B60!(int, long).Thing   thing1;
+        B60!(int).Thing         thing2;
+
+        printf("thing1.sizeof: %u\n", thing1.sizeof);
+        printf("thing2.sizeof: %u\n", thing2.sizeof);
+
+        version (Win32)
+            assert(thing1.sizeof == 16);
+        else version (X86_64)
+            assert(thing1.sizeof == 16);
+        else version(ARM)
+            assert(thing1.sizeof == 16);
+        else
+            assert(thing1.sizeof == 12);
+        assert(thing2.sizeof == 8);
+
+        C60!(int /*,A60*/ )     container1;
+
+        printf("container1.sizeof: %u\n", container1.sizeof);
+        assert(container1.sizeof == (void*).sizeof);
+}
+
+/******************************************/
+
+struct Foo61
+{
+    int a;
+
+    template Bar(T)
+    {
+        T abc() { return a; }
+    }
+
+    int def() { return 4; }
+}
+
+void test61()
+{
+    Foo61 *f = new Foo61();
+    int i;
+
+    f.a = 3;
+    i = f.def();
+    assert(i == 4);
+    i = f.Bar!(int).abc();
+    assert(i == 3);
+
+    Foo61 g;
+    g.a = 3;
+    i = g.def();
+    assert(i == 4);
+    i = g.Bar!(int).abc();
+    assert(i == 3);
+}
+
+/******************************************/
+
+class Foo62(T)
+{
+    template Bar(T)
+    {
+        int func() { return 3; }
+    }
+}
+
+void test62()
+{
+    Foo62!(int) x = new Foo62!(int);
+
+    assert(x.Bar!(int).func() == 3);
+}
+
+/******************************************/
+
+class Foo63(T)
+{
+    template Bar(T)
+    {
+        int func() { this.def(); return 3; }
+        int func2() { return 4; }
+    }
+
+    void def()
+    {
+        assert(Bar!(T).func2() == 4);
+    }
+}
+
+void test63()
+{
+    Foo63!(int) x = new Foo63!(int);
+
+    assert(x.Bar!(int).func() == 3);
+    x.def();
+}
+
+/******************************************/
+
+struct XVector(qfloat)
+{
+    qfloat x;qfloat y;qfloat z;
+
+    static int opCall (qfloat x, qfloat y, qfloat z) { return 8; }
+}
+
+void test64()
+{
+    int i;
+    i = XVector!(int)(1,2,3);
+    assert(i == 8);
+    i = XVector!(real).opCall(1,2,3);
+    assert(i == 8);
+}
+
+/******************************************/
+// http://www.digitalmars.com/d/archives/28052.html
+
+alias int value_type;
+
+struct Foo65
+{
+    uint length() { return 47; }
+
+    size_t test()
+    {
+        value_type[] e = new value_type[length];
+        return e.length;
+    }
+}
+
+void test65()
+{
+    Foo65 f;
+
+    assert(f.test() == 47);
+}
+
+/******************************************/
+
+class Thing66
+{
+        template print(T2)
+        {
+                void print(T2 t)
+                {
+                    printf("t = %d\n", t);
+                    assert(t == 10);
+                }
+        }
+}
+
+
+void test66()
+{
+        Thing66 thing = new Thing66;
+
+        thing.print!(int)(10);
+}
+
+/******************************************/
+
+template Foo67(alias T)
+{
+    void Foo67()
+    {
+        printf("T = '%.*s'\n", T.length, T.ptr);
+        assert(T == "hello");
+    }
+}
+
+void test67()
+{
+    static string x = "hello";
+
+    Foo67!(x)();
+}
+
+
+/******************************************/
+
+template T68(int a) {
+    int vec[a];
+}
+
+void test68()
+{
+        int i;
+
+        i = T68!(4>1?4:1).vec[0];
+        assert(i == 0);
+        i = T68!(4==1?1:(1==1?4:(4>1?1:4))).vec[0];
+        assert(i == 0);
+}
+
+/******************************************/
+
+size_t printx(string s)
+{
+    printf("s = '%.*s'\n", s.length, s.ptr);
+    return s.length;
+}
+
+size_t printx(int i)
+{
+    printf("i = %d\n", i);
+    return 28;
+}
+
+template Foo69(alias T)
+{
+ size_t Foo69()
+ {
+  return printx(T);
+ }
+}
+
+void test69()
+{
+ static string x = "hello";
+ static string z = "abc";
+ static int y=100;
+ size_t i;
+
+ alias Foo69!(x) foox;
+ alias Foo69!(y) fooy;
+
+    i = Foo69!(x)();
+    assert(i == 5);
+    i = Foo69!(y)();
+    assert(i == 28);
+    i = Foo69!(z)();
+    assert(i == 3);
+    i = foox();
+    assert(i == 5);
+    i = fooy();
+    assert(i == 28);
+}
+
+/******************************************/
+
+template temptt70(alias func)
+{
+   void temp()
+   {
+        func();
+   }
+}
+
+int x70;
+
+void myfunc70()
+{
+    printf("myfunc70()\n");
+    x70 = 6;
+}
+
+alias temptt70!(myfunc70).temp foo70;
+
+void test70()
+{
+   foo70();
+   assert(x70 == 6);
+}
+
+/******************************************/
+
+struct A71(T)
+{
+    alias .A71!(T) AT;
+    int x;
+}
+
+alias A71!(int) Aint71;
+
+void test71()
+{
+    Aint71.AT a;
+    a.x = 3;
+}
+
+/******************************************/
+
+template foo72(T)
+{
+    char[] foo72(T d)
+    {
+        uint sz = typeof(d[0]).sizeof * 2;
+        return null;
+    }
+}
+
+void test72()
+{
+    static ulong[5] a = [0,1,2,3,4];
+    static uint[5] b = [0,1,2,3,4];
+    char[] r;
+    r = foo72!(ulong[5])(a); printf("%.*s\n", r.length, r.ptr);
+    r = foo72!(uint[5])(b);  printf("%.*s\n", r.length, r.ptr);
+}
+
+
+/******************************************/
+
+alias int Int73;
+class Test73(T = Int73);
+alias Test73!() Foo73;
+
+void test73()
+{
+}
+
+/******************************************/
+
+class A74
+{
+    alias A74 atype;
+    int x;
+}
+
+
+class B74(R, int V = R.sizeof)
+{
+    int v = V;
+}
+
+void test74()
+{
+    B74!(A74,3) b = new B74!(A74,3)();
+    assert(b.v == 3);
+
+    B74!(A74) c = new B74!(A74)();
+    assert(c.v == A74.sizeof);
+}
+
+
+/******************************************/
+
+interface NotionalRange75(V)
+{
+}
+
+class MatchedNotionalRange75(R)
+    : NotionalRange75!(R.value_type)
+{
+}
+
+class Range75
+{
+    alias   int   value_type;
+}
+
+class List75
+{
+
+    MatchedNotionalRange75!(Range75) x;
+}
+
+void test75()
+{
+}
+
+
+/******************************************/
+
+interface Indian(T)
+{
+}
+
+interface Iterable(T)
+{
+  Indian!(T) foo();
+}
+
+class Lope(T) : Iterable!(T)
+{
+  Indian!(T) foo()
+  {
+        return new Corn!(T);
+  }
+}
+
+class Corn(T) : Indian!(T)
+{
+}
+
+void test76()
+{
+  Lope!(int) x = new Lope!(int);
+}
+
+
+/******************************************/
+
+class RawFile
+{
+}
+
+class Stream : RawFile
+{
+        template readLineT(T) { bool readLineT()
+        {
+                if (super)
+                        return false;
+                return true;
+        }}
+
+        bool readLine()
+        {
+                return readLineT!(int)();
+        }
+}
+
+void test77()
+{
+}
+
+
+/******************************************/
+
+class Four(U, V, X, Y)
+{
+  U i;  V j;  X k;  Y l;
+}
+
+template WhatFour(U,V,X,Y)
+{
+    int func(Four!(U,V,X,Y) four)
+    {
+        printf("general template\n");
+        return 1;
+    }
+}
+
+template WhatFour(U:int,V,X,Y)
+{
+    int func(Four!(int,V,X,Y) four)
+    {
+        printf("specialization:: first int\n");
+        return 2;
+    }
+}
+
+template WhatFour(U,V:U,X,Y:X)
+{
+    int func(Four!(U,U,X,X) four)
+    {
+        printf("specialization:: first two equal, second two equal\n");
+        return 3;
+    }
+}
+
+alias WhatFour!(int,float,char,bool).func whatfour;
+alias WhatFour!(float,float,char,bool).func whatfour;
+alias WhatFour!(float,float,char,char).func whatfour;
+alias WhatFour!(int,int,float,char).func whatfour;  // ambiguous match
+
+void test78()
+{ int j;
+
+  Four!(int,float,char,bool) f;
+  Four!(float,float,char,bool) g;
+  Four!(float,float,char,char) h;
+  Four!(int,int,float,char) i;
+
+  j = whatfour(f);
+  assert(j == 2);
+  j = whatfour(g);
+  assert(j == 1);
+  j = whatfour(h);
+  assert(j == 3);
+  j = whatfour(i);
+  assert(j == 2);
+
+  /*
+  will print:
+specialization:: first int
+general template
+specialization:: first two equal, second two equal
+specialization:: first int
+  */
+}
+
+
+/******************************************/
+// http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=2117
+
+class Conversion(T,U){
+        alias char Small;
+        class Big{
+                char[2] dummy;
+        }
+        static Small Test(U u);
+        static Big Test(...);
+        static T MakeT();
+        enum {
+                exists = (Test(MakeT())).sizeof == (Small).sizeof
+        }
+}
+
+void variadicDummy(...){
+}
+
+void test79()
+{
+        variadicDummy(Conversion!(double,int).exists);
+}
+
+/******************************************/
+
+class A80(T)
+{
+   T s;
+
+   int foo(int delegate (T) d) { return 3 + d(s); }
+
+   int bar()
+   {
+     return foo(delegate int (T t) { return 6 + t.x; });
+   }
+}
+
+class B80: A80!(B80)
+{
+    int x = 20;
+}
+
+class C80: A80!(C80)
+{
+    int y = 3;
+    int x = 10;
+}
+
+void test80()
+{
+    B80 b = new B80();
+    C80 c = new C80();
+
+    b.s = b;
+    c.s = c;
+
+    assert(b.bar() == 9+20);
+    assert(c.bar() == 9+10);
+}
+
+/******************************************/
+
+struct T81(FOO)
+{
+        S81 s;
+}
+
+struct S81
+{
+        T81!(int)* pt;
+}
+
+void test81()
+{
+}
+
+/******************************************/
+
+T foo82(T : const(U)*, U=char)(T t)
+{
+    return null;
+}
+
+void test82()
+{   int i;
+    const int ci;
+
+    //writeln(typeid(typeof(foo82(&ci))));
+    //writeln(typeid(typeof(foo82(&i))));
+    assert(typeof(foo82(&ci)).stringof == "const(int)*");
+    assert(typeof(foo82(&i)).stringof == "int*");
+}
+
+/******************************************/
+
+struct A83
+{
+    void foo(int) {}
+    void bar(T)(T) {}
+}
+
+void test83()
+{
+    A83 a;
+    a.foo = 5;
+    a.bar = 6;
+}
+
+/******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+//    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test56();
+    test57();
+    test58();
+    test59();
+    test60();
+    test61();
+    test62();
+    test63();
+    test64();
+    test65();
+    test66();
+    test67();
+    test68();
+    test69();
+    test70();
+    test71();
+    test72();
+    test73();
+    test74();
+    test75();
+    test76();
+    test77();
+    test78();
+    test79();
+    test80();
+    test81();
+    test82();
+    test83();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/template13478.d b/gcc/testsuite/gdc.test/runnable/template13478.d
new file mode 100644
index 00000000000..7fa7a18aa27
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/template13478.d
@@ -0,0 +1,10 @@
+/// Tests emission of templates also referenced in speculative contexts.
+/// Failure triggered with -inline.
+module template13478;
+
+import imports.template13478a;
+import imports.template13478b;
+
+int main() {
+   return foo!int();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/template2.d b/gcc/testsuite/gdc.test/runnable/template2.d
new file mode 100644
index 00000000000..ba5ad13ebd2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/template2.d
@@ -0,0 +1,114 @@
+// original post to the D newsgroup:
+//    http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=D&artnum=10554&header
+// Test to manipulate 3D vectors, in D!
+// by Sean L Palmer (seanpalmer@directvinternet.com)
+// This code is released without any warranty.  Use at your own risk.
+import core.stdc.stdio;
+import std.math : sqrt;
+
+template VecTemplate(tfloat, int dim:3)
+{
+ struct Vector
+ {
+  tfloat d[dim];
+
+  version(none)
+  {
+   // sets the vector to the value of the given array
+   void set(tfloat[dim] r) { d[] = r[]; }
+   // comparison (a == b, a != b)
+   bool opEquals(Vector b) { for (int i=0; i<dim; ++i) if (d[i] != b.d[i]) return
+false; return true; }
+   // negate (-a)
+   Vector opNeg() { Vector r; for (int i=0; i<dim; ++i) r.d[i] = -d[i]; return
+r;  }
+   // complement (~a)
+   Vector opCom() { Vector r; for (int i=0; i<dim; ++i) r.d[i] = d[(i+1)%dim];
+d[0] = -d[0]; return r;  }
+   // add (a + b)
+   Vector opAdd(Vector b) { Vector r; r.d[] = d[] + b.d[]; return r;  }
+   // addto (a += b)
+   Vector opAddAssign(Vector b) { d[] += b.d[]; return r;  }
+   // subtract (a - b)
+   Vector opSub(Vector b) { Vector r; r.d[] = d[] - b.d[]; return r;  }
+   // multiply by scalar (a * 2.0)
+   Vector opMul(tfloat b) { Vector r; for (int i=0; i<dim; ++i) r.d[i] = d[i]
+* b; return r;  }
+   // divide by scalar (a / b)
+   Vector opDiv(tfloat b) { return *this * (1/b);  }
+   // dot product (a * b)
+   tfloat opMul(Vector b) { tfloat r=0; for (int i=0; i<dim; ++i) r += d[i];
+return r;  }
+   // outer product (a ^ b)
+   //Vector opXor(Vector b) { Vector r; for (int i=0; i<dim; ++i) r += d[i]; return r;  }
+  }
+
+  void set(tfloat[dim] r) { for (int i=0; i<dim; ++i) d[i] = r[i]; }
+  // comparison (a == b, a != b)
+  const bool opEquals(ref const Vector b) { for (int i=0; i<dim; ++i) if (d[i] != b.d[i]) return
+false; return true; }
+  // negate (-a)
+  Vector opNeg() { Vector r; for (int i=0; i<dim; ++i) r.d[i] = -d[i]; return
+r;  }
+  // complement (~a)
+  Vector opCom() { Vector r; for (int i=0; i<dim; ++i) r.d[i] = d[(i+1)%dim];
+d[0] = -d[0]; return r;  }
+  // add (a + b)
+  Vector opAdd(Vector b) { Vector r; for (int i=0; i<dim; ++i) r.d[i] = d[i] +
+b.d[i]; return r;  }
+  // addto (a += b)
+  Vector opAddAssign(Vector b) { for (int i=0; i<dim; ++i) d[i] += b.d[i]; return
+this; }
+  // subtract (a - b)
+  Vector opSub(Vector b) { Vector r; for (int i=0; i<dim; ++i) r.d[i] = d[i] -
+b.d[i]; return r;  }
+  // multiply by scalar (a * 2.0)
+  Vector opMul(tfloat b) { Vector r; for (int i=0; i<dim; ++i) r.d[i] = d[i] *
+b; return r;  }
+  // divide by scalar (a / b)
+  Vector opDiv(tfloat b) { return this * (1/b);  }
+  // dot product (a * b)
+  tfloat opMul(Vector b) { tfloat r=0; for (int i=0; i<dim; ++i) r += d[i];
+return r;  }
+  // outer product (a ^ b)
+  //Vector opXor(Vector b) { Vector r; for (int i=0; i<dim; ++i) r += d[i]; return r;  }
+
+  void print() { for (int i=0; i<dim; ++i) printf("%f ", d[i]);
+printf("\n"); }
+ }
+
+ tfloat abs(Vector v)
+ {
+  return sqrt(sqr(v));
+ }
+
+ tfloat sqr(Vector v)
+ {
+  return v * v;
+ }
+}
+
+alias VecTemplate!(float, 3) VcT;
+
+float[3] up = [ 0, 1, 0 ];
+
+int main(char[][] args)
+{
+ printf("running\n");
+ with (VcT)         // try this, I dare ya!!  crashes DMD 0.51
+ {
+  VcT.Vector a,b,c;
+  c.set(up);
+  b.set(up);
+  a = b + c;
+  a.print();
+  printf("b * c = %f\n",b * c);
+  printf("abs(a) = %f\n",VcT.abs(a));
+  printf("sqr(a) = %f\n",VcT.sqr(a));
+ }
+ printf("closing\n");
+ return 0;
+}
+
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/template2962.d b/gcc/testsuite/gdc.test/runnable/template2962.d
new file mode 100644
index 00000000000..3993e81b4d4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/template2962.d
@@ -0,0 +1,30 @@
+// EXTRA_SOURCES: imports/template2962a.d
+
+// comment 29
+void foo(T)(T p)
+{
+    void inner(U)() {
+        auto p2 = p;
+    }
+    inner!int();
+}
+
+// comment 20
+void funcD(alias x)() {
+   assert(x==1.0);
+}
+
+void funcC(T)(double a){
+    // Case 1: ICE(glue.c)
+    funcD!(a)();
+
+    // Case 2: wrong code
+    double b = 1.0; funcD!(b)();
+}
+
+void bug2962comment36()(int p)
+{
+    int inner()() { return p; }
+    alias inner!() finner;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/template3.d b/gcc/testsuite/gdc.test/runnable/template3.d
new file mode 100644
index 00000000000..85417fe384f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/template3.d
@@ -0,0 +1,241 @@
+
+import core.stdc.stdio;
+
+/*********************************************************/
+
+template Foo(T)
+{
+    static if (is(T : int))
+        alias T t1;
+
+    static if (T.sizeof == 4)
+        alias T t2;
+
+    static if (is(T U : int))
+        alias U t3;
+
+    static if (is(T* V : V*))
+        alias V t4;
+
+    static if (is(T W))
+        alias W t5;
+    else
+        alias char t5;
+
+    static if (is(T* X : X*))
+    {
+    }
+}
+
+void test1()
+{
+    Foo!(int).t1 x1;
+    assert(typeid(typeof(x1)) == typeid(int));
+
+    Foo!(int).t2 x2;
+    assert(typeid(typeof(x2)) == typeid(int));
+
+    Foo!(int).t3 x3;
+    assert(typeid(typeof(x3)) == typeid(int));
+
+    Foo!(int*).t4 x4;
+    assert(typeid(typeof(x4)) == typeid(int*));
+
+    Foo!(int).t5 x5;
+    assert(typeid(typeof(x5)) == typeid(int));
+
+    Foo!(int).X x6;
+    assert(typeid(typeof(x6)) == typeid(int));
+}
+
+/*********************************************************/
+
+
+void test2()
+{
+    alias int T;
+
+    static if (is(T : int))
+        alias T t1;
+
+    static if (T.sizeof == 4)
+        alias T t2;
+
+    static if (is(T U : int))
+        alias U t3;
+
+    static if (is(T* V : V*))
+        alias V t4;
+
+    static if (is(T W))
+        alias W t5;
+    else
+        alias char t5;
+
+    static if (is(T* X : X*))
+    {
+    }
+
+    t1 x1;
+    assert(typeid(typeof(x1)) == typeid(int));
+
+    t2 x2;
+    assert(typeid(typeof(x2)) == typeid(int));
+
+    t3 x3;
+    assert(typeid(typeof(x3)) == typeid(int));
+
+    t4 x4;
+    assert(typeid(typeof(x4)) == typeid(int));
+
+    t5 x5;
+    assert(typeid(typeof(x5)) == typeid(int));
+
+    X x6;
+    assert(typeid(typeof(x6)) == typeid(int));
+}
+
+/*********************************************************/
+
+void test3()
+{
+    static if (is(short : int))
+    {   printf("1\n");
+    }
+    else
+        assert(0);
+    static if (is(short == int))
+        assert(0);
+    static if (is(int == int))
+    {   printf("3\n");
+    }
+    else
+        assert(0);
+}
+
+/*********************************************************/
+
+template TValue(int i:1)
+{
+        pragma(msg,"last instantiation!!!");
+        const int TValue = 1;
+}
+
+template TValue(int i)
+{       
+        pragma(msg,"instantiating...");
+        const int TValue = i * TValue!(i-1);
+}
+
+void test4()
+{
+        assert(TValue!(3) == 6);
+}
+
+/*********************************************************/
+
+template Reverse(string s: "") {
+    const char[] Reverse = "";
+}
+
+template Reverse(string s) {
+    const char[] Reverse = Reverse!(s[1..$]) ~ s[0];
+}
+
+void test5()
+{
+    assert(Reverse!("Recursive string template") == "etalpmet gnirts evisruceR");
+}
+
+/*********************************************************/
+
+template foo6(alias V)
+{
+    int foo6()
+    {
+        return V;
+    }
+}
+
+class bar6(alias V)
+{
+    int abc()
+    {
+        return V;
+    }
+}
+
+void test6()
+{
+    int j = 3;
+    int k = 4;
+
+    int i = foo6!(j)();
+    i += foo6!(j)();
+
+    i += foo6!(k)();
+
+    bar6!(j) b = new bar6!(j);
+    i -= b.abc();
+
+    assert(i == 7);
+}
+
+/*********************************************************/
+
+template Bind7(alias dg)
+{
+    int Bind7()
+    {
+        dg('c');
+        return 0;
+    }
+}
+
+void test7()
+{
+    char[] v;
+
+    void foo(char c) { v ~= c; }
+
+    alias Bind7!(foo) intv;
+    intv();
+    assert(v[0] == 'c');
+}
+
+/*********************************************************/
+
+template sum8(real x)
+{
+    static if (x <= 1.0L){
+            const real sum8 = x;
+    }else{
+            const real sum8 = x + sum8!(x - 1.0L);
+    }
+}
+
+void test8()
+{
+    real x = sum8!(3.0L);
+
+    if(x != 6.0L){
+            assert(0);
+    }
+}
+
+/*********************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/template4.d b/gcc/testsuite/gdc.test/runnable/template4.d
new file mode 100644
index 00000000000..ab082d9f5d7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/template4.d
@@ -0,0 +1,1166 @@
+import std.stdio;
+import core.stdc.stdio;
+
+/*********************************************************/
+
+template Foo(T)
+{
+    static if ( is(T : int) )
+        alias T t1;
+
+    static if (T.sizeof == 4)
+        alias T t2;
+
+    static if ( is(T AB : int) )
+        alias AB t3;
+
+    static if ( is(T* V : V*) )
+        alias V t4;
+
+    static if ( is(T W) )
+        alias W t5;
+    else
+        alias char t5;
+
+    static if ( is(T* X : X*) )
+    {
+    }
+}
+
+void test1()
+{
+    Foo!(int).t1 x1;
+    assert(typeid(typeof(x1)) == typeid(int));
+
+    Foo!(int).t2 x2;
+    assert(typeid(typeof(x2)) == typeid(int));
+
+    Foo!(int).t3 x3;
+    assert(typeid(typeof(x3)) == typeid(int));
+
+    Foo!(int).t4 x4;
+    assert(typeid(typeof(x4)) == typeid(int));
+
+    Foo!(int).t5 x5;
+    assert(typeid(typeof(x5)) == typeid(int));
+
+    Foo!(int).X x6;
+    assert(typeid(typeof(x6)) == typeid(int));
+}
+
+/*********************************************************/
+
+
+void test2()
+{
+    alias int T;
+
+    static if ( is(T : int) )
+        alias T t1;
+
+    static if (T.sizeof == 4)
+        alias T t2;
+
+    static if ( is(T U : int) )
+        alias U t3;
+
+    static if ( is(T* V : V*) )
+        alias V t4;
+
+    static if ( is(T W) )
+        alias W t5;
+    else
+        alias char t5;
+
+    static if ( is(T* X : X*) )
+    {
+    }
+
+    t1 x1;
+    assert(typeid(typeof(x1)) == typeid(int));
+
+    t2 x2;
+    assert(typeid(typeof(x2)) == typeid(int));
+
+    t3 x3;
+    assert(typeid(typeof(x3)) == typeid(int));
+
+    t4 x4;
+    assert(typeid(typeof(x4)) == typeid(int));
+
+    t5 x5;
+    assert(typeid(typeof(x5)) == typeid(int));
+
+    X x6;
+    assert(typeid(typeof(x6)) == typeid(int));
+}
+
+/*********************************************************/
+
+void test3()
+{
+    static if ( is(short : int) )
+    {
+        printf("1\n");
+    }
+    else
+        assert(0);
+    static if ( is(short == int) )
+        assert(0);
+    static if ( is(int == int) )
+    {
+        printf("3\n");
+    }
+    else
+        assert(0);
+}
+
+/*********************************************************/
+
+void test4()
+{
+    alias void Function(int);
+
+    static if (is(Function Void == function))
+        printf("if\n");
+    else
+        assert(0);
+
+//    static if (is(Void == void))
+//        printf("if\n");
+//    else
+//        assert(0);
+
+
+    alias byte delegate(int) Delegate;
+
+    static if (is(Delegate Foo == delegate))
+        printf("if\n");
+    else
+        assert(0);
+
+    static if (is(Foo Byte == function))
+        printf("if\n");
+    else
+        assert(0);
+
+//    static if (is(Byte == byte))
+//        printf("if\n");
+//    else
+//        assert(0);
+
+
+    union Union { }
+
+    static if (is(Union == union))
+        printf("if\n");
+    else
+        assert(0);
+
+
+    struct Struct { }
+
+    static if (is(Struct == struct))
+        printf("if\n");
+    else
+        assert(0);
+
+
+    enum Enum : short { EnumMember }
+
+    static if (is(Enum Short == enum))
+        printf("if\n");
+    else
+        assert(0);
+
+    static if (is(Short == short))
+        printf("if\n");
+    else
+        assert(0);
+
+    class Class { }
+
+    static if (is(Class == class))
+        printf("if\n");
+    else
+        assert(0);
+
+
+    interface Interface { }
+
+    static if (is(Interface == interface))
+        printf("if\n");
+    else
+        assert(0);
+
+}
+
+/*********************************************************/
+
+class Foo5(T)
+{
+    Node sentinel;
+
+    struct Node
+    {
+        int value;
+    }
+}
+
+void test5()
+{
+    Foo5!(int) bar=new Foo5!(int);
+    bar.sentinel.value = 7;
+}
+
+
+/*********************************************************/
+
+template factorial6(int n)
+{
+    static if (n == 1)
+        const int factorial6 = 1;
+    else
+        const int factorial6 = n * .factorial6!(n-1);
+}
+
+void test6()
+{
+    int i = factorial6!(4);
+    printf("%d\n", i);
+    assert(i == 24);
+}
+
+
+/*********************************************************/
+
+template factorial7(float n, cdouble c, string sss, string ttt)
+{
+    static if (n == 1)
+        const float factorial7 = 1;
+    else
+        const float factorial7 = n * 2;
+}
+
+template bar7(wstring abc, dstring def)
+{
+    const int x = 3;
+}
+
+void test7()
+{
+    float f = factorial7!(4.25, 6.8+3i, "hello", null);
+    printf("%g\n", f);
+    assert(f == 8.5);
+    int i = bar7!("abc"w, "def"d).x;
+    printf("%d\n", i);
+    assert(i == 3);
+}
+
+/*********************************************************/
+
+template whale(string walrus)
+{
+    const char [] whale = walrus;
+}
+
+template dolphin(string fish)
+{
+   const char [] dolphin = whale!(fish[0..3]);
+}
+
+const char [] urchin1 = dolphin!("anenome");
+const char [] urchin2 = whale!("anenome"[0..3]);
+
+template dolphin3(string fish)
+{
+   const char [] dolphin3 = fish[0..3];
+}
+
+const char [] urchin3 = dolphin3!("anenome");
+
+template dolphin4(string fish)
+{
+  const char [] dolphin4 = whale!(fish[0..(3)]);
+}
+
+const char [] urchin4 = dolphin4!("anenome");
+
+template dolphin5(string fish)
+{
+  const char [] dolphin5 = whale!(fish[(0)..3]);
+}
+
+const char [] urchin5 = dolphin5!("anenome");
+
+void test8()
+{
+    assert(urchin1 == "ane");
+    assert(urchin2 == "ane");
+    assert(urchin3 == "ane");
+    assert(urchin4 == "ane");
+    assert(urchin5 == "ane");
+}
+
+/*********************************************************/
+
+int testEmpty(string s) { return 0; }
+
+template Recurse(string pattern){
+}
+
+
+template slice(string str, int from, int to)
+{
+    const string slice = str[from..to];
+}
+
+
+template Compile(string pattern)
+{
+    const string left = slice!(pattern,4,pattern.length);
+
+    const string remaining = slice!(left,1,left.length);
+
+    alias Recurse!(remaining) fn;
+}
+
+
+
+template Match(string pattern)
+{
+    alias Compile!(pattern) Match;
+}
+
+void test9()
+{
+    alias Match!("abcdefghijk") f;
+}
+
+/*********************************************************/
+
+template Foo10(string s)
+{
+    const string Foo10 = s;
+}
+
+void test10()
+{
+    string s;
+
+    s = Foo10!("abc" ~ "e");
+    assert(s == "abce");
+
+    s = Foo10!("abc" ~ 'f');
+    assert(s == "abcf");
+
+    s = Foo10!('g' ~ "abc");
+    assert(s == "gabc");
+
+    s = Foo10!('g' ~ "abc" ~ 'h');
+    assert(s == "gabch");
+}
+
+/*********************************************************/
+
+template Foo11(string s)
+{
+    const string Foo11 = s;
+}
+
+void test11()
+{
+    string s;
+
+    s = Foo11!("abcdef"[1..$ - 1]);
+    assert(s == "bcde");
+}
+
+/*********************************************************/
+
+template Foo12(int i)
+{
+    const int Foo12 = i;
+}
+
+void test12()
+{
+    int i;
+
+    i = Foo12!("abcdef" == "abcdef");
+    assert(i == 1);
+    i = Foo12!("abcdef" == "abcqef");
+    assert(i == 0);
+    i = Foo12!("abcdef" == "abc");
+    assert(i == 0);
+    i = Foo12!("abc" == "abcdef");
+    assert(i == 0);
+}
+
+/*********************************************************/
+
+const a13 = 3;
+static if (a13 == 3)
+    int b13 = 7;
+
+template Foo13(int i)
+{
+    const int j = i + 1;
+    static if (j == 3)
+        const int k = 2;
+}
+
+void test13()
+{
+    assert(b13 == 7);
+    assert(Foo13!(2).k == 2);
+}
+
+/*********************************************************/
+
+template zebra(string w)
+{
+    static if (w.length > 2 && w[1] == 'q')
+        const bool zebra = true;
+    else
+        const bool zebra = false;
+}
+
+template horse(string w)
+{
+    static if (w.length == 1 || w[1] == 'q')
+        const bool horse = true;
+    else
+        const bool horse = false;
+}
+
+void test14()
+{
+    bool lion = zebra!("a");
+    writeln(lion);
+    assert(!lion);
+    lion = zebra!("aqb");
+    writeln(lion);
+    assert(lion);
+
+    lion = horse!("a");
+    writeln(lion);
+    assert(lion);
+    lion = horse!("aqb");
+    writeln(lion);
+    assert(lion);
+    lion = horse!("ab");
+    writeln(lion);
+    assert(!lion);
+}
+
+/*********************************************************/
+
+template factorial15(int n)
+{
+   static if (n<2) const int factorial15 = 1;
+   else const int factorial15 = n * factorial15!(n-1);
+}
+
+template rhino15(alias hippo)
+{
+   const int rhino15 = hippo!(3);
+}
+
+void test15()
+{
+    const int lion = rhino15!(factorial15);
+    assert(lion == 6);
+}
+
+/*********************************************************/
+
+// Create a constant array of int or uint sized items
+// as a dstring string. n is the index of the last item.
+template makeLookup(alias entry, int n)
+{
+   static if (n == -1) // start with an empty array...
+     const dchar [] makeLookup = "";
+   else        // ... and fill it up
+     const dchar [] makeLookup = makeLookup!(entry, n-1)
+           ~ cast(dchar)entry!(n);
+}
+
+template factorial16(uint n)
+{
+     static if (n<2) const uint factorial16 = 1;
+     else const factorial16 = n * factorial16!(n-1);
+}
+
+// Make an array of factorials from 0 to 13 (14!> uint.max)
+const smallfactorials = makeLookup!(factorial16, 13);
+
+const uint[14] testtable =
+[
+  1,
+  1,
+  2,
+  6,
+  24,
+  120,
+  720,
+  5040,
+  40320,
+  362880,
+  3628800,
+  39916800,
+  479001600,
+  1932053504,
+];
+
+void test16()
+{
+    for (int i=0; i<smallfactorials.length; ++i)
+    {
+        writefln("%d  %d", i, smallfactorials[i]);
+        assert(smallfactorials[i] == testtable[i]);
+    }
+}
+
+/*********************************************************/
+
+template dingo(int a)
+{
+    pragma(msg, "This actually gets evaluated!");
+    static if (a==2) {
+        const int dingo = 28;
+    }
+    else
+        const int dingo = a;
+}
+
+const int bilby = dingo!(2);
+
+void test17()
+{
+    assert(bilby == 28);
+}
+
+/*********************************************************/
+
+template frog(char F)
+{
+     const int frog = 1;
+}
+
+template frog(int F)
+{
+     const int frog = 2;
+}
+
+template frog(char F: 'A')
+{
+     const int frog = 3;
+}
+
+template frog(int F: 65)
+{
+     const int frog = 4;
+}
+
+static assert( frog!('B')==1);
+static assert( frog!(64)==2);
+static assert( frog!('A')==3);
+static assert( frog!(65)==4);
+
+void test18()
+{
+}
+
+/*********************************************************/
+
+void test19()
+{
+    MakeTuple19!(int,int) t;
+    assert(t.sizeof == int.sizeof);
+}
+
+template MakeTuple19( T1, T2 )
+{
+     alias int MakeTuple19;
+}
+
+template MakeTuple19(T1, T2, T3=float)
+{
+     alias long MakeTuple19;
+}
+
+
+/*********************************************************/
+
+template sqrt(real x, real root = x/2, int ntries = 0)
+{
+  static if (ntries == 5)
+    // precision doubles with each iteration,
+    // 5 should be enough
+    const sqrt = root;
+  else static if (root * root - x == 0)
+    const sqrt = root;  // exact match
+  else
+    // iterate again
+    const sqrt = sqrt!(x, (root+x/root)/2, ntries+1);
+}
+
+void test20()
+{
+    real x = sqrt!(2);
+    writefln("%.20g", x); // 1.4142135623730950487
+}
+
+/*********************************************************/
+
+template hash(string s, uint sofar=0)
+{
+   static if (s.length == 0)
+      const hash = sofar;
+   else
+      const hash = hash!(s[1 .. $], sofar * 11 + s[0]);
+}
+
+uint foo21()
+{
+    return hash!("hello world");
+}
+
+void test21()
+{
+    auto i = foo21();
+    writeln(i);
+    assert(i == 1871483972);
+}
+
+
+/*********************************************************/
+
+T Foo22(T)(int i)
+{
+    printf("i = %d\n", i);
+    return cast(T)0;
+}
+
+void test22()
+{
+    Foo22!(int)(3);
+}
+
+/*********************************************************/
+
+template fish( char s)
+{
+  const bool fish = true;
+}
+
+template dog(string bird)
+{
+        static if (bird.length>99 && fish!( (bird[95])) )
+           const int dog = 2;
+        else const int dog = 3;
+}
+
+const int pig = dog!("a");
+
+void test23()
+{
+}
+
+/*********************************************************/
+
+T delegate (T) acc24 (T) (T n)
+{
+    return (T i) { return n += i; };
+}
+
+void test24()
+{
+    auto acc1 = acc24 (4);
+}
+
+/*********************************************************/
+
+T func25(T, T c = 1)(T x)
+{
+    return x * c;
+}
+
+void test25()
+{
+    double d;
+
+    d = func25(1.0);
+    assert(d == 1.0);
+
+    d = func25(2.0);
+    assert(d == 2.0);
+
+    d = func25!(double)(2.0);
+    assert(d == 2.0);
+
+    d = func25!(double, 3)(2.0);
+    assert(d == 6.0);
+}
+
+/*********************************************************/
+
+class Foo26 {}
+class Bar26 {}
+
+string name26;
+
+template aliastest(alias A) {
+    pragma(msg,"Alias Test instantiated");
+    void aliastest() {
+        name26 = (new A!().al).classinfo.name;
+        //writefln("Alias Test: ", name26);
+    }
+}
+
+template boxtpl(alias A) {
+    template box() {
+        alias A al;
+    }
+}
+
+void test26()
+{
+    aliastest!(boxtpl!(Foo26).box) ();
+    assert(name26 == "template4.Foo26");
+    aliastest!(boxtpl!(Bar26).box) ();
+    assert(name26 == "template4.Bar26");
+}
+
+/*********************************************************/
+
+struct TFoo27(int x) { }
+alias TFoo27!(3) a;
+alias TFoo27!(2+1) b;
+alias TFoo27!(3u) c;
+
+static assert(is(TFoo27!(3) == TFoo27!(2 + 1)));
+static assert(is(TFoo27!(3) == TFoo27!(3u)));
+
+void test27()
+{
+}
+
+/*********************************************************/
+
+struct SiQuantity
+{
+    real value = 0;
+    static assert(SiQuantity.sizeof == real.sizeof);
+
+    template AddDimensions(int mul, U) { }
+}
+
+void test28()
+{
+}
+
+/*********************************************************/
+
+template Count29() { const Count29 = 5; }
+
+void test29()
+{
+    int[Count29!()] x;
+
+    assert(x.length == 5);
+}
+
+/*********************************************************/
+
+class FooClass(T) {  T data; }
+
+struct FooStruct(T) {  T data;  }
+
+void bar_struct(T)(FooStruct!(T) a) {}
+
+void bar_class(T)(FooClass!(T) a) {}
+
+void test30()
+{
+    auto C = new FooClass!(double);
+    FooStruct!(double) S;
+
+    bar_struct(S);
+    bar_class!(double)(C);
+    bar_class(C);
+}
+
+/*********************************************************/
+
+V get31(V,K)(V[K] dict, K key, V def = V.init)
+{
+    V* ptr = key in dict;
+    return ptr? *ptr: def;
+}
+
+
+string get31x(string[int] dict, int key, string def = null)
+{
+    string* ptr = key in dict;
+    return ptr? *ptr: def;
+}
+
+
+void test31()
+{
+    string[int] i2s;
+    i2s[1] = "Hello";
+    i2s[5] = "There";
+
+    writeln( i2s.get31(1, "yeh") );
+    writeln( i2s.get31(2, "default") );
+    writeln( i2s.get31(1) );
+    writeln( i2s.get31(2) );
+}
+
+/*********************************************************/
+
+void delegate(T, S) Concat(S, T...)(void delegate(T) one, void delegate(S) two)
+{
+  return( delegate void(T t, S s){} );
+}
+
+void test32()
+{
+  void delegate(char, char, int) wtf = Concat(
+    delegate void(char a, char b) {},
+    delegate void(int lol) {}
+  );
+}
+
+/*********************************************************/
+
+struct Composer(T) {
+    alias T delegate(T) Fun;
+    Fun[] funs;
+    public T opCall()(T x) {
+        T result = x;
+        foreach_reverse (f; funs)
+        {
+            result = f(result);
+        }
+        return result;
+    }
+    public void opAddAssign(Fun f) {
+        funs ~= f;
+    }
+}
+
+struct square(T) {
+    T opCall(T t) {
+        return t*t;
+    }
+}
+
+struct plus1(T) {
+    T opCall(T t) {
+        return t+1;
+    }
+}
+
+struct div3(T) {
+    T opCall(T t) {
+        return t/3.0;
+    }
+}
+
+T delegate(T) tofp(T : S!(T), alias S)()
+{
+    class Foo
+    {
+        div3!(T) arg;
+
+        T bar(T t)
+        {
+            return arg(t);
+        }
+    }
+
+    Foo f = new Foo;
+    return &f.bar;
+}
+
+void test33() {
+    Composer!(double) comp;
+    comp += delegate double (double x) { return x/3.0;};
+    comp += delegate double (double x) { return x*x;};
+    comp += (double x) => x + 1.0;
+    writefln("%f", comp(2.0));
+
+    // Try function objects
+    Composer!(double) comp2;
+    comp2 += tofp!(div3!(double))();
+    comp2 += tofp!(square!(double))();
+    comp2 += tofp!(plus1!(double))();
+    writefln("%f", comp2( 2.0));
+}
+
+/*********************************************************/
+
+template Print34(Ts ...) { pragma (msg, Ts.stringof); }
+
+template Tuple34(Ts ...) { alias Ts Tuple34; }
+
+template Decode34( T )                                       { alias Tuple34!() Types; }
+template Decode34( T : TT!(U1),       alias TT, U1 )         { alias Tuple34!(U1) Types; }
+template Decode34( T : TT!(U1,U2),    alias TT, U1, U2 )     { alias Tuple34!(U1,U2) Types; }
+template Decode34( T : TT!(U1,U2,U3), alias TT, U1, U2, U3 ) { alias Tuple34!(U1,U2,U3) Types; }
+
+
+struct S34_1(T1) {}
+struct S34_2(T1, T2) {}
+struct S34_3(T1, T2, T3) {}
+
+alias Decode34!( bool ).Types SQ0;
+alias Decode34!( S34_1!(bool) ).Types SQ1;
+alias Decode34!( S34_2!(bool,short) ).Types SQ2;
+alias Decode34!( S34_3!(bool,short,int) ).Types SQ3;
+
+mixin Print34!(SQ0);
+mixin Print34!(SQ1);
+mixin Print34!(SQ2);
+mixin Print34!(SQ3);
+
+void test34()
+{
+}
+
+/*********************************************************/
+
+template strof(T)
+{
+    static string strof = T.stringof;
+}
+
+void test35()
+{
+    alias typeof(delegate () { return (char[]).init;} ) del;
+    auto a = strof!(del);
+    auto aa = strof!(int);
+    auto ab = strof!(typeof(5));
+    auto meth = delegate () { return (char[]).init;};
+    auto b = strof!(typeof(meth));
+    auto c = strof!(typeof(delegate () { return 5; } ));
+    auto d = strof!(typeof(delegate () { return (char[]).init;} ));
+}
+
+/*********************************************************/
+
+struct Number36(int N)
+{
+    const int value = N;
+}
+
+struct Foo36(T)
+{
+    int talk() { printf("Not so special:\n"); return 1; }
+}
+
+struct Foo36(T : Number36!(N), int N)
+{
+    int talk() { printf("Ooh special - NUMBER N\n"); return 2; }
+}
+
+void test36()
+{
+    Foo36!(Number36!(5)) x;
+    auto i = x.talk();
+    assert(i == 2);
+}
+
+/*********************************************************/
+
+struct Base37(T) {}
+
+alias Base37 Alias37;
+
+void foo37(T)(Alias37!(T) x) {}
+
+void test37()
+{
+   Base37!(float) b;
+   foo37(b); // fails!
+}
+
+/*********************************************************/
+
+void sort(alias dg, T)(T[] arr)
+{
+    bool a = dg(1,2);
+    printf("a = %d\n", a);
+    assert(a == true);
+}
+
+void test38()
+{   int[] arr;
+    int i = 3;
+
+    sort!( (x,y){ return x + i > y; } )(arr);
+    sort!( (int x,int y){ return x + i > y; } )(arr);
+}
+
+/*********************************************************/
+
+void bug4652(U, T...)(long y, T x, U num) {}
+void bug4652default(T) (T value, int x=2) {}
+void bug4652default(T) (T value, int y) {}
+void bug4676(T...)(T args, string str) {}
+void bug4676(T...)(T args) {}
+
+void instantiate4652()
+{
+    bug4652(2, 'c', 27, 'e', 'f',1); // rejects-valid
+    bug4652(2, 1);  // infinite loop on valid code
+    bug4652default(true);
+    bug4676(1, 2, 3);
+}
+
+/*********************************************************/
+// 7589
+
+struct T7589(T)
+{
+    void n;
+}
+static assert(!__traits(compiles, T7589!(int)));
+
+int bug7589b(T)() @safe { int *p; *(p + 8) = 6; }
+static assert(!__traits(compiles, bug7589b!(int)()+7 ));
+
+
+/*********************************************************/
+
+int bar39(alias dg)(int i)
+{
+    return dg(i);
+}
+
+void test39()
+{
+    auto i = bar39!(a => a + 1)(3);
+    if (i != 4)
+        assert(0);
+}
+
+/*********************************************************/
+// 6701
+
+uint foo_6701(uint v:0)() { return 1; }
+uint foo_6701(uint v)() { return 0; }
+uint foo2_6701(uint v:0, string op)() { return 1; }
+uint foo2_6701(uint v, string op)() { return 0; }
+
+void test6701()
+{
+    assert(foo_6701!(0u)() == 1);
+    assert(foo2_6701!(0u, "+")() == 1);
+}
+
+/******************************************/
+// 7469
+
+struct Foo7469a(int x) { }
+struct Foo7469b(int x) { }
+struct Foo7469c(alias v) { }
+struct Foo7469d(T...) { }
+struct Foo7469e(int a, T...) { }
+struct Foo7469f(T, int k=1) { }
+struct Foo7469g(T, int k=1) { }
+
+void test7469()
+{
+    static assert(Foo7469a!(3 )    .mangleof[$-28 .. $] == "17__T8Foo7469aVii3Z8Foo7469a");
+    static assert(Foo7469a!(3u)    .mangleof[$-28 .. $] == "17__T8Foo7469aVii3Z8Foo7469a");
+    static assert(Foo7469b!(3u)    .mangleof[$-28 .. $] == "17__T8Foo7469bVii3Z8Foo7469b");
+    static assert(Foo7469b!(3 )    .mangleof[$-28 .. $] == "17__T8Foo7469bVii3Z8Foo7469b");
+    static assert(Foo7469c!(3 )    .mangleof[$-28 .. $] == "17__T8Foo7469cVii3Z8Foo7469c");
+    static assert(Foo7469c!(3u)    .mangleof[$-28 .. $] == "17__T8Foo7469cVki3Z8Foo7469c");
+    static assert(Foo7469d!(3 )    .mangleof[$-28 .. $] == "17__T8Foo7469dVii3Z8Foo7469d");
+    static assert(Foo7469d!(3u)    .mangleof[$-28 .. $] == "17__T8Foo7469dVki3Z8Foo7469d");
+    static assert(Foo7469e!(3u, 5u).mangleof[$-32 .. $] == "21__T8Foo7469eVii3Vki5Z8Foo7469e");
+    static assert(Foo7469f!(int, 1).mangleof[$-30 .. $] == "19__T8Foo7469fTiVii1Z8Foo7469f");
+    static assert(Foo7469f!(int)   .mangleof[$-30 .. $] == "19__T8Foo7469fTiVii1Z8Foo7469f");
+    static assert(Foo7469g!(int)   .mangleof[$-30 .. $] == "19__T8Foo7469gTiVii1Z8Foo7469g");
+    static assert(Foo7469g!(int, 1).mangleof[$-30 .. $] == "19__T8Foo7469gTiVii1Z8Foo7469g");
+}
+
+/******************************************/
+
+template foo7698a(T, T val : 0)
+{
+    enum foo7698a = val;
+}
+
+T foo7698b(T, T val : 0)()
+{
+    return val;
+}
+
+T foo7698c(T, T val : T.init)()
+{
+    return val;
+}
+
+void test7698()
+{
+    static assert(foo7698a!(int, 0) == 0);
+    assert(foo7698b!(int, 0)() == 0);
+    assert(foo7698c!(int, 0)() == 0);
+}
+
+/*********************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test6701();
+    test7698();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/template6.d b/gcc/testsuite/gdc.test/runnable/template6.d
new file mode 100644
index 00000000000..9a49c953bc0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/template6.d
@@ -0,0 +1,445 @@
+// This is a copy of the engine here:
+//   http://www.digitalmars.com/d/2.0/templates-revisited.html
+// which is a cut down version of the file here:
+//   http://www.dsource.org/projects/ddl/browser/trunk/meta/regex.d
+// which has this copyright notice:
+/+
+    Copyright (c) 2005 Eric Anderton
+
+    Permission is hereby granted, free of charge, to any person
+    obtaining a copy of this software and associated documentation
+    files (the "Software"), to deal in the Software without
+    restriction, including without limitation the rights to use,
+    copy, modify, merge, publish, distribute, sublicense, and/or
+    sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following
+    conditions:
+
+    The above copyright notice and this permission notice shall be
+    included in all copies or substantial portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+    OTHER DEALINGS IN THE SOFTWARE.
++/
+
+
+import std.stdio;
+
+
+const int testFail = -1;
+
+/**
+ * Compile pattern[] and expand to a custom generated function
+ * that will take a string str[] and apply the regular expression
+ * to it, returning an array of matches.
+ */
+
+template regexMatch(string pattern)
+{
+    string[] regexMatch(string str)
+    {
+        string[] results;
+        int result = regexCompile!(pattern).fn(str);
+        if(result != testFail && result > 0){
+            results ~= str[0..result];
+        }
+        return results;
+    }
+}
+
+/******************************
+ * The testXxxx() functions are custom generated by templates
+ * to match each predicate of the regular expression.
+ *
+ * Params:
+ *      string str      the input string to match against
+ *
+ * Returns:
+ *      testFail        failed to have a match
+ *      n >= 0          matched n characters
+ */
+
+/// Always match
+template testEmpty()
+{
+    int testEmpty(string str) { return 0; }
+}
+
+/// Match if testFirst(str) and testSecond(str) match
+template testUnion(alias testFirst,alias testSecond,string key)
+{
+    int testUnion(string str)
+    {
+        int result = testFirst(str);
+        if(result != testFail){
+            int nextResult = testSecond(str[result..$]);
+            if(result != testFail)
+                return result + nextResult;
+        }
+        return testFail;
+    }
+}
+
+/// Match if first part of str[] matches text[]
+template testText(string text)
+{
+    int testText(string str)
+    {
+        if (str.length &&
+            text.length <= str.length &&
+            str[0..text.length] == text
+           )
+            return text.length;
+        return testFail;
+    }
+}
+
+/// Match if testPredicate(str) matches 0 or more times
+template testZeroOrMore(alias testPredicate,string key)
+{
+    int testZeroOrMore(string str)
+    {
+        if(str.length == 0) return 0;
+        int result = testPredicate(str);
+        if(result != testFail){
+            int nextResult = .testZeroOrMore!(testPredicate,key)(str[result..$]);
+            if(nextResult != testFail)
+                return result + nextResult;
+            return result;
+        }
+        return 0;
+    }
+}
+
+/// Match if term1[0] <= str[0] <= term2[0]
+template testRange(string term1,string term2)
+{
+    int testRange(string str)
+    {
+        if(str.length && str[0] >= term1[0] && str[0] <= term2[0])
+            return 1;
+        return testFail;
+    }
+}
+
+/// Match if ch[0]==str[0]
+template testChar(string ch)
+{
+    int testChar(string str)
+    {
+        if(str.length && str[0] == ch[0])
+            return 1;
+        return testFail;
+    }
+}
+
+/// Match if str[0] is a word character
+template testWordChar()
+{
+    int testWordChar(string str)
+    {
+        if(str.length &&
+           (
+            (str[0] >= 'a' && str[0] <= 'z') ||
+            (str[0] >= 'A' && str[0] <= 'Z') ||
+            (str[0] >= '0' && str[0] <= '9') ||
+            str[0] == '_'
+           )
+          )
+        {
+            return 1;
+        }
+        return testFail;
+    }
+}
+
+/*****************************************************/
+
+/**
+ * Returns the front of pattern[] up until the end or a special character.
+ */
+
+template parseTextToken(string pattern){
+    static if(pattern.length > 0){
+        static if(isSpecial!(pattern)){
+            const string parseTextToken="";
+        }
+        else{
+            const string parseTextToken = pattern[0] ~ parseTextToken!(pattern[1..$]);
+        }
+    }
+    else{
+        const string parseTextToken="";
+    }
+}
+
+/**
+ * Parses pattern[] up to and including terminator.
+ * Returns:
+ *      token[]         everything up to terminator.
+ *      consumed        number of characters in pattern[] parsed
+ */
+template parseUntil(string pattern,char terminator,bool fuzzy=false){
+    static if(pattern.length > 0){
+        static if(pattern[0] == '\\'){
+            static if(pattern.length > 1){
+                const string nextSlice = pattern[2 .. $];
+                alias parseUntil!(nextSlice,terminator,fuzzy) next;
+                const string token = pattern[0 .. 2] ~ next.token;
+                const uint consumed = next.consumed+2;
+            }
+            else{
+                pragma(msg,"Error: expected character to follow \\");
+                static assert(false);
+            }
+        }
+        else static if(pattern[0] == terminator){
+            const string token="";
+            const uint consumed = 1;
+        }
+        else{
+            const string nextSlice = pattern[1 .. $];
+            alias parseUntil!(nextSlice,terminator,fuzzy) next;
+            const string token = pattern[0] ~ next.token;
+            const uint consumed = next.consumed+1;
+        }
+    }
+    else static if(fuzzy){
+        const string token = "";
+        const uint consumed = 0;
+    }
+    else{
+        pragma(msg,"Error: exptected " ~ terminator ~ " to terminate group expression");
+        static assert(false);
+    }
+}
+
+/**
+ * Parse contents of character class.
+ * Params:
+ *      pattern[]  rest of pattern to compile
+ * Output:
+ *      fn         generated function
+ *      consumed   number of characters in pattern[] parsed
+ */
+
+template regexCompileCharClass2(string pattern){
+    static if(pattern.length > 0){
+        static if(pattern.length > 1){
+            static if(pattern[1] == '-'){
+                static if(pattern.length > 2){
+                    alias testRange!(pattern[0..1], pattern[2..3]) termFn;
+                    const uint thisConsumed = 3;
+                    const string remaining = pattern[3 .. $];
+                }
+                else{ // length is 2
+                    pragma(msg,"Error: expected character following '-' in character class");
+                    static assert(false);
+                }
+            }
+            else{ // not '-'
+                alias testChar!(pattern[0..1]) termFn;
+                const uint thisConsumed = 1;
+                const string remaining = pattern[1 .. $];
+            }
+        }
+        else{
+            alias testChar!(pattern[0..1]) termFn;
+            const uint thisConsumed = 1;
+            const string remaining = pattern[1 .. $];
+        }
+
+        static if(remaining.length > 0){
+            static if(remaining[0] != ']'){
+                alias regexCompileCharClass2!(remaining) next;
+                alias testOr!(termFn,next.fn,remaining) fn;
+                const uint consumed = next.consumed + thisConsumed;
+            }
+            else{
+                alias termFn fn;
+                const uint consumed = thisConsumed;
+            }
+        }
+        else{
+            alias termFn fn;
+            const uint consumed = thisConsumed;
+        }
+    }
+    else{
+        alias testEmpty!() fn;
+        const uint consumed = 0;
+    }
+}
+
+/**
+ * At start of character class. Compile it.
+ * Params:
+ *      pattern[]  rest of pattern to compile
+ * Output:
+ *      fn         generated function
+ *      consumed   number of characters in pattern[] parsed
+ */
+
+template regexCompileCharClass(string pattern){
+    static if(pattern.length > 0){
+        static if(pattern[0] == ']'){
+            alias testEmpty!() fn;
+            const uint consumed = 0;
+        }
+        else{
+            alias regexCompileCharClass2!(pattern) charClass;
+            alias charClass.fn fn;
+            const uint consumed = charClass.consumed;
+        }
+    }
+    else{
+        pragma(msg,"Error: expected closing ']' for character class");
+        static assert(false);
+    }
+}
+
+/**
+ * Look for and parse '*' postfix.
+ * Params:
+ *      test       function compiling regex up to this point
+ *      token[]    the part of original pattern that the '*' is a postfix of
+ *      pattern[]  rest of pattern to compile
+ * Output:
+ *      fn         generated function
+ *      consumed   number of characters in pattern[] parsed
+ */
+
+template regexCompilePredicate(alias test,string token,string pattern){
+    static if(pattern.length > 0){
+        static if(pattern[0] == '*'){
+            alias testZeroOrMore!(test,token) fn;
+            const uint consumed = 1;
+        }
+        else{
+            alias test fn;
+            const uint consumed = 0;
+        }
+    }
+    else{
+        alias test fn;
+        const uint consumed = 0;
+    }
+}
+
+/**
+ * Parse escape sequence.
+ * Params:
+ *      pattern[]  rest of pattern to compile
+ * Output:
+ *      fn         generated function
+ *      consumed   number of characters in pattern[] parsed
+ */
+
+template regexCompileEscape(string pattern){
+    static if(pattern.length > 0){
+        static if(pattern[0] == 's'){
+            // whitespace char
+            alias testRange!("\x00","\x20") fn;
+        }
+        else static if(pattern[0] == 'w'){
+            //word char
+            alias testWordChar!() fn;
+        }
+        else{
+            alias testChar!(pattern[0 .. 1]) fn;
+        }
+        const uint consumed = 1;
+    }
+    else{
+        pragma(msg,"Error: expected char following '\\'");
+        static assert(false);
+    }
+}
+
+/**
+ * Parse and compile regex represented by pattern[].
+ * Params:
+ *      pattern[]  rest of pattern to compile
+ * Output:
+ *      fn         generated function
+ */
+
+template regexCompile(string pattern)
+{
+    static if(pattern.length > 0){
+        static if(pattern[0] == '['){
+            const string charClassToken = parseUntil!(pattern[1 .. $],']').token;
+            alias regexCompileCharClass!(charClassToken) charClass;
+            const string token = pattern[0 .. charClass.consumed+2];
+            const string next = pattern[charClass.consumed+2 .. $];
+            alias charClass.fn test;
+        }
+        else static if(pattern[0] == '\\'){
+            alias regexCompileEscape!(pattern[1..$]) escapeSequence;
+            const string token = pattern[0 .. escapeSequence.consumed+1];
+            const string next = pattern[escapeSequence.consumed+1 .. $];
+            alias escapeSequence.fn test;
+        }
+        else{
+            const string token = parseTextToken!(pattern);
+            static assert(token.length > 0);
+            const string next = pattern[token.length .. $];
+            alias testText!(token) test;
+        }
+
+        alias regexCompilePredicate!(test,token,next) term;
+        const string remaining = next[term.consumed .. next.length];
+
+        static if(remaining.length > 0){
+            alias testUnion!(term.fn,regexCompile!(remaining).fn,remaining) fn;
+        }
+        else{
+            alias term.fn fn;
+        }
+    }
+    else{
+        alias testEmpty!() fn;
+    }
+}
+
+/// Utility function for parsing
+template isSpecial(string pattern)
+{
+    static if(
+        pattern[0] == '*' ||
+        pattern[0] == '+' ||
+        pattern[0] == '?' ||
+        pattern[0] == '.' ||
+        pattern[0] == '[' ||
+        pattern[0] == '{' ||
+        pattern[0] == '(' ||
+        pattern[0] == '$' ||
+        pattern[0] == '^' ||
+        pattern[0] == '\\'
+    ){
+        const bool isSpecial = true;
+    }
+    else{
+        const bool isSpecial = false;
+    }
+}
+
+
+
+
+int main()
+{
+    auto exp = &regexMatch!(r"[a-z]*\s*\w*");
+    string[] m = exp("hello    world");
+    writefln("matches: %s", m);
+    assert(m.length == 1);
+    assert(m[0] == "hello    world");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/template8.d b/gcc/testsuite/gdc.test/runnable/template8.d
new file mode 100644
index 00000000000..ce0edf1cf24
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/template8.d
@@ -0,0 +1,128 @@
+// NOTE: comes from std.bitmanip
+
+// PERMUTE_ARGS:
+
+private string myToString(ulong n)
+{
+    return n < 10
+        ? "" ~ cast(char) (n + '0')
+        : myToString(n / 10) ~ myToString(n % 10);
+}
+
+private string toStringSfx(ulong n)
+{
+    return myToString(n) ~ (n > uint.max ? "UL" : "U");
+}
+
+private string CreateAccessors(
+    string store, T, string name, size_t len, size_t offset)()
+{
+    static if (!name.length)
+    {
+        // No need to create any accessor
+        return "";
+    }
+    else
+    {
+        static const
+            maskAllElse = ((1uL << len) - 1u) << offset,
+            maskMyself = ~maskAllElse,
+            signBitCheck = 1uL << (len - 1),
+            extendSign = ~((1uL << len) - 1);
+
+        string result;
+        static if (is(T == bool))
+        {
+            static assert(len == 1);
+            // getter
+            result ~= "bool " ~ name ~ "(){ return "
+                "("~store~" & "~toStringSfx(maskAllElse)~") != 0;}";
+            // setter
+            result ~= "void " ~ name ~ "(bool v){"
+                "if (v) "~store~" |= "~toStringSfx(maskAllElse)~";"
+                "else "~store~" &= "~toStringSfx(maskMyself)~";}";
+        }
+        else
+        {
+            // getter
+            result ~= T.stringof ~ " " ~ name ~ "(){ auto result = "
+                "("~store~" & "
+                ~ toStringSfx(maskAllElse) ~ ") >>"
+                ~ toStringSfx(offset) ~ ";";
+            static if (T.min < 0)
+            {
+                result ~= "if (result >= " ~ toStringSfx(signBitCheck)
+                    ~ ") result |= " ~ toStringSfx(extendSign) ~ ";";
+            }
+            result ~= " return cast(" ~ T.stringof ~ ") result;}";
+            // setter
+            result ~= "void " ~ name ~ "(" ~ T.stringof
+                ~ " v){ "~store~" = ("~store~" & "
+                ~ toStringSfx(maskMyself) ~ ") | "
+                ~ "((cast(typeof("~store~")) v << " ~ toStringSfx(offset)
+                ~ ") & " ~ toStringSfx(maskAllElse)
+                ~ ");}";
+        }
+        return result;
+    }
+}
+
+private string createStoreName(Ts...)()
+{
+    static if (Ts.length == 0)
+        return "";
+    else
+        return Ts[1] ~ createStoreName!(Ts[3 .. $])();
+}
+
+private string CreateFields(string store, size_t offset, Ts...)()
+{
+    static if (!Ts.length)
+    {
+        static if (offset == ubyte.sizeof * 8)
+            return "private ubyte " ~ store ~ ";";
+        else static if (offset == ushort.sizeof * 8)
+            return "private ushort " ~ store ~ ";";
+        else static if (offset == uint.sizeof * 8)
+            return "private uint " ~ store ~ ";";
+        else static if (offset == ulong.sizeof * 8)
+            return "private ulong " ~ store ~ ";";
+        else
+            static assert(false, ToString!(offset));
+    }
+    else
+    {
+        return CreateAccessors!(store, Ts[0], Ts[1], Ts[2], offset)()
+            ~ CreateFields!(store, offset + Ts[2], Ts[3 .. $])();
+    }
+}
+
+template BitFields(T...)
+{
+    //pragma(msg, CreateFields!(createStoreName!(T)(), 0, T)());
+    mixin(CreateFields!(createStoreName!(T)(), 0, T)());
+}
+
+struct FloatRep
+{
+    mixin BitFields!(
+        uint, "fraction", 23,
+        uint, "exponent", 8,
+        bool, "sign", 1);
+}
+
+struct DoubleRep
+{
+    mixin BitFields!(
+        ulong, "fraction", 52,
+        uint, "exponent", 11,
+        bool, "sign", 1);
+}
+
+struct Bug2355(string x) {}
+static assert(is(Bug2355!"a" U : Bug2355!V, string V));
+
+int main()
+{
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/template9.d b/gcc/testsuite/gdc.test/runnable/template9.d
new file mode 100644
index 00000000000..a6bc24047ba
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/template9.d
@@ -0,0 +1,4931 @@
+// PERMUTE_ARGS:
+
+module breaker;
+
+import core.stdc.stdio, core.vararg;
+
+/**********************************/
+
+U foo(T, U)(U i)
+{
+    return i + 1;
+}
+
+int foo(T)(int i)
+{
+    return i + 2;
+}
+
+void test1()
+{
+    auto i = foo!(int)(2L);
+//    assert(i == 4);    // now returns 3
+}
+
+/**********************************/
+
+U foo2(T, U)(U i)
+{
+    return i + 1;
+}
+
+void test2()
+{
+    auto i = foo2!(int)(2L);
+    assert(i == 3);
+}
+
+/**********************************/
+
+class Foo3
+{
+    T bar(T,U)(U u)
+    {
+        return cast(T)u;
+    }
+}
+
+void test3()
+{
+  Foo3 foo = new Foo3;
+  int i = foo.bar!(int)(1.0);
+  assert(i == 1);
+}
+
+
+/**********************************/
+
+T* begin4(T)(T[] a) { return a.ptr; }
+
+void copy4(string pred = "", Ranges...)(Ranges rs)
+{
+    alias rs[$ - 1] target;
+    pragma(msg, typeof(target).stringof);
+    auto tb = begin4(target);//, te = end(target);
+}
+
+void test4()
+{
+    int[] a, b, c;
+    copy4(a, b, c);
+    // comment the following line to prevent compiler from crashing
+    copy4!("a > 1")(a, b, c);
+}
+
+/**********************************/
+
+import std.stdio:writefln;
+
+template foo5(T,S)
+{
+    void foo5(T t, S s) {
+        writefln("typeof(T)=",typeid(T)," typeof(S)=",typeid(S));
+    }
+}
+
+template bar5(T,S)
+{
+    void bar5(S s) {
+        writefln("typeof(T)=",typeid(T),"typeof(S)=",typeid(S));
+    }
+}
+
+
+void test5()
+{
+    foo5(1.0,33);
+    bar5!(double,int)(33);
+    bar5!(float)(33);
+}
+
+/**********************************/
+
+int foo6(T...)(auto ref T x)
+{   int result;
+
+    foreach (i, v; x)
+    {
+        if (v == 10)
+            assert(__traits(isRef, x[i]));
+        else
+            assert(!__traits(isRef, x[i]));
+        result += v;
+    }
+    return result;
+}
+
+void test6()
+{   int y = 10;
+    int r;
+    r = foo6(8);
+    assert(r == 8);
+    r = foo6(y);
+    assert(r == 10);
+    r = foo6(3, 4, y);
+    assert(r == 17);
+    r = foo6(4, 5, y);
+    assert(r == 19);
+    r = foo6(y, 6, y);
+    assert(r == 26);
+}
+
+/**********************************/
+
+auto ref min(T, U)(auto ref T lhs, auto ref U rhs)
+{
+    return lhs > rhs ? rhs : lhs;
+}
+
+void test7()
+{   int x = 7, y = 8;
+    int i;
+
+    i = min(4, 3);
+    assert(i == 3);
+    i = min(x, y);
+    assert(i == 7);
+    min(x, y) = 10;
+    assert(x == 10);
+    static assert(!__traits(compiles, min(3, y) = 10));
+    static assert(!__traits(compiles, min(y, 3) = 10));
+}
+
+/**********************************/
+// 5946
+
+template TTest8()
+{
+    int call(){ return this.g(); }
+}
+class CTest8
+{
+    int f() { mixin TTest8!(); return call(); }
+    int g() { return 10; }
+}
+void test8()
+{
+    assert((new CTest8()).f() == 10);
+}
+
+/**********************************/
+// 693
+
+template TTest9(alias sym)
+{
+    int call(){ return sym.g(); }
+}
+class CTest9
+{
+    int f1() { mixin TTest9!(this); return call(); }
+    int f2() { mixin TTest9!this; return call(); }
+    int g() { return 10; }
+}
+void test9()
+{
+    assert((new CTest9()).f1() == 10);
+    assert((new CTest9()).f2() == 10);
+}
+
+/**********************************/
+// 1780
+
+template Tuple1780(Ts ...) { alias Ts Tuple1780; }
+
+template Decode1780( T )                            { alias Tuple1780!() Types; }
+template Decode1780( T : TT!(Us), alias TT, Us... ) { alias Us Types; }
+
+void test1780()
+{
+    struct S1780(T1, T2) {}
+
+    // should extract tuple (bool,short) but matches the first specialisation
+    alias Decode1780!( S1780!(bool,short) ).Types SQ1780;  // --> SQ2 is empty tuple!
+    static assert(is(SQ1780 == Tuple1780!(bool, short)));
+}
+
+/**********************************/
+// 1659
+
+class Foo1659 { }
+class Bar1659 : Foo1659 { }
+
+void f1659(T : Foo1659)() { }
+void f1659(alias T)() { static assert(false); }
+
+void test1659()
+{
+    f1659!Bar1659();
+}
+
+/**********************************/
+// 2025
+
+struct S2025 {}
+void f2025() {}
+
+template Foo2025(int i) { enum Foo2025 = 1; }
+template Foo2025(TL...) { enum Foo2025 = 2; }
+static assert(Foo2025!1 == 1);
+static assert(Foo2025!int == 2);
+static assert(Foo2025!S2025 == 2);
+static assert(Foo2025!f2025 == 2);
+
+template Bar2025(T)    { enum Bar2025 = 1; }
+template Bar2025(A...) { enum Bar2025 = 2; }
+static assert(Bar2025!1 == 2);
+static assert(Bar2025!int == 1);    // 2 -> 1
+static assert(Bar2025!S2025 == 1);  // 2 -> 1
+static assert(Bar2025!f2025 == 2);
+
+template Baz2025(T)       { enum Baz2025 = 1; }
+template Baz2025(alias A) { enum Baz2025 = 2; }
+static assert(Baz2025!1 == 2);
+static assert(Baz2025!int == 1);
+static assert(Baz2025!S2025 == 1);  // 2 -> 1
+static assert(Baz2025!f2025 == 2);
+
+/**********************************/
+// 3608
+
+template foo3608(T, U){}
+
+template BaseTemplate3608(alias TTT : U!V, alias U, V...)
+{
+    alias U BaseTemplate3608;
+}
+template TemplateParams3608(alias T : U!V, alias U, V...)
+{
+    alias V TemplateParams3608;
+}
+
+template TyueTuple3608(T...) { alias T TyueTuple3608; }
+
+void test3608()
+{
+    alias foo3608!(int, long) Foo3608;
+
+    static assert(__traits(isSame, BaseTemplate3608!Foo3608, foo3608));
+    static assert(is(TemplateParams3608!Foo3608 == TyueTuple3608!(int, long)));
+}
+
+/**********************************/
+// 5015
+
+import breaker;
+
+static if (is(ElemType!(int))){}
+
+template ElemType(T) {
+  alias _ElemType!(T).type ElemType;
+}
+
+template _ElemType(T) {
+    alias r type;
+}
+
+/**********************************/
+// 5185
+
+class C5185(V)
+{
+    void f()
+    {
+        C5185!(C5185!(int)) c;
+    }
+}
+
+void test5185()
+{
+    C5185!(C5185!(int)) c;
+}
+
+/**********************************/
+// 5893
+
+class C5893
+{
+    int concatAssign(C5893 other) { return 1; }
+    int concatAssign(int other) { return 2; } // to demonstrate overloading
+
+    template opOpAssign(string op) if (op == "~")
+    { alias concatAssign opOpAssign; }
+
+    int opOpAssign(string op)(int other) if (op == "+") { return 3; }
+}
+
+void test5893()
+{
+    auto c = new C5893;
+    assert(c.opOpAssign!"~"(c) == 1); // works
+    assert(c.opOpAssign!"~"(1) == 2); // works
+    assert((c ~= 1) == 2);
+    assert((c += 1) == 3);  // overload
+}
+
+/**********************************/
+// 5988
+
+template Templ5988(alias T)
+{
+    alias T!int Templ5988;
+}
+
+class C5988a(T) { Templ5988!C5988a foo; }
+//Templ5988!C5988a foo5988a;    // Commented version
+void test5988a() { C5988a!int a; }  // Was error, now works
+
+class C5988b(T) { Templ5988!C5988b foo; }
+Templ5988!C5988b foo5988b;      // Uncomment version
+void test5988b() { C5988b!int a; }  // Works
+
+/**********************************/
+// 6404
+
+// receive only rvalue
+void rvalue(T)(auto ref T x) if (!__traits(isRef, x)) {}
+void rvalueVargs(T...)(auto ref T x) if (!__traits(isRef, x[0])) {}
+
+// receive only lvalue
+void lvalue(T)(auto ref T x) if ( __traits(isRef, x)) {}
+void lvalueVargs(T...)(auto ref T x) if ( __traits(isRef, x[0])) {}
+
+void test6404()
+{
+    int n;
+
+    static assert(!__traits(compiles, rvalue(n)));
+    static assert( __traits(compiles, rvalue(0)));
+
+    static assert( __traits(compiles, lvalue(n)));
+    static assert(!__traits(compiles, lvalue(0)));
+
+    static assert(!__traits(compiles, rvalueVargs(n)));
+    static assert( __traits(compiles, rvalueVargs(0)));
+
+    static assert( __traits(compiles, lvalueVargs(n)));
+    static assert(!__traits(compiles, lvalueVargs(0)));
+}
+
+/**********************************/
+// 2246
+
+class A2246(T,d){
+    T p;
+}
+
+class B2246(int rk){
+    int[rk] p;
+}
+
+class C2246(T,int rk){
+    T[rk] p;
+}
+
+template f2246(T:A2246!(U,d),U,d){
+    void f2246(){ }
+}
+
+template f2246(T:B2246!(rank),int rank){
+    void f2246(){ }
+}
+
+template f2246(T:C2246!(U,rank),U,int rank){
+    void f2246(){ }
+}
+
+void test2246(){
+    A2246!(int,long) a;
+    B2246!(2) b;
+    C2246!(int,2) c;
+    f2246!(A2246!(int,long))();
+    f2246!(B2246!(2))();
+    f2246!(C2246!(int,2))();
+}
+
+/**********************************/
+// 2296
+
+void foo2296(size_t D)(int[D] i...){}
+void test2296()
+{
+    foo2296(1, 2, 3);
+}
+
+/**********************************/
+// 1684
+
+template Test1684( uint memberOffset ){}
+
+class MyClass1684 {
+    int flags2;
+    mixin Test1684!(cast(uint)flags2.offsetof) t1; // compiles ok
+    mixin Test1684!(cast(int)flags2.offsetof)  t2; // compiles ok
+    mixin Test1684!(flags2.offsetof)           t3; // Error: no property 'offsetof' for type 'int'
+}
+
+/**********************************/
+
+void bug4984a(int n)() if (n > 0 && is(typeof(bug4984a!(n-1) ()))) {
+}
+
+void bug4984a(int n : 0)() {
+}
+
+void bug4984b(U...)(U args) if ( is(typeof( bug4984b(args[1..$]) )) ) {
+}
+
+void bug4984b(U)(U u) {
+}
+
+void bug4984() {
+  // Note: compiling this overflows the stack if dmd is build with DEBUG
+  //bug4984a!400();
+    bug4984a!200();
+    bug4984b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19);
+}
+
+/***************************************/
+// 2579
+
+void foo2579(T)(T delegate(in Object) dlg)
+{
+}
+
+void test2579()
+{
+    foo2579( (in Object o) { return 15; } );
+}
+
+/**********************************/
+// 2803
+
+auto foo2803(T)(T t = 0) { return t; }
+
+struct S2803 {}
+S2803 s2803;
+ref S2803 getS2803() { return s2803; }
+auto fun2803(T, U)(T t, ref U u = getS2803)
+{
+    static assert(is(U == S2803));
+    return &u;
+}
+
+// from the past version of std.conv
+template to2803(T) { T to2803(S)(S src) { return T.init; } }
+auto toImpl2803a(T, S)(S s, in T left, in T sep = ", ", in T right = "]") {}
+auto toImpl2803b(T, S)(S s, in T left = to2803!T(S.stringof~"("), in T right = ")") {}
+auto toImpl2803c(T, S)(S s, in T left =          S.stringof~"(" , in T right = ")") {}  // combination with enh 13944
+
+// from std.range.package in 2.067a.
+auto enumerate2803(En = size_t, R)(R r, En start = 0)
+{
+    // The type of 'start' should be size_t, it's the defaultArg of En,
+    // rather than the deduced type from its defualtArg '0'.
+    static assert(is(typeof(start) == size_t));
+    return start;
+}
+
+// from std.numeric.
+alias ElementType2803(R) = typeof(R.init[0].init);
+void normalize2803(R)(R range, ElementType2803!R sum = 1)
+{
+    // The type of 'sum' should be determined to ElementType!(double[]) == double
+    // before the type deduction from its defaultArg '1'.
+    static assert(is(typeof(sum) == double));
+}
+
+auto foo14468(T)(T[]...) { return 1; }
+auto foo14468(bool flag, T)(T[]...) { return 2; }
+
+void test2803()
+{
+    assert(foo2803() == 0);
+    assert(foo2803(1) == 1);
+
+    S2803 s;
+    assert(fun2803(1)    is &s2803);
+    assert(fun2803(1, s) is &s);
+
+    // regression cases
+
+    toImpl2803a!string(1, "[");
+
+    toImpl2803b! string(1);
+    toImpl2803b!wstring(1);
+    toImpl2803b!dstring(1);
+
+    toImpl2803c! string(1);
+    toImpl2803c!wstring(1); // requires enhancement 13944
+    toImpl2803c!dstring(1); // requires enhancement 13944
+
+    enumerate2803([1]);
+
+    double[] a = [];
+    normalize2803(a);
+
+    assert(foo14468!int() == 1);
+}
+
+/**********************************/
+// 6613
+
+alias Tuple6613(T...) = T;
+
+void f6613(T...)(int x = 0, T xs = Tuple6613!())
+{
+    assert(x == 0);
+    static assert(T.length == 0);
+}
+
+void test6613()
+{
+    f6613();
+}
+
+/**********************************/
+// 4953
+
+void bug4953(T = void)(short x) {}
+static assert(is(typeof(bug4953(3))));
+
+/**********************************/
+// 5886 & 5393
+
+mixin template Foo5886(T)
+{
+    void foo(U : T, this X)() const { static assert(is(X == const K5886)); }
+}
+
+struct K5886
+{
+    void get1(this T)() const
+    {
+        pragma(msg, T);
+    }
+    void get2(int N=4, this T)() const
+    {
+        pragma(msg, N, " ; ", T);
+    }
+
+    mixin Foo5886!double;
+    mixin Foo5886!string;
+
+    void test() const
+    {
+        get1;       // OK
+        get2;       // OK
+        get2!8;     // NG
+
+        foo!(int);
+        foo!(typeof(null));
+    }
+}
+
+void test5886()
+{
+    K5886 km;
+    const(K5886) kc;
+    immutable(K5886) ki;
+
+    km.get1;        // OK
+    kc.get1;        // OK
+    ki.get1;        // OK
+    km.get2;        // OK
+    kc.get2;        // OK
+    ki.get2;        // OK
+    km.get2!(1, K5886);             // Ugly
+    kc.get2!(2, const(K5886));      // Ugly
+    ki.get2!(3, immutable(K5886));  // Ugly
+    km.get2!8;      // Error
+    kc.get2!9;      // Error
+    ki.get2!10;     // Error
+}
+
+// --------
+
+void test5393()
+{
+    class A
+    {
+        void opDispatch (string name, this T) () { }
+    }
+
+    class B : A {}
+
+    auto b = new B;
+    b.foobar();
+}
+
+/**********************************/
+// 5896
+
+struct X5896
+{
+                 T opCast(T)(){ return 1; }
+           const T opCast(T)(){ return 2; }
+       immutable T opCast(T)(){ return 3; }
+          shared T opCast(T)(){ return 4; }
+    const shared T opCast(T)(){ return 5; }
+}
+void test5896()
+{
+    auto xm =              X5896  ();
+    auto xc =        const(X5896) ();
+    auto xi =    immutable(X5896) ();
+    auto xs =       shared(X5896) ();
+    auto xcs= const(shared(X5896))();
+    assert(cast(int)xm == 1);
+    assert(cast(int)xc == 2);
+    assert(cast(int)xi == 3);
+    assert(cast(int)xs == 4);
+    assert(cast(int)xcs== 5);
+}
+
+/**********************************/
+// 6312
+
+void h6312() {}
+
+class Bla6312
+{
+    mixin wrap6312!h6312;
+}
+
+mixin template wrap6312(alias f)
+{
+    void blub(alias g = f)()
+    {
+        g();
+    }
+}
+
+void test6312()
+{
+    Bla6312 b = new Bla6312();
+    b.blub();
+}
+
+/**********************************/
+// 6825
+
+void test6825()
+{
+    struct File
+    {
+        void write(S...)(S args) {}
+    }
+
+    void dump(void delegate(string) d) {}
+
+    auto o = File();
+    dump(&o.write!string);
+}
+
+/**********************************/
+// 6789
+
+template isStaticArray6789(T)
+{
+    static if (is(T U : U[N], size_t N))    // doesn't match
+    {
+        pragma(msg, "> U = ", U, ", N:", typeof(N), " = ", N);
+        enum isStaticArray6789 = true;
+    }
+    else
+        enum isStaticArray6789 = false;
+}
+
+void test6789()
+{
+    alias int[3] T;
+    static assert(isStaticArray6789!T);
+}
+
+/**********************************/
+// 2778
+
+struct ArrayWrapper2778(T)
+{
+    T[] data;
+    alias data this;
+}
+
+void doStuffFunc2778(int[] data) {}
+
+void doStuffTempl2778(T)(T[] data) {}
+
+int doStuffTemplOver2778(T)(void* data) { return 1; }
+int doStuffTemplOver2778(T)(ArrayWrapper2778!T w) { return 2; }
+
+void test2778()
+{
+    ArrayWrapper2778!(int) foo;
+
+    doStuffFunc2778(foo);  // Works.
+
+    doStuffTempl2778!(int)(foo);  // Works.
+
+    doStuffTempl2778(foo);  // Error
+
+    assert(doStuffTemplOver2778(foo) == 2);
+}
+
+// ----
+
+void test2778aa()
+{
+    void foo(K, V)(V[K] aa){ pragma(msg, "K=", K, ", V=", V); }
+
+    int[string] aa1;
+    foo(aa1);   // OK
+
+    struct SubTypeOf(T)
+    {
+        T val;
+        alias val this;
+    }
+    SubTypeOf!(string[char]) aa2;
+    foo(aa2);   // NG
+}
+
+// ----
+
+void test2778get()
+{
+    void foo(ubyte[]){}
+
+    static struct S
+    {
+        ubyte[] val = [1,2,3];
+        @property ref ubyte[] get(){ return val; }
+        alias get this;
+    }
+    S s;
+    foo(s);
+}
+
+/**********************************/
+// 6208
+
+int getRefNonref(T)(ref T s){ return 1; }
+int getRefNonref(T)(    T s){ return 2; }
+
+int getAutoRef(T)(auto ref T s){ return __traits(isRef, s) ? 1 : 2; }
+
+void getOut(T)(out T s){ ; }
+
+void getLazy1(T=int)(lazy void s){ s(), s(); }
+void getLazy2(T)(lazy T s){  s(), s(); }
+
+void test6208a()
+{
+    int lvalue;
+    int rvalue(){ int t; return t; }
+
+    assert(getRefNonref(lvalue  ) == 1);
+    assert(getRefNonref(rvalue()) == 2);
+
+    assert(getAutoRef(lvalue  ) == 1);
+    assert(getAutoRef(rvalue()) == 2);
+
+    static assert( __traits(compiles, getOut(lvalue  )));
+    static assert(!__traits(compiles, getOut(rvalue())));
+
+    int n1; getLazy1(++n1); assert(n1 == 2);
+    int n2; getLazy2(++n2); assert(n2 == 2);
+
+    struct X
+    {
+        int f(T)(auto ref T t){ return 1; }
+        int f(T)(auto ref T t, ...){ return -1; }
+    }
+    auto xm =       X ();
+    auto xc = const(X)();
+    int n;
+    assert(xm.f!int(n) == 1);   // resolved 'auto ref'
+    assert(xm.f!int(0) == 1);   // ditto
+}
+
+void test6208b()
+{
+    void foo(T)(const T value) if (!is(T == int)) {}
+
+    int mn;
+    const int cn;
+    static assert(!__traits(compiles, foo(mn)));    // OK -> OK
+    static assert(!__traits(compiles, foo(cn)));    // NG -> OK
+}
+
+void test6208c()
+{
+    struct S
+    {
+        // Original test case.
+        int foo(V)(in V v)                         { return 1; }
+        int foo(Args...)(auto ref const Args args) { return 2; }
+
+        // Reduced test cases
+
+        int hoo(V)(const V v)             { return 1; }  // typeof(10) : const V       -> MATCHconst
+        int hoo(Args...)(const Args args) { return 2; }  // typeof(10) : const Args[0] -> MATCHconst
+        // If deduction matching level is same, tuple parameter is less specialized than others.
+
+        int bar(V)(V v)                   { return 1; }  // typeof(10) : V             -> MATCHexact
+        int bar(Args...)(const Args args) { return 2; }  // typeof(10) : const Args[0] -> MATCHconst
+
+        int baz(V)(const V v)             { return 1; }  // typeof(10) : const V -> MATCHconst
+        int baz(Args...)(Args args)       { return 2; }  // typeof(10) : Args[0] -> MATCHexact
+
+        inout(int) war(V)(inout V v)            { return 1; }
+        inout(int) war(Args...)(inout Args args){ return 2; }
+
+        inout(int) waz(Args...)(inout Args args){ return 0; }   // wild deduction test
+    }
+
+    S s;
+
+    int nm = 10;
+    assert(s.foo(nm) == 1);
+    assert(s.hoo(nm) == 1);
+    assert(s.bar(nm) == 1);
+    assert(s.baz(nm) == 2);
+    assert(s.war(nm) == 1);
+    static assert(is(typeof(s.waz(nm)) == int));
+
+    const int nc = 10;
+    assert(s.foo(nc) == 1);
+    assert(s.hoo(nc) == 1);
+    assert(s.bar(nc) == 1);
+    assert(s.baz(nc) == 1);
+    assert(s.war(nc) == 1);
+    static assert(is(typeof(s.waz(nc)) == const(int)));
+
+    immutable int ni = 10;
+    assert(s.foo(ni) == 1);
+    assert(s.hoo(ni) == 1);
+    assert(s.bar(ni) == 1);
+    assert(s.baz(ni) == 2);
+    assert(s.war(ni) == 1);
+    static assert(is(typeof(s.waz(ni)) == immutable(int)));
+
+    static assert(is(typeof(s.waz(nm, nm)) == int));
+    static assert(is(typeof(s.waz(nm, nc)) == const(int)));
+    static assert(is(typeof(s.waz(nm, ni)) == const(int)));
+    static assert(is(typeof(s.waz(nc, nm)) == const(int)));
+    static assert(is(typeof(s.waz(nc, nc)) == const(int)));
+    static assert(is(typeof(s.waz(nc, ni)) == const(int)));
+    static assert(is(typeof(s.waz(ni, nm)) == const(int)));
+    static assert(is(typeof(s.waz(ni, nc)) == const(int)));
+    static assert(is(typeof(s.waz(ni, ni)) == immutable(int)));
+}
+
+/**********************************/
+// 6805
+
+struct T6805
+{
+    template opDispatch(string name)
+    {
+        alias int Type;
+    }
+}
+static assert(is(T6805.xxx.Type == int));
+
+/**********************************/
+// 6738
+
+struct Foo6738
+{
+    int _val = 10;
+
+    @property int val()() { return _val; }
+    int get() { return val; }  // fail
+}
+
+void test6738()
+{
+    Foo6738 foo;
+    auto x = foo.val;  // ok
+    assert(x == 10);
+    assert(foo.get() == 10);
+}
+
+/**********************************/
+// 7498
+
+template IndexMixin(){
+    void insert(T)(T value){  }
+}
+
+class MultiIndexContainer{
+    mixin IndexMixin!() index0;
+    class Index0{
+        void baburk(){
+            this.outer.index0.insert(1);
+        }
+    }
+}
+
+/**********************************/
+// 6780
+
+@property int foo6780()(){ return 10; }
+
+int g6780;
+@property void bar6780()(int n){ g6780 = n; }
+
+void test6780()
+{
+    auto n = foo6780;
+    assert(n == 10);
+
+    bar6780 = 10;
+    assert(g6780 == 10);
+}
+
+/**********************************/
+// 6810
+
+int f6810(int n)(int) { return 1;}
+int f6810(U...)(U)    { assert(0); }
+int f6810(U...)(U a)  { assert(0); }
+int f6810(U...)(U)   if (true) { assert(0); }
+int f6810(U...)(U a) if (true) { assert(0); }
+
+void test6810()
+{
+    assert(f6810!0(0) == 1);
+}
+
+/**********************************/
+// 6891
+
+struct S6891(int N, T)
+{
+    void f(U)(S6891!(N, U) u) { }
+}
+
+void test6891()
+{
+    alias S6891!(1, void) A;
+    A().f(A());
+}
+
+/**********************************/
+// 6994
+
+struct Foo6994
+{
+    T get(T)(){ return T.init; }
+
+    T func1(T)()
+    if (__traits(compiles, get!T()))
+    { return get!T; }
+
+    T func2(T)()
+    if (__traits(compiles, this.get!T()))   // add explicit 'this'
+    { return get!T; }
+}
+void test6994()
+{
+    Foo6994 foo;
+    foo.get!int();      // OK
+    foo.func1!int();    // OK
+    foo.func2!int();    // NG
+}
+
+/**********************************/
+// 6764
+
+enum N6764 = 1; //use const for D1
+
+alias size_t[N6764] T6764; //workaround
+void f6764()(T6764 arr...) { }
+
+void g6764()(size_t[1] arr...) { }
+
+void h6764()(size_t[N6764] arr...) { }
+
+void test6764()
+{
+    f6764(0);    //good
+    g6764(0);    //good
+    h6764!()(0); //good
+    h6764(0);    //Error: template main.f() does not match any function template declaration
+}
+
+/**********************************/
+// 3467 & 6806
+
+struct Foo3467( uint n )
+{
+    Foo3467!( n ) bar( ) {
+        typeof( return ) result;
+        return result;
+    }
+}
+struct Vec3467(size_t N)
+{
+    void opBinary(string op:"~", size_t M)(Vec3467!M) {}
+}
+void test3467()
+{
+    Foo3467!( 4 ) baz;
+    baz = baz.bar;// FAIL
+
+    Vec3467!2 a1;
+    Vec3467!3 a2;
+    a1 ~ a2; // line 7, Error
+}
+
+struct TS6806(size_t n) { pragma(msg, typeof(n)); }
+static assert(is(TS6806!(1u) == TS6806!(1)));
+
+/**********************************/
+// 4413
+
+struct Foo4413
+{
+    alias typeof(this) typeof_this;
+    void bar1(typeof_this other) {}
+    void bar2()(typeof_this other) {}
+    void bar3(typeof(this) other) {}
+    void bar4()(typeof(this) other) {}
+}
+
+void test4413()
+{
+    Foo4413 f;
+    f.bar1(f); // OK
+    f.bar2(f); // OK
+    f.bar3(f); // OK
+    f.bar4(f); // ERR
+}
+
+/**********************************/
+// 4675
+
+template isNumeric(T)
+{
+    enum bool test1 = is(T : long);     // should be hidden
+    enum bool test2 = is(T : real);     // should be hidden
+    enum bool isNumeric = test1 || test2;
+}
+void test4675()
+{
+    static assert( isNumeric!int);
+    static assert(!isNumeric!string);
+    static assert(!__traits(compiles, isNumeric!int.test1));   // should be an error
+    static assert(!__traits(compiles, isNumeric!int.test2));   // should be an error
+    static assert(!__traits(compiles, isNumeric!int.isNumeric));
+}
+
+/**********************************/
+// 5525
+
+template foo5525(T)
+{
+    T foo5525(T t)      { return t; }
+    T foo5525(T t, T u) { return t + u; }
+}
+
+void test5525()
+{
+    alias foo5525!int f;
+    assert(f(1) == 1);
+    assert(f(1, 2) == 3);
+}
+
+/**********************************/
+// 5801
+
+int a5801;
+void bar5801(T = double)(typeof(a5801) i) {}
+void baz5801(T)(typeof(a5801) i, T t) {}
+void test5801()
+{
+    bar5801(2);  // Does not compile.
+    baz5801(3, "baz"); // Does not compile.
+}
+
+/**********************************/
+// 5832
+
+struct Bar5832(alias v) {}
+
+template isBar5832a(T)
+{
+    static if (is(T _ : Bar5832!(v), alias v))
+        enum isBar5832a = true;
+    else
+        enum isBar5832a = false;
+}
+template isBar5832b(T)
+{
+    static if (is(T _ : Bar5832!(v), alias int v))
+        enum isBar5832b = true;
+    else
+        enum isBar5832b = false;
+}
+template isBar5832c(T)
+{
+    static if (is(T _ : Bar5832!(v), alias string v))
+        enum isBar5832c = true;
+    else
+        enum isBar5832c = false;
+}
+static assert( isBar5832a!(Bar5832!1234));
+static assert( isBar5832b!(Bar5832!1234));
+static assert(!isBar5832c!(Bar5832!1234));
+
+/**********************************/
+// 2550
+
+template pow10_2550(long n)
+{
+    const long pow10_2550 = 0;
+    static if (n < 0)
+        const long pow10_2550 = 0;
+    else
+        const long pow10_2550 = 10 * pow10_2550!(n - 1);
+}
+template pow10_2550(long n:0)
+{
+    const long pow10_2550 = 1;
+}
+static assert(pow10_2550!(0) == 1);
+
+/**********************************/
+// [2.057] Remove top const in IFTI, 9198
+
+void foo10a(T   )(T)            { static assert(is(T    == const(int)[])); }
+void foo10b(T...)(T)            { static assert(is(T[0] == const(int)[])); }
+
+// ref paramter doesn't remove top const
+void boo10a(T   )(ref T)        { static assert(is(T    == const(int[]))); }
+void boo10b(T...)(ref T)        { static assert(is(T[0] == const(int[]))); }
+
+// auto ref with lvalue doesn't
+void goo10a(T   )(auto ref T)   { static assert(is(T    == const(int[]))); }
+void goo10b(T...)(auto ref T)   { static assert(is(T[0] == const(int[]))); }
+
+// auto ref with rvalue does
+void hoo10a(T   )(auto ref T)   { static assert(is(T    == const(int)[])); }
+void hoo10b(T...)(auto ref T)   { static assert(is(T[0] == const(int)[])); }
+
+void bar10a(T   )(T)            { static assert(is(T    == const(int)*)); }
+void bar10b(T...)(T)            { static assert(is(T[0] == const(int)*)); }
+
+void test10()
+{
+    const a = [1,2,3];
+    static assert(is(typeof(a) == const(int[])));
+    foo10a(a);
+    foo10b(a);
+    boo10a(a);
+    boo10b(a);
+    goo10a(a);
+    goo10b(a);
+    hoo10a(cast(const)[1,2,3]);
+    hoo10b(cast(const)[1,2,3]);
+
+    int n;
+    const p = &n;
+    static assert(is(typeof(p) == const(int*)));
+    bar10a(p);
+    bar10b(p);
+}
+
+/**********************************/
+// 3092
+
+template Foo3092(A...)
+{
+    alias A[0] Foo3092;
+}
+static assert(is(Foo3092!(int, "foo") == int));
+
+/**********************************/
+// 7037
+
+struct Foo7037 {}
+struct Bar7037 { Foo7037 f; alias f this; }
+void works7037( T )( T value ) if ( is( T : Foo7037 ) ) {}
+void doesnotwork7037( T : Foo7037 )( T value ) {}
+
+void test7037()
+{
+   Bar7037 b;
+   works7037( b );
+   doesnotwork7037( b );
+}
+
+/**********************************/
+// 7110
+
+struct S7110
+{
+    int opSlice(int, int) const { return 0; }
+    int opSlice()         const { return 0; }
+    int opIndex(int, int) const { return 0; }
+    int opIndex(int)      const { return 0; }
+}
+
+enum e7110 = S7110();
+
+template T7110(alias a) { } // or T7110(a...)
+
+alias T7110!( S7110 ) T71100; // passes
+alias T7110!((S7110)) T71101; // passes
+
+alias T7110!( S7110()[0..0]  )  A0; // passes
+alias T7110!(  (e7110[0..0]) )  A1; // passes
+alias T7110!(   e7110[0..0]  )  A2; // passes
+
+alias T7110!( S7110()[0, 0]  ) B0; // passes
+alias T7110!(  (e7110[0, 0]) ) B1; // passes
+alias T7110!(   e7110[0, 0]  ) B2; // passes
+
+alias T7110!( S7110()[]  ) C0; // passes
+alias T7110!(  (e7110[]) ) C1; // passes
+alias T7110!(   e7110[]  ) C2; // fails: e7110 is used as a type
+
+alias T7110!( S7110()[0]  ) D0; // passes
+alias T7110!(  (e7110[0]) ) D1; // passes
+alias T7110!(   e7110[0]  ) D2; // fails: e7110 must be an array or pointer type, not S7110
+
+/**********************************/
+// 7124
+
+template StaticArrayOf(T : E[dim], E, size_t dim)
+{
+    pragma(msg, "T = ", T, ", E = ", E, ", dim = ", dim);
+    alias E[dim] StaticArrayOf;
+}
+
+template DynamicArrayOf(T : E[], E)
+{
+    pragma(msg, "T = ", T, ", E = ", E);
+    alias E[] DynamicArrayOf;
+}
+
+template AssocArrayOf(T : V[K], K, V)
+{
+    pragma(msg, "T = ", T, ", K = ", K, ", V = ", V);
+    alias V[K] AssocArrayOf;
+}
+void test7124()
+{
+    struct SA { int[5] sa; alias sa this; }
+    static assert(is(StaticArrayOf!SA == int[5]));
+
+    struct DA { int[] da; alias da this; }
+    static assert(is(DynamicArrayOf!DA == int[]));
+
+    struct AA { int[string] aa; alias aa this; }
+    static assert(is(AssocArrayOf!AA == int[string]));
+}
+
+/**********************************/
+// 7359
+
+bool foo7359(T)(T[] a ...)
+{
+    return true;
+}
+
+void test7359()
+{
+    assert(foo7359(1,1,1,1,1,1));               // OK
+    assert(foo7359("abc","abc","abc","abc"));   // NG
+}
+
+/**********************************/
+// 7363
+
+template t7363()
+{
+   enum e = 0;
+   static if (true)
+       enum t7363 = 0;
+}
+static assert(!__traits(compiles, t7363!().t7363 == 0)); // Assertion fails
+static assert(t7363!() == 0); // Error: void has no value
+
+template u7363()
+{
+   static if (true)
+   {
+       enum e = 0;
+       enum u73631 = 0;
+   }
+   alias u73631 u7363;
+}
+static assert(!__traits(compiles, u7363!().u7363 == 0)); // Assertion fails
+static assert(u7363!() == 0); // Error: void has no value
+
+/**********************************/
+
+struct S4371(T ...) { }
+
+alias S4371!("hi!") t;
+
+static if (is(t U == S4371!(U))) { }
+
+/**********************************/
+// 7416
+
+void t7416(alias a)() if(is(typeof(a())))
+{}
+
+void test7416() {
+    void f() {}
+    alias t7416!f x;
+}
+
+/**********************************/
+// 7563
+
+class Test7563
+{
+    void test(T, bool a = true)(T t)
+    {
+
+    }
+}
+
+void test7563()
+{
+    auto test = new Test7563;
+    pragma(msg, typeof(test.test!(int, true)).stringof);
+    pragma(msg, typeof(test.test!(int)).stringof); // Error: expression (test.test!(int)) has no type
+}
+
+/**********************************/
+// 7572
+
+class F7572
+{
+    Tr fn7572(Tr, T...)(T t) { return 1; }
+}
+Tr Fn7572(Tr, T...)(T t) { return 2; }
+
+void test7572()
+{
+    F7572 f = new F7572();
+    int delegate() dg = &f.fn7572!int;
+    assert(dg() == 1);
+
+    int function() fn = &Fn7572!int;
+    assert(fn() == 2);
+}
+
+/**********************************/
+// 7580
+
+struct S7580(T)
+{
+    void opAssign()(T value) {}
+}
+struct X7580(T)
+{
+    private T val;
+    @property ref inout(T) get()() inout { return val; }    // template
+    alias get this;
+}
+struct Y7580(T)
+{
+    private T val;
+    @property ref auto get()() inout { return val; }        // template + auto return
+    alias get this;
+}
+
+void test7580()
+{
+    S7580!(int) s;
+    X7580!int x;
+    Y7580!int y;
+    s = x;
+    s = y;
+
+    shared(X7580!int) sx;
+    static assert(!__traits(compiles, s = sx));
+}
+
+/**********************************/
+// 7585
+
+extern(C) alias void function() Callback;
+
+template W7585a(alias dg)
+{
+    //pragma(msg, typeof(dg));
+    extern(C) void W7585a() { dg(); }
+}
+
+void test7585()
+{
+    static void f7585a(){}
+    Callback cb1 = &W7585a!(f7585a);      // OK
+    static assert(!__traits(compiles,
+    {
+        void f7585b(){}
+        Callback cb2 = &W7585a!(f7585b);  // NG
+    }));
+
+    Callback cb3 = &W7585a!((){});              // NG -> OK
+    Callback cb4 = &W7585a!(function(){});      // OK
+    static assert(!__traits(compiles,
+    {
+        Callback cb5 = &W7585a!(delegate(){});  // NG
+    }));
+
+    static int global;  // global data
+    Callback cb6 = &W7585a!((){return global;});    // NG -> OK
+    static assert(!__traits(compiles,
+    {
+        int n;
+        Callback cb7 = &W7585a!((){return n;});     // NG
+    }));
+}
+
+/**********************************/
+// 7643
+
+template T7643(A...){ alias A T7643; }
+
+alias T7643!(long, "x", string, "y") Specs7643;
+
+alias T7643!( Specs7643[] ) U7643;  // Error: tuple A is used as a type
+
+/**********************************/
+// 7671
+
+       inout(int)[3]  id7671n1             ( inout(int)[3] );
+       inout( U )[n]  id7671x1(U, size_t n)( inout( U )[n] );
+
+shared(inout int)[3]  id7671n2             ( shared(inout int)[3] );
+shared(inout  U )[n]  id7671x2(U, size_t n)( shared(inout  U )[n] );
+
+void test7671()
+{
+    static assert(is( typeof( id7671n1( (immutable(int)[3]).init ) ) == immutable(int[3]) ));
+    static assert(is( typeof( id7671x1( (immutable(int)[3]).init ) ) == immutable(int[3]) ));
+
+    static assert(is( typeof( id7671n2( (immutable(int)[3]).init ) ) == immutable(int[3]) ));
+    static assert(is( typeof( id7671x2( (immutable(int)[3]).init ) ) == immutable(int[3]) ));
+}
+
+/************************************/
+// 7672
+
+T foo7672(T)(T a){ return a; }
+
+void test7672(inout(int[]) a = null, inout(int*) p = null)
+{
+    static assert(is( typeof(        a ) == inout(int[]) ));
+    static assert(is( typeof(foo7672(a)) == inout(int)[] ));
+
+    static assert(is( typeof(        p ) == inout(int*) ));
+    static assert(is( typeof(foo7672(p)) == inout(int)* ));
+}
+
+/**********************************/
+// 7684
+
+       U[]  id7684(U)(        U[]  );
+shared(U[]) id7684(U)( shared(U[]) );
+
+void test7684()
+{
+    shared(int)[] x;
+    static assert(is( typeof(id7684(x)) == shared(int)[] ));
+}
+
+/**********************************/
+// 7694
+
+void match7694(alias m)()
+{
+    m.foo();    //removing this line supresses ice in both cases
+}
+
+struct T7694
+{
+    void foo(){}
+    void bootstrap()
+    {
+    //next line causes ice
+        match7694!(this)();
+    //while this works:
+        alias this p;
+        match7694!(p)();
+    }
+}
+
+/**********************************/
+// 7755
+
+template to7755(T)
+{
+    T to7755(A...)(A args)
+    {
+        return toImpl7755!T(args);
+    }
+}
+
+T toImpl7755(T, S)(S value)
+{
+    return T.init;
+}
+
+template Foo7755(T){}
+
+struct Bar7755
+{
+    void qux()
+    {
+        if (is(typeof(to7755!string(Foo7755!int)))){};
+    }
+}
+
+/**********************************/
+
+             U[]   id11a(U)(              U[]   );
+       inout(U)[]  id11a(U)(        inout(U)[]  );
+       inout(U[])  id11a(U)(        inout(U[])  );
+inout(shared(U[])) id11a(U)( inout(shared(U[])) );
+
+void test11a(inout int _ = 0)
+{
+    shared(const(int))[] x;
+    static assert(is( typeof(id11a(x)) == shared(const(int))[] ));
+
+    shared(int)[] y;
+    static assert(is( typeof(id11a(y)) == shared(int)[] ));
+
+    inout(U)[n] idz(U, size_t n)( inout(U)[n] );
+
+    inout(shared(bool[1])) z;
+    static assert(is( typeof(idz(z)) == inout(shared(bool[1])) ));
+}
+
+inout(U[]) id11b(U)( inout(U[]) );
+
+void test11b()
+{
+    alias const(shared(int)[]) T;
+    static assert(is(typeof(id11b(T.init)) == const(shared(int)[])));
+}
+
+/**********************************/
+// 7769
+
+void f7769(K)(inout(K) value){}
+void test7769()
+{
+    f7769("abc");
+}
+
+/**********************************/
+// 7812
+
+template A7812(T...) {}
+
+template B7812(alias C) if (C) {}
+
+template D7812()
+{
+    alias B7812!(A7812!(NonExistent!())) D7812;
+}
+
+static assert(!__traits(compiles, D7812!()));
+
+/**********************************/
+// 7873
+
+inout(T)* foo(T)(inout(T)* t)
+{
+    static assert(is(T == int*));
+    return t;
+}
+
+inout(T)* bar(T)(inout(T)* t)
+{
+    return foo(t);
+}
+
+void test7873()
+{
+    int *i;
+    bar(&i);
+}
+
+/**********************************/
+// 7933
+
+struct Boo7933(size_t dim){int a;}
+struct Baa7933(size_t dim)
+{
+    Boo7933!dim a;
+    //Boo7933!1 a; //(1) This version causes no errors
+}
+
+auto foo7933()(Boo7933!1 b){return b;}
+//auto fuu7933(Boo7933!1 b){return b;} //(2) This line neutralizes the error
+
+void test7933()
+{
+    Baa7933!1 a; //(3) This line causes the error message
+    auto b = foo7933(Boo7933!1(1));
+}
+
+/**********************************/
+// 8094
+
+struct Tuple8094(T...) {}
+
+template getParameters8094(T, alias P)
+{
+    static if (is(T t == P!U, U...))
+        alias U getParameters8094;
+    else
+        static assert(false);
+}
+
+void test8094()
+{
+    alias getParameters8094!(Tuple8094!(int, string), Tuple8094) args;
+}
+
+/**********************************/
+
+struct Tuple12(T...)
+{
+    void foo(alias P)()
+    {
+        alias Tuple12 X;
+        static if (is(typeof(this) t == X!U, U...))
+            alias U getParameters;
+        else
+            static assert(false);
+    }
+}
+
+void test12()
+{
+    Tuple12!(int, string) t;
+    t.foo!Tuple12();
+}
+
+/**********************************/
+// 14290
+
+struct Foo14290(int i) {}
+alias Foo14290a = Foo14290!1;
+static assert(!is(Foo14290!2 == Foo14290a!T, T...));
+
+/**********************************/
+// 8125
+
+void foo8125(){}
+
+struct X8125(alias a) {}
+
+template Y8125a(T : A!f, alias A, alias f) {}  //OK
+template Y8125b(T : A!foo8125, alias A) {}     //NG
+
+void test8125()
+{
+    alias Y8125a!(X8125!foo8125) y1;
+    alias Y8125b!(X8125!foo8125) y2;
+}
+
+/**********************************/
+
+struct A13() {}
+struct B13(TT...) {}
+struct C13(T1) {}
+struct D13(T1, TT...) {}
+struct E13(T1, T2) {}
+struct F13(T1, T2, TT...) {}
+
+template Test13(alias X)
+{
+    static if (is(X x : P!U, alias P, U...))
+        enum Test13 = true;
+    else
+        enum Test13 = false;
+}
+
+void test13()
+{
+    static assert(Test13!( A13!() ));
+    static assert(Test13!( B13!(int) ));
+    static assert(Test13!( B13!(int, double) ));
+    static assert(Test13!( B13!(int, double, string) ));
+    static assert(Test13!( C13!(int) ));
+    static assert(Test13!( D13!(int) ));
+    static assert(Test13!( D13!(int, double) ));
+    static assert(Test13!( D13!(int, double, string) ));
+    static assert(Test13!( E13!(int, double) ));
+    static assert(Test13!( F13!(int, double) ));
+    static assert(Test13!( F13!(int, double, string) ));
+    static assert(Test13!( F13!(int, double, string, bool) ));
+}
+
+/**********************************/
+
+struct A14(T, U, int n = 1)
+{
+}
+
+template Test14(alias X)
+{
+    static if (is(X x : P!U, alias P, U...))
+        alias U Test14;
+    else
+        static assert(0);
+}
+
+void test14()
+{
+    alias A14!(int, double) Type;
+    alias Test14!Type Params;
+    static assert(Params.length == 3);
+    static assert(is(Params[0] == int));
+    static assert(is(Params[1] == double));
+    static assert(   Params[2] == 1);
+}
+
+/**********************************/
+// test for evaluateConstraint assertion
+
+bool canSearchInCodeUnits15(C)(dchar c)
+if (is(C == char))
+{
+    return true;
+}
+
+void test15()
+{
+    int needle = 0;
+    auto b = canSearchInCodeUnits15!char(needle);
+}
+
+/**********************************/
+// 8129
+
+class X8129 {}
+class A8129 {}
+class B8129 : A8129 {}
+
+int foo8129(T : A8129)(X8129 x) { return 1; }
+int foo8129(T : A8129)(X8129 x, void function (T) block) { return 2; }
+
+int bar8129(T, R)(R range, T value) { return 1; }
+
+int baz8129(T, R)(R range, T value) { return 1; }
+int baz8129(T, R)(R range, Undefined value) { return 2; }
+
+void test8129()
+{
+    auto x = new X8129;
+    assert(x.foo8129!B8129()      == 1);
+    assert(x.foo8129!B8129((a){}) == 2);
+    assert(foo8129!B8129(x)        == 1);
+    assert(foo8129!B8129(x, (a){}) == 2);
+    assert(foo8129!B8129(x)              == 1);
+    assert(foo8129!B8129(x, (B8129 b){}) == 2);
+
+    ubyte[] buffer = [0, 1, 2];
+    assert(bar8129!ushort(buffer, 915) == 1);
+
+    // While deduction, parameter type 'Undefined' shows semantic error.
+    static assert(!__traits(compiles, {
+        baz8129!ushort(buffer, 915);
+    }));
+}
+
+/**********************************/
+// 8238
+
+void test8238()
+{
+    static struct S { template t(){ int t; } }
+
+    S s1, s2;
+    assert(cast(void*)&s1      != cast(void*)&s2     );
+    assert(cast(void*)&s1      != cast(void*)&s1.t!());
+    assert(cast(void*)&s2      != cast(void*)&s2.t!());
+    assert(cast(void*)&s1.t!() == cast(void*)&s2.t!());
+    s1.t!() = 256;
+    assert(s2.t!() == 256);
+}
+
+/**********************************/
+// 8669
+
+struct X8669
+{
+    void mfoo(this T)()
+    {
+        static assert(is(typeof(this) == T));
+    }
+    void cfoo(this T)() const
+    {
+        static assert(is(typeof(this) == const(T)));
+    }
+    void sfoo(this T)() shared
+    {
+        static assert(is(typeof(this) == shared(T)));
+    }
+    void scfoo(this T)() shared const
+    {
+        static assert(is(typeof(this) == shared(const(T))));
+    }
+    void ifoo(this T)() immutable
+    {
+        static assert(is(typeof(this) == immutable(T)));
+    }
+}
+
+void test8669()
+{
+                 X8669 mx;
+           const X8669 cx;
+      immutable  X8669 ix;
+          shared X8669 sx;
+    shared const X8669 scx;
+
+     mx.mfoo();
+     cx.mfoo();
+     ix.mfoo();
+     sx.mfoo();
+    scx.mfoo();
+
+     mx.cfoo();
+     cx.cfoo();
+     ix.cfoo();
+     sx.cfoo();
+    scx.cfoo();
+
+    static assert(!is(typeof(  mx.sfoo() )));
+    static assert(!is(typeof(  cx.sfoo() )));
+     ix.sfoo();
+     sx.sfoo();
+    scx.sfoo();
+
+    static assert(!is(typeof(  mx.scfoo() )));
+    static assert(!is(typeof(  cx.scfoo() )));
+     ix.scfoo();
+     sx.scfoo();
+    scx.scfoo();
+
+    static assert(!is(typeof(  mx.ifoo() )));
+    static assert(!is(typeof(  cx.ifoo() )));
+     ix.ifoo();
+    static assert(!is(typeof(  sx.ifoo() )));
+    static assert(!is(typeof( scx.ifoo() )));
+}
+
+/**********************************/
+// 8833
+
+template TypeTuple8833(T...) { alias TypeTuple = T; }
+
+void func8833(alias arg)() { }
+
+void test8833()
+{
+    int x, y;
+
+    alias TypeTuple8833!(
+        func8833!(x),
+        func8833!(y),
+    ) Map;
+}
+
+/**********************************/
+// 8976
+
+void f8976(ref int) { }
+
+void g8976()()
+{
+    f8976(0); // line 5
+}
+
+
+void h8976()()
+{
+    g8976!()();
+}
+
+static assert(! __traits(compiles, h8976!()() ) ); // causes error
+static assert(!is(typeof(          h8976!()() )));
+
+void test8976()
+{
+    static assert(! __traits(compiles, h8976!()() ) );
+    static assert(!is(typeof(          h8976!()() )));
+}
+
+/****************************************/
+// 8940
+
+const int n8940; // or `immutable`
+static this() { n8940 = 3; }
+
+void f8940(T)(ref int val)
+{
+    assert(val == 3);
+    ++val;
+}
+
+static assert(!__traits(compiles,  f8940!void(n8940))); // fails
+void test8940()
+{
+    assert(n8940 == 3);
+    static assert(!__traits(compiles, f8940!void(n8940)));
+    //assert(n8940 == 3); // may pass as compiler caches comparison result
+    //assert(n8940 != 4); // may pass but likely will fail
+}
+
+/**********************************/
+// 6969 + 8990
+
+class A6969() { alias C6969!() C1; }
+class B6969   { alias A6969!() A1; }
+class C6969() : B6969 {}
+
+struct A8990(T) { T t; }
+struct B8990(T) { A8990!T* a; }
+struct C8990    { B8990!C8990* b; }
+
+/**********************************/
+// 9018
+
+template Inst9018(alias Template, T)
+{
+    alias Template!T Inst;
+}
+
+template Template9018(T)
+{
+    enum Template9018 = T;
+}
+
+static assert(!__traits(compiles, Inst9018!(Template9018, int))); // Assert passes
+static assert(!__traits(compiles, Inst9018!(Template9018, int))); // Assert fails
+
+/**********************************/
+// 9022
+
+class C9022
+{
+    struct X {}
+
+    alias B = X;
+}
+class D9022
+{
+    struct X {}
+}
+
+void test9022()
+{
+    auto c = new C9022();
+    auto d = new D9022();
+    auto cx = C9022.X();
+    auto dx = D9022.X();
+
+    void foo1(T)(T, T.X) { static assert(is(T == C9022)); }
+    void foo2(T)(T.X, T) { static assert(is(T == C9022)); }
+    foo1(c, cx);
+    foo2(cx, c);
+
+    void hoo1(T)(T, T.B) { static assert(is(T == C9022)); }
+    void hoo2(T)(T.B, T) { static assert(is(T == C9022)); }
+    hoo1(c, cx);
+    hoo1(c, cx);
+
+    void bar1(alias A)(A.C9022, A.D9022) { static assert(A.stringof == "module breaker"); }
+    void bar2(alias A)(A.D9022, A.C9022) { static assert(A.stringof == "module breaker"); }
+    bar1(c, d);
+    bar2(d, c);
+
+    void var1(alias A)(A.C9022, A.D9022.X) { static assert(A.stringof == "module breaker"); }
+    void var2(alias A)(A.D9022.X, A.C9022) { static assert(A.stringof == "module breaker"); }
+    var1(c, dx);
+    var2(dx, c);
+
+    void baz(T)(T.X t, T.X u) { }
+    static assert(!__traits(compiles, baz(cx, dx)));
+}
+
+/**********************************/
+// 9026
+
+mixin template node9026()
+{
+    static if (is(this == struct))
+        alias typeof(this)* E;
+    else
+        alias typeof(this) E;
+    E prev, next;
+}
+
+struct list9026(alias N)
+{
+    N.E head;
+    N.E tail;
+}
+
+class A9026
+{
+    mixin node9026 L1;
+    mixin node9026 L2;
+}
+
+list9026!(A9026.L1) g9026_l1;
+list9026!(A9026.L2) g9026_l2;
+
+void test9026()
+{
+    list9026!(A9026.L1) l9026_l1;
+    list9026!(A9026.L2) l9026_l2;
+}
+
+/**********************************/
+// 9038
+
+mixin template Foo9038()
+{
+    string data = "default";
+}
+
+class Bar9038
+{
+    string data;
+    mixin Foo9038 f;
+}
+
+void check_data9038(alias M, T)(T obj)
+{
+    //writeln(M.stringof);
+    assert(obj.data == "Bar");
+    assert(obj.f.data == "F");
+}
+
+void test9038()
+{
+    auto bar = new Bar9038;
+    bar.data = "Bar";
+    bar.f.data = "F";
+
+    assert(bar.data == "Bar");
+    assert(bar.f.data == "F");
+
+    check_data9038!(Bar9038)(bar);
+    check_data9038!(Bar9038.f)(bar);
+    check_data9038!(bar.f)(bar);
+}
+
+/**********************************/
+// 9050
+
+struct A9050(T) {}
+
+struct B9050(T)
+{
+    void f() { foo9050(A9050!int()); }
+}
+
+auto foo9050()(A9050!int base) pure
+{
+    return B9050!int();
+}
+
+auto s9050 = foo9050(A9050!int());
+
+/**********************************/
+// 10936 (dup of 9050)
+
+struct Vec10936(string s)
+{
+    auto foo(string v)()
+    {
+        return Vec10936!(v)();
+    }
+
+    static void bar()
+    {
+        Vec10936!"" v;
+        auto p = v.foo!"sup";
+    }
+}
+
+Vec10936!"" v;
+
+/**********************************/
+// 9076
+
+template forward9076(args...)
+{
+    @property forward9076()(){ return args[0]; }
+}
+
+void test9076()
+{
+    int a = 1;
+    int b = 1;
+    assert(a == forward9076!b);
+}
+
+/**********************************/
+// 9083
+
+template isFunction9083(X...) if (X.length == 1)
+{
+    enum isFunction9083 = true;
+}
+
+struct S9083
+{
+    static string func(alias Class)()
+    {
+        foreach (m; __traits(allMembers, Class))
+        {
+            pragma(msg, m);  // prints "func"
+            enum x1 = isFunction9083!(mixin(m));  //NG
+            enum x2 = isFunction9083!(func);      //OK
+        }
+        return "";
+    }
+}
+enum nothing9083 = S9083.func!S9083();
+
+class C9083
+{
+    int x;  // some class members
+
+    void func()
+    {
+        void templateFunc(T)(const T obj)
+        {
+            enum x1 = isFunction9083!(mixin("x"));  // NG
+            enum x2 = isFunction9083!(x);           // NG
+        }
+        templateFunc(this);
+    }
+}
+
+/**********************************/
+// 9100
+
+template Id(alias A) { alias Id = A; }
+template ErrId(alias A) { static assert(0); }
+template TypeTuple9100(TL...) { alias TypeTuple9100 = TL; }
+
+class C9100
+{
+    int value;
+
+    int fun() { return value; }
+    int tfun(T)() { return value; }
+    TypeTuple9100!(int, long) field;
+
+    void test()
+    {
+        this.value = 1;
+        auto c = new C9100();
+        c.value = 2;
+
+        alias t1a = Id!(c.fun);             // OK
+        alias t1b = Id!(this.fun);          // Prints weird error, bad
+        // -> internally given TOKdotvar
+        assert(t1a() == this.value);
+        assert(t1b() == this.value);
+
+        alias t2a = Id!(c.tfun);            // OK
+        static assert(!__traits(compiles, ErrId!(this.tfun)));
+        alias t2b = Id!(this.tfun);         // No error occurs, why?
+        // -> internally given TOKdottd
+        assert(t2a!int() == this.value);
+        assert(t2b!int() == this.value);
+
+        alias t3a = Id!(foo9100);           // OK
+        alias t3b = Id!(mixin("foo9100"));  // Prints weird error, bad
+        // -> internally given TOKtemplate
+        assert(t3a() == 10);
+        assert(t3b() == 10);
+
+        assert(field[0] == 0);
+        alias t4a = TypeTuple9100!(field);              // NG
+        alias t4b = TypeTuple9100!(GetField9100!());    // NG
+        t4a[0] = 1; assert(field[0] == 1);
+        t4b[0] = 2; assert(field[0] == 2);
+    }
+}
+
+int foo9100()() { return 10; }
+template GetField9100() { alias GetField9100 = C9100.field[0]; }
+
+void test9100()
+{
+    (new C9100()).test();
+}
+
+/**********************************/
+// 9101
+
+class Node9101
+{
+    template ForwardCtorNoId()
+    {
+        this() {} // default constructor
+        void foo() { 0 = 1; }    // wrong code
+    }
+}
+enum x9101 = __traits(compiles, Node9101.ForwardCtorNoId!());
+
+/**********************************/
+// 9124
+
+struct Foo9124a(N...)
+{
+    enum SIZE = N[0];
+    private int _val;
+
+    public void opAssign (T) (T other)
+    if (is(T unused == Foo9124a!(_N), _N...))
+    {
+        _val = other._val;          // compile error
+        this._val = other._val;     // explicit this make it work
+    }
+
+    public auto opUnary (string op) () if (op == "~") {
+        Foo9124a!(SIZE) result = this;
+        return result;
+    }
+}
+void test9124a()
+{
+    Foo9124a!(28) a;
+    Foo9124a!(28) b = ~a;
+}
+
+// --------
+
+template Foo9124b(T, U, string OP)
+{
+    enum N = T.SIZE;
+    alias Foo9124b = Foo9124b!(false, true, N);
+}
+struct Foo9124b(bool S, bool L, N...)
+{
+    enum SIZE = 5;
+    long[1] _a = 0;
+    void someFunction() const {
+        auto data1 = _a;        // Does not compile
+        auto data2 = this._a;   // <--- Compiles
+    }
+    auto opBinary(string op, T)(T) {
+        Foo9124b!(typeof(this), T, op) test;
+    }
+}
+void test9124b()
+{
+    auto p = Foo9124b!(false, false, 5)();
+    auto q = Foo9124b!(false, false, 5)();
+    p|q;
+    p&q;
+}
+
+/**********************************/
+// 9143
+
+struct Foo9143a(bool S, bool L)
+{
+    auto noCall() {
+        Foo9143a!(S, false) x1;         // compiles if this line commented
+        static if(S) Foo9143a!(true,  false) x2;
+        else         Foo9143a!(false, false) x2;
+    }
+    this(T)(T other)        // constructor
+    if (is(T unused == Foo9143a!(P, Q), bool P, bool Q)) { }
+}
+
+struct Foo9143b(bool L, size_t N)
+{
+    void baaz0() {
+        bar!(Foo9143b!(false, N))();    // line 7
+        // -> move to before the baaz semantic
+    }
+    void baaz() {
+        bar!(Foo9143b!(false, 2LU))();  // line 3
+        bar!(Foo9143b!(true, 2LU))();   // line 4
+        bar!(Foo9143b!(L, N))();        // line 5
+        bar!(Foo9143b!(true, N))();     // line 6
+        bar!(Foo9143b!(false, N))();    // line 7
+    }
+    void bar(T)()
+    if (is(T unused == Foo9143b!(_L, _N), bool _L, size_t _N))
+    {}
+}
+
+void test9143()
+{
+    Foo9143a!(false, true) k = Foo9143a!(false, false)();
+
+    auto p = Foo9143b!(true, 2LU)();
+}
+
+/**********************************/
+// 9266
+
+template Foo9266(T...)
+{
+    T Foo9266;
+}
+struct Bar9266()
+{
+    alias Foo9266!int f;
+}
+void test9266()
+{
+    Bar9266!() a, b;
+}
+
+/**********************************/
+// 9361
+
+struct Unit9361(A)
+{
+    void butPleaseDontUseMe()()
+    if (is(unitType9361!((this))))  // !
+    {}
+
+}
+template isUnit9361(alias T) if ( is(T)) {}
+template isUnit9361(alias T) if (!is(T)) {}
+
+template unitType9361(alias T) if (isUnit9361!T) {}
+
+void test9361()
+{
+    Unit9361!int u;
+    static assert(!__traits(compiles, u.butPleaseDontUseMe())); // crashes
+}
+
+/**********************************/
+// 9536
+
+struct S9536
+{
+    static A foo(A)(A a)
+    {
+        return a * 2;
+    }
+    int bar() const
+    {
+        return foo(42);
+    }
+}
+
+void test9536()
+{
+    S9536 s;
+    assert(s.bar() == 84);
+}
+
+/**********************************/
+// 9578
+
+template t9578(alias f) { void tf()() { f(); } }
+
+void g9578a(alias f)()  { f(); }        // Error -> OK
+void g9578b(alias ti)() { ti.tf(); }    // Error -> OK
+
+void test9578()
+{
+    int i = 0;
+    int m() { return i; }
+
+    g9578a!(t9578!m.tf)();
+    g9578b!(t9578!m)();
+}
+
+/**********************************/
+// 9596
+
+int foo9596a(K, V)(inout(       V  [K])) { return 1; }
+int foo9596a(K, V)(inout(shared(V) [K])) { return 2; }
+
+int foo9596b(K, V)(inout(       V  [K])) { return 1; }
+int foo9596b(K, V)(inout( const(V) [K])) { return 3; }
+
+int foo9596c(K, V)(inout(shared(V) [K])) { return 2; }
+int foo9596c(K, V)(inout( const(V) [K])) { return 3; }
+
+int foo9596d(K, V)(inout(       V  [K])) { return 1; }
+int foo9596d(K, V)(inout(shared(V) [K])) { return 2; }
+int foo9596d(K, V)(inout( const(V) [K])) { return 3; }
+
+int foo9596e(K, V)(inout(shared(V) [K])) { return 2; }
+int foo9596e(K, V)(inout(       V  [K])) { return 1; }
+int foo9596e(K, V)(inout( const(V) [K])) { return 3; }
+
+void test9596()
+{
+    shared(int)[int] aa;
+    static assert(!__traits(compiles, foo9596a(aa)));
+
+    assert(foo9596b(aa) == 1);
+    assert(foo9596c(aa) == 2);
+
+    static assert(!__traits(compiles, foo9596d(aa)));
+    static assert(!__traits(compiles, foo9596e(aa)));
+}
+
+/******************************************/
+// 9806
+
+struct S9806a(alias x)
+{
+    alias S9806a!0 N;
+}
+enum expr9806a = 0 * 0;
+alias S9806a!expr9806a T9806a;
+
+// --------
+
+struct S9806b(alias x)
+{
+    template Next()
+    {
+        enum expr = x + 1;
+        alias S9806b!expr Next;
+    }
+}
+alias S9806b!1 One9806b;
+alias S9806b!0.Next!() OneAgain9806b;
+
+// --------
+
+struct S9806c(x...)
+{
+    template Next()
+    {
+        enum expr = x[0] + 1;
+        alias S9806c!expr Next;
+    }
+}
+alias S9806c!1 One9806c;
+alias S9806c!0.Next!() OneAgain9806c;
+
+/******************************************/
+// 9837
+
+void test9837()
+{
+    enum DA : int[] { a = [1,2,3] }
+    DA da;
+    int[] bda = da;
+    static assert(is(DA : int[]));
+    void fda1(int[] a) {}
+    void fda2(T)(T[] a) {}
+    fda1(da);
+    fda2(da);
+
+    enum SA : int[3] { a = [1,2,3] }
+    SA sa;
+    int[3] bsa = sa;
+    static assert(is(SA : int[3]));
+    void fsa1(int[3] a) {}
+    void fsa2(T)(T[3] a) {}
+    void fsa3(size_t d)(int[d] a) {}
+    void fsa4(T, size_t d)(T[d] a) {}
+    fsa1(sa);
+    fsa2(sa);
+    fsa3(sa);
+    fsa4(sa);
+
+    enum AA : int[int] { a = null }
+    AA aa;
+    int[int] baa = aa;
+    static assert(is(AA : int[int]));
+    void faa1(int[int] a) {}
+    void faa2(V)(V[int] a) {}
+    void faa3(K)(int[K] a) {}
+    void faa4(K, V)(V[K] a) {}
+    faa1(aa);
+    faa2(aa);
+    faa3(aa);
+    faa4(aa);
+}
+
+/******************************************/
+// 9874
+
+bool foo9874() { return true; }
+void bar9874(T)(T) if (foo9874()) {} // OK
+void baz9874(T)(T) if (foo9874)   {} // error
+
+void test9874()
+{
+    foo9874;                      // OK
+    bar9874(0);
+    baz9874(0);
+}
+
+/******************************************/
+
+void test9885()
+{
+    void foo(int[1][]) {}
+    void boo()(int[1][]){}
+    struct X(T...) { static void xoo(T){} }
+    struct Y(T...) { static void yoo()(T){} }
+    struct Z(T...) { static void zoo(U...)(T, U){} }
+
+    struct V(T...) { static void voo()(T, ...){} }
+    struct W(T...) { static void woo()(T...){} }
+
+    struct R(T...) { static void roo(U...)(int, U, T){} }
+
+    // OK
+    foo([[10]]);
+    boo([[10]]);
+
+    // OK
+    X!(int[1][]).xoo([[10]]);
+
+    // NG!
+    Y!().yoo();
+    Y!(int).yoo(1);
+    Y!(int, int[]).yoo(1, [10]);
+    static assert(!__traits(compiles, Y!().yoo(1)));
+    static assert(!__traits(compiles, Y!(int).yoo("a")));
+    static assert(!__traits(compiles, Y!().yoo!(int)()));
+
+    // NG!
+    Z!().zoo();
+    Z!().zoo([1], [1:1]);
+    Z!(int, string).zoo(1, "a");
+    Z!(int, string).zoo(1, "a", [1], [1:1]);
+    Z!().zoo!()();
+    static assert(!__traits(compiles, Z!().zoo!()(1)));     // (none) <- 1
+    static assert(!__traits(compiles, Z!(int).zoo!()()));   // int <- (none)
+    static assert(!__traits(compiles, Z!(int).zoo!()(""))); // int <- ""
+    static assert(!__traits(compiles, Z!().zoo!(int)()));   // int <- (none)
+    static assert(!__traits(compiles, Z!().zoo!(int)(""))); // int <- ""
+
+    V!().voo(1,2,3);
+    V!(int).voo(1,2,3);
+    V!(int, long).voo(1,2,3);
+    static assert(!__traits(compiles, V!(int).voo()));          // int <- (none)
+    static assert(!__traits(compiles, V!(int, long).voo(1)));       // long <- (none)
+    static assert(!__traits(compiles, V!(int, string).voo(1,2,3)));     // string <- 2
+
+    W!().woo();
+    //W!().woo(1, 2, 3);    // Access Violation
+    {   // this behavior is consistent with:
+        //alias TL = TypeTuple!();
+        //void foo(TL...) {}
+        //foo(1, 2, 3);     // Access Violation
+        //pragma(msg, typeof(foo));   // void(...)  -> D-style variadic function?
+    }
+    W!(int,int[]).woo(1,2,3);
+    W!(int,int[2]).woo(1,2,3);
+    static assert(!__traits(compiles, W!(int,int,int).woo(1,2,3)));     // int... <- 2
+    static assert(!__traits(compiles, W!(int,int).woo(1,2)));           // int... <- 2
+    static assert(!__traits(compiles, W!(int,int[2]).woo(1,2)));    // int[2]... <- 2
+
+    R!().roo(1, "", []);
+    R!(int).roo(1, "", [], 1);
+    R!(int, string).roo(1, "", [], 1, "");
+    R!(int, string).roo(1, 2, "");
+    static assert(!__traits(compiles, R!(int).roo(1, "", []))); // int <- []
+    static assert(!__traits(compiles, R!(int, int).roo(1, "", [])));    // int <- []
+    static assert(!__traits(compiles, R!(int, string).roo(1, 2, 3)));   // string <- 3
+
+    // test case
+    struct Tuple(T...) { this()(T values) {} }
+    alias T = Tuple!(int[1][]);
+    auto t = T([[10]]);
+}
+
+/******************************************/
+// 9971
+
+void goo9971()()
+{
+    auto g = &goo9971;
+}
+
+struct S9971
+{
+    void goo()()
+    {
+        auto g = &goo;
+        static assert(is(typeof(g) == delegate));
+    }
+}
+
+void test9971()
+{
+    goo9971!()();
+
+    S9971.init.goo!()();
+}
+
+/******************************************/
+// 9977
+
+void test9977()
+{
+    struct S1(T) { T value; }
+    auto func1(T)(T value) { return value; }
+    static assert(is(S1!int == struct));
+    assert(func1(10) == 10);
+
+    template S2(T) { struct S2 { T value; } }
+    template func2(T) { auto func2(T value) { return value; } }
+    static assert(is(S2!int == struct));
+    assert(func2(10) == 10);
+
+    template X(T) { alias X = T[3]; }
+    static assert(is(X!int == int[3]));
+
+    int a;
+    template Y(T) { alias Y = T[typeof(a)]; }
+    static assert(is(Y!double == double[int]));
+
+    int v = 10;
+    template Z() { alias Z = v; }
+    assert(v == 10);
+    Z!() = 20;
+    assert(v == 20);
+}
+
+/******************************************/
+
+enum T8848a(int[] a) = a;
+enum T8848b(int[int] b) = b;
+enum T8848c(void* c) = c;
+
+static assert(T8848a!([1,2,3]) == [1,2,3]);
+static assert(T8848b!([1:2,3:4]) == [1:2,3:4]);
+static assert(T8848c!(null) == null);
+
+/******************************************/
+// 9990
+
+auto initS9990() { return "hi"; }
+
+class C9990(alias init) {}
+
+alias SC9990 = C9990!(initS9990);
+
+/******************************************/
+// 10067
+
+struct assumeSize10067(alias F) {}
+
+template useItemAt10067(size_t idx, T)
+{
+    void impl(){ }
+
+    alias useItemAt10067 = assumeSize10067!(impl);
+}
+
+useItemAt10067!(0, char) mapS10067;
+
+/******************************************/
+// 4072
+
+void bug4072(T)(T x)
+    if (is(typeof(bug4072(x))))
+{}
+
+static assert(!is(typeof(bug4072(7))));
+
+/******************************************/
+// 10074
+
+template foo10074(F)
+{
+    enum foo10074 = false;
+}
+bool foo10074(F)(F f)
+    if (foo10074!F)
+{
+    return false;
+}
+
+static assert(!is(typeof(foo10074(1))));
+
+/******************************************/
+// 10083
+
+// [a-c] IFTI can find syntactic eponymous member
+template foo10083a(T)
+{
+    int foo10083a(double) { return 1; }
+    int foo10083a(T) { return 2; }
+}
+template foo10083b(T)
+{
+    int foo10083b(T) { return 1; }
+    int foo10083b(T, T) { return 2; }
+}
+template foo10083c1(T)
+{
+    int foo10083c1(T) { return 1; }
+    static if (true) { int x; }
+}
+template foo10083c2(T)
+{
+    int foo10083c2(T) { return 1; }
+    static if (true) { int x; } else { int y; }
+}
+
+// [d-f] IFTI cannot find syntactic eponymous member
+template foo10083d1(T)
+{
+    static if (true)
+    {
+        int foo10083d1(T) { return 1; }
+    }
+    else
+    {
+    }
+}
+template foo10083d2(T)
+{
+    static if (true)
+    {
+    }
+    else
+    {
+        int foo10083d2(T) { return 1; }
+    }
+}
+template foo10083e(T)
+{
+    static if (true)
+    {
+        int foo10083e(double arg) { return 1; }
+    }
+    int foo10083e(T arg) { return 2; }
+}
+template foo10083f(T)
+{
+    static if (true)
+    {
+        int foo10083f(T) { return 1; }
+    }
+    else
+    {
+        int foo10083f(T) { return 2; }
+    }
+}
+
+void test10083()
+{
+    assert(foo10083a(1) == 2);
+    assert(foo10083a!int(1) == 2);
+    assert(foo10083a!int(1.0) == 1);
+    static assert(!__traits(compiles, foo10083a!double(1)));
+    static assert(!__traits(compiles, foo10083a!double(1.0)));
+    static assert(!__traits(compiles, foo10083a!real(1)));
+    assert(foo10083a!real(1.0) == 1);
+    assert(foo10083a!real(1.0L) == 2);
+
+    assert(foo10083b(2) == 1);
+    assert(foo10083b(3, 4) == 2);
+    static assert(!__traits(compiles, foo10083b(2, "")));
+
+    assert(foo10083c1(1) == 1);
+    assert(foo10083c2(1) == 1);
+
+    static assert(!__traits(compiles, foo10083d1(2)));
+    static assert(!__traits(compiles, foo10083d2(2)));
+    static assert(!__traits(compiles, foo10083e(3)));
+    static assert(!__traits(compiles, foo10083f(3)));
+}
+
+/******************************************/
+// 10134
+
+template ReturnType10134(alias func)
+{
+    static if (is(typeof(func) R == return))
+        alias R ReturnType10134;
+    else
+        static assert(0);
+}
+
+struct Result10134(T) {}
+
+template getResultType10134(alias func)
+{
+    static if(is(ReturnType10134!(func.exec) _ == Result10134!(T), T))
+    {
+        alias getResultType10134 = T;
+    }
+}
+
+template f10134(alias func)
+{
+    Result10134!(getResultType10134!(func)) exec(int i)
+    {
+        return typeof(return)();
+    }
+}
+
+template a10134()
+{
+    Result10134!(double) exec(int i)
+    {
+        return b10134!().exec(i);
+    }
+}
+
+template b10134()
+{
+    Result10134!(double) exec(int i)
+    {
+        return f10134!(a10134!()).exec(i);
+    }
+}
+
+pragma(msg, getResultType10134!(a10134!()));
+
+/******************************************/
+// 10313
+
+void test10313()
+{
+    struct Nullable(T)
+    {
+        this()(inout T value) inout {}
+    }
+
+    struct S { S[] array; }
+    S s;
+    auto ns = Nullable!S(s);
+
+    class C { C[] array; }
+    C c;
+    auto nc = Nullable!C(c);
+}
+
+/******************************************/
+// 10498
+
+template triggerIssue10498a()
+{
+    enum triggerIssue10498a = __traits(compiles, { T10498a; });
+}
+
+template PackedGenericTuple10498a(Args...)
+{
+    alias Args Tuple;
+    enum e = triggerIssue10498a!();
+}
+
+struct S10498a { }
+
+template T10498a()
+{
+    alias PackedGenericTuple10498a!S10498a T10498a;
+}
+
+void test10498a()
+{
+    alias T10498a!() t;
+    static assert(is(t.Tuple[0])); // Fails -> OK
+}
+
+// --------
+
+template triggerIssue10498b(A...)
+{
+    enum triggerIssue10498b = __traits(compiles, { auto a = A[0]; });
+}
+
+template PackedGenericTuple10498b(Args...)
+{
+    alias Args Tuple;
+    enum e = triggerIssue10498b!Args;
+}
+
+template T10498b()
+{
+    struct S {} // The fact `S` is in `T` causes the problem
+    alias PackedGenericTuple10498b!S T10498b;
+}
+
+void test10498b()
+{
+    alias T10498b!() t;
+    static assert(is(t.Tuple[0]));
+}
+
+/******************************************/
+// 10537
+
+struct Iota10537
+{
+    int s,e,i;
+    mixin Yield10537!q{ ; };
+}
+
+auto skipStrings10537(T)(T source)
+{
+    return "";
+}
+
+mixin template Yield10537(dstring code)
+{
+    alias X = typeof({ enum x = rewriteCode10537(code); }());
+}
+
+dstring rewriteCode10537(dstring code)
+{
+    skipStrings10537(code);  // IFTI causes forward reference
+    return "";
+}
+
+/******************************************/
+// 10558
+
+template Template10558() {}
+
+struct Struct10558(alias T){}
+
+alias bar10558 = foo10558!(Template10558!());
+
+template foo10558(alias T)
+{
+    alias foobar = Struct10558!T;
+
+    void fun()
+    {
+        alias a = foo10558!T;
+    }
+}
+
+/******************************************/
+// 10592
+
+void test10592()
+{
+    struct A(E)
+    {
+        int put()(const(E)[] data)
+        {
+            return 1;
+        }
+
+        int put()(const(dchar)[] data) if (!is(E == dchar))
+        {
+            return 2;
+        }
+
+        int put(C)(const(C)[] data) if (!is(C == dchar) && !is(E == C))
+        {
+            return 3;
+        }
+    }
+
+    A!char x;
+    assert(x.put("abcde"c) == 1);   // OK: hit 1
+    assert(x.put("abcde"w) == 3);   // NG: this should hit 3
+    assert(x.put("abcde"d) == 2);   // OK: hit 2
+}
+
+/******************************************/
+// 11242
+
+inout(T[]) fromString11242(T)(inout(char[]) s, T[] dst)
+{
+    return s;
+}
+
+void test11242()
+{
+    char[] a;
+    fromString11242(a, a);
+}
+
+/******************************************/
+// 10811
+
+void foo10811a(R1, R2)(R1, R2) {}
+template foo10811a(alias pred) { void foo10811a(R1, R2)(R1, R2) {} }
+
+template foo10811b(alias pred) { void foo10811b(R1, R2)(R1, R2) {} }
+void foo10811b(R1, R2)(R1, R2) {}
+
+void test10811()
+{
+    foo10811a(1, 2);
+    foo10811a!(a => a)(1, 2);
+
+    foo10811b(1, 2);
+    foo10811b!(a => a)(1, 2);
+}
+
+/******************************************/
+// 10969
+
+template A10969(T, U...) { alias A10969 = T; }
+void foo10969(T, U...)(A10969!(T, U) a) {}
+
+template B10969(T, U) { alias B10969 = T; }
+void bar10969(T, U...)(B10969!(T, U[0]) a) {}
+
+void test10969()
+{
+    foo10969!(int, float)(3);
+    bar10969!(int, float)(3);
+}
+
+/******************************************/
+// 11271
+
+struct SmartPtr11271(T)
+{
+    ~this() {}
+    void opAssign(U)(auto ref U rh) {}
+}
+
+void test11271()
+{
+    SmartPtr11271!Object a;
+    a = SmartPtr11271!Object();
+}
+
+/******************************************/
+// 11533
+
+version (none)
+{
+struct S11533
+{
+    void put(alias fun)() { fun!int(); }
+}
+void test11533a()
+{
+    static void foo(T)() {}
+    S11533 s;
+    s.put!foo();
+}
+
+void test11533b()
+{
+    static void bar(alias fun)() { fun(); }
+    void nested() {}
+    bar!nested();
+}
+
+void test11533c()
+{
+    static struct Foo(alias fun)
+    {
+        auto call() { return fun(); }
+    }
+    int var = 1;
+    auto getVar() { return var; }
+    Foo!getVar foo;
+    assert(foo.call() == var);
+    var += 1;
+    assert(foo.call() == var);
+}
+
+void test11533()
+{
+    test11533a();
+    test11533b();
+    test11533c();
+}
+}
+else
+{
+void test11533()
+{
+}
+}
+
+/******************************************/
+// 11553
+
+struct Pack11553(T ...)
+{
+    alias Unpack = T;
+    enum length = T.length;
+}
+
+template isPack11553(TList ...)
+{
+    static if (TList.length == 1 && is(Pack11553!(TList[0].Unpack) == TList[0]))
+    {
+        enum isPack11553 = true;
+    }
+    else
+    {
+        enum isPack11553 = false;
+    }
+}
+
+template PartialApply11553(alias T, uint argLoc, Arg ...)
+    if (Arg.length == 1)
+{
+    template PartialApply11553(L ...)
+    {
+        alias PartialApply11553 = T!(L[0 .. argLoc], Arg, L[argLoc .. $]);
+    }
+}
+
+template _hasLength11553(size_t len, T)
+{
+    static if (T.length == len)
+    {
+        enum _hasLength11553 = true;
+    }
+    else
+    {
+        enum _hasLength11553 = false;
+    }
+}
+
+alias _hasLength11553(size_t len) = PartialApply11553!(._hasLength11553, 0, len);
+
+
+alias hl11553 = _hasLength11553!1;
+
+// this segfaults
+static if (!isPack11553!hl11553) { pragma(msg, "All good 1"); }
+
+// these are fine
+static if ( hl11553!(Pack11553!(5))) { pragma(msg, "All good 2"); }
+
+static if (!hl11553!(Pack11553!( ))) { pragma(msg, "All good 3"); }
+
+/******************************************/
+// 11818
+
+enum E11818 { e0, e1 }
+
+struct SortedRange11818
+{
+    void fun(E11818 e = true ? E11818.e0 : E11818.e1)()
+    {
+    }
+}
+
+void test11818()
+{
+    SortedRange11818 s;
+    s.fun();
+}
+
+/******************************************/
+// 11843
+
+void test11843()
+{
+    struct Foo
+    {
+        int x[string];
+    }
+
+    struct Bar(alias foo) {}
+
+    enum bar1 = Bar!(Foo(["a": 1]))();
+    enum bar2 = Bar!(Foo(["a": 1]))();
+    static assert(is(typeof(bar1) == typeof(bar2)));
+
+    enum foo1 = Foo(["a": 1]);
+    enum foo2 = Foo(["b": -1]);
+    static assert(!__traits(isSame, foo1, foo2));
+    enum bar3 = Bar!foo1();
+    enum bar4 = Bar!foo2();
+    static assert(!is(typeof(bar3) == typeof(bar4)));
+}
+
+/******************************************/
+// 11872
+
+class Foo11872
+{
+    auto test(int v)() {}
+    auto test(int v)(string) {}
+
+    template Bar(T)
+    {
+        void test(T) {}
+    }
+}
+
+void test11872()
+{
+    auto foo = new Foo11872();
+
+    with (foo)
+    {
+        // ScopeExp(ti) -> DotTemplateInstanceExp(wthis, ti)
+        foo.test!2();   // works
+        test!2();       // works <- fails
+        test!2;         // works <- fails
+
+        // ScopeExp(ti) -> DotTemplateInstanceExp(wthis, ti) -> DotExp(wthis, ScopeExp)
+        foo.Bar!int.test(1);    // works
+        Bar!int.test(1);        // works <- fails
+    }
+}
+
+/******************************************/
+// 12042
+
+struct S12042
+{
+    int[] t;
+
+    void m()()
+    {
+        t = null;   // CTFE error -> OK
+    }
+}
+
+int test12042()
+{
+    S12042 s;
+
+    with (s)
+        m!()();
+
+    return 1;
+}
+
+static assert(test12042());
+
+/******************************************/
+// 12077
+
+struct S12077(A) {}
+
+alias T12077(alias T : Base!Args, alias Base, Args...) = Base;
+static assert(__traits(isSame, T12077!(S12077!int), S12077));
+
+alias U12077(alias T : Base!Args, alias Base, Args...) = Base;
+alias U12077(      T : Base!Args, alias Base, Args...) = Base;
+static assert(__traits(isSame, U12077!(S12077!int), S12077));
+
+/******************************************/
+// 12262
+
+template Inst12262(T) { int x; }
+
+enum fqnSym12262(alias a)                      = 1;
+enum fqnSym12262(alias a : B!A, alias B, A...) = 2;
+
+static assert(fqnSym12262!(Inst12262!(Object)) == 2);
+static assert(fqnSym12262!(Inst12262!(Object).x) == 1);
+
+/******************************************/
+// 12264
+
+struct S12264(A) {}
+
+template AX12264(alias A1)                      { enum AX12264 = 1; }
+template AX12264(alias A2 : B!A, alias B, A...) { enum AX12264 = 2; }
+template AY12264(alias A1)                  { enum AY12264 = 1; }
+template AY12264(alias A2 : B!int, alias B) { enum AY12264 = 2; }
+template AZ12264(alias A1)               { enum AZ12264 = 1; }
+template AZ12264(alias A2 : S12264!T, T) { enum AZ12264 = 2; }
+static assert(AX12264!(S12264!int) == 2);
+static assert(AY12264!(S12264!int) == 2);
+static assert(AZ12264!(S12264!int) == 2);
+
+template TX12264(T1)                      { enum TX12264 = 1; }
+template TX12264(T2 : B!A, alias B, A...) { enum TX12264 = 2; }
+template TY12264(T1)                  { enum TY12264 = 1; }
+template TY12264(T2 : B!int, alias B) { enum TY12264 = 2; }
+template TZ12264(T1)               { enum TZ12264 = 1; }
+template TZ12264(T2 : S12264!T, T) { enum TZ12264 = 2; }
+static assert(TX12264!(S12264!int) == 2);
+static assert(TY12264!(S12264!int) == 2);
+static assert(TZ12264!(S12264!int) == 2);
+
+/******************************************/
+// 12122
+
+enum N12122 = 1;
+
+void foo12122(T)(T[N12122]) if(is(T == int)) {}
+
+void test12122()
+{
+    int[N12122] data;
+    foo12122(data);
+}
+
+/******************************************/
+// 12186
+
+template map_front12186(fun...)
+{
+    auto map_front12186(Range)(Range r)
+    {
+        return fun[0](r[0]);
+    }
+}
+
+void test12186()
+{
+    immutable int[][] mat;
+
+    mat.map_front12186!((in r) => 0);              // OK
+    mat.map_front12186!((const r) => 0);           // OK
+    mat.map_front12186!((immutable int[] r) => 0); // OK
+    mat.map_front12186!((immutable r) => 0);       // OK <- Error
+}
+
+/******************************************/
+// 12207
+
+void test12207()
+{
+    static struct S
+    {
+        static void f(T)(T) {}
+    }
+
+    immutable S s;
+
+    s.f(1);
+}
+
+/******************************************/
+// 12263
+
+template A12263(alias a) { int x; }
+template B12263(alias a) { int x; }
+
+template fqnSym12263(alias T : B12263!A, alias B12263, A...)
+{
+    enum fqnSym12263 = true;
+}
+
+static assert(fqnSym12263!(A12263!(Object)));
+static assert(fqnSym12263!(B12263!(Object)));
+
+/******************************************/
+// 12290
+
+void test12290()
+{
+    short[] arrS;
+    float[] arrF;
+    double[] arrD;
+    real[] arrR;
+    string cstr;
+    wstring wstr;
+    dstring dstr;
+    short[short] aa;
+
+    auto func1a(E)(E[], E) { return E.init; }
+    auto func1b(E)(E, E[]) { return E.init; }
+
+    static assert(is(typeof(func1a(arrS, 1)) == short));
+    static assert(is(typeof(func1b(1, arrS)) == short));
+    static assert(is(typeof(func1a(arrF, 1.0)) == float));
+    static assert(is(typeof(func1b(1.0, arrF)) == float));
+    static assert(is(typeof(func1a(arrD, 1.0L)) == double));
+    static assert(is(typeof(func1b(1.0L, arrD)) == double));
+    static assert(is(typeof(func1a(arrR, 1)) == real));
+    static assert(is(typeof(func1b(1, arrR)) == real));
+    static assert(is(typeof(func1a("str" , 'a')) == immutable  char));
+    static assert(is(typeof(func1b('a', "str" )) == immutable  char));
+    static assert(is(typeof(func1a("str"c, 'a')) == immutable  char));
+    static assert(is(typeof(func1b('a', "str"c)) == immutable  char));
+    static assert(is(typeof(func1a("str"w, 'a')) == immutable wchar));
+    static assert(is(typeof(func1b('a', "str"w)) == immutable wchar));
+    static assert(is(typeof(func1a("str"d, 'a')) == immutable dchar));
+    static assert(is(typeof(func1b('a', "str"d)) == immutable dchar));
+    static assert(is(typeof(func1a([1,2,3], 1L)) == long));
+    static assert(is(typeof(func1b(1L, [1,2,3])) == long));
+    static assert(is(typeof(func1a([1,2,3], 1.5)) == double));
+    static assert(is(typeof(func1b(1.5, [1,2,3])) == double));
+    static assert(is(typeof(func1a(["a","b"], "s"c)) ==  string));
+    static assert(is(typeof(func1b("s"c, ["a","b"])) ==  string));
+    static assert(is(typeof(func1a(["a","b"], "s"w)) == wstring));
+    static assert(is(typeof(func1b("s"w, ["a","b"])) == wstring));
+    static assert(is(typeof(func1a(["a","b"], "s"d)) == dstring));
+    static assert(is(typeof(func1b("s"d, ["a","b"])) == dstring));
+
+    auto func2a(K, V)(V[K], K, V) { return V[K].init; }
+    auto func2b(K, V)(V, K, V[K]) { return V[K].init; }
+
+    static assert(is(typeof(func2a(aa, 1, 1)) == short[short]));
+    static assert(is(typeof(func2b(1, 1, aa)) == short[short]));
+    static assert(is(typeof(func2a([1:10,2:20,3:30], 1L, 10L)) == long[long]));
+    static assert(is(typeof(func2b(1L, 10L, [1:20,2:20,3:30])) == long[long]));
+
+    auto func3a(T)(T, T) { return T.init; }
+    auto func3b(T)(T, T) { return T.init; }
+
+    static assert(is(typeof(func3a(arrS, null)) == short[]));
+    static assert(is(typeof(func3b(null, arrS)) == short[]));
+    static assert(is(typeof(func3a(arrR, null)) == real[]));
+    static assert(is(typeof(func3b(null, arrR)) == real[]));
+    static assert(is(typeof(func3a(cstr, "str")) ==  string));
+    static assert(is(typeof(func3b("str", cstr)) ==  string));
+    static assert(is(typeof(func3a(wstr, "str")) == wstring));
+    static assert(is(typeof(func3b("str", wstr)) == wstring));
+    static assert(is(typeof(func3a(dstr, "str")) == dstring));
+    static assert(is(typeof(func3b("str", dstr)) == dstring));
+    static assert(is(typeof(func3a("str1" , "str2"c)) ==  string));
+    static assert(is(typeof(func3b("str1"c, "str2" )) ==  string));
+    static assert(is(typeof(func3a("str1" , "str2"w)) == wstring));
+    static assert(is(typeof(func3b("str1"w, "str2" )) == wstring));
+    static assert(is(typeof(func3a("str1" , "str2"d)) == dstring));
+    static assert(is(typeof(func3b("str1"d, "str2" )) == dstring));
+
+    inout(V) get(K, V)(inout(V[K]) aa, K key, lazy V defaultValue) { return V.init; }
+
+    short[short] hash12220;
+    short res12220 = get(hash12220, 1, 1);
+
+    short[short] hash12221;
+    enum Key12221 : short { a }
+    get(hash12221, Key12221.a, Key12221.a);
+
+    int[][string] mapping13026;
+    int[] v = get(mapping13026, "test", []);
+}
+
+/******************************************/
+// 12292
+
+void test12292()
+{
+    void fun(T : string)(T data) {}
+
+    ubyte[3] sa;
+    static assert(!__traits(compiles, fun(sa)));
+    static assert(!__traits(compiles, { alias f = fun!(ubyte[3]); }));
+}
+
+/******************************************/
+// 12376
+
+static auto encode12376(size_t sz)(dchar ch) if (sz > 1)
+{
+    undefined;
+}
+
+void test12376()
+{
+    enum x = __traits(compiles, encode12376!2(x));
+}
+
+/******************************************/
+// 12447
+
+enum   test12447(string str) = str; // [1]
+string test12447(T...)(T args) if (T.length) { return args[0]; }    // [2]
+
+// With [1]: The template parameter str cannot be be deduced -> no match
+// With [2]: T is deduced to a type tuple (string), then match to the function call.
+static assert(test12447("foo") == "foo");
+
+// With [1]: template parameter str is deduced to "bar", then match.
+// With [2]: T is deduced to an expression tuple ("bar"), but it will make invalid the function signature (T args).
+//           The failure should be masked silently and prefer the 1st version.
+static assert(test12447!("bar") == "bar");
+
+/******************************************/
+// 12651
+
+alias TemplateArgsOf12651(alias T : Base!Args, alias Base, Args...) = Args;
+
+struct S12651(T) { }
+
+static assert(!__traits(compiles, TemplateArgsOf12651!(S12651!int, S, float)));
+
+/******************************************/
+// 12719
+
+struct A12719
+{
+    B12719!int b();
+}
+
+struct B12719(T)
+{
+    A12719 a;
+    void m()
+    {
+        auto v = B12719!T.init;
+    }
+}
+
+// --------
+
+enum canDoIt12719(R) = is(typeof(W12719!R));
+
+struct W12719(R)
+{
+    R r;
+    static if (canDoIt12719!R) {}
+}
+
+W12719!int a12719;
+
+/******************************************/
+// 12746
+
+template foo12746()
+{
+    void bar()
+    {
+        static assert(!__traits(compiles, bar(1)));
+    }
+    alias foo12746 = bar;
+}
+
+void foo12746(int)
+{
+    assert(0);
+}
+
+void test12746()
+{
+    foo12746(); // instantiate
+}
+
+/******************************************/
+// 9708
+
+struct S9708
+{
+    void f()(inout(Object)) inout {}
+}
+
+void test9708()
+{
+    S9708 s;
+    s.f(new Object);
+}
+
+/******************************************/
+// 12880
+
+void f12880(T)(in T value) { static assert(is(T == string)); }
+void test12880() { f12880(string.init); }
+
+/******************************************/
+// 13087
+
+struct Vec13087
+{
+    int x;
+    void m()                      { auto n = component13087!(this, 'x'); }
+    void c() const                { auto n = component13087!(this, 'x'); }
+    void w() inout                { auto n = component13087!(this, 'x'); }
+    void wc() inout const         { auto n = component13087!(this, 'x'); }
+    void s() shared               { auto n = component13087!(this, 'x'); }
+    void sc() shared const        { auto n = component13087!(this, 'x'); }
+    void sw() shared inout        { auto n = component13087!(this, 'x'); }
+    void swc() shared inout const { auto n = component13087!(this, 'x'); }
+    void i() immutable            { auto n = component13087!(this, 'x'); }
+}
+
+template component13087(alias vec, char c)
+{
+    alias component13087 = vec.x;
+}
+
+/******************************************/
+// 13127
+
+/+void test13127(inout int = 0)
+{
+                       int []   ma1;
+                 const(int)[]   ca1;
+                 const(int[])   ca2;
+           inout(      int)[]  wma1;
+           inout(      int[])  wma2;
+           inout(const int)[]  wca1;
+           inout(const int[])  wca2;
+             immutable(int)[]   ia1;
+             immutable(int[])   ia2;
+    shared(            int)[]  sma1;
+    shared(            int[])  sma2;
+    shared(      const int)[]  sca1;
+    shared(      const int[])  sca2;
+    shared(inout       int)[] swma1;
+    shared(inout       int[]) swma2;
+    shared(inout const int)[] swca1;
+    shared(inout const int[]) swca2;
+
+    /* In all cases, U should be deduced to top-unqualified type.
+     */
+
+    /* Parameter is (shared) mutable
+     */
+    U f_m(U)(       U) { return null; }
+    U fsm(U)(shared U) { return null; }
+    // 9 * 2 - 1
+    static assert(is(typeof(f_m(  ma1))  ==                    int []));
+    static assert(is(typeof(f_m(  ca1))  ==              const(int)[]));
+    static assert(is(typeof(f_m(  ca2))  ==              const(int)[]));
+    static assert(is(typeof(f_m( wma1))  ==        inout(      int)[]));
+    static assert(is(typeof(f_m( wma2))  ==        inout(      int)[]));
+    static assert(is(typeof(f_m( wca1))  ==        inout(const int)[]));
+    static assert(is(typeof(f_m( wca2))  ==        inout(const int)[]));
+    static assert(is(typeof(f_m(  ia1))  ==          immutable(int)[]));
+    static assert(is(typeof(f_m(  ia2))  ==          immutable(int)[]));
+    static assert(is(typeof(f_m( sma1))  == shared(            int)[]));
+    static assert(is(typeof(f_m( sma2))  == shared(            int)[]));  // <- shared(int[])
+    static assert(is(typeof(f_m( sca1))  == shared(      const int)[]));
+    static assert(is(typeof(f_m( sca2))  == shared(      const int)[]));  // <- shared(const(int)[])
+    static assert(is(typeof(f_m(swma1))  == shared(inout       int)[]));
+    static assert(is(typeof(f_m(swma2))  == shared(inout       int)[]));  // <- shared(inout(int[]))
+    static assert(is(typeof(f_m(swca1))  == shared(inout const int)[]));
+    static assert(is(typeof(f_m(swca2))  == shared(inout const int)[]));  // <- shared(inout(const(int))[])
+    // 9 * 2 - 1
+    static assert(is(typeof(fsm(  ma1))) == false);
+    static assert(is(typeof(fsm(  ca1))) == false);
+    static assert(is(typeof(fsm(  ca2))) == false);
+    static assert(is(typeof(fsm( wma1))) == false);
+    static assert(is(typeof(fsm( wma2))) == false);
+    static assert(is(typeof(fsm( wca1))) == false);
+    static assert(is(typeof(fsm( wca2))) == false);
+    static assert(is(typeof(fsm(  ia1))) == false);
+    static assert(is(typeof(fsm(  ia2))) == false);
+    static assert(is(typeof(fsm( sma1))  == shared(            int)[]));  // <- NG
+    static assert(is(typeof(fsm( sma2))  == shared(            int)[]));
+    static assert(is(typeof(fsm( sca1))  == shared(      const int)[]));  // <- NG
+    static assert(is(typeof(fsm( sca2))  == shared(      const int)[]));
+    static assert(is(typeof(fsm(swma1))  == shared(inout       int)[]));  // <- NG
+    static assert(is(typeof(fsm(swma2))  == shared(inout       int)[]));
+    static assert(is(typeof(fsm(swca1))  == shared(inout const int)[]));  // <- NG
+    static assert(is(typeof(fsm(swca2))  == shared(inout const int)[]));
+
+    /* Parameter is (shared) const
+     */
+    U f_c(U)(       const U) { return null; }
+    U fsc(U)(shared const U) { return null; }
+    // 9 * 2 - 1
+    static assert(is(typeof(f_c(  ma1))  ==                    int []));
+    static assert(is(typeof(f_c(  ca1))  ==              const(int)[]));
+    static assert(is(typeof(f_c(  ca2))  ==              const(int)[]));
+    static assert(is(typeof(f_c( wma1))  ==        inout(      int)[]));
+    static assert(is(typeof(f_c( wma2))  ==        inout(      int)[]));
+    static assert(is(typeof(f_c( wca1))  ==        inout(const int)[]));
+    static assert(is(typeof(f_c( wca2))  ==        inout(const int)[]));
+    static assert(is(typeof(f_c(  ia1))  ==          immutable(int)[]));
+    static assert(is(typeof(f_c(  ia2))  ==          immutable(int)[]));
+    static assert(is(typeof(f_c( sma1))  == shared(            int)[]));
+    static assert(is(typeof(f_c( sma2))  == shared(            int)[]));  // <- shared(int[])
+    static assert(is(typeof(f_c( sca1))  == shared(      const int)[]));
+    static assert(is(typeof(f_c( sca2))  == shared(      const int)[]));  // <- shared(const(int)[])
+    static assert(is(typeof(f_c(swma1))  == shared(inout       int)[]));
+    static assert(is(typeof(f_c(swma2))  == shared(inout       int)[]));  // shared(inout(int)[])
+    static assert(is(typeof(f_c(swca1))  == shared(inout const int)[]));
+    static assert(is(typeof(f_c(swca2))  == shared(inout const int)[]));  // shared(inout(const(int))[])
+    // 9 * 2 - 1
+    static assert(is(typeof(fsc(  ma1))) == false);
+    static assert(is(typeof(fsc(  ca1))) == false);
+    static assert(is(typeof(fsc(  ca2))) == false);
+    static assert(is(typeof(fsc( wma1))) == false);
+    static assert(is(typeof(fsc( wma2))) == false);
+    static assert(is(typeof(fsc( wca1))) == false);
+    static assert(is(typeof(fsc( wca2))) == false);
+    static assert(is(typeof(fsc(  ia1))  ==          immutable(int)[]));  // <- NG
+    static assert(is(typeof(fsc(  ia2))  ==          immutable(int)[]));  // <- NG
+    static assert(is(typeof(fsc( sma1))  == shared(            int)[]));  // <- NG
+    static assert(is(typeof(fsc( sma2))  == shared(            int)[]));
+    static assert(is(typeof(fsc( sca1))  == shared(      const int)[]));  // <- NG
+    static assert(is(typeof(fsc( sca2))  == shared(      const int)[]));
+    static assert(is(typeof(fsc(swma1))  == shared(inout       int)[]));  // <- NG
+    static assert(is(typeof(fsc(swma2))  == shared(inout       int)[]));
+    static assert(is(typeof(fsc(swca1))  == shared(inout const int)[]));  // <- NG
+    static assert(is(typeof(fsc(swca2))  == shared(inout const int)[]));
+
+    /* Parameter is immutable
+     */
+    U fi(U)(immutable U) { return null; }
+    // 9 * 2 - 1
+    static assert(is(typeof(fi(  ma1))) == false);
+    static assert(is(typeof(fi(  ca1))) == false);
+    static assert(is(typeof(fi(  ca2))) == false);
+    static assert(is(typeof(fi( wma1))) == false);
+    static assert(is(typeof(fi( wma2))) == false);
+    static assert(is(typeof(fi( wca1))) == false);
+    static assert(is(typeof(fi( wca2))) == false);
+    static assert(is(typeof(fi(  ia1))  == immutable(int)[]));  // <- NG
+    static assert(is(typeof(fi(  ia2))  == immutable(int)[]));  // <- NG
+    static assert(is(typeof(fi( sma1))) == false);
+    static assert(is(typeof(fi( sma2))) == false);
+    static assert(is(typeof(fi( sca1))) == false);
+    static assert(is(typeof(fi( sca2))) == false);
+    static assert(is(typeof(fi(swma1))) == false);
+    static assert(is(typeof(fi(swma2))) == false);
+    static assert(is(typeof(fi(swca1))) == false);
+    static assert(is(typeof(fi(swca2))) == false);
+
+    /* Parameter is (shared) inout
+     */
+    U f_w(U)(       inout U) { return null; }
+    U fsw(U)(shared inout U) { return null; }
+    // 9 * 2 - 1
+    static assert(is(typeof(f_w(  ma1))  ==              int []));
+    static assert(is(typeof(f_w(  ca1))  ==              int []));  // <- const(int)[]
+    static assert(is(typeof(f_w(  ca2))  ==              int []));  // <- const(int)[]
+    static assert(is(typeof(f_w( wma1))  ==              int []));  // <- inout(int)[]
+    static assert(is(typeof(f_w( wma2))  ==              int []));  // <- inout(int)[]
+    static assert(is(typeof(f_w( wca1))  ==        const(int)[]));  // <- inout(const(int))[]
+    static assert(is(typeof(f_w( wca2))  ==        const(int)[]));  // <- inout(const(int))[]
+    static assert(is(typeof(f_w(  ia1))  ==              int []));  // <- immutable(int)[]
+    static assert(is(typeof(f_w(  ia2))  ==              int []));  // <- immutable(int)[]
+    static assert(is(typeof(f_w( sma1))  == shared(      int)[]));
+    static assert(is(typeof(f_w( sma2))  == shared(      int)[]));  // <- shared(int[])
+    static assert(is(typeof(f_w( sca1))  == shared(      int)[]));  // <- shared(const(int))[]
+    static assert(is(typeof(f_w( sca2))  == shared(      int)[]));  // <- shared(const(int)[])
+    static assert(is(typeof(f_w(swma1))  == shared(      int)[]));  // <- shared(inout(int))[]
+    static assert(is(typeof(f_w(swma2))  == shared(      int)[]));  // <- shared(inout(int)[])
+    static assert(is(typeof(f_w(swca1))  == shared(const int)[]));  // <- shared(inout(const(int)))[]
+    static assert(is(typeof(f_w(swca2))  == shared(const int)[]));  // <- shared(inout(const(int))[])
+    // 9 * 2 - 1
+    static assert(is(typeof(fsw(  ma1))) == false);
+    static assert(is(typeof(fsw(  ca1))) == false);
+    static assert(is(typeof(fsw(  ca2))) == false);
+    static assert(is(typeof(fsw( wma1))) == false);
+    static assert(is(typeof(fsw( wma2))) == false);
+    static assert(is(typeof(fsw( wca1))) == false);
+    static assert(is(typeof(fsw( wca2))) == false);
+    static assert(is(typeof(fsw(  ia1))  ==              int []));  // <- NG
+    static assert(is(typeof(fsw(  ia2))  ==              int []));  // <- NG
+    static assert(is(typeof(fsw( sma1))  ==              int []));  // <- NG
+    static assert(is(typeof(fsw( sma2))  ==              int []));
+    static assert(is(typeof(fsw( sca1))  ==              int []));  // <- NG
+    static assert(is(typeof(fsw( sca2))  ==              int []));  // const(int)[]
+    static assert(is(typeof(fsw(swma1))  ==              int []));  // <- NG
+    static assert(is(typeof(fsw(swma2))  ==              int []));  // inout(int)[]
+    static assert(is(typeof(fsw(swca1))  ==        const(int)[]));  // <- NG
+    static assert(is(typeof(fsw(swca2))  ==        const(int)[]));  // <- inout(const(int))[]
+
+    /* Parameter is (shared) inout const
+     */
+    U f_wc(U)(       inout const U) { return null; }
+    U fswc(U)(shared inout const U) { return null; }
+    // 9 * 2 - 1
+    static assert(is(typeof(f_wc(  ma1))  ==        int []));
+    static assert(is(typeof(f_wc(  ca1))  ==        int []));  // <- const(int)[]
+    static assert(is(typeof(f_wc(  ca2))  ==        int []));  // <- const(int)[]
+    static assert(is(typeof(f_wc( wma1))  ==        int []));  // <- inout(int)[]
+    static assert(is(typeof(f_wc( wma2))  ==        int []));  // <- inout(int)[]
+    static assert(is(typeof(f_wc( wca1))  ==        int []));  // <- inout(const(int))[]
+    static assert(is(typeof(f_wc( wca2))  ==        int []));  // <- inout(const(int))[]
+    static assert(is(typeof(f_wc(  ia1))  ==        int []));  // <- immutable(int)[]
+    static assert(is(typeof(f_wc(  ia2))  ==        int []));  // <- immutable(int)[]
+    static assert(is(typeof(f_wc( sma1))  == shared(int)[]));
+    static assert(is(typeof(f_wc( sma2))  == shared(int)[]));  // <- shared(int[])
+    static assert(is(typeof(f_wc( sca1))  == shared(int)[]));  // <- shared(const(int))[]
+    static assert(is(typeof(f_wc( sca2))  == shared(int)[]));  // <- shared(const(int)[])
+    static assert(is(typeof(f_wc(swma1))  == shared(int)[]));  // <- shared(inout(int))[]
+    static assert(is(typeof(f_wc(swma2))  == shared(int)[]));  // <- shared(inout(int)[])
+    static assert(is(typeof(f_wc(swca1))  == shared(int)[]));  // <- shared(inout(const(int)))[]
+    static assert(is(typeof(f_wc(swca2))  == shared(int)[]));  // <- shared(inout(const(int))[])
+    // 9 * 2 - 1
+    static assert(is(typeof(fswc(  ma1))) == false);
+    static assert(is(typeof(fswc(  ca1))) == false);
+    static assert(is(typeof(fswc(  ca2))) == false);
+    static assert(is(typeof(fswc( wma1))) == false);
+    static assert(is(typeof(fswc( wma2))) == false);
+    static assert(is(typeof(fswc( wca1))) == false);
+    static assert(is(typeof(fswc( wca2))) == false);
+    static assert(is(typeof(fswc(  ia1))  ==        int []));  // <- NG
+    static assert(is(typeof(fswc(  ia2))  ==        int []));  // <- NG
+    static assert(is(typeof(fswc( sma1))  ==        int []));  // <- NG
+    static assert(is(typeof(fswc( sma2))  ==        int []));
+    static assert(is(typeof(fswc( sca1))  ==        int []));  // <- NG
+    static assert(is(typeof(fswc( sca2))  ==        int []));  // <- const(int)[]
+    static assert(is(typeof(fswc(swma1))  ==        int []));  // <- NG
+    static assert(is(typeof(fswc(swma2))  ==        int []));  // <- inout(int)[]
+    static assert(is(typeof(fswc(swca1))  ==        int []));  // <- NG
+    static assert(is(typeof(fswc(swca2))  ==        int []));  // <- inout(const(int))[]
+}+/
+
+void test13127a()
+{
+    void foo(T)(in T[] src, T[] dst) { static assert(is(T == int[])); }
+
+    int[][] a;
+    foo(a, a);
+}
+
+/******************************************/
+// 13159
+
+template maxSize13159(T...)
+{
+    static if (T.length == 1)
+    {
+        enum size_t maxSize13159 = T[0].sizeof;
+    }
+    else
+    {
+        enum size_t maxSize13159 =
+            T[0].sizeof >= maxSize13159!(T[1 .. $])
+                ? T[0].sizeof
+                : maxSize13159!(T[1 .. $]);
+    }
+}
+
+struct Node13159
+{
+    struct Pair
+    {
+        Node13159 value;
+    }
+
+    //alias Algebraic!(Node[], int) Value;
+    enum n = maxSize13159!(Node13159[], int);
+}
+
+/******************************************/
+// 13180
+
+void test13180()
+{
+    inout(V) get1a(K, V)(inout(V[K]) aa, lazy inout(V) defaultValue)
+    {
+        static assert(is(V == string));
+        static assert(is(K == string));
+        return defaultValue;
+    }
+    inout(V) get1b(K, V)(lazy inout(V) defaultValue, inout(V[K]) aa)
+    {
+        static assert(is(V == string));
+        static assert(is(K == string));
+        return defaultValue;
+    }
+
+    inout(V) get2a(K, V)(inout(V)[K] aa, lazy inout(V) defaultValue)
+    {
+        static assert(is(V == string));
+        static assert(is(K == string));
+        return defaultValue;
+    }
+    inout(V) get2b(K, V)(lazy inout(V) defaultValue, inout(V)[K] aa)
+    {
+        static assert(is(V == string));
+        static assert(is(K == string));
+        return defaultValue;
+    }
+    string def;
+    string[string] aa;
+    string s1a = get1a(aa, def);
+    string s1b = get1b(def, aa);
+    string s2a = get2a(aa, def);
+    string s2b = get2b(def, aa);
+}
+
+/******************************************/
+// 13204
+
+struct A13204(uint v)
+{
+    alias whatever = A13204y;
+    static assert(is(whatever == A13204));
+}
+alias A13204x = A13204!1;
+alias A13204y = A13204x;
+
+struct B13204(uint v)
+{
+    alias whatever = B13204z;
+    static assert(is(whatever == B13204));
+}
+alias B13204x = B13204!1;
+alias B13204y = B13204x;
+alias B13204z = B13204y;
+
+void test13204()
+{
+    static assert(is(A13204x == A13204!1));
+    static assert(is(A13204x == A13204!1.whatever));
+    static assert(is(A13204x == A13204y));
+
+    static assert(is(B13204x == B13204!1));
+    static assert(is(B13204x == B13204!1.whatever));
+    static assert(is(B13204x == B13204y));
+    static assert(is(B13204x == B13204z));
+}
+
+/******************************************/
+// 8462 (dup of 13204)
+
+alias FP8462 = void function(C8462.Type arg);
+
+class C8462
+{
+    enum Type { Foo }
+    alias funcPtrPtr = FP8462*;
+}
+
+/******************************************/
+// 13218
+
+template isCallable13218(T...)
+    if (T.length == 1)
+{
+    static assert(0);
+}
+
+template ParameterTypeTuple13218(func...)
+    if (func.length == 1 && isCallable13218!func)
+{
+    static assert(0);
+}
+
+struct R13218
+{
+    private static string mangleFuncPtr(ArgTypes...)()
+    {
+        string result = "fnp_";
+        foreach (T; ArgTypes)
+            result ~= T.mangleof;
+        return result;
+    }
+    void function(int) fnp_i;
+    double delegate(double) fnp_d;
+
+    void opAssign(FnT)(FnT func)
+    {
+        mixin(mangleFuncPtr!( ParameterTypeTuple13218!FnT) ~ " = func;");   // parsed as TypeInstance
+      //mixin(mangleFuncPtr!(.ParameterTypeTuple13218!FnT) ~ " = func;");   // parsed as DotTemplateInstanceExp -> works
+    }
+}
+
+/******************************************/
+// 13219
+
+struct Map13219(V) {}
+
+void test13219a(alias F, VA, VB)(Map13219!VA a, Map13219!VB b)
+if (is(VA : typeof(F(VA.init, VB.init))))
+{}
+
+void test13219b(alias F)()
+{
+    test13219a!((a, b) => b)(Map13219!int.init, Map13219!int.init);
+}
+
+void test13219()
+{
+    int x;
+    test13219b!x();
+}
+
+/******************************************/
+// 13223
+
+void test13223()
+{
+    T[] f1(T)(T[] a1, T[] a2)
+    {
+        static assert(is(T == int));
+        return a1 ~ a2;
+    }
+    T[] f2(T)(T[] a1, T[] a2)
+    {
+        static assert(is(T == int));
+        return a1 ~ a2;
+    }
+    int[] a = [1, 2];
+    static assert(is(typeof(f1(a, [])) == int[]));
+    static assert(is(typeof(f2([], a)) == int[]));
+    static assert(is(typeof(f1(a, null)) == int[]));
+    static assert(is(typeof(f2(null, a)) == int[]));
+
+    T[] f3(T)(T[] a) { return a; }
+    static assert(is(typeof(f3([])) == void[]));
+    static assert(is(typeof(f3(null)) == void[]));
+
+    T f4(T)(T a) { return a; }
+    static assert(is(typeof(f4([])) == void[]));
+    static assert(is(typeof(f4(null)) == typeof(null)));
+
+    T[][] f5(T)(T[][] a) { return a; }
+    static assert(is(typeof(f5([])) == void[][]));
+    static assert(is(typeof(f5(null)) == void[][]));
+
+    void translate(C = immutable char)(const(C)[] toRemove)
+    {
+        static assert(is(C == char));
+    }
+    translate(null);
+}
+
+void test13223a()
+{
+    T f(T)(T, T) { return T.init; }
+
+    immutable i = 0;
+    const c = 0;
+    auto m = 0;
+    shared s = 0;
+
+    static assert(is(typeof(f(i, i)) == immutable int));
+    static assert(is(typeof(f(i, c)) ==     const int));
+    static assert(is(typeof(f(c, i)) ==     const int));
+    static assert(is(typeof(f(i, m)) ==           int));
+    static assert(is(typeof(f(m, i)) ==           int));
+    static assert(is(typeof(f(c, m)) ==           int));
+    static assert(is(typeof(f(m, c)) ==           int));
+    static assert(is(typeof(f(m, m)) ==           int));
+    static assert(is(typeof(f(i, s)) ==    shared int));
+    static assert(is(typeof(f(s, i)) ==    shared int));
+    static assert(is(typeof(f(c, s)) ==    shared int));
+    static assert(is(typeof(f(s, c)) ==    shared int));
+    static assert(is(typeof(f(s, s)) ==    shared int));
+    static assert(is(typeof(f(s, m)) ==           int));
+    static assert(is(typeof(f(m, s)) ==           int));
+}
+
+/******************************************/
+// 13235
+
+struct Tuple13235(T...)
+{
+    T expand;
+    alias expand field;
+
+    this(T values)
+    {
+        field = values;
+    }
+}
+struct Foo13235
+{
+    Tuple13235!(int, Foo13235)* foo;
+}
+
+template Inst13235(T...)
+{
+    struct Tuple
+    {
+        T expand;
+        alias expand field;
+
+        this(T values)
+        {
+            field = values;
+        }
+    }
+    alias Inst13235 = Tuple*;
+}
+struct Bar13235
+{
+    Inst13235!(int, Bar13235) bar;
+}
+
+void test13235()
+{
+    alias Tup1 = Tuple13235!(int, Foo13235);
+    assert(Tup1(1, Foo13235()).expand[0] == 1);
+
+    alias Tup2 = typeof(*Inst13235!(int, Bar13235).init);
+    assert(Tup2(1, Bar13235()).expand[0] == 1);
+}
+
+/******************************************/
+// 13252
+
+alias TypeTuple13252(T...) = T;
+
+static assert(is(typeof(TypeTuple13252!(cast(int )1)[0]) == int ));
+static assert(is(typeof(TypeTuple13252!(cast(long)1)[0]) == long));
+
+static assert(is(typeof(TypeTuple13252!(cast(float )3.14)[0]) == float ));
+static assert(is(typeof(TypeTuple13252!(cast(double)3.14)[0]) == double));
+
+static assert(is(typeof(TypeTuple13252!(cast(cfloat )(1 + 2i))[0]) == cfloat ));
+static assert(is(typeof(TypeTuple13252!(cast(cdouble)(1 + 2i))[0]) == cdouble));
+
+static assert(is(typeof(TypeTuple13252!(cast(string  )null)[0]) == string  ));
+static assert(is(typeof(TypeTuple13252!(cast(string[])null)[0]) == string[]));  // OK <- NG
+
+static assert(is(typeof(TypeTuple13252!(cast(wstring)"abc")[0]) == wstring));
+static assert(is(typeof(TypeTuple13252!(cast(dstring)"abc")[0]) == dstring));
+
+static assert(is(typeof(TypeTuple13252!(cast(int[] )[])[0]) == int[] ));
+static assert(is(typeof(TypeTuple13252!(cast(long[])[])[0]) == long[]));        // OK <- NG
+
+struct S13252 { }
+static assert(is(typeof(TypeTuple13252!(const     S13252())[0]) ==     const(S13252)));
+static assert(is(typeof(TypeTuple13252!(immutable S13252())[0]) == immutable(S13252)));     // OK <- NG
+
+/******************************************/
+// 13294
+
+void test13294()
+{
+    void f(T)(const ref T src, ref T dst)
+    {
+        pragma(msg, "T = ", T);
+        static assert(!is(T == const));
+    }
+    {
+        const byte src;
+              byte dst;
+        f(src, dst);
+    }
+    {
+        const char src;
+              char dst;
+        f(src, dst);
+    }
+
+    // 13351
+    T add(T)(in T x, in T y)
+    {
+        T z;
+        z = x + y;
+        return z;
+    }
+    const double a = 1.0;
+    const double b = 2.0;
+    double c;
+    c = add(a,b);
+}
+
+/******************************************/
+// 13299
+
+struct Foo13299
+{
+    Foo13299 opDispatch(string name)(int a, int[] b...)
+    if (name == "bar")
+    {
+        return Foo13299();
+    }
+
+    Foo13299 opDispatch(string name)()
+    if (name != "bar")
+    {
+        return Foo13299();
+    }
+}
+
+void test13299()
+{
+    Foo13299()
+        .bar(0)
+        .bar(1)
+        .bar(2);
+
+    Foo13299()
+        .opDispatch!"bar"(0)
+        .opDispatch!"bar"(1)
+        .opDispatch!"bar"(2);
+}
+
+/******************************************/
+// 13333
+
+template AliasThisTypeOf13333(T)
+{
+    static assert(0, T.stringof);  // T.stringof is important
+}
+
+template StaticArrayTypeOf13333(T)
+{
+    static if (is(AliasThisTypeOf13333!T AT))
+        alias X = StaticArrayTypeOf13333!AT;
+    else
+        alias X = T;
+
+    static if (is(X : E[n], E, size_t n))
+        alias StaticArrayTypeOf13333 = X;
+    else
+        static assert(0, T.stringof~" is not a static array type");
+}
+
+enum bool isStaticArray13333(T) = is(StaticArrayTypeOf13333!T);
+
+struct VaraiantN13333(T)
+{
+    static if (isStaticArray13333!T)
+        ~this() { static assert(0); }
+}
+
+struct DummyScope13333
+{
+    alias A = VaraiantN13333!C;
+
+    static class C
+    {
+        A entity;
+    }
+}
+
+void test13333()
+{
+    struct DummyScope
+    {
+        alias A = VaraiantN13333!C;
+
+        static class C
+        {
+            A entity;
+        }
+    }
+}
+
+/******************************************/
+// 13374
+
+int f13374(alias a)()  { return 1; }
+int f13374(string s)() { return 2; }
+
+void x13374(int i) {}
+
+void test13374()
+{
+    assert(f13374!x13374() == 1);
+}
+
+/******************************************/
+// 14109
+
+string f14109() { return "a"; }
+string g14109()() { return "a"; }
+
+struct S14109(string s) { static assert(s == "a"); }
+
+alias X14109 = S14109!(f14109);
+alias Y14109 = S14109!(g14109!());
+static assert(is(X14109 == Y14109));
+
+/******************************************/
+// 13378
+
+struct Vec13378(size_t n, T, string as)
+{
+    T[n] data;
+}
+
+void doSome13378(size_t n, T, string as)(Vec13378!(n,T,as) v) {}
+
+void test13378()
+{
+    auto v = Vec13378!(3, float, "xyz")([1,2,3]);
+    doSome13378(v);
+}
+
+/******************************************/
+// 13379
+
+void test13379()
+{
+    match13379("");
+}
+
+auto match13379(RegEx )(RegEx  re)
+if (is(RegEx == Regex13379!char))       // #1 Regex!char (speculative && tinst == NULL)
+{}
+auto match13379(String)(String re)
+{}
+
+struct Regex13379(Char)
+{
+    ShiftOr13379!Char kickstart;        // #2 ShiftOr!char (speculative && tinst == Regex!char)
+}
+struct ShiftOr13379(Char)
+{
+    this(ref Regex13379!Char re)        // #3 Regex!Char (speculative && tinst == ShiftOr!char)
+    {
+        uint n_length;
+        uint idx;
+        n_length = min13379(idx, n_length);
+    }
+}
+
+template MinType13379(T...)
+{
+    alias MinType13379 = T[0];
+}
+MinType13379!T min13379(T...)(T args)   // #4 MinType!uint (speculative && thist == ShiftOr!char)
+{
+    alias a = args[0];
+    alias b = args[$-1];
+    return cast(typeof(return)) (a < b ? a : b);
+}
+
+/******************************************/
+// 13417
+
+struct V13417(size_t N, E, alias string AS)
+{
+}
+
+auto f13417(E)(in V13417!(4, E, "ijka"))
+{
+    return V13417!(3, E, "xyz")();
+}
+
+void test13417()
+{
+    f13417(V13417!(4, float, "ijka")());
+}
+
+/******************************************/
+// 13484
+
+int foo13484()(void delegate() hi) { return 1; }
+int foo13484(T)(void delegate(T) hi) { return 2; }
+
+void test13484()
+{
+    assert(foo13484({}) == 1);          // works
+    assert(foo13484((float v){}) == 2); // works <- throws error
+}
+
+/******************************************/
+// 13675
+
+enum E13675;
+
+bool foo13675(T : E13675)()
+{
+    return false;
+}
+
+void test13675()
+{
+    if (foo13675!E13675)
+    {}
+}
+
+/******************************************/
+// 13694
+
+auto foo13694(T)(string A,         T[] G ...) { return 1; }
+auto foo13694(T)(string A, long E, T[] G ...) { return 2; }
+
+void test13694()
+{
+    struct S {}
+
+    S v;
+    assert(foo13694("A", v) == 1);      // <- OK
+    assert(foo13694("A", 0, v) == 2);   // <- used to be OK but now fails
+    assert(foo13694!S("A", 0, v) == 2); // <- workaround solution
+}
+
+/******************************************/
+// 13760
+
+void test13760()
+{
+    void func(K, V)(inout(V[K]) aa, inout(V) val) {}
+
+    class C {}
+    C[int] aa;
+    func(aa, new C);
+}
+
+/******************************************/
+// 13714
+
+struct JSONValue13714
+{
+    this(T)(T arg)
+    {
+    }
+    this(T : JSONValue13714)(inout T arg) inout
+    {
+        //store = arg.store;
+    }
+
+    void opAssign(T)(T arg)
+    {
+    }
+}
+
+void test13714()
+{
+    enum DummyStringEnum
+    {
+        foo = "bar"
+    }
+
+    JSONValue13714[string] aa;
+    aa["A"] = DummyStringEnum.foo;
+}
+
+/******************************************/
+// 13807
+
+T f13807(T)(inout(T)[] arr)
+{
+    return T.init;
+}
+
+void test13807()
+{
+    static assert(is(typeof(f13807([1, 2, 3])) == int));    // OK
+    static assert(is(typeof(f13807(["a", "b"])) == string));    // OK <- Error
+    static assert(is(typeof(f13807!string(["a", "b"])) == string)); // OK
+}
+
+/******************************************/
+// 14174
+
+struct Config14174(a, b) {}
+
+struct N14174 {}
+
+alias defConfig14174 = Config14174!(N14174, N14174);
+
+void accepter14174a(Config : Config14174!(T) = defConfig14174, T...)()
+{
+    static assert(accepter14174a.mangleof
+        == "_D7breaker131__T14"~
+           "accepter14174a"~
+           "HTS7breaker51__T11Config14174TS7breaker6N14174TS7breaker6N14174Z11Config14174TS7breaker6N14174TS7breaker6N14174Z14"~
+           "accepter14174a"~
+           "FZv");
+}
+
+void accepter14174b(Config : Config14174!(T) = defConfig14174, T...)()
+{
+    static assert(accepter14174b.mangleof
+        == "_D7breaker131__T14"~
+           "accepter14174b"~
+           "HTS7breaker51__T11Config14174TS7breaker6N14174TS7breaker6N14174Z11Config14174TS7breaker6N14174TS7breaker6N14174Z14"~
+           "accepter14174b"~
+           "FZv");
+}
+
+void test14174()
+{
+    accepter14174a!()(); // ok
+    accepter14174b();    // error
+}
+
+/******************************************/
+// 14836
+
+template a14836x(alias B, C...)
+{
+    int a14836x(D...)()    if (D.length == 0) { return 1; }
+    int a14836x(D...)(D d) if (D.length >  0) { return 2; }
+}
+template a14836y(alias B, C...)
+{
+    int a14836y(T, D...)(T t)      if (D.length == 0) { return 1; }
+    int a14836y(T, D...)(T t, D d) if (D.length >  0) { return 2; }
+}
+
+void test14836()
+{
+    int v;
+    assert(a14836x!(v)() == 1);
+    assert(a14836x!(v)(1) == 2);
+    assert(a14836y!(v)(1) == 1);
+    assert(a14836y!(v)(1, 2) == 2);
+}
+
+/******************************************/
+// 14357
+
+template Qux14357(T : U*, U : V*, V)
+{
+    pragma(msg, T);     // no match <- float**
+    pragma(msg, U);     // no match <- float*
+    pragma(msg, V);     // no match <- int
+    enum Qux14357 = T.sizeof + V.sizeof;
+}
+static assert(!__traits(compiles, Qux14357!(float**, int*)));
+
+/******************************************/
+// 14481
+
+template someT14481(alias e)
+{
+    alias someT14481 = e;
+}
+
+mixin template Mix14481(alias e)
+{
+    alias SomeAlias = someT14481!e;
+}
+
+struct Hoge14481
+{
+    mixin Mix14481!e;
+    enum e = 10;
+}
+
+/******************************************/
+// 14520
+
+template M14520(alias  a) { enum M14520 = 1; }
+template M14520(string s) { enum M14520 = 2; }
+
+int f14520a();
+string f14520b() { assert(0); }
+string f14520c() { return "a"; }
+
+static assert(M14520!f14520a == 1);
+static assert(M14520!f14520b == 1);
+static assert(M14520!f14520c == 1);
+
+/******************************************/
+// 14568
+
+struct Interval14568()
+{
+    auto left = INVALID;
+
+    auto opAssign()(Interval14568) { left; }
+}
+
+auto interval14568(T)(T point)
+{
+    Interval14568!();
+}
+
+alias Instantiate14568(alias symbol, Args...) = symbol!Args;
+
+template Match14568(patterns...)
+{
+    static if (__traits(compiles, Instantiate14568!(patterns[0])))
+    {
+        alias Match14568 = patterns[0];
+    }
+    else static if (patterns.length == 1)
+    {}
+}
+
+template SubOps14568(Args...)
+{
+    auto opIndex()
+    {
+        template IntervalType(T...)
+        {
+            alias Point() = typeof(T.interval14568);
+
+            alias IntervalType = Match14568!(Point);
+        }
+        alias Subspace = IntervalType!(Args);
+    }
+}
+
+struct Nat14568 { mixin SubOps14568!(null); }
+
+/******************************************/
+// 14735
+
+enum CS14735 { yes, no }
+
+int indexOf14735a(Range      )(Range    s, in dchar c) { return 1; }
+int indexOf14735a(T, size_t n)(ref T[n] s, in dchar c) { return 2; }
+
+int indexOf14735b(Range      )(Range    s, in dchar c, in CS14735 cs = CS14735.yes) { return 1; }
+int indexOf14735b(T, size_t n)(ref T[n] s, in dchar c, in CS14735 cs = CS14735.yes) { return 2; }
+
+void test14735()
+{
+    char[64] buf;
+
+    // Supported from 2.063: (http://dlang.org/changelog#implicitarraycast)
+    assert(indexOf14735a(buf[0..32], '\0') == 2);
+    assert(indexOf14735b(buf[0..32], '\0') == 2);
+
+    // Have to work as same as above.
+    assert(indexOf14735a(buf[], '\0') == 2);
+    assert(indexOf14735b(buf[], '\0') == 2);
+}
+
+/******************************************/
+// 14743
+
+class A14743
+{
+    auto func1 = (A14743 a) { a.func2!int(); };
+    auto func2(T)() {}
+}
+
+/******************************************/
+// 14802
+
+void test14802()
+{
+    auto func(T)(T x, T y) { return x; }
+
+    struct S1 { double x; alias x this; }
+    struct S2 { double x; alias x this; }
+    S1 s1;
+    S2 s2;
+
+    enum E1 : double { a = 1.0 }
+    enum E2 : double { a = 1.0 }
+
+    static assert(is(typeof( func(1 , 1 ) ) == int));
+    static assert(is(typeof( func(1u, 1u) ) == uint));
+    static assert(is(typeof( func(1u, 1 ) ) == uint));
+    static assert(is(typeof( func(1 , 1u) ) == uint));
+
+    static assert(is(typeof( func(1.0f, 1.0f) ) == float));
+    static assert(is(typeof( func(1.0 , 1.0 ) ) == double));
+    static assert(is(typeof( func(1.0 , 1.0f) ) == double));
+    static assert(is(typeof( func(1.0f, 1.0 ) ) == double));
+
+    static assert(is(typeof( func(s1, s1) ) == S1));
+    static assert(is(typeof( func(s2, s2) ) == S2));
+    static assert(is(typeof( func(s1, s2) ) == double));
+    static assert(is(typeof( func(s2, s1) ) == double));
+
+    static assert(is(typeof( func(E1.a, E1.a) ) == E1));
+    static assert(is(typeof( func(E2.a, E2.a) ) == E2));
+    static assert(is(typeof( func(E1.a, 1.0)  ) == double));
+    static assert(is(typeof( func(E2.a, 1.0)  ) == double));
+    static assert(is(typeof( func(1.0,  E1.a) ) == double));
+    static assert(is(typeof( func(1.0,  E2.a) ) == double));
+    static assert(is(typeof( func(E1.a, E2.a) ) == double));
+    static assert(is(typeof( func(E2.a, E1.a) ) == double));
+}
+
+/******************************************/
+// 14886
+
+void test14886()
+{
+    alias R = int[100_000];
+
+    auto front(T)(T[] a) {}
+    front(R.init);
+
+    auto bar1(T)(T, T[] a) { return T.init; }
+    auto bar2(T)(T[] a, T) { return T.init; }
+
+    static assert(is(typeof(bar1(1L, R.init)) == long));
+    static assert(is(typeof(bar2(R.init, 1L)) == long));
+    // <-- T should be deduced to int because R.init is rvalue...?
+
+    ubyte x;
+    static assert(is(typeof(bar1(x, R.init)) == int));
+    static assert(is(typeof(bar2(R.init, x)) == int));
+}
+
+/******************************************/
+// 15156
+
+// 15156
+auto f15116a(T)(string s, string arg2) { return 1; }
+auto f15116b(T)(int    i, string arg2) { return 2; }
+
+template bish15116(T)
+{
+    alias bish15116 = f15116a!T;
+    alias bish15116 = f15116b!T;
+}
+
+void test15116()
+{
+    alias func = bish15116!string;
+    assert(func("", "") == 1);
+    assert(func(12, "") == 2);
+}
+
+/******************************************/
+// 15152
+
+void test15152()
+{
+    void func(string M)() { }
+
+    struct S
+    {
+        enum name = "a";
+    }
+
+    enum s = S.init;
+    func!(s.name);
+}
+
+/******************************************/
+// 15352
+
+struct S15352(T, T delegate(uint idx) supplier)
+{
+}
+
+auto make15352a(T, T delegate(uint idx) supplier)()
+{
+    enum local = supplier;      // OK
+    S15352!(T, local) ret;
+    return ret;
+}
+
+auto make15352b(T, T delegate(uint idx) supplier)()
+{
+    S15352!(T, supplier) ret;   // OK <- Error
+    return ret;
+}
+
+void test15352()
+{
+    enum dg = delegate(uint idx) => idx;
+    auto s1 = S15352!(uint, dg)();
+    auto s2 = make15352a!(uint, dg)();
+    auto s3 = make15352b!(uint, dg)();
+    assert(is(typeof(s1) == typeof(s2)));
+    assert(is(typeof(s1) == typeof(s3)));
+}
+
+/******************************************/
+// 15623
+
+struct WithFoo15623a { void foo() {} }
+struct WithFoo15623b { void foo() {} }
+struct WithFoo15623c { void foo() {} }
+struct WithFoo15623d { void foo() {} }
+
+struct WithoutFoo15623a {}
+struct WithoutFoo15623b {}
+struct WithoutFoo15623c {}
+struct WithoutFoo15623d {}
+
+struct CallsFoo15623(T)
+{
+    T t;
+    void bar() { t.foo(); }     // error occurs during TemplateInstance.semantic3
+}
+
+// Instantiations outside of function bodies
+static assert( is(CallsFoo15623!WithFoo15623a));
+static assert(!is(CallsFoo15623!WithoutFoo15623a));                     // OK <- NG
+static assert( __traits(compiles, CallsFoo15623!WithFoo15623b));
+static assert(!__traits(compiles, CallsFoo15623!WithoutFoo15623b));     // OK <- NG
+
+// Instantiations inside function bodies (OK)
+static assert( is(typeof({ alias Baz = CallsFoo15623!WithFoo15623c; return Baz.init; }())));
+static assert(!is(typeof({ alias Baz = CallsFoo15623!WithoutFoo15623c; return Baz.init; }())));
+static assert( __traits(compiles, { alias Baz = CallsFoo15623!WithFoo15623d; return Baz.init; }()));
+static assert(!__traits(compiles, { alias Baz = CallsFoo15623!WithoutFoo15623d; return Baz.init; }()));
+
+/******************************************/
+// 15781
+
+void test15781()
+{
+    static struct S
+    {
+        int value;
+    }
+
+    T foo(T)(T a, T b)
+    {
+        return T();
+    }
+
+    const S cs;
+          S ms;
+    static assert(is(typeof(foo(ms, ms)) ==       S));
+    static assert(is(typeof(foo(ms, cs)) == const S));
+    static assert(is(typeof(foo(cs, ms)) == const S));
+    static assert(is(typeof(foo(cs, cs)) == const S));
+}
+
+/******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test1780();
+    test3608();
+    test5893();
+    test6404();
+    test2246();
+    test2296();
+    bug4984();
+    test2579();
+    test2803();
+    test6613();
+    test5886();
+    test5393();
+    test5896();
+    test6825();
+    test6789();
+    test2778();
+    test2778aa();
+    test2778get();
+    test6208a();
+    test6208b();
+    test6208c();
+    test6738();
+    test6780();
+    test6810();
+    test6891();
+    test6994();
+    test6764();
+    test3467();
+    test4413();
+    test5525();
+    test5801();
+    test10();
+    test7037();
+    test7124();
+    test7359();
+    test7416();
+    test7563();
+    test7572();
+    test7580();
+    test7585();
+    test7671();
+    test7672();
+    test7684();
+    test11a();
+    test11b();
+    test7769();
+    test7873();
+    test7933();
+    test8094();
+    test12();
+    test8125();
+    test13();
+    test14();
+    test8129();
+    test8238();
+    test8669();
+    test8833();
+    test8976();
+    test8940();
+    test9022();
+    test9026();
+    test9038();
+    test9076();
+    test9100();
+    test9124a();
+    test9124b();
+    test9143();
+    test9266();
+    test9536();
+    test9578();
+    test9596();
+    test9837();
+    test9874();
+    test9885();
+    test9971();
+    test9977();
+    test10083();
+    test10592();
+    test11242();
+    test10811();
+    test10969();
+    test11271();
+    test11533();
+    test11818();
+    test11843();
+    test11872();
+    test12122();
+    test12207();
+    test12376();
+    test13235();
+    test13294();
+    test13299();
+    test13374();
+    test13378();
+    test13379();
+    test13484();
+    test13694();
+    test14836();
+    test14735();
+    test14802();
+    test15116();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test10.d b/gcc/testsuite/gdc.test/runnable/test10.d
new file mode 100644
index 00000000000..671a61a661e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test10.d
@@ -0,0 +1,13 @@
+// EXTRA_SOURCES: imports/test10a.d
+
+import imports.test10a;
+
+extern(C) int printf(const char*, ...);
+
+int main()
+{
+    imports.test10a.init();
+    printf("it is %d\n", it[0]);
+    assert(it[0] == 32);
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test10378.d b/gcc/testsuite/gdc.test/runnable/test10378.d
new file mode 100644
index 00000000000..f83ece18bbf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test10378.d
@@ -0,0 +1,13 @@
+
+int writeln() { return 3; }
+
+struct S {
+    import imports.bar10378;
+    void abc() { assert(writeln() == 3); }
+}
+
+
+void main() {
+    S s;
+    s.abc();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test10441.d b/gcc/testsuite/gdc.test/runnable/test10441.d
new file mode 100644
index 00000000000..6dc24eac0ff
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test10441.d
@@ -0,0 +1,10 @@
+// EXTRA_SOURCES: imports/test10441b.d imports/test10441c.d
+
+import test10441b;
+
+void main()
+{
+    boo(1);
+    foo();
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test10573.d b/gcc/testsuite/gdc.test/runnable/test10573.d
new file mode 100644
index 00000000000..53013443a21
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test10573.d
@@ -0,0 +1,4 @@
+// EXTRA_SOURCES: imports/test10573a.d
+
+import imports.test10573a;
+void main(string[] args) {}
diff --git a/gcc/testsuite/gdc.test/runnable/test10736.d b/gcc/testsuite/gdc.test/runnable/test10736.d
new file mode 100644
index 00000000000..373b536129b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test10736.d
@@ -0,0 +1,4 @@
+// EXTRA_SOURCES: imports/test10736a.d imports/test10736b.d
+
+import imports.test10736a;
+import imports.test10736b;
diff --git a/gcc/testsuite/gdc.test/runnable/test10942.d b/gcc/testsuite/gdc.test/runnable/test10942.d
new file mode 100644
index 00000000000..f85b4c9b9c8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test10942.d
@@ -0,0 +1,26 @@
+// REQUIRED_ARGS: -g
+
+import std.string;
+
+string getEnum(size_t count)
+{
+    string en;
+    en ~= "enum KeyCode\n {    \n";
+
+    foreach (i; 0 .. count)
+    {
+        en ~= format("    memb_%s = %s,\n", i+1, i+1);
+    }
+
+    en ~= "} ";
+    return en;
+}
+
+// Linker warning: Warning 161: Unknown CV version, ignored
+// mixin(getEnum(1024));
+
+// ICE
+mixin(getEnum(1087));
+
+void main() { }
+
diff --git a/gcc/testsuite/gdc.test/runnable/test11.d b/gcc/testsuite/gdc.test/runnable/test11.d
new file mode 100644
index 00000000000..5b21ba0fa51
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test11.d
@@ -0,0 +1,1392 @@
+// REQUIRED_ARGS:
+
+extern(C) int printf(const char*, ...);
+extern(C) size_t strlen(const char*);
+
+/**************************************/
+
+alias strlen foo1;
+
+void test1()
+{
+    const(char) *p = "bar";
+    size_t i = foo1(p);
+    assert(i == 3);
+}
+
+/**************************************/
+
+template Foo2(T)
+{
+    alias T t;
+}
+
+alias Foo2!(int) t1;
+alias Foo2!(int).t t2;
+alias t1.t t3;
+alias t2 t4;
+alias Foo2!(int) t5;
+
+void test2()
+{
+    t1.t v1;
+    t2 v2;
+    t3 v3;
+    t4 v4;
+    t5.t v5;
+    int *p;
+
+    p = &v1;
+    p = &v2;
+    p = &v3;
+    p = &v4;
+    p = &v5;
+}
+
+
+/**************************************/
+
+debug = stdchar;
+
+debug(mychar)
+{
+    alias byte mychar;
+}
+
+void test3()
+{
+    debug(mychar)
+    {
+    mychar[] line=cast(mychar[])cast(char[])"It is a long line.";
+    mychar[] delimiter=cast(mychar[])cast(string)"is";
+    }
+
+    debug(stdchar)
+    {
+    string line="It is a long line.";
+    string delimiter="is";
+    }
+
+    debug(stdbyte)
+    {
+    byte[] line=cast(byte[])cast(string)"It is a long line.";
+    byte[] delimiter=cast(byte[])cast(string)"is";
+    }
+
+    debug(stdwchar)
+    {
+    wstring line="It is a long line.";
+    wstring delimiter="is";
+    }
+    int ptr=3;
+
+    size_t dl=delimiter.length;
+    size_t pl=ptr+dl;
+
+    assert(line[ptr..pl]==delimiter[]);
+}
+
+
+/**************************************/
+
+void test4()
+{
+    byte* p;
+
+    version(D_LP64)
+        assert(p.sizeof == 8);
+    else
+        assert(p.sizeof == 4);
+}
+
+
+/**************************************/
+
+
+class Foo6
+{
+}
+
+void test6()
+{
+    Foo6 foo = new Foo6();
+
+     with (foo)
+     {
+         int x;
+
+         x = 4;
+     }
+}
+
+/**************************************/
+
+int i7 = 3;
+
+void test7()
+{
+    switch (i7)
+    {
+    default: assert(0);
+    case 3:
+        int x;
+
+        x = 4;
+    }
+}
+
+/**************************************/
+
+void test8()
+{
+    string a = "a
+b
+c";
+    assert(a.length == 5);
+    assert(a[1] == '\n');
+}
+
+/**************************************/
+
+
+struct Foo9 { char c; char bar() { return c; } }
+
+Foo9 makeFoo() { Foo9 f; return f; }
+
+void callFoo (Foo9 a)
+{
+    a.bar();
+}
+
+void test9()
+{
+    callFoo(makeFoo ());
+}
+
+/**************************************/
+
+
+struct Foo10 { }
+
+Foo10 makeFoo10() { Foo10 f; return f; }
+
+void callFoo (Foo10 a)
+{
+}
+
+void test10()
+{
+    callFoo(makeFoo10());
+}
+
+/**************************************/
+
+struct Color
+{ int x; }
+
+Color[3] colors;
+
+Color eval(float x, float y)
+{
+    colors[1].x = 7;
+    return colors[1];
+}
+
+void test11()
+{
+    Color c;
+
+    c = eval(1.0, 2.0);
+    assert(c.x == 7);
+}
+
+/**************************************/
+
+struct Size12
+{
+  int width;
+  int height;
+}
+
+int x12;
+
+void foo12(out Size12 sz)
+{
+  sz.width = 2;
+
+  if(sz.width == 2)
+    x12 = 1;
+}
+
+
+void test12()
+{
+  Size12 sz;
+
+  foo12(sz);
+  assert(x12 == 1);
+  assert(sz.width == 2);
+}
+
+/**************************************/
+
+
+interface D13
+{
+    void setHostFrame();
+}
+
+class A13 : D13
+{
+    void setHostFrame()
+    {
+    }
+
+    char         group;
+}
+
+
+void setLayout(D13 lo)
+{
+    printf("lo = %p\n", lo);
+    lo.setHostFrame();
+    printf("ok\n");
+}
+
+
+void test13()
+{
+    A13 a = new A13();
+    printf("a  = %p\n", a);
+    setLayout(a);
+}
+
+/**************************************/
+
+void test14()
+{
+    while(false)
+    {
+        static int a;
+    }
+}
+
+
+/**************************************/
+
+alias void delegate(int) t_func;
+
+class Foo15
+{
+   t_func func1;
+   int x;
+
+   void dothis()
+   {
+     if (func1)
+        func1(4);
+     else
+        x = 3;
+   }
+
+   void func(int num) { x = num; }
+}
+
+void test15()
+{
+   Foo15 a = new Foo15;
+   a.dothis();
+   assert(a.x == 3);
+   a.func1 = &a.func;
+   a.dothis();
+   assert(a.x == 4);
+}
+
+
+/**************************************/
+
+int[] foo16(byte[] a)
+{
+    return cast(int[])a;
+}
+
+void test16()
+{
+    byte[12] b;
+    int[] i;
+
+    i = foo16(b);
+    assert(i.length == 3);
+}
+
+/**************************************/
+
+void test17()
+{
+  {
+    float x = 10;
+    x %= 4;
+    printf("x = %g\n", x);
+    assert(x == 2);
+    x = 10;
+    x = x % 4;
+    printf("x = %g\n", x);
+    assert(x == 2);
+    x = 4;
+    x = 10 % x;
+    printf("x = %g\n", x);
+    assert(x == 2);
+  }
+  {
+    double y = 10;
+    y %= 4;
+    printf("y = %g\n", y);
+    assert(y == 2);
+    y = 10;
+    y = y % 4;
+    printf("y = %g\n", y);
+    assert(y == 2);
+    y = 4;
+    y = 10 % y;
+    printf("y = %g\n", y);
+    assert(y == 2);
+  }
+  {
+    real z = 10;
+    z %= 4;
+    printf("z = %Lg\n", z);
+    assert(z == 2);
+    z = 10;
+    z = z % 4;
+    printf("z = %Lg\n", z);
+    assert(z == 2);
+    z = 4;
+    z = 10 % z;
+    printf("z = %Lg\n", z);
+    assert(z == 2);
+  }
+}
+
+
+/**************************************/
+
+struct Bar18 { }
+
+struct Foo18
+{
+     static Bar18 x = { };
+}
+
+void test18()
+{
+     const Bar18 b = Foo18.x;
+}
+
+
+/**************************************/
+
+int x19 = 10;
+
+void test19()
+{   bool b;
+
+    b = cast(bool)x19;
+    assert(b == true);
+}
+
+/**************************************/
+
+class A20
+{
+  int abc() { return 3; }
+
+  alias abc def;
+}
+
+void test20()
+{
+    int i;
+    A20 a = new A20();
+
+    i = a.def();
+    assert(i == 3);
+}
+
+
+/**************************************/
+
+void test21()
+{
+    string s;
+    s = 1 ? "a" : "b";
+    assert(s == "a");
+}
+
+/**************************************/
+
+class Foo22
+{
+}
+
+class Bar22 : Foo22
+{
+}
+
+class Abc22
+{
+    Foo22 test() { return null; }
+}
+
+class Def22 : Abc22
+{
+    override Bar22 test() { return new Bar22; }
+}
+
+void testx22(Abc22 a)
+{
+    assert(a.test() !is null);
+}
+
+void test22()
+{
+    Def22 d = new Def22();
+
+    testx22(d);
+}
+
+/**************************************/
+
+struct foo23
+{
+   static struct bar
+   {
+      int x;
+   }
+}
+
+void test23()
+{
+   //printf ("%d\n", foo23.bar.sizeof);
+   assert(foo23.bar.sizeof == int.sizeof);
+}
+
+
+/**************************************/
+
+void test24()
+{
+  struct Test
+  {
+    int i;
+
+    bool bar(int a)
+    {
+      i = a;
+      return true;
+    }
+  }
+
+  Test t;
+  assert(t.bar(3));
+}
+
+
+/**************************************/
+
+void test25()
+{
+    {   const int [] list = [ 1, 2 ];
+      assert(list[0] == 1);
+      assert(list[1] == 2);
+    }
+
+    {   const int [] list = [ 3, 4 ];
+      assert(list[0] == 3);
+      assert(list[1] == 4);
+    }
+}
+
+
+/**************************************/
+
+void test26()
+{
+   while (0)
+   {
+      int x;
+   }
+
+   while (0)
+   {
+      int x;
+   }
+}
+
+
+/**************************************/
+
+struct NODE27 {
+    int data;
+    shared(NODE27) *next;
+}
+
+static shared NODE27 nodetbl[3] =
+[
+    {   0,cast(shared(NODE27)*)nodetbl + 1},
+    {   0,cast(shared(NODE27)*)nodetbl + 2},
+    {   0,null}
+];
+
+static shared NODE27 nodetbl2[3] = [
+    {   0,&nodetbl2[1]},
+    {   0,&nodetbl2[2]},
+    {   0,null}
+];
+
+void test27()
+{
+}
+
+
+/**************************************/
+
+class Foo28
+{
+    protected int x;
+
+    static class Bar
+    {
+       Foo28 f;
+
+       int method () { return f.x; }
+    }
+}
+
+void test28()
+{
+}
+
+
+/**************************************/
+
+void test29()
+{
+  int[immutable(byte)[]] foo;
+
+  static immutable(byte)[] bar = [ 65, 66, 67 ];
+
+  foo[bar] = 1;
+  assert(foo[bar] == 1);
+}
+
+/**************************************/
+
+class A30
+{
+   static class Child
+   {
+   }
+}
+
+
+class B30
+{
+   static class Child
+   {
+      static int value = 6;
+   }
+}
+
+void test30()
+{
+   printf ("%d\n", B30.Child.value);
+   assert(B30.Child.value == 6);
+}
+
+
+/**************************************/
+
+void test31()
+{
+    float b;
+    b -= 1.0;
+    b += 1.0;
+}
+
+/**************************************/
+
+class Foo32
+{
+    struct Bar
+    {
+        int x;
+    }
+}
+
+void test32()
+{
+    with (new Foo32)
+    {
+        Bar z;
+        z.x = 5;
+    }
+}
+
+
+/**************************************/
+
+string[2][] foo33;
+
+void test33()
+{
+    string[2] bar;
+
+    bar[1] = "hello";
+    foo33 ~= bar;
+    assert(foo33[0][1] == "hello");
+}
+
+
+/**************************************/
+
+
+void test34()
+{
+ try {
+  int i = 0;
+  printf( "i:%d\n", i );
+ } finally {
+  printf( "Done\n" );
+ }
+ try {
+  int i = 1;
+  printf( "i:%d\n", i );
+ } finally {
+  printf( "Done\n" );
+ }
+}
+
+
+/**************************************/
+
+class Bar35 {}
+
+template Foo35( T )
+{
+    void func() { };
+}
+
+void test35()
+{
+ try {
+  alias Foo35!( Bar35 ) filter;
+ } catch (Exception e) {
+  printf( "Exception %.*s", e.msg.length, e.msg.ptr );
+ } finally {
+  printf( "Done0." );
+ }
+}
+
+
+/**************************************/
+
+void test36()
+{
+    enum {A=1}
+    enum {B=A?0:1}
+    assert(A == 1);
+    assert(B == 0);
+}
+
+/**************************************/
+
+struct A37
+{
+    int a;
+}
+
+struct B37
+{
+    int a;
+    int b;
+}
+
+struct C37
+{
+    int a;
+    int b;
+    int c;
+}
+
+struct D37
+{
+    byte a,b,c;
+}
+
+void test37()
+{
+    A37 a;
+    B37 b;
+    C37 c;
+    D37 d;
+
+    assert(a.a == 0);
+    assert(b.a == 0 && b.b == 0);
+    assert(c.a == 0 && c.b == 0 && c.c == 0);
+    assert(d.a == 0 && d.b == 0 && d.c == 0);
+}
+
+
+/**************************************/
+
+int function() fp18;
+
+extern(Windows) int func18()
+{
+    static int otherfunc()
+    {   return 18; }
+
+    fp18 = &otherfunc;
+    return fp18();
+}
+
+void test38()
+{
+    assert(func18() == 18);
+}
+
+
+/**************************************/
+
+class bar39
+{
+  struct _sub
+  {
+    bool a;
+    string d;
+  };
+  _sub mySub;
+};
+
+class foo39
+{
+  bar39._sub[] subArray;
+
+  this(bar39[] arr)
+  {
+    for(int i=0; i<arr.length; i++)
+      subArray ~= arr[i].mySub;
+  };
+};
+
+
+void test39()
+{
+}
+
+
+/**************************************/
+
+void test40()
+{
+    void* h;
+
+    h = h.init;
+    assert(h == cast(void*)0);
+}
+
+/**************************************/
+
+int test41()
+{
+ label:
+ int foo;
+ foo = 0;
+ return foo;
+}
+
+
+/**************************************/
+
+struct A42
+{
+    invariant()
+    {
+    }
+
+    B42 *findPool()
+    {
+        return null;
+    }
+
+}
+
+struct B42
+{
+    int cmp(B42 *p2)
+    {
+        return 0;
+    }
+}
+
+void test42()
+{
+}
+
+
+/**************************************/
+
+void test43()
+{
+    real a = 0.9;
+    ulong b = cast(ulong) a;
+    printf("%u", cast(uint) b);
+    assert(cast(uint) b == 0);
+
+    int c = cast(int) a;
+    printf("%i", c);
+    assert(c == 0);
+}
+
+
+/**************************************/
+
+void test44()
+{
+   switch("asdf")
+   {
+   case "asdf":
+     printf("asdf\n");
+     break;
+
+
+   case "jkl":
+     printf("jkl\n");
+     assert(0);
+     break;
+
+
+   default:
+     printf("default\n");
+     assert(0);
+   }
+}
+
+
+/**************************************/
+
+void func45(string a)
+{
+    assert(a.length == 5);
+}
+
+void test45()
+{
+    char[5] foo;
+
+    foo[] = "hello";
+    printf("'%.*s'\n", foo.length, foo.ptr);
+    func45(cast(string)foo);
+}
+
+/**************************************/
+
+struct Foo46
+{
+    int x;
+}
+
+void test46()
+{
+    Foo46 f;
+
+    with (f)
+    {
+        x = 3;
+    }
+    assert(f.x == 3);
+}
+
+/**************************************/
+
+struct Bar48
+{
+    uint k;
+    ubyte m;
+}
+
+Bar48 makebar48() { Bar48 b; return b; }
+
+void test48()
+{
+    Bar48 b = makebar48();
+}
+
+/**************************************/
+
+void testx49() { printf("testx49()\n"); }
+
+void test49() { return testx49(); }
+
+/**************************************/
+
+int testx50() { printf("testx50()\n"); return 3; }
+
+void test50() { return cast(void)testx50(); }
+
+/**************************************/
+
+class A51
+{
+    static typeof(this) foo()
+    {
+        return new A51();
+    }
+
+    this()
+    {
+        bar = 3;
+    }
+
+    int bar;
+}
+
+class B51 : A51
+{
+    static typeof(super) b;
+}
+
+struct C51
+{
+    typeof(&this) x;
+}
+
+void test51()
+{
+    A51 a = A51.foo();
+    assert(a.bar == 3);
+
+    B51.b = a;
+    assert(B51.b.bar == 3);
+    assert(B51.b.classinfo == A51.classinfo);
+
+    C51 c;
+    c.x = &c;
+}
+
+
+/**************************************/
+
+class A52
+{
+    char get() { return 'A'; }
+
+    char foo() { return typeof(this).get(); }
+    char bar() { return A52.get(); }
+}
+
+class B52 : A52
+{
+    override char get() { return 'B'; }
+}
+
+void test52()
+{
+    B52 b = new B52();
+
+    assert(b.foo() == 'A');
+    assert(b.bar() == 'A');
+    assert(b.get() == 'B');
+}
+
+/**************************************/
+
+struct A53
+{
+    int b() { return 1; }
+}
+
+int x53()
+{
+    A53 a;
+    return a.b;
+}
+
+void test53()
+{
+    assert(x53() == 1);
+}
+
+/**************************************/
+
+class A54
+{
+    void a()
+    {
+        printf("A54.a\n");
+    }
+
+    void b()
+    {
+        typeof(this).a();
+    }
+}
+
+class B54 : A54
+{
+    override void a()
+    {
+        printf("B54.a\n");
+        assert(0);
+    }
+}
+
+void test54()
+{
+    B54 b = new B54();
+
+    b.b();
+}
+
+
+/**************************************/
+
+int foo55(int x = 5)
+{
+    printf("x = %d\n", x);
+    return x;
+}
+
+void test55()
+{   int i;
+
+    i = foo55(6);
+    assert(i == 6);
+    i = foo55();
+    assert(i == 5);
+}
+
+/**************************************/
+
+class A56
+{
+    int foo(int x = 5)
+    {
+        printf("A56.x = %d\n", x);
+        return x;
+    }
+}
+
+class B56 : A56
+{
+    override int foo(int x = 7)
+    {
+        printf("B56.x = %d\n", x);
+        return x;
+    }
+}
+
+
+void test56()
+{   int i;
+    B56 b = new B56();
+
+    i = b.foo(6);
+    assert(i == 6);
+    i = b.foo();
+    assert(i == 7);
+}
+
+
+/**************************************/
+
+void test57()
+{
+    char c;
+    wchar w;
+    dchar d;
+
+    printf("c = %x, w = %x, d = %x\n", c, w, d);
+    assert(c == 0xFF);
+    assert(w == 0xFFFF);
+    assert(d == 0xFFFF);
+}
+
+/**************************************/
+
+void test58()
+{
+    static int x;
+
+    static class S
+    {
+        static this()
+        {
+            printf ("static constructor\n");
+            x = 10;
+        }
+
+        this()
+        {
+            printf ("class constructor\n");
+        }
+    }
+
+    assert(x == 10);
+    new S;
+}
+
+/**************************************/
+
+struct S61 {
+    int a, b, c, d;
+}
+
+void rec(int n, S61 t)
+{
+ if (n > 0) {
+  t.b++;
+  rec(n-1,t);
+ }
+}
+
+void test61()
+{
+    S61 F;
+
+    rec(100, F);
+}
+
+/**************************************/
+
+class A62
+{
+    static A62 test(int q=0) {
+        return null;
+    }
+}
+
+A62 foo62()
+{
+    return A62.test;
+}
+
+void test62()
+{
+    foo62();
+}
+
+
+/**************************************/
+
+class A63
+{
+     private import std.file;
+     alias std.file.getcwd getcwd;
+}
+
+void test63()
+{
+     A63 f = new A63();
+     auto s = f.getcwd();
+     printf("%.*s\n", s.length, s.ptr);
+}
+
+
+/**************************************/
+
+debug = 3;
+
+void test64()
+{
+    debug(5)
+    {
+        assert(0);
+    }
+    debug(3)
+    {
+        int x = 3;
+    }
+    assert(x == 3);
+}
+
+/**************************************/
+
+version = 3;
+
+void test65()
+{
+    version(5)
+    {
+        assert(0);
+    }
+    version(3)
+    {
+        int x = 3;
+    }
+    assert(x == 3);
+}
+
+/**************************************/
+// 8809
+
+void test8809()
+{
+    static class B
+    {
+        char foo() { return 'B'; }
+    }
+    static class C : B
+    {
+        char test1Bx() { return B.foo(); }
+        char test1Cx() { return C.foo(); }
+        char test1Dx() { return   foo(); }
+        char test1By() { return this.B.foo(); }
+        char test1Cy() { return this.C.foo(); }   // cannot compile -> OK
+        char test1Dy() { return this.  foo(); }
+        char test1Bz() { return typeof(super).foo(); }
+        char test1Cz() { return typeof(this). foo(); }
+      //char test1Dz();
+
+        char test2Bx() { return { return B.foo(); }(); }
+        char test2Cx() { return { return C.foo(); }(); }
+        char test2Dx() { return { return   foo(); }(); }
+        char test2By() { return { return this.B.foo(); }(); }
+        char test2Cy() { return { return this.C.foo(); }(); }   // cannot compile -> OK
+        char test2Dy() { return { return this.  foo(); }(); }
+        char test2Bz() { return { return typeof(super).foo(); }(); }
+        char test2Cz() { return { return typeof(this). foo(); }(); }
+      //char test2Dz();
+
+        char test3Bx() { return (new class Object { char bar() { return B.foo(); } }).bar(); }
+        char test3Cx() { return (new class Object { char bar() { return C.foo(); } }).bar(); }
+        char test3Dx() { return (new class Object { char bar() { return   foo(); } }).bar(); }
+
+        override char foo() { return 'C'; }
+    }
+    static class D : C
+    {
+        override char foo() { return 'D'; }
+    }
+
+    C c = new D();
+
+    assert(c.test1Bx() == 'B');
+    assert(c.test1Cx() == 'C');
+    assert(c.test1Dx() == 'D');
+    assert(c.test1By() == 'B');
+    assert(c.test1Cy() == 'C');
+    assert(c.test1Dy() == 'D');
+    assert(c.test1Bz() == 'B'); // NG('D') -> OK
+    assert(c.test1Cz() == 'C');
+  //assert(c.test1Dz() == 'D');
+
+    assert(c.test2Bx() == 'B'); // NG('D') -> OK
+    assert(c.test2Cx() == 'C'); // NG('D') -> OK
+    assert(c.test2Dx() == 'D');
+    assert(c.test2By() == 'B');
+    assert(c.test2Cy() == 'C');
+    assert(c.test2Dy() == 'D');
+    assert(c.test2Bz() == 'B'); // NG('D') -> OK
+    assert(c.test2Cz() == 'C'); // NG('D') -> OK
+  //assert(c.test2Dz() == 'D');
+
+    assert(c.test3Bx() == 'B'); // NG('D') -> OK
+    assert(c.test3Cx() == 'C'); // NG('D') -> OK
+    assert(c.test3Dx() == 'D');
+}
+
+/**************************************/
+// 9734
+
+void test9734()
+{
+    class C {}
+    class D : C
+    {
+        static bool test(C) { return true; }
+
+        void foo()() if (is(typeof(test(super)))) {}
+        void bar()() if (is(typeof(super) == C)) {}
+    }
+    void baz()() if (is(typeof(super))) {}
+
+    auto d = new D();
+    d.foo();
+    d.bar();
+    static assert(!__traits(compiles, baz()));
+}
+
+/**************************************/
+
+int main(string[] argv)
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test56();
+    test57();
+    test58();
+    test61();
+    test62();
+    test63();
+    test64();
+    test65();
+    test8809();
+    test9734();
+
+    printf("Success\n");
+    return 0;
+}
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/test11039.d b/gcc/testsuite/gdc.test/runnable/test11039.d
new file mode 100644
index 00000000000..8c2e624499b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test11039.d
@@ -0,0 +1,23 @@
+
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test11039b.d
+
+import imports.test11039b;
+
+struct SomeStruct(T)
+{
+    T field;
+    T getInnerField()
+    {
+        return field;
+    }
+}
+
+static globalField = SomeStruct!string("Hello!");
+
+void main()
+{
+    globalField.getInnerField();
+    anotherGlobalField.getInnerField();
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test11239.d b/gcc/testsuite/gdc.test/runnable/test11239.d
new file mode 100644
index 00000000000..9ace1cf95ab
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test11239.d
@@ -0,0 +1,11 @@
+// EXTRA_SOURCES: imports/inc11239.d
+// REQUIRED_ARGS: -debug
+// COMPILE_SEPARATELY
+// PERMUTE_ARGS:
+
+import imports.inc11239;
+
+void main()
+{
+    foo(1);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test11447a.d b/gcc/testsuite/gdc.test/runnable/test11447a.d
new file mode 100644
index 00000000000..cced4779c89
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test11447a.d
@@ -0,0 +1,11 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/a11447.d
+// PERMUTE_ARGS: -allinst
+
+import imports.a11447;
+
+void main()
+{
+    A a;
+    TTT.yyy(a);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test11447b.d b/gcc/testsuite/gdc.test/runnable/test11447b.d
new file mode 100644
index 00000000000..1e76da7799a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test11447b.d
@@ -0,0 +1,11 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/b11447.d
+// PERMUTE_ARGS: -allinst
+
+import imports.b11447;
+
+void main()
+{
+    A a;
+    aaa(a);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test11447c.d b/gcc/testsuite/gdc.test/runnable/test11447c.d
new file mode 100644
index 00000000000..a540d7340b8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test11447c.d
@@ -0,0 +1,11 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/c11447.d
+// PERMUTE_ARGS: -allinst -w -debug -gc
+
+import imports.c11447;
+
+void main()
+{
+    auto a = new A();
+    TemplateInstancier().instanciateFromResolvedArgs(a);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test11745.d b/gcc/testsuite/gdc.test/runnable/test11745.d
new file mode 100644
index 00000000000..9c5628cd297
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test11745.d
@@ -0,0 +1,14 @@
+// EXTRA_SOURCES: imports/test11745b.d
+// REQUIRED_ARGS: -unittest
+// PERMUTE_ARGS:
+import imports.test11745b;
+
+void main()
+{
+        // Test that we can invoke all unittests, including private ones.
+        assert(__traits(getUnitTests, imports.test11745b).length == 3);
+        foreach(test; __traits(getUnitTests, imports.test11745b))
+        {
+                test();
+        }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test11863.d b/gcc/testsuite/gdc.test/runnable/test11863.d
new file mode 100644
index 00000000000..f42ac45d348
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test11863.d
@@ -0,0 +1,10 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/std11863conv.d imports/std11863format.d
+
+import imports.std11863conv;
+
+void main()
+{
+    auto s = to!string(15, 10);
+    assert(s == "15");  // failure
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test12.d b/gcc/testsuite/gdc.test/runnable/test12.d
new file mode 100644
index 00000000000..55399b23909
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test12.d
@@ -0,0 +1,1250 @@
+
+extern(C) int printf(const char*, ...);
+extern(C) int sprintf(char*, const char*, ...);
+
+/**************************************/
+
+void test1()
+{
+     bool x;
+     int i;
+
+     i = !("bar" == "bar");
+     assert(i == 0);
+
+     i = "bar" != "bar";
+     assert(i == 0);
+
+     i = "bar" == "bar";
+     assert(i == 1);
+
+     x = "bar" != "bar";
+     assert(x == false);
+
+     assert("bar" == "bar");
+
+     x = "bar" == "bar";
+     assert(x == true);
+
+     /+ ---- +/
+
+     i = !("foo" == "bar");
+     assert(i == 1);
+
+     i = "foo" != "bar";
+     assert(i == 1);
+
+     i = "foo" == "bar";
+     assert(i == 0);
+
+     x = "foo" != "bar";
+     assert(x == true);
+
+     assert("foo" != "bar");
+
+     x = "foo" == "bar";
+     assert(x == false);
+
+}
+
+
+/**************************************/
+
+void test2()
+{
+     bool x;
+     int i;
+
+     i = !("bar" <= "bar");
+     assert(i <= 0);
+
+     i = "bar" > "bar";
+     assert(i == 0);
+
+     i = "bar" >= "bar";
+     assert(i == 1);
+
+     x = "bar" < "bar";
+     assert(x == false);
+
+     assert("bar" <= "bar");
+
+     x = "bar" <= "bar";
+     assert(x == true);
+
+     /+ ---- +/
+
+     i = !("foo" < "bar");
+     assert(i == 1);
+
+     i = "foo" > "bar";
+     assert(i == 1);
+
+     i = "foo" < "bar";
+     assert(i == 0);
+
+     x = "foo" >= "bar";
+     assert(x == true);
+
+     assert("foo" >= "bar");
+
+     x = "foo" <= "bar";
+     assert(x == false);
+
+}
+
+
+/**************************************/
+
+bool all(string array, bool function(char) predicate) {
+    for (int i = 0; i < array.length; i++) {
+        if (!predicate(array[i])) {
+            return false;
+        }
+    }
+    return true;
+}
+
+bool all(string array, bool delegate(char) predicate) {
+    for (int i = 0; i < array.length; i++) {
+        if (!predicate(array[i])) {
+            return false;
+        }
+    }
+    return true;
+}
+
+bool isVowel(char c) {
+    return (c == 'a') || (c == 'e') || (c == 'i') || (c == 'o') || (c == 'u');
+}
+
+class Character {
+    private char letter;
+    this(char c) {
+        this.letter = c;
+    }
+    public bool isLetter(char c) {
+        return this.letter == c;
+    }
+}
+
+void test3()
+{
+    Character a = new Character('a');
+    bool delegate(char) isLetter;
+    isLetter = &a.isLetter;
+    bool i;
+
+    i = all("aeiouoeieuiei", &isVowel);
+    assert(i == true);
+
+    i = all("aeiouoeieuiei", isLetter);
+    assert(i == false);
+}
+
+
+/**************************************/
+
+int[] fun(int i)
+    in
+    {
+        assert(i > 0);
+    }
+    out (result)
+    {
+        assert(result[0] == 2);
+    }
+    body
+    {
+        char result;
+        int[] res = new int[10];
+        res[] = i;
+        int isZero = (result == 0xFF);
+        assert(isZero);
+        return res;
+    }
+
+void test4()
+{
+    int[] values = fun(2);
+}
+
+
+/**************************************/
+
+
+const uint D3DSP_DSTMOD_SHIFT = 20;
+
+const uint D3DSP_DSTMOD_MASK = 0x00F00000;
+
+
+enum D3DSHADER_PARAM_DSTMOD_TYPE
+
+{
+    NONE = 0<<D3DSP_DSTMOD_SHIFT,
+    SATURATE= 1<<D3DSP_DSTMOD_SHIFT,
+    FORCE_DWORD = 0x7fffffff,
+}
+
+void test5()
+{
+}
+
+/**************************************/
+
+class foo6
+{
+     union
+     {
+         int i;
+         char j;
+     }
+}
+
+void test6()
+{
+}
+
+/**************************************/
+
+void test7()
+{
+}
+
+
+/**************************************/
+
+real x8 = 4;
+long y8;
+
+void test8()
+{
+    y8 = cast(long)x8;
+    assert(y8 == 4);
+    y8 = cast(long)cast(double)x8;
+    assert(y8 == 4);
+    printf ("%lld\n", y8);
+}
+
+
+/**************************************/
+
+void test9()
+{
+    struct B { }
+    B bar (ref int p)
+    {
+        B b;
+        return b;
+    }
+}
+
+
+/**************************************/
+
+struct B10
+{
+   uint member;
+}
+
+B10 func10()
+{
+   B10 b;
+   b.member=7;
+   return b;
+}
+
+void test10()
+{
+   uint i=func10().member; // Internal error: ..\ztc\cgcs.c 350
+   assert(i == 7);
+
+   B10 b=func10();  //works
+   i=b.member;
+   assert(i == 7);
+}
+
+
+/**************************************/
+
+void test11()
+{
+   const int notInitialized;
+   const int i=notInitialized; // DMD crashes
+   assert(notInitialized == 0);
+   assert(i == 0);
+}
+
+
+/**************************************/
+
+struct Array12
+{
+    char len;
+    void* p;
+}
+//Array12 f12(string a)
+//{
+//    return *cast(Array12*) &a[0..23]; //Internal error: ..\ztc\cgcs.c 350
+//}
+
+Array12 g12(string a)
+{
+    return *cast(Array12*) &a; //works
+}
+
+void test12()
+{
+    string a = "12345678901234567890123";
+    Array12 b;
+
+    //b = f12(a);
+    //printf("b.len = %x\n", b.len);
+    b = g12(a);
+    printf("b.len = %x\n", b.len);
+}
+
+
+/**************************************/
+
+
+class A13
+{
+    int opShl(char* v) { return 1; }
+    int opShl(string v) { return 2; }
+}
+
+void test13()
+{
+        A13 a = new A13();
+        int i;
+        i = a.opShl(cast(string)"");
+        assert(i == 2);
+        i = a << cast(string)"";
+        assert(i == 2);
+}
+
+/**************************************/
+
+union U1
+{
+   struct { int a; }
+   struct { int b; }
+}
+
+union U2
+{
+   struct { int a; }
+   struct { long b; }
+}
+
+union U3
+{
+   struct { long a; }
+   struct { int b; }
+}
+
+union U4
+{
+   int a;
+   int b;
+}
+
+union U5
+{
+   int a;
+   long b;
+}
+
+union U6
+{
+   long a;
+   int b;
+}
+
+void test14()
+{
+   printf("%d %d %d\n", U1.a.offsetof, U1.b.offsetof, U1.sizeof);
+   assert(U1.a.offsetof == 0);
+   assert(U1.b.offsetof == 0);
+   assert(U1.sizeof == 4);
+
+   printf("%d %d %d\n", U2.a.offsetof, U2.b.offsetof, U2.sizeof);
+   assert(U2.a.offsetof == 0);
+   assert(U2.b.offsetof == 0);
+   assert(U2.sizeof == 8);
+
+   printf("%d %d %d\n", U3.a.offsetof, U3.b.offsetof, U3.sizeof);
+   assert(U3.a.offsetof == 0);
+   assert(U3.b.offsetof == 0);
+   assert(U3.sizeof == 8);
+
+   printf("%d %d %d\n", U4.a.offsetof, U4.b.offsetof, U4.sizeof);
+   assert(U4.a.offsetof == 0);
+   assert(U4.b.offsetof == 0);
+   assert(U4.sizeof == 4);
+
+   printf("%d %d %d\n", U5.a.offsetof, U5.b.offsetof, U5.sizeof);
+   assert(U5.a.offsetof == 0);
+   assert(U5.b.offsetof == 0);
+   assert(U5.sizeof == 8);
+
+   printf("%d %d %d\n", U6.a.offsetof, U6.b.offsetof, U6.sizeof);
+   assert(U6.a.offsetof == 0);
+   assert(U6.b.offsetof == 0);
+   assert(U6.sizeof == 8);
+}
+
+
+/**************************************/
+
+void test15()
+{
+    const int[] array = [1,2,3];
+
+    assert(array.length == 3);
+    assert(array[1] == 2);
+}
+
+
+/**************************************/
+
+class Conversion(T)
+{
+  class Big {char[2] dummy;}
+  static Big Test(...);
+
+  enum { exists = Test().sizeof }
+}
+
+void test16()
+{
+    assert(Conversion!(double).exists == (void*).sizeof);
+}
+
+
+/**************************************/
+
+class Cout17
+{
+ Cout17 set(int x)
+ {
+  printf("%d",x);
+  return this;
+ }
+ alias set opShl;
+}
+
+void test17()
+{
+ Cout17 cout = new Cout17;
+ cout << 5 << 4;
+}
+
+
+
+/**************************************/
+
+void test18()
+{
+  bool[] x = new bool[100];
+  x[] = 1;
+  bool[] y = x.dup;
+  assert(y[99]);
+}
+
+
+/**************************************/
+
+bool[32] x19 = 1;
+
+void test19()
+{
+    assert(x19[31]);
+}
+
+
+/**************************************/
+
+bool[2] y20 = [ cast(bool) 3, cast(bool) 2 ];
+
+void test20()
+{
+    assert(y20[0]); // ok
+    assert(y20[1]); // fails
+}
+
+/**************************************/
+
+bool isnan(float x) { return !( (x >= 0)  || (x < 0)); }
+
+struct X21 { float f, g, h; }
+X21 x21_1;
+X21 x21_2 = { f: 1.0, h: 2.0 };
+
+char[3] y21_1;
+char[3] y21_2 = [ 0: 'a', 2: 'b' ];
+
+void test21()
+{
+    assert(isnan(x21_1.g));
+    assert(isnan(x21_2.g));
+    assert(y21_1[1] == '\xff');
+    assert(y21_2[1] == '\xff');
+}
+
+
+/**************************************/
+
+void test22()
+{
+    wstring a = cast(wstring)"一〇";
+}
+
+
+/**************************************/
+
+interface A23 { void x(); }
+class B23 : A23 { void x() { } }
+class C23 : B23 { uint y = 12345678; }
+
+void stest23(A23 a)
+{
+    synchronized (a)
+    {
+    }
+}
+
+void test23()
+{
+    C23 c = new C23;
+    assert(c.y == 12345678 /*c.y.init*/);
+    stest23(c);
+    assert(c.y == 12345678 /*c.y.init*/);
+}
+
+
+/**************************************/
+
+class A24
+{
+    unittest
+    {
+    }
+}
+
+void test24()
+{
+}
+
+/**************************************/
+
+char rot13(char ret)
+{
+    if (ret > 'A'-1 && ret < 'N')
+    {   ret += 13;}
+    else if(ret > 'M' && ret < 'Z'+1)
+    {   ret -= 13;}
+    else if(ret > 'a'-1 && ret < 'n')
+    {   ret += 13;}
+    else if(ret > 'm' && ret < 'z'+1)
+    {   ret -= 13;}
+
+    return ret;
+}
+
+
+void test25()
+{
+    foreach (char c; "hello World\n")
+        printf("%c %c\n", c, rot13(c));
+    assert(rot13('h') == 'u');
+    assert(rot13('o') == 'b');
+    assert(rot13('W') == 'J');
+    assert(rot13('H') == 'U');
+}
+
+
+/**************************************/
+
+bool b26a = cast(bool)( cast(bool) 2 & cast(bool) 1 );
+bool b26b = cast(bool) 2;
+
+void test26()
+{
+    assert( (* cast(byte *) & b26a) == 1 );
+    assert( (* cast(byte *) & b26b) == 1 );
+}
+
+
+/**************************************/
+
+int c27;
+
+struct X27
+{
+  int x;
+  struct
+  {
+      int a;
+      int b;
+      static this() { c27 = 3; }
+  }
+}
+
+void test27()
+{
+    assert(c27 == 3);
+}
+
+/**************************************/
+
+void test28()
+{
+  void bar()
+  {
+    throw new Foo28();
+  }
+}
+
+class Foo28 : Throwable
+{
+  private:
+        this() { super(""); }
+}
+
+/**************************************/
+
+struct S29 {
+    ubyte a, b, c, d;
+}
+
+int hoge(S29 s) {
+    char[10] b;
+    printf("%x\n", s);
+    sprintf(b.ptr, "%x", s);
+    assert(b[0 .. 7] == "4030201");
+    return 0;
+}
+
+void test29()
+{
+    for (int i = 0; i < 1; i++) {
+        S29 s;
+        s.a = 1;
+        s.b = 2;
+        s.c = 3;
+        s.d = 4;
+        hoge(s);
+    }
+}
+
+
+/**************************************/
+
+class Qwert {
+     static {
+         deprecated int yuiop() {
+             return 42;
+         }
+     }
+
+     static deprecated int asdfg() {
+         return yuiop() + 105;
+     }
+}
+
+void test30()
+{
+}
+
+/**************************************/
+
+void test31()
+{
+    string foo = "hello";
+
+    printf("%s\n", foo.ptr);
+    auto s = typeid(typeof(foo.ptr)).toString();
+    printf("%.*s\n", s.length, s.ptr);
+    s = typeid(char*).toString();
+    printf("%.*s\n", s.length, s.ptr);
+    assert(typeid(typeof(foo.ptr)) == typeid(immutable(char)*));
+}
+
+/**************************************/
+
+class Qwert32
+{
+    struct
+    {
+        int yuiop = 13;
+    }
+    int asdfg = 42;
+
+    void foo()
+    {
+        printf("yuiop = %d, asdfg = %d\n", Qwert32.yuiop.offsetof, Qwert32.asdfg.offsetof);
+        version(D_LP64)
+        {
+            assert(Qwert32.yuiop.offsetof == 16);
+            assert(Qwert32.asdfg.offsetof == 20);
+        }
+        else
+        {
+            assert(Qwert32.yuiop.offsetof == 8);
+            assert(Qwert32.asdfg.offsetof == 12);
+        }
+    }
+}
+
+void test32()
+{
+    Qwert32 q = new Qwert32;
+
+    q.foo();
+}
+
+
+/**************************************/
+
+int x33;
+int y33;
+
+size_t os_query()
+{
+    return cast(uint)(cast(char *)&x33 - cast(char *)&y33);
+}
+
+void test33()
+{
+    os_query();
+}
+
+/**************************************/
+
+uint x34 = ~(16u-1u);
+uint y34 = ~(16u-1);
+
+void test34()
+{
+     assert(x34 == 0xFFFFFFF0);
+     assert(y34 == 0xFFFFFFF0);
+}
+
+/**************************************/
+
+private static extern (C)
+{
+        shared char* function () uloc_getDefault;
+}
+
+
+static shared void**[] targets =
+    [
+        cast(shared(void*)*) &uloc_getDefault,
+    ];
+
+void test35()
+{
+}
+
+/**************************************/
+
+class S36
+{
+    int s = 1;
+
+    this()
+    {
+    }
+}
+
+
+class A36 : S36
+{
+    int a = 2;
+    int b = 3;
+    int c = 4;
+    int d = 5;
+}
+
+void test36()
+{
+    A36 a = new A36;
+
+    printf("A36.sizeof = %d\n", a.classinfo.initializer.length);
+    printf("%d\n", a.s);
+    printf("%d\n", a.a);
+    printf("%d\n", a.b);
+    printf("%d\n", a.c);
+    printf("%d\n", a.d);
+
+    version(D_LP64)
+        assert(a.classinfo.initializer.length == 36);
+    else
+        assert(a.classinfo.initializer.length == 28);
+    assert(a.s == 1);
+    assert(a.a == 2);
+    assert(a.b == 3);
+    assert(a.c == 4);
+    assert(a.d == 5);
+}
+
+
+/**************************************/
+
+struct MyStruct
+{
+    StructAlias* MyStruct()
+    {
+        return null;
+    }
+}
+
+alias MyStruct StructAlias;
+
+void test37()
+{
+}
+
+/**************************************/
+
+class Foo38
+{
+    static void display_name()
+    {
+        printf("%.*s\n", Object.classinfo.name.length, Object.classinfo.name.ptr);
+        assert(Object.classinfo.name == "object.Object");
+        assert(super.classinfo.name == "object.Object");
+        assert(this.classinfo.name == "test12.Foo38");
+    }
+}
+
+void test38()
+{
+    Foo38.display_name();
+}
+
+
+/**************************************/
+// http://www.digitalmars.com/d/archives/digitalmars/D/bugs/2409.html
+
+class C39
+{
+    C39 c;
+    this() { c = this; }
+    C39 lock() { return c; }
+}
+
+void test39()
+{
+    C39 c = new C39();
+    synchronized( c.lock() ) {}
+    synchronized( c.lock ) {}
+}
+
+
+/**************************************/
+
+class C40
+{
+    static int x = 4;
+
+    static int foo()
+    {
+        return this.x;
+    }
+}
+
+void test40()
+{
+    C40 c = new C40();
+    assert(C40.foo() == 4);
+}
+
+
+/**************************************/
+
+struct Foo42
+{
+    Bar42 b;
+}
+
+struct Bar42
+{
+    long a;
+}
+
+void test42()
+{
+    assert(Bar42.sizeof == long.sizeof);
+    assert(Foo42.sizeof == long.sizeof);
+}
+
+
+/**************************************/
+
+class Foo43
+{
+    Bar43 b;
+}
+
+struct Bar43
+{
+    long a;
+}
+
+void test43()
+{
+    assert(Bar43.sizeof == long.sizeof);
+    assert(Foo43.sizeof == (void*).sizeof);
+}
+
+
+/**************************************/
+
+struct Property
+{
+    uint attributes;
+
+    Value value;
+}
+
+struct Value
+{
+    int a,b,c,d;
+}
+
+struct PropTable
+{
+    Property[Value] table;
+    PropTable* previous;
+
+    Value* get(Value* key)
+    {
+        Property *p;
+
+        p = *key in table;
+        p = &table[*key];
+        table.remove(*key);
+        return null;
+    }
+
+}
+
+void test44()
+{
+}
+
+
+/**************************************/
+
+struct Shell
+{
+    string str;
+
+    const int opCmp(ref const Shell s)
+    {
+        import std.algorithm;
+        return std.algorithm.cmp(this.str, s.str);
+    }
+}
+
+void test45()
+{
+    import std.algorithm;
+
+    Shell[3] a;
+
+    a[0].str = "hello";
+    a[1].str = "betty";
+    a[2].str = "fred";
+
+    a[].sort;
+
+    foreach (Shell s; a)
+    {
+        printf("%.*s\n", s.str.length, s.str.ptr);
+    }
+
+    assert(a[0].str == "betty");
+    assert(a[1].str == "fred");
+    assert(a[2].str == "hello");
+}
+
+/**************************************/
+
+class A46
+{
+    char foo() { return 'a'; }
+}
+
+class B46 : A46
+{
+}
+
+class C46 : B46
+{
+    override char foo() { return 'c'; }
+    char bar()
+    {
+        return B46.foo();
+    }
+}
+
+void test46()
+{
+    C46 c = new C46();
+
+    assert(c.bar() == 'a');
+    printf("%c\n", c.bar());
+}
+
+
+/**************************************/
+
+class Foo47
+{
+   static bool prop() { return false; }
+   static string charprop() { return null; }
+}
+
+void test47()
+{
+   if (0 || Foo47.prop) { }
+   if (1 && Foo47.prop) { }
+   switch (Foo47.prop) { default: break; }
+   foreach (char ch; Foo47.charprop) { }
+}
+
+
+/**************************************/
+
+struct foo48
+{
+    int x, y, z;
+}
+
+void bar48() {}
+
+void test48()
+{
+    foo48[] arr;
+    foreach(foo48 a; arr)
+    {
+        bar48();
+    }
+}
+
+
+/**************************************/
+
+enum E49;
+
+void test49()
+{
+}
+
+/**************************************/
+
+void test50()
+{
+        S50!() s;
+        assert(s.i == int.sizeof);
+}
+
+struct S50()
+{
+        int i=f50(0).sizeof;
+}
+
+int f50(...);
+
+/**************************************/
+
+enum Enum51
+{
+        A,
+        B,
+        C
+}
+
+struct Struct51
+{
+        Enum51 e;
+}
+
+void test51()
+{
+        Struct51 s;
+        assert(s.e == Enum51.A);
+        assert(s.e == 0);
+}
+
+/**************************************/
+
+bool foo52()
+{
+  int x;
+  for (;;) {
+    if (x == 0)
+      return true;
+    x = 1;
+  }
+  return false;
+}
+
+void test52()
+{
+  foo52();
+}
+
+/**************************************/
+
+void foo53()
+{
+   ret:{}
+   goto ret;
+}
+
+void test53()
+{
+}
+
+/**************************************/
+
+struct V54
+{
+    int x = 3;
+}
+
+class Foo54
+{
+    static int y;
+    static V54 prop() { V54 val; return val; }
+    static void prop(V54 val) { y = val.x * 2; }
+}
+
+void test54()
+{
+    (new Foo54).prop = true ? Foo54.prop : Foo54.prop;
+    assert(Foo54.y == 6);
+}
+
+/**************************************/
+
+void test55()
+{
+    dchar c;
+
+    c = 'x';
+    //writefln("c = '%s', c.init = '%s'", c, c.init);
+    assert(c == 'x');
+    assert(c.init == dchar.init);
+}
+
+/**************************************/
+
+void writefln(string s)
+{
+    printf("%.*s\n", s.length, s.ptr);
+}
+
+/**************************************/
+
+void test58()
+{
+        int label=1;
+        if (0)
+        {
+label:
+            int label2=2;
+            assert(label2==2);
+        }
+        else
+        {
+            assert(label==1);
+            goto label;
+        }
+        assert(label==1);
+}
+
+/**************************************/
+
+void test59()
+{
+        if(0){
+label:
+                return;
+        }else{
+                goto label;
+        }
+        assert(0);
+}
+
+/**************************************/
+
+int main(string[] argv)
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test58();
+    test59();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test12197.d b/gcc/testsuite/gdc.test/runnable/test12197.d
new file mode 100644
index 00000000000..51dc36c83c8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test12197.d
@@ -0,0 +1,12 @@
+// import std.math;
+
+void foo(T)(T[] b)
+{
+    b[] = b[] ^^ 4;
+}
+void main()
+{
+    double[] a = [10];
+    foo(a);
+    assert(a[0] == 10000);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test12874.d b/gcc/testsuite/gdc.test/runnable/test12874.d
new file mode 100644
index 00000000000..750c8247e43
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test12874.d
@@ -0,0 +1,18 @@
+// EXTRA_SOURCES: imports/a12874.d
+// PERMUTE_ARGS: -inline -g -O
+
+import imports.a12874;
+
+void main()
+{
+    try
+    {
+        int x;
+        foo!(x)();
+    }
+    catch (Error e)
+    {
+        assert(e.file[$-8..$] == "a12874.d");
+        assert(e.line == 7);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test13.d b/gcc/testsuite/gdc.test/runnable/test13.d
new file mode 100644
index 00000000000..e28021944c7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test13.d
@@ -0,0 +1,13 @@
+// EXTRA_SOURCES: imports/test13a.d
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -unittest
+
+module test13;
+
+import imports.test13a;
+
+alias Ordinal!(char) ord;
+
+int main() {
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test13504.d b/gcc/testsuite/gdc.test/runnable/test13504.d
new file mode 100644
index 00000000000..eed8739d688
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test13504.d
@@ -0,0 +1,11 @@
+// REQUIRED_ARGS: -O -cov
+
+bool func(T)()
+{
+    return true;
+}
+
+void main()
+{
+    assert(func!int() || int.sizeof);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test13613.d b/gcc/testsuite/gdc.test/runnable/test13613.d
new file mode 100644
index 00000000000..ea57df4e915
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test13613.d
@@ -0,0 +1,74 @@
+// PERMUTE_ARGS:
+
+// MT!"y" is analyzed from the pragma inside MT!"x"
+/*
+TEST_OUTPUT:
+---
+CT x.offsetof = <
+CT y.offsetof = <
+0 > y
+0 > x
+---
+*/
+
+mixin template MT(string id)
+{
+    union
+    {
+        mixin("void* " ~ id ~ ";");
+    }
+
+    // Evaluating `typeof(this).init` completes data layout.
+    pragma(msg,
+        "CT " ~ id ~ ".offsetof = <\n",
+        cast(int)typeof(this).init.i.offsetof, " > " ~ id);
+}
+
+struct S1
+{
+    int i;
+    mixin MT!"x";
+    mixin MT!"y";
+}
+struct S2
+{
+    int i;
+    union { void* x; }
+    union { void* y; }
+}
+struct S3
+{
+    int i;
+    void* x;
+    void* y;
+}
+
+void main()
+{
+    // S1, S2, and S3 should have exactly same data layout.
+    static assert(S1.i.offsetof == S3.i.offsetof);
+    static assert(S1.i.offsetof == S3.i.offsetof);
+    static assert(S1.x.offsetof == S3.x.offsetof);
+    static assert(S1.y.offsetof == S3.y.offsetof);
+    static assert(S2.x.offsetof == S3.x.offsetof);
+    static assert(S2.y.offsetof == S3.y.offsetof);
+    static assert(S1.sizeof == S3.sizeof);
+    static assert(S2.sizeof == S3.sizeof);
+
+    S1 s = void;
+
+    s.i = 1;
+    assert(s.i == 1);
+    s.x = null;
+    assert(s.i == 1);
+    s.y = null;
+    assert(s.i == 1);
+
+    char a, b;
+    s.x = cast(void*)&a;
+    assert(s.x is &a);
+    assert(s.y is null);
+    s.y = cast(void*)&b;
+    assert(s.x is &a);
+    assert(s.y is &b);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test13944.d b/gcc/testsuite/gdc.test/runnable/test13944.d
new file mode 100644
index 00000000000..928df698a8f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test13944.d
@@ -0,0 +1,36 @@
+// PERMUTE_ARGS:
+module m;
+
+struct S {}
+enum E { a }
+void f() {}
+
+void main()
+{
+     string ssc = S.stringof;   assert(ssc == "S"c);
+    wstring ssw = S.stringof;   assert(ssw == "S"w);
+    dstring ssd = S.stringof;   assert(ssd == "S"d);
+
+     string esc = E.stringof;   assert(esc == "E"c);
+    wstring esw = E.stringof;   assert(esw == "E"w);
+    dstring esd = E.stringof;   assert(esd == "E"d);
+
+     string msc = m.stringof;   assert(msc == "module m"c);
+    wstring msw = m.stringof;   assert(msw == "module m"w);
+    dstring msd = m.stringof;   assert(msd == "module m"d);
+
+     string smc = S.mangleof;   assert(smc == "S1m1S"c);
+    wstring smw = S.mangleof;   assert(smw == "S1m1S"w);
+    dstring smd = S.mangleof;   assert(smd == "S1m1S"d);
+
+     string fmc = f.mangleof;   assert(fmc == "_D1m1fFZv"c);
+    wstring fmw = f.mangleof;   assert(fmw == "_D1m1fFZv"w);
+    dstring fmd = f.mangleof;   assert(fmd == "_D1m1fFZv"d);
+
+    // The default type is still string
+    static assert(is(typeof(S.stringof) == string));
+    static assert(is(typeof(E.stringof) == string));
+    static assert(is(typeof(m.stringof) == string));
+    static assert(is(typeof(S.mangleof) == string));
+    static assert(is(typeof(f.mangleof) == string));
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test14874.d b/gcc/testsuite/gdc.test/runnable/test14874.d
new file mode 100644
index 00000000000..470a93c60ff
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test14874.d
@@ -0,0 +1,38 @@
+// REQUIRED_ARGS: -dip25
+
+template indexOfReturn(T...)
+{
+    static if (T.length == 0)
+    {
+        enum indexOfReturn = -1;
+    }
+    else static if (T[$ - 1] == "return")
+    {
+        enum indexOfReturn = T.length - 1;
+    }
+    else
+    {
+        enum indexOfReturn = indexOfReturn!(T[0..$-1]);
+    }
+}
+
+struct Test
+{
+    int n;
+
+    ref int getN() return
+    {
+        return n;
+    }
+
+    int getNNonReturn()
+    {
+        return n;
+    }
+}
+
+void main()
+{
+    assert(indexOfReturn!(__traits(getFunctionAttributes, Test.getN)) != -1);
+    assert(indexOfReturn!(__traits(getFunctionAttributes, Test.getNNonReturn)) == -1);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test14901.d b/gcc/testsuite/gdc.test/runnable/test14901.d
new file mode 100644
index 00000000000..73a357a4086
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test14901.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS:
+// PERMUTE_ARGS: -unittest
+// EXTRA_SOURCES: imports/test14901a.d imports/test14901b.d imports/test14901c.d imports/test14901d.d
+// COMPILE_SEPARATELY
+
+module test14901;
+
+import imports.test14901c;
+import imports.test14901d;
+
+extern(C) __gshared static int initCount;
+
+extern(C) int printf(const char*, ...);
+
+void main()
+{
+    caller1();
+    caller2();
+    assert(initCount == 1);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test14903.d b/gcc/testsuite/gdc.test/runnable/test14903.d
new file mode 100644
index 00000000000..6b5c6d5fe96
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test14903.d
@@ -0,0 +1,86 @@
+import core.stdc.stdio : printf;
+
+__gshared int counter;
+
+int getID(int expectedID) nothrow {
+    printf("getID: counter = %d, expecting %d\n", counter, expectedID);
+    assert(counter == expectedID);
+    ++counter;
+    return expectedID;
+}
+
+ref int getCounterRef(int expectedID) nothrow {
+    getID(expectedID);
+    return counter;
+}
+
+struct StructWithDtor {
+    __gshared int numDtor;
+    int id;
+
+    this(int expectedID) nothrow {
+        printf("constructing %d\n", expectedID);
+        this.id = getID(expectedID);
+    }
+
+    ~this() nothrow {
+        printf("destructing %d\n", id);
+        ++numDtor;
+    }
+}
+
+StructWithDtor make(int expectedID, bool doThrow) {
+    if (doThrow)
+        throw new Exception("make()");
+    return StructWithDtor(expectedID);
+}
+
+void evaluationOrder(int a, int b, StructWithDtor c, int d, int e, ref int f, StructWithDtor g, int h, int i) {
+    assert(f is counter);
+}
+void evaluationOrderTest() {
+    counter = StructWithDtor.numDtor = 0;
+    evaluationOrder(getID(0), getID(1), StructWithDtor(2), getID(3), getID(4), getCounterRef(5), make(6, false), getID(7), getID(8));
+    assert(counter == 9);
+
+    // TODO: add right-to-left test (array ops)
+}
+
+void dtors(StructWithDtor a, StructWithDtor b, StructWithDtor c, StructWithDtor d) {
+    throw new Exception("dtors()");
+}
+void dtorsTest() {
+    // no throw in args, but in callee
+    counter = StructWithDtor.numDtor = 0;
+    try {
+        dtors(StructWithDtor(0), make(1, false), StructWithDtor(2), make(3, false));
+        assert(0);
+    } catch (Exception) {}
+    assert(counter == 4);
+    assert(StructWithDtor.numDtor == 4);
+
+    // throw in last arg
+    counter = StructWithDtor.numDtor = 0;
+    try {
+        dtors(StructWithDtor(0), make(1, false), StructWithDtor(2), make(3, true));
+        assert(0);
+    } catch (Exception) {}
+    assert(counter == 3);
+    assert(StructWithDtor.numDtor == 3);
+
+    // throw in 2nd arg
+    counter = StructWithDtor.numDtor = 0;
+    try {
+        dtors(StructWithDtor(0), make(1, true), StructWithDtor(2), make(3, true));
+        assert(0);
+    } catch (Exception) {}
+    assert(counter == 1);
+    //assert(StructWithDtor.numDtor == 1); // XGDC
+
+    // TODO: test exception chaining with throwing dtors
+}
+
+void main() {
+    evaluationOrderTest();
+    dtorsTest();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test15.d b/gcc/testsuite/gdc.test/runnable/test15.d
new file mode 100644
index 00000000000..d8bb3ae613e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test15.d
@@ -0,0 +1,1441 @@
+// REQUIRED_ARGS:
+// EXTRA_FILES: extra-files/test15.txt
+
+import std.array;
+import core.stdc.math : cos, fabs, sin, sqrt;
+import core.vararg;
+import std.math: rndtol, rint;
+import std.string;
+import std.stdio : File;
+
+extern (C)
+{
+    int printf(const char*, ...);
+}
+
+struct A { int x; }
+struct B { int x = 22; }
+
+void test5()
+{
+    A* a = new A;
+    assert(a.x == 0);
+    B* b = new B;
+    assert(b.x == 22);
+}
+
+/************************************/
+
+void test6()
+{
+    assert('\x12'.sizeof == 1);
+    assert('\u1234'.sizeof == 2);
+    assert('\U00105678'.sizeof == 4);
+
+    assert('\x12' == 0x12);
+    assert('\u1234' == 0x1234);
+    assert('\U00105678' == 0x105678);
+
+    assert("abc\\def" == r"abc\def");
+}
+
+
+/************************************/
+
+void test7()
+{
+    string s = `hello"there'you`;
+    printf("s = '%.*s'\n", s.length, s.ptr);
+    assert(s == "hello\"there'you");
+    ubyte[] b = cast(ubyte[])x"8B 7D f4 0d";
+    for (int i = 0; i < b.length; i++)
+        printf("b[%d] = x%02x\n", i, b[i]);
+    assert(b.length == 4);
+    assert(b[0] == 0x8B);
+    assert(b[1] == 0x7D);
+    assert(b[2] == 0xF4);
+    assert(b[3] == 0x0D);
+}
+
+
+/************************************/
+
+
+void foo8(out bool b)
+{
+    b = true;
+}
+
+
+void test8()
+{
+   bool b;
+   bool *pb = &b;
+
+   assert(b == false);
+   *pb = true;
+   assert(b == true);
+   *pb = false;
+   assert(b == false);
+   foo8(b);
+   assert(b == true);
+}
+
+
+/************************************/
+
+struct Pair
+{
+   int a;
+   int b;
+
+   Pair abs ()
+   {
+       return this;
+   }
+
+   Pair opDiv(Pair other)
+   {
+       Pair result;
+
+        result.a = a + other.a;
+        result.b = b + other.b;
+       return result;
+   }
+}
+
+void test9()
+{
+   Pair t;
+
+   t.a = 5;
+   t.b = 23;
+   t = t.abs () / t;
+   printf("a = %d, b = %d\n", t.a, t.b);
+   assert(t.a == 10);
+   assert(t.b == 46);
+}
+
+
+/************************************/
+
+void test10()
+{
+    int b = 0b_1_1__1_0_0_0_1_0_1_0_1_0_;
+
+    printf("b = %d\n", b);
+    assert(b == 3626);
+
+    b = 1_2_3_4_;
+    printf("b = %d\n", b);
+    assert(b == 1234);
+
+    b = 0x_1_2_3_4_;
+    printf("b = %d\n", b);
+    assert(b == 4660);
+
+    b = 0_;
+    printf("b = %d\n", b);
+    assert(b == 0);
+
+    double d = 0_._2_3_4_;
+    printf("d = %g\n", d);
+    assert(d == 0.234);
+
+    d = 0_._2_3_4_e+3_5_;
+    printf("d = %g\n", d);
+    assert(d == 0.234e+35);
+
+    d = 0_._2_3_4_e3_5_;
+    printf("d = %g\n", d);
+    assert(d == 0.234e+35);
+}
+
+/************************************/
+
+class CA14 { }
+class CB14 : CA14 { }
+
+class A14 {
+    int show( CA14 a ) { printf("A14::show( CA14 )\n"); return 1; }
+    int boat( CA14 a ) { printf("A14::boat( CA14 )\n"); return 1; }
+}
+
+class B14 : A14 {
+    int show( CA14 a, CB14 b ) { printf("B14::show(CA14, CB14)\n"); return 2; }
+    int boat( CA14 a, CB14 b ) { printf("B14::boat(CA14, CB14)\n"); return 2; }
+}
+
+class C14 : B14 {
+    override int show( CA14 a ) { printf("C::show( CA14 )\n"); return 3; }
+    alias B14.show show;
+
+    alias B14.boat boat;
+    override int boat( CA14 a ) { printf("C::boat( CA14 )\n"); return 3; }
+}
+
+class D14 : C14  {
+}
+
+
+void test14()
+{
+    D14 b = new D14();
+    int i;
+
+    i = b.show( new CA14(), new CB14() );
+    assert(i == 2);
+    i = b.show( new CA14() );
+    assert(i == 3);
+
+    i = b.boat( new CA14(), new CB14() );
+    assert(i == 2);
+    i = b.boat( new CA14() );
+    assert(i == 3);
+}
+
+
+/************************************/
+
+class A15
+{
+    void foo()
+    {
+        List1.rehash;
+        List2.rehash;
+    }
+  private:
+    int delegate(in int arg1) List1[char[]];
+    int  List2[char []];
+}
+
+void test15()
+{
+}
+
+
+/************************************/
+
+void test16()
+{
+    char[] a=new char[0];
+    uint c = 200000;
+    while (c--)
+        a ~= 'x';
+    //printf("a = '%.*s'\n", a.length, a.ptr);
+}
+
+
+/************************************/
+
+class A17 { }
+class B17 : A17 { }
+
+void foo17(const(A17)[] a) { }
+
+void test17()
+{
+    B17[] b;
+    foo17(b);
+}
+
+
+/************************************/
+
+void test18()
+{
+    uint a;
+    real b=4;
+    a=cast(uint)b;
+}
+
+/************************************/
+
+abstract class Foo19
+{
+    int bar() { return 1; }
+}
+
+void test19()
+{
+    Foo19 f;
+}
+
+/************************************/
+
+int foo20(string s,char d) {  return 1; }
+int foo20(string s,double d) {  return 2; }
+int foo20(string s,cdouble d) {  return 3; }
+
+void test20()
+{
+    int i;
+    double x;
+    i = foo20("test=",x);
+    assert(i == 2);
+}
+
+/************************************/
+
+void test21()
+{
+    int[string] esdom;
+    auto f = File("runnable/extra-files/test15.txt", "r");
+
+    foreach(it; f.byLine())
+        esdom[it.idup] = 0;
+
+    esdom.rehash;
+}
+
+/************************************/
+
+int foo22(char* p) { return 1; }
+int foo22(char[] s) { return 2; }
+
+void test22()
+{
+    int i;
+
+    i = foo22(cast(char*)"abc");
+    assert(i == 1);
+    i = foo22(cast(char[])"abc");
+    assert(i == 2);
+}
+
+
+/************************************/
+
+void test23()
+{
+    uint v;
+    int b;
+    long l;
+    real e;
+
+    e = cos(e);
+    e = fabs(e);
+    e = rint(e);
+    l = rndtol(e);
+    e = sin(e);
+    e = sqrt(e);
+}
+
+
+/************************************/
+
+abstract class dtortest24
+{
+  this() {}
+  ~this() {}
+}
+
+void test24()
+{
+}
+
+
+/************************************/
+
+abstract class bar25 {
+
+  this() {}
+
+  void foo() {}
+
+}
+
+class subbar25 : bar25 {
+
+  this() {}
+
+}
+
+void test25()
+{
+   new subbar25();
+}
+
+
+/************************************/
+
+void test26()
+{
+    string[] instructions = std.array.split("a;b;c", ";");
+
+    foreach(ref string instr; instructions)
+    {
+        std.string.strip(instr);
+    }
+
+    foreach(string instr; instructions)
+    {
+        printf("%.*s\n", instr.length, instr.ptr);
+    }
+}
+
+
+/************************************/
+
+void foo27(ClassInfo ci) { }
+
+class A27
+{
+}
+
+class B27 : A27
+{
+    static this()
+    {
+        foo27(B27.classinfo);
+        foo27(A27.classinfo);
+    }
+}
+
+void test27()
+{
+}
+
+
+/************************************/
+
+void foo28(ClassInfo ci)
+{
+    printf("%.*s\n", ci.name.length, ci.name.ptr);
+
+    static int i;
+    switch (i++)
+    {
+        case 0:
+        case 2: assert(ci.name == "test15.A28");
+                break;
+        case 1: assert(ci.name == "test15.B28");
+                break;
+        default: assert(0);
+    }
+}
+
+class A28
+{
+    static this() {
+    foo28(A28.classinfo );
+    }
+}
+
+class B28 : A28
+{
+    static this() {
+        foo28(B28.classinfo );
+        (new B28()).bodge_it();
+    }
+    void bodge_it() {
+        foo28(A28.classinfo );
+    }
+}
+
+void test28()
+{
+    A28 a,b;
+    a = new A28();
+    b = new B28();
+}
+
+
+/************************************/
+
+void test29()
+{
+    static void delegate() dg;
+
+    dg = null;
+}
+
+
+/************************************/
+
+string foo30(int i)
+{
+    return i ? "three" : "two";
+}
+
+string bar30(int i)
+{
+    return i ? "one" : "five";
+}
+
+void test30()
+{
+    string s;
+
+    s = foo30(0);
+    assert(s == "two");
+    s = foo30(1);
+    assert(s == "three");
+
+    s = bar30(0);
+    assert(s == "five");
+    s = bar30(1);
+    assert(s == "one");
+}
+
+
+/************************************/
+// http://www.digitalmars.com/d/archives/18204.html
+// DMD0.050 also failed with alias.
+
+alias int recls_bool_t;
+
+class Entry31
+{
+
+    recls_bool_t IsReadOnly()
+    {
+        return cast(recls_bool_t)0;
+    }
+}
+
+
+void test31()
+{
+    Entry31 entry = new Entry31();
+
+    if (entry.IsReadOnly)
+    {
+    }
+}
+
+
+/************************************/
+
+class A32
+{
+    alias int delegate() mfunc;
+
+    this( mfunc initv )
+    {
+    }
+}
+
+class foo32
+{
+    static void getMemberBar()
+    {
+        //foo32 f = new foo32(); new A32( &(f.bar) );
+        new A32( &((new foo32()).bar) );
+    }
+
+    int bar()
+    {
+        return 0;
+    }
+}
+
+
+void test32()
+{
+    foo32.getMemberBar();
+}
+
+
+/************************************/
+
+void[] foo33(int[] b)
+{
+    return b;
+}
+
+void test33()
+{
+    int[6] c;
+    void[] v;
+
+    v = foo33(c);
+    assert(v.length == 6 * int.sizeof);
+}
+
+/************************************/
+
+void test34()
+{
+    version (D_Bits)
+    {
+        bool[8] a8;
+        assert(a8.sizeof == 4);
+        bool[16] a16;
+        assert(a16.sizeof == 4);
+        bool[32] a32;
+        assert(a32.sizeof == 4);
+        bool[256] a256;
+        assert(a256.sizeof == 32);
+    }
+}
+
+/************************************/
+
+void test35()
+{
+    typeof(1 + 2) i;
+
+    assert(i.sizeof == int.sizeof);
+    assert(typeof('c').sizeof == char.sizeof);
+    assert(typeof(1).sizeof == int.sizeof);
+    assert(typeof(1.0F).sizeof == float.sizeof);
+    assert(typeof(1.0).sizeof == double.sizeof);
+    assert(typeof(1.0L).sizeof == real.sizeof);
+
+    //assert(((typeof(1.0L))i).sizeof == real.sizeof);
+    assert((cast(typeof(1.0L))i).sizeof == real.sizeof);
+}
+
+/************************************/
+
+void test36x()
+{
+    version (Win32)
+    {
+//      stdin.getch();
+    }
+}
+
+void test36()
+{
+}
+
+
+/************************************/
+
+struct T37
+{
+    char x;
+
+    T37 create()
+    {   T37 t;
+        t.x = 3;
+        return t;
+    }
+
+    bool test1()
+    {
+        return create() == this;
+    }
+
+    bool test2()
+    {
+        return this == create();
+    }
+}
+
+
+void test37()
+{
+    T37 t;
+
+    assert(!t.test1());
+    t.x = 3;
+    assert(t.test1());
+
+    t.x = 0;
+    assert(!t.test2());
+    t.x = 3;
+    assert(t.test2());
+}
+
+/************************************/
+
+void test38()
+{
+    uint f(uint n) { return n % 10; }
+
+    printf("%u\n", uint.max);
+    printf("%u\n", f(uint.max));
+    assert(f(uint.max) == 5);
+}
+
+/************************************/
+
+void test39()
+{
+    short s=HIWORD (0x0FFFDDDD);
+    short t=LOWORD (0xFFFFCCCC);
+    short v=HIWORD_(0x0FFFEEEE);
+    short x=HIWORD_(0xFFFFAAAA);
+
+    printf("%x %x %x %x\n",s,t,v,x);
+    assert(s == 0xFFF);
+    assert(t == 0xFFFFCCCC);
+    assert(v == 0xFFF);
+    assert(x == 0xFFFFFFFF);
+}
+
+short HIWORD(uint i)
+{
+    return cast(short)(( i >> 16) & 0xFFFF);
+}
+
+short LOWORD(uint i)
+{
+
+    return cast(short)i;
+}
+extern (C) short HIWORD_(uint i)
+{
+    return cast(short)(( i >> 16) & 0xFFFF);
+}
+
+
+/************************************/
+
+class caller40 {
+   caller40 opCall (out int i) {
+      i = 10;
+      return this;
+   }
+}
+
+void test40()
+{
+   caller40 c = new caller40;
+   int x,y;
+   c(x)(y);
+   assert(x == 10);
+   assert(y == 10);
+}
+
+/************************************/
+
+class Foo41 { void print() {printf("Foo41\n");} }
+
+class Bar41 : Foo41
+{
+    void test()
+    {
+        void printFoo41()
+        {
+            super.print();      // DMD crashes here
+        }
+        printFoo41();
+    }
+}
+
+void test41()
+{
+    Bar41 b = new Bar41();
+    b.test();
+}
+
+/************************************/
+
+interface Interface
+{
+    void foo42();
+}
+
+void bar42(Interface i)
+{
+    i.foo42();
+}
+
+class Abstract : Interface
+{
+    abstract void foo42();
+}
+
+class Concrete : Abstract
+{
+    override void foo42() { printf("Concrete.foo42(this = %p)\n", this); }
+}
+
+class Sub : Concrete
+{
+}
+
+void test42()
+{
+    Sub s = new Sub();
+    s.foo42();
+    bar42(s);
+}
+
+/************************************/
+
+class A43
+{
+    int foo() { return 6; }
+}
+
+int bar43(A43 a)
+{
+    return a.foo;
+}
+
+void test43()
+{
+    A43 a = new A43();
+    assert(bar43(a) == 6);
+}
+
+
+/************************************/
+
+class C44
+{
+    const char[][] arrArr=["foo"];
+}
+
+void test44()
+{
+  C44 c= new C44();
+  printf("%.*s\n", c.arrArr[0].length, c.arrArr[0].ptr);
+  assert(c.arrArr[0] == "foo");
+}
+
+
+/************************************/
+
+void test45()
+{
+    void* p;
+    void[] data;
+
+    data = p[0 .. 5];
+}
+
+/************************************/
+
+union A46
+{
+    char c;
+    struct { short s; }
+    struct { long  l; }
+    int a;
+    struct { float f; }
+}
+
+void test46()
+{
+    A46 a;
+    printf("%d\n", cast(byte*)&a.c - cast(byte*)&a);
+    printf("%d\n", cast(byte*)&a.s - cast(byte*)&a);
+    printf("%d\n", cast(byte*)&a.l - cast(byte*)&a);
+    printf("%d\n", cast(byte*)&a.a - cast(byte*)&a);
+    printf("%d\n", cast(byte*)&a.f - cast(byte*)&a);
+
+    assert(cast(byte*)&a.c == cast(byte*)&a);
+    assert(cast(byte*)&a.s == cast(byte*)&a);
+    assert(cast(byte*)&a.l == cast(byte*)&a);
+    assert(cast(byte*)&a.a == cast(byte*)&a);
+    assert(cast(byte*)&a.f == cast(byte*)&a);
+}
+
+
+/************************************/
+
+class Bug47
+{
+
+    void foo()
+    {
+    }
+
+    static void foo(int i)
+    {
+    }
+
+    static void bar()
+    {
+        foo(1);
+    }
+}
+
+void test47()
+{
+}
+
+
+/************************************/
+
+int[2] x48 = 3;
+float y48 = 0.0f;
+
+void test48()
+{
+    printf("%d, %d\n", x48[0], x48[1]);
+    assert(x48[0] == 3 && x48[1] == 3);
+
+    y48 = -100;
+
+    printf("%d, %d\n", x48[0], x48[1]);
+    assert(x48[0] == 3 && x48[1] == 3);
+}
+
+/************************************/
+
+struct Baz49 { int x,y,z,t; }
+
+void foo49(out Baz49 x, out int y)
+{
+}
+
+void test49()
+{
+    int y = 3;
+    Baz49 b;
+    assert(b.x == 0);
+    assert(b.y == 0);
+    assert(b.z == 0);
+    assert(b.t == 0);
+    b.x = 1;
+    b.y = 6;
+    b.z = 10;
+    b.t = 11;
+    foo49(b, y);
+    assert(b.x == 0);
+    assert(b.y == 0);
+    assert(b.z == 0);
+    assert(b.t == 0);
+    assert(y == 0);
+}
+
+/************************************/
+
+void foo50(int[] f, ...)
+{
+    foreach(int i, TypeInfo ti; _arguments) { }
+}
+
+void bar50(out int[] f, ...)
+{
+    foreach(int i, TypeInfo ti; _arguments) { }
+}
+
+void test50()
+{
+    int[] a;
+
+    foo50(a, 1, 2, 3);
+    bar50(a, 1, 2, 3);
+}
+
+
+/************************************/
+
+deprecated int tri(int x)
+{
+    return x*(x+1)/2;
+}
+
+deprecated int pent(int x)
+{
+    return x*x + tri(x) - x;
+}
+
+deprecated class Qwert
+{
+    int yuiop;
+
+    this(int y) { yuiop = y; }
+
+    int twiceYuiop()
+    {
+        return 2 * yuiop;
+    }
+
+    invariant()
+    {
+        assert (yuiop < 100);
+    }
+}
+
+void test51()
+{
+}
+
+/************************************/
+
+void foo52(double d) {}
+deprecated void foo52(int i) {}
+
+deprecated void bar52(int i) {}
+void bar52(double d) {}
+
+void test52()
+{
+//    foo52(1);
+    foo52(1.0);
+    bar52(1.0);
+}
+
+/************************************/
+
+class X53
+{
+    void foo(double d) {}
+    deprecated void foo(int i) {}
+
+    deprecated void bar(int i) {}
+    void bar(double d) {}
+}
+
+void test53()
+{
+    X53 x = new X53();
+    //x.foo(1);
+    //x.bar(1);
+    x.foo(1.0);
+    x.bar(1.0);
+}
+
+/************************************/
+
+interface B54 : A54
+{
+  A54 getParent();
+}
+
+interface A54
+{
+  void parse(char[] systemId);
+}
+
+void test54()
+{
+}
+
+
+/************************************/
+
+class Writer
+{
+    int put (bool x){ return 1; }
+    int put (int x){ return 2; }
+}
+
+class MyWriter : Writer
+{
+    alias Writer.put put;
+
+    override int put (bool x){ return 3; }
+}
+
+void test55()
+{
+    MyWriter m = new MyWriter();
+
+    assert(m.put(false) == 3);
+    assert(m.put(1) == 2);
+}
+
+
+/************************************/
+
+class Foo56
+{
+    alias int baseType;
+}
+
+void test56()
+{
+    Foo56 f = new Foo56;
+
+    f.baseType s = 10;
+}
+
+
+/************************************/
+
+void det(float mat[][])
+{
+    float newmat[][];
+
+    size_t i = newmat[0 .. (mat.length - 1)].length;
+}
+
+void test57()
+{
+}
+
+
+/************************************/
+
+int foo58 (int a, int t) { return 2; }
+
+class A58
+{
+    int foo58 ( ) { return 3; }
+    alias .foo58 foo58;
+}
+
+void test58()
+{   int y, x;
+
+    with ( new A58 )
+    {   y = foo58(0,1);
+        x = foo58();
+    }
+    assert(y == 2);
+    assert(x == 3);
+}
+
+
+/************************************/
+
+void test59()
+{
+    struct data
+    {
+        int b1=-1;
+        int b2=2;
+    }
+
+    data d;
+    assert(d.b1 == -1);
+    assert(d.b2 == 2);
+}
+
+
+/************************************/
+
+class Foo60
+{
+   int x;
+static:
+   this() { x = 3; }
+   ~this() { }
+}
+
+
+void test60()
+{
+    Foo60 f = new Foo60();
+
+    assert(f.x == 3);
+}
+
+
+/************************************/
+
+class StdString
+{
+     alias std.string.format toString;
+}
+
+void test61()
+{
+    int i = 123;
+    StdString g = new StdString();
+    string s = g.toString("%s", i);
+    printf("%.*s\n", s.length, s.ptr);
+    assert(s == "123");
+}
+
+
+/************************************/
+
+void test62()
+{   char[4] a;
+
+    assert(a[0] == 0xFF);
+    assert(a[1] == 0xFF);
+    assert(a[2] == 0xFF);
+    assert(a[3] == 0xFF);
+}
+
+
+/************************************/
+
+void test63()
+{
+    bool b;
+    real r;
+    int i;
+
+    i=cast(double) b ? 1 : 4;
+    r=cast(real) b ? 1.0 : 2.0;
+}
+
+
+/************************************/
+
+struct MyStruct64
+{
+    int test(short s){printf("dynamic short\n"); return 1; }
+    int test(int i){printf("dynamic int\n"); return 2; }
+    static int staticTest(short s){printf("static short\n"); return 3; }
+    static int staticTest(int i){printf("static int\n"); return 4; }
+}
+
+void test64()
+{
+    MyStruct64 S;
+    int j;
+
+    short s = 1;
+    int i = 1;
+
+    j = S.test(s);
+    assert(j == 1);
+    j = S.test(i);
+    assert(j == 2);
+
+    j = S.staticTest(s);
+    assert(j == 3);
+    j = S.staticTest(i);
+    assert(j == 4);
+
+}
+
+/************************************/
+
+void test65()
+{
+    int[8] qwert;
+    int[] yuiop = qwert[2..5] = 4;
+
+    assert(yuiop.length == 3);
+    assert(yuiop[0] == 4);
+    assert(yuiop[1] == 4);
+    assert(yuiop[2] == 4);
+    yuiop[1] = 2;
+    assert(qwert[0] == 0);
+    assert(qwert[1] == 0);
+    assert(qwert[2] == 4);
+    assert(qwert[3] == 2);
+    assert(qwert[4] == 4);
+    assert(qwert[5] == 0);
+    assert(qwert[6] == 0);
+    assert(qwert[7] == 0);
+}
+
+
+/************************************/
+
+void foo66(ref bool b)
+{
+    b = true;
+}
+
+void test66()
+{
+    bool[3] a;
+
+    foo66(a[0]);
+    assert(a[0] == true);
+    assert(a[1] == false);
+    assert(a[2] == false);
+}
+
+
+/************************************/
+
+class FuBar
+{
+        void foo ()
+        {
+                printf ("should never get here\n");
+                assert(0);
+        }
+
+        const(void)[] get ()
+        {
+                return "weqweqweqweqwee";
+        }
+
+        void test (void* dst)
+        {
+                uint count = 7;
+                while (count)
+                      {
+                      // get as much as there is available in the buffer
+                      uint available = 10;
+
+                      // cap bytes read
+                      if (available > count)
+                          available = count;
+
+                      // copy them over
+                      dst[0..available] = get ()[0..available];
+
+                      // bump counters
+                      dst += available;
+                      if ((count -= available) > 0)
+                           foo ();
+                      }
+        }
+}
+
+
+void test67()
+{
+    FuBar b = new FuBar();
+    char[10] dst;
+    b.test(&dst[0]);
+}
+
+
+/************************************/
+
+struct Foo68 { int a,b,c,d; }
+
+void bar68(out Foo68 f)
+{
+    f.a = 28;
+}
+
+void test68()
+{
+    Foo68 f;
+    bar68(f);
+    assert(f.a == 28);
+}
+
+/************************************/
+
+class ConduitStyle
+{
+
+//      static ConduitStyle     Read;
+//      static ConduitStyle     ReadWrite;
+
+        static ConduitStyle     Read, ReadWrite;
+}
+
+void test69()
+{
+}
+
+
+/************************************/
+
+void test70()
+{
+    printf("-5/3 prints: %d\n", -5/3);
+    printf("-5/2 prints: %d\n", -5/2);
+    printf("-7/3 prints: %d\n", -7/3);
+    printf("-7/4 prints: %d\n", -7/4);
+    printf("-7/7 prints: %d\n", -7/7);
+    printf("-8/7 prints: %d\n", -8/7);
+    printf("-12/6 prints: %d\n", -12/6);
+    printf("12/6 prints: %d\n", 12/6);
+    printf("-9/7 prints: %d\n", -9/7);
+    printf("-11/8 prints: %d\n", -11/8);
+    printf("-7/9 prints: %d\n", -7/9);
+
+    assert(-5/3 == -1);
+    assert(-5/2 == -2);
+    assert(-7/3 == -2);
+    assert(-7/4 == -1);
+    assert(-7/7 == -1);
+    assert(-8/7 == -1);
+    assert(-12/6 == -2);
+    assert(12/6 == 2);
+    assert(-9/7 == -1);
+    assert(-11/8 == -1);
+    assert(-7/9 == 0);
+}
+
+/************************************/
+
+void insertText(string str)
+{
+    assert(str == "a ");
+}
+
+char getCharAt()
+{
+    return 'a';
+}
+
+void test71()
+{
+    insertText(getCharAt() ~ " ");
+}
+
+/************************************/
+
+public class Foo72
+{
+    public this() { }
+}
+
+void test72()
+{
+    Foo72[] foos;
+
+    foos = new Foo72() ~ foos[];
+    assert(foos.length == 1);
+}
+
+
+/************************************/
+
+int main()
+{
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test56();
+    test57();
+    test58();
+    test59();
+    test60();
+    test61();
+    test62();
+    test63();
+    test64();
+    test65();
+    test66();
+    test67();
+    test68();
+    test69();
+    test70();
+    test71();
+    test72();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test15079.d b/gcc/testsuite/gdc.test/runnable/test15079.d
new file mode 100644
index 00000000000..5316d73e2ca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test15079.d
@@ -0,0 +1,5 @@
+module test15079;
+
+import imports.a15079;
+
+void main() {}
diff --git a/gcc/testsuite/gdc.test/runnable/test16.d b/gcc/testsuite/gdc.test/runnable/test16.d
new file mode 100644
index 00000000000..06741f5bcc7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test16.d
@@ -0,0 +1,386 @@
+// REQUIRED_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+/************************************************/
+// These seem to be the original tests for $ (originally 'length').
+
+int x;
+
+int[] bar(int[] a)
+{
+    x++;
+    return a[0 .. $ - 1];
+}
+
+void test1()
+{
+  {
+    int[4] foo;
+
+    foo[$ - 2] = 4;
+    assert(foo[0] == 0);
+    assert(foo[1] == 0);
+    assert(foo[2] == 4);
+    assert(foo[3] == 0);
+
+    foo[3] = 5;
+    assert(foo[$ - 1] == 5);
+
+    x = 0;
+    bar(foo)[$ - 3] = 6;
+    assert(x == 1);
+    assert(foo[0] == 6);
+
+    assert(bar(foo)[$ * 2 - 1 - $] == 4);
+    assert(x == 2);
+
+    foo[0 .. $] = 1;
+    assert(foo[0] == 1);
+    assert(foo[1] == 1);
+    assert(foo[2] == 1);
+    assert(foo[3] == 1);
+
+    x = 0;
+    bar(foo)[1 .. $ * 3 - $ - $] = 2;
+    assert(x == 1);
+    assert(foo[0] == 1);
+    assert(foo[1] == 2);
+    assert(foo[2] == 2);
+    assert(foo[3] == 1);
+
+    int[] a = new int[3];
+    a[0..$] = foo[0..$-1];
+    assert(a[0] == 1);
+    assert(a[1] == 2);
+    assert(a[2] == 2);
+    a[] = 4;
+    a[0..$] = bar(foo)[0..$];
+    assert(x == 2);
+    assert(a[0] == 1);
+    assert(a[1] == 2);
+    assert(a[2] == 2);
+  }
+
+  {
+    int[4] f; int[] foo = f;
+
+    foo[$ - 2] = 4;
+    assert(foo[0] == 0);
+    assert(foo[1] == 0);
+    assert(foo[2] == 4);
+    assert(foo[3] == 0);
+
+    foo[3] = 5;
+    assert(foo[$ - 1] == 5);
+
+    x = 0;
+    bar(foo)[$ - 3] = 6;
+    assert(x == 1);
+    assert(foo[0] == 6);
+
+    assert(bar(foo)[$ * 2 - 1 - $] == 4);
+    assert(x == 2);
+
+    foo[0 .. $] = 1;
+    assert(foo[0] == 1);
+    assert(foo[1] == 1);
+    assert(foo[2] == 1);
+    assert(foo[3] == 1);
+
+    x = 0;
+    bar(foo)[1 .. $ * 3 - $ - $] = 2;
+    assert(x == 1);
+    assert(foo[0] == 1);
+    assert(foo[1] == 2);
+    assert(foo[2] == 2);
+    assert(foo[3] == 1);
+
+    int[] a = new int[3];
+    a[0..$] = foo[0..$-1];
+    assert(a[0] == 1);
+    assert(a[1] == 2);
+    assert(a[2] == 2);
+    a[] = 4;
+    a[0..$] = bar(foo)[0..$];
+    assert(x == 2);
+    assert(a[0] == 1);
+    assert(a[1] == 2);
+    assert(a[2] == 2);
+  }
+}
+
+/************************************************/
+
+struct ICONINFO
+{
+    bool fIcon;
+}
+
+void test2()
+{
+     ICONINFO info;
+     info.fIcon = true;
+     assert(info.fIcon == true);
+}
+
+
+/************************************************/
+
+class A3
+{
+    void foo()
+    {
+        printf("A.foo \n" );
+    }
+}
+
+class B3 : A3
+{
+}
+
+class C3 : B3
+{
+    override void foo()
+    {
+        printf("C.foo \n" );
+        super.foo();
+    }
+}
+
+void test3()
+{
+    C3 c = new C3();
+    c.foo();
+}
+
+
+/************************************************/
+
+void test4()
+{
+    int function (int i) x = function int (int i) { return i * 2; };
+    int function (int i) y = function int (int i) { return i / 2; };
+
+    int k;
+    k = x(2);
+    assert(k == 4);
+    k = y(3);
+    assert(k == 1);
+}
+
+
+/************************************************/
+
+class Parser
+{
+    void next(ref int test)
+    {
+        void work (int input)
+        {
+            printf("work(%d, %d)\n", input, test);
+            test = 2;
+        }
+
+        test = 3;
+        work(4);
+    }
+}
+
+
+void test5()
+{
+    Parser parser = new Parser();
+    int test;
+
+    parser.next (test);
+    printf("test %d\n", test);
+    assert(test == 2);
+}
+
+
+/************************************************/
+
+void foo6(out int bar)
+{
+}
+
+void test6()
+{
+    int bar = 3;
+    foo6(bar);
+    printf("%d", bar );
+    assert(bar == 0);
+//    return 0;
+}
+
+/************************************************/
+
+void test7()
+{
+   char ch = ' ';
+   char[] u;
+   u.length = 3;
+
+   int i = 2;
+
+   printf("a\n");
+   u[0..2] = ch;
+   printf("b\n");
+   u[0..i] = ch;
+   printf("c\n");
+   assert(u[0] == 0x20);
+   assert(u[1] == 0x20);
+}
+
+
+/************************************************/
+
+struct X8
+{
+    bool flag;
+}
+
+void test8()
+{
+    X8 x;
+    x.flag = 0 != 0;
+}
+
+
+/************************************************/
+
+void foo9(float x)
+{
+    assert(x == 0.0f);
+}
+
+void len9(float x, float y, float z, float t)
+{
+    foo9(x*x+y*y+z*z);
+}
+
+void test9()
+{
+    float[4] a;
+    a[0] = a[1] = a[2] = a[3] = 0.0f;
+
+    for (int y = 0; y < 7; ++y)
+    {
+        len9(a[0], a[1], a[2], a[3]);
+
+        float justOne() { return 1.0f; }
+
+        float dot = justOne();
+        if (dot < 0.0f)
+            dot = 0.0f;
+    }
+}
+
+/************************************************/
+
+ubyte[4] arr10;
+
+void foo10()
+{
+  *cast(float*)(&arr10[0]) = 3.25;
+}
+
+uint bar10()
+{
+  uint result = *cast(uint*)&arr10[0];
+  return result;
+}
+
+float baz10()
+{
+  uint result = bar10();
+  return *cast(float*)&result;
+}
+
+void test10()
+{
+  foo10();
+  float x = baz10();
+
+  assert(x == 3.25);
+}
+
+
+/************************************************/
+
+interface I11
+{
+  void M ();
+}
+
+interface J11 : I11
+{
+  void N ();
+}
+
+class A11 : I11
+{
+  void M () { printf("A.M()\n"); }
+}
+
+class B11 : A11, J11
+{
+  void N () { printf("B.N()\n"); }
+}
+
+void test11()
+{
+  I11 f = new B11 ();
+
+  f.M();
+}
+
+
+/************************************************/
+
+int x12;
+
+void test12()
+{
+    static class S
+    {
+        static this()
+        {
+            printf ("static constructor\n");
+            x12 += 1;
+        }
+
+        this()
+        {
+            printf ("class constructor\n");
+            x12 += 10;
+        }
+    }
+
+    assert(x12 == 1);
+    new S;
+    assert(x12 == 11);
+}
+
+
+/************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test16115.d b/gcc/testsuite/gdc.test/runnable/test16115.d
new file mode 100644
index 00000000000..c8ad4649f2c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test16115.d
@@ -0,0 +1,38 @@
+/*
+REQUIRED_ARGS: -d
+PERMUTE_ARGS:
+ */
+
+// https://issues.dlang.org/show_bug.cgi?id=16115
+// https://github.com/dlang/dmd/pull/3979
+
+int n;
+
+struct Test
+{
+    enum tag = 42;
+}
+
+enum tagx = 42;
+
+auto call()
+{
+    version (none) // works
+    {
+        n = Test.tag;
+        return null;
+    }
+    else // assert error
+    {
+        //return n = tagx, null;
+        return n = Test.tag, null;
+        //return n = Test.tag;
+    }
+}
+
+void main()
+{
+    call();
+
+    assert(n == 42);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test16980.d b/gcc/testsuite/gdc.test/runnable/test16980.d
new file mode 100644
index 00000000000..ea94d2219a5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test16980.d
@@ -0,0 +1,22 @@
+// https://issues.dlang.org/show_bug.cgi?id=16980
+interface A { void foo(); }
+interface B { void bar(); }
+interface AB : A, B {}
+class C : AB {
+    void foo() { assert(false, "Must never be called!"); }
+    void bar() {}
+}
+
+struct T() {
+    AB ab;
+    ~this() {
+        ab.bar(); // uses wrong vtable
+    }
+}
+
+T!() tinst; // triggers semantic3 of dtor from Module::semantic(1)
+
+void main()
+{
+    auto dst = T!()(new C);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test17.d b/gcc/testsuite/gdc.test/runnable/test17.d
new file mode 100644
index 00000000000..58873a095e6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test17.d
@@ -0,0 +1,43 @@
+
+import core.stdc.stdio: fflush, stdout;
+
+extern(C) int printf(const char*, ...);
+
+void ulog(string s)
+{
+    printf("%.*s\n",s.length, s.ptr);
+    fflush(stdout);
+}
+
+int open()
+{
+    char *s;
+    char abs[2000];
+    char qu[100];
+    int a;
+    ulog("reaches this only 9 times of 10!\n");
+    return 0;
+}
+
+
+int yhenda()
+{
+    char MEM[2200];
+    int a;
+    ulog("point(2.1) \n");
+    open();
+    ulog("point(2.2) \n");
+    return 0;
+}
+
+
+int main()
+{
+    printf("Content-type: text/html\n\n");
+    fflush(stdout);
+    ulog("point(1.1)\n");
+    yhenda();
+    ulog("point(1.2)\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test17072.d b/gcc/testsuite/gdc.test/runnable/test17072.d
new file mode 100644
index 00000000000..019331daa67
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test17072.d
@@ -0,0 +1,13 @@
+/*
+REQUIRED_ARGS: -inline
+PERMUTE_ARSG: -release -O -dip25
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=17072
+
+import core.thread;
+
+void main()
+{
+        Thread.sleep(dur!"msecs"(0));
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test17073.d b/gcc/testsuite/gdc.test/runnable/test17073.d
new file mode 100644
index 00000000000..82df219254d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test17073.d
@@ -0,0 +1,13 @@
+struct S0
+{
+    int x = void;
+}
+struct S1
+{
+    S0  x = S0(42);
+}
+void main()
+{
+    S1  x;
+    assert(x.x.x == 42);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test17338.d b/gcc/testsuite/gdc.test/runnable/test17338.d
new file mode 100644
index 00000000000..5c5012fecdd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test17338.d
@@ -0,0 +1,25 @@
+// PERMUTE_ARGS:
+// Generate \sum_{i=0}^{14} 2^i = 32767 template instantiations
+// (each with 3 sections) to use more than 64Ki sections in total.
+version (Win32)
+{
+    // Apparently omf or optlink does not support more than 32767 symbols.
+    void main()
+    {
+    }
+}
+else
+{
+    size_t foo(size_t i, size_t mask)()
+    {
+        static if (i == 14)
+            return mask;
+        else
+            return foo!(i + 1, mask) + foo!(i + 1, mask | (1UL << i));
+    }
+
+    void main()
+    {
+        assert(foo!(0, 0) != 0);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test17684.d b/gcc/testsuite/gdc.test/runnable/test17684.d
new file mode 100644
index 00000000000..4734d962810
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test17684.d
@@ -0,0 +1,132 @@
+struct StructField(T)
+{
+    static T Field;
+    static alias Field this;
+}
+
+struct StructProperty(T)
+{
+    static T Field;
+	
+	static @property T property()
+	{
+		return Field;	
+	}
+	
+	static @property void property(T value)
+	{
+		Field = value;	
+	}
+	
+    static alias property this;
+}
+
+class ClassField(T)
+{
+    static T Field;
+    static alias Field this;
+}
+
+class ClassProperty(T)
+{
+    static T Field;
+	
+	static @property T property()
+	{
+		return Field;	
+	}
+	
+	static @property void property(T value)
+	{
+		Field = value;	
+	}
+	
+    static alias property this;
+}
+
+bool boolTest(T)()
+{
+    alias t = T;
+
+    t = false;                    // tests AssignExp
+    assert(t == false);
+
+    bool boolValue = t;           // tests AssignExp
+    assert(boolValue == false);
+
+    t = !t;                       // tests NotExp
+    assert(t == true);
+
+    boolValue = t;
+    assert(boolValue == true);
+
+    assert(boolValue && t);       // tests AndAndExp
+    assert(t && boolValue);
+
+    boolValue = false;
+    assert(boolValue || t);       // tests OrOrExp
+    assert(t || boolValue);
+
+    assert(t != boolValue);       // tests CmpExp
+    assert(boolValue != t);
+
+    boolValue = true;
+    assert(t == boolValue);
+    assert(boolValue == t);
+
+    t = true;
+    return t;                     // tests ReturnStatement
+}
+
+int intTest(T)()
+{
+    alias t = T;
+
+    t = 42;                       // tests AssignExp
+    assert(t == 42);
+
+    int intValue = t;
+    assert(intValue == 42);
+
+    assert(t == 42);              // tests CmpExp
+    assert(42 == t);
+    assert(t != 43);
+    assert(43 != t);
+    assert(t < 43);
+    assert(43 > t);
+    assert(t <= 42);
+    assert(42 >= t);
+
+    // These currently don't work for properties due to https://issues.dlang.org/show_bug.cgi?id=8006
+    static if (!(typeid(T) is typeid(StructProperty!int)) && !(typeid(T) is typeid(ClassProperty!int)))
+    {
+        t++;              // test a few unary and binary operators
+        assert(t == 43);
+
+        t += 1;
+        assert(t == 44);
+
+        t--;
+        assert(t == 43);
+
+        t -= 1;
+        assert(t == 42);
+    }
+
+    assert(~t == ~42);            // tests ComExp
+
+    return t;                     // tests ReturnStatement
+}
+
+void main()
+{
+    assert(boolTest!(StructField!(bool))());
+    assert(boolTest!(StructProperty!(bool))());
+    assert(boolTest!(ClassField!(bool))());
+    assert(boolTest!(ClassProperty!(bool))());
+
+    assert(intTest!(StructField!(int))() == 42);
+    assert(intTest!(StructProperty!(int))() == 42);
+    assert(intTest!(ClassField!(int))() == 42);
+    assert(intTest!(ClassProperty!(int))() == 42);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test19.d b/gcc/testsuite/gdc.test/runnable/test19.d
new file mode 100644
index 00000000000..b9360eeeabb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test19.d
@@ -0,0 +1,480 @@
+// REQUIRED_ARGS: -unittest
+
+import std.algorithm: cmp;
+
+extern(C) int printf(const char*, ...);
+
+/* ================================ */
+
+class Foo
+{
+    int foo(int x) { return x + 3; }
+}
+
+class Bar : Foo
+{
+    override int foo(int y) { return y + 4; }
+}
+
+void test1()
+{
+    Bar e;
+
+    assert(e is null);
+    e = new Bar();
+    assert(e.foo(5) == 9);
+}
+
+/* ================================ */
+
+class Foo2
+{
+    int foo(int x)
+    {
+        return x + 3;
+    }
+}
+
+class Bar2 : Foo2
+{
+    override int foo(int y)
+    {
+        assert(Foo2.foo(2) == 5);
+        return y + 4;
+    }
+}
+
+void test2()
+{
+    Bar2 e;
+
+    assert(e is null);
+    e = new Bar2();
+    assert(e.foo(5) == 9);
+    assert(e.Foo2.foo(10) == 13);
+}
+
+/* ================================ */
+
+void test3()
+{
+    debug printf("debug\n");
+    debug(1) printf("debug(1)\n");
+    debug(2) printf("debug(2)\n");
+    debug(3) printf("debug(3)\n");
+    debug(bar) printf("debug(bar)\n");
+    debug(10) assert(0);
+
+    debug(1)
+    {
+        int d1 = 3;
+
+        printf("debug(1) { }\n");
+    }
+    debug(2)
+    {
+        printf("debug(2): d1 = %d\n", d1);
+    }
+}
+
+/* ================================ */
+
+int x1;
+int x2;
+
+class Foo4
+{
+    static  this() { x1 = 3; printf("Foo4 ctor()\n"); }
+    static ~this() { x1 = 4; printf("Foo4 dtor()\n"); }
+}
+
+static  this() { x2 = 5; printf("ctor()\n"); }
+static ~this() { x2 = 6; printf("dtor()\n"); }
+
+void test4()
+{
+    printf("x1 = %d, x2 = %d\n", x1, x2);
+    assert(x1 == 3);
+    assert(x2 == 5);
+}
+
+/* ================================ */
+
+void test5()
+{
+    version (D_Bits)
+    {
+    printf("test5()\n");
+    static uint foo;
+    static uint x = 3;
+    static uint len = 32;
+
+    bool[] bools;
+
+    bools = (cast(bool *)&foo)[0..len];
+    bools[6] = true;
+    assert(foo == (1 << 6));
+    }
+}
+
+/* ================================ */
+
+int[] test6_1(int[] a)
+{
+    a.length = 6;
+    return a;
+}
+
+void test6()
+{
+    printf("test6()\n");
+    int b[3];
+    int a[];
+
+    b[0] = 0;
+    b[1] = 1;
+    b[2] = 2;
+    assert(b.length == 3);
+    a = test6_1(b);
+    a[2] = 2;
+    assert(a.length == 6);
+}
+
+/* ================================ */
+
+class OutBuffer7
+{
+    char data[];
+    uint offset;
+
+    void write(const(char) *p, uint nbytes)
+    {
+        data[offset .. offset + nbytes] = (cast(char *)p)[0 .. nbytes];
+    }
+}
+
+
+void test7()
+{
+    printf("test7()\n");
+    int i;
+    OutBuffer7 ob = new OutBuffer7;
+
+    ob.data = new char[10];
+    printf("ob.data.length = %d\n", ob.data.length);
+    assert(ob.data.length == 10);
+    for (i = 0; i < 10; i++)
+        assert(ob.data[i] == char.init);
+
+printf("test7.1()\n");
+    ob.data[] = '-';
+printf("test7.2()\n");
+    printf("ob.data[] = '%.*s'\n", ob.data.length, ob.data.ptr);
+    for (i = 0; i < 10; i++)
+        assert(ob.data[i] == '-');
+
+    ob.offset = 3;
+    ob.write("foo", 3);
+    printf("ob.data.length = %d\n", ob.data.length);
+    printf("ob.data[] = '%.*s'\n", ob.data.length, ob.data.ptr);
+    for (i = 0; i < 10; i++)
+    {
+        if (i < 3 || i >= 6)
+            assert(ob.data[i] == '-');
+    }
+    assert(ob.data[3] == 'f');
+    assert(ob.data[4] == 'o');
+    assert(ob.data[5] == 'o');
+}
+
+/* ================================ */
+
+class A8
+{
+    enum { bar = 8, baz }
+    int foo;
+}
+
+void test8()
+{
+    printf("test8()\n");
+    A8 a;
+    a = new A8();
+    a.foo = A8.bar;
+    assert(a.foo == 8);
+}
+
+/* ================================ */
+
+
+int z9;
+
+unittest
+{
+    printf("module unittest 9\n");
+    z9 = 3;
+}
+
+
+void test9()
+{
+    assert(z9 == 3);
+}
+
+/* ================================ */
+
+void test10()
+{
+    printf("test10()\n");
+    const int i = 8000;
+    assert(i == 8000);
+    static int j = 78;
+    assert(j == 78);
+}
+
+/* ================================ */
+
+Object test11_a()
+{
+    return null;
+}
+
+void test11()
+{
+    assert(test11_a() is null);
+}
+
+/* ================================ */
+
+class A12 { }
+class B12 { }
+
+int testx(A12 a) { return 1; }
+
+int testx(B12 b) { return 2; }
+
+void test12()
+{
+    A12 a = new A12();
+    B12 b = new B12();
+
+    assert(testx(a) == 1);
+    assert(testx(b) == 2);
+}
+
+/* ================================ */
+
+char[] tolower13(ref char[] s)
+{
+    int i;
+
+    for (i = 0; i < s.length; i++)
+    {
+        char c = s[i];
+        if ('A' <= c && c <= 'Z')
+            s[i] = cast(char)(c + (cast(char)'a' - 'A'));
+    }
+    return s;
+}
+
+void test13()
+{
+    char[] s1 = "FoL".dup;
+    char[] s2;
+
+    s1 = s1.dup;
+    s2 = tolower13(s1);
+    assert(cmp(s2, "fol") == 0);
+    assert(s2 == s1);
+}
+
+/* ================================ */
+
+alias ABC14* LPABC14;
+class ABC14 { }
+
+alias DEF14* LPDEF14;
+DEF14[3] foo;
+struct DEF14 { int x; }
+
+void test14()
+{
+    assert(foo.sizeof == int.sizeof * 3);
+}
+
+/* ================================ */
+
+class bools15
+{
+    bool a = true, b = true, c = true;
+    void dump()
+    {
+        printf("%d %d %d\n", a, b, c);
+    }
+}
+
+void test15()
+{
+     bools15 k = new bools15;
+     k.a = true; k.dump();
+     k.b = true; k.dump();
+     k.c = true; k.dump();
+     assert(k.a == true);
+     assert(k.b == true);
+     assert(k.c == true);
+}
+
+
+/* ================================ */
+
+align(4) struct foo16
+{
+    short s;
+    int i;
+}
+
+void test16()
+{
+    assert(foo16.sizeof == 8);
+}
+
+/* ================================ */
+
+enum Color { red, blue, green };
+int[Color.max+1] colors1 = [ Color.blue:6, Color.green:2, Color.red:5 ];
+
+
+enum { red, blue, green };
+int[3] colors2 = [ blue:6, green:2, red:5 ];
+
+void test17()
+{
+    assert(colors1.length == 3);
+    assert(colors1[0] == 5);
+    assert(colors1[1] == 6);
+    assert(colors1[2] == 2);
+    assert(colors2[0] == 5);
+    assert(colors2[1] == 6);
+    assert(colors2[2] == 2);
+}
+
+/* ================================ */
+
+
+alias void* HANDLE18;
+
+HANDLE18 testx18()
+{
+    return null;
+}
+
+void test18()
+{
+    assert(testx18() is null);
+}
+
+/* ================================ */
+
+class Test19 { struct { int a, b, c; } }
+
+void test19()
+{
+    Test19 t = new Test19();
+
+    t.a = 3;
+    assert(t.a == 3);
+}
+
+/* ================================ */
+
+bool tested20;
+
+struct S20
+{
+    unittest
+    {
+        assert(!tested20);
+        tested20 = true;
+    }
+}
+
+void test20()
+{
+    assert(tested20);
+}
+
+/* ================================ */
+// 7848
+
+@safe pure nothrow void func7848() {}
+
+@safe pure nothrow unittest
+{
+    func7848();
+}
+
+/* ================================ */
+// 8128
+
+int flag8128 = 0;
+
+interface I8128
+{
+    unittest
+    {
+        printf("utest, flag8128 = %d\n", flag8128);
+        flag8128 = 1;
+    }
+}
+
+void test8128()
+{
+    printf("main, flag8128 = %d\n", flag8128);
+    assert(flag8128 == 1);
+}
+
+/* ================================ */
+
+class C8635{
+        int x;
+        this(int x)
+        {
+                this.x = x;
+        }
+}
+void test8635()
+{
+        assert(new C8635(2).x==2);
+        assert(new C8635(3).x==3);
+}
+
+/* ================================ */
+
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test8128();
+    test8635();
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test20.d b/gcc/testsuite/gdc.test/runnable/test20.d
new file mode 100644
index 00000000000..63775662cf4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test20.d
@@ -0,0 +1,1296 @@
+import core.vararg;
+
+extern(C) int printf(const char*, ...);
+
+/*****************************************/
+
+class A1
+{
+    union
+    {
+        struct
+        {
+            int x;
+            public int y;
+        }
+        protected int z;
+    }
+}
+
+class A2
+{
+    struct
+    {
+        int x;
+        public int y;
+    }
+}
+
+class A3
+{
+    union
+    {
+        int x;
+        public int y;
+    }
+}
+
+void test1()
+{
+    A1 a1 = new A1();
+    A2 a2 = new A2();
+    A3 a3 = new A3();
+
+    a1.x = 1;
+    a1.y = 2;
+    a1.z = 3;
+    assert(a1.x == 3);
+    assert(a1.y == 2);
+
+    a2.x = 1;
+    a2.y = 2;
+    assert(a2.x == 1);
+
+    a3.x = 1;
+    a3.y = 2;
+    assert(a3.x == 2);
+}
+
+/*****************************************/
+
+struct A4
+{
+    union
+    {
+        struct
+        {
+            int x = 13;
+        }
+        int y;
+    }
+}
+
+void test4()
+{
+    printf("A4.sizeof = %d\n", A4.sizeof);
+    assert(A4.sizeof == 1 * int.sizeof);
+
+    A4 q;
+    assert(q.y == 13);
+}
+
+/*****************************************/
+
+class A5
+{
+     union {
+         struct {
+             int x;
+         }
+         public int y;
+     }
+}
+
+void test5()
+{
+     A5 a = new A5;
+
+     a.x = 3;
+     a.y = 4;
+     assert(a.x == 4);
+}
+
+/*****************************************/
+
+int i6 = 5;
+
+float m6 = 5.0;
+
+void test6()
+{
+  void f()
+  {
+    void i6(float j)
+    {
+        m6 = j;
+    }
+
+    void g()
+    {
+        i6 = 1;
+    }
+    g();
+  }
+
+  f();
+
+  printf( "%d %f\n", i6, m6);
+  assert(i6 == 5);
+  assert(m6 == 1);
+}
+
+/*****************************************/
+
+const int a1 = 50;
+const int a2 = 50;
+const int a3 = a1 * a2;
+
+const int b1 = a1 - 1;
+const int b2 = a2 - 1;
+
+const int c1 = 50*50;
+const int c2 = (a1-1)*(a2-1);
+const int c3 = b1*b2;
+
+int[4*c1]  array1;  // illegal!
+int[4*c2]  array2;  // illegal!
+int[4*c3]  array3;  // illegal!
+
+int[a3]    array4;  // valid! no error!
+
+void test7()
+{
+    assert(a1 == 50);
+    assert(a2 == 50);
+    assert(a3 == 2500);
+
+    assert(b1 == 49);
+    assert(b2 == 49);
+
+    assert(c1 == 2500);
+    assert(c2 == 2401);
+    assert(c3 == 2401);
+
+    assert(array1.length == 10000);
+    assert(array2.length == 9604);
+    assert(array3.length == 9604);
+}
+
+/*****************************************/
+
+struct Foo8
+{
+    static Foo8 bar()
+    {
+        Foo8 res;
+        return res;
+    }
+}
+
+void test8()
+{
+    Foo8[8] x;
+    x[] = Foo8.bar;
+}
+
+
+/*****************************************/
+
+void test9()
+{
+     try {
+     } catch (Exception e) {
+         debug printf("Exception happened\n");
+     }
+}
+
+/*****************************************/
+
+struct Foo10 {
+  const bool opEquals(const ref Foo10 x) {
+    return this.normalize is x.normalize;
+  }
+  const Foo10 normalize() {
+    Foo10 res;
+    return res;
+  }
+}
+
+void test10()
+{
+}
+
+
+/*****************************************/
+
+scope class T11
+{
+    this(){}
+    ~this(){}
+}
+
+void test11()
+{
+    scope T11 t=new T11();
+    int i=1;
+    switch(i)
+    {
+        case 1:
+            break;
+
+        default:
+            break;
+    }
+}
+
+/*****************************************/
+
+void test12()
+{
+        char[] s;
+        char[] t;
+
+        if (true)
+            s = null;
+        s = (true) ? null : t;
+        t = (true) ? s : null;
+}
+
+/*****************************************/
+
+class Foo13
+{
+       int init (int x) { return 1; }
+
+       static int init (long y) { return 2; }
+}
+
+void test13()
+{
+    Foo13 f = new Foo13();
+    int i;
+
+    i = f.init(1);
+    assert(i == 1);
+    i = f.init(1L);
+    assert(i == 2);
+}
+
+/*****************************************/
+
+void write14(bool[] c)
+{
+    printf("[%2d]: ", c.length);
+    foreach (bool x; c)
+        printf("%d,", x);
+    printf("\n");
+}
+
+void test14()
+{
+     static bool[] a = [ 1, 1, 0, 1, 0 ];
+     static bool[] b = [ 1, 0, 0, 1 ];
+     bool[] c = a ~ b;
+
+     static bool[] r1 = [1,1,0,1,0,1,0,0,1];
+     static bool[] r2 = [1,1,0,1,0,1,0,0,1,1,1,0,1,0];
+     static bool[] r3 = [1,1,0,1,0,1,0,0,1,1,1,0,1,0,0];
+     static bool[] r4 = [1,1,0,1,0,1,0,0,1,1,1,0,1,0,0,1];
+
+
+     write14(c);
+     assert(c == r1);
+
+     c ~= a;
+     write14(c);
+     assert(c == r2);
+
+     c ~= 0;
+     write14(c);
+     assert(c == r3);
+
+     c ~= 1;
+     write14(c);
+     assert(c == r4);
+}
+
+/*****************************************/
+
+void test15()
+{
+        bool[] b;
+        bool[] c;
+
+        b.length = 10;
+        c = b[0..4];
+        c[] = true;
+
+        assert(b[0] == true);
+        assert(b[1] == true);
+        assert(b[2] == true);
+        assert(b[3] == true);
+
+        assert(b[4] == false);
+        assert(b[5] == false);
+        assert(b[6] == false);
+        assert(b[7] == false);
+        assert(b[8] == false);
+        assert(b[9] == false);
+}
+
+/*****************************************/
+
+int y16;
+
+class C16
+{
+        new(size_t size, byte blah){
+                void* v = (new byte[C16.classinfo.initializer.length]).ptr;
+                y16 = 1;
+                assert(blah == 3);
+                return v;
+        }
+        int x;
+        this()
+        {
+            x = 4;
+        }
+}
+
+void test16()
+{
+    C16 c = new(3) C16;
+    assert(y16 == 1);
+    assert(c.x == 4);
+}
+
+/*****************************************/
+
+ubyte* ptr17;
+
+void test17()
+{
+    ubyte[16] foo;
+
+    printf("foo = %p\n", foo.ptr);
+    ptr17 = foo.ptr;
+    abc17(foo);
+}
+
+void abc17(ref ubyte[16] bar)
+{
+    printf("bar = %p\n", bar.ptr);
+    assert(bar.ptr == ptr17);
+}
+
+/*****************************************/
+
+struct Iterator18(T)
+{
+   T* m_ptr;
+
+   const bool opEquals(const ref Iterator18 iter)
+   {
+     return (m_ptr == iter.m_ptr);
+   }
+
+   const int opCmp(const ref Iterator18 iter)
+   {
+     return cast(int)(m_ptr - iter.m_ptr);
+   }
+}
+
+void test18()
+{
+    Iterator18!(int) iter;
+}
+
+/*****************************************/
+
+struct S29(T)
+{
+   const bool opEquals(const ref S29!(T) len2)
+   {
+     return 0;
+   }
+
+   const int opCmp(const ref S29!(T) len2)
+   {
+     return 0;
+   }
+}
+
+
+void test19()
+{
+   TypeInfo info = typeid(S29!(int));
+}
+
+
+/*****************************************/
+
+class Mapped : Buffer
+{
+        this()
+        {
+        }
+
+        ~this()
+        {
+        }
+}
+
+class Buffer
+{
+        private uint limit;
+        private uint capacity;
+        private uint position;
+
+        invariant()
+        {
+               assert (position <= limit);
+               assert (limit <= capacity);
+        }
+}
+
+void test20()
+{
+    Buffer b = new Buffer();
+    delete b;
+}
+
+/*****************************************/
+
+class T21
+{
+ char[1] p1;
+ char[1] p2;
+public:
+ char[] P() {return p1~p2;}
+}
+
+void test21()
+{
+    T21 t = new T21;
+    t.p1[0] = 'a';
+    t.p2[0] = 'b';
+    assert(t.P() == "ab");
+}
+
+/*****************************************/
+
+void test22()
+{
+    struct foo1 { int a; int b; int c; }
+
+    class foo2
+    {
+        foo1[] x;
+
+        foo1 fooret(foo1 foo2)
+        {
+            x.length = 9;
+            return x[0] = foo2; // Here
+
+            // x[0] = foo2; --- This version does not
+            // return x[0]; --- cause the error.
+        }
+    }
+}
+
+
+/*****************************************/
+
+void test23()
+{
+    float f;
+    double d;
+    real r;
+
+    if (f > ifloat.max)
+        goto Loverflow;
+    if (d > ifloat.max)
+        goto Loverflow;
+    if (r > ifloat.max)
+        goto Loverflow;
+
+    if (ifloat.max < f)
+        goto Loverflow;
+    if (ifloat.max < d)
+        goto Loverflow;
+    if (ifloat.max < r)
+        goto Loverflow;
+
+    return;
+
+  Loverflow:
+    return;
+}
+
+/*****************************************/
+
+interface I24 { }
+
+void test24()
+{
+}
+
+/*****************************************/
+
+interface D25{}
+interface C25:D25{}
+interface B25:C25{}
+interface A25:B25{}
+
+void test25()
+{
+}
+
+class     A26:B26{}
+interface B26:C26{}
+interface C26:D26{}
+interface D26{}
+
+void test26()
+{
+}
+
+interface A27:B27{}
+interface B27:C27{}
+interface C27:D27{}
+interface D27{}
+
+void test27()
+{
+}
+
+/*****************************************/
+
+void test28()
+{
+    const double d = -1.0;
+    int i = cast(int)d;
+    printf("i = %d\n", i);
+    assert(-1 == i);
+}
+
+/*****************************************/
+
+static int[1][5] array = [[1],[2],[3],[4],[5] ];
+
+void Lookup( int which )
+{
+   switch( which )
+   {
+     case 0 : return cast(void)array[which];
+     default: assert(0);
+   }
+}
+
+void test29()
+{
+}
+
+/*****************************************/
+
+void test30()
+{
+  double d = 1;
+  cdouble cd = 1+0i;
+  assert(cd == 1.0 + 0i);
+}
+
+/*****************************************/
+
+void foo31(...)
+{
+    byte b = va_arg!byte(_argptr);
+    assert(b == 8);
+}
+
+void test31()
+{
+    byte x = 9;
+    foo31(--x);
+    --x;
+    foo31(++x);
+}
+
+/*****************************************/
+
+template Foo33(T, int L)
+{
+        T[L] arr;
+        class Bar {
+                int before = 6;
+                T[L] arr;
+                int after = 7;
+        }
+}
+
+void test33()
+{
+        alias Foo33!(int, 100) foo;
+        foreach (int x; foo.arr)
+                assert(x == int.init);
+
+        foo.Bar bar = new foo.Bar();
+        foreach (int x; bar.arr)
+        {       //printf("%d\n", x);
+                assert(x == int.init);
+        }
+}
+
+
+/*****************************************/
+
+void test34()
+{
+        bool[1] a;
+        bool[1] b;
+
+        bool[] concat() {
+                return a~b;
+        }
+
+        a[]=0;
+        b[]=1;
+
+        bool[] arr=concat();
+
+        assert(arr.length==2);
+        assert(arr[0]==0);
+        assert(arr[1]==1);
+}
+
+/*****************************************/
+
+void dummy35(...) {}
+
+void test35()
+{
+    byte x = 9;
+    dummy35(x);
+    int y = --x;
+    assert (y == 8);
+    assert (x == 8);
+}
+
+/*****************************************/
+
+void test36()
+{
+        int[] a;
+        a.length = 2;
+        a[0]=1;
+        a[1]=2;
+
+        int[] b;
+        b.length = 1;
+        b[0]=3;
+
+        a~=b;
+
+        assert(a.length==3);
+        assert(a[0]==1);
+        assert(a[1]==2);
+        assert(a[2]==3);
+
+        assert(b.length==1);
+        assert(b[0]==3);
+}
+
+/*****************************************/
+
+struct Range{
+        int width(){
+                return 1;
+        }
+}
+
+class Container {
+        Range opIndex(int i){
+                return data[i];
+        }
+
+        Range[2] data;
+}
+
+void test37()
+{
+        Container ranges=new Container;
+
+// fails with -inline
+//      assert(ranges[0].width() == 1);
+}
+
+/*****************************************/
+
+void test38()
+{
+        uint mask = (uint.max >> 1);
+        assert(mask == (uint.max >> 1));
+}
+
+
+/*****************************************/
+
+void test41()
+{
+    assert(new void[40] == new void[40]);
+}
+
+/*****************************************/
+
+void test42()
+{
+        static ubyte[] master = [
+                0xE3u, 0x83u, 0xAFu, 0xE3u, 0x83u, 0xADu, 0xE3u, 0x82u,
+                0xB9u, 0xEFu, 0xBDu, 0x97u
+        ];
+
+        string string1 =  "ワロスｗ";
+        string string2 = r"ワロスｗ";
+        string string3 =  `ワロスｗ`;
+        string string4 = x"E3 83 AF E3 83 AD E3 82 B9 EF BD 97";
+
+        assert(string1.length==master.length);
+
+        for(int i=0; i<master.length; i++){
+                assert(string1[i]==master[i]);
+        }
+
+        assert(string2.length==master.length);
+
+        for(int i=0; i<master.length; i++){
+                assert(string2[i]==master[i]);
+        }
+
+        assert(string3.length==master.length);
+
+        for(int i=0; i<master.length; i++){
+                assert(string3[i]==master[i]);
+        }
+
+        assert(string4.length==master.length);
+
+        for(int i=0; i<master.length; i++){
+                assert(string4[i]==master[i]);
+        }
+}
+
+/*****************************************/
+
+struct S43
+{
+        int i=1;
+}
+
+static S43[3] s= [ 1: { 2 } ];
+
+void test43()
+{
+        assert(s[0].i==1);
+        assert(s[1].i==2);
+        assert(s[2].i==1);
+}
+
+/*****************************************/
+
+struct S44
+{
+  int i;
+}
+
+static S44[12] S44s = [];
+
+void test44()
+{
+}
+
+
+/*****************************************/
+
+struct S45
+{
+    double x = 0, y = 0;
+    static S45 opCall(int i) { S45 r; r.x = i; return r; }
+    S45 opMul(S45 s)
+    {
+        S45 r;
+        r.x = x * s.x;
+        r.y = y * s.y;
+        return r;
+    }
+}
+
+template sqr(F) { F sqr(F x) { return x * x; } }
+
+template pow(F)
+{
+    F pow(F x, int i) {
+        if (i < 1)
+        {
+            static if (is(F : real))
+                return 1;
+            else
+                return F(1);
+        }
+        if (i & 1)
+        {
+            if (i == 1)
+                return x;
+            else
+                return x * pow(x,i-1);
+        }
+        return sqr!(F)(pow(x,i/2));
+    }
+}
+
+void test45()
+{
+    S45 s = S45(10);
+    S45 val = pow!(S45)(s,2);
+    printf("x = %2.2lf, y = %2.2lf\n", val.x, val.y);
+    assert(val.x == 100);
+    assert(val.y == 0);
+    double d = pow!(double)(10,3);
+    printf("%2.2lf\n", d);
+    assert(d == 1000);
+}
+
+/*****************************************/
+
+struct Node46
+{
+  Node46* left,right,parent;
+  int color = 5;
+  char[] key;
+  char[] value;
+}
+
+void test46()
+{
+  Node46* x = new Node46;
+  assert( x.left is null );
+  assert( x.right is null );
+  assert( x.parent is null );
+  assert( x.color is 5 );
+  assert( x.key is null );
+  assert( x.value is null );
+}
+
+/*****************************************/
+
+void test47()
+{
+   cdouble[] a;
+   cdouble[] b;
+   foreach(ref cdouble d; b)
+     {
+       d = -a[0];
+       for(;;){}
+     }
+}
+
+/*****************************************/
+
+string foo48(string s)
+{
+    return s;
+}
+
+void test48()
+{
+    char c = '?';
+    string s;
+
+    s = foo48("is this it" ~ c ~ " yep!");
+    assert(s == "is this it? yep!");
+
+    s = foo48("is this it" ~ c);
+    assert(s == "is this it?");
+
+    s = foo48(c ~ "is this it");
+    assert(s == "?is this it");
+}
+
+
+/*****************************************/
+
+char[10] foo49 = void;
+
+void test49()
+{
+    int i = void;
+    //printf("i = %d\n", i);
+    int[10] a = void;
+    foreach (int x; a)
+    {
+        printf("\tx = %d\n", x);
+    }
+}
+
+/*****************************************/
+
+void foo50(string s) { assert(s == "is this it? yep!"); }
+
+void test50()
+{
+    char c = '?';
+    foo50("is this it"~c~" yep!");
+}
+
+/*****************************************/
+
+void test51()
+{
+    bool[9][3] qwert;
+
+    printf("qwert.sizeof = %d\n", qwert.sizeof);
+
+    for (int i = 0; i < 3; i++)
+        for (int j = 0; j < 9; j++)
+            assert(qwert[i][j] == false);
+
+    version (D_Bits)
+        assert(qwert.sizeof == 12);
+    else
+        assert(qwert.sizeof == 27);
+
+    qwert[0][3] = true;
+    qwert[0][5] = true;
+    qwert[0][7] = true;
+
+    qwert[1..3] = qwert[0];
+
+    for (int i = 0; i < 3; i++)
+    {
+        assert(qwert[i][0] == false);
+        assert(qwert[i][1] == false);
+        assert(qwert[i][2] == false);
+        assert(qwert[i][3] == true);
+        assert(qwert[i][4] == false);
+        assert(qwert[i][5] == true);
+        assert(qwert[i][6] == false);
+        assert(qwert[i][7] == true);
+        assert(qwert[i][8] == false);
+    }
+}
+
+
+/*****************************************/
+
+void test52()
+{
+    size_t vsize = void.sizeof;
+    assert(vsize == 1);
+}
+
+/*****************************************/
+
+const char[3][13] month = [
+     1: "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+     8: "Aug", "Sep", "Oct", "Nov", "Dec"
+];
+
+void test53()
+{
+    printf("%.*s\n", month[1].length, month[1].ptr);
+    printf("%.*s\n", month[2].length, month[2].ptr);
+    printf("%.*s\n", month[3].length, month[3].ptr);
+    printf("%.*s\n", month[4].length, month[4].ptr);
+    printf("%.*s\n", month[5].length, month[5].ptr);
+    printf("%.*s\n", month[6].length, month[6].ptr);
+    printf("%.*s\n", month[8].length, month[8].ptr);
+
+    assert(month[1] == "Jan");
+    assert(month[2] == "Feb");
+    assert(month[3] == "Mar");
+    assert(month[4] == "Apr");
+    assert(month[5] == "May");
+    assert(month[6] == "Jun");
+    assert(month[8] == "Aug");
+    assert(month[9] == "Sep");
+    assert(month[10] == "Oct");
+    assert(month[11] == "Nov");
+    assert(month[12] == "Dec");
+
+    assert(month[0][0] == 0xFF);
+    assert(month[0][1] == 0xFF);
+    assert(month[0][2] == 0xFF);
+
+    assert(month[7][0] == 0xFF);
+    assert(month[7][1] == 0xFF);
+    assert(month[7][2] == 0xFF);
+}
+
+/*****************************************/
+
+struct S54
+{
+    static S54 foo()
+    {
+        S54 s;
+        with (s) {} // bug
+        return s;
+    }
+
+    static S54 bar()
+    {
+        return S54.foo() * S54.foo();
+    }
+
+    S54 opMul(S54 s)
+    {
+        return s;
+    }
+}
+
+void test54()
+{
+    S54.bar();
+}
+
+/*****************************************/
+
+void test55()
+{
+  char c = 'a';
+  char[] str, uvw;
+  str = str ~ c;
+  uvw = c ~ uvw;
+
+  printf("%.*s\n", str.length, str.ptr);
+  assert(str == "a");
+  assert(uvw == "a");
+
+  c = 'b';
+  printf("%.*s\n", str.length, str.ptr);
+  assert(str == "a");
+  assert(uvw == "a");
+}
+
+/*****************************************/
+
+void test56()
+{
+    char[4] a, b;
+    a[] = 'a'; b[] = 'a';
+
+    for (int i = 0; i < 4; i++)
+    {
+        assert(a[i] == 'a');
+        assert(b[i] == 'a');
+    }
+
+    a[] = b[] = 'b';
+
+    for (int i = 0; i < 4; i++)
+    {
+        assert(a[i] == 'b');
+        assert(b[i] == 'b');
+    }
+
+}
+
+
+/*****************************************/
+
+void test57()
+{
+        char[] a;
+        char[] b;
+
+        a = a ~ 'x';
+        assert(a == "x");
+        b = 'c' ~ a ~ 'b';
+        assert(b == "cxb");
+}
+
+
+/*****************************************/
+
+struct Foo58
+{
+    ubyte a, b, c;
+}
+
+void test58()
+{
+    Foo58 d;
+    foobar58(d);
+    return cast(void)0;
+}
+
+void foobar58(Foo58 e) {}
+
+
+/*****************************************/
+
+void foo59(string s)
+{
+    assert(s == "hello");
+}
+
+void foo59(wstring s)
+{
+    assert(s == "baby");
+}
+
+void foo59(dstring s)
+{
+    assert(s == "jane");
+}
+
+void test59()
+{
+    string h = "hello"c;
+    wstring b = "baby"w;
+    dstring j = "jane"d;
+
+    //writefln("%s %s %s", h, b, j);
+
+    foo59(h);
+    foo59("hello"c);
+    foo59(b);
+    foo59("baby"w);
+    foo59(j);
+    foo59("jane"d);
+}
+
+/*****************************************/
+
+class C60
+{
+    static const int x;
+    const int y;
+
+    void foo()
+    {
+    }
+
+    static this()
+    {
+        x = 5;
+    }
+
+    this()
+    {
+        y = 7;
+    }
+}
+
+const int z60;
+
+static this()
+{
+    z60 = 3;
+}
+
+void test60()
+{
+    C60 c = new C60();
+
+    assert(c.x == 5);
+    assert(c.y == 7);
+    assert(z60 == 3);
+}
+
+/*****************************************/
+
+void foo61(real[] arr)
+{
+    // i = 0 doesn't trigger the bug, everything bigger seems to
+    // also, making this const fixes the bug
+    size_t i = 1;
+
+    for (size_t j = i; j >= i; j -= i)
+    {
+        // interesting results follow from this:
+        printf("%d ", i);
+        // it prints a _lot_ of ones
+
+        arr[j] = arr[j - i];
+    }
+}
+
+void test61()
+{
+    real[] array;
+    array.length = 2; // whatever, as long as it's more than 1
+
+    foreach (ref real i; array)
+        i = 1; // just something
+
+    foo61(array);
+}
+
+/*****************************************/
+
+void bug7493()
+{
+    string str = "abcde";
+    const(void) [][1] arr = [str];
+    assert(arr[0].length == str.length);
+    const(void) [][1] arr2;
+    arr2 = [str];
+    assert(arr[0].length == str.length);
+}
+
+/*****************************************/
+
+int main()
+{
+    test1();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test56();
+    test57();
+    test58();
+    test59();
+    test60();
+    test61();
+    bug7493();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test21.d b/gcc/testsuite/gdc.test/runnable/test21.d
new file mode 100644
index 00000000000..66e3cf2d59f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test21.d
@@ -0,0 +1,10 @@
+// EXTRA_SOURCES: imports/test21a.d
+
+import imports.test21a;
+
+int main()
+{
+    TA!(int) variable;
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test22.d b/gcc/testsuite/gdc.test/runnable/test22.d
new file mode 100644
index 00000000000..69453b74ebb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test22.d
@@ -0,0 +1,1278 @@
+// REQUIRED_ARGS:
+
+import std.math: poly;
+import core.stdc.stdarg;
+
+extern(C)
+{
+    int printf(const char*, ...);
+    version(Windows)
+    {
+        int _snprintf(char*, size_t, const char*, ...);
+        alias _snprintf snprintf;
+    }
+    else
+        int snprintf(char*, size_t, const char*, ...);
+}
+
+/*************************************/
+
+// http://www.digitalmars.com/d/archives/digitalmars/D/bugs/4766.html
+// Only with -O
+
+real randx()
+{
+    return 1.2;
+}
+
+void test1()
+{
+    float x10=randx();
+    float x11=randx();
+    float x20=randx();
+    float x21=randx();
+    float y10=randx();
+    float y11=randx();
+    float y20=randx();
+    float y21=randx();
+
+    float tmp=(
+    x20*x21 + y10*y10 + y10*y11 + y11*y11 +
+    y11*y20 + y20*y20 + y10*y21 + y11*y21 +
+    y21*y21);
+    assert(tmp > 0);
+}
+
+/*************************************/
+
+void test2()
+{
+        double x10=randx();
+        double x11=randx();
+        double x20=randx();
+        double x21=randx();
+        double y10=randx();
+        double y11=randx();
+        double y20=randx();
+        double y21=randx();
+
+    double tmp=(
+    x20*x21 + y10*y10 + y10*y11 + y11*y11 +
+    y11*y20 + y20*y20 + y10*y21 + y11*y21 +
+    y21*y21);
+    assert(tmp > 0);
+}
+
+/*************************************/
+
+void test3()
+{
+    real x10=randx();
+    real x11=randx();
+    real x20=randx();
+    real x21=randx();
+    real y10=randx();
+    real y11=randx();
+    real y20=randx();
+    real y21=randx();
+
+    real tmp=(
+    x20*x21 + y10*y10 + y10*y11 + y11*y11 +
+    y11*y20 + y20*y20 + y10*y21 + y11*y21 +
+    y21*y21);
+    assert(tmp > 0);
+}
+
+/*************************************/
+
+void test4()
+{
+     printf("main() : (-128 >= 0)=%s, (-128 <= 0)=%s\n",
+              cast(char*)(-128 >= 0 ? "true" : "false"),
+              cast(char*)(-128 <= 0 ?  "true" : "false"));
+
+     printf("main() : (128 >= 0)=%s, (128 <= 0)=%s\n",
+              cast(char*)(128 >= 0 ? "true" : "false"),
+              cast(char*)(128 <= 0 ?  "true" : "false"));
+
+     assert((-128 >= 0 ? "true" : "false") == "false"),
+     assert((-128 <= 0 ? "true" : "false") == "true");
+     assert((+128 >= 0 ? "true" : "false") == "true"),
+     assert((+128 <= 0 ? "true" : "false") == "false");
+}
+
+
+/*************************************/
+
+int foo5() { assert(0); } // No return.
+
+int abc5()
+{
+    printf("foo = %d\n", foo5());
+    return 0;
+}
+
+void test5()
+{
+}
+
+/*************************************/
+
+void test6()
+{
+    ireal a = 6.5i % 3i;
+    printf("%Lfi %Lfi\n", a, a - .5i);
+    assert(a == .5i);
+
+    a = 6.5i % 3;
+    printf("%Lfi %Lfi\n", a, a - .5i);
+    assert(a == .5i);
+
+    real b = 6.5 % 3i;
+    printf("%Lf %Lf\n", b, b - .5);
+    assert(b == .5);
+
+    b = 6.5 % 3;
+    printf("%Lf %Lf\n", b, b - .5);
+    assert(b == .5);
+}
+
+/*************************************/
+
+void test7()
+{
+    cfloat f = 1+0i;
+    f %= 2fi;
+    printf("%f + %fi\n", f.re, f.im);
+    assert(f == 1 + 0i);
+
+    cdouble d = 1+0i;
+    d %= 2i;
+    printf("%f + %fi\n", d.re, d.im);
+    assert(d == 1 + 0i);
+
+    creal r = 1+0i;
+    r %= 2i;
+    printf("%Lf + %Lfi\n", r.re, r.im);
+    assert(r == 1 + 0i);
+}
+
+/*************************************/
+
+void test8()
+{
+    cfloat f = 1+0i;
+    f %= 2i;
+    printf("%f + %fi\n", f.re, f.im);
+    assert(f == 1);
+
+    cdouble d = 1+0i;
+    d = d % 2i;
+    printf("%f + %fi\n", d.re, d.im);
+    assert(d == 1);
+
+    creal r = 1+0i;
+    r = r % 2i;
+    printf("%Lf + %Lfi\n", r.re, r.im);
+    assert(r == 1);
+}
+
+/*************************************/
+
+class A9
+{
+    this(int[] params ...)
+    {
+        for (int i = 0; i < params.length; i++)
+        {
+            assert(params[i] == i + 1);
+        }
+    }
+}
+
+class B9
+{
+    this()
+    {
+        init();
+    }
+
+    private void init()
+    {
+        A9 test1 = new A9(1, 2, 3);
+        A9 test2 = new A9(1, 2, 3, 4);
+        int[3] arg; A9 test3 = new A9((arg[0]=1, arg[1]=2, arg[2]=3, arg));
+    }
+}
+
+void test9()
+{
+    B9 test2 = new B9();
+}
+
+/*************************************/
+
+void test10()
+{
+    auto i = 5u;
+    auto s = typeid(typeof(i)).toString;
+    printf("%.*s\n", s.length, s.ptr);
+    assert(typeid(typeof(i)) == typeid(uint));
+}
+
+/*************************************/
+
+void test11()
+{
+    printf("%d\n", 3);
+    printf("xhello world!\n");
+}
+
+/*************************************/
+
+void assertEqual(real* a, real* b, string file = __FILE__, size_t line = __LINE__)
+{
+    auto x = cast(ubyte*)a;
+    auto y = cast(ubyte*)b;
+
+    // Only compare the 10 value bytes, the padding bytes are of undefined
+    // value.
+    version (X86) enum count = 10;
+    else version (X86_64) enum count = 10;
+    else enum count = real.sizeof;
+    for (size_t i = 0; i < count; i++)
+    {
+        if (x[i] != y[i])
+        {
+            printf("%02d: %02x %02x\n", i, x[i], y[i]);
+            import core.exception;
+            throw new AssertError(file, line);
+        }
+    }
+}
+
+void assertEqual(creal* a, creal* b, string file = __FILE__, size_t line = __LINE__)
+{
+    assertEqual(cast(real*)a, cast(real*)b, file, line);
+    assertEqual(cast(real*)a + 1, cast(real*)b + 1, file, line);
+}
+
+void test12()
+{
+    creal a = creal.nan;
+    creal b = real.nan + ireal.nan;
+    assertEqual(&a, &b);
+
+    real c= real.nan;
+    real d=a.re;
+    assertEqual(&c, &d);
+
+    d=a.im;
+    assertEqual(&c, &d);
+}
+
+/*************************************/
+
+void test13()
+{
+    creal a = creal.infinity;
+    creal b = real.infinity + ireal.infinity;
+    assertEqual(&a, &b);
+
+    real c = real.infinity;
+    real d=a.re;
+    assertEqual(&c, &d);
+
+    d=a.im;
+    assertEqual(&c, &d);
+}
+
+/*************************************/
+
+void test14()
+{
+    creal a = creal.nan;
+    creal b = creal.nan;
+    b = real.nan + ireal.nan;
+    assertEqual(&a, &b);
+
+    real c = real.nan;
+    real d=a.re;
+    assertEqual(&c, &d);
+
+    d=a.im;
+    assertEqual(&c, &d);
+}
+
+/*************************************/
+
+ireal x15;
+
+void foo15()
+{
+    x15 = -x15;
+}
+
+void bar15()
+{
+    return foo15();
+}
+
+void test15()
+{
+    x15=2i;
+    bar15();
+    assert(x15==-2i);
+}
+
+/*************************************/
+
+real x16;
+
+void foo16()
+{
+    x16 = -x16;
+}
+
+void bar16()
+{
+    return foo16();
+}
+
+void test16()
+{
+    x16=2;
+    bar16();
+    assert(x16==-2);
+}
+
+/*************************************/
+
+class Bar17
+{
+        this(...) {}
+}
+
+class Foo17
+{
+        void opAdd (Bar17 b) {}
+}
+
+void test17()
+{
+        auto f = new Foo17;
+        f + new Bar17;
+}
+
+
+/*************************************/
+
+template u18(int n)
+{
+    static if (n==1) {
+       int a = 1;
+    } else
+       int b = 4;
+}
+
+void test18()
+{
+   mixin u18!(2);
+   assert(b == 4);
+}
+
+/*************************************/
+
+class DP
+{
+  private:
+    void I(char[] p)
+    {
+        I(p[1..p.length]);
+    }
+}
+
+void test19()
+{
+}
+
+/*************************************/
+
+struct Struct20
+{
+    int i;
+}
+
+void test20()
+{
+    auto s = new Struct20;
+    s.i = 7;
+}
+
+/*************************************/
+
+class C21(float f)
+{
+    float ff = f;
+}
+
+void test21()
+{
+    auto a = new C21!(1.2);
+    C21!(1.2) b = new C21!(1.2);
+}
+
+/*************************************/
+
+void test22()
+{
+    static creal[] params = [1+0i, 3+0i, 5+0i];
+
+    printf("params[0] = %Lf + %Lfi\n", params[0].re, params[0].im);
+    printf("params[1] = %Lf + %Lfi\n", params[1].re, params[1].im);
+    printf("params[2] = %Lf + %Lfi\n", params[2].re, params[2].im);
+
+    creal[] sums = new creal[3];
+    sums[] = 0+0i;
+
+    foreach(creal d; params)
+    {
+        creal prod = d;
+
+        printf("prod = %Lf + %Lfi\n", prod.re, prod.im);
+        for(int i; i<2; i++)
+        {
+            sums[i] += prod;
+            prod *= d;
+        }
+        sums[2] += prod;
+    }
+
+    printf("sums[0] = %Lf + %Lfi", sums[0].re, sums[0].im);
+    assert(sums[0].re==9);
+    assert(sums[0].im==0);
+    assert(sums[1].re==35);
+    assert(sums[1].im==0);
+    assert(sums[2].re==153);
+    assert(sums[2].im==0);
+}
+
+/*************************************/
+
+const int c23 = b23 * b23;
+const int a23 = 1;
+const int b23 = a23 * 3;
+
+template T23(int n)
+{
+    int[n] x23;
+}
+
+mixin T23!(c23);
+
+void test23()
+{
+    assert(x23.length==9);
+}
+
+/*************************************/
+
+ifloat func_24_1(ifloat f, double d)
+{
+//    f /= cast(cdouble)d;
+    return f;
+}
+
+ifloat func_24_2(ifloat f, double d)
+{
+    f = cast(ifloat)(f / cast(cdouble)d);
+    return f;
+}
+
+float func_24_3(float f, double d)
+{
+//    f /= cast(cdouble)d;
+    return f;
+}
+
+float func_24_4(float f, double d)
+{
+    f = cast(float)(f / cast(cdouble)d);
+    return f;
+}
+
+void test24()
+{
+    ifloat f = func_24_1(10i, 8);
+    printf("%fi\n", f);
+//    assert(f == 1.25i);
+
+    f = func_24_2(10i, 8);
+    printf("%fi\n", f);
+    assert(f == 1.25i);
+
+    float g = func_24_3(10, 8);
+    printf("%f\n", g);
+//    assert(g == 1.25);
+
+    g = func_24_4(10, 8);
+    printf("%f\n", g);
+    assert(g == 1.25);
+}
+
+/*************************************/
+
+template cat(int n)
+{
+   const int dog = n;
+}
+
+const char [] bird = "canary";
+
+const int sheep = cat!(bird.length).dog;
+
+void test25()
+{
+    assert(sheep == 6);
+}
+
+/*************************************/
+
+string toString26(cdouble z)
+{
+    char[ulong.sizeof*8] buf;
+
+    auto len = snprintf(buf.ptr, buf.sizeof, "%f+%fi", z.re, z.im);
+    return buf[0 .. len].idup;
+}
+
+void test26()
+{
+  static cdouble[] A = [1+0i, 0+1i, 1+1i];
+  string s;
+
+  foreach( cdouble z; A )
+  {
+    s = toString26(z);
+    printf("%.*s  ", s.length, s.ptr);
+  }
+  printf("\n");
+
+  for(int ii=0; ii<A.length; ii++ )
+    A[ii] += -1i*A[ii];
+
+  assert(A[0] == 1 - 1i);
+  assert(A[1] == 1 + 1i);
+  assert(A[2] == 2);
+
+  foreach( cdouble z; A )
+  {
+    s = toString26(z);
+    printf("%.*s  ", s.length, s.ptr);
+  }
+  printf("\n");
+}
+
+/*************************************/
+
+void test27()
+{   int x;
+
+    string s = (int*function(int ...)[]).mangleof;
+    printf("%.*s\n", s.length, s.ptr);
+    assert((int*function(int ...)[]).mangleof == "APFiXPi");
+    assert(typeof(x).mangleof == "i");
+    assert(x.mangleof == "_D6test226test27FZ1xi");
+}
+
+/*************************************/
+
+void test28()
+{
+    alias cdouble X;
+    X four = cast(X) (4.0i + 0.4);
+}
+
+/*************************************/
+
+void test29()
+{
+    ulong a = 10_000_000_000_000_000,
+          b =  1_000_000_000_000_000;
+
+    printf("test29\n%lx\n%lx\n%lx\n", a, b, a / b);
+    assert((a / b) == 10);
+}
+
+static assert((10_000_000_000_000_000 / 1_000_000_000_000_000) == 10);
+
+/*************************************/
+
+template chook(int n)
+{
+   const int chook = 3;
+}
+
+template dog(alias f) {
+    const int dog =  chook!(f.mangleof.length);
+}
+
+class pig {}
+
+const int goose = dog!(pig);
+
+void test30()
+{
+    printf("%d\n", goose);
+    assert(goose == 3);
+}
+
+/*************************************/
+
+template dog31(string sheep)
+{
+  immutable string dog31 = "daschund";
+}
+
+void test31()
+{
+    string duck = dog31!("bird"[1..3]);
+
+    assert(duck == "daschund");
+}
+
+/*************************************/
+
+struct particle
+{
+    int   active; /* Active (Yes/No) */
+    float life;   /* Particle Life   */
+    float fade;   /* Fade Speed      */
+
+    float r;      /* Red Value       */
+    float g;      /* Green Value     */
+    float b;      /* Blue Value      */
+
+    float x;      /* X Position      */
+    float y;      /* Y Position      */
+
+    float xi;     /* X Direction     */
+    float yi;     /* Y Direction     */
+
+    float xg;     /* X Gravity       */
+    float yg;     /* Y Gravity       */
+}
+
+particle particles[10000];
+
+void test32()
+{
+}
+
+/*************************************/
+
+class Foo33
+{
+    template foo()
+    {
+        int foo() { return 6; }
+    }
+}
+
+
+void test33()
+{
+    Foo33 f = new Foo33;
+
+    assert(f.foo!()() == 6);
+    with (f)
+        assert(foo!()() == 6);
+}
+
+/*************************************/
+
+template dog34(string duck)
+{
+    const int dog34 = 2;
+}
+
+void test34()
+{
+    int aardvark = dog34!("cat" ~ "pig");
+
+    assert(aardvark == 2);
+}
+
+/*************************************/
+
+class A35
+{
+    private bool quit;
+    void halt() {quit = true;}
+    bool isHalted() {return quit;}
+}
+
+void test35()
+{
+    auto a = new A35;
+
+    a.halt;         // error here
+    a.halt();
+
+    a.isHalted;     // error here
+    bool done = a.isHalted;
+    if (a.isHalted)
+    {
+    }
+}
+
+
+/*************************************/
+
+void test36()
+{
+    bool q = (0.9 + 3.5L == 0.9L + 3.5L);
+    assert(q);
+    static assert(0.9 + 3.5L == 0.9L + 3.5L);
+    assert(0.9 + 3.5L == 0.9L + 3.5L);
+}
+
+/*************************************/
+
+abstract class Foo37(T)
+{
+    void bar () { }
+}
+
+class Bar37 : Foo37!(int)
+{
+}
+
+void test37()
+{
+    auto f = new Bar37;
+}
+
+/*************************************/
+
+void test38()
+{
+        auto s=`hello`;
+        assert(s.length==5);
+        assert(s[0]=='h');
+        assert(s[1]=='e');
+        assert(s[2]=='l');
+        assert(s[3]=='l');
+        assert(s[4]=='o');
+}
+
+/*************************************/
+
+void test39()
+{
+        int value=1;
+        string key = "eins";
+        int[char[]] array;
+
+        array[key]=value;
+        int* ptr = key in array;
+
+        assert(value == *ptr);
+}
+
+/*************************************/
+
+void test40()
+{
+        auto s=r"hello";
+        assert(s.length==5);
+        assert(s[0]=='h');
+        assert(s[1]=='e');
+        assert(s[2]=='l');
+        assert(s[3]=='l');
+        assert(s[4]=='o');
+}
+
+/*************************************/
+
+void test41()
+{
+    version (Windows)
+    {
+        version(D_InlineAsm){
+                double a = 1.2;
+                double b = 0.2;
+                double c = 1.4;
+
+                asm{
+                        movq XMM0, a;
+                        movq XMM1, b;
+                        addsd XMM1, XMM0;
+                        movq c, XMM1;
+                }
+
+                a += b;
+
+                b = a-c;
+                b = (b>0) ? b : (-1 * b);
+
+                assert(b < b.epsilon*4);
+        }
+    }
+}
+
+/*************************************/
+
+const char[] tapir = "some horned animal";
+
+const byte[] antelope = cast(byte []) tapir;
+
+void test42()
+{
+}
+
+/*************************************/
+
+void test43()
+{
+     string armadillo = "abc" ~ 'a';
+     assert(armadillo == "abca");
+     string armadillo2 = 'b' ~ "abc";
+     assert(armadillo2 == "babc");
+}
+
+/*************************************/
+
+const uint baboon44 = 3;
+
+const int monkey44 = 4;
+
+const ape44 = monkey44 * baboon44;
+
+void test44()
+{
+    assert(ape44 == 12);
+}
+
+/*************************************/
+
+class A45
+{
+ this()
+ {
+  b = new B();
+  b.x = 5; // illegal
+ }
+
+ class B
+ {
+  protected int x;
+ }
+
+ B b;
+}
+
+void test45()
+{
+}
+
+
+/*************************************/
+
+class C46(T)
+{
+    private T i; // or protected or package
+}
+
+void test46()
+{
+    C46!(int) c = new C46!(int); //  class t4.C46!(int).C46 member i is not accessible
+    c.i = 10;
+}
+
+/*************************************/
+
+void bug5809()
+{
+    ushort[2] x = void;
+    x[0] = 0;
+    x[1] = 0x1234;
+    ushort *px =  &x[0];
+
+    uint b = px[0];
+
+    assert(px[0] == 0);
+}
+
+/*************************************/
+
+void bug7546()
+{
+    double p = -0.0;
+    assert(p == 0);
+}
+
+
+/*************************************/
+
+real poly_asm(real x, real[] A)
+in
+{
+    assert(A.length > 0);
+}
+body
+{
+    version (D_InlineAsm_X86)
+    {
+        version (linux)
+        {
+        asm     // assembler by W. Bright
+        {
+            // EDX = (A.length - 1) * real.sizeof
+            mov     ECX,A[EBP]          ; // ECX = A.length
+            dec     ECX                 ;
+            lea     EDX,[ECX][ECX*8]    ;
+            add     EDX,ECX             ;
+            add     EDX,ECX             ;
+            add     EDX,ECX             ;
+            add     EDX,A+4[EBP]        ;
+            fld     real ptr [EDX]      ; // ST0 = coeff[ECX]
+            jecxz   return_ST           ;
+            fld     x[EBP]              ; // ST0 = x
+            fxch    ST(1)               ; // ST1 = x, ST0 = r
+            align   4                   ;
+    L2:     fmul    ST,ST(1)            ; // r *= x
+            fld     real ptr -12[EDX]   ;
+            sub     EDX,12              ; // deg--
+            faddp   ST(1),ST            ;
+            dec     ECX                 ;
+            jne     L2                  ;
+            fxch    ST(1)               ; // ST1 = r, ST0 = x
+            fstp    ST(0)               ; // dump x
+            align   4                   ;
+    return_ST:                          ;
+            ;
+        }
+        }
+        else version (OSX)
+        {
+            asm // assembler by W. Bright
+            {
+                // EDX = (A.length - 1) * real.sizeof
+                mov     ECX,A[EBP]              ; // ECX = A.length
+                dec     ECX                     ;
+                lea     EDX,[ECX*8]             ;
+                add     EDX,EDX                 ;
+                add     EDX,A+4[EBP]            ;
+                fld     real ptr [EDX]          ; // ST0 = coeff[ECX]
+                jecxz   return_ST               ;
+                fld     x[EBP]                  ; // ST0 = x
+                fxch    ST(1)                   ; // ST1 = x, ST0 = r
+                align   4                       ;
+        L2:     fmul    ST,ST(1)                ; // r *= x
+                fld     real ptr -16[EDX]       ;
+                sub     EDX,16                  ; // deg--
+                faddp   ST(1),ST                ;
+                dec     ECX                     ;
+                jne     L2                      ;
+                fxch    ST(1)                   ; // ST1 = r, ST0 = x
+                fstp    ST(0)                   ; // dump x
+                align   4                       ;
+        return_ST:                              ;
+                ;
+            }
+        }
+        else version (FreeBSD)
+        {
+        asm     // assembler by W. Bright
+        {
+            // EDX = (A.length - 1) * real.sizeof
+            mov     ECX,A[EBP]          ; // ECX = A.length
+            dec     ECX                 ;
+            lea     EDX,[ECX][ECX*8]    ;
+            add     EDX,ECX             ;
+            add     EDX,ECX             ;
+            add     EDX,ECX             ;
+            add     EDX,A+4[EBP]        ;
+            fld     real ptr [EDX]      ; // ST0 = coeff[ECX]
+            jecxz   return_ST           ;
+            fld     x[EBP]              ; // ST0 = x
+            fxch    ST(1)               ; // ST1 = x, ST0 = r
+            align   4                   ;
+    L2:     fmul    ST,ST(1)            ; // r *= x
+            fld     real ptr -12[EDX]   ;
+            sub     EDX,12              ; // deg--
+            faddp   ST(1),ST            ;
+            dec     ECX                 ;
+            jne     L2                  ;
+            fxch    ST(1)               ; // ST1 = r, ST0 = x
+            fstp    ST(0)               ; // dump x
+            align   4                   ;
+    return_ST:                          ;
+            ;
+        }
+        }
+        else
+        {
+        asm     // assembler by W. Bright
+        {
+            // EDX = (A.length - 1) * real.sizeof
+            mov     ECX,A[EBP]          ; // ECX = A.length
+            dec     ECX                 ;
+            lea     EDX,[ECX][ECX*8]    ;
+            add     EDX,ECX             ;
+            add     EDX,A+4[EBP]        ;
+            fld     real ptr [EDX]      ; // ST0 = coeff[ECX]
+            jecxz   return_ST           ;
+            fld     x[EBP]              ; // ST0 = x
+            fxch    ST(1)               ; // ST1 = x, ST0 = r
+            align   4                   ;
+    L2:     fmul    ST,ST(1)            ; // r *= x
+            fld     real ptr -10[EDX]   ;
+            sub     EDX,10              ; // deg--
+            faddp   ST(1),ST            ;
+            dec     ECX                 ;
+            jne     L2                  ;
+            fxch    ST(1)               ; // ST1 = r, ST0 = x
+            fstp    ST(0)               ; // dump x
+            align   4                   ;
+    return_ST:                          ;
+            ;
+        }
+        }
+    }
+    else
+    {
+        printf("Sorry, you don't seem to have InlineAsm_X86\n");
+        return 0;
+    }
+}
+
+real poly_c(real x, real[] A)
+in
+{
+    assert(A.length > 0);
+}
+body
+{
+    ptrdiff_t i = A.length - 1;
+    real r = A[i];
+    while (--i >= 0)
+    {
+        r *= x;
+        r += A[i];
+    }
+    return r;
+}
+
+void test47()
+{
+    real x = 3.1;
+    static real pp[] = [56.1, 32.7, 6];
+    real r;
+
+    printf("The result should be %Lf\n",(56.1L + (32.7L + 6L * x) * x));
+    printf("The C version outputs %Lf\n", poly_c(x, pp));
+    printf("The asm version outputs %Lf\n", poly_asm(x, pp));
+    printf("The std.math version outputs %Lf\n", poly(x, pp));
+
+    r = (56.1L + (32.7L + 6L * x) * x);
+    assert(r == poly_c(x, pp));
+    version (D_InlineAsm_X86)
+        assert(r == poly_asm(x, pp));
+    assert(r == poly(x, pp));
+}
+
+/*************************************/
+
+const c48 = 1uL-1;
+
+void test48()
+{
+    assert(c48 == 0);
+}
+
+/*************************************/
+
+template cat49()
+{
+     static assert(1);  // OK
+     static if (1)
+     {
+        static assert(1); // doesn't work
+        static if (1)
+        {
+             static assert(1);  // OK
+             const int cat49 = 3;
+        }
+     }
+}
+
+void test49()
+{
+    const int a = cat49!();
+    assert(a == 3);
+}
+
+/*************************************/
+
+void test50()
+{
+    if (auto x = 1)
+    {
+        assert(typeid(typeof(x)) == typeid(int));
+        assert(x == 1);
+    }
+    else
+        assert(0);
+
+    if (int x = 1)
+    {
+        assert(typeid(typeof(x)) == typeid(int));
+        assert(x == 1);
+    }
+    else
+        assert(0);
+
+    if (1)
+    {
+    }
+    else
+        assert(0);
+}
+
+/*************************************/
+
+void test51()
+{
+    bool b;
+    assert(b == false);
+    b &= 1;
+    assert(b == false);
+    b |= 1;
+    assert(b == true);
+    b ^= 1;
+    assert(b == false);
+    b = b | true;
+    assert(b == true);
+    b = b & false;
+    assert(b == false);
+    b = b ^ true;
+    assert(b == true);
+    b = !b;
+    assert(b == false);
+}
+
+/*************************************/
+
+alias int function (int) x52;
+
+template T52(string str){
+        const int T52 = 1;
+}
+
+static assert(T52!(x52.mangleof));
+
+void test52()
+{
+}
+
+/*************************************/
+import std.stdio;
+import core.stdc.stdarg;
+
+void myfunc(int a1, ...) {
+        va_list argument_list;
+        TypeInfo argument_type;
+        string sa; int ia; double da;
+        writefln("%d variable arguments", _arguments.length);
+        writefln("argument types %s", _arguments);
+        va_start(argument_list, a1);
+        for (int i = 0; i < _arguments.length; ) {
+                if ((argument_type=_arguments[i++]) == typeid(string)) {
+                        va_arg(argument_list, sa);
+                        writefln("%d) string arg = '%s', length %d", i+1, sa.length<=20? sa : "?", sa.length);
+                } else if (argument_type == typeid(int)) {
+                        va_arg(argument_list, ia);
+                        writefln("%d) int arg = %d", i+1, ia);
+                } else if (argument_type == typeid(double)) {
+                        va_arg(argument_list, da);
+                        writefln("%d) double arg = %f", i+1, da);
+                } else {
+                        throw new Exception("invalid argument type");
+                }
+        }
+        va_end(argument_list);
+}
+
+void test6758() {
+        myfunc(1, 2, 3, 4, 5, 6, 7, 8, "9", "10");                              // Fails.
+        myfunc(1, 2.0, 3, 4, 5, 6, 7, 8, "9", "10");                    // Works OK.
+        myfunc(1, 2, 3, 4, 5, 6, 7, "8", "9", "10");                    // Works OK.
+        myfunc(1, "2", 3, 4, 5, 6, 7, 8, "9", "10");                    // Works OK.
+}
+
+
+/*************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    bug5809();
+    bug7546();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test6758();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test23.d b/gcc/testsuite/gdc.test/runnable/test23.d
new file mode 100644
index 00000000000..3a7beaf187e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test23.d
@@ -0,0 +1,1575 @@
+// REQUIRED_ARGS:
+
+module test;
+
+import core.vararg;
+import core.stdc.stdlib;
+import std.stdio;
+import std.string;
+import core.stdc.stdlib;
+
+
+/*******************************************/
+
+struct S
+{
+    int opSliceAssign(int v, size_t i, size_t j)
+    {
+        assert(v == 5);
+        assert(i == 9);
+        assert(j == 10);
+        return 3;
+    }
+
+    int opSliceAssign(int v)
+    {
+        assert(v == 6);
+        return 11;
+    }
+}
+
+void test1()
+{
+    S s;
+
+    assert((s[9 .. 10] = 5) == 3);
+    assert((s[] = 6) == 11);
+}
+
+/*******************************************/
+
+static int i2 = 1;
+
+void test2()
+{
+    synchronized { int i2 = 2; }
+    assert(i2 == 1);
+}
+
+/*******************************************/
+
+void test3()
+{
+    size_t border = 8;
+
+    for(ulong i = 0; i < border; i++)
+    {
+        ulong test = 1;
+        test <<= i;
+        double r = test;
+        ulong result = cast(ulong)r;
+
+        if (result != test)
+        {
+            assert(0);
+        }
+    }
+}
+
+/*******************************************/
+
+void test4()
+{
+    writeln("",true);
+}
+
+/*******************************************/
+
+void test5()
+{
+    int[] qwert = new int[6];
+    int[] yuiop;
+    yuiop = qwert[2..5] = 3;
+    assert(yuiop.length == 3);
+    assert(yuiop[0] == 3);
+    assert(yuiop[1] == 3);
+    assert(yuiop[2] == 3);
+}
+
+/*******************************************/
+
+struct Foo6
+{
+    static int x;
+
+    static int[] farray()
+    {
+        printf("farray\n");
+        assert(x == 0);
+        x++;
+        return new int[6];
+    }
+
+    static int flwr()
+    {
+        printf("flwr\n");
+        assert(x == 1);
+        x++;
+        return 2;
+    }
+
+    static int fupr()
+    {
+        printf("fupr\n");
+        assert(x == 2);
+        x++;
+        return 1;
+    }
+}
+
+void test6()
+{
+    int[] yuiop;
+    yuiop =
+        Foo6.farray()[Foo6.flwr() .. $ - Foo6.fupr()] = 3;
+    assert(Foo6.x == 3);
+    assert(yuiop.length == 3);
+    assert(yuiop[0] == 3);
+    assert(yuiop[1] == 3);
+    assert(yuiop[2] == 3);
+}
+
+/*******************************************/
+
+void test7()
+{
+    real a = 3.40483; // this is treated as 3.40483L
+    real b;
+    b = 3.40483;
+    assert(a==b);
+    assert(a==3.40483);
+    assert(a==3.40483L);
+    assert(a==3.40483F);
+}
+
+/*******************************************/
+
+void test8()
+{
+   real [5][5] m = 1;
+   m[1][1..3] = 2;
+
+   for (size_t i = 0; i < 5; i++)
+        for (size_t j = 0; j < 5; j++)
+        {
+            if (i == 1 && (j >= 1 && j < 3))
+                assert(m[i][j] == 2);
+            else
+                assert(m[i][j] == 1);
+        }
+}
+
+/*******************************************/
+
+class ClassOf(Type)
+{
+    Type val;
+
+    template refx()
+    {
+        alias val refx;
+    }
+}
+
+struct StructOf
+{
+    int val;
+
+    template refx()
+    {
+        alias val refx;
+    }
+}
+
+void test9()
+{
+    ClassOf!(int)  c = new ClassOf!(int)();
+    StructOf s;
+    int x = 10;
+
+    c.refx!() = x;
+    x = c.refx!();
+    assert(x == 10);
+
+    x = 11;
+    s.refx!() = x;
+    x = s.refx!();
+    assert(x == 11);
+}
+
+
+/*******************************************/
+
+void test10()
+{
+    static if( int.mangleof.length > 1 && int.mangleof[1] == 'x' )
+        printf("'x' as second char\n");
+}
+
+/*******************************************/
+
+class Foo11 : Bar11 { }
+
+class Foo11T(V)
+{
+    public void foo() {}
+}
+
+class Bar11
+{
+    public this(){
+        f = new Foo11T!(int);
+    }
+    Foo11T!(int) f;
+}
+
+void test11()
+{
+    Foo11 fooIt = new Foo11();
+    if (fooIt !is null)
+        writefln("fooIt should be valid");
+    fooIt.f.foo();
+    writefln("it worked");
+}
+
+/*******************************************/
+
+struct A12 {
+        int a;
+        union {
+                int c;
+                B12 b;
+        }
+}
+
+struct B12 {
+        int b1;
+        int b2;
+}
+
+void test12()
+{
+        A12 a;
+        printf("%d\n", A12.sizeof);
+        assert(A12.sizeof == 12);
+}
+
+/*******************************************/
+
+template declare13(X) { X declare13; }
+
+typeof(declare13!(int[0]).ptr[0]) x13;
+typeof(declare13!(typeof(""))[0..$]) y13;
+
+void test13()
+{
+}
+
+/*******************************************/
+
+interface Father {}
+
+class Mother {
+     Father test() {
+         writefln("Called Mother.test!");
+         return new Child(42);
+     }
+}
+
+class Child : Mother, Father {
+     int data;
+
+     this(int d) { data = d; }
+
+     override Child test() {
+         writefln("Called Child.test!");
+         return new Child(69);
+     }
+}
+
+void test14()
+{
+     Child aChild = new Child(105);
+     Mother childsMum = aChild;
+     Child childsChild = aChild.test();
+     Child mumsChild = cast(Child) childsMum.test();
+     writefln("Success2");
+}
+
+
+/*******************************************/
+
+class A15
+{
+        int a = 3;
+
+        class B
+        {
+            void bar()
+            {
+                assert(a == 3);
+            }
+        }
+
+        void fork()
+        {
+                assert(a == 3);
+                B b = new B();  // This is okay
+                b.bar();
+
+                void knife()
+                {
+                        assert(a == 3);
+                        B b = new B();  // No 'this' for nested class B
+                        b.bar();
+                }
+        }
+}
+
+void test15()
+{
+    A15 a = new A15();
+    a.fork();
+}
+
+/*******************************************/
+
+creal x16;
+
+void foo16()
+{
+        x16 = -x16;
+}
+
+void bar16()
+{
+        return foo16();
+}
+
+void test16()
+{
+        x16 = 2.0L + 0.0Li;
+        bar16();
+        assert(x16 == -2.0L + 0.0Li);
+}
+
+/*******************************************/
+
+void test17()
+{
+    version (OSX)
+    {
+    }
+    else
+    {
+        /*const*/ float f = 1.2f;
+        float g = void;
+
+
+        version(D_SoftFloat)
+        {
+            g = f;
+        }
+        else version(GNU)
+        {
+            version(X86) asm
+            {
+                "flds %1; fstps %0;" : "=m" (g) : "m" (f) : ;
+            }
+            else version(X86_64) asm
+            {
+                "flds %1; fstps %0;" : "=m" (g) : "m" (f) : ;
+            }
+            else version(ARM) asm
+            {
+                "vldr d0, %1; vstr d0, %0;" : "=m" (g) : "m" (f), : "d0";
+            }
+            else static assert(false, "ASM code not implemented for this architecture");
+        }
+        else
+        {
+            asm
+            {
+                fld f;  // doesn't work with PIC
+                fstp g;
+            }
+        }
+        assert(g == 1.2f);
+    }
+}
+
+/*******************************************/
+
+class Foo18 : Bar18 {}
+class FooT18(V){}
+class Bar18 : FooT18!(int) {}
+
+void test18()
+{
+}
+
+/*******************************************/
+
+struct STRUCTA19
+{
+  union {
+    int a;
+    long b;
+  }
+  STRUCTB19 c;
+}
+
+struct STRUCTB19
+{
+  int a;
+}
+
+void test19()
+{
+}
+
+/*******************************************/
+
+class Foo20
+{
+        void bar (void * src)
+        {
+                void baz (void function (void *, size_t) xyz)
+                {
+                        size_t foo (void [] dst)
+                        {
+                                size_t len = dst.length;
+                                dst [0 .. len] = src [0 .. len];
+                                xyz (dst.ptr, len);
+                                return len;
+                        }
+                }
+        }
+}
+
+void test20()
+{
+}
+
+/*******************************************/
+
+class Baz21
+{
+        int opApply (int delegate(ref int) dg)
+        {
+                int i;
+                return dg(i);
+        }
+}
+
+class Foo21
+{
+        Baz21    baz;
+
+        int foo (int delegate() dg)
+        {
+                foreach (b; baz)
+                         if (bar ())
+                            if (dg ())
+                                break;
+                return 0;
+        }
+
+        bool bar ()
+        { return true; }
+}
+
+void test21()
+{
+}
+
+/*******************************************/
+
+struct Bar22 {
+    union {
+        struct {
+            union {
+                Foo22 A;
+            }
+        }
+    }
+}
+
+struct Foo22 {
+    double d = 3;
+}
+
+void test22()
+{
+    printf("Bar22.sizeof = %zd, double.sizeof = %zd\n", Bar22.sizeof, double.sizeof);
+    assert(Bar22.sizeof == double.sizeof);
+    Bar22 b;
+    assert(b.A.d == 3);
+}
+
+/*******************************************/
+
+struct Ag
+{
+    static void func(){}
+
+    static void foo()
+    {
+        void function() fnp;
+        Ag a;
+
+        fnp = &func;
+        fnp = &Ag.func;
+        with(a)    fnp = &Ag.func;
+
+        with(a) fnp = &func;
+    }
+}
+
+class Ah
+{
+    static void func(){}
+
+    static void foo()
+    {
+        void function() fnp;
+        Ah a;
+
+        fnp = &func;
+        fnp = &Ah.func;
+        with(a)    fnp = &Ah.func;
+
+        with(a) fnp = &func;
+    }
+}
+
+void test23()
+{
+}
+
+/*******************************************/
+
+void test24()
+{
+    uint[10] arr1;
+    ulong idx = 3;
+    uint[] arr3 = arr1[ cast(int)(idx) .. (cast(int) idx) + 3  ]; // OK
+    uint[] arr4 = arr1[ cast(int) idx  ..  cast(int) idx  + 3  ]; // OK
+    uint[] arr5 = arr1[ cast(int)(idx) ..  cast(int)(idx) + 3  ]; // C style cast illegal, use cast(idx)+3
+    uint[] arr6 = arr1[ cast(int)(idx) ..  cast(int)(idx  + 3) ]; // OK
+}
+
+/*******************************************/
+
+void test25()
+{
+  char[6] cstr = "123456"c;
+  auto str1 = cast(wchar[3])(cstr);
+
+  writefln("str1: ", (cast(char[])str1).length , " : ", (cast(char[])str1));
+  assert(cast(char[])str1 == "123456"c);
+
+  auto str2 = cast(wchar[3])("789abc"c);
+  writefln("str2: ", (cast(char[])str2).length , " : ", (cast(char[])str2));
+  assert(cast(char[])str2 == "789abc"c);
+
+  auto str3 = cast(wchar[3])("defghi");
+  writefln("str3: ", (cast(char[])str3).length , " : ", (cast(char[])str3));
+  assert(cast(char[])str3 == "d\000e\000f\000"c);
+}
+
+/*******************************************/
+
+void test26()
+{
+    assert(foo26(5) == 25);
+}
+
+int foo26(int i)
+{
+    if (auto j = i * i)
+      return j;
+    else
+      return 10;
+}
+
+/*******************************************/
+
+class A27
+{
+    int am;
+
+    class B
+    {
+        this()
+        {
+            assert(am == 3);
+        }
+    }
+
+    void fork()
+    {
+        B b = new B();  // This is okay
+
+        void knife()
+        {
+                B b = new B();  // No 'this' for nested class B
+                assert(am == 3);
+        }
+    }
+}
+
+
+void test27()
+{
+    A27 a = new A27();
+    a.am = 3;
+
+    a.fork();
+}
+
+/*******************************************/
+
+uint intRes()
+{
+        return 4;
+}
+
+void test28()
+{
+        auto s = std.string.format("%s", "abc123"[intRes() % $] );
+        writefln( "%s", s );
+        assert(s == "2");
+
+        static const char[] foo = "abc123";
+        s = std.string.format("%s", foo[intRes() % $] );
+        assert(s == "2");
+
+
+        static string bar = "abc123";
+        s = std.string.format("%s", bar[intRes() % $] );
+        assert(s == "2");
+
+        const char[] abc = "abc123";
+        s = std.string.format("%s", abc[intRes() % $] );
+        assert(s == "2");
+
+        string def = "abc123";
+        s = std.string.format("%s", def[intRes() % $] );
+        assert(s == "2");
+}
+
+/*******************************************/
+
+class UA {
+    A29 f() { return null; }
+}
+
+class UB : UA {
+    override B29 f() { return null; }
+}
+
+class A29
+{
+}
+
+class B29 : A29
+{
+}
+
+void test29()
+{
+}
+
+/*******************************************/
+
+class Foo30 : Bar30 {}
+
+class FooT30(V) {}
+
+class Bar30 : FooT30!(int) {}
+
+void test30()
+{
+}
+
+
+/*******************************************/
+
+int y31;
+
+struct X31 { static void opCall() { y31 = 3; } }
+
+void test31()
+{
+    X31 x;
+    typeof(x)();
+    assert(y31 == 3);
+}
+
+/*******************************************/
+
+class Foo32
+{
+    static void* ps;
+
+    new (size_t sz)
+    {
+        void* p = core.stdc.stdlib.malloc(sz);
+        printf("new(sz = %d) = %p\n", sz, p);
+        ps = p;
+        return p;
+    }
+
+    delete(void* p)
+    {
+        printf("delete(p = %p)\n", p);
+        assert(p == ps);
+        if (p) core.stdc.stdlib.free(p);
+    }
+}
+
+void test32()
+{
+    Foo32 f = new Foo32;
+    delete f;
+}
+
+/*******************************************/
+
+class Foo33
+{
+//    this() { printf("this()\n"); }
+//    ~this() { printf("~this()\n"); }
+
+    static void* ps;
+    static int del;
+
+    new (size_t sz, int i)
+    {
+        void* p = core.stdc.stdlib.malloc(sz);
+        printf("new(sz = %d) = %p\n", sz, p);
+        ps = p;
+        return p;
+    }
+
+    delete(void* p)
+    {
+        printf("delete(p = %p)\n", p);
+        assert(p == ps);
+        if (p) core.stdc.stdlib.free(p);
+        del += 1;
+    }
+}
+
+void foo33()
+{
+    scope Foo33 f = new(3) Foo33;
+}
+
+void test33()
+{
+    foo33();
+    assert(Foo33.del == 1);
+}
+
+/*******************************************/
+
+struct o_O { int a; }
+union  O_O { int a; }
+class  O_o { int a; }
+
+struct Foo34
+{
+    int ok;
+    o_O foo;
+    O_O bar;
+    O_o baz;
+}
+
+void test34()
+{
+    int o1 = Foo34.ok.offsetof;
+    assert(o1 == 0);
+    int o2 = Foo34.foo.offsetof;
+    assert(o2 == 4);
+    int o3 = Foo34.bar.offsetof;
+    assert(o3 == 8);
+    int o4 = Foo34.baz.offsetof;
+    assert((o4 % (void*).sizeof) == 0);
+    assert(o4 > o3);
+}
+
+/*******************************************/
+
+class Foo37
+{
+    float[4] array = 1.0;
+    int count = 10;
+}
+
+void test37()
+{
+    Foo37 f = new Foo37();
+
+    writefln("Foo.array[0] = %s", f.array[0] );
+    writefln("Foo.array[1] = %s", f.array[1] );
+    writefln("Foo.array[2] = %s", f.array[2] );
+    writefln("Foo.array[3] = %s", f.array[3] );
+    writefln("Foo.count = %s", f.count );
+
+    assert(f.array[0] == 1.0);
+    assert(f.array[1] == 1.0);
+    assert(f.array[2] == 1.0);
+    assert(f.array[3] == 1.0);
+    assert(f.count == 10);
+}
+
+/*******************************************/
+
+void test38()
+in
+{
+    static void checkParameters()
+    {
+        return;
+    }
+
+    checkParameters();
+}
+body
+{
+}
+
+/*******************************************/
+
+void delegate() foo39()
+{
+        return &(new class
+        {
+
+                int a;
+
+                this() { a = 3; }
+
+                void dg()
+                {
+                        writefln("delegate!");
+                        assert(a == 3);
+                }
+        }).dg;
+}
+
+void test39()
+{
+    void delegate() dg = foo39();
+
+    dg();
+}
+
+/*******************************************/
+
+void test40()
+{
+    assert( typeid(int) == typeid(int) );
+    assert( (typeid(int) != typeid(int)) == false );
+
+    int x;
+
+    bool b1 = (typeid(typeof(x)) != typeid(int));
+
+    TypeInfo t1 = typeid(typeof(x));
+    TypeInfo t2 = typeid(int);
+
+    bool b2 = (t1 != t2);
+
+    assert(b1 == b2);
+}
+
+/*******************************************/
+
+int foo41(string s)
+{
+        short shift = cast(short)(s.length * 3);
+        int answer;
+
+        for (size_t i = 0; i < s.length; i++){
+                answer = s[i] << shift;
+        }
+
+        return answer;
+}
+
+void test41()
+{
+        if(foo41("\u0001") != 8){
+                assert(0);
+        }
+}
+
+/*******************************************/
+
+struct S42
+{
+        int i;
+
+        static S42 foo(int x){
+                S42 s;
+
+                s.i = x;
+
+                return s;
+        }
+}
+
+void test42()
+{
+        S42[] s;
+
+        s = s ~ S42.foo(6);
+        s = s ~ S42.foo(1);
+
+        if(s.length != 2){
+                assert(0);
+        }
+        if(s[0].i != 6){
+                assert(0);
+        }
+        if(s[1].i != 1){
+                assert(0);
+        }
+}
+
+/*******************************************/
+
+struct S43
+{
+        int i,j;
+
+        static S43 foo(int x){
+                S43 s;
+
+                s.i = x;
+
+                return s;
+        }
+}
+
+void test43()
+{
+        S43[] s;
+
+        s = s ~ S43.foo(6);
+        s = s ~ S43.foo(1);
+
+        if(s.length != 2){
+                assert(0);
+        }
+        if(s[0].i != 6){
+                assert(0);
+        }
+        if(s[1].i != 1){
+                assert(0);
+        }
+}
+
+/*******************************************/
+
+struct S44
+{
+        int i,j,k;
+
+        static S44 foo(int x){
+                S44 s;
+
+                s.i = x;
+
+                return s;
+        }
+}
+
+void test44()
+{
+        S44[] s;
+
+        s = s ~ S44.foo(6);
+        s = s ~ S44.foo(1);
+
+        if(s.length != 2){
+                assert(0);
+        }
+        if(s[0].i != 6){
+                assert(0);
+        }
+        if(s[1].i != 1){
+                assert(0);
+        }
+}
+
+/*******************************************/
+
+void test45()
+{
+   char[] buffer = "abcdefghijklmnopqrstuvwxyz".dup;
+   foreach(ref char c; buffer)
+   {
+       if('a' <= c && c <= 'z')
+       {
+           c -= cast(char)'a' - 'A'; // segfault here
+       }
+   }
+   for(int i = 0; i < buffer.length; i++)
+   {
+       if('a' <= buffer[i] && buffer[i] <= 'z')
+       {
+           buffer[i] -= cast(char)'a' - 'A'; // segfault here
+       }
+   }
+   writeln(buffer);
+}
+
+/*******************************************/
+
+struct st46
+{
+    template t1()
+    {
+        template t2(int n2) { }
+    }
+}
+
+alias st46.t1!().t2 a46;
+
+void test46()
+{
+}
+
+/*******************************************/
+
+struct A47
+{
+    static int y;
+    void opSliceAssign(int x)
+    {
+        printf("x = %d\n", x);
+        y = x;
+    }
+    A47 d() { return this; }
+}
+
+void test47()
+{
+    A47 a;
+    a[] = 3;
+    printf("y = %d\n", a.y);
+    a.d()[] = 5;
+    printf("y = %d\n", a.y);
+    assert(a.y == 5);
+    a.d[] = 6;
+    printf("y = %d\n", a.y);
+    assert(a.y == 6);
+}
+
+/*******************************************/
+
+static uint[] sarray48 = void;
+
+void test48()
+{
+    static uint[] array = void;
+
+    assert(sarray48 == null);
+    assert(array == null);
+}
+
+/*******************************************/
+
+int x = 2, y = 1;
+
+void foo50(int z)
+{
+    static int t;
+    t++;
+    assert(t == z);
+}
+
+void test50()
+{
+    printf("test50()\n");
+    int res = 0;
+    for(int i = 0; i < 10; i++)
+    {
+        res = res + x - y;
+        foo50(res);
+    }
+}
+
+/*******************************************/
+
+void test52()
+{
+    printf("test52()\n");
+    char[] s;
+    s = ['a', 'b', 'c'];
+    assert(s == "abc");
+
+    int[] x;
+    x = [17, 18u, 29, 33];
+    assert(x.length == 4);
+    assert(x[0] == 17);
+    assert(x[1] == 18);
+    assert(x[2] == 29);
+    assert(x[3] == 33);
+    assert(x == [17, 18, 29, 33]);
+}
+
+/*******************************************/
+
+void test54()
+{
+    printf("test54()\n");
+    uint[500][] data;
+
+    data.length = 1;
+    assert(data.length == 1);
+    foreach (ref foo; data)
+    {
+        assert(foo.length == 500);
+        foreach (ref u; foo)
+        {   //printf("u = %u\n", u);
+            assert(u == 0);
+            u = 23;
+        }
+    }
+    foreach (ref foo; data)
+    {
+        assert(foo.length == 500);
+        foreach (u; foo)
+        {   assert(u == 23);
+            auto v = u;
+            v = 23;
+        }
+    }
+}
+
+/*******************************************/
+
+class Base56
+{
+        private string myfoo;
+        private string mybar;
+
+        // Get/set properties that will be overridden.
+        void foo(string s) { myfoo = s; }
+        string foo() { return myfoo; }
+
+        // Get/set properties that will not be overridden.
+        void bar(string s) { mybar = s; }
+        string bar() { return mybar; }
+}
+
+class Derived56: Base56
+{
+        alias Base56.foo foo; // Bring in Base56's foo getter.
+        override void foo(string s) { super.foo = s; } // Override foo setter.
+}
+
+void test56()
+{
+        Derived56 d = new Derived56;
+        with (d)
+        {
+                foo = "hi";
+                d.foo = "hi";
+                bar = "hi";
+                assert(foo == "hi");
+                assert(d.foo == "hi");
+                assert(bar == "hi");
+        }
+}
+
+/*******************************************/
+
+bool[void[]] reg57;
+
+void addToReg57(const(void)[] a, int b, bool v)
+{
+    if (!v)
+        writefln("X");
+    auto key = a~(cast(void*)&b)[0..4];
+    reg57[cast(immutable(void)[])key] = v;
+    writefln("OK");
+}
+
+void test57()
+{
+        addToReg57("test", 1024, true);
+}
+
+/*******************************************/
+
+int bar58( string msg ){
+    return 1;
+}
+
+int foo58( lazy string dg ){
+    return bar58( dg() );
+}
+
+void test58()
+{
+    printf("test58()\n");
+    try{
+    }
+    finally{
+        foo58("");
+    }
+}
+
+/*******************************************/
+
+struct S59
+{
+    string toString()
+    {
+        return "foo";
+    }
+}
+
+void test59()
+{   S59 s;
+    writefln("s = %s", s);
+
+    string p;
+    p = std.string.format("s = %s", s);
+    assert(p == "s = foo");
+}
+
+/*******************************************/
+
+void test60()
+{
+    int[2][] a;
+    a = [ [-1,2], [3,4] ];
+    assert(a[0][0] == -1);
+    assert(a[0][1] == 2);
+    assert(a[1][0] == 3);
+    assert(a[1][1] == 4);
+
+    int[][] b;
+    b = [ [-1,2], [3,4] ];
+    assert(b[0][0] == -1);
+    assert(b[0][1] == 2);
+    assert(b[1][0] == 3);
+    assert(b[1][1] == 4);
+}
+
+/*******************************************/
+
+void test61()
+{
+    int[][] f = [[1,2],[3,4]];
+    assert(f[0][0] == 1);
+    assert(f[0][1] == 2);
+    assert(f[1][0] == 3);
+    assert(f[1][1] == 4);
+    writeln(f);
+}
+
+/*******************************************/
+
+struct List62 {
+        void get() {}
+}
+struct Array62 {
+        interface Model {
+                List62 list();
+        }
+        List62 list() {
+                return model ? model.list() : List62.init;
+        }
+        void item() {
+                list.get();
+        }
+        private Model model;
+}
+
+void test62()
+{
+}
+
+/*******************************************/
+
+void foo63(...)
+{
+}
+
+void test63()
+{
+        int[] arr;
+        arr = [1] ~ 2;
+
+        // runtime crash, the length == 1
+        printf("%d\n", arr.length);
+        assert (arr.length == 2);
+        assert(arr[0] == 1);
+        assert(arr[1] == 2);
+
+        arr = 2 ~ [1];
+        assert(arr.length == 2);
+        assert(arr[0] == 2);
+        assert(arr[1] == 1);
+
+        arr = [2, 3] ~ [1];
+        assert(arr.length == 3);
+        assert(arr[0] == 2);
+        assert(arr[1] == 3);
+        assert(arr[2] == 1);
+
+        foo63([1] ~ 2, 2 ~ [1], [1,2] ~ [3,4,5]);
+}
+
+/*******************************************/
+
+void test64()
+{
+    printf("test64()\n");
+    int[] x = [1,2,3,4];
+    int j = 4;
+
+    foreach_reverse(v; x)
+    {
+        writeln(v);
+        assert(j == v);
+        j--;
+    }
+    assert(j == 0);
+
+    j = 4;
+    foreach_reverse(i, v; x)
+    {
+        writefln("[%s] = %s", i, v);
+        assert(i + 1 == j);
+        assert(j == v);
+        j--;
+    }
+    assert(j == 0);
+    printf("-test64()\n");
+}
+
+/*******************************************/
+
+void test65()
+{
+    // Bugzilla Issue 407.
+    int i = *cast(int*)cast(char[4])['0', '0', '0', '0']; // compiler seg-fault
+    printf("i = %x\n", i);
+}
+
+/*******************************************/
+
+void test66()
+{
+    int[]  ia;
+    ia ~= 3;
+    byte[] data = new byte[ia[0]];
+    byte[] data2 = new byte[ cast(int)(ia[0])];
+}
+
+/*******************************************/
+
+class C68
+{
+    static int value;
+}
+
+void test68()
+{
+    auto v1 = test.C68.value;
+    auto v2 = C68.classinfo;
+    auto v3 = test.C68.classinfo;
+    assert(v2 == v3);
+}
+
+/*******************************************/
+
+void test69()
+{
+    class Bug
+    {
+      char[12] str = "";
+      uint t = 1;
+    }
+
+    class NoBug
+    {
+      uint t = 2;
+      char[12] str = "";
+    }
+
+    class NoBug2
+    {
+      char[12] str;
+      uint t = 3;
+    }
+
+    auto b = new Bug;
+    auto n = new NoBug;
+    auto n2 = new NoBug2;
+
+    writefln("bug %d", b.t);
+    assert(b.t == 1);
+    writefln("nobug %d", n.t);
+    assert(n.t == 2);
+    writefln("nobug2 %d", n2.t);
+    assert(n2.t == 3);
+}
+
+/*******************************************/
+
+void test70()
+{
+    void foo(char[0] p)
+    {
+    }
+
+    static const char[0] altsep;
+    string s = std.string.format("test%spath", altsep);
+    assert(s == "testpath");
+    foo(altsep);
+}
+
+/*******************************************/
+
+
+class C71
+{
+    static int cnt;
+    this() { printf("C()\n"); cnt++; }
+    ~this() { printf("~C()\n"); cnt--; }
+}
+
+class D71
+{
+    static int cnt;
+    this() { printf("D()\n"); cnt++; }
+    ~this() { printf("~D()\n"); cnt--; }
+}
+
+class E71
+{
+    static int cnt;
+    this() { printf("E()\n"); cnt++; }
+    ~this() { printf("~E()\n"); cnt--; }
+}
+
+void test71()
+{
+  {
+    int i = 0;
+    printf("start\n");
+    scope D71 d = new D71();
+    assert(D71.cnt == 1);
+    for (scope E71 e = new E71(); i < 5; i++)
+    {
+        assert(D71.cnt == 1);
+        assert(E71.cnt == 1);
+        scope c = new C71();
+        assert(C71.cnt == 1);
+    }
+    assert(C71.cnt == 0);
+    assert(E71.cnt == 0);
+    assert(D71.cnt == 1);
+    printf("finish\n");
+  }
+  assert(D71.cnt == 0);
+}
+
+/*******************************************/
+
+size_t getLength(int[] arr) { return arr.length; }
+
+void test13237()
+{
+        int[] arr = [0];
+        immutable size_t len = getLength(arr);
+
+        arr.length--;
+
+        assert(len == 1); // ok
+        if (len) { auto l = len; }
+        assert(len == 1); // len cannot be changed, but produces Assertion failure with "-O -inline"
+}
+
+/*******************************************/
+
+void main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test50();
+    test52();
+    test54();
+    test56();
+    test57();
+    test58();
+    test59();
+    test60();
+    test61();
+    test62();
+    test63();
+    test64();
+    test65();
+    test66();
+    test68();
+    test69();
+    test70();
+    test71();
+    test13237();
+
+    printf("Success\n");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test24.d b/gcc/testsuite/gdc.test/runnable/test24.d
new file mode 100644
index 00000000000..78e9150ea87
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test24.d
@@ -0,0 +1,10 @@
+// EXTRA_SOURCES: imports/test24a.d imports/test24b.d
+// PERMUTE_ARGS:
+// REQUIRED_ARGS:
+
+import imports.test24a, imports.test24b;
+
+void main()
+{
+    string hi = std.string.format("%s", 3);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test27.d b/gcc/testsuite/gdc.test/runnable/test27.d
new file mode 100644
index 00000000000..b45c132620e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test27.d
@@ -0,0 +1,13 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test27a.d
+// PERMUTE_ARGS:
+
+import imports.test27a;
+
+int main()
+{
+    auto v = new myClass!(int)();
+    v.func(5);
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test28.d b/gcc/testsuite/gdc.test/runnable/test28.d
new file mode 100644
index 00000000000..c7ec6ad3228
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test28.d
@@ -0,0 +1,1320 @@
+module test;
+
+import core.vararg;
+import std.stdio;
+import std.string;
+
+extern(C) int printf(const char*, ...);
+
+/*******************************************/
+
+struct S1
+{
+    void* function(void*) fn;
+}
+
+template M1()
+{
+    S1 s;
+}
+
+void test1()
+{
+    S1 s2;
+    mixin M1;
+    assert(s.fn == null);
+}
+
+/*******************************************/
+
+enum Qwert { yuiop }
+
+int asdfg(Qwert hjkl) { return 1; }
+int asdfg(uint zxcvb) { return 2; }
+
+void test2()
+{
+    int nm = 2;
+
+    assert(asdfg(nm) == 2);
+    assert(asdfg(cast(int) nm) == 2);
+    assert(asdfg(3) == 2);
+    assert(asdfg(cast(int) 3) == 2);
+    assert(asdfg(3L) == 2);
+    assert(asdfg(cast(int) 3L) == 2);
+    assert(asdfg(3 + 2) == 2);
+    assert(asdfg(cast(int) (3 + 2)) == 2);
+    assert(asdfg(nm + 2) == 2);
+    assert(asdfg(cast(int) (nm + 2)) == 2);
+    assert(asdfg(3 + nm) == 2);
+    assert(asdfg(cast(int) (3 + nm)) == 2);
+
+}
+
+/*******************************************/
+
+template Qwert3(string yuiop) {
+    immutable string Qwert3 = cast(string)yuiop;
+}
+
+template Asdfg3(string yuiop) {
+    immutable string Asdfg3 = cast(string)Qwert3!(cast(string)(cast(string)yuiop ~ cast(string)"hjkl"));
+}
+
+void test3()
+{
+    string zxcvb = Asdfg3!(null);
+    assert(zxcvb == "hjkl");
+    assert(zxcvb == "hjkl" ~ null);
+}
+
+/*******************************************/
+
+template Qwert4(string yuiop)
+{
+    immutable string Qwert4 = cast(string)(yuiop ~ "asdfg" ~ yuiop);
+}
+
+void test4()
+{
+    string hjkl = Qwert4!(null);
+    assert(hjkl == "asdfg");
+}
+
+/*******************************************/
+
+void test6()
+{
+    struct Foo
+    {
+        void foo() { }
+    }
+
+    alias Foo Bar;
+
+    Bar a;
+    a.foo();
+}
+
+/*******************************************/
+
+void test7()
+{
+    struct Foo
+    {
+        alias typeof(this) ThisType;
+        alias typeof(this) ThatType;
+    }
+
+    assert(is(Foo.ThisType == Foo));
+    assert(is(Foo.ThatType == Foo));
+}
+
+/*******************************************/
+
+void test8()
+{
+   int[] test;
+   test.length = 10;
+   // Show address of array start and its length (10)
+   writefln("%s %s", cast(uint)test.ptr, test.length);
+
+   test.length = 1;
+   // Show address of array start and its length (1)
+   writefln("%s %s", cast(uint)test.ptr, test.length);
+
+   test.length = 8;
+   // Show address of array start and its length (8)
+   writefln("%s %s", cast(uint)test.ptr, test.length);
+
+   test.length = 0;
+   // Shows 0 and 0!
+   writefln("%s %s", cast(uint)test.ptr, test.length);
+   assert(test.length == 0);
+   assert(test.ptr != null);
+}
+
+/*******************************************/
+
+cdouble y9;
+
+cdouble f9(cdouble x)
+{
+    return (y9 = x);
+}
+
+void test9()
+{
+    f9(1.0+2.0i);
+    assert(y9 == 1.0+2.0i);
+}
+
+/*******************************************/
+
+class CBase10
+{
+    this() { }
+}
+
+void foo10( CBase10 l )
+{
+}
+
+void test10()
+{
+    if (1)
+    {
+        foo10( new class() CBase10
+               {
+                    this() { super(); }
+               }
+             );
+    }
+    return;
+}
+
+/*******************************************/
+
+struct Foo11
+{
+    static
+        int func(T)(T a) { assert(a == 1); return 0; }
+}
+
+void test11()
+{
+        auto a = Foo11.init.func(1);
+        a = Foo11.init.func!(int)(1);
+        a = Foo11.func(1);
+        a = Foo11.func!(int)(1);
+}
+
+/*******************************************/
+
+void test12()
+{
+    class ExceptioN { }
+
+    class ExceptioX { }
+
+    static assert(ExceptioN.mangleof[0 ..$-1] == ExceptioX.mangleof[0 .. $-1]);
+}
+
+/*******************************************/
+
+template check( char ch1, char ch2)
+{
+    const bool check = ch1 == ch2;
+}
+
+void test13()
+{
+        const char[] s = "123+456" ;
+        assert(check!( '+', s[3] ) == true);
+}
+
+/*******************************************/
+
+void test14()
+{
+    static const char[] test=['a','b','c','d'];
+    static assert(test==['a','b','c','d']);
+    static assert(['a','b','c','d']== test);
+}
+
+/*******************************************/
+
+void func15(...)
+in {
+    writefln("Arguments len = %d\n", _arguments.length);
+    assert(_arguments.length == 2);
+}
+body {
+
+}
+
+void test15()
+{
+    func15(1, 2);
+}
+
+/*******************************************/
+
+void test17()
+{
+    void delegate() y = { };
+    y();
+}
+
+/*******************************************/
+
+abstract class Pen { int foo(); }
+
+class Penfold : Pen {
+    override int foo() { return 1; }
+}
+
+class Pinky : Pen {
+    override int foo() { return 2; }
+}
+
+class Printer {
+    void vprint(Pen obj) {
+        assert(obj.foo() == 1 || obj.foo() == 2);
+    }
+
+    C print(C)(C obj) {
+        assert(obj.foo() == 1 || obj.foo() == 2);
+        return obj;
+    }
+
+}
+
+void test18()
+{
+    Printer p = new Printer;
+    p.print(new Pinky);
+    p.print(new Penfold);
+    with (p)
+    {
+        vprint(new Pinky);
+        vprint(new Penfold);
+
+        print!(Pinky)(new Pinky);
+        print!(Penfold)(new Penfold);
+
+        p.print(new Pinky);
+        p.print(new Penfold);
+
+        print(new Pinky);
+        print(new Penfold);
+    }
+}
+
+/*******************************************/
+
+
+class A19
+{
+    void s() {}
+}
+
+class B19 : A19
+{
+    alias A19.s s;
+    static void s(int i) {}
+    override void s() {}
+}
+
+class C19
+{
+    void f() {
+        B19.s(0);
+    }
+}
+
+void test19()
+{
+}
+
+
+/*******************************************/
+
+class U {}
+class T : U {}
+
+void test20()
+{
+        T*   ptr;
+        T[2] sar;
+        T[]  dar;
+
+        // all of the following should work according to the "Implicit
+        // Conversions" section of the spec
+
+        tPtr(ptr);
+        tPtr(sar.ptr);
+        tPtr(dar.ptr);
+        tDar(sar);
+
+//      uPtr(ptr);      // T* => U*
+//      uPtr(sar);      // T[2] => U*
+//      uPtr(dar);      // T[] => U*
+//      uSar(sar);      // T[2] => U[2]
+//      uDar(sar);      // T[2] => U[]
+
+        uDar(dar);      // T[] => const(U)[]
+        vPtr(ptr);      // T* => void*
+        vPtr(sar.ptr);
+        vPtr(dar.ptr);
+
+        vDar(sar);
+        vDar(dar);      // works, but T[] => void[] isn't mentioned in the spec
+}
+
+void tPtr(T*t){}
+void tDar(T[]t){}
+void uPtr(U*u){}
+void uSar(U[2]u){}
+void uDar(const(U)[]u){}
+void vPtr(void*v){}
+void vDar(void[]v){}
+
+
+/*******************************************/
+
+struct Foo21
+{
+    int i;
+}
+
+template some_struct_instance(T)
+{
+    static Foo21 some_struct_instance =
+    {
+        5,
+    };
+}
+
+void test21()
+{
+    alias some_struct_instance!(int) inst;
+    assert(inst.i == 5);
+}
+
+/*******************************************/
+
+struct Foo22(T) {}
+
+void test22()
+{
+    int i;
+
+    if ((Foo22!(char)).init == (Foo22!(char)).init)
+        i = 1;
+    assert(i == 1);
+}
+
+
+/*******************************************/
+
+void test23()
+{
+    auto t=['a','b','c','d'];
+    writeln(typeid(typeof(t)));
+    assert(is(typeof(t) == char[]));
+
+    const t2=['a','b','c','d','e'];
+    writeln(typeid(typeof(t2)));
+    assert(is(typeof(t2) == const(const(char)[])));
+}
+
+/*******************************************/
+
+int foo24(int i ...)
+{
+    return i;
+}
+
+void test24()
+{
+    assert(foo24(3) == 3);
+}
+
+/*******************************************/
+
+void test25()
+{
+    ireal x = 4.0Li;
+    ireal y = 4.0Li;
+    ireal z = 4Li;
+    creal c = 4L + 0Li;
+}
+
+/*******************************************/
+
+struct Foo26
+{
+    int a;
+
+    static Foo26 opCall(int i)
+    {   Foo26 f;
+        f.a += i;
+        return f;
+    }
+}
+
+void test26()
+{   Foo26 f;
+
+    f = cast(Foo26)3;
+    assert(f.a == 3);
+
+    Foo26 g = 3;
+    assert(g.a == 3);
+}
+
+/*******************************************/
+
+struct S27
+{
+    int x;
+
+    void opAssign(int i)
+    {
+        x = i + 1;
+    }
+}
+
+void test27()
+{
+    S27 s;
+    s = 1;
+    assert(s.x == 2);
+}
+
+/*******************************************/
+
+class C28
+{
+    int x;
+
+    void opAssign(int i)
+    {
+        x = i + 1;
+    }
+}
+
+void test28()
+{
+// No longer supported for 2.0
+//    C28 s = new C28;
+//    s = 1;
+//    assert(s.x == 2);
+}
+
+/*******************************************/
+
+struct S29
+{
+    static S29 opCall(int v)
+    {
+        S29 result;
+        result.v = v;
+        return result;
+    }
+    int a;
+    int v;
+    int x,y,z;
+}
+
+int foo29()
+{
+   auto s = S29(5);
+   return s.v;
+}
+
+void test29()
+{
+    int i = foo29();
+    printf("%d\n", i);
+    assert(i == 5);
+}
+
+/*******************************************/
+
+struct S30
+{
+    static S30 opCall(int v)
+    {
+        S30 result;
+
+        void bar()
+        {
+            result.v += 1;
+        }
+
+        result.v = v;
+        bar();
+        return result;
+    }
+    int a;
+    int v;
+    int x,y,z;
+}
+
+int foo30()
+{
+   auto s = S30(5);
+   return s.v;
+}
+
+void test30()
+{
+    int i = foo30();
+    printf("%d\n", i);
+    assert(i == 6);
+}
+
+/*******************************************/
+
+struct S31
+{
+    static void abc(S31 *r)
+    {
+        r.v += 1;
+    }
+
+    static S31 opCall(int v)
+    {
+        S31 result;
+
+        void bar()
+        {
+            abc(&result);
+        }
+
+        result.v = v;
+        bar();
+        return result;
+    }
+    int a;
+    int v;
+    int x,y,z;
+}
+
+int foo31()
+{
+   auto s = S31(5);
+   return s.v;
+}
+
+void test31()
+{
+    int i = foo31();
+    printf("%d\n", i);
+    assert(i == 6);
+}
+
+/*******************************************/
+
+
+struct T32
+{
+    int opApply(int delegate(ref int i) dg)
+    {
+        int i;
+        return dg(i);
+    }
+}
+
+struct S32
+{
+    static void abc(S32 *r)
+    {
+        r.v += 1;
+    }
+
+    static S32 opCall(int v)
+    {
+        S32 result;
+        T32 t;
+
+        result.v = v;
+        foreach (i; t)
+        {
+            result.v += 1;
+            break;
+        }
+        return result;
+    }
+    int a;
+    int v;
+    int x,y,z;
+}
+
+int foo32()
+{
+   auto s = S32(5);
+   return s.v;
+}
+
+void test32()
+{
+    int i = foo32();
+    printf("%d\n", i);
+    assert(i == 6);
+}
+
+/*******************************************/
+
+class Confectionary
+{
+    this(int sugar)
+    {
+        //if (sugar < 500)
+        //    tastiness = 200;
+
+        //for (int i = 0; i < 10; ++i)
+        //    tastiness = 300;
+
+        //int[] tastinesses_array;
+
+        //foreach (n; tastinesses_array)
+        //    tastiness = n;
+
+        //int[int] tastinesses_aa;
+
+        //foreach (n; tastinesses_aa)
+        //    tastiness = n;
+
+        tastiness = 1;
+    }
+
+   const int tastiness;
+}
+
+void test33()
+{
+}
+
+/*******************************************/
+
+template a34(string name, T...)
+{
+    string a34(string name,T t)
+    {
+        string localchar;
+        foreach (a34; T)
+        {
+            writefln(`hello`);
+            localchar ~= a34.mangleof;
+        }
+        return localchar;
+    }
+}
+
+void test34()
+{
+    writeln(a34!("Adf"[], typeof("adf"),uint)("Adf"[],"adf",1234));
+}
+
+/*******************************************/
+
+template a35(string name, T...)
+{
+    int a35(M...)(M m)
+    {
+        return 3;
+    }
+}
+
+void test35()
+{
+    assert(a35!("adf")() == 3);
+}
+
+/*******************************************/
+
+template a36(AnotherT,string name,T...){
+    AnotherT a36(M...)(M){
+        AnotherT localchar;
+        foreach(a;T)
+        {
+            writefln(`hello`);
+            localchar~=a.mangleof;
+        }
+        return cast(AnotherT)localchar;
+    }
+}
+
+void test36()
+{
+    string b="adf";
+    uint i=123;
+    char[3] c="Adf";
+    writeln(a36!(typeof(b),"Adf")());
+}
+
+/*******************************************/
+
+struct Q37 {
+    Y37 opCast() {
+        return Y37.init;
+    }
+}
+
+struct Y37 {
+    Q37 asdfg() {
+        return Q37.init;
+    }
+
+    void hjkl() {
+        Q37 zxcvb = asdfg();  // line 13
+    }
+}
+
+void test37()
+{
+}
+
+/*******************************************/
+
+
+
+class C38 { }
+
+const(Object)[] foo38(C38[3] c) @system
+{   const(Object)[] x = c;
+    return x;
+}
+
+void test38()
+{
+}
+
+/*******************************************/
+
+void test39()
+{
+    void print(string[] strs)
+    {
+        writeln(strs);
+        assert(format("%s", strs) == `["Matt", "Andrew"]`);
+    }
+
+    print(["Matt", "Andrew"]);
+}
+
+/*******************************************/
+
+void test40()
+{
+    class C
+    {
+        Object propName()
+        {
+            return this;
+        }
+    }
+
+    auto c = new C;
+
+    with (c.propName)
+    {
+        writeln(toString());
+    }
+
+    auto foo = c.propName;
+}
+
+/*******************************************/
+
+void test41()
+{
+    auto test = new char [2];
+
+    int x1, x2, x3;
+    char[] foo1() { x1++; return test; }
+    int foo2() { x2++; return 0; }
+    int foo3() { x3++; return 1; }
+
+    test [] = 'a';
+    test = test [0 .. 1];
+
+    foo1() [foo2() .. foo3()] = 'b';
+    assert(x1 == 1);
+    assert(x2 == 1);
+    assert(x3 == 1);
+
+    //test [0 .. 2] = 'b'; // this line should assert
+    writef ("%s\n", test.ptr [0 .. 2]);
+}
+
+/*******************************************/
+
+void test42()
+{
+    struct X { int x; }
+
+    X x;
+    assert(x.x == 0);
+    x = x.init;
+    assert(x.x == 0);
+}
+
+/*******************************************/
+
+struct A43
+{
+    static const MY_CONST_STRING = "hello";
+
+    void foo()
+    {
+        // This will either print garbage or throw a UTF exception.
+        // But if never_called() is commented out, then it will work.
+        writefln("%s", MY_CONST_STRING);
+    }
+}
+
+void never_called43()
+{
+    // This can be anything; there just needs to be a reference to
+    // A43.MY_CONST_STRING somewhere.
+    writefln("%s", A43.MY_CONST_STRING);
+}
+
+void test43()
+{
+    A43 a;
+    a.foo();
+}
+
+/*******************************************/
+
+class A44
+{
+    static const MY_CONST_STRING = "hello";
+
+    this()
+    {
+        // This will either print garbage or throw a UTF exception.
+        // But if never_called() is commented out, then it will work.
+        writefln("%s", MY_CONST_STRING);
+    }
+}
+
+void never_called44()
+{
+    // This can be anything; there just needs to be a reference to
+    // A44.MY_CONST_STRING somewhere.
+    writefln("%s", A44.MY_CONST_STRING);
+}
+
+void test44()
+{
+    A44 a = new A44();
+}
+
+/*******************************************/
+
+class C45
+{
+    void func(lazy size_t x)
+    {
+        (new C45).func(super.toHash());
+    }
+}
+
+void test45()
+{
+}
+
+/*******************************************/
+
+template T46(double v)
+{
+    double T46 = v;
+}
+
+void test46()
+{
+    double g = T46!(double.nan) + T46!(-double.nan);
+}
+
+/*******************************************/
+
+void test47()
+{
+    uint* where = (new uint[](5)).ptr;
+
+    where[0 .. 5] = 1;
+    assert(where[2] == 1);
+    where[0 .. 0] = 0;
+    assert(where[0] == 1);
+    assert(where[2] == 1);
+}
+
+/*******************************************/
+
+void test48()
+{
+    Object o = new Object();
+    printf("%.*s\n", typeof(o).classinfo.name.length, typeof(o).classinfo.name.ptr);
+    printf("%.*s\n", (typeof(o)).classinfo.name.length, (typeof(o)).classinfo.name.ptr);
+    printf("%.*s\n", (Object).classinfo.name.length, (Object).classinfo.name.ptr);
+}
+
+/*******************************************/
+
+void test49()
+{
+    foo49();
+}
+
+void foo49()
+{
+    char[] bar;
+    assert(true, bar ~ "foo");
+}
+
+/*******************************************/
+
+void test50()
+{
+    foo50("foo");
+}
+
+void foo50(string bar)
+{
+    assert(true, bar ~ "foo");
+}
+
+/*******************************************/
+
+struct Foo51
+{
+    static Foo51 opCall()
+    {
+      return Foo51.init;
+    }
+    private char[] _a;
+    private bool _b;
+}
+
+void test51()
+{
+}
+
+/*******************************************/
+
+template A52(T ...) { }
+mixin A52!(["abc2", "def"]);
+
+void test52()
+{
+}
+
+/*******************************************/
+
+enum: int
+{
+        AF_INET53 =       2,
+        PF_INET53 =       AF_INET53,
+}
+
+enum: int
+{
+        SOCK_STREAM53 =     1,
+}
+
+struct sockaddr_in53
+{
+        int sin_family = AF_INET53;
+}
+
+enum AddressFamily53: int
+{
+        INET =       AF_INET53,
+}
+
+enum SocketType53: int
+{
+        STREAM =     SOCK_STREAM53,
+}
+
+
+class Socket53
+{
+        this(AddressFamily53 af, SocketType53 type)
+        {
+        }
+}
+
+void test53()
+{
+    new Socket53(AddressFamily53.INET, SocketType53.STREAM);
+}
+
+/*******************************************/
+
+void test54()
+{
+    int[2][] a;
+    a ~= [1,2];
+    assert(a.length == 1);
+    assert(a[0][0] == 1);
+    assert(a[0][1] == 2);
+}
+
+/*******************************************/
+
+void test55()
+{
+        float[][] a = new float [][](1, 1);
+
+        if((a.length != 1) || (a[0].length != 1)){
+                assert(0);
+        }
+        if (a[0][0] == a[0][0]){
+                assert(0);
+        }
+}
+
+/*******************************************/
+
+void test58()
+{
+    struct S
+    {
+        int i;
+        int[4] bar = 4;
+        float[4] abc;
+    }
+
+    static S a = {i: 1};
+    static S b;
+
+    writefln("a.bar: %s, %s", a.bar, a.abc);
+    assert(a.i == 1);
+    assert(a.bar[0] == 4);
+    assert(a.bar[1] == 4);
+    assert(a.bar[2] == 4);
+    assert(a.bar[3] == 4);
+    writefln("b.bar: %s, %s", b.bar, b.abc);
+    assert(b.i == 0);
+    assert(b.bar[0] == 4);
+    assert(b.bar[1] == 4);
+    assert(b.bar[2] == 4);
+    assert(b.bar[3] == 4);
+}
+
+
+/*******************************************/
+
+void bug59(string s)()
+{
+  writeln(s);
+  writeln(s.length);
+}
+
+void test59()
+{
+    bug59!("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234")();
+}
+
+/*******************************************/
+
+class Foo60(T)
+{
+    this() { unknown_identifier; }
+}
+
+void test60()
+{
+    bool foobar = is( Foo60!(int) );
+    assert(!foobar);
+}
+
+
+/*******************************************/
+
+void repeat( int n, void delegate() dg )
+{
+    printf("n = %d\n", n);
+    if( n&1 ) dg();
+    if( n/2 ) repeat( n/2, {dg();dg();} );
+}
+
+void test61()
+{
+    repeat( 10, {printf("Hello\n");} );
+}
+
+/*******************************************/
+
+void test62()
+{
+    Vector62 a;
+    a.set(1,2,24);
+    a = a * 2;
+    writeln(a.x, a.y, a.z);
+    assert(a.x == 2);
+    assert(a.y == 4);
+    assert(a.z == 48);
+}
+
+
+struct Vector62
+{
+    float x,y,z;
+
+    // constructor
+    void set(float _x, float _y, float _z)
+    {
+      x = _x;
+      y = _y;
+      z = _z;
+    }
+
+    Vector62 opMul(float s)
+    {
+      Vector62 ret;
+      ret.x = x*s;
+      ret.y = y*s;
+      ret.z = z*s;
+      return ret;
+    }
+}
+
+/*******************************************/
+
+struct Data63
+{
+    int x, y;
+
+    /// To make size > 8 so NRVO is used.
+    /// Program runs correctly with this line commented out:
+    byte filler;
+}
+
+Data63 frob(ref Data63 d)
+{
+    Data63 ret;
+    ret.y = d.x - d.y;
+    ret.x = d.x + d.y;
+    return ret;
+}
+
+void test63()
+{
+    Data63 d; d.x = 1; d.y = 2;
+    d = frob(d);
+    writeln(d.x);
+    writeln(d.y);
+    assert(d.x == 3 && d.y == -1);
+}
+
+/*******************************************/
+
+class Foo64
+{
+    this() { writefln("Foo64 created"); }
+    ~this() { writefln("Foo64 destroyed"); }
+}
+
+template Mix64()
+{
+    void init() {
+        ptr = new Foo64;
+    }
+    Foo64 ptr;
+}
+
+class Container64
+{
+    this() { init(); }
+    mixin Mix64;
+}
+
+
+void test64()
+{
+    auto x = new Container64;
+
+    assert(!(x.classinfo.flags & 2));
+}
+
+/*******************************************/
+
+struct Vector65(T, uint dim)
+{
+  T[dim]  data;
+}
+
+T dot65(T, uint dim)(Vector65!(T,dim) a, Vector65!(T,dim) b)
+{
+  T tmp;
+  for ( int i = 0; i < dim; ++i )
+    tmp += a.data[i] * b.data[i];
+  return tmp;
+}
+
+void test65()
+{
+  Vector65!(double,3u) a,b;
+  auto t = dot65(a,b);
+}
+
+
+/*******************************************/
+
+void main()
+{
+    printf("Start\n");
+
+    test1();
+    test2();
+    test3();
+    test4();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test58();
+    test59();
+    test60();
+    test61();
+    test62();
+    test63();
+    test64();
+    test65();
+
+    printf("Success\n");
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test29.d b/gcc/testsuite/gdc.test/runnable/test29.d
new file mode 100644
index 00000000000..9156c91923b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test29.d
@@ -0,0 +1,13 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test29a.d imports/test29b.d
+// PERMUTE_ARGS:
+
+import imports.test29a;
+import imports.test29b;
+
+extern(C) int printf(const char*, ...);
+
+void main() {
+        printf("%d\n", qwert);
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test3.d b/gcc/testsuite/gdc.test/runnable/test3.d
new file mode 100644
index 00000000000..79d08a44c21
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test3.d
@@ -0,0 +1,41 @@
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: imports/test3a.d imports/test3b.d
+
+import imports.test3a;
+
+extern(C) int printf(const char*, ...);
+
+class Foo
+{
+    string bar;
+
+    unittest
+    {
+        printf("in Foo.unittest()\n");
+    }
+}
+
+
+void test(int a)
+{
+}
+
+void test(uint b)
+{
+}
+
+
+int main(string[] args)
+{
+    Foo a = new Foo;
+    string baz = "lolo";
+
+    test(3);
+    a.bar = "hello";
+    a.bar = baz ~ "betty";
+
+    printf("a.bar = '%.*s'\n", a.bar.length, a.bar.ptr);
+    assert(a.bar == "lolobetty");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test30.d b/gcc/testsuite/gdc.test/runnable/test30.d
new file mode 100644
index 00000000000..085311a585f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test30.d
@@ -0,0 +1,10 @@
+// 444
+
+int main()
+{
+  int nothing( int delegate(ref int) dg ) {return 0;}
+  foreach(int x; &nothing)
+    return 7;
+  return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test31.d b/gcc/testsuite/gdc.test/runnable/test31.d
new file mode 100644
index 00000000000..b19366d240f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test31.d
@@ -0,0 +1,18 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test31a.d
+// PERMUTE_ARGS:
+
+import imports.test31a;
+
+class Foo {
+    mixin Baz!();
+
+    void testfunc() {
+        privfunc(); // Error: .privfunc is private
+    }
+}
+
+int main()
+{
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test32.d b/gcc/testsuite/gdc.test/runnable/test32.d
new file mode 100644
index 00000000000..8340ad2a234
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test32.d
@@ -0,0 +1,11 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test32a.d
+// PERMUTE_ARGS:
+
+import imports.test32a;
+
+void main()
+{
+    assert(S.sizeof == int.sizeof);
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test34.d b/gcc/testsuite/gdc.test/runnable/test34.d
new file mode 100644
index 00000000000..003024db977
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test34.d
@@ -0,0 +1,1311 @@
+
+module test34;
+
+import std.stdio;
+import std.string;
+import std.format;
+import core.exception;
+
+
+/************************************************/
+
+class Foo {}
+class Bar {}
+
+void test1()
+{
+    TypeInfo ti_foo = typeid(Foo);
+    TypeInfo ti_bar = typeid(Bar);
+
+    auto hfoo = ti_foo.toHash();
+    auto hbar = ti_bar.toHash();
+    writefln("typeid(Foo).toHash: ", hfoo);
+    writefln("typeid(Bar).toHash: ", hbar);
+    assert(hfoo != hbar);
+
+    auto e = (ti_foo == ti_bar);
+    writefln("opEquals: ", e ? "equal" : "not equal");
+    assert(!e);
+
+    auto c = (ti_foo.opCmp(ti_bar) == 0);
+    writefln("opCmp: ", c ? "equal" : "not equal");
+    assert(!c);
+}
+
+
+/************************************************/
+
+void test2()
+{
+  assert( [2,3]!=[2,4] );
+  assert( [3,2]!=[4,2] );
+  assert( !([2,3]==[2,4]) );
+  assert( ([2,3]==[2,3]) );
+}
+
+/************************************************/
+
+struct Struct
+{
+    int langID;
+    long _force_nrvo;
+}
+
+Struct[1] table;
+
+Struct getfirst()
+{
+    foreach(v; table) {
+        writeln(v.langID);
+        assert(v.langID == 1);
+        return v;
+    }
+    assert(0);
+}
+
+Struct getsecond()
+{
+    foreach(ref v; table) {
+        writeln(v.langID);
+        assert(v.langID == 1);
+        return v;
+    }
+    assert(0);
+}
+
+void test3()
+{
+    table[0].langID = 1;
+
+    auto v = getfirst();
+    writeln(v.langID);
+    assert(v.langID == 1);
+
+    v = getsecond();
+    writeln(v.langID);
+    assert(v.langID == 1);
+}
+
+/************************************************/
+
+class ExOuter
+{
+    class ExInner
+    {
+        this()
+        {
+            typeof(this.outer) X;
+            static assert(is(typeof(X) == ExOuter));
+        }
+    }
+}
+
+void test4()
+{
+}
+
+/************************************************/
+
+int status5;
+
+struct MyStruct5
+{
+}
+
+void rec5(int i, MyStruct5 s)
+{
+    if( i > 0 )
+    {
+        status5++;
+        rec5(i-1, s);
+    }
+}
+
+void test5()
+{
+    assert(status5==0);
+    MyStruct5 st;
+    rec5(1030, st);
+    assert(status5==1030);
+}
+
+/************************************************/
+
+class C6
+{
+    const int a;
+
+    this()
+    {
+        a = 3;
+    }
+
+    this(int x)
+    {
+        this();
+    }
+}
+
+void test6()
+{
+}
+
+/************************************************/
+
+template parseUinteger(string s)
+{
+    static if (s.length == 0)
+    {   const char[] value = "";
+        const char[] rest = "";
+    }
+    else static if (s[0] >= '0' && s[0] <= '9')
+    {   const char[] value = s[0] ~ parseUinteger!(s[1..$]).value;
+        const char[] rest = parseUinteger!(s[1..$]).rest;
+    }
+    else
+    {   const char[] value = "";
+        const char[] rest = s;
+    }
+}
+
+template parseInteger(string s)
+{
+    static if (s.length == 0)
+    {   const char[] value = "";
+        const char[] rest = "";
+    }
+    else static if (s[0] >= '0' && s[0] <= '9')
+    {   const char[] value = s[0] ~ parseUinteger!(s[1..$]).value;
+        const char[] rest = parseUinteger!(s[1..$]).rest;
+    }
+    else static if (s.length >= 2 &&
+                s[0] == '-' && s[1] >= '0' && s[1] <= '9')
+    {   const char[] value = s[0..2] ~ parseUinteger!(s[2..$]).value;
+        const char[] rest = parseUinteger!(s[2..$]).rest;
+    }
+    else
+    {   const char[] value = "";
+        const char[] rest = s;
+    }
+}
+
+void test7()
+{
+    writeln(parseUinteger!("1234abc").value);
+    writeln(parseUinteger!("1234abc").rest);
+    writeln(parseInteger!("-1234abc").value);
+    writeln(parseInteger!("-1234abc").rest);
+
+    assert(parseUinteger!("1234abc").value == "1234");
+    assert(parseUinteger!("1234abc").rest == "abc");
+    assert(parseInteger!("-1234abc").value == "-1234");
+    assert(parseInteger!("-1234abc").rest == "abc");
+}
+
+/************************************************/
+
+struct Foo8 { }
+
+enum Enum { RED }
+
+//typedef int myint;
+
+alias int myalias;
+
+void test8()
+{
+/+
+    assert((1+2).stringof == "1 + 2");
+    assert(Foo8.stringof == "Foo8");
+    assert(test.Foo8.stringof == "test.Foo8");
+    assert(int.stringof == "int");
+    assert((int*[5][]).stringof == "int*[5][]");
+    assert(Enum.RED.stringof == "Enum.RED");
+    assert(test.myint.stringof == "test.myint");
+    assert(myalias.stringof == "myalias");
+    assert((5).stringof == "5");
+    assert(typeof(5).stringof == "typeof(5)");
++/
+}
+
+/************************************************/
+
+/+
+class Base9 {
+    public void fnc(){
+    }
+}
+
+class Foo9 : Base9 {
+    alias Base9.fnc fnc;
+    public void fnc(){
+    }
+    static this(){
+        alias void function() T;
+        T ptr = & fnc;
+    }
+}
++/
+
+void test9()
+{
+}
+
+/************************************************/
+
+bool isalnum(dchar c) { return c>='0' && c >= '9'; }
+
+char[] toHtmlFilename(char[] fname)
+{
+    foreach (ref c; fname)
+    {
+        if (!isalnum(c) && c != '.' && c != '-')
+            c = '_';
+    }
+    return fname;
+}
+
+void test10()
+{
+}
+
+/************************************************/
+
+class A34 { }
+class B34 : A34 { }
+
+void test11()
+{
+  A34 test=new B34;
+  writefln("Test is ", test.toString);
+  assert(test.toString == "test34.B34");
+  A34 test_2=cast(A34)(new B34);
+  writefln("Test 2 is ", test_2.toString);
+  assert(test_2.toString == "test34.B34");
+}
+
+/************************************************/
+
+template Foo12(T: T[U], U)
+{
+    alias int Foo12;
+}
+
+void test12()
+{
+    Foo12!(int[long]) x;
+    assert(is(typeof(x) == int));
+}
+
+/************************************************/
+
+class C13
+{
+    int a = 4;
+    this()
+    {
+        printf("C13.this()\n");
+        assert(a == 4);
+        a = 5;
+    }
+}
+
+void test13()
+{
+    C13 c = cast(C13)Object.factory("test34.C13");
+    assert(c.a == 5);
+    Object o = Object.factory("test35.C13");
+    assert(o is null);
+}
+
+/************************************************/
+
+class Base15 {
+        int func(int a) { return 1; }
+}
+
+
+class Foo15 : Base15 {
+        alias Base15.func func;
+}
+
+
+class Bar15 : Foo15 {
+        alias Foo15.func func;
+        int func(string a) { return 2; }
+}
+
+void test15()
+{
+    Bar15 b = new Bar15();
+    assert(b.func("hello") == 2);
+    assert(b.func(5) == 1);
+}
+
+/************************************************/
+
+struct Basic16(T, U) {}
+
+struct Iterator16(T : Basic16!(T, U), U)
+{
+    static void Foo()
+    {
+        writeln(typeid(T), typeid(U));
+        assert(is(T == int));
+        assert(is(U == float));
+    }
+}
+
+void test16()
+{
+    Iterator16!(Basic16!(int, float)).Foo();
+}
+
+/************************************************/
+
+struct S17(T)
+{
+    struct iterator {}
+}
+
+int insert17(T) (S17!(T) lst, S17!(T).iterator i)
+{
+    return 3;
+}
+
+void test17()
+{
+    S17!(int) a;
+    S17!(int).iterator i;
+    auto x = insert17(a, i);
+    assert(x == 3);
+}
+
+/************************************************/
+
+void test18()
+{
+    real t = 0.;
+    for(int i=0; i<10; i++)
+    {
+        t += 1.;
+        real r =  (2*t);
+        printf("%Lg  %Lg  %Lg\n", t, r, 2*t);
+        assert(2*t == (i+1)*2);
+    }
+}
+
+/************************************************/
+
+void test19()
+{
+    char c = '3';
+    void[] ca = cast(void[])[c];
+    char[] x = cast(char[])ca;
+    assert(x[0] == '3');
+}
+
+/************************************************/
+
+enum type20
+{
+    a,
+    b,
+}
+
+class myclass20
+{
+    template XX(uint a, uint c)
+    {
+        static uint XX(){ return (a*256+c);}
+    }
+    void testcase()
+    {
+        switch (cast(uint)type20.a)
+        {
+            case XX!(cast(uint)type20.a,cast(uint)type20.b)():
+                break;
+            default: assert(0);
+        }
+    }
+}
+
+void test20()
+{
+}
+
+/************************************************/
+
+struct S21
+{
+    alias int Foo;
+    int x;
+}
+
+void test21()
+{
+    S21 s;
+    typeof(s).Foo j;
+    assert(is(typeof(j) == int));
+}
+
+/************************************************/
+
+void test22()
+{
+    auto i = 3, j = 4;
+    assert(is(typeof(i) == int));
+    assert(is(typeof(j) == int));
+}
+
+/************************************************/
+
+static m23 = 5, n23 = 6;
+
+void test23()
+{
+    auto i = 3, j = 4;
+    assert(is(typeof(i) == int));
+    assert(is(typeof(j) == int));
+    assert(is(typeof(m23) == int));
+    assert(is(typeof(n23) == int));
+}
+
+/************************************************/
+
+const int a24 = 0;
+const int foo24 = 4;
+const int[1] bar24 = [foo24 * 2];
+const int zap24 = (1 << bar24[a24]);
+
+void test24()
+{
+    assert(zap24 == 256);
+}
+
+/************************************************/
+
+struct List25(T) {  }
+struct CircularQueue25(T) {  }
+
+void front25(T)(ref List25!(T) list) {  }
+void front25(T)(ref CircularQueue25!(T) queue) {  }
+
+void test25()
+{
+    List25!(int) x;
+    front25(x);
+}
+
+/************************************************/
+
+struct Foo26
+{
+    const string x;
+}
+
+static Foo26 foo26 = {"something"};
+
+void test26()
+{
+    assert(foo26.x == "something");
+}
+
+/************************************************/
+
+template Mang(alias F)
+{
+    class G { }
+    alias void function (G ) H;
+    const string mangledname = H.mangleof;
+}
+
+template moo(alias A)
+{
+    pragma(msg,"   ");
+    const string a = Mang!(A).mangledname;
+    pragma(msg,"   ");
+    static assert(Mang!(A).mangledname == a); // FAILS !!!
+    pragma(msg,"   ");
+}
+
+void test27()
+{
+    int q;
+    string b = moo!(q).a;
+}
+
+/************************************************/
+
+struct Color
+{
+    static void fromRgb(uint rgb)
+    {
+    }
+
+    static void fromRgb(ubyte alpha, uint rgb)
+    {
+    }
+}
+
+void test28()
+{
+    Color.fromRgb(0);
+    Color.fromRgb(cast(uint)0);
+}
+
+/************************************************/
+
+void test29()
+{
+  const char[] t="abcd";
+  const ubyte[] t2=cast(ubyte[])t;
+  const char[] t3=['a','b','c','d'];
+  const ubyte[] t4=cast(ubyte[])t3;
+  assert(t4[1] == 'b');
+}
+
+/************************************************/
+
+void test30()
+{
+  const char[] test = "" ~ 'a' ~ 'b' ~ 'c';
+  char[] test2 = (cast(char[])null)~'a'~'b'~'c';
+  const char[] test3 = (cast(char[])null)~'a'~'b'~'c';
+  char[] test4 = (cast(char[])[])~'a'~'b'~'c';
+  const char[] test5 = (cast(char[])[])~'a'~'b'~'c';
+  const char[] test6 = null;
+  const char[] test7 = test6~'a'~'b'~'c';
+}
+
+/************************************************/
+
+class C31
+{
+    synchronized invariant() { int x; }
+}
+
+void test31()
+{
+}
+
+/************************************************/
+
+ulong foo32()
+{
+        return cast(ulong) (cast(ulong) 1176576512 + cast(float) -2);
+}
+
+void test32()
+{
+        assert(foo32()==1176576510);
+}
+
+/************************************************/
+
+class RangeCoder
+{
+    uint[258] cumCount; // 256 + end + total
+    uint lower;
+    uint upper;
+    ulong range;
+
+    this() {
+        for (int i=0; i<cumCount.length; i++)
+            cumCount[i] = i;
+        lower = 0;
+        upper = 0xffffffff;
+        range = 0x100000000;
+    }
+
+    void encode(uint symbol) {
+        uint total = cumCount[$ - 1];
+        // "Error: Access Violation" in following line
+        upper = lower + cast(uint)((cumCount[symbol+1] * range) / total) - 1;
+        lower = lower + cast(uint)((cumCount[symbol]   * range) / total);
+    }
+}
+
+void test33()
+{
+    RangeCoder rc = new RangeCoder();
+    rc.encode(77);
+}
+
+/************************************************/
+
+struct Vector34
+{
+    float x, y, z;
+
+    public static Vector34 opCall(float x = 0, float y = 0, float z = 0)
+    {
+        Vector34 v;
+
+        v.x = x;
+        v.y = y;
+        v.z = z;
+
+        return v;
+    }
+
+    public string toString()
+    {
+        return std.string.format("<%f, %f, %f>", x, y, z);
+    }
+}
+
+class Foo34
+{
+    private Vector34 v;
+
+    public this()
+    {
+        v = Vector34(1, 0, 0);
+    }
+
+    public void foo()
+    {
+        bar();
+    }
+
+    private void bar()
+    {
+        auto s = foobar();
+        writef("Returned: %s\n", s);
+        assert(std.string.format("%s", s) == "<1.000000, 0.000000, 0.000000>");
+    }
+
+    public Vector34 foobar()
+    {
+        writef("Returning %s\n", v);
+
+        return v;
+        Vector34 b = Vector34();
+        return b;
+    }
+}
+
+void test34()
+{
+    Foo34 f = new Foo34();
+    f.foo();
+}
+
+
+/************************************************/
+
+void foo35()
+{
+        uint a;
+        uint b;
+        uint c;
+        extern (Windows) int function(int i, int j, int k) xxx;
+
+        a = 1;
+        b = 2;
+        c = 3;
+
+        xxx = cast(typeof(xxx))(a + b);
+        version(GNU)
+        {
+            version(X86) asm
+            {
+                "int $3;" : : : ;
+            }
+            else version(X86_64) asm
+            {
+                "int $3;" : : : ;
+            }
+            else
+            {
+                import gcc.builtins;
+                __builtin_trap();
+            }
+        }
+        else
+            asm { int 3; }
+        xxx( 4, 5, 6 );
+}
+
+void test35()
+{
+}
+
+/************************************************/
+
+void test36()
+{
+    int* p = void, c = void;
+}
+
+/************************************************/
+
+void test37()
+{
+    synchronized
+    {
+        synchronized
+        {
+            writefln("Hello world!");
+        }
+    }
+}
+
+/************************************************/
+
+struct Rect {
+    int left, top, right, bottom;
+}
+
+void test38()
+{
+    print38(sizeTest(false));
+    print38(sizeTest(true));
+    print38(defaultRect);
+}
+
+static Rect sizeTest(bool empty) {
+    if (empty) {
+        Rect result;
+        return result;
+        //return Rect.init;
+    } else {
+        return defaultRect;
+        /+Rect result = defaultRect;
+        return result;+/
+    }
+}
+
+void print38(Rect r) {
+    writefln("(%d, %d)-(%d, %d)", r.left, r.top, r.right, r.bottom);
+    assert(r.left == 0);
+    assert(r.right == 0);
+    assert(r.top == 0);
+    assert(r.bottom == 0);
+}
+
+Rect defaultRect() {
+    return Rect.init;
+}
+
+/************************************************/
+
+void test39()
+{
+   double[][] foo = [[1.0],[2.0]];
+
+   writeln(foo[0]); // --> [1] , ok
+   writeln(foo[1]); // --> [2] , ok
+
+   writeln(foo);       // --> [[1],4.63919e-306]  ack!
+   writefln("%s", foo); // --> ditto
+   auto f = std.string.format("%s", foo);
+   assert(f == "[[1], [2]]");
+
+   double[1][2] bar;
+   bar[0][0] = 1.0;
+   bar[1][0] = 2.0;
+
+   writeln(bar);       // Error: Access violation
+   auto r = std.string.format("%s", bar);
+   assert(r == "[[1], [2]]");
+}
+
+/************************************************/
+
+void test40()
+{
+    int[char] x;
+    x['b'] = 123;
+    writeln(x);
+    auto r = std.string.format("%s", x);
+    assert(r == "['b':123]");
+    writeln(x['b']);
+}
+
+/************************************************/
+
+void test41()
+{
+}
+
+/************************************************/
+
+enum Enum42 {
+        A = 1
+}
+
+void test42() {
+        Enum42[] enums = new Enum42[1];
+        assert(enums[0] == Enum42.A);
+}
+
+
+/************************************************/
+
+struct A43 {}
+
+struct B43(L) {
+  A43 l;
+}
+
+void test43()
+{
+  A43 a;
+  auto b = B43!(A43)(a);
+}
+
+/************************************************/
+
+void test44()
+{
+    int[ const char[] ] a = ["abc":3, "def":4];
+}
+
+/************************************************/
+
+void test45()
+{
+    //char[3][] a = ["abc", "def"];
+    //writefln(a);
+    //char[][2] b = ["abc", "def"];
+    //writefln(b);
+}
+
+/************************************************/
+
+struct bignum
+{
+    bool smaller()
+    {
+        if (true) return false;
+        else      return false;
+        assert(0);
+    }
+
+    void equal()
+    {
+        if (!smaller)
+            return;
+    }
+}
+
+void test46()
+{
+}
+
+/************************************************/
+
+static size_t myfind(string haystack, char needle) {
+  foreach (i, c ; haystack) {
+    if (c == needle) return i;
+  }
+  return size_t.max;
+}
+
+static size_t skip_digits(string s) {
+  foreach (i, c ; s) {
+    if (c < '0' || c > '9') return i;
+  }
+  return s.length;
+}
+
+static uint matoi(string s) {
+  uint result = 0;
+  foreach (c ; s) {
+    if (c < '0' || c > '9') break;
+    result = result * 10 + (c - '0');
+  }
+  return result;
+}
+
+enum { leading, skip, width, modifier, format, fmt_length, extra };
+
+static string GetFormat(string s) {
+  uint pos = 0;
+  string result;
+  // find the percent sign
+  while (pos < s.length && s[pos] != '%') {
+    ++pos;
+  }
+  const leading_chars = pos;
+  result ~= cast(char) pos;
+  if (pos < s.length) ++pos; // go right after the '%'
+  // skip?
+  if (pos < s.length && s[pos] == '*') {
+    result ~= 1;
+    ++pos;
+  } else {
+    result ~= 0;
+  }
+  // width?
+  result ~= cast(char) matoi(s);
+  pos += skip_digits(s[pos .. $]);
+  // modifier?
+  if (pos < s.length && myfind("hjlLqtz", s[pos]) != size_t.max) {
+    // @@@@@@@@@@@@@@@@@@@@@@@@@@@@
+    static if (true) {
+      result ~= s[pos++];
+    } else {
+      result ~= s[pos];
+      ++pos;
+    }
+    // @@@@@@@@@@@@@@@@@@@@@@@@@@@@
+  } else {
+    result ~= '\0';
+  }
+  return result;
+}
+
+void test47()
+{
+  static string test = GetFormat(" %*Lf");
+  assert(test[modifier] == 'L', "`" ~ test[modifier] ~ "'");
+}
+
+/************************************************/
+
+class B48() {}
+class C48   {}
+
+int foo48()(B48!()) { return 1; }
+int foo48()(C48 c) { return 2; }
+
+void test48()
+{
+    auto i = foo48(new B48!());
+    assert(i == 1);
+
+    i = foo48(new C48);
+    assert(i == 2);
+}
+
+/************************************************/
+
+void test49()
+{
+    struct A { int v; }
+
+    A a = A(10);
+
+  version (all)
+  {
+    writefln("Before test 1: ", a.v);
+    if (a == a.init) { writeln(a.v,"(a==a.init)"); assert(0); }
+    else { writeln(a.v,"(a!=a.init)"); assert(a.v == 10); }
+  }
+  else
+  {
+    writefln("Before test 1: ", a.v);
+    if (a == a.init) { writeln(a.v,"(a==a.init)"); assert(a.v == 10); }
+    else { writeln(a.v,"(a!=a.init)"); assert(0); }
+  }
+
+    a.v = 100;
+    writefln("Before test 2: ", a.v);
+    if (a == a.init) { writeln(a.v,"(a==a.init)"); assert(0); }
+    else { writeln(a.v,"(a!=a.init)"); assert(a.v == 100); }
+
+    a = A(1000);
+    writefln("Before test 3: ", a.v);
+    if (a == a.init) { writeln(a.v,"(a==a.init)"); assert(0); }
+    else { writeln(a.v,"(a!=a.init)"); assert(a.v == 1000); }
+
+  version (all)
+    assert(a.init.v == 0);
+  else
+    assert(a.init.v == 10);
+}
+
+/************************************************/
+
+struct S51
+{
+    int i = 3;
+    void div() { assert(i == 3); }
+}
+
+void test51()
+{
+    S51().div();
+}
+
+/************************************************/
+
+void test52()
+{
+    struct Foo {
+        alias int Y;
+    }
+    with (Foo) {
+         Y y;
+    }
+}
+
+/************************************************/
+
+struct TestStruct
+{
+    int dummy0 = 0;
+    int dummy1 = 1;
+    int dummy2 = 2;
+}
+
+void func53(TestStruct[2] testarg)
+{
+    writeln(testarg[0].dummy0);
+    writeln(testarg[0].dummy1);
+    writeln(testarg[0].dummy2);
+
+    writeln(testarg[1].dummy0);
+    writeln(testarg[1].dummy1);
+    writeln(testarg[1].dummy2);
+
+    assert(testarg[0].dummy0 == 0);
+    assert(testarg[0].dummy1 == 1);
+    assert(testarg[0].dummy2 == 2);
+
+    assert(testarg[1].dummy0 == 0);
+    assert(testarg[1].dummy1 == 1);
+    assert(testarg[1].dummy2 == 2);
+}
+
+TestStruct m53[2];
+
+void test53()
+{
+    writeln(&m53);
+    func53(m53);
+}
+
+/************************************************/
+
+void test54()
+{
+    double a = 0;
+    double b = 1;
+    // Internal error: ..\ztc\cg87.c 3233
+//    a += (1? b: 1+1i)*1i;
+    writeln(a);
+//    assert(a == 0);
+    // Internal error: ..\ztc\cod2.c 1680
+//    a += (b?1:b-1i)*1i;
+    writeln(a);
+//    assert(a == 0);
+}
+
+/************************************************/
+
+class B55 {}
+class D55 : B55 {}
+
+template foo55(S, T : S) { }    // doesn't work
+
+alias foo55!(B55, D55) bar55;
+
+void test55()
+{
+}
+
+/************************************************/
+
+template t56() { alias Object t56; }
+pragma(msg, t56!().stringof);
+
+void test56()
+{
+}
+
+/************************************************/
+
+void test57()
+{
+    alias long[char[]] AA;
+
+    static if (is(AA T : T[U], U : const char[]))
+    {
+        writeln(typeid(T));
+        writeln(typeid(U));
+
+        assert(is(T == long));
+        assert(is(U == const(char)[]));
+    }
+
+    static if (is(AA A : A[B], B : int))
+    {
+        assert(0);
+    }
+
+    static if (is(int[10] W : W[V], int V))
+    {
+        writeln(typeid(W));
+        assert(is(W == int));
+        writeln(V);
+        assert(V == 10);
+    }
+
+    static if (is(int[10] X : X[Y], int Y : 5))
+    {
+        assert(0);
+    }
+}
+
+/************************************************/
+
+static this()
+{
+   printf("one\n");
+}
+
+static this()
+{
+   printf("two\n");
+}
+
+static ~this()
+{
+   printf("~two\n");
+}
+
+static ~this()
+{
+   printf("~one\n");
+}
+
+
+void test59()
+{
+}
+
+/************************************************/
+
+class C60
+{
+    extern (C++) int bar60(int i, int j, int k)
+    {
+        printf("this = %p\n", this);
+        printf("i = %d\n", i);
+        printf("j = %d\n", j);
+        printf("k = %d\n", k);
+        assert(i == 4);
+        assert(j == 5);
+        assert(k == 6);
+        return 1;
+    }
+}
+
+
+extern (C++)
+        int foo60(int i, int j, int k)
+{
+    printf("i = %d\n", i);
+    printf("j = %d\n", j);
+    printf("k = %d\n", k);
+    assert(i == 1);
+    assert(j == 2);
+    assert(k == 3);
+    return 1;
+}
+
+void test60()
+{
+    foo60(1, 2, 3);
+
+    C60 c = new C60();
+    c.bar60(4, 5, 6);
+}
+
+/***************************************************/
+
+template Foo61(alias a) {}
+
+struct Bar61 {}
+const Bar61 bar61 = {};
+
+alias Foo61!(bar61) baz61;
+
+void test61()
+{
+}
+
+/************************************************/
+
+T foo62(T)(lazy T value)
+{
+    return value;
+}
+
+void test62()
+{
+    foo62(new float[1]);
+}
+
+/************************************************/
+
+void main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test56();
+    test57();
+    test59();
+    test60();
+    test61();
+    test62();
+
+    writefln("Success");
+}
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/test3449.d b/gcc/testsuite/gdc.test/runnable/test3449.d
new file mode 100644
index 00000000000..d330cb95f20
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test3449.d
@@ -0,0 +1,112 @@
+
+/******************************************/
+// 3449
+
+template TypeTuple(T...) { alias TypeTuple = T; }
+
+// If module variable has no explicit initializer,
+// constant folding is not allowed for that.
+int mg1;
+const int cg1;
+immutable int ig1;
+static this()
+{
+    mg1 = 10;
+    cg1 = 10;
+    ig1 = 10;
+}
+static assert(!__traits(compiles, { static assert(mg1 == 0); }));
+static assert(!__traits(compiles, { static assert(cg1 == 0); }));
+static assert(!__traits(compiles, { static assert(ig1 == 0); }));
+
+// But, if module variable has explicit initializer and
+// non-mutable type, constant folding is allowed for that..
+int mg2 = 1;
+const int cg2 = 1;
+immutable int ig2 = 1;
+static this()
+{
+    mg2 = 11;
+    static assert(!__traits(compiles, cg2 = 11));   // not allowed for constant folding
+    static assert(!__traits(compiles, ig2 = 11));   // not allowed for constant folding
+}
+static assert(!__traits(compiles, { static assert(mg2 == 1); }));
+                                    static assert(cg2 == 1);    // possible
+                                    static assert(ig2 == 1);    // possible
+
+// For aggregate fields, compiler behavior will be changed.
+void test3449()
+{
+    static struct S(T)
+    {
+        T field1;       // doesn't have explicit initializer
+        T field2 = 1;   // has explicit initializer
+
+        this(int n)
+        {
+            field1 = n; // allowed
+            field2 = n; // NEW! re-assigning during construction is allowed for any qualified fields.
+        }
+    }
+
+    foreach (T; TypeTuple!(int, const int, immutable int))
+    {
+        alias S!T ST;
+
+        auto s1 = ST();             // default construction
+        assert(s1.field1 == 0);     // == T.init
+        assert(s1.field2 == 1);     // == specified initializer
+
+        // Getting address for non-mutable field is allowed.
+        T* s1p1 = &s1.field1;
+        T* s1p2 = &s1.field2;
+        assert(*s1p1 == 0);
+        assert(*s1p2 == 1);
+        static if (is(T == int))
+        {   // If T is mutable,
+            // modification through indirection is allowed
+            *s1p1 = 100, *s1p2 = 101;
+            assert(*s1p1 == 100);
+            assert(*s1p2 == 101);
+        }
+        else
+        {   // If T is not mutable, modification is not allowed
+            static assert(!__traits(compiles, *s1p1 = 100));
+            static assert(!__traits(compiles, *s1p2 = 100));
+        }
+
+        // Access to non-static non-mutable field is
+        // now correctly rejected by "need this" error.
+        static assert(!__traits(compiles, ST.field1 == 1));
+        static assert(!__traits(compiles, ST.field2 == 0));
+
+        // So, re-assignment of non-mutable fields
+        // during construction is enough acceptable.
+        auto s2 = ST(10);
+        assert(s2.field1 == 10);
+        assert(s2.field2 == 10);
+    }
+}
+
+/******************************************/
+// 10643
+
+struct S10643
+{
+    const int[1000] x = void;
+
+    this(int n)
+    {
+        x[] = n;
+    }
+}
+static assert(S10643.sizeof == int.sizeof * 1000);
+
+/******************************************/
+
+int main()
+{
+    test3449();
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test3574a.d b/gcc/testsuite/gdc.test/runnable/test3574a.d
new file mode 100644
index 00000000000..c2283f704b8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test3574a.d
@@ -0,0 +1,13 @@
+int g = 0;
+static ~this() { assert(g == 100); }
+
+void main()
+out
+{
+    g = 100;
+}
+body
+{
+    return;
+    // expected return code == 0
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test3574b.d b/gcc/testsuite/gdc.test/runnable/test3574b.d
new file mode 100644
index 00000000000..d239ab68469
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test3574b.d
@@ -0,0 +1,13 @@
+int g = 0;
+static ~this() { assert(g == 100); }
+
+void main()
+out
+{
+    g = 100;
+}
+body
+{
+    //return;
+    // expected return code == 0
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test3574c.d b/gcc/testsuite/gdc.test/runnable/test3574c.d
new file mode 100644
index 00000000000..2974da53383
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test3574c.d
@@ -0,0 +1,13 @@
+//int g = 0;
+//static ~this() { assert(g == 100); }
+
+void main()
+//out
+//{
+//    g = 100;
+//}
+//body
+{
+    return;
+    // expected return code == 0
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test3574d.d b/gcc/testsuite/gdc.test/runnable/test3574d.d
new file mode 100644
index 00000000000..0eaf2dd8e79
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test3574d.d
@@ -0,0 +1,13 @@
+//int g = 0;
+//static ~this() { assert(g == 100); }
+
+void main()
+//out
+//{
+//    g = 100;
+//}
+//body
+{
+    //return;
+    // expected return code == 0
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test36.d b/gcc/testsuite/gdc.test/runnable/test36.d
new file mode 100644
index 00000000000..9f5b140127d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test36.d
@@ -0,0 +1,109 @@
+// PERMUTE_ARGS:
+
+import std.stdio;
+interface IUnknown{
+        extern(Windows):
+        void func();
+}
+class ComObject :IUnknown
+{
+extern (Windows):
+        void func()
+        {writefln(`comobject`);
+        }
+}
+interface IDataObject: IUnknown
+{
+        extern(Windows):
+        void method();
+}
+package class invarianttest:ComObject, IDataObject
+{
+        invariant()
+        {
+                writefln(`hello invariant`);
+        }
+
+extern (Windows):
+        override void func()
+        {
+        int esp;
+        version(GNU)
+        {
+            version(X86) asm
+            {
+                "mov %%ESP,%0" : "=r" esp : : ;
+            }
+            else version(X86_64) asm
+            {
+                "mov %%ESP,%0" : "=r" esp : : ;
+            }
+            else version(ARM) asm
+            {
+                "str sp,%0" : "=m" esp : : ;
+            }
+            else static assert(false, "ASM code not implemented for this architecture");
+        }
+        else asm
+        {
+                mov esp,ESP;
+        }
+        printf("\n%d",esp);
+        printf(`func`);
+        }
+        void method()
+        {
+                writefln(`method`);
+        }
+}
+int main()
+{
+        auto inst= new invarianttest;
+        int esp;
+        version(GNU)
+        {
+            version(X86) asm
+            {
+                "mov %%ESP,%0" : "=r" esp : : ;
+            }
+            else version(X86_64) asm
+            {
+                "mov %%ESP,%0" : "=r" esp : : ;
+            }
+            else version(ARM) asm
+            {
+                "str sp,%0" : "=m" esp : : ;
+            }
+            else static assert(false, "ASM code not implemented for this architecture");
+        }
+        else asm
+        {
+                mov esp,ESP;
+        }
+        inst.func();
+        inst.method();
+        writefln("\n%d",esp);
+        version(GNU)
+        {
+            version(X86) asm
+            {
+                "mov %%ESP,%0" : "=r" esp : : ;
+            }
+            else version(X86_64) asm
+            {
+                "mov %%ESP,%0" : "=r" esp : : ;
+            }
+            else version(ARM) asm
+            {
+                "str sp,%0" : "=m" esp : : ;
+            }
+            else static assert(false, "ASM code not implemented for this architecture");
+        }
+        else asm
+        {
+                mov esp,ESP;
+        }
+        writefln("\n%d",esp);
+        return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test37.d b/gcc/testsuite/gdc.test/runnable/test37.d
new file mode 100644
index 00000000000..8ef6cb53662
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test37.d
@@ -0,0 +1,10 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -Jrunnable/extra-files
+// EXTRA_FILES: extra-files/foo37.txt
+
+import std.stdio;
+
+void main()
+{
+    writefln(import("foo37.txt"));
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test38.d b/gcc/testsuite/gdc.test/runnable/test38.d
new file mode 100644
index 00000000000..4fc728d4310
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test38.d
@@ -0,0 +1,13 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test38a.d
+// PERMUTE_ARGS:
+
+import std.stdio;
+import imports.test38a;
+
+void main()
+{
+    static b = bar(7);
+    printf("b = %d, %d\n", b, bar(7));
+    assert(b == 49);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test4.d b/gcc/testsuite/gdc.test/runnable/test4.d
new file mode 100644
index 00000000000..2e4df9c68f1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test4.d
@@ -0,0 +1,1513 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS:
+
+import core.exception;
+import core.stdc.math;
+import core.vararg;
+
+extern(C)
+{
+    int atoi(const char*);
+    int memcmp(const void*, const void*, size_t);
+    int printf(const char*, ...);
+}
+
+int cmp(const(char)[] s1, const(char)[] s2)
+{
+    assert(s1.length == s2.length);
+
+    return memcmp(s1.ptr, s2.ptr, s1.length);
+}
+
+/* ================================ */
+
+void test1()
+{
+    int i;
+
+    int[6] foo = 1;
+    for (i = 0; i < foo.length; i++)
+        assert(foo[i] == 1);
+
+    int[10] bar;
+    for (i = 0; i < bar.length; i++)
+        assert(bar[i] == 0);
+
+    foo[3] = 4;
+    int[6] abc = foo;
+    for (i = 0; i < abc.length; i++)
+        assert(abc[i] == foo[i]);
+
+    abc[2] = 27;
+    foo[] = abc;
+    for (i = 0; i < abc.length; i++)
+        assert(abc[i] == foo[i]);
+}
+
+/* ================================ */
+
+void test2()
+{
+    byte foo1[5];
+    ubyte foo2[6];
+    short foo3[7];
+    ushort foo4[8];
+    int foo5[9];
+    uint foo6[10];
+    long foo7[11];
+    ulong foo8[12];
+    float foo9[13];
+    double foo10[14];
+    real foo11[15];
+
+    int i;
+
+    printf("test2()\n");
+    for (i = 0; i < foo1.length; i++)
+        assert(foo1[i] == 0);
+    for (i = 0; i < foo2.length; i++)
+    {   printf("foo2[%d] = %d\n", i, foo2[i]);
+        assert(foo2[i] == 0);
+    }
+    for (i = 0; i < foo3.length; i++)
+        assert(foo3[i] == 0);
+    for (i = 0; i < foo4.length; i++)
+        assert(foo4[i] == 0);
+    for (i = 0; i < foo5.length; i++)
+    {
+        printf("foo5[%d] = %d\n", i, foo5[i]);
+        assert(foo5[i] == 0);
+    }
+    for (i = 0; i < foo6.length; i++)
+        assert(foo6[i] == 0);
+    for (i = 0; i < foo7.length; i++)
+        assert(foo7[i] == 0);
+    for (i = 0; i < foo8.length; i++)
+        assert(foo8[i] == 0);
+    for (i = 0; i < foo9.length; i++)
+        assert(isnan(foo9[i]));
+    for (i = 0; i < foo10.length; i++)
+        assert(isnan(foo10[i]));
+    for (i = 0; i < foo11.length; i++)
+        assert(isnan(foo11[i]));
+}
+
+/* ================================ */
+
+void test3()
+{
+    byte foo1[5] = 20;
+    ubyte foo2[6] = 21;
+    short foo3[7] = 22;
+    ushort foo4[8] = 23;
+    int foo5[9] = 24;
+    uint foo6[10] = 25;
+    long foo7[11] = 26;
+    ulong foo8[12] = 27;
+    float foo9[13] = 28;
+    double foo10[14] = 29;
+    real foo11[15] = 30;
+
+    int i;
+
+    for (i = 0; i < foo1.length; i++)
+        assert(foo1[i] == 20);
+    for (i = 0; i < foo2.length; i++)
+        assert(foo2[i] == 21);
+    for (i = 0; i < foo3.length; i++)
+        assert(foo3[i] == 22);
+    for (i = 0; i < foo4.length; i++)
+        assert(foo4[i] == 23);
+    for (i = 0; i < foo5.length; i++)
+        assert(foo5[i] == 24);
+    for (i = 0; i < foo6.length; i++)
+        assert(foo6[i] == 25);
+    for (i = 0; i < foo7.length; i++)
+        assert(foo7[i] == 26);
+    for (i = 0; i < foo8.length; i++)
+        assert(foo8[i] == 27);
+    for (i = 0; i < foo9.length; i++)
+        assert(foo9[i] == 28);
+    for (i = 0; i < foo10.length; i++)
+        assert(foo10[i] == 29);
+    for (i = 0; i < foo11.length; i++)
+        assert(foo11[i] == 30);
+}
+
+/* ================================ */
+
+struct a4
+{
+    string b = "string";
+    int c;
+}
+
+void test4()
+{
+    a4 a;
+    int i;
+
+    assert(a.b.length == 6);
+    i = cmp(a.b, "string");
+    assert(i == 0);
+
+    a4[3] c;
+    int j;
+    for (j = 0; j < 3; j++)
+    {
+        assert(c[j].b.length == 6);
+        i = cmp(c[j].b, "string");
+        assert(i == 0);
+    }
+}
+
+
+/* ================================ */
+
+float f5;
+const char[4] x5 = "abcd";
+
+struct a5
+{
+    string b = "string";
+    int c;
+}
+
+a5[5] foo5;
+
+void test5()
+{
+    printf("test5()\n");
+    assert(isnan(f5));
+
+    assert(cmp(x5, "abcd") == 0);
+
+    int i;
+    for (i = 0; i < 5; i++)
+    {
+        assert(foo5[i].c == 0);
+        assert(cmp(foo5[i].b, "string") == 0);
+    }
+}
+
+/* ================================ */
+
+struct TRECT6
+{
+    int foo1 = 2;
+
+    union {
+      struct
+      {
+        int Left = 3, Top = 4, Right = 5, Bottom = 6;
+      }
+      struct
+      {
+        long TopLeft, BottomRight;
+      }
+    }
+
+    int foo2 = 7;
+}
+
+void test6()
+{
+    TRECT6 t;
+
+    assert(t.foo1   == 2);
+    assert(t.Left   == 3);
+    assert(t.Top    == 4);
+    assert(t.Right  == 5);
+    assert(t.Bottom == 6);
+    assert(t.foo2   == 7);
+    assert(&t.foo1 < &t.Left);
+    assert(&t.Bottom < &t.foo2);
+
+    assert(TRECT6.foo1.offsetof == 0);
+version (Win32)
+{
+    assert(TRECT6.Left.offsetof == 8);
+    assert(TRECT6.Top.offsetof == 12);
+    assert(TRECT6.Right.offsetof == 16);
+    assert(TRECT6.Bottom.offsetof == 20);
+    assert(TRECT6.TopLeft.offsetof == 8);
+    assert(TRECT6.BottomRight.offsetof == 16);
+    assert(TRECT6.foo2.offsetof == 24);
+}
+else version (X86_64)
+{
+    assert(TRECT6.Left.offsetof == 8);
+    assert(TRECT6.Top.offsetof == 12);
+    assert(TRECT6.Right.offsetof == 16);
+    assert(TRECT6.Bottom.offsetof == 20);
+    assert(TRECT6.TopLeft.offsetof == 8);
+    assert(TRECT6.BottomRight.offsetof == 16);
+    assert(TRECT6.foo2.offsetof == 24);
+}
+else version(ARM)
+{
+    assert(TRECT6.Left.offsetof == 8);
+    assert(TRECT6.Top.offsetof == 12);
+    assert(TRECT6.Right.offsetof == 16);
+    assert(TRECT6.Bottom.offsetof == 20);
+    assert(TRECT6.TopLeft.offsetof == 8);
+    assert(TRECT6.BottomRight.offsetof == 16);
+    assert(TRECT6.foo2.offsetof == 24);
+}
+else version(ARM)
+{
+    assert(TRECT6.Left.offsetof == 8);
+    assert(TRECT6.Top.offsetof == 12);
+    assert(TRECT6.Right.offsetof == 16);
+    assert(TRECT6.Bottom.offsetof == 20);
+    assert(TRECT6.TopLeft.offsetof == 8);
+    assert(TRECT6.BottomRight.offsetof == 16);
+    assert(TRECT6.foo2.offsetof == 24);
+}
+else
+{
+    assert(TRECT6.Left.offsetof == 4);
+    assert(TRECT6.Top.offsetof == 8);
+    assert(TRECT6.Right.offsetof == 12);
+    assert(TRECT6.Bottom.offsetof == 16);
+    assert(TRECT6.TopLeft.offsetof == 4);
+    assert(TRECT6.BottomRight.offsetof == 12);
+    assert(TRECT6.foo2.offsetof == 20);
+}
+}
+
+/* ================================ */
+
+struct TestVectors
+{
+    string pattern;
+    string input;
+    string result;
+    string format;
+    string replace;
+};
+
+TestVectors tva[] =
+[
+  {  pattern:"(a)\\1",  input:"abaab",  result:"y",     format:"&",     replace:"aa" },
+  {  pattern:"abc",     input:"abc",    result:"y",     format:"&",     replace:"abc" },
+];
+
+TestVectors tvs[2] =
+[
+  {  pattern:"(a)\\1",  input:"abaab",  result:"y",     format:"&",     replace:"aa" },
+  {  pattern:"abc",     input:"abc",    result:"y",     format:"&",     replace:"abc" },
+];
+
+TestVectors* tvp =
+[
+  {  pattern:"(a)\\1",  input:"abaab",  result:"y",     format:"&",     replace:"aa" },
+  {  pattern:"abc",     input:"abc",    result:"y",     format:"&",     replace:"abc" },
+];
+
+void test7()
+{
+    int i;
+
+    //printf("start\n");
+    //printf("%d\n", tva[0].pattern.length);
+    //printf("%.*s\n", tva[0].pattern.length, tva[0].pattern.ptr);
+
+    i = cmp(tva[0].pattern, "(a)\\1");
+    assert(i == 0);
+    i = cmp(tva[1].replace, "abc");
+    assert(i == 0);
+
+    i = cmp(tvs[0].pattern, "(a)\\1");
+    assert(i == 0);
+    i = cmp(tvs[1].replace, "abc");
+    assert(i == 0);
+
+    i = cmp(tvp[0].pattern, "(a)\\1");
+    assert(i == 0);
+    i = cmp(tvp[1].replace, "abc");
+    assert(i == 0);
+
+    //printf("finish\n");
+}
+
+/* ================================ */
+
+const uint WSABASEERR            = 10000;
+const uint WSAENOTCONN           = (WSABASEERR+57);
+
+void test8()
+{
+ switch (10057)
+ {
+  case WSAENOTCONN:
+   break;
+  default:
+   assert(0);
+ }
+}
+
+/* ================================ */
+
+
+alias T9* PPixel;
+align(1) struct TAG
+{
+    int foo;
+}
+alias TAG T9;
+alias TAG Pixel;
+
+
+void func9(PPixel x)
+{
+}
+
+void test9()
+{
+    Pixel p;
+    func9(&p);
+}
+
+/* ================================ */
+
+
+string[] colors10 = [ "red", "green", "blue" ];
+
+void test10()
+{
+    printf("test10()\n");
+
+    int i;
+
+    i = cmp(colors10[0], "red");
+    assert(i == 0);
+}
+
+/* ================================ */
+
+const uint MAX_PATH1 = 260;
+enum { MAX_PATH2 = 261 }
+
+struct WIN32_FIND_DATA {
+    char   cFileName1[MAX_PATH1];
+    char   cFileName2[MAX_PATH2];
+}
+
+void test11()
+{
+}
+
+/* ================================ */
+
+
+interface IPersistent
+{
+ int store(Object);
+ int retrieve(Object);
+}
+
+class Persistent: IPersistent
+{
+ int store(Object n) { return 1; }
+ int retrieve(Object n) { return 2; }
+}
+
+void func12(IPersistent p)
+{
+    Object o = new Object();
+    assert(p.store(o) == 1);
+    assert(p.retrieve(o) == 2);
+}
+
+void test12()
+{
+    Persistent p = new Persistent();
+    Object o = new Object();
+    assert(p.store(o) == 1);
+    assert(p.retrieve(o) == 2);
+
+    func12(p);
+}
+
+/* ================================ */
+
+class X13 { }
+
+class A13
+{
+     X13 B(X13 x, out int i)
+     {
+        i = 666;
+        return new X13;
+     }
+
+     X13 B(X13 x)
+     {
+        int j;
+        return B(x, j);
+     }
+}
+
+void test13()
+{
+    A13 a;
+    X13 x;
+    int i;
+
+    a = new A13();
+    x = a.B(x, i);
+    assert(i == 666);
+}
+
+/* ================================ */
+
+void foo14() { }
+
+int testx14(int x)
+{
+    try
+    {
+        return 3;
+    }
+    finally
+    {
+        foo14();
+    }
+}
+
+class bar
+{
+    int y;
+    synchronized int sync(int x)
+    {
+        printf("in sync(%d) = %d\n", x, y + 3);
+        return y + 3;
+    }
+}
+
+void test14()
+{
+    auto b = new shared(bar)();
+    int i;
+    i = b.sync(4);
+    printf("i = %d\n", i);
+    assert(i == 3);
+
+    assert(testx14(7) == 3);
+}
+
+/* ================================ */
+
+/+
+int foo15(int i)
+{
+    switch (i)
+    {
+        case 7:
+        case 8:
+            return i;
+    }
+    return 0;
+}
+
+void test15()
+{
+    int i = 0;
+    try
+    {
+        foo15(3);
+    }
+    catch (SwitchError sw)
+    {
+        //printf("caught switch error\n");
+        i = 1;
+    }
+    assert(i == 1);
+}
++/
+
+/* ================================ */
+
+
+struct GUID {          // size is 16
+    align(1):
+        uint    Data1;
+        ushort  Data2;
+        ushort  Data3;
+        ubyte   Data4[8];
+}
+
+
+GUID CLSID_Hello = { 0x30421140, 0, 0, [0xC0,0,0,0,0,0,0,0x46] };
+GUID IID_IHello  = { 0x00421140, 0, 0, [0xC0,0,0,0,0,0,0,0x46] };
+
+int testa()
+{
+    return CLSID_Hello == IID_IHello;
+}
+
+int testb()
+{
+    return CLSID_Hello != IID_IHello;
+}
+
+int testc()
+{
+    return CLSID_Hello == IID_IHello ? 5 : 3;
+}
+
+int testd()
+{
+    return CLSID_Hello != IID_IHello ? 7 : 9;
+}
+
+void test16()
+{
+    assert(testa() == 0);
+    assert(testb() == 1);
+    assert(testc() == 3);
+    assert(testd() == 7);
+}
+
+
+/* ================================ */
+
+void test17()
+{
+    creal z = 1. + 2.0i;
+
+    real r = z.re;
+    assert(r == 1.0);
+
+    real i = z.im;
+    assert(i == 2.0);
+
+    assert(r.im == 0.0);
+    assert(r.re == 1.0);
+
+    assert(i.re == 2.0);
+    assert(i.im == 0.0i);
+}
+
+/* ================================ */
+
+private const uint crc_table[256] = [
+    0x00000000u, 0x77073096u, 0xee0e612cu, 0x990951bau, 0x076dc419u,
+    0x2d02ef8du
+  ];
+
+public const(uint)[] get_crc_table()
+{
+  return crc_table;
+}
+
+void test18()
+{
+    const(uint)[] c;
+
+    c = get_crc_table();
+    assert(c[3] == 0x990951bau);
+}
+
+/* ================================ */
+
+int[0xffff] foo19;
+
+void test19()
+{
+    int i;
+
+    for (i = 0; i < 0xffff; i++)
+        assert(foo19[i] == 0);
+}
+
+/* ================================ */
+
+
+extern (Windows) int cfw(int x, int y)
+{
+    return x * 10 + y;
+}
+
+extern (C) int cfc(int x, int y)
+{
+    return x * 10 + y;
+}
+
+extern (Pascal) int cfp(int x, int y)
+{
+    return x * 10 + y;
+}
+
+int cfd(int x, int y)
+{
+    return x * 10 + y;
+}
+
+
+extern (Windows) int function (int, int) fpw;
+extern (C) int function (int, int) fpc;
+extern (Pascal) int function (int, int) fpp;
+int function (int, int) fpd;
+
+void test20()
+{
+    printf("test20()\n");
+    int i;
+
+    fpw = &cfw;
+    fpc = &cfc;
+    fpp = &cfp;
+    fpd = &cfd;
+
+//printf("test w\n");
+    i = (*fpw)(1, 2);
+    assert(i == 12);
+
+//printf("test c\n");
+    i = (*fpc)(3, 4);
+    assert(i == 34);
+
+//printf("test p\n");
+    i = (*fpp)(5, 6);
+    assert(i == 56);
+
+//printf("test d\n");
+    i = (*fpd)(7, 8);
+    assert(i == 78);
+}
+
+
+/* ================================ */
+
+void test21()
+{
+    ireal imag = 2.5i;
+    printf ("test of imag*imag = %Lf\n",imag*imag);
+    assert(imag * imag == -6.25);
+}
+
+/* ================================ */
+
+void test22()
+{
+    creal z1 = 1. - 2.0i;
+    ireal imag_part = z1.im/1i;
+}
+
+
+/* ================================ */
+
+int def23(int x, int y)
+{
+    return x * y;
+}
+
+struct Foo23
+{
+    int a = 7;
+    int b = 8;
+    int c = 9;
+
+    int abc()
+    {
+        def23(3, 4);
+        a *= b;
+        bar();
+        return a;
+    }
+
+    int bar()
+    {
+        a *= 2;
+        return a;
+    }
+
+    invariant()
+    {
+        assert(c == 9);
+    }
+}
+
+void test23()
+{
+    Foo23 f;
+    int i;
+
+    assert(f.a == 7 && f.b == 8);
+    i = f.abc();
+    assert(i == 112);
+}
+
+/* ================================ */
+
+struct Foo24
+{
+        int x, y;
+        int[] z;
+}
+
+void test24()
+{
+    assert(Foo24.z.offsetof == 8);
+}
+
+/* ================================ */
+
+void test27()
+{
+    static real[1] n = [ -1 ];
+    //printf("%Le\n", n[0]);
+    assert(n[0] == -1.0);
+}
+
+/* ================================ */
+
+int x29;
+
+class Foo29
+{
+    ~this()
+    {
+        x29 = bar();
+    }
+
+    int bar()
+    {
+        return 3;
+    }
+}
+
+
+void test29()
+{
+    printf("test29()\n");
+
+    Foo29 f = new Foo29();
+
+    delete f;
+    assert(x29 == 3);
+}
+
+/* ================================ */
+
+
+struct GC30
+{
+    static ClassInfo gcLock;
+
+    invariant()
+    {
+    }
+
+    void *malloc()
+    {   void *p;
+
+        synchronized (gcLock)
+        {
+            p = test();
+            if (!p)
+                return null;
+        }
+        return p;
+    }
+
+    void *test() { return null; }
+}
+
+void test30()
+{
+    printf("test30()\n");
+    GC30 gc;
+
+    GC30.gcLock = Object.classinfo;
+    assert(gc.malloc() == null);
+}
+
+
+/* ================================ */
+
+void test31()
+{
+    char[14] foo;
+    char[] bar;
+    int i = 3;
+
+    while (i--)
+        bar = foo;
+}
+
+/* ================================ */
+
+
+
+real foo32()
+{
+    return 4 % 1.0;
+}
+
+void test32()
+{
+    assert(foo32() == 0);
+}
+
+/* ================================ */
+
+void test33()
+{
+    char[8] foo;
+
+    foo[] = "12345678";
+    assert(foo[7] == '8');
+}
+
+
+/* ================================ */
+
+void foo34(int[] a)
+{
+    //printf("a.length = %d\n", a.length);
+    assert(a.length == 5);
+    assert(a[0] == 11);
+    assert(a[1] == 22);
+    assert(a[2] == 33);
+    assert(a[3] == 44);
+    assert(a[4] == 55);
+}
+
+void test34()
+{
+    printf("test34()\n");
+
+    static int[5] x = [11,22,33,44,55];
+    int[] y;
+    int* z;
+
+    foo34(x);
+
+    y = x;
+    foo34(y);
+
+    z = x.ptr;
+    foo34(z[0..5]);
+}
+
+/* ================================ */
+
+class X35
+{
+    final synchronized void foo()
+    {
+        for(;;)
+        {
+            break;
+        }
+    }
+}
+
+void test35()
+{
+    auto x = new shared(X35);
+
+    x.foo();
+}
+
+
+/* ================================ */
+
+void test36()
+{
+    synchronized
+    {
+    }
+}
+
+void test36b() @nogc nothrow
+{
+    synchronized
+    {
+    }
+}
+
+/* ================================ */
+int test37()
+{
+       string one = "1";
+       debug printf("pre\n");
+       int N = atoi(one.ptr);
+       assert(N == 1);
+       return 0;
+}
+
+
+/* ================================ */
+
+void test39()
+{
+        char[] array;
+        array.length=4;
+        char letter = 'a';
+        array[0..4]=letter;
+        assert(array[0]=='a');
+        assert(array[1]=='a');
+        assert(array[2]=='a');
+        assert(array[3]=='a');
+}
+
+/* ================================ */
+
+int dummyJob;
+
+int dummy()
+{
+        return ++dummyJob;
+}
+
+void bar40(){
+        return cast(void)dummy();
+}
+
+int foo40()
+{
+        bar40();
+        return dummyJob-1;
+}
+
+void test40()
+{
+    assert(foo40() == 0);
+}
+
+/* ================================ */
+
+int status;
+
+void check()
+{
+        assert(status==1);
+        void main(int dummy){
+                assert(status==3);
+                status+=5;
+        }
+        status+=2;
+        assert(status==3);
+        main(2);
+        assert(status==8);
+        status+=7;
+}
+
+void test41()
+{
+        status++;
+        assert(status==1);
+        check();
+        assert(status==15);
+}
+
+/* ================================ */
+
+void test42()
+{
+    real[10] array;
+    real[] copy = array.dup;
+}
+
+/* ================================ */
+
+void test43()
+{
+    string s;
+
+    s = __FILE__; printf("file = '%.*s'\n", s.length, s.ptr);
+    printf("line = %d\n", __LINE__);
+    s = __DATE__; printf("date = '%.*s'\n", s.length, s.ptr);
+    s = __TIME__; printf("time = '%.*s'\n", s.length, s.ptr);
+    s = __TIMESTAMP__; printf("timestamp = '%.*s'\n", s.length, s.ptr);
+}
+
+/* ================================ */
+
+void test44()
+{
+    int[] a;
+    int i;
+
+    a.length = 6;
+    a = a[0 .. $ - 1];
+    assert(a.length == 5);
+}
+
+/* ================================ */
+
+alias int MyInt;
+
+void test45()
+{
+        MyInt test(string c="x"){
+                return 2;
+        }
+        assert(test("abc")==2);
+}
+
+/* ================================ */
+
+int status46;
+
+class Check46
+{
+        void sum(byte[] b){
+                status46++;
+        }
+
+        void add(byte b){
+                assert(0);
+        }
+
+        alias sum write;
+        alias add write;
+
+        void test(){
+                byte[] buffer;
+                write(buffer);
+        }
+}
+
+
+void test46()
+{
+        Check46 c = new Check46();
+        status46=0;
+        assert(status46==0);
+        c.test();
+        assert(status46==1);
+}
+
+/* ================================ */
+
+int status47;
+
+int foo47(int arg)
+{
+loop:
+    while(1)
+    {
+        try
+        {
+            try
+            {
+                if (arg == 1)
+                {
+                    break loop;
+                }
+            }
+            finally
+            {
+                assert(status47==0);
+                status47+=2;
+            }
+
+            try
+            {
+                assert(0);
+            }
+            finally
+            {
+                assert(0);
+            }
+        }
+        finally
+        {
+            assert(status47==2);
+            status47+=3;
+        }
+        assert(0);
+        return 0;
+    }
+    return -1;
+}
+
+void test47()
+{
+        assert(status47 == 0);
+        assert(foo47(1) == -1);
+        assert(status47 == 5);
+}
+
+/* ================================ */
+
+int status48;
+
+int foo48(int arg)
+{
+
+loop:
+    while(1){
+        try{
+            try{
+                if(arg == 1)
+                {
+                    break loop;
+                }
+            }finally{
+                assert(status48==0);
+                status48+=2;
+            }
+        }finally{
+            assert(status48==2);
+            status48+=3;
+        }
+        return 0;
+    }
+    return -1;
+}
+
+void test48()
+{
+    assert(status48 == 0);
+    assert(foo48(1) == -1);
+    assert(status48 == 5);
+}
+
+/* ================================ */
+
+int getch49()
+{
+        return 0;
+}
+
+void writefln49(...)
+{
+}
+
+class Cout{
+        Cout set(int x){
+                return this;
+        }
+        alias set opShl;
+}
+
+void test49()
+{
+        Cout cout = new Cout;
+        cout << 5 << 4;
+        writefln49,getch49;
+}
+
+/* ================================ */
+
+struct S50{
+        int i;
+}
+
+class C50{
+        static S50 prop(){
+                S50 s;
+                return s;
+        }
+
+        static void prop(S50 s){
+        }
+}
+
+void test50()
+{
+        C50 c = new C50();
+        c.prop = true ? C50.prop : C50.prop;
+        assert(c.prop.i == 0);
+        c.prop.i = 7;
+        assert(c.prop.i != 7);
+}
+
+/* ================================ */
+
+void func1()
+{
+        static class foo {
+                public int a;
+        }
+}
+
+void test51()
+{
+        static class foo {
+                public int b;
+        }
+
+        foo bar = new foo();
+        bar.b = 255;
+}
+
+/* ================================ */
+
+struct S52
+{
+        int i;
+}
+
+const int a52 = 3;
+const S52 b52 = { a52 };
+const S52 c52 = b52;
+
+void test52()
+{
+    assert(c52.i == 3);
+}
+
+/* ================================ */
+
+const int c53 = b53 + 1;
+const int a53 = 1;
+const int b53 = a53 + 1;
+
+void test53()
+{
+        assert(a53==1);
+        assert(b53==2);
+        assert(c53==3);
+}
+
+/* ================================ */
+void test54()
+{
+        int status=0;
+
+        try
+        {
+                try
+                {
+                        status++;
+                        assert(status==1);
+                        throw new Exception("first");
+                }
+                finally
+                {
+                        printf("finally\n");
+                        status++;
+                        assert(status==2);
+                        status++;
+                        throw new Exception("second");
+                }
+        }
+        catch(Exception e)
+        {
+                printf("catch %.*s\n", e.msg.length, e.msg.ptr);
+                assert(e.msg == "first");
+                assert(e.next.msg == "second");
+        }
+        printf("success54\n");
+}
+
+/* ================================ */
+
+void foo55()
+{
+    try
+    {
+        Exception x = new Exception("second");
+        printf("inner throw %p\n", x);
+        throw x;
+    }
+    catch (Exception e)
+    {
+        printf("inner catch %p\n", e);
+        printf("e.msg == %.*s\n", e.msg.length, e.msg.ptr);
+        assert(e.msg == "second");
+        //assert(e.msg == "first");
+        //assert(e.next.msg == "second");
+    }
+}
+
+void test55()
+{
+        int status=0;
+        try{
+                try{
+                        status++;
+                        assert(status==1);
+                        Exception x = new Exception("first");
+                        printf("outer throw %p\n", x);
+                        throw x;
+                }finally{
+                        printf("finally\n");
+                        status++;
+                        assert(status==2);
+                        status++;
+                        foo55();
+                        printf("finally2\n");
+                }
+        }catch(Exception e){
+                printf("outer catch %p\n", e);
+                assert(e.msg == "first");
+                assert(status==3);
+        }
+        printf("success55\n");
+}
+
+/* ================================ */
+
+void test56()
+{
+    assert('\&sup2;'==178);
+    assert('\&sup3;'==179);
+    assert('\&sup1;'==185);
+    assert('\&frac14;'==188);
+    assert('\&frac12;'==189);
+    assert('\&frac34;'==190);
+    assert('\&there4;'==8756);
+}
+
+/* ================================ */
+
+void test57()
+{
+  version (D_Bits)
+  {
+    void displayb(char[] name, bit[] x)
+    {
+        writef("%-5s: ", name);
+        foreach(bit b; x)
+            writef("%d",b);
+        writefln("");
+    }
+
+    bit[] a;
+    bit[] b;
+
+    a.length = 7;
+    a[0] = 0;
+    a[1] = 1;
+    a[2] = 1;
+    a[3] = 0;
+    a[4] = 0;
+    a[5] = 1;
+    a[6] = 0;
+
+    displayb("a", a);
+
+    b ~= a;
+    displayb("b1", b);
+
+    b ~= a;
+    displayb("b2", b);
+
+    for (int i = 0; i < a.length; i++)
+    {
+        assert(b[i] == a[i]);
+        assert(b[i+7] == a[i]);
+    }
+
+    b.length = 0;
+    b ~= a;
+    displayb("b3", b);
+
+    b.length = b.length + 7;
+    for(int i = 0; i < a.length; i++)
+        b[i+7] = a[i];
+    displayb("b4", b);
+
+    for (int i = 0; i < a.length; i++)
+    {
+        assert(b[i] == a[i]);
+        assert(b[i+7] == a[i]);
+    }
+  }
+}
+
+/* ================================ */
+
+interface Foo58
+{
+}
+
+interface Bar58 : Foo58
+{
+}
+
+class Baz58 : Bar58
+{
+}
+
+Object test58()
+{
+    Bar58 b = new Baz58;
+    return cast(Object)b;
+}
+
+/* ================================ */
+
+float x59;
+
+void test59()
+{
+    return cast(void)(x59 = -x59);
+}
+
+
+/* ================================ */
+
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    //test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+//    test26();
+    test27();
+//    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test56();
+    test57();
+    test58();
+    test59();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test40.d b/gcc/testsuite/gdc.test/runnable/test40.d
new file mode 100644
index 00000000000..528162b78c1
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test40.d
@@ -0,0 +1,16 @@
+// EXTRA_SOURCES: imports/test40a.d
+// PERMUTE_ARGS:
+// REQUIRED_ARGS:
+
+import std.stdio;
+import imports.test40a;
+
+class Foo {
+        mixin Mix;
+}
+
+
+void main() {
+        Bar.foobar();
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test41.d b/gcc/testsuite/gdc.test/runnable/test41.d
new file mode 100644
index 00000000000..fd89bab529d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test41.d
@@ -0,0 +1,29 @@
+// EXTRA_SOURCES: imports/test41a.d
+// PERMUTE_ARGS: -inline -g -O
+
+import imports.test41a;
+import core.exception;
+
+int main()
+{
+    try
+    {
+        foo();
+        return 1;
+    }
+    catch (AssertError e)
+    {
+    }
+
+    try
+    {
+        func!(void)();
+        return 1;
+    }
+    catch (AssertError e)
+    {
+    }
+
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test42.d b/gcc/testsuite/gdc.test/runnable/test42.d
new file mode 100644
index 00000000000..5b2fd75b203
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test42.d
@@ -0,0 +1,6418 @@
+// REQUIRED_ARGS:
+#line 2
+
+module test42;
+
+import std.stdio;
+import core.stdc.stdio;
+import std.string;
+import core.memory;
+
+/***************************************************/
+
+class Foo {
+    template myCast(T) {
+        T myCast(U)(U val) {
+            return cast(T) val;
+        }
+    }
+}
+
+void test1()
+{
+  Foo foo = new Foo;
+  int i = foo.myCast!(int)(1.0);
+}
+
+/***************************************************/
+
+template A()
+{
+  static T foo(T)(T t) { return 7 + t; }
+}
+
+struct Bar
+{
+  mixin A!() a;
+}
+
+void test2()
+{
+  auto i = A!().foo(1);
+  assert(i == 8);
+  i = Bar.a.foo!(int)(2);
+  assert(i == 9);
+  i = Bar.a.foo(3);
+  assert(i == 10);
+}
+
+/***************************************************/
+
+void test3()
+{
+    auto i = mixin("__LINE__");
+    writefln("%d", i);
+    assert(i == 52);
+}
+
+/***************************************************/
+
+class C4
+{
+    void Stamp(){}
+
+    this() { }
+
+    S4 cursor;
+}
+
+struct S4
+{
+}
+
+void test4()
+{
+}
+
+/***************************************************/
+
+char a5 = (cast(char[])['a']) [$-1];
+
+void test5()
+{
+    assert(a5 == 'a');
+}
+
+/***************************************************/
+// Bug 1200. One case moved to deprecate1.d
+
+void foo6a() {
+        do
+                debug {}
+        while (true);
+}
+
+void foo6b() {
+        while (true)
+                debug {}
+}
+
+void foo6c() {
+        with (Object.init)
+                debug {}
+}
+
+void foo6d() {
+        synchronized debug {}
+}
+
+void foo6e() {
+//        volatile debug {}
+}
+
+void test6()
+{
+}
+
+/***************************************************/
+
+class C7 {
+    public this(){
+    }
+}
+
+interface I7 {
+    void fnc();
+}
+
+void test7()
+{
+    char[][] t;
+    foreach( char[] c; t ){
+        new class( c ) C7, I7 {
+            public this( char[] c ){
+                super();
+            }
+            void fnc(){
+            }
+        };
+    }
+}
+
+/***************************************************/
+
+const ulong[] A8 = ([1LU])[0..$];
+
+void test8()
+{
+    assert(A8[0] == 1);
+}
+
+/***************************************************/
+
+void test9()
+{
+    writeln(long.max.stringof);
+    writeln(ulong.max.stringof);
+    assert(long.max.stringof == "9223372036854775807L");
+    assert(ulong.max.stringof == "18446744073709551615LU");
+}
+
+/***************************************************/
+
+const ulong[] A10 = [1UL];
+const ulong[] B10 = A10 ~ [1UL];
+
+void test10()
+{
+}
+
+/***************************************************/
+
+class Base11 {
+        private final void foo() {}
+}
+
+class Derived11 : Base11 {
+        void foo() {}
+}
+
+void test11()
+{
+}
+
+/***************************************************/
+
+void test12()
+{
+    int[] bar;
+    assert((bar ~ 1).length == bar.length + 1);
+
+    int[][] baz;
+    assert((baz ~ cast(int[])[1]).length == baz.length + 1);
+
+    char[][] foo;
+    assert((foo ~ cast(char[])"foo").length == foo.length + 1);
+    assert((cast(char[])"foo" ~ foo).length == foo.length + 1);
+
+    printf("%d\n", (foo ~ cast(char[])"foo")[0].length);
+
+    assert((foo ~ [cast(char[])"foo"]).length == foo.length + 1);
+
+    char[] qux;
+    assert(([qux] ~ cast(char[])"foo").length == [qux].length + 1);
+
+    assert(([cast(dchar[])"asdf"] ~ cast(dchar[])"foo").length == [cast(dchar[])"asdf"].length + 1);
+
+    string[] quux;
+    auto quuux = quux.dup;
+    quuux ~= "foo";
+    assert (quuux.length == quux.length + 1);
+}
+
+/***************************************************/
+
+int prop() { return 3; }
+
+void test13()
+{
+  auto x = prop;
+  assert(x == 3);
+}
+
+/***************************************************/
+
+void recurse(ref int i)
+{
+    int j = i;
+    recurse(j);
+}
+
+void test14()
+{
+}
+
+/***************************************************/
+
+void bar15(void delegate(int) dg)
+{
+    dg(7);
+}
+
+class C15
+{
+    int x;
+
+    private void callback(int i)
+    {
+        x = i + 3;
+    }
+
+    void foo()
+    {
+        bar15(&callback);
+        assert(x == 10);
+    }
+}
+
+void test15()
+{
+    C15 c = new C15();
+
+    c.foo();
+}
+
+/***************************************************/
+
+void bar16(int i, ...) { }
+
+void foo16() { }
+void foo16(int) { }
+
+void test16()
+{
+    bar16(1, cast(void function())&foo16);
+}
+
+/***************************************************/
+
+void foo17(char[4] buf, dchar c) { }
+void foo17(string s) { }
+void foo17(wstring s) { }
+
+
+void test17()
+{
+    wstring w;
+    .foo17(w);
+}
+
+/***************************************************/
+
+struct S18
+{
+  version (Dversion2)
+  {
+    static void opCall(string msg) { assert(0); }
+  }
+    static void opCall() { }
+}
+
+void test18()
+{
+    S18();
+}
+
+/***************************************************/
+
+class C19
+{
+  version (Dversion2)
+  {
+    static void opCall(string msg) { assert(0); }
+  }
+    static void opCall() { }
+}
+
+void test19()
+{
+    C19();
+}
+
+/***************************************************/
+
+extern (System) void test20()
+{
+}
+
+/***************************************************/
+
+void func21()
+{
+}
+
+int foo21()
+{
+   return *cast(int*)&func21;
+}
+
+void test21()
+{
+    foo21();
+}
+
+/***************************************************/
+
+void bar22(alias T)()
+{
+        assert(3 == T);
+}
+
+class Test22
+{
+        int a;
+        mixin bar22!(a);
+}
+
+void test22()
+{
+        Test22 t = new Test22();
+        t.a = 3;
+        t.bar22();
+}
+
+/***************************************************/
+
+static this()
+{
+   printf("one\n");
+}
+
+static this()
+{
+   printf("two\n");
+}
+
+static ~this()
+{
+   printf("~two\n");
+}
+
+static ~this()
+{
+   printf("~one\n");
+}
+
+void test23()
+{
+}
+
+/***************************************************/
+
+class Foo24
+{
+    static string gen()
+    {
+        return "abc";
+    }
+}
+
+auto s24 = Foo24.gen();
+
+void test24()
+{
+    assert(s24 == "abc");
+}
+
+/***************************************************/
+
+void test25()
+{
+    int[10] arrayA = [0,1,2,3,4,5,6,7,8,9];
+    foreach(int i; arrayA)
+    {
+        writeln(i);
+    }
+}
+
+/************************************/
+
+const char[][7] DAY_NAME = [
+        DAY.SUN: "sunday", "monday", "tuesday", "wednesday",
+          "thursday", "friday", "saturday"
+];
+
+enum DAY { SUN, MON, TUE, WED, THU, FRI, SAT }
+
+void test27()
+{
+    assert(DAY_NAME[DAY.SUN] == "sunday");
+    assert(DAY_NAME[DAY.MON] == "monday");
+    assert(DAY_NAME[DAY.TUE] == "tuesday");
+    assert(DAY_NAME[DAY.WED] == "wednesday");
+    assert(DAY_NAME[DAY.THU] == "thursday");
+    assert(DAY_NAME[DAY.FRI] == "friday");
+    assert(DAY_NAME[DAY.SAT] == "saturday");
+}
+
+/***************************************************/
+
+void test28()
+{
+}
+
+/***************************************************/
+
+struct C29 {
+
+    C29 copy() { return this; }
+}
+
+void foo29(C29 _c) {
+
+    foo29( _c.copy() );
+}
+
+void test29() {
+
+    C29 c;
+
+    //foo(c);
+}
+
+/***************************************************/
+
+template Tuple31(T...) { alias T Tuple31; }
+alias Tuple31!(int,int) TType31;
+
+void bar31(TType31) {
+}
+
+void test31()
+{
+}
+
+/***************************************************/
+
+template Foo32(T : S!(T), alias S)
+{
+    alias int Foo32;
+}
+
+struct Struct32(T)
+{
+}
+
+void test32()
+{
+    Foo32!(Struct32!(int)) f;
+}
+
+/***************************************************/
+
+void test33()
+{
+    string a = "a";
+    string b = "b";
+    string c = a ~ b;
+    assert(c == "ab");
+}
+
+/***************************************************/
+
+void foo34(in string s)
+{
+    string t = s;
+}
+
+void test34()
+{
+}
+
+/***************************************************/
+
+struct S35
+{
+   string toString()
+   {
+       return "foo";
+   }
+}
+
+void test35()
+{   S35 s;
+    auto t = typeid(S35);
+    writefln("s = %s", s);
+    writefln("s = %s", t);
+    auto tis = cast(TypeInfo_Struct)t;
+    writefln("s = %s", tis);
+    writefln("s = %s", tis.xtoString);
+    assert(tis.xtoString != null);
+}
+
+/***************************************************/
+
+void test36()
+{
+    void[0] x;
+    auto y = x;
+    alias x z;
+}
+
+/***************************************************/
+
+template isStaticArray(T : U[], U)
+{
+    const bool isStaticArray = is(typeof(U) == typeof(T.init));
+}
+
+template isStaticArray(T, U = void)
+{
+    const bool isStaticArray = false;
+}
+
+template isStaticArray(T : T[N], size_t N)
+{
+    const bool isStaticArray = true;
+}
+
+static assert (isStaticArray!(int[51]));
+static assert (isStaticArray!(int[][2]));
+static assert (isStaticArray!(char[][int][11]));
+static assert (!isStaticArray!(int[]));
+static assert (!isStaticArray!(int[char]));
+static assert (!isStaticArray!(int[1][]));
+
+static assert(isStaticArray!(void[0]));
+
+void test37()
+{
+}
+
+/***************************************************/
+
+template Foo38(T)
+{
+    const bool Foo38 = false;
+}
+
+template Foo38(T : U[N], U, size_t N)
+{
+    const bool Foo38 = true;
+}
+
+void test38()
+{
+    static assert (Foo38!(int[51]));
+}
+
+/***************************************************/
+
+void test39()
+{
+}
+
+/***************************************************/
+
+void test40()
+{
+    static x = [[1.0, 2.0], [3.0, 4.0]]; // works
+    assert(x[0][0] == 1.0);
+    assert(x[0][1] == 2.0);
+    assert(x[1][0] == 3.0);
+    assert(x[1][1] == 4.0);
+
+    auto y = [[1.0, 2.0], [3.0, 4.0]]; // fails
+    assert(y[0][0] == 1.0);
+    assert(y[0][1] == 2.0);
+    assert(y[1][0] == 3.0);
+    assert(y[1][1] == 4.0);
+}
+
+/***************************************************/
+
+align(16) struct S41
+{
+    int[4] a;
+}
+
+shared int x41;
+shared S41 s41;
+
+void test41()
+{
+    printf("&x = %p\n", &x41);
+    printf("&s = %p\n", &s41);
+    assert((cast(int)&s41 & 0xF) == 0);
+}
+
+/***************************************************/
+
+int test42(string[] args = null)
+{
+   foreach(p; args){
+      version(dummy) int i;
+   }
+   return 0;
+}
+
+
+/***************************************************/
+
+void foo43(float length, byte b)
+{
+//    b /= cast(cfloat) length;
+}
+
+void test43()
+{
+}
+
+/***************************************************/
+
+void test44()
+{
+    ifloat f = 1.0fi;
+//    f *= 2.0fi; // illegal but compiles
+    writefln("%s", f);
+//    assert(f == 0i);
+}
+
+/***************************************************/
+
+int foo45(int i)
+{
+   if(i==0){
+      return 2;
+   }
+   assert(0);
+}
+
+void test45()
+{
+   version (Win32)  // this test fails in -release because asserts will be removed
+   {
+   assert(foo45(0)==2);
+   try{
+      foo45(1);
+   }catch{
+      return cast(void)0;
+   }
+   assert(0);
+   }
+}
+
+/***************************************************/
+
+
+void va_copy46(out void* dest, void* src)
+{
+    dest = src;
+}
+
+void test46()
+{
+}
+
+/***************************************************/
+
+void test47()
+{
+    enum { _P_WAIT, _P_NOWAIT, _P_OVERLAY };
+
+    alias _P_WAIT P_WAIT;
+    alias _P_NOWAIT P_NOWAIT;
+}
+
+/***************************************************/
+
+void f48(int x)
+{
+    const(char)[] blah = (x == 1 ? "hello".dup : "world");
+}
+
+void test48()
+{
+    f48(1);
+}
+
+/***************************************************/
+
+void test49()
+{
+    version(GNU)
+    {
+        assert((25.5).stringof ~ (3.0625).stringof == "2.55e+13.0625e+0");
+        assert(25.5.stringof ~ 3.0625.stringof == "2.55e+13.0625e+0");
+    }
+    else
+    {
+        assert((25.5).stringof ~ (3.01).stringof == "25.53.01");
+        assert(25.5.stringof ~ 3.01.stringof == "25.53.01");
+    }
+}
+
+/***************************************************/
+
+class Ap50
+{
+    ulong size;
+    static uint valuex;
+
+    void update(ubyte input, int i)
+    {
+        valuex =
+            (((size + i) & 1) == 0) ?
+                    0 :
+                    input;
+    }
+}
+
+void test50()
+{
+}
+
+/***************************************************/
+
+int* foo51()
+{
+    assert(is(typeof(return) == int*));
+    return null;
+}
+
+void test51()
+{
+    foo51();
+}
+
+/***************************************************/
+
+template Foo52(ulong U)
+{
+    int Foo52 = 1;
+}
+
+template Foo52(uint U)
+{
+    int Foo52 = 2;
+}
+
+template Foo52(ubyte U)
+{
+    int Foo52 = 3;
+}
+
+
+void test52()
+{
+    const uint u = 3;
+    auto s = Foo52!(u);
+    assert(s == 2);
+}
+
+/***************************************************/
+
+void test53()
+{
+    extern int x;
+}
+
+/***************************************************/
+
+void func54(string delegate() dg)
+{
+        dg();
+}
+
+void test54()
+{
+    string[] k=["adf","AsdfadSF","dfdsfassdf"];
+    foreach(d;k)
+    {
+        printf("%.*s\n", d.length, d.ptr);
+        string foo() {assert(d!="");return d;}
+        func54(&foo);
+        func54(delegate string() {assert(d!="");return d;});
+    }
+}
+
+/***************************************************/
+// bug 1767
+
+class DebugInfo
+{
+    alias int CVHeaderType ;
+    enum anon:CVHeaderType{ CV_NONE, CV_DOS, CV_NT, CV_DBG }
+}
+
+void test55()
+{
+}
+
+/***************************************************/
+
+template T56() { int i; }
+
+struct S56 {
+    alias T56!() data;
+}
+
+class C56 {
+    alias T56!() data;
+}
+
+void test56()
+{
+    S56.data.i = 3;
+    C56.data.i = 4;
+    assert(S56.data.i == 4);
+}
+
+/***************************************************/
+
+void writecrossing(bool goal)
+{
+  writeln(goal?"escape":"return");
+}
+
+void test57()
+{
+    writecrossing(true);
+    writecrossing(false);
+}
+
+/***************************************************/
+
+void f58(int n) {}
+void g58(char[] s) {}
+
+char[][] a58;
+
+class bar58
+{
+        int i;
+
+        void func() {
+                f58(i);
+
+                foreach (s; a58) {
+                        if (s == s){}
+                        if (s[0..0] == "" && s[0..0])
+                                g58(s);
+                }
+
+                f58(i);
+        }
+}
+
+void test58()
+{
+}
+
+/***************************************************/
+
+void test59()
+{
+    int[] array = new int[5];
+    uint check = 0;
+    foreach (it; array.ptr .. array.ptr + array.length) {
+        ++check;
+    }
+    assert(check == array.length);
+}
+
+/***************************************************/
+
+final class Foo60()
+{
+    void bar()
+    {
+        int baz;
+        baz = 1;
+    }
+}
+
+void test60()
+{
+    auto foo = new Foo60!();
+}
+
+/***************************************************/
+
+class ZipEntry61
+{
+    ZipEntryInfo61 info;
+    this() {}
+}
+struct ZipEntryInfo61 {}
+
+void test61()
+{
+}
+
+/***************************************************/
+
+void test62()
+{
+   int foo() { return 0; }
+   int bar() { return 0; }
+
+   auto t1 = typeid(typeof(foo));
+   auto t2 = typeid(typeof(bar));
+
+   t1.tsize();
+}
+
+/***************************************************/
+
+struct S63
+{
+    int a;
+    static int foo()
+    {
+        return a.sizeof;
+    }
+}
+
+void test63()
+{
+    int x = S63.a.sizeof;
+    assert(x == 4);
+    assert(S63.foo() == 4);
+}
+
+/***************************************************/
+
+string[] foo64()
+{
+    return [[]];
+}
+
+void test64()
+{
+    auto a = foo64();
+    assert(a.length == 1);
+    assert(a[0].length == 0);
+}
+
+/***************************************************/
+
+string[][] foo65()
+{
+    string[][] result = [];
+    string[] s = [];
+    result ~= [s];
+    return result;
+}
+
+void test65()
+{
+    auto s = foo65();
+    assert(s.length == 1);
+    assert(s[0].length == 0);
+}
+
+/***************************************************/
+
+string[][] foo66()
+{
+    string[] strings = ["a","bc"];
+    string [][] result = [];
+    foreach (s; strings)
+    {
+        result ~= [s];
+    }
+    return result;
+}
+
+void test66()
+{
+    auto s = foo66();
+    assert(s.length == 2);
+    assert(s[0].length == 1);
+    assert(s[0][0].length == 1);
+    assert(s[1].length == 1);
+    assert(s[1][0].length == 2);
+}
+
+/***************************************************/
+
+template Tuple67(A...)
+{
+    alias A Tuple67;
+}
+
+template Bar67()
+{
+    const s = "a bar";
+}
+
+void test67()
+{
+    alias Tuple67!(Bar67!()) tuple;
+    static const i = 0;
+    alias tuple[0] bara;
+    alias tuple[i] barb;
+
+    static assert(bara.s == "a bar");
+    static assert(barb.s == "a bar");
+}
+
+/***************************************************/
+
+template Tuple68(A...)
+{
+    alias A Tuple68;
+}
+
+size_t foo68()
+{
+    return 1;
+}
+
+void test68()
+{
+    alias Tuple68!("one", "two") tuple;
+    static assert(tuple[foo68()] == "two");
+}
+
+/***************************************************/
+
+class Base69 {}
+
+class Da69 : Base69 {}
+class Db69 : Base69 {}
+
+void test69()
+{   int i;
+    auto b = i ? new Da69 : new Db69;
+    assert(is(typeof(b) == Base69));
+}
+
+/***************************************************/
+
+struct Bar70
+{
+        Bar70[] bars;
+}
+
+void test70()
+{
+        Bar70 node;
+}
+
+/***************************************************/
+
+template Foo71(string s)
+{
+    string b = s;
+}
+
+void test71()
+{
+    size_t s = Foo71!(
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"helloabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+"When dealing with complex template tuples, it's very easy to overflow the
+maximum symbol length allowed by OPTLINK.  This is, simply put, a damn shame,
+because it prevents otherwise completely legal code from compiling and linking
+with DMDWin, whereas it works perfectly fine when using DMDNix or GDC.
+I know that this is neither a simple nor a small issue to fix: either the
+ancient, nearly-immutable OPTLINK would have to be modified, or DMDWin would
+have to be changed to output a more reasonable format, in which case a new
+linker would probably have to be written.  Until then, this issue should stand
+as a reminder that DMDWin is inherently limited.
+Oplink isn't the issue. The OMF file format has a hard limit. This results in
+the only solutions being: convert DMD to use some other .obj format or have DMD
+do something else for name mangling.
+In talking to Walter, the issue is that it's easy to get symbols that have more
+info in them than can be fit into the limit. (the limit has already stretched
+by gziping the symbols.)
+The simple solution I have proposed is to just MD5 (or what not) the symbols.
+The only issue (besides a vanishingly small chance of a hash collision) is that
+this looses information so you can't look at a symbol and directly determine
+what it was. My answer to that is, who cares? The only place where hashing
+provides less info than compressing is in a debugger and it can grab the full
+symbol from a table in the static data segment.
+I suppose as a stopgap measure that'd work fine, and might even be controlled
+by a compiler switch, so that in the general case debugger info wouldn't be
+affected.  And what's more -- the only time these issues come up is with
+templates, which a lot of debuggers have serious problems with anyway, so..
+I would set it up as a method of last resort. It wouldn't be used unless the
+symbol can't be used any other way.
+"
+        ).b.length;
+}
+
+/***************************************************/
+
+class B72 { this(bool b, string c){} }
+
+class C72 : B72
+{
+        this()
+        {
+                alias typeof(super(false,"hello")) foo;
+                super(false,"hello");
+        }
+}
+
+void test72()
+{
+}
+
+/***************************************************/
+
+template Foo73()
+{
+    mixin ("const int x = 3;");
+    //const int x = 3;
+
+    static if (x == 3)
+    {
+        pragma(msg, "success");
+    }
+}
+
+alias Foo73!() foo73;
+
+void test73()
+{
+}
+
+/***************************************************/
+
+alias uint foo74;
+
+void simple_func_t(T)(T s, foo74 i)
+{
+    assert(s == "hello");
+    assert(i == 3);
+}
+
+void test74()
+{
+    simple_func_t("hello", 3);
+}
+
+/***************************************************/
+
+void foo75(T)(T[] x ...)
+{
+    assert(x.length == 3);
+    assert(x[0] == 2);
+    assert(x[1] == 3);
+    assert(x[2] == 4);
+    assert(is(T == int));
+}
+
+void test75()
+{
+    foo75(2,3,4);
+}
+
+/***************************************************/
+
+void delegate(U) Curry(A, U...)(void delegate(A,U) dg,A arg)
+{
+  struct ArgRecord {
+    A arg;
+    typeof(dg) callback;
+
+    void OpCall(U args) { callback(arg,args); }
+  }
+  auto temp = new ArgRecord;
+  temp.arg = arg;
+  temp.callback = dg;
+  return &temp.OpCall;
+}
+
+void delegate(A) Seq(A...)(void delegate(A)[] dgs...)
+{
+  return Curry(delegate void(void delegate(A)[] dgs1,A args)
+               {
+                 foreach(dg; dgs1)
+                   dg(args);
+               },
+               dgs);
+}
+
+struct Foo76
+{
+  void fred(int i) {}
+}
+
+void test76()
+{
+  void delegate(int) tmp;
+  auto bob = new Foo76;
+  auto dan = new Foo76;
+
+  tmp = Seq!(int)(&bob.fred);             // this works
+  tmp = Seq!(int)(&bob.fred, &dan.fred);  // this works
+  tmp = Seq      (&bob.fred);             // this doesn't
+  tmp = Seq      (&bob.fred, &dan.fred);  // neither does this
+}
+
+/***************************************************/
+
+int x77;
+
+void foo77()
+{
+    x77 = 1;
+
+    static if(true)
+    {
+    }
+    else
+    {
+    }
+}
+
+void test77()
+{
+    foo77();
+    assert(x77 == 1);
+}
+
+/***************************************************/
+
+class Foo78
+{
+  template TBar(T)
+  {
+    T x;                   // Compiles, but is implicitly static
+    void func(T t)   // Ok, non-static member template function
+    { assert(t == 2); assert(this.bar == 42); }
+  }
+  int bar = 42;
+}
+
+void test78()
+{
+  alias Foo78 Foo;
+  Foo.TBar!(int).x = 2;
+  //Foo.TBar!(int).func(2); // error, since funcx is not static
+
+  Foo f = new Foo;
+  Foo g = new Foo;
+
+  f.TBar!(int).func(2); // works
+
+  f.TBar!(int).x = 10;
+  g.TBar!(int).x = 20;
+  assert(f.TBar!(int).x == 20); // prints 20
+}
+
+/***************************************************/
+
+class C79
+{
+}
+
+void test79()
+{
+    C79 c = new C79();
+    writeln(c.__vptr);
+    writeln(c.__vptr[0]);
+    writeln(cast(void*)c.classinfo);
+    assert(c.__vptr[0] == cast(void*)c.classinfo);
+    writeln(c.__monitor);
+    assert(c.__monitor == null);
+    synchronized (c)
+    {
+        writeln(c.__monitor);
+        assert(c.__monitor !is null);
+    }
+}
+
+/***************************************************/
+
+class Test80{
+  template test(){
+    enum int test=1;
+  }
+}
+
+void test80()
+{
+  assert(Test80.test!()==1);
+  assert((new Test80).test!()==1);
+}
+
+/***************************************************/
+
+class Test81
+{
+  static const test2=1;
+  template test(){
+    static const int test=1;
+  }
+}
+
+void test81()
+{
+  auto a=new Test81;
+  static assert(typeof(a).test2==1);//ok
+  alias typeof(a) t;
+  static assert(t.test!()==1);//ok
+  static assert(typeof(a).test!()==1);//syntax error
+}
+
+/***************************************************/
+
+deprecated
+{
+    alias real A82;
+    void foo82(A82 x) {    }
+}
+
+void test82()
+{
+}
+
+/***************************************************/
+
+class Bar83
+{
+    deprecated void foo(int param)
+    {
+    }
+
+    void foo(string param)
+    {
+    }
+}
+
+void test83()
+{
+    Bar83 b = new Bar83;
+    string str = "bar";
+    b.foo(str);
+}
+
+/***************************************************/
+
+void test84()
+{
+    int[0][10] arr;
+    printf("%u\n", &arr[9] - &arr[0]);
+    auto i = &arr[9] - &arr[0];
+    assert(i == 0);
+}
+
+/***************************************************/
+
+class myid
+{
+    string buf;
+    this(string str )
+    {
+            buf = str;
+    }
+}
+struct Lex
+{
+    static myid myidinst;
+    static void Init()
+    {
+            myidinst = new myid("abc");
+    }
+}
+
+void test85()
+{
+    Lex.Init();
+    assert(cast(myid)(Lex.myidinst) !is null);
+}
+
+/***************************************************/
+
+struct Time
+{
+  long ticks;
+}
+
+struct Stamps
+{
+    Time    created,        /// time created
+            accessed,       /// last time accessed
+            modified;       /// last time modified
+}
+
+Stamps getTimeStamps()
+{
+    foreach(i; 0..10) { }
+    Stamps                    time = void;
+
+    time.modified = Time(20);
+    time.accessed = Time(20);
+    time.created  = Time(20);
+    return time;
+}
+
+Time accessed ()
+{
+    foreach(i; 0..10) { }
+    return timeStamps(4).accessed;
+}
+
+Stamps timeStamps (int name)
+{
+  return getTimeStamps();
+}
+
+void test86()
+{
+
+  assert(accessed().ticks == 20);
+}
+
+/***************************************************/
+
+const bool foo87 = is(typeof(function void() { }));
+const bar87      = is(typeof(function void() { }));
+
+void test87()
+{
+    assert(foo87 == true);
+    assert(bar87 == true);
+}
+
+/***************************************************/
+
+int function() wrap88(void function()) { return null; }
+
+void test88()
+{
+        printf("test88\n");
+        if (0)
+            wrap88(&test88)();
+}
+
+/***************************************************/
+
+struct S89
+{
+        static const float[2] z = 3;
+}
+
+class C89
+{
+        static const float[2] z = 3;
+}
+
+void bar89(float f) { assert(f == 3); }
+
+void test89()
+{
+        printf("test89\n");
+        bar89(S89.z[0]);
+        bar89(S89.z[1]);
+        bar89(C89.z[0]);
+        bar89(C89.z[1]);
+}
+
+/***************************************************/
+
+void trigger(char[] txt)
+{
+        txt[0] = 'x';
+
+        scope(exit)
+        {
+                txt[0] = 'x';
+        }
+
+        return;
+}
+
+void test90()
+{
+}
+
+/***************************************************/
+
+void test91()
+{
+    enum ABC { a, b, c }
+    assert(ABC.stringof == "ABC");
+}
+
+/***************************************************/
+
+int x92;
+
+int f92() {
+    x92++;
+    return 0;
+}
+
+void test92()
+{
+    int[1] a;
+    a[f92()] += 42L;
+    assert(x92 == 1);
+}
+
+/***************************************************/
+
+void test93()
+{
+    void foo() { }
+    static assert(is(typeof(1 || foo()) == void));
+    static assert(is(typeof(1 && foo()) == void));
+}
+
+/***************************************************/
+
+void foo94(T)()
+{
+}
+
+struct f94(alias func=foo94!(int))
+{
+}
+
+void test94()
+{
+    f94!() myf;
+}
+
+/***************************************************/
+
+struct X95
+{
+   import core.stdc.stdio;
+}
+
+void test95()
+{
+   X95.core.stdc.stdio.printf("hello\n");
+}
+
+/***************************************************/
+
+template foo96(alias bar)
+{
+    pragma(msg, bar.stringof ~ " " ~ typeof(bar).stringof);
+    static assert((bar.stringof ~ " " ~ typeof(bar).stringof) == "myInt int" ||
+        (bar.stringof ~ " " ~ typeof(bar).stringof) == "myBool bool");
+    void foo96() {}
+}
+
+void test96()
+{
+    int myInt;
+    bool myBool;
+
+    foo96!(myInt)();
+    foo96!(myBool)();
+}
+
+/***************************************************/
+
+void test97()
+{
+    const short[] ct = cast(short[]) [cast(byte)1, 1];
+    writeln(ct);
+    assert(ct.length == 2 && ct[0] == 1 && ct[1] == 1);
+
+    short[] rt = cast(short[]) [cast(byte)1, cast(byte)1].dup;
+    writeln(rt);
+    assert(rt.length == 1 && rt[0] == 257);
+}
+
+/***************************************************/
+
+class Foo98
+{
+    string foo = "abc";
+    size_t i = 0;
+
+    void bar()
+    {
+        printf("%c\n", foo[i]);
+        i++;
+        printf("%c\n", foo[i]);
+        assert(foo[i] == 'b');
+    }
+}
+
+void test98()
+{
+    auto f = new Foo98();
+    f.bar();
+}
+
+/***************************************************/
+
+template implicitlyConverts99(S, T)
+{
+    enum bool implicitlyConverts99 = T.sizeof >= S.sizeof
+        && is(typeof({S s; T t = s;}()));
+}
+
+static assert(!implicitlyConverts99!(long, short));
+
+void test99()
+{
+}
+
+/***************************************************/
+
+void test100()
+{
+  {
+    real r = ulong.max;
+    printf("r = %Lg, ulong.max = %llu\n", r, ulong.max);
+    ulong d = cast(ulong)r;
+    printf("d = %llx, ulong.max = %llx\n", d, ulong.max);
+    assert(d == ulong.max);
+  }
+  static if(real.mant_dig == 64)
+  {
+    real r = ulong.max - 1;
+    printf("r = %Lg, ulong.max = %llu\n", r, ulong.max);
+    ulong d = cast(ulong)r;
+    printf("d = %llx, ulong.max = %llx\n", d, ulong.max);
+    assert(d == ulong.max - 1);
+  }
+  else static if(real.mant_dig == 53)
+  { //can't store ulong.max-1 in double
+  }
+  else
+     static assert(false, "Test not implemented for this platform");
+}
+
+/***************************************************/
+
+auto e101(int x) { return 5; }
+
+void test101()
+{
+    assert(is(typeof(e101(3)) == int));
+}
+
+/***************************************************/
+
+version(GNU)
+{
+int x103;
+
+void external(int a, ...)
+{
+    va_list ap;
+    va_start(ap, a);
+    auto ext = va_arg!int(ap);
+    printf("external: %d\n", ext);
+    x103 = ext;
+    va_end(ap);
+}
+
+class C103
+{
+    void method ()
+    {
+        void internal (int a, ...)
+        {
+            va_list ap;
+            va_start(ap, a);
+        auto internal = va_arg!int(ap);
+            printf("internal: %d\n", internal);
+            x103 = internal;
+            va_end(ap);
+        }
+
+        internal (0, 43);
+        assert(x103 == 43);
+    }
+}
+
+void test103()
+{
+    external(0, 42);
+    assert(x103 == 42);
+    (new C103).method ();
+}
+}
+else version(X86)
+{
+int x103;
+
+void external(...)
+{
+    printf("external: %d\n", *cast (int *) _argptr);
+    x103 = *cast (int *) _argptr;
+}
+
+class C103
+{
+    void method ()
+    {
+        void internal (...)
+        {
+            printf("internal: %d\n", *cast (int *)_argptr);
+            x103 = *cast (int *) _argptr;
+        }
+
+        internal (43);
+        assert(x103 == 43);
+    }
+}
+
+void test103()
+{
+    external(42);
+    assert(x103 == 42);
+    (new C103).method ();
+}
+}
+else version(X86_64)
+{
+    pragma(msg, "Not ported to x86-64 compatible varargs, yet.");
+    void test103() {}
+}
+else
+    static assert(false, "Unknown platform");
+
+/***************************************************/
+
+class C104
+{
+    template Bar()
+    {
+    }
+}
+
+static assert(!is(typeof(C104.Bar.foo)));
+
+void test104()
+{
+}
+
+/***************************************************/
+
+template Templ(T)
+{
+    const char [] XXX = Type.mangleof;
+    alias T Type;
+}
+
+void test105()
+{
+    Templ!(int).Type x;
+    auto s = Templ!(int).XXX;
+    writeln(s);
+    assert(s == "i");
+}
+
+/***************************************************/
+// rejects-valid 2.012.
+
+class foo107 {}
+alias foo107 bar107;
+void x107()
+{
+   bar107 a = new bar107();
+   bar107 b = new bar107();
+   bool c = (a == b);
+}
+
+void test107()
+{
+}
+
+/***************************************************/
+
+struct Foo108
+{
+    char[] byLine()()
+    {
+        return null;
+    }
+}
+
+void test108()
+{   Foo108 foo;
+
+    foreach (char c; foo.byLine)
+    {
+    }
+}
+
+/***************************************************/
+
+void test109()
+{
+    double x[] = new double[1];
+    assert(x[0] != 0);
+}
+
+/***************************************************/
+
+void test110()
+{
+    struct C {
+        int[0] b;
+    }
+    static C g_c2_ = {  };
+}
+
+/***************************************************/
+
+template Foo111(T...) {
+    alias T Foo111;
+}
+
+void test111()
+{
+    auto y = (Foo111!(int) x){ return 0; };
+}
+
+/***************************************************/
+
+bool isNull(string str) {
+        return str is null;
+}
+
+const bool foo112 = isNull("hello!");
+
+void test112()
+{
+    assert(!foo112);
+}
+
+/***************************************************/
+
+void test113()
+{
+  for (int j=1; j<2; j++) {
+    int x = (j<0) ? -j : j;
+    int q=0;
+    for (int i=0; i<x; i++) ++q;
+    assert(q!=0);
+  }
+}
+
+/***************************************************/
+
+struct VariantN
+{
+    static int opCall(int value)
+    {
+        return 0;
+    }
+
+    void foo()
+    {
+        VariantN v;
+        v.bar(42, 5);
+    }
+
+    void bar(int value, int i)
+    {
+        int args[2] = [ VariantN(value), VariantN(i) ];
+    }
+}
+
+void test114()
+{
+}
+
+/***************************************************/
+
+class B115 : A115!(B115) { }
+class A115(T) { }
+
+void test115()
+{
+}
+
+/***************************************************/
+
+struct Foo116 {
+    this(U...)(U values)  { }
+}
+
+void test116()
+{
+  new Foo116;
+}
+
+/***************************************************/
+
+void test117()
+{
+    float f = 7;
+    f = f * 2;
+    assert(f == 14);
+
+    double d = 7;
+    d = d * 2;
+    assert(d == 14);
+
+    real r = 7;
+    r = r * 2;
+    assert(r == 14);
+}
+
+/***************************************************/
+
+void test118()
+{
+    int foo(real x)
+    {
+        real y = -x*-x;
+        return cast(int)y;
+    }
+
+    auto i = foo(4.0);
+    assert(i == 16);
+}
+
+/***************************************************/
+
+class A119
+{
+    static class B119 : C119.D { }
+}
+
+abstract class C119
+{
+    static class D { }
+}
+
+void test119()
+{
+}
+
+/***************************************************/
+
+class A120 {
+    class B120 : C120.D { }
+}
+
+class C120 : E120 {
+    static class D { }
+}
+
+interface E120 { }
+
+void test120()
+{
+}
+
+/***************************************************/
+
+void test121()
+{
+    static assert(null is null);
+}
+
+/***************************************************/
+
+T[] find123(alias pred, T)(T[] input) {
+   while (input.length > 0) {
+      if (pred(input[0])) break;
+      input = input[1 .. $];
+   }
+   return input;
+}
+
+void test123()
+{
+    int[] a = [ 1, 2, 3, 4, -5, 3, -4 ];
+    find123!(function bool(int i) { return i < 0; })(a);
+}
+
+
+/***************************************************/
+
+static assert(!is(typeof((){(){}
+         ;-()
+{};})));
+
+/***************************************************/
+
+struct Foobar;
+
+/***************************************************/
+
+int test124()
+{   int result;
+    dchar[] aa;
+    alias uint foo_t;
+
+    foreach (foo_t i, dchar d; aa)
+    {
+    }
+    return result;
+}
+
+/***************************************************/
+
+int foo125(int x)
+{
+    while (1)
+    {
+        if (x)
+            return 3;
+        x++;
+    }
+}
+
+void test125()
+{
+    foo125(4);
+}
+
+/***************************************************/
+
+int foo126(int x)
+{
+    while (1)
+    {
+        if (x)
+            return 3;
+        x++;
+    }
+    assert(0);
+}
+
+void test126()
+{
+    foo126(4);
+}
+
+/***************************************************/
+
+struct S127(T, int topology = 1)
+{
+    this(T value) { }
+}
+
+void cons127(int t)(S127!(int, t) tail)
+{
+}
+
+void test127()
+{
+    S127!(int)(1);
+    S127!(int, 1) lst;
+    cons127(lst);
+}
+
+/***************************************************/
+
+struct S128(T, int topology = 1)
+{
+    this(T value) { }
+}
+
+void cons128(int t)(S128!(int, t) tail)
+{
+}
+
+void test128()
+{
+    S128!(int, 1)(1);
+    S128!(int) lst;
+    cons128(lst);
+}
+
+/***************************************************/
+
+struct R129(R : E[], E)
+{
+    E[] forward;
+    static R129 opCall(E[] range)
+    {
+        R129 result = {};
+        result.forward =  range;
+        return result;
+    }
+}
+
+R129!(E[]) retro129(E)(E[] r)
+{
+    return R129!(E[])(r);
+}
+
+int begin129(F)(R129!(F) range)
+{
+    return 0;
+}
+
+void test129()
+{
+    int[] a = [ 1, 2, 3 ];
+    auto r = retro129(a);
+    auto i = begin129(r);
+}
+
+/***************************************************/
+// 12725
+
+struct R12725(R : E[], E)
+{
+}
+
+int begin12725(F)(R12725!(F) range)
+{
+    return 0;
+}
+
+void test12725()
+{
+    R12725!(int[], int) r;
+    auto i = begin12725(r);
+}
+
+/***************************************************/
+// 12728
+
+struct Matrix12728(T, uint m, uint n = m, ubyte f = 0)
+{
+    void foo(uint r)(auto ref in Matrix12728!(T, n, r) b)
+    {
+    }
+}
+
+void test12728()
+{
+    alias Matrix4 = Matrix12728!(float, 4);
+
+    Matrix4 m;
+    m.foo(m);
+}
+
+/***************************************************/
+
+struct S130
+{
+  byte[3] x;
+}
+
+__gshared S130 e130;
+
+const(S130) example130() { return e130; }
+
+void test130()
+{
+}
+
+/***************************************************/
+
+void foo131(real z) {}
+
+void test131()
+{
+    real F = 1;
+    foo131( 1 + (F*3*2.1) );
+}
+
+/***************************************************/
+
+float getFloat() {
+    return 11468.78f;
+}
+
+void test132()
+{
+    uint i = cast(uint) 11468.78f;
+    assert(i == 11468);
+
+    uint j = cast(uint) getFloat();
+    assert(j == 11468);
+}
+
+/***************************************************/
+
+template T133(string s) {
+    const string T133 = s;
+}
+
+string f133(string s) {
+    return s;
+}
+
+void test133()
+{
+    int foo;
+    //writeln(foo.stringof);
+    assert ("foo" == f133(foo.stringof));
+    assert ("foo" == T133!(foo.stringof));
+}
+
+/***************************************************/
+
+public struct foo134
+{
+    public this(real aleft)
+    {
+    }
+}
+
+class bar134
+{
+    final void fun(foo134 arg = foo134(0.)) { }
+}
+
+/***************************************************/
+
+void test135()
+{
+    char[char[3]] ac;
+    char[3] c = "abc";
+    ac["abc"]='a';
+    assert(ac[c]=='a');
+
+    char[dchar[3]] ad;
+    dchar[3] d = "abc"d;
+    ad["abc"d]='a';
+    assert(ad[d]=='a');
+}
+
+/***************************************************/
+
+void test136()
+{
+    struct S { int i[3]; }
+    enum S s = S(8);
+    const int i  = s.i[2];
+    assert(i == 8);
+}
+
+/***************************************************/
+
+struct Particle {
+    char[16] name;
+}
+
+class ReadSystem {
+    size_t[char[16]] pKindsIdx;
+
+    void t(Particle p)
+    {   auto idx=p.name in pKindsIdx;
+    }
+}
+
+void test137()
+{
+    char[16] n;
+    size_t[char[16]] aa;
+    auto r=n in aa; // works
+}
+
+/***************************************************/
+
+long test138(int y)
+{
+    return *cast(long*)(&y);
+}
+
+/***************************************************/
+
+void test139()
+{
+   auto famousNamedConstants =
+    [ "pi" : 3.14, "e" : 2.71, "moving sofa" : 2.22 ];
+
+    assert(famousNamedConstants["e"]==2.71);
+}
+
+/***************************************************/
+
+int* get140()  {  return (new int[4]).ptr; }
+
+void test140()
+{
+  int* p = get140();
+  p[0..3] = 0;
+  p[0] = 7;
+}
+
+/***************************************************/
+
+class Foo141 {
+    Foo141 next;
+    void start()
+    in { assert (!next); } body
+    {
+        void* p = cast(void*)this;
+    }
+}
+
+/***************************************************/
+
+void a142(int b = 1+2)(){};
+
+void test142()
+{
+    a142!(1+2)();
+    a142();
+}
+
+/***************************************************/
+
+class A143
+{
+    invariant() { }
+    void fill() { }
+}
+
+
+class B143 : A143
+{
+    override void fill() { }
+}
+
+void test143()
+{
+    auto b = new B143();
+    b.fill();
+}
+
+/***************************************************/
+
+struct Pair
+{
+    static Pair opCall(uint a, uint b) { return Pair.init; }
+}
+
+struct Stack
+{
+    Pair pop() { return Pair.init; }
+}
+
+void test144()
+{
+    Stack stack;
+    Pair item = stack.pop;
+}
+
+/***************************************************/
+
+struct Ashes {
+    int ashes = cast(int)0;
+}
+void funky (Ashes s = Ashes()) { }
+
+struct S145 {
+    real a = 0, b = 0;
+}
+
+void func145(S145 s = S145()) { }
+
+void test145()
+{
+    funky();
+    func145();
+}
+
+/***************************************************/
+
+string foo146(T...)(T args)
+{
+    string ret;
+
+    foreach(arg; args) {
+        ret = arg;
+    }
+
+    assert(ret=="b"); // passes
+    return ret;
+}
+
+void test146()
+{
+    string s = foo146("b");
+    assert(s == "b"); // fails
+}
+
+/***************************************************/
+
+void test147()
+{
+    string s = "foo";
+    dchar c = 'x';
+    s ~= c;
+    assert(s == "foox");
+
+    wstring ws = "foo";
+    ws ~= c;
+    assert(ws == "foox");
+}
+
+/***************************************************/
+
+void test148()
+{
+    string a = "\U00091234";
+    string b;
+
+    b ~= "\U00091234";
+
+    if (a != b) {
+            assert(0);
+    }
+}
+
+/***************************************************/
+
+void test149()
+{
+  long[1] b = void;
+  b[0] = -1L;
+  b[0] >>>= 2;
+  assert( (b[0]) == 0x3FFFFFFFFFFFFFFFL);
+}
+
+/***************************************************/
+
+bool foo150()
+{
+    int x;
+    return cast(void*) (x & 1) == null;
+}
+
+/***************************************************/
+// 3521
+
+void crash(int x)
+{
+    if (x==200) return;
+
+    version(GNU)
+    {
+        version(X86) asm
+        {
+            "int $3;" : :  :;
+        }
+        else version(X86_64) asm
+        {
+            "int $3;" : : :;
+        }
+        else
+        {
+            import gcc.builtins;
+            __builtin_trap();
+        }
+    }
+    else
+    {
+        asm { int 3; }
+    }
+}
+
+void test151()
+{
+   int x;
+   bug3521(&x);
+}
+
+void bug3521(int *a){
+    int c = 0;
+    *a = 0;
+    if ( *a || (*a != (c = 200)) )
+       crash(c);
+}
+
+/***************************************************/
+
+string foo152(T...)() {
+    return "";
+}
+
+void test152() {
+    foo152!(int, char)();
+}
+
+/***************************************************/
+
+int get_value()
+{
+    return 1;
+}
+
+int[2] array1;
+int[2] array2;
+
+int foo153(ulong a1, ulong extra, ulong extra2, ulong extra3)
+{
+    if (!((a1 & 1) | (get_value() | array1[cast(uint)(a1^1)])))
+        return 0;
+
+    if (0 >= array2[cast(uint)(a1^1)])
+        return 0;
+
+    return 1;
+}
+
+void test153()
+{
+    foo153(0, 0, 0, 0);
+}
+
+/***************************************************/
+
+class B154 : A154
+{
+}
+
+enum SomeEnum
+{
+    EnumMember = 10
+}
+
+class A154
+{
+    SomeEnum someEnum()
+    {
+        return SomeEnum.EnumMember;
+    }
+}
+
+void test154()
+{
+    auto b = new B154();
+    assert(cast(int)b.someEnum == 10);
+}
+
+/***************************************************/
+
+struct Qwert {
+    Yuiop.Asdfg hjkl;
+}
+
+struct Yuiop {
+    struct Asdfg {
+        int zxcvb;
+    }
+}
+
+/***************************************************/
+
+void f156(Value156.Id t)
+{
+    assert(cast(int)t == 1);
+}
+
+struct Value156 {
+  public static enum Id {
+    A,
+    B
+  }
+}
+
+void test156()
+{
+  Value156.Id t = Value156.Id.B;
+  f156(t);
+}
+
+/***************************************************/
+
+X157 x157;
+enum X157 { Y };
+
+interface Foo157 {
+    Policy157 fn();
+}
+
+enum Policy157 {Default, Cached, Direct}
+
+void test157()
+{
+}
+
+/***************************************************/
+
+class X158 {
+  Y158.NY t;
+  enum NX { BLA, BLA1 }
+}
+
+class Y158 {
+  enum NY { FOO, BAR }
+  X158.NX nx;
+}
+
+/***************************************************/
+
+struct Foo159 {
+    Bar.Baz x;
+
+    struct Bar {
+        struct Baz {}
+    }
+}
+
+/***************************************************/
+
+void test160()
+{
+  long[1] b = void;
+  b[0] = -1L;
+  b[0] >>>= 2;
+  assert( (b[0]) == 0x3FFFFFFFFFFFFFFFL);
+  int i = -1;
+  assert(i >>>2 == 0x3FFFFFFF);
+}
+
+/***************************************************/
+
+class A161 {
+    struct B {
+        D161 x;
+
+        struct C {}
+    }
+}
+
+
+struct D161 {}
+
+class C161
+{
+    A a;
+
+    struct A
+    {
+        uint m;
+    }
+
+    enum
+    {
+        E = 0
+    }
+}
+
+/***************************************************/
+
+interface A162
+{
+    C162 foo();
+    C162 foo() const;
+}
+
+class B162 : A162
+{
+    C162 foo() { return null; }
+    C162 foo() const { return null; }
+}
+
+abstract class C162 : A162
+{
+    C162 foo() { return null; }
+    C162 foo() const { return null; }
+}
+
+/***************************************************/
+
+void func163( A... )( string name, string v )
+{
+}
+
+void test163()
+{
+    func163!( int, long, float )( "val", "10" );
+    func163!()( "tmp", "77" );
+    alias func163!() TMP; TMP( "tmp", "77" );
+}
+
+/***************************************************/
+
+class A164
+{
+    B164 foo() { return null; }
+    B164 foo() const { return null; }
+}
+
+abstract class B164 : A164
+{
+    override final B164 foo() { return null; }
+    override final B164 foo() const { return null; }
+}
+
+/***************************************************/
+
+class A165
+{
+    B165 foo() { return null; }
+    const(B165) foo() const { return null; }
+}
+
+abstract class B165 : A165
+{
+    override final B165 foo() { return null; }
+    override final const(B165) foo() const { return null; }
+}
+
+/***************************************************/
+
+struct A166 {
+   B166  xxx;
+   static this () { }
+}
+
+struct B166 {}
+
+/***************************************************/
+
+void x168(T)() {
+    static assert(false);
+}
+
+template y168(T) {
+    const bool y168 = is(typeof( { x168!(T)(); } ));
+}
+
+static assert(!y168!(int));
+
+/***************************************************/
+
+void test169()
+{
+    int AssociativeArray;
+    int[int] foo;
+    foreach (x; foo)    {    }
+}
+
+/***************************************************/
+
+FwdEnum this_fails;
+
+enum : int
+{
+        E170 =  2
+}
+
+enum FwdEnum : int
+{
+        E2 =  E170
+}
+
+/***************************************************/
+// 3740
+
+abstract class Address {
+    abstract int nameLen();
+}
+
+class Class171 : Address {
+    FwdStruct z;
+
+    struct FwdStruct  {  }
+
+    override int nameLen()    { return 0; }
+}
+
+void test171 ()
+{
+    Class171 xxx = new Class171;
+    assert(typeid(Class171).vtbl.length - typeid(Object).vtbl.length == 1);
+}
+
+/***************************************************/
+
+struct Foo172
+{
+    enum bool BAR = is (typeof({}()));
+    static assert (BAR == is (typeof({}())));
+}
+
+/***************************************************/
+
+const char[][ 89 ] ENUM_NAME = [ 1:"N0" ];
+
+void test173()
+{
+    switch(`Hi`.dup) {
+        case ENUM_NAME[1]:
+        default:
+                break;
+    }
+}
+
+/***************************************************/
+
+class A174 {
+    void x() {  }
+}
+
+class B174 : A174 {
+    override void x() {
+        assert(0);
+    }
+    final void do_x() {
+        super.x();
+    }
+}
+
+void test174()
+{
+    auto b = new B174();
+    b.do_x();
+}
+
+/***************************************************/
+
+void badvariadic(...) {}
+
+static assert(!is(typeof(mixin(badvariadic()))));
+
+/***************************************************/
+
+struct Foo176
+{
+    int x;
+}
+
+Foo176 getFoo(Foo176 irrelevant)
+{
+    Foo176 p = Foo176(400);
+    if ( p.x > p.x )
+        return irrelevant;
+    else
+        return p;
+}
+
+void test176()
+{
+   assert(getFoo( Foo176(0) ).x == 400);
+}
+
+/***************************************************/
+
+int test177()
+{
+    long[1] c = [0]; // must be long
+
+    int [1] d = [1];
+    int k = 0;
+    if (!d[0])
+       k = 1;
+    k = d[0] + k + k;
+
+    if (c[0]) assert(c[0]);
+
+    return k;
+}
+
+/***************************************************/
+
+struct S178 {
+    int x;
+
+    template T(int val) {
+        enum S178 T = { val };
+    }
+}
+
+const x178 = S178.T!(0);
+
+/***************************************************/
+
+double[100_000] arr = 0.0;
+
+/***************************************************/
+
+alias ireal BUG3919;
+alias typeof(BUG3919.init*BUG3919.init) ICE3919;
+alias typeof(BUG3919.init/BUG3919.init) ICE3920;
+
+/***************************************************/
+
+struct S179 {
+    char a, b, c, d;
+}
+
+void show(char[] args...) {
+    assert(args[0]=='A');
+    assert(args[1]=='L');
+    assert(args[2]=='D');
+    assert(args[3]=='O');
+}
+
+void A179( S179 ss ) {
+    show( ss.a, ss.b, ss.c, ss.d );
+}
+
+void test179()
+{
+    S179 ss3;
+    ss3.a = 'A';
+    ss3.b = 'L';
+    ss3.c = 'D';
+    ss3.d = 'O';
+    A179( ss3 );
+}
+
+/***************************************************/
+
+struct XY { union { int x, y; } }
+struct AHolder {
+    XY aa;
+    void a(XY x) { aa = x; }
+}
+struct AB {
+    AHolder aHolder;
+    XY b;
+    void a(XY x) { aHolder.a(x); }
+}
+struct Main {
+    AB ab;
+
+    void setB() { ab.b = XY(); }
+    void f() {
+        ab.a(XY.init);
+        setB();
+    }
+}
+
+/***************************************************/
+
+void fooa181(int x, int y, int[0] a, int z, int t)
+{
+    if (!(x == 2 && y == 4 && z == 6 && t == 8))
+        assert(0);
+}
+
+void foob181(int x, int y, int[0] a)
+{
+    if (!(x == 2 && y == 4))
+        assert(0);
+}
+
+void fooc181(int[0] a, int x, int y)
+{
+    if (!(x == 2 && y == 4))
+        assert(0);
+}
+
+void food181(int[0] a)
+{
+}
+
+void test181()
+{
+    int[0] arr = 0;
+    fooa181(2, 4, arr, 6, 8);
+    foob181(2, 4, arr);
+    fooc181(arr, 2, 4);
+    food181(arr);
+}
+
+/***************************************************/
+// 4042
+
+template isQObjectType(T)
+{
+    enum isQObjectType = is(T.__isQObjectType);
+}
+
+template QTypeInfo(T)
+{
+    static if (!isQObjectType!T)
+    {
+        enum size = T.sizeof;
+    }
+}
+
+struct QList(T)
+{
+    alias QTypeInfo!T TI;
+    int x;
+
+    void foo()
+    {
+        x++;
+    }
+}
+
+void exec(QList!(QAction) actions) {}
+
+interface IQGraphicsItem
+{
+}
+
+abstract
+        class QGraphicsObject : IQGraphicsItem
+{
+}
+
+class QGraphicsWidget : QGraphicsObject
+{
+}
+
+class QAction
+{
+    void associatedGraphicsWidgets(QList!(QGraphicsWidget) a)
+    {
+        QList!(QGraphicsWidget) x;
+    }
+}
+
+void test182()
+{
+}
+
+/***************************************************/
+
+enum { a183 = b183() }
+
+int b183() { return 0; }
+
+/***************************************************/
+
+struct Z184 {
+    int bar = 1;
+    union { Foo184 foo; }
+}
+
+struct Foo184 { size_t offset = 0;}
+
+/***************************************************/
+
+struct BB185
+{
+  Item185[1] aa;
+}
+
+struct CC185
+{
+  Item185 aa;
+}
+
+struct Item185
+{
+  byte data;
+}
+
+/***************************************************/
+
+const PM_QS_INPUT = QS_INPUT;
+const QS_INPUT = 2;
+
+/***************************************************/
+
+alias A187 B187;
+const int A187 = 1;
+
+/***************************************************/
+
+int foo188(int[3] s)
+{
+    return s[0] + s[1] + s[2];
+}
+
+void test188()
+{
+    int[3] t = [1,3,4];
+    auto i = foo188(t);
+    if (i != 8)
+        assert(0);
+}
+
+/***************************************************/
+
+template X189(alias fn) {
+    alias typeof(fn) X189;
+}
+
+void a189()(T1189 x) {
+    alias X189!(T1189.foo) P; //line 7
+
+    x.foo();
+}
+
+class T1189 {
+    void foo() {
+        printf("T1.foo()\n");
+    }
+}
+
+class T2189 : T1189 {
+    void bla() {
+        printf("T2.blah()\n");
+        assert(false); //line 19
+    }
+}
+
+void test189() {
+    a189!()(new T2189());
+}
+
+/***************************************************/
+
+void test190()
+{
+    string s;
+
+    if (true) scope(exit) s ~= "a";
+    if (false) { } else scope(exit) s ~= "b";
+    if (true) scope(exit) scope(exit) s ~= "c";
+    foreach(x; 1..2) scope(exit) s ~= "d";
+    if (true) L1: scope(exit) s ~= "e";
+    do scope(exit) s ~= "f"; while (false);
+    int i; while (++i == 1) scope(exit) s ~= "g";
+    try { } finally scope(exit) s ~= "h";
+    assert(s == "abcdefgh");
+}
+
+/***************************************************/
+
+struct S191 {
+  int last = 0;
+  S191 opCall(int i) {
+    printf("%d %d\n", last, i);
+    assert(i == 1 && last == 0 || i == 2 && last == 1 || i == 3 && last == 1);
+    last = i;
+    return this;
+  }
+}
+
+void test191()
+{
+  S191 t;
+  t(1)(2);
+  t(3);
+}
+
+/***************************************************/
+
+enum foo192 {
+    item,
+}
+
+//pragma(msg, foo.mangleof);
+static assert(foo192.mangleof == "E6test426foo192");
+
+/***************************************************/
+
+void test193()
+{
+    enum Shapes
+    {
+        Circle, Square
+    }
+
+    int i;
+    Shapes s;
+
+    pragma(msg, i.stringof);
+    pragma(msg, s.stringof);
+
+    static assert(i.stringof == "i");
+    static assert(s.stringof == "s");
+}
+
+/***************************************************/
+
+void test194()
+{
+    uint[][] b = [[ 1, 2, ]];
+}
+
+/***************************************************/
+
+alias int T195;
+
+class C195
+{
+    int yum = x195;
+}
+
+const T195 x195 = 0;
+
+/***************************************************/
+
+union A196 {
+    double[2] a;
+    double[2] b;
+}
+
+union B196 {
+public:
+     double[2] a;
+     double[2] b;
+}
+
+static assert(A196.sizeof == B196.sizeof);
+
+/***************************************************/
+
+template Compileable(int z) { bool OK;}
+
+struct Bug3569 {
+    int bar() { return 7; }
+}
+
+struct Bug3569b {
+    Bug3569 foo;
+    void crash() {
+        static assert(!is(typeof(Compileable!(foo.bar()))));
+        static assert(!is(typeof(Compileable!((foo = Bug3569.init).bar()))));
+    }
+}
+
+void test197()
+{
+}
+
+/***************************************************/
+
+void test198()  // Bugzilla 4506
+{
+    int c = 1;
+    for (int k = 0; k < 2; k++) {
+        assert((k == 0 && c == 1) || (k == 1 && c == -1));
+        c *= -1;
+    }
+}
+
+/***************************************************/
+
+// Bugzilla 4514
+void g199(void delegate(void*, void*) d) { }
+
+struct X199 {
+    void f(void*, void*) {}
+    void n()
+    {
+        g199(&f);
+    }
+}
+
+/***************************************************/
+// Bugzilla 4443
+
+struct Struct4443
+{
+    int x;
+    char[5] unused;
+}
+
+void foo4443(Struct4443 *dest, Struct4443[] arr)
+{
+    int junk = arr[$-1].x;
+    if (dest || arr[$-1].x) {
+        *dest = arr[$-1];
+    }
+}
+
+void test200()
+{
+    Struct4443[1] a;
+    Struct4443 info;
+    foo4443(&info, a);
+}
+
+/***************************************************/
+
+// Bugzilla 2931
+
+struct Bug2931 {
+        int val[3][4];
+}
+
+struct Outer2931 {
+        Bug2931 p = Bug2931(67);  // Applies to struct static initializers too
+        int zoom = 2;
+        int move = 3;
+        int scale = 4;
+}
+
+int bug2931()
+{
+  Outer2931 v;
+  assert(v.move==3);
+  assert(v.scale == 4);
+  return v.zoom;
+}
+
+int bug2931_2()
+{
+  Outer2931 v;
+  Bug2931 w = Bug2931(68);
+  assert(v.move==3);
+  for (int i = 0; i < 4; i++)
+  {
+    for (int j = 0; j < 3; j++)
+    {
+        assert(w.val[j][i] == 68);
+        assert(v.p.val[j][i] == 67);
+    }
+  }
+  assert(v.scale == 4);
+  return v.zoom;
+}
+
+static assert(bug2931()==2);
+
+void test201() {
+    assert(bug2931()==2);
+    assert(bug2931_2()==2);
+}
+
+
+/***************************************************/
+// This was the original varargs example in std.vararg
+
+import core.vararg;
+
+void foo202(int x, ...) {
+    printf("%d arguments\n", _arguments.length);
+    for (int i = 0; i < _arguments.length; i++) {
+        int j = va_arg!(int)(_argptr);
+        printf("\t%d\n", j);
+        assert(j == i + 2);
+    }
+}
+
+void fooRef202(ref int x, ...) {
+    printf("%d arguments\n", _arguments.length);
+    for (int i = 0; i < _arguments.length; i++) {
+        int j = va_arg!(int)(_argptr);
+        printf("\t%d\n", j);
+        assert(j == i + 2);
+    }
+}
+
+void test202()
+{
+    foo202(1, 2, 3, 4, 5);
+
+    printf("---\n");
+
+    int x = 1;
+    fooRef202(x, 2, 3, 4, 5);
+}
+
+/***************************************************/
+// Bugzilla 1418
+
+class A203
+{
+    char name = 'A';
+    class B203
+    {
+        char name = 'B';
+    }
+}
+
+void test203()
+{
+    class C203
+    {
+    char name = 'C';
+    }
+
+    auto a = new A203;
+    auto b = a.new B203;
+    auto c = new C203;
+
+    writeln(a.tupleof); // prints: A
+    writeln(b.tupleof); // prints: B main.A
+    writeln(c.tupleof); // prints: C 0000
+    assert(a.tupleof.length == 1 && a.tupleof[0] == 'A');
+    assert(b.tupleof.length == 1 && b.tupleof[0] == 'B');
+    assert(c.tupleof.length == 1 && c.tupleof[0] == 'C');
+}
+
+/***************************************************/
+// Bugzilla 4516
+
+struct A204 { B204 b; }
+enum B204 { Z }
+
+/***************************************************/
+// Bugzilla 4503
+
+class Collection205(T) { }
+ICollection c;
+
+alias Collection205!int ICollection;
+
+/***************************************************/
+
+enum TaskStatus:int { Building=-1, }
+
+TaskStatus test206(char[] s){
+    char[] t="TaskStatus".dup;
+    if (s.length>t.length && s[0..t.length]==t){
+        long res=0;
+        if (s[t.length]=='-') res= -res;        // <= OPnegass
+        return cast(TaskStatus)cast(int)res;
+    }
+    assert(0);
+}
+
+/***************************************************/
+
+struct UN {   double dd;    long ll; }
+bool cmp( UN * pU ) {   return pU.dd >= pU.ll ? true : false; }
+
+struct UN2 {  real dd; long ll; }
+bool cmp2( UN2 * pU ) {  return pU.dd >= pU.ll ? true : false; }
+
+struct UN3 {  double dd; int ll; }
+bool cmp3( UN3 * pU ) {  return pU.dd >= pU.ll ? true : false; }
+
+void test207()
+{
+   static UN u = { 10.50, 10 };
+   auto i = cmp(&u);
+   printf( "%d\n", cmp( &u ) );
+   assert(i);
+
+   static UN2 u2 = { 10.50, 10 };
+   i = cmp2(&u2);
+   assert(i);
+
+   static UN3 u3 = { 10.50, 10 };
+   i = cmp3(&u3);
+   assert(i);
+
+   static UN3 u3_1 = { 9.50, 10 };
+   i = cmp3(&u3_1);
+   assert(!i);
+}
+
+/***************************************************/
+
+template fail4302() {
+    static assert(0);
+}
+template bug4302() {
+   alias fail4302!() bad;
+}
+static if (is(bug4302!())) {}
+
+/***************************************************/
+
+template tough4302()
+{
+  template bar()
+  {
+     template far()
+     {
+         static assert(0);
+     }
+     alias far!() par;
+  }
+  static if (is(bar!())) {}
+}
+
+alias tough4302!() tougher;
+
+/***************************************************/
+
+template Bug6602A(T) {
+  Bug6602B!(T).Result result;
+}
+
+template Bug6602B(U) {
+  static assert(is(U == int));
+  alias bool Result;
+}
+
+enum bug6602Compiles = __traits(compiles, Bug6602A!short);
+
+/***************************************************/
+// Bugzilla 3493
+
+const bar209 = foo209;
+const int * foo209 = null;
+
+/***************************************************/
+// 3418
+
+void test210()
+{
+    ulong a = 1;
+    a = cast(ulong)(a * 2.0L);
+}
+
+/***************************************************/
+
+static assert(!is(typeof(Object.tupleof[2000]=0)));
+
+/***************************************************/
+
+struct Ghost {}
+
+void bug4430(T)(int x)   {}
+void bug4430(T)(Ghost x) {}
+
+void test212()
+{
+    bug4430!(char)( 777 );
+}
+
+/***************************************************/
+// 4768
+
+struct A213 { B213 b; }
+enum B213 { Z213 = 2 }
+
+void test213()
+{
+   A213 x;
+   assert(x.b == 2);
+}
+
+/***************************************************/
+
+void g214(int j) { }
+
+void test214()
+{
+    struct S
+    {
+        int i;
+        void f() { g214(i); }
+    }
+    auto s = S();
+}
+
+/***************************************************/
+
+template Q(s...) { alias s q; }
+
+void test215()
+{
+    class C {}
+    enum assocarrayliteral = Q!( [1:2] ).q.stringof;
+    enum complex80 = Q!( 1+1.0i ).q.stringof;
+    //enum dottype = Q!( C.Object.toString ).q.stringof;
+    enum halt = (assert(0), 0).stringof;    // ICE w/ -release
+    //enum remove = Q!( [1:2].remove(1) ).q.stringof;
+    enum templat = Q!( Q ).q.stringof;
+}
+
+/***************************************************/
+// 4941
+
+template T216(_...) { alias _ T216; }
+size_t mid216(size_t n) { return n/2; }
+
+alias T216!(int, int)[0 .. mid216($)] A216;
+alias T216!(1, 2, 3)[0 .. mid216($)] B216;
+
+void test216()
+{
+    T216!(int, int, int) values;
+    auto slice = values[0 .. mid216($)];   // C
+}
+
+/***************************************************/
+
+int bug4529a() { return 0; }
+int function() bug4529b;
+auto ivorBomb1 = typeid(typeof(bug4529a));
+auto ivorBomb2 = typeid(typeof(bug4529b));
+
+/***************************************************/
+
+void bug5218c(char [3] s) {}
+void bug5218w(wchar [3] s) {}
+void bug5218d(dchar [3] s) {}
+
+void test217()
+{
+    bug5218c("abc");
+    bug5218w("abc"w);
+    bug5218d("abc"d);
+}
+
+/***************************************************/
+// 2954
+
+void test218()
+{
+    char[char[3]] ac;
+    char[3] c = "abc";
+    ac["abc"]='a';
+    assert(ac[c]=='a');
+
+    char[dchar[3]] ad;
+    dchar[3] d = "abc"d;
+    ad["abc"d]='a';
+    assert(ad[d]=='a');
+}
+
+/***************************************************/
+// 2206
+
+template T219(U) {
+  class C {}
+}
+
+void test219()
+{
+  mixin T219!(int); // using a named mixin here fixes it
+
+  pragma(msg, T219!(int).C.mangleof);
+  pragma(msg, C.mangleof); // incorrectly outputs the same as above
+
+  assert(T219!(int).C.classinfo !is C.classinfo); // fails
+  assert(T219!(int).C.mangleof != C.mangleof); // fails
+}
+
+
+/***************************************************/
+// 2206
+
+class D220 {}
+
+template T220(U) {
+  class C { this() { } }
+}
+
+void test220()
+{
+  mixin T220!(int);
+
+  // all print 8
+  writeln(T220!(int).C.classinfo.initializer.length);
+  writeln(C.classinfo.initializer.length);
+  writeln(D220.classinfo.initializer.length);
+
+  auto c = new C; // segfault in _d_newclass
+}
+
+/***************************************************/
+
+const struct S5110
+{
+    static int value;
+}
+
+static assert(is(typeof(S5110.value) == int));
+
+/***************************************************/
+
+class C5110
+{
+ override:
+    string toString() { return ""; }
+
+    class Nested
+    {
+        void gun() {}
+    }
+}
+
+/***************************************************/
+
+immutable class Bug5504
+{
+    void foo(T)(T a) {}
+    template xx(X) {
+        void hoo(T)(T a) {}
+    }
+}
+
+shared class Bug5504b
+{
+    void foo(T)(T a) {}
+    template xx(X) {
+        void hoo(T)(T a) {}
+    }
+}
+
+void test5504()
+{
+    immutable Bug5504 c;
+    c.foo(10);
+    c.xx!(int).hoo(10);
+    shared Bug5504b d;
+    d.foo(10);
+    d.xx!(int).hoo(10);
+}
+
+/***************************************************/
+
+void bug5105() // compilation test -- don't need to run
+{
+    auto c = new shared(C5105);
+    c.foo(10);
+}
+
+synchronized shared class C5105
+{
+    void foo(T)(T a) {}
+}
+
+/***************************************************/
+// 5145
+
+interface I221{
+    void bla();
+}
+
+interface J221
+{
+    I221 sync ();
+}
+
+class A221 : B221
+{
+    final override I221 sync()
+    in { assert( valid ); }
+    body
+    {
+        return null;
+    }
+}
+
+class B221 : J221
+{
+    override I221 sync()
+    in { assert( valid ); }
+    body
+    {
+        return null;
+    }
+
+    final bool valid()
+    {
+        return true;
+    }
+}
+
+/***************************************************/
+
+template Bug3276(bool B) {
+   static if (B)
+      alias Bug3276!(false) Bug3276;
+   else
+       alias double Bug3276;
+}
+
+template Bug3276_b(alias W) {
+    alias W!(true) Bug3276_b;
+}
+
+alias Bug3276_b!(Bug3276) Bug3276_c;
+
+/***************************************************/
+// 5294
+
+void foo222(int) {}
+
+void test222()
+{
+    int count;
+    for (int i = 0; i < 2; i++) {
+        count++;
+        foo222(i * 5 - 6); // comment this out and it makes 2 loops
+    }
+    printf("%d\n", count); // compile with -O and it prints 1
+    assert(count == 2);
+}
+
+/***************************************************/
+
+void foo223(long x,long a,long b,long c,long d,long e,long f)
+{
+    assert(x == 0x123456789ABCDEF0);
+}
+
+void test223()
+{
+    foo223(0x123456789ABCDEF0,2,3,4,5,6,7);
+}
+
+/***************************************************/
+// 4379
+
+template BigTuple(U...) {
+    alias U BigTuple;
+}
+
+alias
+BigTuple!(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1) Tuple4379;
+
+void test224()
+{
+    foreach(x; Tuple4379) {    }
+}
+
+/***************************************************/
+// 3681
+
+public final class A3681 {
+    private this() {
+        int i =0;
+        int j = i + 1;
+ i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59;
+ i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59;
+ i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59;
+ i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59;
+ i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59;
+ i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59;
+ i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59;
+ i = j * 15; j = i * 59; i = j * 15; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15;
+ j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; j = i * 59; i = j * 15; j = i * 59;
+ i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59;
+ i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59; i = j * 15; j = i * 59;
+    }
+}
+
+/***************************************************/
+
+int bug4389()
+{
+    string s;
+    dchar c = '\u2348';
+    s ~= c;
+    assert(s.length==3);
+    dchar d = 'D';
+    s ~= d;
+    assert(s.length==4);
+    s = "";
+    s ~= c;
+    assert(s.length==3);
+    s ~= d;
+    assert(s.length==4);
+    string z;
+    wchar w = '\u0300';
+    z ~= w;
+    assert(z.length==2);
+    z = "";
+    z ~= w;
+    assert(z.length==2);
+    return 1;
+}
+
+static assert(bug4389());
+
+// ICE(constfold.c)
+int ice4389()
+{
+    string s;
+    dchar c = '\u2348';
+    s ~= c;
+    s = s ~ "xxx";
+   return 1;
+}
+
+static assert(ice4389());
+
+// ICE(expression.c)
+string ice4390()
+{
+    string s;
+    dchar c = '`';
+    s ~= c;
+    s ~= c;
+   return s;
+}
+
+static assert(mixin(ice4390()) == ``);
+static assert(mixin(ice4390()) == ``);
+
+/***************************************************/
+// 190
+
+alias int avocado;
+void eat(avocado x225 = .x225);
+avocado x225;
+
+void test225()
+{
+}
+
+/***************************************************/
+// 5534
+
+void doStuff(byte start, byte end, uint increment = 1U) {
+   auto output = new byte[3];
+
+    size_t count = 0;
+    for(byte i = start; i < end; i += increment) {
+        output[count++] = i;
+    }
+}
+
+void test226()  {
+    doStuff(0, 3);
+}
+
+/***************************************************/
+// 5536
+
+void test227()
+{
+  int[] as = [111, 666];
+  as ~= as[$ - 2];
+  assert(as.length == 3);
+  assert(as[2] == 111);
+}
+
+/***************************************************/
+// 4017
+
+struct _A
+{
+   uint data;
+}
+
+const A_SIZE =   (A4017.sizeof);
+
+alias _A A4017;
+
+/***************************************************/
+// 5455
+
+void thrw(Data *s) {
+    throw new Exception("xxx");
+}
+
+struct Data {
+    Rapper *w;
+    uint n, m;
+}
+
+struct Rapper {
+    ubyte * dat;
+    ubyte[] con() {
+        return dat[0..1];
+    }
+}
+
+uint jaz(ubyte[] data) {
+    return cast(uint)data.length;
+}
+
+struct Resp {
+    void set(Data *data, string[] soup) {
+        switch(soup[0]) {
+            default:
+        }
+        uint[] f = [jaz(data.w ? data.w.con[data.n ..data.m] : null), data.m - data.n];
+        thrw(data);
+    }
+}
+
+/**************************************/
+// 5571
+
+void test228() {
+    auto b = new bool;
+    printf("%p\n", b);
+    *b = false;
+}
+
+/***************************************************/
+// 5572
+
+void doSynchronized() {
+    printf("In doSynchronized() 1:  %p\n", cast(void*) global229);
+    synchronized {
+        printf("In doSynchronized() 2:  %p\n", cast(void*) global229);
+    }
+}
+
+__gshared Object global229;
+
+void test229() {
+    auto local = new Object;
+    global229 = local;
+
+    printf("In main() 1:  %p\t%p\n",
+        cast(void*) global229, cast(void*) local);
+    doSynchronized();
+    printf("In main() 1:  %p\t%p\n",
+        cast(void*) global229, cast(void*) local);
+
+    assert(cast(void*) global229 == cast(void*) local);
+}
+
+/***************************************************/
+
+static immutable real negtab[14] =
+    [ 1e-4096L,1e-2048L,1e-1024L,1e-512L,1e-256L,1e-128L,1e-64L,1e-32L,
+            1e-16L,1e-8L,1e-4L,1e-2L,1e-1L,1.0L ];
+static immutable real postab[13] =
+    [ 1e+4096L,1e+2048L,1e+1024L,1e+512L,1e+256L,1e+128L,1e+64L,1e+32L,
+            1e+16L,1e+8L,1e+4L,1e+2L,1e+1L ];
+
+float parse(ref string p)
+{
+    printf("test1\n");
+
+    real ldval = 0.0;
+    int exp = 0;
+    long msdec = 0;
+
+    msdec = 123;
+    exp = 2;
+
+    ldval = msdec;
+    printf("ldval = %Lg\n", ldval);
+    if (ldval)
+    {
+        uint u = 0;
+        int pow = 4096;
+
+        while (exp > 0)
+        {
+            while (exp >= pow)
+            {
+                ldval *= postab[u];
+                exp -= pow;
+            }
+            pow >>= 1;
+            u++;
+        }
+        while (exp < 0)
+        {
+            while (exp <= -pow)
+            {
+                ldval *= negtab[u];
+                exp += pow;
+            }
+            pow >>= 1;
+            u++;
+        }
+    }
+    return ldval;
+}
+
+void test230()
+{
+    float f;
+    string s = "123e+2";
+    f = parse( s );
+    //printf("f = %g\n", f);
+    assert( f == 123e+2f );
+}
+
+/***************************************************/
+
+class Bug4033 {}
+
+class Template4033(T) {
+    static assert(is(T : Bug4033));
+}
+
+alias Template4033!(Z4033) Bla;
+
+class Z4033 : Bug4033 { }
+
+/***************************************************/
+
+struct Bug4322 {
+    int[1] a = void;
+}
+
+void bug4322() {
+    Bug4322 f = Bug4322();
+    Bug4322 g = Bug4322.init;
+}
+
+/***************************************************/
+
+bool bug5672(long v)
+{
+    return  (v & 1) == 1;
+    return  (v & 1) == 1;
+}
+
+/***************************************************/
+
+void bug5717()
+{
+    string s, s2;
+    s = "Привет";
+    for (int i=0; i<s.length; i++)
+        s2 ~= s[i];
+    assert(s == s2);
+}
+
+/***************************************************/
+// 3086
+
+class X231 {
+    void a() {}
+    void b(int z, short c) {}
+    void c(int z, short d) {}
+}
+
+void test231() {
+    auto z = new X231();
+    TypeInfo a = typeid(typeof(&z.a));
+    TypeInfo b = typeid(typeof(&z.b));
+    TypeInfo c = typeid(typeof(&z.c));
+
+    assert(a !is b, "1");
+    assert(a != b, "2");
+    assert(b == c, "3");
+}
+
+/***************************************************/
+// 4140
+
+const A232 = [1,2,3];
+const B232 = A232[1..A232.length];
+const C232 = A232[1..$];
+
+void test232()
+{
+    assert(A232[0] == 1);
+    assert(A232[1] == 2);
+    assert(A232[2] == 3);
+    assert(B232[0] == 2);
+    assert(B232[1] == 3);
+    assert(C232[0] == 2);
+    assert(C232[1] == 3);
+}
+
+/***************************************************/
+// 1389
+
+void test233()
+{
+    int a;
+    mixin("a") = 666;
+}
+
+/***************************************************/
+// 5735
+
+struct A234 {}
+
+void foo234(bool cond){}
+
+void test234()
+{
+    A234 a;
+    int i;
+
+    static assert(!__traits(compiles, assert(a)));      // type A does not have a boolean value
+    static assert(!__traits(compiles, assert(i || a))); // type A does not have a boolean value
+    static assert(!__traits(compiles, assert(0 || a))); // OK
+
+//    if(a) {}        // type A does not have a boolean value
+//    if(i || a) {}   // type A does not have a boolean value
+//    if(0 || a) {}   // type A does not have a boolean value
+
+    static assert(!__traits(compiles, foo234(a)));         // cannot implicitly convert type A to bool
+    static assert(!__traits(compiles, foo234(i || a)));    // OK
+    static assert(!__traits(compiles, foo234(0 || a)));    // OK
+}
+
+
+/***************************************************/
+
+int space() { return 4001; }
+
+void oddity4001()
+{
+    const int bowie = space();
+    static assert(space() == 4001); // OK
+    static assert(bowie == 4001);   // doesn't compile
+}
+
+/***************************************************/
+
+int bug3809()
+{
+    version(GNU)
+    {
+        version(X86)
+            asm { "nop"; }
+        else version(X86_64)
+            asm { "nop"; }
+        else version(ARM)
+            asm { "nop"; }
+        else
+            static assert(false, "ASM code not implemented for this architecture");
+    }
+    else
+    {
+        asm { nop; }
+    }
+    return 0;
+}
+struct BUG3809 { int xx; }
+void bug3809b() {
+}
+
+/***************************************************/
+//
+
+void bug6184()
+{
+    bool cmp(ref int[3] a, ref int[3] b)
+    {
+        return a is b;
+    }
+
+    static struct Ary
+    {
+        int[3] ary;
+    }
+
+    auto a = new Ary;
+    auto b = new Ary;
+    assert(!cmp(a.ary, b.ary));
+    b = a;
+    assert(cmp(a.ary, b.ary));
+
+    // change high bit of ary address
+    *(cast(size_t*)&b) ^= (1UL << (size_t.sizeof * 4));
+    assert(!cmp(a.ary, b.ary));
+}
+
+/***************************************************/
+// 6229
+
+int test6229()
+{
+  {
+    ubyte a = 2;
+    ubyte b = 4;
+    b += a;
+  }
+
+    char a = 2;
+    char b = 4;
+    b += a;
+
+    wchar c = 2;
+    wchar d = 4;
+    c /= d;
+
+    return b;
+}
+
+/***************************************************/
+// XMMBug
+
+class XMMPainter
+{
+  float call()
+  {
+    return sumFloats(0.0f, 0.0f);
+  }
+
+  static float sumFloats(float a, float b)
+  {
+    return a + b;
+  }
+}
+
+void test6270()
+{
+  auto painter = new XMMPainter;
+  assert(XMMPainter.sumFloats(20, painter.call()) == 20.0f);
+  auto dg = () { return XMMPainter.sumFloats(0.0f, 0.0f); };
+  assert(XMMPainter.sumFloats(20, dg()) == 20.0f);
+}
+
+/***************************************************/
+
+void testrolror(int shift)
+{
+    uint a = 7;
+    uint r;
+    r = (a >> shift) | (a << (int.sizeof * 8 - shift));
+    assert(r == 0x8000_0003);
+    r = (r << shift) | (r >> (int.sizeof * 8 - shift));
+    assert(r == 7);
+}
+
+void test236()
+{
+    testrolror(1);
+}
+
+
+/***************************************************/
+// 4460
+
+void test237()
+{
+    foreach (s, i; [ "a":1, "b":2 ])
+    {
+        writeln(s, i);
+    }
+}
+
+
+/***************************************************/
+
+void foo238(long a, long b)
+{
+  while (1)             // prevent inlining
+  {
+    long x = a / b;
+    long y = a % b;
+    assert(x == 3);
+    assert(y == 1);
+    break;
+  }
+}
+
+void test238()
+{
+    long a, b;
+    a = 10;
+    b = 3;
+    long x = a / b;
+    long y = a % b;     // evaluate at compile time
+    assert(x == 3);
+    assert(y == 1);
+
+    foo238(a, b);
+}
+
+/***************************************************/
+// 5239
+
+struct S239 { int x; }
+
+int test239()
+{
+   S239[4] w = void;
+   w[$-2].x = 217;
+   return w[2].x;
+}
+
+
+/***************************************************/
+
+void enforce6506b(bool condition, void delegate() m) {
+    assert(!condition);
+}
+void toImpl6506b(int value) {
+    void f(){}
+    enforce6506b(value >= 0, &f);
+}
+void test6506() {
+    toImpl6506b(-112345);
+}
+
+/***************************************************/
+// 6505
+
+double foo240() {
+    return 1.0;
+}
+
+void test240() {
+    double a = foo240();
+    double b = foo240();
+    double x = a*a + a*a + a*a + a*a + a*a + a*a + a*a +
+               a*b + a*b;
+    assert(x > 0);
+}
+
+/***************************************************/
+// 6563
+
+int foo6563(float a, float b, float c, float d, float e, float f, float g, float h)
+{
+    assert(a == 1);
+    return 0; // return something to prevent folding
+}
+
+void test6563()
+{
+    auto res = foo6563(1, 1, 1, 1, 1, 1, 1, 1);
+}
+
+/***************************************************/
+
+ubyte foo241(ubyte[] data)
+{
+    ubyte a, b, c, d;
+
+    a = data[0];
+    b = data[1];
+    c = data[2];
+    d = data[3];
+
+    c <<= 1;
+    if (c & 0x80)
+        c >>= 1;
+    d <<= 1;
+    if (d & 0x80)
+        d >>= 1;
+
+    return d;
+}
+
+void test241()
+{
+    ubyte[4] data;
+    data[3] = 0x40;
+    assert(foo241(data[]) == 0x40);
+    data[3] = 0x20;
+    assert(foo241(data[]) == 0x40);
+}
+
+/***************************************************/
+
+struct Foo6665
+{
+    double[2][2] dat;
+
+    double foo(size_t i, size_t j)
+    {
+        return dat[i][j] = 0;
+    }
+}
+
+void test6665()
+{
+    Foo6665 a;
+}
+
+/***************************************************/
+
+double entropy(double[] probs) {
+    double result = 0;
+    foreach (p; probs) {
+        if (!p) continue;
+        result -= p;
+    }
+    return result;
+}
+
+/***************************************************/
+
+long b5364(long bmax){
+    if(true){
+    }
+    if(bmax >= 0) bmax = -1;
+    return bmax;
+}
+
+void test5364()
+{
+    assert(b5364(0) == -1L);
+}
+
+
+/***************************************************/
+
+struct FPoint {
+  float x, y;
+}
+
+void constructBezier(FPoint p0, FPoint p1, FPoint p2, ref FPoint[3] quad) {
+  quad[0] = p0;
+  quad[1] = FPoint(p1.x, p1.y);
+  quad[$-1] = p2;
+}
+
+void test6189() {
+  auto p0 = FPoint(0, 0);
+  auto p1 = FPoint(1, 1);
+  auto p2 = FPoint(2, 2);
+
+  // avoid inline of call
+  FPoint[3] quad;
+  auto f = &constructBezier;
+  f(p0, p1, p2, quad);
+
+  assert(quad == [p0, p1, p2]);
+}
+
+/***************************************************/
+// 6997
+
+long fun6997(long a,long b,long c)
+{
+    return a < b ? a < c ? a : b < c ? b : c : b;
+}
+
+long baz6997(long a, long b)
+{
+    bool s = (a<0) != (b<0);
+    a = a > 0 ? a : -a;
+    return s ? a : a;
+}
+
+struct S6997
+{
+    ulong bar, qux;
+    bool c;
+
+    S6997 foo()
+    {
+        if(!c)
+        {
+            long a = baz6997(bar, 0),
+                b = baz6997(bar, 0),
+                c = baz6997(bar, 0);
+            return S6997(fun6997(a,b,c), fun6997(a,b,c));
+        }
+        return S6997();
+    }
+}
+
+void test6997()
+{
+    auto x = S6997().foo();
+}
+
+/***************************************************/
+
+ubyte foo7026(uint n) {
+  ubyte[5] buf = void;
+  ubyte wsize;
+
+  while (true) {
+    if ((n & ~0x7F) == 0) {
+      buf[wsize++] = cast(ubyte)n;
+      break;
+    } else {
+      buf[wsize++] = cast(ubyte)((n & 0x7F) | 0x80);
+      n >>= 7;
+    }
+  }
+
+  printf("%hhu\n", wsize);
+  return buf[0];
+}
+
+void test7026() {
+    if (foo7026(3) != 3)
+        assert(0);
+}
+
+
+/***************************************************/
+
+void test6354()
+{
+    foreach(j; 0 .. 2)
+    {
+        scope(failure) int i = 0;
+
+        ushort left = 0xffU;
+        left <<= (ushort.sizeof - 1) * 8;
+
+        assert((((left & 0xff00U) >> 8) | ((left & 0x00ffU) << 8)) == 0xffu);
+    }
+}
+
+/***************************************************/
+
+struct S7072
+{
+    this(A)(A args) { }
+}
+
+void test7072() {
+   auto s = S7072( null );
+}
+
+/***************************************************/
+
+struct Point6881
+{
+    float _x, _y;
+
+    void rotateCCW()
+    {
+        float tmp = -_x;
+        _x = _y;
+        _y = tmp;
+    }
+}
+
+/***************************************************/
+// 7212
+void foo7212(scope int delegate(int a) dg)
+{
+}
+
+void foo7212(bool a)
+{
+}
+
+void test7212()
+{
+    foo7212((int a) => a);
+}
+
+/***************************************************/
+
+void test242()
+{
+    foreach(v; long.max / 8 .. long.max / 8 + 1)
+    {
+        immutable long t1 = v;
+        long t2 = t1 + t1;
+        t2 *= 1L << 1;
+        assert(t2 > long.max / 4);
+    }
+}
+
+/***************************************************/
+// 7290
+
+void foo7290a(alias dg)()
+{
+    assert(dg(5) == 7);
+}
+
+void foo7290b(scope int delegate(int a) dg)
+{
+    assert(dg(5) == 7);
+}
+
+void foo7290c(int delegate(int a) dg)
+{
+    assert(dg(5) == 7);
+}
+
+void test7290()
+{
+    int add = 2;
+    scope dg = (int a) => a + add;
+
+    assert(GC.addrOf(dg.ptr) == null);
+
+    foo7290a!dg();
+    foo7290b(dg);
+    foo7290c(dg);
+}
+
+/***************************************************/
+
+void test7367()
+{
+    char a = '\x00';
+    char b = '\xFF';
+    assert(a < b);
+}
+
+/***************************************************/
+// 7375
+
+class A7375 {}
+class B7375(int i) : A7375 {}
+class C7375(int i) : B7375!i {}
+
+template DerivedAlias(int i)
+{
+    alias B7375!i DerivedAlias;
+}
+
+alias DerivedAlias!22 X7375;
+
+void test7375()
+{
+    A7375 foo = new C7375!11();
+    assert(cast(B7375!22)foo is null);
+}
+
+/***************************************************/
+
+void test6504()
+{
+    for (int i=0; i<3; ++i)
+    {
+/+
+        char[] x2 = "xxx" ~ ['c'];
+        if (i == 0)
+            assert(x2[1] == 'x');
+        x2[1] = 'q';
++/
+    }
+}
+
+/***************************************************/
+
+struct S7424a
+{
+    @property inout(int) g()() inout { return 7424; }
+    void test1()
+    {
+        int f = g;
+        assert(f == 7424);
+        assert(g == 7424);
+    }
+    void test2() const
+    {
+        int f = g;
+        assert(f == 7424);
+        assert(g == 7424);
+    }
+    void test3() immutable
+    {
+        int f = g;
+        assert(f == 7424);
+        assert(g == 7424);
+    }
+}
+struct S7425
+{
+    inout(T) g(T)(T x) inout
+    {
+        return x;
+    }
+    void test1()
+    {
+        int f = g(2);
+        assert(f == 2);
+    }
+    void test2() const
+    {
+        double y = g(4.5);
+        assert(y == 4.5);
+    }
+}
+void test7424()
+{
+    S7424a s1;
+    s1.test1();
+    s1.test2();
+
+    immutable(S7424a) s2;
+    s2.test2();
+    s2.test3();
+
+    const(S7424a) s3;
+    s3.test2();
+
+    S7425 s4;
+    s4.test1();
+    s4.test2();
+}
+
+/***************************************************/
+
+struct Logger {
+    static bool info()() {
+        return false;
+    }
+}
+
+void test7422() {
+    if (Logger.info()) {
+    }
+}
+
+/***************************************************/
+
+struct S7502
+{
+    int[0x1000] arr;
+}
+
+S7502 s7502;
+
+void test7502()
+{
+    s7502 = s7502.init;
+}
+
+/***************************************************/
+
+void nextis(void delegate() dg = {}) {}
+
+void test4820() {
+    nextis();
+}
+
+/***************************************************/
+
+void test4820_2() {
+
+void nextis(void delegate() dg = {}) {}
+    nextis();
+}
+
+/***************************************************/
+
+template T3509(bool b) { static assert (b); }
+
+template Mix3509() { void f() {} }
+
+class C3509 {
+    alias T3509!(is(typeof(M.f))) U;
+    mixin Mix3509!() M;
+}
+
+/***************************************************/
+
+struct S3510(int x) {}
+
+template Mix3510() { Sa s; }
+
+class C3510 {
+    mixin Mix3510!();
+    alias S3510!(0) Sa;
+}
+
+/***************************************************/
+
+struct Array243(T) if (is(T == bool))
+{
+    struct Range
+    {
+        Array243!bool _outer;
+        ulong _a, _b, _c;
+        ulong _d;
+    }
+
+    Range opSlice()
+    {
+        return Range(this, 0, 3);
+    }
+
+}
+
+
+void test243() {
+    Array243!bool a;
+}
+
+/***************************************************/
+// 7742
+
+struct Foo7742 {
+    static immutable f = Foo7742(1, 2);
+    int x, y;
+}
+
+struct Bar7742 {
+    int x, y;
+    static immutable f = Bar7742(1, 2);
+}
+
+void test7742()
+{
+    assert(Foo7742.f.x == 1);
+    assert(Foo7742.f.y == 2);
+
+    assert(Bar7742.f.x == 1);
+    assert(Bar7742.f.y == 2);
+}
+
+/***************************************************/
+// 7807
+
+interface Interface7807
+{
+    Interface7807 getNext();
+    const(Interface7807) getNext() const;
+}
+
+class Implementation7807 : Interface7807
+{
+    Implementation7807 getNext()
+    {
+        return this;
+    }
+
+    const(Implementation7807) getNext() const
+    {
+        return null;
+    }
+}
+
+void test7807()
+{
+    auto mc = new Implementation7807();
+    assert(mc.getNext() is mc);
+    Interface7807 mi = mc;
+    assert(mi.getNext() is mi);
+
+    auto cc = new const(Implementation7807)();
+    assert(cc.getNext() is null);
+    const(Interface7807) ci = cc;
+    assert(ci.getNext() is null);
+}
+
+/***************************************************/
+// 7815
+
+enum Closure {
+    Matrix
+}
+
+struct BasicMatrix {
+    mixin Operand!( Closure.Matrix );
+}
+
+template Operand( Closure closure_ ) {
+    alias closure_ closure;
+}
+
+struct Expression( string op_, Lhs, Rhs = void ) {
+    enum lhsClosure = closureOf!Lhs;
+}
+
+template closureOf( T ) {
+    enum closureOf = T.closure;
+}
+
+alias Expression!("+", BasicMatrix) Foo7815;
+
+/***************************************************/
+
+struct Test244 {
+    static immutable c = Test244();
+    static if( true ){}
+}
+
+/***************************************************/
+
+int noswap245(ubyte *data)
+{
+    return
+        (data[0]<<  0) |
+        (data[1]<<  8) |
+        (data[2]<< 16) |
+        (data[3]<< 24);
+}
+
+int bswap245(ubyte *data)
+{
+    return
+        (data[0]<< 24) |
+        (data[1]<< 16) |
+        (data[2]<< 8 ) |
+        (data[3]<< 0 );
+}
+
+void test245()
+{
+    int x1 = 0x01234567;
+    x1 = noswap245(cast(ubyte *)&x1);
+    assert(x1 == 0x01234567);
+    x1 = bswap245(cast(ubyte *)&x1);
+    assert(x1 == 0x67452301);
+}
+
+/***************************************************/
+
+mixin template mix7974()
+{
+    uint _x;
+}
+
+struct Foo7974
+{
+    static immutable Foo7974 fa = Foo7974(0);
+
+    this(uint x)
+    {
+        _x = x;
+    }
+
+    mixin mix7974!();
+}
+
+/***************************************************/
+// 4155
+
+
+float getnanf() { return float.nan; }
+double getnand() { return double.nan; }
+real getnanr() { return real.nan; }
+
+void test4155()
+{
+    assert(getnanf() != 0);
+    assert(getnand() != 0);
+    assert(getnanr() != 0);
+}
+
+/***************************************************/
+// 7911
+
+struct Klass7911
+{
+    double value;
+
+    //static const Klass zero; // Does not trigger bug!
+    static const Klass7911 zero = {0}; // Bug trigger #1
+
+    static if (true) // Bug trigger #2
+        static if (true)
+            Klass7911 foo() { return Klass7911(); }
+}
+
+void test7911()
+{
+    auto a = Klass7911().foo();
+}
+
+/***************************************************/
+// 8429
+
+static if(true)
+    version = Foo8429;
+static if(true)
+    version(Foo8429) {}
+
+/***************************************************/
+// 8069
+
+interface I8069
+{
+    void f();
+}
+struct A8069
+{
+    final class B8069 : I8069
+    {
+        A8069 a;
+        void f() {}
+    }
+}
+
+/***************************************************/
+// 8095
+
+void bug8095(int p0, int *p1, int z, int edx, int *p4, int p5)
+{
+    int x = z / 3;
+    if (z) {
+        int c = p5 + *p1 + p0; // *p1 segfaults -- it does *z !!
+        if ( z / 5 )
+            c = 1;
+        *p4 = c;
+        x = c;
+    }
+    void never_used() {
+        ++x;
+        int * unused = p1; // kills p4 somehow
+    }
+}
+
+void test8095() {
+    int x, y;
+    bug8095(0, &x, 1, 0, &y, 0);
+}
+
+/***************************************************/
+// 8091
+
+int solve1(int n) {
+    int a;
+    return ((a = n ? (n>=1u) : 1) != 0) ? a : 0;
+//    return ((a = !n ? 1 : (n>=1u)) != 0) ? a : 0;
+}
+
+int solve2(int n) {
+    int a;
+//    return ((a = n ? (n>=1u) : 1) != 0) ? a : 0;
+    return ((a = !n ? 1 : (n>=1u)) != 0) ? a : 0;
+}
+
+void test8091() {
+    assert(solve1(1) ==  1);
+    assert(solve2(1) ==  1);
+}
+
+/***************************************************/
+
+struct IPoint {
+    int x, y;
+}
+
+void bug6189_2(uint half, IPoint pos, float[4] *pts, uint unused) {
+    pos.y += half;
+    float xo = pos.x;
+    float yo = pos.y;
+
+    (*pts)[0] = xo;
+    (*pts)[1] = yo;
+    (*pts)[2] = xo;
+}
+
+void test6189_2()
+{
+    auto pos = IPoint(2, 2);
+    float[4] pts;
+    pts[0] = pts[1] = pts[2] = pts[3] = 0;
+    bug6189_2(0, pos, &pts, 0);
+
+    assert(pts[0] == 2);
+}
+
+/***************************************************/
+// 8199
+
+version (D_InlineAsm_X86_64)
+{
+    version = Check;
+    enum Align = 0x8;
+}
+else version (D_InlineAsm_X86)
+{
+    version = Check;
+    version (OSX)
+        enum Align = 0xC;
+}
+
+void onFailure()
+{
+    assert(0, "alignment failure");
+}
+
+void checkAlign()
+{
+    version (Check)
+    {
+        static if (is(typeof(Align)))
+        asm
+        {
+            naked;
+            mov EAX, ESP;
+            and EAX, 0xF;
+            cmp EAX, Align;
+            je Lpass;
+            call onFailure;
+        Lpass:
+            ret;
+        }
+    }
+    else
+        return;
+}
+
+void foo8199()
+{
+}
+
+void test8199()
+{
+    try
+        foo8199();
+    finally
+        checkAlign();
+}
+
+/***************************************************/
+
+void test246()
+{
+    struct Struct
+    {
+        void method() {}
+    }
+    auto val = Struct();
+}
+
+/***************************************************/
+
+double sqrt8454(double d) { return d/2; }
+void foo8454(cdouble m) {}
+void test8454() {
+    foo8454(0 - sqrt8454(1.0) * 1i);
+}
+
+/***************************************************/
+// 8423
+
+struct S8423
+{
+    int opCmp(S8423 rhs)
+    {
+        return 1;
+    }
+}
+
+void enforce8423(bool value, string a, string b)
+{
+    if (!value) assert(false);
+}
+
+void test8423()
+{
+    auto a = S8423();
+    auto b = S8423();
+    enforce8423(a > b, null, null);
+}
+
+/***************************************************/
+class Foo8496
+{
+public:
+    void foo(uint value)
+    {
+        ubyte size = value < (0x7fU << 0 ) ? 1 :
+                     value < (0x7fU << 14) ? 2 :
+                                             3;
+        import std.stdio;
+        writeln(size);
+        assert(size == 2);
+    }
+}
+
+void test8496()
+{
+    Foo8496 f = new Foo8496();
+    f.foo(1000000);
+}
+
+/***************************************************/
+
+long foo8840() { return 4; }
+
+int bar8840(long g) { assert(g == 4); return printf("%llx\n", g); }
+
+void test8840()
+{
+    long f1 = foo8840();
+    long f2 = foo8840();
+
+    long f = (f1 < f2 ? f1 : f2);
+    int len = (f == 0 ? 0 : bar8840(f));
+}
+
+/***************************************************/
+
+struct S8889
+{
+    real f;
+    int i;
+}
+
+void test8889()
+{
+}
+
+/***************************************************/
+
+struct S8870
+{
+    float x = 0;
+    float y = 0;
+    float z = 0;
+    float w = 0;
+}
+
+void test8870()
+{
+    S8870 r1 = S8870(1,2,3,4);
+    S8870 r2 = S8870(5,6,7,8);
+
+    foo8870(r1, r2, false, 1);
+    bar8870(r1, r2, false, 1);
+}
+
+//extern (C)
+void foo8870(S8870 t1, S8870 t2, bool someBool, float finalFloat)
+{
+    printf("t1: %g %g %g %g\n", t1.x, t1.y, t1.z, t1.w);
+    printf("t2: %g %g %g %g\n", t2.x, t2.y, t2.z, t2.w);
+    printf("someBool: %d\n", someBool);
+    printf("finalFloat: %g\n", finalFloat);
+
+    assert(t1.x == 1 && t1.y == 2 && t1.z == 3 && t1.w == 4);
+    assert(t2.x == 5 && t2.y == 6 && t2.z == 7 && t2.w == 8);
+    assert(someBool == false);
+    assert(finalFloat == 1);
+}
+
+extern (C)
+void bar8870(S8870 t1, S8870 t2, bool someBool, float finalFloat)
+{
+    printf("t1: %g %g %g %g\n", t1.x, t1.y, t1.z, t1.w);
+    printf("t2: %g %g %g %g\n", t2.x, t2.y, t2.z, t2.w);
+    printf("someBool: %d\n", someBool);
+    printf("finalFloat: %g\n", finalFloat);
+
+    assert(t1.x == 1 && t1.y == 2 && t1.z == 3 && t1.w == 4);
+    assert(t2.x == 5 && t2.y == 6 && t2.z == 7 && t2.w == 8);
+    assert(someBool == false);
+    assert(finalFloat == 1);
+}
+
+/***************************************************/
+
+int foo9781(int[1] x)
+{
+    return x[0] * x[0];
+}
+
+void test9781()
+{
+    foo9781([7]);
+}
+
+/***************************************************/
+
+struct S247 { size_t length; size_t ptr; }
+
+S247 foo247()
+{
+    S247 f;
+    f.length = 7;
+    f.ptr = 8;
+    return f;
+}
+
+void test247()
+{
+    S247 f;
+    f = foo247();
+    assert(f.length == 7);
+    assert(f.ptr == 8);
+}
+
+/***************************************************/
+// 8340
+
+void test8340(){
+    byte[] ba = [1,2,3,4,5];
+    short[] sa = [1,2,3,4,5];
+    int[] ia = [1,2,3,4,5];
+    long[] la = [1,2,3,4,5];
+
+    ba[2] *= -1;
+    sa[2] *= -1;
+    ia[2] *= -1;
+    la[2] *= -1;
+
+    assert(ba == [1,2,-3,4,5]);
+    assert(sa == [1,2,-3,4,5]);
+    assert(ia == [1,2,-3,4,5]);
+    assert(la == [1,2,-3,4,5]);
+}
+
+/***************************************************/
+// 8376
+
+void test8376() {
+    int i = 0;
+    int[2] a;
+    a[1]=1;
+    while(!a[0]){
+        if(a[i]) continue;
+        a[i] = 1;
+    }
+}
+
+/***************************************************/
+
+// Don't call, compile only
+void test8987(){
+    int last = 0;
+    int count = 0;
+    int d;
+
+    for (int x = 0; count < 100; x++){
+        d = 3;
+
+        while (x / d)
+            d += 2;
+
+        if (x & d) {
+            last = x;
+            count++;
+        }
+    }
+
+    printf("Last: %d\n", last);
+}
+
+/***************************************************/
+// 8796
+
+int* wrong8796(int* p)
+{
+    *p++ = 1;
+    return p;
+}
+
+void test8796()
+{
+    int[3] arr;
+    int* q = arr.ptr;
+    q = wrong8796(q);
+    assert(q != arr.ptr);
+}
+
+/***************************************************/
+// 9171
+
+ulong bitcomb9171(ulong v)
+{
+    if(v)
+    {
+        ulong result;
+        if(v & 1)
+        {
+            auto r = bitcomb9171(v >> 1);
+            printf("r=%016llx\n", r);
+
+            auto z = ((r & (r-1) ^ r));
+            check9171("str", z>>1);
+//          printf("z=%016llx\n", z>>1);
+            return r;
+        }
+        else
+        {
+            auto fb = v & (v-1) ^ v;
+            result = (fb >> 1) | (v ^ fb);
+        }
+        return result;
+    }
+    return 0;
+}
+
+void check9171(const char *s, ulong v)
+{
+    assert(v == 0x80000000);
+}
+
+void test9171()
+{
+    bitcomb9171(0b1110000000000000010000000000000000000000000000000001);
+}
+
+/***************************************************/
+// 9248
+
+void test9248()
+{
+    void*[] a = [cast(void*)1];
+    void*[] b = [cast(void*)2];
+    auto c = a ~ b;
+    assert(c == [cast(void*)1, cast(void*)2]);
+}
+
+/***************************************************/
+// 14682
+
+void test14682a()
+{
+    // operands
+    int[]       a1;
+    int[][]     a2;
+    int[][][]   a3;
+    int[][][][] a4;
+
+    // results
+    int[]       r1w =    [];    assert(r1w.length == 0);
+    int[][]     r2w =    [];    assert(r2w.length == 0);
+    int[][][]   r3w =    [];    assert(r3w.length == 0);
+    int[][][][] r4w =    [];    assert(r4w.length == 0);
+    // ----
+    int[][]     r2x =   [[]];   assert(r2x.length == 1 && r2x[0].length == 0);
+    int[][][]   r3x =   [[]];   assert(r3x.length == 1 && r3x[0].length == 0);
+    int[][][][] r4x =   [[]];   assert(r4x.length == 1 && r4x[0].length == 0);
+    // ----
+    int[][][]   r3y =  [[[]]];  assert(r3y.length == 1 && r3y[0].length == 1 && r3y[0][0].length == 0);
+    int[][][][] r4y =  [[[]]];  assert(r4y.length == 1 && r4y[0].length == 1 && r4y[0][0].length == 0);
+    // ----
+    int[][][][] r4z = [[[[]]]]; assert(r4z.length == 1 && r4z[0].length == 1 && r4z[0][0].length == 1 && r4z[0][0][0].length == 0);
+
+    // ArrayLiteralExp conforms to the type of LHS.
+    { auto x = a1 ~    []   ;   static assert(is(typeof(x) == typeof(a1))); assert(x == r1w); } // no ambiguity
+    { auto x = a2 ~    []   ;   static assert(is(typeof(x) == typeof(a2))); assert(x == r2w); } // fix <- ambiguity
+    { auto x = a3 ~    []   ;   static assert(is(typeof(x) == typeof(a3))); assert(x == r3w); } // fix <- ambiguity
+    { auto x = a4 ~    []   ;   static assert(is(typeof(x) == typeof(a4))); assert(x == r4w); } // fix <- ambiguity
+    // ----
+  //{ auto x = a1 ~   [[]]  ; } // (see test14682b)
+    { auto x = a2 ~   [[]]  ;   static assert(is(typeof(x) == typeof(a2))); assert(x == r2x); } // no ambiguity
+    { auto x = a3 ~   [[]]  ;   static assert(is(typeof(x) == typeof(a3))); assert(x == r3x); } // fix <- ambiguity
+    { auto x = a4 ~   [[]]  ;   static assert(is(typeof(x) == typeof(a4))); assert(x == r4x); } // fix <- ambiguity
+    // ----
+    static assert(!__traits(compiles, { auto x = a1 ~   [[[]]] ; }));
+  //{ auto x = a2 ~  [[[]]] ; } // (see test14682b)
+    { auto x = a3 ~  [[[]]] ;   static assert(is(typeof(x) == typeof(a3))); assert(x == r3y); } // no ambiguity
+    { auto x = a4 ~  [[[]]] ;   static assert(is(typeof(x) == typeof(a4))); assert(x == r4y); } // fix <- ambiguity
+    // ----
+    static assert(!__traits(compiles, { auto x = a1 ~  [[[[]]]]; }));
+    static assert(!__traits(compiles, { auto x = a2 ~  [[[[]]]]; }));
+  //{ auto x = a3 ~ [[[[]]]]; } // (see test14682b)
+    { auto x = a4 ~ [[[[]]]];   static assert(is(typeof(x) == typeof(a4))); assert(x == r4z); } // no ambiguity
+
+    // ArrayLiteralExp conforms to the type of RHS.
+    { auto x =    []    ~ a1;   static assert(is(typeof(x) == typeof(a1))); assert(x == r1w); } // no ambiguity
+    { auto x =    []    ~ a2;   static assert(is(typeof(x) == typeof(a2))); assert(x == r2w); } // fix <- ambiguity
+    { auto x =    []    ~ a3;   static assert(is(typeof(x) == typeof(a3))); assert(x == r3w); } // fix <- ambiguity
+    { auto x =    []    ~ a4;   static assert(is(typeof(x) == typeof(a4))); assert(x == r4w); } // fix <- ambiguity
+    // ----
+  //{ auto x =   [[]]   ~ a1; } // (see test14682b)
+    { auto x =   [[]]   ~ a2;   static assert(is(typeof(x) == typeof(a2))); assert(x == r2x); } // no ambiguity
+    { auto x =   [[]]   ~ a3;   static assert(is(typeof(x) == typeof(a3))); assert(x == r3x); } // fix <- ambiguity
+    { auto x =   [[]]   ~ a4;   static assert(is(typeof(x) == typeof(a4))); assert(x == r4x); } // fix <- ambiguity
+    // ----
+    static assert(!__traits(compiles, { auto x =  [[[]]]  ~ a1; }));
+  //{ auto x =  [[[]]]  ~ a2; } // (see test14682b)
+    { auto x =  [[[]]]  ~ a3;   static assert(is(typeof(x) == typeof(a3))); assert(x == r3y); } // no ambiguity
+    { auto x =  [[[]]]  ~ a4;   static assert(is(typeof(x) == typeof(a4))); assert(x == r4y); } // fix <- ambiguity
+    // ----
+    static assert(!__traits(compiles, { auto x = [[[[]]]] ~ a1; }));
+    static assert(!__traits(compiles, { auto x = [[[[]]]] ~ a2; }));
+  //{ auto x = [[[[]]]] ~ a3; } // (see test14682b)
+    { auto x = [[[[]]]] ~ a4;   static assert(is(typeof(x) == typeof(a4))); assert(x == r4z); } // no ambiguity
+}
+
+void test14682b()
+{
+    // operands
+    int[]       a1;
+    int[][]     a2;
+    int[][][]   a3;
+    int[][][][] a4;
+
+    // results
+    int[][]     r2a = [[],   []  ]; assert(r2a.length == 2 && r2a[0].length == 0 && r2a[1].length == 0);
+  //int[][][]   r3a = [[],  [[]] ]; // should work, but doesn't
+  //int[][][][] r4a = [[], [[[]]]]; // should work, but doesn't
+    int[][][]   r3a;  { r3a.length = 2; r3a[0] = []; r3a[1] =  [[]] ; }
+                                    assert(r3a.length == 2 && r3a[0].length == 0 && r3a[1].length == 1 && r3a[1][0].length == 0);
+    int[][][][] r4a;  { r4a.length = 2; r4a[0] = []; r4a[1] = [[[]]]; }
+                                    assert(r4a.length == 2 && r4a[0].length == 0 && r4a[1].length == 1 && r4a[1][0].length == 1 && r4a[1][0][0].length == 0);
+    // ----
+    int[][]     r2b = [  []  , []]; assert(r2b.length == 2 && r2b[1].length == 0 && r2b[0].length == 0);
+  //int[][][]   r3b = [ [[]] , []]; // should work, but doesn't
+  //int[][][][] r4b = [[[[]]], []]; // should work, but doesn't
+    int[][][]   r3b;  { r3b.length = 2; r3b[0] =  [[]] ; r3b[1] = []; }
+                                    assert(r3b.length == 2 && r3b[1].length == 0 && r3b[0].length == 1 && r3b[0][0].length == 0);
+    int[][][][] r4b;  { r4b.length = 2; r4b[0] = [[[]]]; r4b[1] = []; }
+                                    assert(r4b.length == 2 && r4b[1].length == 0 && r4b[0].length == 1 && r4b[0][0].length == 1 && r4b[0][0][0].length == 0);
+
+    // ArrayLiteralExp conforms to the typeof(LHS)->arrayOf().
+    { auto x = a1 ~   [[]]  ;   static assert(is(typeof(x) == typeof(a1)[])); assert(x == r2a); } // fix
+    { auto x = a2 ~  [[[]]] ;   static assert(is(typeof(x) == typeof(a2)[])); assert(x == r3a); } // fix
+    { auto x = a3 ~ [[[[]]]];   static assert(is(typeof(x) == typeof(a3)[])); assert(x == r4a); } // fix
+
+    // ArrayLiteralExp conforms to the typeof(RHS)->arrayOf().
+    { auto x =   [[]]   ~ a1;   static assert(is(typeof(x) == typeof(a1)[])); assert(x == r2b); } // fix
+    { auto x =  [[[]]]  ~ a2;   static assert(is(typeof(x) == typeof(a2)[])); assert(x == r3b); } // fix
+    { auto x = [[[[]]]] ~ a3;   static assert(is(typeof(x) == typeof(a3)[])); assert(x == r4b); } // fix
+}
+
+/***************************************************/
+// 9739
+
+class Foo9739
+{
+    int val = 1;
+    this(int arg = 2) { val = arg; }
+}
+
+class Bar9739 : Foo9739 { }
+
+void test9739()
+{
+    Bar9739 bar = new Bar9739;
+    assert(bar.val == 2);
+}
+
+/***************************************************/
+// 6057
+void test6057()
+{
+    enum Foo { A=1, B=2 }
+    Foo[] bar = [cast(Foo)1];
+}
+
+/***************************************************/
+
+ulong d2ulong(double u)
+{
+    return cast(ulong)u;
+}
+
+void testdbl_to_ulong()
+{
+    auto u = d2ulong(12345.6);
+    //writeln(u);
+    assert(u == 12345);
+
+    real adjust = 1.0L/real.epsilon;
+    u = d2ulong(adjust);
+    //writefln("%s %s", adjust, u);
+    static if(real.mant_dig == 64)
+        assert(u == 9223372036854775808UL);
+    else static if(real.mant_dig == 53)
+        assert(u == 4503599627370496UL);
+    else
+        static assert(false, "Test not implemented for this architecture");
+
+    auto v = d2ulong(adjust * 1.1);
+    //writefln("%s %s %s", adjust, v, u + u/10);
+
+    // The following can vary in the last bits with different optimization settings,
+    // i.e. the conversion from real to double may not happen.
+    //assert(v == 10145709240540254208UL);
+}
+
+/***************************************************/
+
+
+
+uint d2uint(double u)
+{
+    return cast(uint)u;
+}
+
+void testdbl_to_uint()
+{
+    auto u = d2uint(12345.6);
+    //writeln(u);
+    assert(u == 12345);
+}
+
+/***************************************************/
+
+ulong r2ulong(real u)
+{
+    return cast(ulong)u;
+}
+
+void testreal_to_ulong()
+{
+    auto u = r2ulong(12345.6L);
+    //writeln(u);
+    assert(u == 12345);
+
+    real adjust = 1.0L/real.epsilon;
+    u = r2ulong(adjust);
+    //writefln("%s %s", adjust, u);
+    static if(real.mant_dig == 64)
+        assert(u == 9223372036854775808UL);
+    else static if(real.mant_dig == 53)
+        assert(u == 4503599627370496UL);
+    else
+        static assert(false, "Test not implemented for this architecture");
+
+    auto v = r2ulong(adjust * 1.1);
+    writefln("%s %s %s", adjust, v, u + u/10);
+
+    //assert(v == 10145709240540253389UL);
+}
+
+/***************************************************/
+
+long testbt1(long a, long b, int c)
+{
+    return a + ((b >> c) & 1);
+//    return a + ((b & (1L << c)) != 0);
+}
+
+
+long testbt2(long a, long b, int c)
+{
+//    return a + ((b >> c) & 1);
+    return a + ((b & (1L << c)) != 0);
+}
+
+int testbt3(int a, int b, int c)
+{
+    return a + ((b >> c) & 1);
+//    return a + ((b & (1 << c)) != 0);
+}
+
+int testbt4(int a, int b, int c)
+{
+//    return a + ((b >> c) & 1);
+    return a + ((b & (1 << c)) != 0);
+}
+
+
+void test248()
+{
+    auto a1 = testbt1(3, 4, 2);
+    assert(a1 == 4);
+    a1 = testbt2(3, 4, 2);
+    assert(a1 == 4);
+    a1 = testbt3(3, 4, 2);
+    assert(a1 == 4);
+    a1 = testbt4(3, 4, 2);
+    assert(a1 == 4);
+
+    a1 = testbt1(3, 8, 2);
+    assert(a1 == 3);
+    a1 = testbt2(3, 8, 2);
+    assert(a1 == 3);
+    a1 = testbt3(3, 8, 2);
+    assert(a1 == 3);
+    a1 = testbt4(3, 8, 2);
+    assert(a1 == 3);
+}
+
+/***************************************************/
+
+int foo249(int a, int b)
+{
+    return a + ((b & 0x80) != 0);
+}
+
+long bar249(long a, int b)
+{
+    return a + ((b & 0x80) != 0);
+}
+
+void test249()
+{
+  {
+    auto i = foo249(3, 6);
+    assert(i == 3);
+    i = foo249(3, 0x88);
+    assert(i == 4);
+  }
+  {
+    auto i = bar249(3, 6);
+    assert(i == 3);
+    i = bar249(3, 0x88);
+    assert(i == 4);
+  }
+}
+
+/***************************************************/
+
+// These should all compile to a BT instruction when -O, for -m32 and -m64
+
+int bt32(uint *p, uint b) { return ((p[b >> 5] & (1 << (b & 0x1F)))) != 0; }
+
+int bt64a(ulong *p, uint b) { return ((p[b >> 6] & (1L << (b & 63)))) != 0; }
+
+int bt64b(ulong *p, size_t b) { return ((p[b >> 6] & (1L << (b & 63)))) != 0; }
+
+void test250()
+{
+    static uint[2]  a1 = [0x1001_1100, 0x0220_0012];
+
+    if ( bt32(a1.ptr,30)) assert(0);
+    if (!bt32(a1.ptr,8))  assert(0);
+    if ( bt32(a1.ptr,30+32)) assert(0);
+    if (!bt32(a1.ptr,1+32))  assert(0);
+
+    static ulong[2] a2 = [0x1001_1100_12345678, 0x0220_0012_12345678];
+
+    if ( bt64a(a2.ptr,30+32)) assert(0);
+    if (!bt64a(a2.ptr,8+32))  assert(0);
+    if ( bt64a(a2.ptr,30+32+64)) assert(0);
+    if (!bt64a(a2.ptr,1+32+64))  assert(0);
+
+    if ( bt64b(a2.ptr,30+32)) assert(0);
+    if (!bt64b(a2.ptr,8+32))  assert(0);
+    if ( bt64b(a2.ptr,30+32+64)) assert(0);
+    if (!bt64b(a2.ptr,1+32+64))  assert(0);
+}
+
+/***************************************************/
+
+struct S251 { int a,b,c,d; }
+
+S251 foo251(S251 s)
+{
+    S251 a = s;
+    S251 b = a; // copy propagation
+    S251 c = b;
+    S251 d = c;
+    S251 e = d; // dead assignment
+    return d;
+}
+
+void test251()
+{
+    S251 a;
+    a.a = 1;
+    a.b = 2;
+    a.c = 3;
+    a.d = 4;
+    a = foo251(a);
+    assert(a.a == 1);
+    assert(a.b == 2);
+    assert(a.c == 3);
+    assert(a.d == 4);
+}
+
+/***************************************************/
+// 9387
+
+void bug9387a(double x) { }
+
+void ice9387()
+{
+    double x = 0.3;
+    double r = x*0.1;
+    double q = x*0.1 + r;
+    double p = x*0.1 + r*0.2;
+    if ( q )
+        p = -p;
+    bug9387a(p);
+}
+
+/***************************************************/
+
+void bug6962(string value)
+{
+    string v = value;
+    try
+    {
+        v = v[0LU..0LU];
+        return;
+    }
+    finally
+    {
+        assert(!v.length);
+    }
+}
+
+void test6962()
+{
+    bug6962("42");
+}
+
+/***************************************************/
+
+int[1] foo4414() {
+    return [7];
+}
+
+ubyte[4] bytes4414()
+{
+    ubyte[4] x;
+    x[0] = 7;
+    x[1] = 8;
+    x[2] = 9;
+    x[3] = 10;
+    return x;
+}
+
+void test4414() {
+  {
+    int x = foo4414()[0];
+    assert(x == 7);
+  }
+  {
+    auto x = bytes4414()[0..4];
+    if (x[0] != 7 || x[1] != 8 || x[2] != 9 || x[3] != 10)
+        assert(0);
+  }
+}
+
+/***************************************************/
+
+void test9844() {
+    int a = -1;
+    long b = -1;
+    assert(a == -1);
+    assert(b == -1L);
+}
+
+/***************************************************/
+// 10628
+
+abstract class B10628
+{
+    static if (! __traits(isVirtualMethod, foo))
+    {
+    }
+
+    private bool _bar;
+    public void foo();
+}
+
+class D10628 : B10628
+{
+    public override void foo() {}
+}
+
+void test10628()
+{
+    assert(typeid(D10628).vtbl.length - typeid(Object).vtbl.length == 1);
+}
+
+/***************************************************/
+// 11265
+
+struct S11265
+{
+    class InnerClass
+    {
+        S11265 s;
+
+        bool empty()
+        {
+            return true;
+        }
+    }
+}
+
+void test11265()
+{
+    S11265.InnerClass trav = new S11265.InnerClass();
+    trav.empty();
+}
+
+/***************************************************/
+
+struct TimeOfDay
+{
+    void roll(int value)
+    {
+        value %= 60;
+        auto newVal = _seconds + value;
+
+        if(newVal < 0)
+            newVal += 60;
+        else if(newVal >= 60)
+            newVal -= 60;
+
+        _seconds = cast(ubyte)newVal;
+    }
+
+    ubyte _seconds;
+}
+
+
+void test10633()
+{
+    TimeOfDay tod = TimeOfDay(0);
+    tod.roll(-1);
+    assert(tod._seconds == 59);
+}
+
+/***************************************************/
+
+import std.stdio;
+
+void _assertEq (ubyte lhs, short rhs, string msg, string file, size_t line)
+{
+    immutable result = lhs == rhs;
+
+    if(!result)
+    {
+        string op = "==";
+        if(msg.length > 0)
+            writefln(`_assertEq failed: [%s] is not [%s].`, lhs, rhs);
+        else
+            writefln(`_assertEq failed: [%s] is not [%s]: %s`, lhs, rhs, msg);
+    }
+
+    assert(result);
+}
+
+struct Date
+{
+    short year;
+    ubyte month;
+    ubyte day;
+}
+
+struct MonthDay
+{
+    ubyte month;
+    short day;
+}
+
+void test10642()
+{
+    static void test(Date date, int day, MonthDay expected, size_t line = __LINE__)
+    {
+        _assertEq(date.day, expected.day, "", __FILE__, line);
+    }
+
+    test(Date(1999, 1, 1), 1, MonthDay(1,1));
+}
+
+
+/***************************************************/
+
+void test7436()
+{
+    ubyte a = 10;
+    float f = 6;
+    ubyte b = a += f;
+    assert(b == 16);
+}
+
+/***************************************************/
+// 12138
+
+struct S12138
+{
+    int num;
+    this(int n) { num = n; }
+    ~this() { num = 0; }
+}
+
+void test12138()
+{
+label:
+    auto s = S12138(10);
+    assert(s.num == 10);
+}
+
+/***************************************************/
+// 14430
+
+void setCookie(long x = 1L << 32L, string y = null){
+    assert(y.ptr is null);
+}
+
+void test14430(){
+    setCookie();
+}
+
+/***************************************************/
+// 14510
+
+alias Vector14510 = ulong[3];
+
+void fun14510(Vector14510 vec, bool recursive = false)
+{
+    assert(vec[2] == 0);
+    if (recursive)
+        return;
+    fun14510(vec, true);
+}
+
+void test14510()
+{
+    Vector14510 vec;
+    fun14510(vec);
+}
+
+/***************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=16027
+
+void test16027()
+{
+    double value = 1.0;
+    value *= -1.0;
+    assert(value == -1.0);    // fails, value is +1.0
+
+    value = 1.0;
+    value = value * -1.0;
+    assert(value == -1.0);
+}
+
+/***************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test27();
+    test28();
+    test29();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test56();
+    test57();
+    test58();
+    test59();
+    test60();
+    test61();
+    test62();
+    test63();
+    test64();
+    test65();
+    test66();
+    test67();
+    test68();
+    test69();
+    test70();
+    test71();
+    test72();
+    test73();
+    test74();
+    test75();
+    test76();
+    test77();
+    test78();
+    test79();
+    test80();
+    test81();
+    test82();
+    test83();
+    test84();
+    test85();
+    test86();
+    test87();
+    test88();
+    test89();
+    test90();
+    test91();
+    test92();
+    test93();
+    test94();
+    test95();
+    test96();
+    test97();
+    test98();
+    test99();
+    test100();
+    test101();
+    test103();
+    test104();
+    test105();
+    test107();
+    test108();
+    test109();
+    test110();
+    test111();
+    test112();
+    test113();
+    test114();
+    test115();
+    test116();
+    test117();
+    test118();
+    test119();
+    test120();
+    test121();
+    //test122();
+    test123();
+    test124();
+    test125();
+    test126();
+    test127();
+    test128();
+    test129();
+    test130();
+    test131();
+    test132();
+    test133();
+
+//    test135();
+    test136();
+    test137();
+
+    test139();
+    test140();
+
+    test142();
+    test143();
+    test144();
+    test145();
+    test146();
+    test147();
+    test148();
+    test149();
+
+    test151();
+    test152();
+    test153();
+    test154();
+
+    test156();
+    test157();
+
+    test160();
+
+    test163();
+
+
+    test169();
+
+    test171();
+
+    test173();
+    test174();
+
+    test176();
+    test177();
+
+    test179();
+
+    test181();
+    test182();
+
+    test188();
+    test189();
+    test190();
+    test191();
+
+    test193();
+    test194();
+
+    test198();
+
+    test200();
+    test201();
+    test202();
+    test203();
+
+//    test208();
+
+    test210();
+
+    test212();
+    test213();
+    test214();
+    test215();
+    test216();
+    test217();
+    test218();
+    test219();
+    test220();
+
+    test222();
+    test223();
+    test224();
+    test225();
+    test226();
+    test227();
+    test228();
+    test229();
+    test230();
+    test230();
+    bug5717();
+    test231();
+    test232();
+    test233();
+    bug6184();
+    test236();
+    test237();
+    test238();
+    test239();
+    test6229();
+    test6270();
+    test6506();
+    test240();
+    test6563();
+    test241();
+    test6665();
+    test5364();
+    test6189();
+    test6997();
+    test7026();
+    test6354();
+    test7072();
+    test7212();
+    test242();
+    test7290();
+    test7367();
+    test7375();
+    test6504();
+    test7422();
+    test7424();
+    test7502();
+    test4820();
+    test4820_2();
+    test243();
+    test7742();
+    test245();
+    test7807();
+    test4155();
+    test7911();
+    test8095();
+    test8091();
+    test6189_2();
+    test8199();
+    test246();
+    test8454();
+    test8423();
+    test8496();
+    test8840();
+    test8889();
+    test8870();
+    test9781();
+    test247();
+    test8340();
+    test8376();
+    test8796();
+    test9171();
+    test9248();
+    test14682a();
+    test14682b();
+    test9739();
+    testdbl_to_ulong();
+    testdbl_to_uint();
+    testreal_to_ulong();
+    test248();
+    test249();
+    test250();
+    test6057();
+    test251();
+    test6962();
+    test4414();
+    test9844();
+    test10628();
+    test11265();
+    test10633();
+    test10642();
+    test7436();
+    test12138();
+    test14430();
+    test14510();
+    test16027();
+
+    writefln("Success");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test42a.d b/gcc/testsuite/gdc.test/runnable/test42a.d
new file mode 100644
index 00000000000..0bb98efcff0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test42a.d
@@ -0,0 +1,315 @@
+// PERMUTE_ARGS:
+
+module test42;
+
+import core.stdc.stdio;
+
+/***************************************************/
+
+void test1()
+{
+    ubyte[] data2 = [
+    3,3,3,3,
+    3,3,3,3,
+    3,3,3,3,
+    3,3,3,
+    ];
+    foreach (i; data2)
+    {   //printf("i = %d\n", i);
+        assert(i == 3);
+    }
+
+ubyte[] data = [
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7];
+    foreach (i; data)
+    {   //printf("i = %d\n", i);
+        assert(i == 7);
+    }
+}
+
+/***************************************************/
+
+int main()
+{
+    test1();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test435.d b/gcc/testsuite/gdc.test/runnable/test435.d
new file mode 100644
index 00000000000..4dcabd1fcff
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test435.d
@@ -0,0 +1,143 @@
+import core.stdc.stdio;
+
+class A
+{
+    immutable size_t f;
+
+    this(T)(T z)
+    {
+        f = z.sizeof;
+    }
+}
+
+struct AS
+{
+    immutable size_t f;
+
+    this(T)(T z)
+    {
+        f = z.sizeof;
+    }
+}
+
+void test0()
+{
+    assert((new A(2.2)).f == double.sizeof);
+    assert((new A('g')).f == char.sizeof);
+    assert((AS(17)).f == int.sizeof);
+    assert((AS(null)).f == typeof(null).sizeof);
+}
+
+//------------------------------------------------------------------------------
+
+class C
+{
+    const int x;
+    const int y;
+
+    this(T...)(T z)
+    {
+        this.tupleof = z;
+    }
+}
+
+struct CS
+{
+    const int x;
+    const int y;
+
+    this(T...)(T z)
+    {
+        this.tupleof = z;
+    }
+}
+
+void test1()
+{
+    auto c = new C(4, 6);
+    assert(c.x == 4);
+    assert(c.y == 6);
+
+    auto cs = CS(7, 8);
+    assert(cs.x == 7);
+    assert(cs.y == 8);
+}
+
+//------------------------------------------------------------------------------
+
+// bug 435.
+class B
+{
+    int i;
+    this(int k)
+    {
+        i = k;
+    }
+}
+class D : B
+{
+    this(A...)(A args)
+    {
+        super(args);
+    }
+}
+
+void test2()
+{
+    auto a = new D(4);
+    assert(a.i == 4);
+}
+
+//------------------------------------------------------------------------------
+
+// bug 4905
+class C2
+{
+    string x;
+
+    this(T...)(in string msg, T args)
+    {
+        x = msg;
+        foreach (a; args)
+            x ~= a;
+    }
+}
+
+void test3()
+{
+    auto c2 = new C2("test");
+    assert(c2.x == "test");
+
+    auto c3 = new C2("test", " variadic", " constructor");
+    assert(c3.x == "test variadic constructor");
+}
+
+//------------------------------------------------------------------------------
+
+// bug 4531 test case 2
+class MyError : Exception
+{
+    this(T...)(T msg)
+    {
+        assert(msg[0] == "Hello, " && msg[1] == 42);
+        super("Hello, 42");
+    }
+}
+
+void test4()
+{
+    auto err = new MyError("Hello, ", 42);
+    assert(err.msg == "Hello, 42");
+}
+
+void main()
+{
+    test0();
+    test1();
+    test2();
+    test3();
+    test4();
+    printf("Success\n");
+}
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/test45.d b/gcc/testsuite/gdc.test/runnable/test45.d
new file mode 100644
index 00000000000..49fa548351a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test45.d
@@ -0,0 +1,31 @@
+// EXTRA_SOURCES: imports/test45a.d imports/test45b.d
+// PERMUTE_ARGS:
+
+import imports.test45a;
+import imports.test45b;
+
+alias int function() fp1;
+alias int function(int) fp2;
+
+void main()
+{
+    auto i = foo();
+    assert(i == 1);
+    i = foo(1);
+    assert(i == 2);
+    i = foo;
+    assert(i == 1);
+
+    fp1 fp = &foo;
+    i = (*fp)();
+    assert(i == 1);
+
+    fp2 fpi = &foo;
+    i = (*fpi)(1);
+    assert(i == 2);
+
+    i = bar(1);
+    assert(i == 3);
+    i = bar(1, 2);
+    assert(i == 4);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test46.d b/gcc/testsuite/gdc.test/runnable/test46.d
new file mode 100644
index 00000000000..908cafb681a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test46.d
@@ -0,0 +1,6 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test46b.d imports/test46a.d imports/test46c.d
+// PERMUTE_ARGS:
+
+module test46;
+void main() {}
diff --git a/gcc/testsuite/gdc.test/runnable/test48.d b/gcc/testsuite/gdc.test/runnable/test48.d
new file mode 100644
index 00000000000..827d681259b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test48.d
@@ -0,0 +1,43 @@
+// EXTRA_SOURCES: imports/test48a.d
+// PERMUTE_ARGS:
+
+import std.stdio;
+import imports.test48a;
+
+void main()
+{
+    S s;
+    auto i = s.tupleof[0] + s.tupleof[1] + s.tupleof[2];
+    printf("i = %d\n", i);
+    assert(i == 6);
+
+    auto t = s.tupleof;
+    i = t[0] + t[1] + t[2];
+    printf("i = %d\n", i);
+    assert(i == 6);
+
+    printf("a = %d %d %d\n", S.tupleof.offsetof);
+    auto o = S.tupleof.offsetof;
+    assert(o[0] == 0);
+    assert(o[1] == 4);
+    assert(o[2] == 8);
+    printf("a = %d %d %d\n", S.tupleof[0].offsetof, S.tupleof[1].offsetof, S.tupleof[2].offsetof);
+    assert(S.tupleof[0].offsetof == 0);
+    assert(S.tupleof[1].offsetof == 4);
+    assert(S.tupleof[2].offsetof == 8);
+
+    auto offset0 = cast(void*)&s.tupleof[0] - cast(void*)&s;
+    printf("offset0 = %d\n", offset0);
+    assert(offset0 == 0);
+
+    auto offset1 = cast(void*)&s.tupleof[1] - cast(void*)&s;
+    printf("offset1 = %d\n", offset1);
+    assert(offset1 == 4);
+
+    auto offset2 = cast(void*)&s.tupleof[2] - cast(void*)&s;
+    printf("offset2 = %d\n", offset2);
+    assert(offset2 == 8);
+
+    int t1[S.tupleof.offsetof[1]];
+    assert(t1.length == 4);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test49.d b/gcc/testsuite/gdc.test/runnable/test49.d
new file mode 100644
index 00000000000..fc80d61fd99
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test49.d
@@ -0,0 +1,12 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test49a.d
+// PERMUTE_ARGS:
+
+import imports.test49a;
+
+alias Foo!(int) foo;
+
+void main()
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test5.d b/gcc/testsuite/gdc.test/runnable/test5.d
new file mode 100644
index 00000000000..7d9769dc03d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test5.d
@@ -0,0 +1,65 @@
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+interface foo
+{
+    extern (C) int testc(int i);
+    extern (Windows) int testw(int i);
+    extern (D) int testd(int i);
+}
+
+class bar : foo
+{
+    int x = 47;
+
+  extern (C)
+    int testc(int i)
+    {
+        printf("foo.testc(%p)\n", this);
+        assert(x == 47);
+        return i + x;
+    }
+
+  extern (Windows)
+    int testw(int i)
+    {
+        printf("foo.testw(%p)\n", this);
+        assert(x == 47);
+        return i + x;
+    }
+
+  extern (D)
+    int testd(int i)
+    {
+        printf("foo.testd(%p)\n", this);
+        assert(x == 47);
+        return i + x;
+    }
+}
+
+int def(foo f)
+{
+    printf("def(%p), %p\n", f, (cast(int*)f)[0]);
+    assert(f.testc(3) == 50);
+    assert(f.testd(7) == 54);
+    assert(f.testd(10) == 57);
+    return 0;
+}
+
+void abc(bar b)
+{
+    printf("abc(%p), %p\n", b, (cast(int*)b)[3]);
+    def(b);
+}
+
+int main()
+{
+    bar b = new bar();
+
+    printf("b.size = x%x\n", b.classinfo.initializer.length);
+    printf("bar.size = x%x\n", bar.classinfo.initializer.length);
+    assert(b.classinfo.initializer.length == bar.classinfo.initializer.length);
+    abc(b);
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test52.d b/gcc/testsuite/gdc.test/runnable/test52.d
new file mode 100644
index 00000000000..2a906d0f454
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test52.d
@@ -0,0 +1,29 @@
+// PERMUTE_ARGS:
+
+// 2311
+
+extern(C)
+{
+    void exit(int);
+    int printf(const char*, ...);
+}
+
+struct X()
+{
+  static this()
+  {
+     printf("this()\n");
+  }
+  static ~this()
+  {
+     printf("~this()\n");
+     exit(0);
+  }
+}
+
+static ~this()
+{
+     printf("g: ~this()\n");
+}
+
+int main() { alias X!() x; return 1; }
diff --git a/gcc/testsuite/gdc.test/runnable/test5305.d b/gcc/testsuite/gdc.test/runnable/test5305.d
new file mode 100644
index 00000000000..e1c274d31ca
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test5305.d
@@ -0,0 +1,7 @@
+// https://issues.dlang.org/show_bug.cgi?id=5305
+
+import std.math;
+void map(real function(real) f) { }
+int main() { map(&sqrt); return 0; }
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/test57.d b/gcc/testsuite/gdc.test/runnable/test57.d
new file mode 100644
index 00000000000..8c2b66294af
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test57.d
@@ -0,0 +1,10 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test57a.d imports/test57b.d
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -inline -release
+
+module test57;
+import imports.test57a;
+
+void main() {}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test58.d b/gcc/testsuite/gdc.test/runnable/test58.d
new file mode 100644
index 00000000000..baad59793c3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test58.d
@@ -0,0 +1,9 @@
+// EXTRA_SOURCES: imports/test58a.d
+// PERMUTE_ARGS:
+
+import imports.test58a;
+
+void main()
+{
+    foo!(long)();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test5943.d b/gcc/testsuite/gdc.test/runnable/test5943.d
new file mode 100644
index 00000000000..0d6619872d7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test5943.d
@@ -0,0 +1,77 @@
+// test that the import of std.math is not needed
+
+__gshared uint x0 = 0;
+__gshared uint x1 = 1;
+__gshared uint x2 = 2;
+__gshared uint x3 = 3;
+__gshared uint x4 = 4;
+__gshared uint x5 = 5;
+__gshared uint x6 = 6;
+__gshared uint x7 = 7;
+__gshared uint x10 = 10;
+__gshared uint x15 = 15;
+__gshared uint x31 = 31;
+__gshared uint x32 = 32;
+
+void main()
+{
+    assert(2 ^^ x0 == 1);
+    assert(2 ^^ x1 == 2);
+    assert(2 ^^ x31 == 0x80000000);
+    assert(4 ^^ x0 == 1);
+    assert(4 ^^ x1 == 4);
+    assert(4 ^^ x15 == 0x40000000);
+    assert(8 ^^ x0 == 1);
+    assert(8 ^^ x1 == 8);
+    assert(8 ^^ x10 == 0x40000000);
+    assert(16 ^^ x0 == 1);
+    assert(16 ^^ x1 == 16);
+    assert(16 ^^ x7 == 0x10000000);
+    assert(32 ^^ x0 == 1);
+    assert(32 ^^ x1 == 32);
+    assert(32 ^^ x6 == 0x40000000);
+    assert(64 ^^ x0 == 1);
+    assert(64 ^^ x1 == 64);
+    assert(64 ^^ x5 == 0x40000000);
+    assert(128 ^^ x0 == 1);
+    assert(128 ^^ x1 == 128);
+    assert(128 ^^ x4 == 0x10000000);
+    assert(256 ^^ x0 == 1);
+    assert(256 ^^ x1 == 256);
+    assert(256 ^^ x3 == 0x1000000);
+    assert(512 ^^ x0 == 1);
+    assert(512 ^^ x1 == 512);
+    assert(512 ^^ x3 == 0x8000000);
+    assert(1024 ^^ x0 == 1);
+    assert(1024 ^^ x1 == 1024);
+    assert(1024 ^^ x3 == 0x40000000);
+    assert(2048 ^^ x0 == 1);
+    assert(2048 ^^ x1 == 2048);
+    assert(2048 ^^ x2 == 0x400000);
+    assert(4096 ^^ x0 == 1);
+    assert(4096 ^^ x1 == 4096);
+    assert(4096 ^^ x2 == 0x1000000);
+    assert(8192 ^^ x0 == 1);
+    assert(8192 ^^ x1 == 8192);
+    assert(8192 ^^ x2 == 0x4000000);
+    assert(16384 ^^ x0 == 1);
+    assert(16384 ^^ x1 == 16384);
+    assert(16384 ^^ x2 == 0x10000000);
+    assert(32768 ^^ x0 == 1);
+    assert(32768 ^^ x1 == 32768);
+    assert(32768 ^^ x2 == 0x40000000);
+    assert(65536 ^^ x0 == 1);
+    assert(65536 ^^ x1 == 65536);
+    assert(131072 ^^ x0 == 1);
+    assert(131072 ^^ x1 == 131072);
+    assert(262144 ^^ x0 == 1);
+    assert(262144 ^^ x1 == 262144);
+    assert(524288 ^^ x0 == 1);
+    assert(524288 ^^ x1 == 524288);
+    assert(1048576 ^^ x0 == 1);
+    assert(1048576 ^^ x1 == 1048576);
+    assert(2097152 ^^ x0 == 1);
+    assert(2097152 ^^ x1 == 2097152);
+    assert(4194304 ^^ x0 == 1);
+    assert(4194304 ^^ x1 == 4194304);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test60.d b/gcc/testsuite/gdc.test/runnable/test60.d
new file mode 100644
index 00000000000..e55f05c1e66
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test60.d
@@ -0,0 +1,22 @@
+import std.stdio;
+import std.algorithm;
+
+void test1()
+{
+    int[] a = [1,2,3,4,5];
+    writeln( remove!("a < 3")(a) );
+}
+
+void test2()
+{
+    auto arr = [1,2,3,4,5];
+    auto m = map!"a + 1"(filter!"a < 4"(arr));
+}
+
+void main()
+{
+    test1();
+    test2();
+
+    writeln("Success");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test61.d b/gcc/testsuite/gdc.test/runnable/test61.d
new file mode 100644
index 00000000000..6e097699127
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test61.d
@@ -0,0 +1,11 @@
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: imports/test61a.d
+
+// Bugzilla 6556
+
+debug=BUG;
+
+void main() {
+    debug(BUG) import imports.test61a;
+    assert(bar() == 12);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test6423.d b/gcc/testsuite/gdc.test/runnable/test6423.d
new file mode 100644
index 00000000000..2ea23db33b7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test6423.d
@@ -0,0 +1,24 @@
+
+bool flag;
+
+void f()
+{
+}
+
+void main()
+{
+    if (!flag)
+    {
+        flag = true;
+        caller();
+    }
+    return f();
+}
+
+alias maintype = extern(C) int function();
+
+void caller()
+{
+    auto fp = cast(maintype)&main;
+    assert(fp() == 0);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test7.d b/gcc/testsuite/gdc.test/runnable/test7.d
new file mode 100644
index 00000000000..d3d4909f178
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test7.d
@@ -0,0 +1,734 @@
+// PERMUTE_ARGS:
+
+// Test memset style array assignments.
+
+extern(C) int printf(const char*, ...);
+
+/**************************************/
+
+char[] b1;
+
+char[] func1(int dim)
+{
+    char[] a = new char[dim];
+
+    b1 = a;
+    return a;
+}
+
+void test1()
+{
+    printf("test1()\n");
+    int i;
+    int j;
+
+    char[1] a1;
+    a1[] = 'x';
+    assert(a1[0] == 'x');
+
+    char[2] a2;
+    a2[] = 'x';
+    for (i = 0; i < a2.length; i++)
+        assert(a2[i] == 'x');
+
+    char[3] a3;
+    a3[] = 'x';
+    for (i = 0; i < a3.length; i++)
+        assert(a3[i] == 'x');
+
+    char[4] a4;
+    a4[] = 'x';
+    for (i = 0; i < a4.length; i++)
+        assert(a4[i] == 'x');
+
+    char[8] a8;
+    a8[] = 'x';
+    for (i = 0; i < a8.length; i++)
+        assert(a8[i] == 'x');
+
+    char[27] a27;
+    a27[] = 'x';
+    for (i = 0; i < a27.length; i++)
+        assert(a27[i] == 'x');
+
+    func1(33)[] = 'y';
+    for (i = 0; i < b1.length; i++)
+        assert(b1[i] == 'y');
+
+
+    char[23] a23 = 'x';
+    i = 16;
+    j = 18;
+    a23[i++..++j] = 'c';
+    printf("i = %d, j = %d\n", i, j);
+    assert(i == 17);
+    assert(j == 19);
+    assert(a23[15] == 'x');
+    assert(a23[16] == 'c');
+    assert(a23[17] == 'c');
+    assert(a23[18] == 'c');
+    assert(a23[19] == 'x');
+    assert(a23[20] == 'x');
+}
+
+/**************************************/
+
+short[] b2;
+
+short[] func2(int dim)
+{
+    short[] a = new short[dim];
+
+    b2 = a;
+    return a;
+}
+
+void test2()
+{
+    printf("test2()\n");
+    int i;
+    int j;
+
+    short[1] a1;
+    a1[] = 0x1234;
+    assert(a1[0] == 0x1234);
+
+    short[2] a2;
+    a2[] = 0x1234;
+    for (i = 0; i < a2.length; i++)
+        assert(a2[i] == 0x1234);
+
+    short[3] a3;
+    a3[] = 0x1234;
+    for (i = 0; i < a3.length; i++)
+        assert(a3[i] == 0x1234);
+
+    short[4] a4;
+    a4[] = 0x1234;
+    for (i = 0; i < a4.length; i++)
+        assert(a4[i] == 0x1234);
+
+    short[8] a8;
+    a8[] = 0x1234;
+    for (i = 0; i < a8.length; i++)
+        assert(a8[i] == 0x1234);
+
+    short[27] a27;
+    a27[] = 0x1234;
+    for (i = 0; i < a27.length; i++)
+        assert(a27[i] == 0x1234);
+
+    func2(33)[] = 0x5678;
+    for (i = 0; i < b2.length; i++)
+        assert(b2[i] == 0x5678);
+
+
+    short[23] a23 = 0x1234;
+    i = 16;
+    j = 18;
+    a23[i++..++j] = 0x4554;
+    printf("i = %d, j = %d\n", i, j);
+    assert(i == 17);
+    assert(j == 19);
+    assert(a23[15] == 0x1234);
+    assert(a23[16] == 0x4554);
+    assert(a23[17] == 0x4554);
+    assert(a23[18] == 0x4554);
+    assert(a23[19] == 0x1234);
+    assert(a23[20] == 0x1234);
+}
+
+/**************************************/
+
+int[] b3;
+
+int[] func3(int dim)
+{
+    int[] a = new int[dim];
+
+    b3 = a;
+    return a;
+}
+
+void test3()
+{
+    printf("test3()\n");
+    int i;
+    int j;
+
+    int[1] a1;
+    a1[] = 0x12345678;
+    assert(a1[0] == 0x12345678);
+
+    int[2] a2;
+    a2[] = 0x12345678;
+    for (i = 0; i < a2.length; i++)
+        assert(a2[i] == 0x12345678);
+
+    int[3] a3;
+    a3[] = 0x12345678;
+    for (i = 0; i < a3.length; i++)
+        assert(a3[i] == 0x12345678);
+
+    int[4] a4;
+    a4[] = 0x12345678;
+    for (i = 0; i < a4.length; i++)
+        assert(a4[i] == 0x12345678);
+
+    int[8] a8;
+    a8[] = 0x12345678;
+    for (i = 0; i < a8.length; i++)
+        assert(a8[i] == 0x12345678);
+
+    int[27] a27;
+    a27[] = 0x12345678;
+    for (i = 0; i < a27.length; i++)
+        assert(a27[i] == 0x12345678);
+
+    func3(33)[] = 0x56781234;
+    for (i = 0; i < b3.length; i++)
+        assert(b3[i] == 0x56781234);
+
+
+    int[23] a23 = 0x12345678;
+    i = 16;
+    j = 18;
+    a23[i++..++j] = 0x45546776;
+    printf("i = %d, j = %d\n", i, j);
+    assert(i == 17);
+    assert(j == 19);
+    assert(a23[15] == 0x12345678);
+    assert(a23[16] == 0x45546776);
+    assert(a23[17] == 0x45546776);
+    assert(a23[18] == 0x45546776);
+    assert(a23[19] == 0x12345678);
+    assert(a23[20] == 0x12345678);
+}
+
+/**************************************/
+
+long[] b4;
+
+long[] func4(int dim)
+{
+    long[] a = new long[dim];
+
+    b4 = a;
+    return a;
+}
+
+void test4()
+{
+    printf("test4()\n");
+    int i;
+    int j;
+
+    long[1] a1;
+    a1[] = 0x123456789ABCDEF0;
+    assert(a1[0] == 0x123456789ABCDEF0);
+
+    long[2] a2;
+    a2[] = 0x123456789ABCDEF0;
+    for (i = 0; i < a2.length; i++)
+        assert(a2[i] == 0x123456789ABCDEF0);
+
+    long[3] a3;
+    a3[] = 0x123456789ABCDEF0;
+    for (i = 0; i < a3.length; i++)
+        assert(a3[i] == 0x123456789ABCDEF0);
+
+    long[4] a4;
+    a4[] = 0x123456789ABCDEF0;
+    for (i = 0; i < a4.length; i++)
+        assert(a4[i] == 0x123456789ABCDEF0);
+
+    long[8] a8;
+    a8[] = 0x123456789ABCDEF0;
+    for (i = 0; i < a8.length; i++)
+        assert(a8[i] == 0x123456789ABCDEF0);
+
+    long[27] a27;
+    a27[] = 0x123456789ABCDEF0;
+    for (i = 0; i < a27.length; i++)
+        assert(a27[i] == 0x123456789ABCDEF0);
+
+    func4(33)[] = 0x5678889911223344;
+    for (i = 0; i < b4.length; i++)
+        assert(b4[i] == 0x5678889911223344);
+
+
+    long[23] a23 = 0x123456789ABCDEF0;
+    i = 16;
+    j = 18;
+    a23[i++..++j] = 0x567888991122334B;
+    printf("i = %d, j = %d\n", i, j);
+    assert(i == 17);
+    assert(j == 19);
+    assert(a23[15] == 0x123456789ABCDEF0);
+    assert(a23[16] == 0x567888991122334B);
+    assert(a23[17] == 0x567888991122334B);
+    assert(a23[18] == 0x567888991122334B);
+    assert(a23[19] == 0x123456789ABCDEF0);
+    assert(a23[20] == 0x123456789ABCDEF0);
+}
+
+/**************************************/
+
+real[] b5;
+
+real[] func5(int dim)
+{
+    real[] a = new real[dim];
+
+    b5 = a;
+    return a;
+}
+
+void test5()
+{
+    printf("test5()\n");
+    int i;
+    int j;
+
+    real[1] a1;
+    a1[] = 31234;
+    assert(a1[0] == 31234);
+
+    real[2] a2;
+    a2[] = 31234;
+    for (i = 0; i < a2.length; i++)
+        assert(a2[i] == 31234);
+
+    real[3] a3;
+    a3[] = 31234;
+    for (i = 0; i < a3.length; i++)
+        assert(a3[i] == 31234);
+
+    real[4] a4;
+    a4[] = 31234;
+    for (i = 0; i < a4.length; i++)
+        assert(a4[i] == 31234);
+
+    real[8] a8;
+    a8[] = 31234;
+    for (i = 0; i < a8.length; i++)
+        assert(a8[i] == 31234);
+
+    real[27] a27;
+    a27[] = 31234;
+    for (i = 0; i < a27.length; i++)
+        assert(a27[i] == 31234);
+
+    func5(33)[] = 35678;
+    for (i = 0; i < b5.length; i++)
+        assert(b5[i] == 35678);
+
+
+    real[23] a23 = 31234;
+    i = 16;
+    j = 18;
+    a23[i++..++j] = 34554e+4;
+    printf("i = %d, j = %d\n", i, j);
+    assert(i == 17);
+    assert(j == 19);
+    assert(a23[15] == 31234);
+    assert(a23[16] == 34554e+4);
+    assert(a23[17] == 34554e+4);
+    assert(a23[18] == 34554e+4);
+    assert(a23[19] == 31234);
+    assert(a23[20] == 31234);
+}
+
+/**************************************/
+
+struct ABC
+{
+    int a,b,c,d;
+}
+
+ABC abc1 = { a:1, b:2, c:3, d:4 };
+ABC abc2 = { a:7, b:6, c:8, d:9 };
+ABC abc3 = { a:5, b:10, c:11, d:12 };
+
+ABC[] b6;
+
+ABC[] func6(int dim)
+{
+    ABC[] a = new ABC[dim];
+
+    b6 = a;
+    return a;
+}
+
+void test6()
+{
+    printf("test6()\n");
+    int i;
+    int j;
+
+    ABC[1] a1;
+    a1[] = abc1;
+    assert(a1[0] == abc1);
+
+    ABC[2] a2;
+    a2[] = abc1;
+    for (i = 0; i < a2.length; i++)
+        assert(a2[i] == abc1);
+
+    ABC[3] a3;
+    a3[] = abc1;
+    for (i = 0; i < a3.length; i++)
+        assert(a3[i] == abc1);
+
+    ABC[4] a4;
+    a4[] = abc1;
+    for (i = 0; i < a4.length; i++)
+        assert(a4[i] == abc1);
+
+    ABC[8] a8;
+    a8[] = abc1;
+    for (i = 0; i < a8.length; i++)
+        assert(a8[i] == abc1);
+
+    ABC[27] a27;
+    a27[] = abc1;
+    for (i = 0; i < a27.length; i++)
+        assert(a27[i] == abc1);
+
+    func6(33)[] = abc2;
+    for (i = 0; i < b6.length; i++)
+        assert(b6[i] == abc2);
+
+
+    ABC[23] a23 = abc1;
+    i = 16;
+    j = 18;
+    a23[i++..++j] = abc3;
+    printf("i = %d, j = %d\n", i, j);
+    assert(i == 17);
+    assert(j == 19);
+    assert(a23[15] == abc1);
+    assert(a23[16] == abc3);
+    assert(a23[17] == abc3);
+    assert(a23[18] == abc3);
+    assert(a23[19] == abc1);
+    assert(a23[20] == abc1);
+}
+
+/**************************************/
+
+bool[] b7;
+
+bool[] func7(int dim)
+{
+    bool[] a = new bool[dim];
+
+    b7 = a;
+    return a;
+}
+
+void test7()
+{
+    printf("test7()\n");
+    int i;
+    int j;
+
+    bool[1] a1;
+    a1[] = 1;
+    assert(a1[0] == 1);
+
+    bool[2] a2;
+    a2[] = 1;
+    for (i = 0; i < a2.length; i++)
+        assert(a2[i] == 1);
+
+    bool[3] a3;
+    a3[] = 1;
+    for (i = 0; i < a3.length; i++)
+        assert(a3[i] == 1);
+
+    bool[4] a4;
+    a4[] = 1;
+    for (i = 0; i < a4.length; i++)
+        assert(a4[i] == 1);
+
+    bool[8] a8;
+    a8[] = 1;
+    for (i = 0; i < a8.length; i++)
+        assert(a8[i] == 1);
+
+    bool[27] a27;
+    a27[] = 1;
+    for (i = 0; i < a27.length; i++)
+        assert(a27[i] == 1);
+
+    func7(33)[] = 1;
+    assert(b7.length == 33);
+    for (i = 0; i < b7.length; i++)
+        assert(b7[i] == 1);
+
+    func7(33)[3..6] = 1;
+    //printf("b7.ptr = %p, b7.length = %d\n", b7.ptr, b7.length);
+    assert(b7.length == 33);
+    for (i = 0; i < b7.length; i++)
+    {
+        //printf("b7[%d] = %d\n", i, b7[i]);
+        if (i >= 3 && i < 6)
+            assert(b7[i] == 1);
+        else
+            assert(b7[i] == 0);
+    }
+
+    bool[23] a23 = 1;
+    i = 16;
+    j = 18;
+    a23[i++..++j] = 0;
+    printf("i = %d, j = %d\n", i, j);
+    assert(i == 17);
+    assert(j == 19);
+    assert(a23[15] == 1);
+    assert(a23[16] == 0);
+    assert(a23[17] == 0);
+    assert(a23[18] == 0);
+    assert(a23[19] == 1);
+    assert(a23[20] == 1);
+
+}
+
+/**************************************/
+
+bool[] slice8(bool[] b)
+{
+    return b[8..16];
+}
+
+void test8()
+{
+    bool[16] b;
+    bool[] b2;
+    b[9] = true;
+    b2 = slice8(b);
+    assert(b2.length == 8);
+    assert(b2[1] == true);
+    b[9] = false;
+    assert(b2[1] == false);
+}
+
+
+/**************************************/
+
+bool[] slice9(bool[] b, int i, int j)
+{
+    return b[i..j];
+}
+
+void test9()
+{
+    bool[17] b;
+    bool[] b2;
+    b[9] = true;
+    b[16] = true;
+    b2 = slice9(b,8,17);
+    assert(b2.length == 9);
+    assert(b2[1] == true);
+    assert(b2[8] == true);
+    b[9] = false;
+    b[16] = false;
+    assert(b2[1] == false);
+    assert(b2[8] == false);
+}
+
+
+/**************************************/
+
+bool* foo10(bool[] b, int i)
+{
+    return &b[i];
+}
+
+void test10()
+{
+    bool[17] b;
+    bool* pb;
+
+    b[8] = true;
+    b[9] = true;
+    pb = foo10(b, 8);
+    assert(*pb == true);
+    b[8] = false;
+    assert(*pb == false);
+}
+
+/**************************************/
+
+bool* foo11(bool[] b, int i)
+{
+    return &b[i];
+}
+
+void test11()
+{
+    bool[17] b;
+    bool* pb;
+
+    b[9] = true;
+    b[10] = true;
+    pb = foo11(b, 8);
+    assert(pb[1] == true);
+    b[9] = false;
+    assert(pb[1] == false);
+}
+
+
+/**************************************/
+
+bool* foo12(bool[] b, int i)
+{
+    return &b[i];
+}
+
+void test12()
+{
+    bool[17] b;
+    bool* pb;
+
+    b[9] = true;
+    b[10] = true;
+    pb = foo12(b, 0);
+    pb = pb + 8;
+    assert(pb[1] == true);
+    b[9] = false;
+    assert(pb[1] == false);
+}
+
+/**************************************/
+
+bool* foo13(bool* b, int i)
+{
+    return &b[i];
+}
+
+void test13()
+{
+    bool[17] b;
+    bool* pb;
+
+    b[9] = true;
+    b[10] = true;
+    pb = foo13(b.ptr, 8);
+    assert(pb[1] == true);
+    b[9] = false;
+    assert(pb[1] == false);
+}
+
+/**************************************/
+
+void test14()
+{
+    bool b = true;
+    assert(b);
+    b = !b;
+    assert(!b);
+}
+
+/**************************************/
+
+void test15()
+{
+   bool b = 1;
+   bool *pb = &b;
+   *pb = false;
+   assert(!b);
+}
+
+
+/**************************************/
+
+void foo16(bool[] b1, bool[] b2)
+{
+    b1[0..3] = b2[8..11];
+}
+
+void test16()
+{
+    static bool[16] b1 = [1,1,0,1,0,0,0,0];
+    static bool[16] b2 = [0,0,0,0,0,0,0,0, 0,0,1,0,1,1,1,1];
+
+    foo16(b1, b2);
+    assert(b1[0] == false);
+    assert(b1[1] == false);
+    assert(b1[2] == true);
+    assert(b1[3] == true);
+    assert(b1[4] == false);
+    assert(b1[5] == false);
+    assert(b1[6] == false);
+    assert(b1[7] == false);
+    assert(b1[8] == false);
+}
+
+/**************************************/
+
+void test17()
+{
+  bool bi = true;
+  byte by;
+
+  by=bi;
+  assert(by == 1);
+}
+
+
+/**************************************/
+
+void test18()
+{
+    bool b = 1;
+    bool c = 1;
+    b |= cast(bool)(3 + c);
+    assert(b == true);
+}
+
+
+/**************************************/
+
+void test19()
+{
+        int i;
+        for (i = 0; i < 10; i++){
+                version(dummy) i=22;
+        }
+        assert(i==10);
+
+        char[][] args;
+        foreach(char[] p; args){
+                version(dummy) int i;
+        }
+}
+
+/**************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test7452.d b/gcc/testsuite/gdc.test/runnable/test7452.d
new file mode 100644
index 00000000000..cc0452907d6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test7452.d
@@ -0,0 +1,75 @@
+import core.stdc.stdio : printf;
+
+//------------------------------------------------------------------------------
+
+T enforce7452(T, string file = __FILE__, size_t line = __LINE__)
+    (T value, lazy const(char)[] msg = null) @safe pure
+{
+    if (!value)
+        throw new Exception(msg ? msg.idup : "Enforcement failed", file, line);
+    return value;
+}
+
+int f7452()(int x)
+{
+   enforce7452(x > 0);
+   return x;
+}
+void g7452() @safe pure
+{
+   assert(4 == f7452(4));
+}
+
+//------------------------------------------------------------------------------
+
+void e7452b(int, lazy int) pure nothrow @safe {}
+int f7452b()(int x)
+{
+   e7452b(x, 0);
+   return x;
+}
+void g7452b() pure nothrow @safe
+{
+   assert(4 == f7452b(4));
+}
+
+//------------------------------------------------------------------------------
+
+int f7452c()(int x)
+{
+   auto y = function int() { return 0; };
+   return x;
+}
+void g7452c() pure nothrow @safe
+{
+   assert(4 == f7452c(4));
+}
+
+//------------------------------------------------------------------------------
+
+auto f6332a()() { return 1; }
+int f6332b()() { return 1; }
+
+alias f6332a!() F6332a;
+
+void g6332() pure nothrow @safe
+{
+    auto x = f6332b();
+    auto y = f6332a();
+    assert(x == y);
+}
+
+//------------------------------------------------------------------------------
+
+int main()
+{
+    g7452();
+    g7452b();
+    g7452c();
+    g6332();
+
+    printf("Success\n");
+    return 0;
+}
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/test7453.d b/gcc/testsuite/gdc.test/runnable/test7453.d
new file mode 100644
index 00000000000..7dd35655b73
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test7453.d
@@ -0,0 +1,14 @@
+struct S
+{
+    int opApply(int delegate(string) dg)
+    {
+        return 0;
+    }
+}
+void main()
+{
+    foreach (_; S())
+    {
+        return;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test7494.d b/gcc/testsuite/gdc.test/runnable/test7494.d
new file mode 100644
index 00000000000..655d00a9ffa
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test7494.d
@@ -0,0 +1,20 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test7494a.d
+// PERMUTE_ARGS:
+// REQUIRED_ARGS:
+
+module test7494;
+
+void main()
+{
+    import imports.test7494a : map;             // selective
+    import imports.test7494a : put = writeln;   // selective + rename
+    auto r = map!(a=>a)([1,2,3]);
+    assert(r == [4,5,6]);
+    put(r);
+    static assert(!__traits(compiles, foo()));
+
+    import core.bitop : bsr;
+    // ^ or just any selective import statements
+    bsr(1);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test7511.d b/gcc/testsuite/gdc.test/runnable/test7511.d
new file mode 100644
index 00000000000..0d19f5466dd
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test7511.d
@@ -0,0 +1,421 @@
+extern(C) int printf(const char*, ...);
+
+/**********************************/
+// 7511
+
+struct S7511(T)
+{
+    // this is a pure function for T==int
+    T foo(T x)
+    {
+        return 2 * x;
+    }
+}
+
+void test7511a() pure
+{
+    S7511!int s;
+    s.foo(2); // error -> OK
+}
+
+/**********************************/
+// certain case - wrapper range
+
+//import std.range;
+@property bool empty(T)(in T[] a) { return !a.length; }
+@property ref T front(T)(T[] a) { return a[0]; }
+void popFront(T)(ref T[] a) { a = a[1 .. $]; }
+
+struct S(T)
+{
+    int foo()
+    {
+        auto t = T();
+        return t.bar();
+    }
+}
+
+struct Wrap(R)
+{
+    R original;
+    this(T : R)(T t) { original = t; }
+    this(A...)(A args) { original = R(args); }
+    @property auto empty() { return original.empty; }
+    @property auto front() { return original.front; }
+    void popFront() { original.popFront(); }
+}
+
+void test7511b() pure @safe
+{
+    static struct Iota
+    {
+        size_t curr;
+        size_t max;
+        @property bool empty() pure @safe { return curr == max; }
+        @property size_t front() pure @safe { return curr; }
+        void popFront() pure @safe { ++curr; }
+    }
+    {
+        auto a = Iota(0, 3);
+        size_t i = 0;
+        foreach (e; a) { assert(e == i++); } // OK
+    }
+    {
+        auto a = Wrap!(int[])([0,1,2]);
+        size_t i = 0;
+        foreach (e; a) { assert(e == i++); } // errors!
+    }
+    {
+        auto a = Wrap!Iota(0, 3);
+        size_t i = 0;
+        foreach (e; a) { assert(e == i++); } // errors!
+    }
+}
+
+/**********************************/
+// with attribute inheritance
+
+struct X
+{
+    static int bar() pure nothrow @safe
+    {
+        return 1;
+    }
+}
+
+class Class(T)
+{
+    int foo()
+    {   // inferred to pure nothrow @safe
+        return T.bar();
+    }
+}
+
+alias Class!X C;
+
+class D : C
+{
+    override int foo()
+    {   // inherits attributes from Class!X.foo
+        return 2;
+    }
+}
+
+void test7511c() pure nothrow @safe
+{
+// Disabled for Bigzilla 9952
+/+
+    assert((new C()).foo() == 1);
+    assert((new D()).foo() == 2);
+    static assert(typeof(&C.init.foo).stringof == "int delegate() pure nothrow @safe");
+    static assert(typeof(&D.init.foo).stringof == "int delegate() pure nothrow @safe");
++/
+}
+
+/**********************************/
+// curiously recurring template pattern (CRTP)
+
+class BX(T, bool mutual)
+{
+    int foo()
+    {
+        static if (mutual)
+            return (cast(T)this).foo();
+        else
+            return 0;
+    }
+}
+
+class D1 : BX!(D1, true)
+{
+    alias typeof(super) B;
+    int val;
+    this(int n) { val = n; }
+    override int foo() { return val; }
+}
+class D2 : BX!(D2, false)
+{
+    alias typeof(super) B;
+    int val;
+    this(int n) { val = n; }
+    override int foo() { return val; }
+}
+class D3 : BX!(D3, true)
+{
+    alias typeof(super) B;
+    int val;
+    this(int n) { val = n; }
+    override int foo() pure nothrow { return val; }
+}
+class D4 : BX!(D4, false)
+{
+    alias typeof(super) B;
+    int val;
+    this(int n) { val = n; }
+    override int foo() pure nothrow { return val; }
+}
+
+void test7511d()
+{
+// Disabled for Bigzilla 9952
+/+
+    // mutual dependent and attribute inference impure, un-@safe, and may throw is default.
+    auto d1 = new D1(10);
+    static assert(is(typeof(&d1.B.foo) == int function()));
+    static assert(is(typeof(&d1.foo) == int delegate()));
+    assert(d1.foo() == 10);
+
+    // no mutual dependent.
+    auto d2 = new D2(10);
+    static assert(is(typeof(&d2.B.foo) == int function() pure nothrow @safe));
+    static assert(is(typeof(&d2  .foo) == int delegate() pure nothrow @safe));
+    assert(d2.foo() == 10);
+
+    // mutual dependent with explicit attribute specification.
+    auto d3 = new D3(10);
+    static assert(is(typeof(&d3.B.foo) == int function() pure nothrow));
+    static assert(is(typeof(&d3  .foo) == int delegate() pure nothrow));
+    assert(d3.foo() == 10);
+
+    // no mutual dependent with explicit attribute specification.
+    auto d4 = new D4(10);
+    static assert(is(typeof(&d4.B.foo) == int function() pure nothrow @safe));
+    static assert(is(typeof(&d4  .foo) == int delegate() pure nothrow @safe));
+    assert(d4.foo() == 10);
++/
+}
+
+/**********************************/
+// 9952
+
+@system void writeln9952(int) {}    // impure throwable
+
+class C9952(T)
+{
+    T foo()
+    {
+        return 2;
+    }
+}
+
+class D9952 : C9952!int
+{
+    override int foo()
+    {
+        writeln9952(super.foo());
+        return 3;
+    }
+}
+
+void test9952()
+{
+    static assert(typeof(&C9952!int.init.foo).stringof == "int delegate()");
+    static assert(typeof(&D9952    .init.foo).stringof == "int delegate()");
+}
+
+/**********************************/
+// 10373
+
+template isMutable10373(T)
+{
+    enum isMutable10373 = !is(T == const) && !is(T == immutable) && !is(T == inout);
+}
+
+struct Test10373a(T, int N = 0)
+{
+    static if (N == 0) T[ ] mBuffer;
+    else               T[N] mBuffer;
+
+    static if (is(T == class))
+    {}
+    else
+    {
+        T* at_(size_t n) { return &mBuffer[n]; }
+
+        static if (is(typeof(*at_(0) = T.init)))
+        {
+            T opIndexAssign(T v, size_t i)
+            {
+                return (*at_(i) = v);
+            }
+        }
+    }
+}
+struct Test10373b(T, int N = 0)
+{
+    static if (is(T == class))
+    {}
+    else
+    {
+        T* at_(size_t n) { return &mBuffer[n]; }
+
+        static if (is(typeof(*at_(0) = T.init)))
+        {
+            T opIndexAssign(T v, size_t i)
+            {
+                return (*at_(i) = v);
+            }
+        }
+    }
+
+    static if (N == 0) T[ ] mBuffer;
+    else               T[N] mBuffer;
+}
+struct Test10373c(T, int N = 0)
+{
+    static if (is(T == class))
+    {}
+    else
+    {
+        T* at_(size_t n) { return &mBuffer[n]; }
+
+        static if (isMutable10373!T)
+        {
+            T opIndexAssign(T v, size_t i)
+            {
+                return (*at_(i) = v);
+            }
+        }
+    }
+
+    static if (N == 0) T[ ] mBuffer;
+    else               T[N] mBuffer;
+}
+
+void test10373()
+{
+    static assert(is(Test10373a!(int, 2)));
+    static assert(is(Test10373b!(int, 2)));
+    static assert(is(Test10373c!(int, 2)));
+
+    Test10373a!(int, 2) testa;  // dmd2.062:OK  dmd2.063:OK
+    Test10373b!(int, 2) testb;  // dmd2.062:OK  dmd2.063:NG
+    Test10373c!(int, 2) testc;  // dmd2.062:OK  dmd2.063:OK
+}
+
+/**********************************/
+// 10329
+
+auto foo10329(T)(T arg)
+{
+    auto bar()
+    {
+        return arg;
+    }
+    static assert(is(typeof(&bar) == T delegate() pure nothrow @nogc @safe));
+    return bar();
+}
+
+auto make10329(T)(T arg)
+{
+    struct S
+    {
+        auto front() { return T.init; }
+    }
+    S s;
+    static assert(is(typeof(&s.front) == T delegate() pure nothrow @nogc @safe));
+    return s;
+}
+
+void test10329() pure nothrow @safe
+{
+    assert(foo10329(1) == 1);
+
+    auto s = make10329(1);
+    assert(s.front() == 0);
+}
+
+/**********************************/
+// 11896
+
+class Foo11896a(T = int)
+{
+    static if (!__traits(isVirtualMethod, zoo)) {} else { Undefined x; }
+
+    static void bar() {}
+    static void bar(Foo11896a foo) {}
+
+    static void zoo()
+    {
+        bar(new Foo11896a);
+    }
+}
+Foo11896a!(int) baz11896a;
+
+// ----
+
+Frop11896b!(int) frop11896b;
+
+mixin template baz11896b()
+{
+    public void bar11896b() {}
+}
+
+mixin baz11896b;
+
+class Foo11896b(T)
+{
+    static if (! __traits(isVirtualMethod, zoo)) {}
+
+    static void zoo()
+    {
+        bar11896b();
+    }
+}
+
+class Frop11896b(T) : Foo11896b!T {}
+
+// ----
+
+static bool flag11896c = false;
+
+class Bar11896c {}
+
+class Foo11896c(T = Bar11896c)
+{
+    static if (! __traits(isVirtualMethod, foo)) {}
+    alias Foo11896c!(T) this_type;
+    this()
+    {
+        flag11896c = true;
+    }
+    static public this_type foo()
+    {
+        auto c = new this_type();
+        return flag11896c ? c : null;
+    }
+}
+
+void test11896c()
+{
+    alias Foo11896c!Bar11896c FooBar;
+    assert(FooBar.foo() !is null);
+}
+
+/**********************************/
+// 12392
+
+void f12392(T)() {}
+alias fa12392 = f12392;
+
+void test12392() pure nothrow @safe
+{
+    fa12392!int();
+}
+
+/**********************************/
+
+int main()
+{
+    test7511a();
+    test7511b();
+    test7511c();
+    test7511d();
+    test9952();
+    test10373();
+    test10329();
+    test11896c();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test7595.d b/gcc/testsuite/gdc.test/runnable/test7595.d
new file mode 100644
index 00000000000..bf7eb3177a2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test7595.d
@@ -0,0 +1,26 @@
+// EXTRA_SOURCES: imports/a7595.d
+
+template isSafe(alias func)
+{
+    @safe void dummySafeFunc()
+    {
+        func();
+    }
+
+    enum isSafe = is(typeof(dummySafeFunc()));
+}
+
+template areAllSafe(funcs...)
+{
+    enum areAllSafe = isSafe!(funcs[0]);
+}
+
+@safe benchmark(fun...)(uint n)
+if (areAllSafe!fun)
+{
+    foreach(i, unused; fun)
+    {
+        foreach (j; 0 .. n)
+            fun[i]();
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test7603.d b/gcc/testsuite/gdc.test/runnable/test7603.d
new file mode 100644
index 00000000000..15756c2432b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test7603.d
@@ -0,0 +1,30 @@
+void test7603()
+{
+    int g;
+    void foo(int n, ref int r = g) { r = n; }
+
+    int x;
+    foo(1, x);
+    assert(x == 1);
+
+    foo(2);
+    assert(g == 2);
+
+    int h = 100;
+    void bar(int n, out int r = h) { if (n != 0) r = n;  }
+
+    bar(0);
+    assert(h == 0);
+
+    bar(10);
+    assert(h == 10);
+
+    bar(10, x);
+    assert(x == 10);
+
+    bar(0, x);
+    assert(x == 0);
+
+}
+
+void main() { test7603(); }
diff --git a/gcc/testsuite/gdc.test/runnable/test7618.d b/gcc/testsuite/gdc.test/runnable/test7618.d
new file mode 100644
index 00000000000..c7b76944bb3
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test7618.d
@@ -0,0 +1,17 @@
+interface ITest
+{
+    int foo();
+
+    final void bar(int k)() { assert(foo() == k); }
+}
+
+class Test : ITest
+{
+    override int foo() { return 12; }
+}
+
+void main()
+{
+    auto test = new Test;
+    test.bar!12();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test7932.d b/gcc/testsuite/gdc.test/runnable/test7932.d
new file mode 100644
index 00000000000..245cf178648
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test7932.d
@@ -0,0 +1,31 @@
+// 7932
+
+import std.stdio;
+
+size_t N;
+
+class C
+{
+    protected void f(size_t n)
+    out
+    {
+        printf("out: this=%p &n=%p n=%zu\n",
+                cast(void*) this, &n, n);
+        assert (N == n);
+    }
+    body
+    {
+        int dummy;
+        //printf("\n");
+        N = n;
+        printf("body: this=%p &dummy=%p &N=%p N=%zu\n",
+                cast(void*) this, &dummy, &N, N);
+    }
+}
+
+void main()
+{
+    auto x = new C;
+    x.f(1);
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/test8.d b/gcc/testsuite/gdc.test/runnable/test8.d
new file mode 100644
index 00000000000..932a0cf4ca4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test8.d
@@ -0,0 +1,977 @@
+
+module testxxx8;
+
+import core.vararg;
+
+extern(C)
+{
+    int atoi(const char*);
+    int printf(const char*, ...);
+    size_t strlen(const char*);
+    version(Windows)
+    {
+        int _snprintf(char*, size_t, const char*, ...);
+        alias _snprintf snprintf;
+    }
+    else
+        int snprintf(char*, size_t, const char*, ...);
+}
+
+/***********************************/
+
+struct Foo1
+{
+        static int x = 3;
+        int y = 4;
+}
+
+void test1()
+{
+    Foo1 f;
+
+    assert(Foo1.x == 3);
+    assert(f.x == 3);
+    assert(f.y == 4);
+}
+
+/***********************************/
+
+class Foo2
+{
+        static int x = 5;
+        int y = 6;
+}
+
+void test2()
+{
+    Foo2 f = new Foo2();
+
+    assert(Foo2.x == 5);
+    assert(f.x == 5);
+    assert(f.y == 6);
+}
+
+
+/***********************************/
+
+struct Foo3
+{
+        static int bar() { return 3; }
+        int y = 4;
+}
+
+void test3()
+{
+    Foo3 f;
+
+    assert(Foo3.bar() == 3);
+    assert(f.bar() == 3);
+}
+
+/***********************************/
+
+class Foo4
+{
+        static int bar() { return 3; }
+        int y = 4;
+}
+
+void test4()
+{
+    Foo4 f = new Foo4();
+
+    assert(Foo4.bar() == 3);
+    assert(f.bar() == 3);
+}
+
+
+/***********************************/
+
+struct Foo5
+{
+        int bar() { return y + 3; }
+        int y = 4;
+}
+
+void test5()
+{
+    Foo5 f;
+
+    assert(f.bar() == 7);
+}
+
+/***********************************/
+
+class Foo6
+{
+        int bar() { return y + 3; }
+        final int abc() { return y + 8; }
+        int y = 4;
+}
+
+class FooX6 : Foo6
+{
+        override int bar() { return y + 5; }
+}
+
+void test6()
+{
+    Foo6 f = new FooX6();
+
+    assert(f.bar() == 9);
+    assert(f.abc() == 12);
+}
+
+
+/***********************************/
+
+void bar7(char[3] cad)
+{
+    assert(cad.length == 3);
+    printf("cad[0] = %d\n", cad[0]);
+    assert(cad[0] == 0xFF);
+    assert(cad[1] == 1);
+    assert(cad[2] == 0xFF);
+}
+
+void test7()
+{
+    char[3] foo;
+
+    foo[1] = 1;
+    bar7(foo);
+}
+
+
+/***********************************/
+
+class gap8
+{
+    this(char[3] cad)
+    {
+        assert(cad[0] == 0xFF);
+        assert(cad[1] == 1);
+        assert(cad[2] == 0xFF);
+    }
+}
+
+void test8()
+{
+    char[3] foo;
+    gap8 g;
+
+    foo[1] = 1;
+    g = new gap8(foo);
+}
+
+
+/***********************************/
+
+void test9()
+{
+    ireal imag = 2.5i;
+    //printf ("test of imag*imag = %Lf\n",imag*imag);
+    real f = imag * imag;
+    assert(f == -6.25);
+}
+
+/***********************************/
+
+void test10()
+{
+    creal z = 1 + 2.5i;
+    real e = z.im;
+
+    printf ("e = %Lf\n", e);
+    assert(e == 2.5);
+}
+
+
+/***********************************/
+
+class Foo11
+{
+  public:
+    int a = 47;
+
+  protected:
+    int b;
+
+  private:
+    int c;
+
+    int bar()
+    {
+        return a + b + c;
+    }
+}
+
+class Bar11 : Foo11
+{
+    int abc()
+    {
+        return a + b;
+    }
+}
+
+void test11()
+{
+    Foo11 f = new Foo11();
+
+    int i = f.a;
+    assert(i == 47);
+}
+
+/***********************************/
+
+class A12
+{
+    protected void foo() { }
+}
+
+class B12: A12
+{
+    override void foo() { super.foo(); }
+}
+
+void test12()
+{
+}
+
+/***********************************/
+
+alias void *HWND;
+
+const HWND hWnd = cast(HWND)(null);
+
+void test13()
+{
+}
+
+/***********************************/
+
+string bar14()
+{
+    return "f";
+}
+
+char foo14()
+{
+    return bar14()[0];
+}
+
+void test14()
+{
+    char f = foo14();
+    assert(f == 'f');
+}
+
+
+/***********************************/
+
+void test15()
+{
+        char[30] a;
+        char[30] b;
+
+        assert(a !is b);
+}
+
+/***********************************/
+
+void test16()
+{
+    static int function() fp = &func16;
+    int i = fp();
+    assert(i == 648);
+}
+
+int func16()
+{
+    return 648;
+}
+
+
+/***********************************/
+
+string returnSameString(string inputstr)
+{
+    return inputstr;
+}
+
+string passString()
+{
+    return returnSameString("First string" ~ "Concatenated with second");
+}
+
+string butThisWorks()
+{
+    string s = "Third string";
+    s = s ~ "Concatenated with fourth";
+    return returnSameString(s);
+}
+
+void test17()
+{
+    string s;
+
+    s = passString();
+    printf("passString() = %.*s\n", s.length, s.ptr);
+    assert(s == "First stringConcatenated with second");
+
+    s = butThisWorks();
+    printf("butThisWorks() = %.*s\n", s.length, s.ptr);
+    assert(s == "Third stringConcatenated with fourth");
+}
+
+/***********************************/
+
+
+
+class A20
+{
+    private:
+        static int a;
+
+    public:
+        int foo(B20 j) { return j.b; }
+}
+
+class B20
+{
+    private:
+        static int b;
+
+    public:
+        int bar(A20 j) { return j.a; }
+}
+
+void test20()
+{
+}
+
+/***********************************/
+
+alias int* IP;
+
+void test21()
+{
+    int i = 5;
+    IP ip = cast(IP) &i;
+    assert(*ip == 5);
+}
+
+/***********************************/
+
+struct RECT
+{
+    int    left = 1;
+    int    top = 2;
+    int    right = 3;
+    int    bottom = 4;
+}
+
+struct Rect
+{
+  RECT theRect;
+}
+
+
+void Test(Rect pos)
+{
+    //printf("left = %d\n", pos.theRect.left);
+    assert(pos.theRect.left == 1);
+    assert(pos.theRect.top == 2);
+    assert(pos.theRect.right == 3);
+    assert(pos.theRect.bottom == 4);
+}
+
+class Window
+{
+  Rect position;
+
+  void createWindow()
+  {
+    Test(position);
+  }
+}
+
+void test22()
+{
+    Window w = new Window();
+    w.createWindow();
+}
+
+/***********************************/
+
+struct Size
+{
+  int width;
+  int height;
+}
+
+Size computeSize()
+{
+  Size foo;
+
+  foo.width = 12;
+  foo.height = 34;
+
+  printf("Inside: %d,%d\n",foo.width,foo.height);
+
+  return foo;
+}
+
+
+void test24()
+{
+  Size bar;
+  bar = computeSize();
+
+  printf("Outside: %d,%d\n",bar.width,bar.height);
+  assert(bar.width == 12);
+  assert(bar.height == 34);
+}
+
+/***********************************/
+
+void test25()
+{   int i = 5;
+
+    while (i)
+    {
+        break;
+    }
+}
+
+/***********************************/
+
+int test26()
+in
+{
+}
+out (result)
+{
+}
+body
+{   int i = 5;
+
+    while (i)
+    {
+        break;
+    }
+    return i;
+}
+
+/***********************************/
+
+class A27
+{
+    int a;
+
+    this()
+    {
+        a = 1;
+    }
+}
+
+class B27 : A27
+{
+}
+
+class C27 : B27
+{
+    this()
+    {
+        super();
+    }
+
+    this(int i)
+    {
+    }
+}
+
+void test27()
+{
+    A27 a = new A27();
+    assert(a.a == 1);
+
+    B27 b = new B27();
+    assert(b.a == 1);
+
+    C27 c = new C27();
+    assert(c.a == 1);
+
+    C27 c2 = new C27(2);
+    assert(c2.a == 1);
+}
+
+
+/***********************************/
+
+const char[1] sep = '/';
+
+string testx28(string s, string t)
+{
+    return cast(string)(s ~ sep ~ t);
+}
+
+void test28()
+{
+    string r;
+
+    r = testx28("ab", "cd");
+    assert(r == "ab/cd");
+}
+
+/***********************************/
+
+void test29()
+{
+}
+
+
+/***********************************/
+
+bool func30(int x, int y)
+{
+    bool b;
+    b|=(x==y);
+    return b;
+}
+
+void test30()
+{
+    bool b;
+
+    b = func30(1,1);
+    assert(b == true);
+    b = func30(1,2);
+    assert(b == false);
+}
+
+/***********************************/
+
+int a31;
+
+void test31()
+{
+    testxxx8.a31 = 3;
+    assert(a31 == 3);
+}
+
+/***********************************/
+
+void test32()
+{
+    string[] foo;
+    int i;
+
+    foo = new string[45];
+    for (i = 0; i < 45; i++)
+        foo[i] = "hello";
+    for (i = 0; i < 45; i++)
+        assert(foo[i] == "hello");
+}
+
+
+/***********************************/
+
+void test33()
+{
+    string[] foo;
+    int i = 45;
+
+    foo = new string[i];
+    for (i = 0; i < 45; i++)
+        foo[i] = "hello";
+    for (i = 0; i < 45; i++)
+        assert(foo[i] == "hello");
+}
+
+
+/***********************************/
+
+void test34()
+{
+    int[3][4] a;
+    int[5][6] b = 16;
+    int i, j;
+
+    for (i = 0; i < 4; i++)
+        for (j = 0; j < 3; j++)
+            assert(a[i][j] == 0);
+
+    for (i = 0; i < 6; i++)
+        for (j = 0; j < 5; j++)
+            assert(b[i][j] == 16);
+}
+
+
+/***********************************/
+
+void test35()
+{
+    ifloat b = cast(ifloat)1i;
+    assert(b == 1.0i);
+
+    ifloat c = 2fi;
+    assert(c == 2.0i);
+
+    c = 0fi;
+    assert(c == 0i);
+}
+
+/***********************************/
+
+string itoa(int i)
+{
+    char[32] buffer;
+    snprintf(buffer.ptr, 32, "%d", i);
+    return buffer[0 .. strlen(buffer.ptr)].idup;
+}
+
+string testa36(int i, int j, string a, string b, string c)
+{
+    string s =  "string 0;" ~ itoa(i) ~
+                "string 1;" ~ itoa(j) ~
+                "string 2;" ~ itoa(i) ~
+                "string 3;";
+
+//    string s = a ~ b ~ c;
+    return s;
+}
+
+void test36()
+{
+    string s = testa36(26, 47, "a", "b", "c");
+
+    printf("s = '%.*s'\n", s.length, s.ptr);
+    assert(s == "string 0;26string 1;47string 2;26string 3;");
+}
+
+/***********************************/
+
+void test37()
+{
+    string[ulong] x;
+    ulong v1 = 297321415603;
+    ulong v2 = 331681153971;
+    x[v1] = "aa";
+    printf( "%llx %llx\n", v1, v2 );
+    assert(!(v2 in x));
+}
+
+
+/***********************************/
+
+void test38()
+{
+    int n = atoi("1");
+    static char flags[8192 + 1];
+    long i, k;
+    int count = 0;
+
+    try
+    {
+       while (n--)
+       {
+          count = 0;
+
+          for (i = 2; i <= 8192; i++)
+             flags[cast(size_t)i] = 1;
+
+          for (i = 2; i <= 8192; i++)
+          {
+             if (flags[cast(size_t)i])
+             {
+                for (k = i+i; k <= 8192; k += i)
+                   flags[cast(size_t)k] = 0;
+
+                count++;
+             }
+          }
+       }
+
+       printf("Count: %d\n", count);
+        assert(count == 1028);
+    }
+    catch
+    {
+       printf("Exception: %d\n", k);
+        assert(0);
+    }
+}
+
+
+/***********************************/
+
+interface I39
+{
+}
+
+class C39 : I39
+{
+    int x = 432;
+}
+
+void test39()
+{
+    C39 c = new C39;
+
+    printf("%p %d\n", c, c.x);
+    assert(c.x == 432);
+    printf("%p\n", cast(I39) c);
+    c = cast(C39) cast(I39) c;
+    printf("%p\n", c);
+    assert(c !is null);
+}
+
+
+/***********************************/
+
+void test40()
+{
+       Object x;
+
+       x = null;
+       x = 0 ? x : null;
+       x = 0 ? null : x;
+}
+
+/***********************************/
+
+int foo42(const(char) *x, ...)
+{
+    va_list ap;
+
+    va_start!(typeof(x))(ap, x);
+    //printf("&x = %p, ap = %p\n", &x, ap);     // XBUG: static array va_lists (eg: x86_64) cannot be passed as vararg.
+
+    int i;
+    i = va_arg!(typeof(i))(ap);
+    printf("i = %d\n", i);
+
+    long l;
+    l = va_arg!(typeof(l))(ap);
+    printf("l = %lld\n", l);
+
+    uint k;
+    k = va_arg!(typeof(k))(ap);
+    printf("k = %u\n", k);
+
+    va_end(ap);
+
+    return cast(int)(i + l + k);
+}
+
+void test42()
+{
+    int j;
+
+    j = foo42("hello", 3, 23L, 4);
+    printf("j = %d\n", j);
+    assert(j == 30);
+}
+
+/***********************************/
+
+void test43()
+{
+    creal C,Cj;
+    real y1,x1;
+
+    C = x1 + y1*1i + Cj;
+    C = 1i*y1 + x1 + Cj;
+    C = Cj + 1i*y1 + x1;
+    C = y1*1i + Cj + x1;
+    C = 1i*y1 + Cj;
+    C = Cj + 1i*y1;
+}
+
+/***********************************/
+
+int x44;
+
+class A44 {
+     this() { printf("A44 ctor\n"); x44 += 1; }
+     ~this() { printf("A44 dtor\n"); x44 += 0x100; }
+}
+class B44 : A44 { }
+
+void foo44() { scope B44 b = new B44; }
+
+void test44()
+{
+     printf("foo44...\n");
+     foo44();
+     printf("...foo44\n");
+     assert(x44 == 0x101);
+}
+
+/***********************************/
+
+/*
+import std.stdarg;
+import std.utf;
+
+int unFormat( bool delegate( out dchar ) getc,
+        bool delegate( dchar ) ungetc,
+        TypeInfo[] arguments,
+        void* argptr )
+{
+    size_t  arg = 0;
+    dchar[] fmt;
+
+    if( arguments[arg] is typeid( string ) )
+        fmt = toUTF32( va_arg!(string)( argptr ) );
+    else if( arguments[arg] is typeid( wchar[] ) )
+        fmt = toUTF32( va_arg!(wchar[])( argptr ) );
+    else if( arguments[arg] is typeid( dchar[] ) )
+        fmt = va_arg!(dchar[])( argptr );
+    else
+        return 0;
+}
+*/
+
+void test45()
+{
+}
+
+/***********************************/
+
+int sreadf( ... )
+{
+    va_arg!(string)( _argptr );
+    return 0;
+}
+
+
+void test46()
+{
+    printf( "hello world\n" );
+}
+
+/***********************************/
+
+void test48()
+{
+  try{
+  }finally{
+    debug(p48) { }
+  }
+}
+
+/***********************************/
+
+void test49()
+{
+  int k = 1;
+  if(k == 0)
+    debug{printf("test");}
+}
+
+/***********************************/
+
+void test50()
+{       int x;
+
+        if (x)
+             version (none)
+                 foo;
+}
+
+/***********************************/
+
+/+
+void foo51(creal a)
+{
+  writeln(a);
+  assert(a == -8i);
+}
+
+void test51()
+{
+  cdouble a = (2-2i)*(2-2i);
+
+  // This fails
+  writeln(a);
+  assert(a == -8i);
+
+  // This works
+  writeln((2-2i)*(2-2i));
+
+  // This fails
+  foo51((2-2i)*(2-2i));
+}
++/
+
+void foo51(creal a)
+{
+    assert(a == -8i);
+}
+
+void test51()
+{
+    assert((2-2i)*(2-2i) == -8i);
+
+    cdouble a = (2-2i)*(2-2i);
+    assert(a == -8i);
+
+    foo51((2-2i)*(2-2i));
+}
+
+/***********************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test20();
+    test21();
+    test22();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test48();
+    test49();
+    test50();
+    test51();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test8182.d b/gcc/testsuite/gdc.test/runnable/test8182.d
new file mode 100644
index 00000000000..15364409d60
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test8182.d
@@ -0,0 +1,16 @@
+struct S
+{
+    ~this()
+    {
+        assert(false);
+    }
+}
+
+void lazily(lazy S)
+{
+}
+
+void main()
+{
+    lazily(S());
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test8544.d b/gcc/testsuite/gdc.test/runnable/test8544.d
new file mode 100644
index 00000000000..7c47e867db6
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test8544.d
@@ -0,0 +1,17 @@
+// EXECUTE_ARGS: foo bar doo
+// PERMUTE_ARGS:
+import std.stdio;
+import std.conv;
+import core.runtime;
+
+void main(string[] args)
+{
+    string[] dArgs = Runtime.args;
+    CArgs cArgs = Runtime.cArgs;
+
+    assert(dArgs.length && cArgs.argc);  // ensure we've passed some args
+    assert(dArgs.length == cArgs.argc);
+
+    assert(dArgs[1] == to!string(cArgs.argv[1]));
+    assert(args[1] == to!string(cArgs.argv[1]));
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test8997.d b/gcc/testsuite/gdc.test/runnable/test8997.d
new file mode 100644
index 00000000000..9604e1264f4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test8997.d
@@ -0,0 +1,15 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/test8997a.d
+
+module test8997;
+
+import imports.test8997a;
+
+void main()
+{
+    auto a = new A();
+
+    foreach(key; a.foobar.byKey())
+    {
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test9259.d b/gcc/testsuite/gdc.test/runnable/test9259.d
new file mode 100644
index 00000000000..f870f63a492
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test9259.d
@@ -0,0 +1,13 @@
+// PERMUTE_ARGS: -inline -release -g -O -d -dw -de
+
+void test(int*[] arr...)
+{
+    assert(arr.length == 1);
+    assert(*arr[0] == 5); // This assertion fails
+}
+
+void main()
+{
+    int a = 5;
+    test([&a]);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test9271.d b/gcc/testsuite/gdc.test/runnable/test9271.d
new file mode 100644
index 00000000000..3ce7fc8f189
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test9271.d
@@ -0,0 +1,14 @@
+// PERMUTE_ARGS:
+
+import algorithm = imports.test9271a;
+
+bool any(alias predicate, Range)(Range range)
+{
+    return algorithm.any!(predicate)(range);
+}
+
+void main()
+{
+    auto arr = ["foo"];
+    any!(e => e == "asd")(arr); // infinite recursive call -> OK
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test9309.d b/gcc/testsuite/gdc.test/runnable/test9309.d
new file mode 100644
index 00000000000..60fc0c69de2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test9309.d
@@ -0,0 +1,37 @@
+immutable(T)[] assumeUnique(T)(ref T[] array) pure nothrow
+{
+    auto result = cast(immutable(T)[]) array;
+    array = null;
+    return result;
+}
+
+pure nothrow
+private string escapeShellArguments()
+{
+    char[] buf;
+
+    @safe nothrow
+    char[] allocator(size_t size)
+    {
+        return buf = new char[size];
+    }
+
+    escapeShellArgument!allocator("foo");
+    return assumeUnique(buf);
+}
+
+@safe nothrow
+auto escapeShellArgument(alias allocator)(in char[] arg)
+{
+    auto buf = allocator(4);
+    buf[0] = 'f';
+    buf[1] = 'o';
+    buf[2] = 'o';
+    buf[3] = '\0';
+}
+
+void main()
+{
+    string res = escapeShellArguments();
+    if (res != "foo\0") assert(0);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/test9495.d b/gcc/testsuite/gdc.test/runnable/test9495.d
new file mode 100644
index 00000000000..e8eaad8ed35
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/test9495.d
@@ -0,0 +1,31 @@
+// PERMUTE_ARGS:
+
+import core.vararg;
+
+int func1(int a, ...)
+{
+  auto result = va_arg!int(_argptr);
+  return result;
+}
+
+void test9495a()
+{
+  assert(func1(5, 12345678) == 12345678);
+}
+
+int func2(const(char)[] a, ...)
+{
+  auto result = va_arg!int(_argptr);
+  return result;
+}
+
+void test9495b()
+{
+  assert(func2("5", 12345678) == 12345678);
+}
+
+void main(string[] args)
+{
+  test9495a();
+  test9495b();
+}
\ No newline at end of file
diff --git a/gcc/testsuite/gdc.test/runnable/testaa.d b/gcc/testsuite/gdc.test/runnable/testaa.d
new file mode 100644
index 00000000000..d069e79e820
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testaa.d
@@ -0,0 +1,1385 @@
+// PERMUTE_ARGS: -fPIC
+
+/* Test associative arrays */
+
+extern(C) int printf(const char*, ...);
+extern(C) int memcmp(const void *s1, const void *s2, size_t n);
+
+import core.memory;  // for GC.collect
+import std.random;   // for uniform random numbers
+
+/************************************************/
+
+int nametable[char[]];
+
+void insert(string name, int value)
+{
+    nametable[name] = value;
+}
+
+int retrieve(string name)
+{
+    return nametable[name];
+}
+
+void test1()
+{   int v;
+
+    printf("test1.a\n");
+    insert("hello", 1);
+    printf("test1.b\n");
+    insert("world", 2);
+    printf("test1.c\n");
+    v = retrieve("hello");
+    assert(v == 1);
+    v = retrieve("world");
+    assert(v == 2);
+    v = retrieve("world");
+    assert(v == 2);
+
+    nametable.rehash;
+    v = retrieve("world");
+    assert(v == 2);
+}
+
+/************************************************/
+
+
+void test2()
+{
+    int[string] aa;
+    string[] keys;
+    int[] values;
+
+    printf("test2()\n");
+
+    /*************/
+
+    assert(aa == null);
+    assert(aa.length == 0);
+
+    keys = aa.keys;
+    assert(keys.length == 0);
+
+    values = aa.values;
+    assert(values.length == 0);
+
+    aa.rehash;
+    assert(aa.length == 0);
+
+    /*************/
+
+    aa["hello"] = 3;
+    assert(aa["hello"] == 3);
+    aa["hello"]++;
+    assert(aa["hello"] == 4);
+
+    assert(aa.length == 1);
+
+    keys = aa.keys;
+    assert(keys.length == 1);
+    assert(memcmp(keys[0].ptr, cast(char*)"hello", 5) == 0);
+
+    values = aa.values;
+    assert(values.length == 1);
+    assert(values[0] == 4);
+
+    aa.rehash;
+    assert(aa.length == 1);
+    assert(aa["hello"] == 4);
+}
+
+/************************************************/
+
+void test4()
+{
+    int[const(ubyte)[]] b;
+    const(ubyte)[] x;
+    b[x] = 3;
+    assert(b[x] == 3);
+}
+
+/************************************************/
+
+void test5()
+{
+    int[immutable(short)[]] b;
+    immutable(short)[] x;
+    b[x] = 3;
+    assert(b[x] == 3);
+}
+
+/************************************************/
+
+void test6()
+{
+    int[const(int)[]] b;
+    const(int)[] x;
+    b[x] = 3;
+    assert(b[x] == 3);
+}
+
+/************************************************/
+
+void test7()
+{
+    int[immutable(uint)[]] b;
+    immutable(uint)[] x;
+    b[x] = 3;
+    assert(b[x] == 3);
+}
+
+/************************************************/
+
+void test8()
+{
+    int[immutable(long)[]] b;
+    immutable(long)[] x;
+    b[x] = 3;
+    assert(b[x] == 3);
+}
+
+/************************************************/
+
+void test9()
+{
+    int[immutable(ulong)[]] b;
+    immutable(ulong)[] x;
+    b[x] = 3;
+    assert(b[x] == 3);
+}
+
+/************************************************/
+
+class A10 {}
+
+int[immutable(A10)[]] foo10;
+
+void test10()
+{
+    auto key = new immutable(A10)[2];
+
+    cast()(key[0]) = new A10();
+    foo10[key] = 0;
+    assert(key in foo10);
+    assert(!(key !in foo10));
+}
+
+
+/************************************************/
+
+struct Value
+{
+    uint x,y,z,t;
+}
+
+struct Key
+{
+    int a,b,c,d;
+
+    static int hash, cmp, equals;
+
+    size_t toHash() const
+    {
+        hash = 1;
+        return a + b + c + d;
+    }
+
+    int opCmp(ref const Key s) const
+    {
+        cmp = 1;
+        int x;
+
+        x = a - s.a;
+        if (x == 0)
+        {   x = b - s.b;
+            if (x == 0)
+            {   x = c - s.c;
+                if (x == 0)
+                    x = d - s.d;
+            }
+        }
+        return x;
+    }
+
+    bool opEquals(ref const Key s) const
+    {
+        printf("opEquals()\n");
+        equals = 1;
+        return (a == s.a && b == s.b && c == s.c && d == s.d);
+    }
+}
+
+void test11()
+{
+    Value[Key] table;
+
+    Value* p;
+    Value v;
+    Value r;
+    Key k;
+
+    v.x = 7;
+    v.y = 8;
+    v.z = 9;
+    v.t = 10;
+
+    k.a = 1;
+    k.b = 2;
+    k.c = 3;
+    k.d = 4;
+
+    p = k in table;
+    assert(!p);
+
+    table[k] = v;
+    p = k in table;
+    assert(p);
+
+    table.rehash;
+    p = k in table;
+    assert(p);
+
+    r = table[k];
+    assert(v == r);
+
+    table.remove(k);
+    assert(!(k in table));
+
+    printf("Key.hash = %d\n", Key.hash);
+    assert(Key.hash == 1);
+    printf("Key.cmp = %d\n", Key.cmp);
+    printf("Key.equals = %d\n", Key.equals);
+    assert(Key.cmp == 1 && !Key.equals || !Key.cmp && Key.equals == 1);
+}
+
+
+/************************************************/
+
+struct S12
+{
+    byte number;
+    char[] description;
+    char[] font_face;
+    byte font_size;
+    ushort flags;
+    int colour_back;
+    int colour_fore;
+    byte charset;
+}
+
+void test12()
+{
+    S12[] x;
+    printf("size %d\n",S12.sizeof);
+    printf("align %d\n",S12.alignof);
+    printf("offset %d\n",S12.description.offsetof);
+
+    for (int i=0;i<3;i++) {
+        S12 s;
+        s.font_face="font face".dup;
+        x ~= s;
+    }
+
+/* works fine
+    S12 s;
+    s.font_face="font face".dup;
+    x ~= s;
+    s.font_face="font face".dup;
+    x ~= s;
+    s.font_face="font face".dup;
+    x ~= s;
+    s.font_face="font face".dup;
+    x ~= s;
+*/
+    GC.collect();
+    printf("%.*s\n",x[0].font_face.length,x[0].font_face.ptr);
+    printf("%.*s\n",x[1].font_face.length,x[1].font_face.ptr);
+}
+
+
+/************************************************/
+
+void test13()
+{
+    int[string] array;
+    array["eins"]=1;
+    array["zwei"]=2;
+    array["drei"]=3;
+
+    assert(array.length==3);
+
+    int[string] rehashed=array.rehash;
+    assert(rehashed is array);
+
+    string[] key = array.keys;
+    assert(key.length==3);
+
+    bool have[3];
+
+    assert(!have[0]);
+    assert(!have[1]);
+    assert(!have[2]);
+
+    foreach(string value; key){
+        switch(value){
+            case "eins":{
+                have[0]=true;
+                break;
+            }case "zwei":{
+                have[1]=true;
+                break;
+            }case "drei":{
+                have[2]=true;
+                break;
+            }default:{
+                assert(0);
+            }
+        }
+    }
+
+    assert(have[0]);
+    assert(have[1]);
+    assert(have[2]);
+}
+
+/************************************************/
+
+void test14()
+{
+    int[char[]] aa;
+
+    aa["hello"] = 3;
+    assert(aa["hello"] == 3);
+    assert("hello" in aa);
+    //delete aa["hello"];
+    aa.remove("hello");
+    assert(!("hello" in aa));
+}
+
+/************************************************/
+
+class SomeClass
+{
+    this(char value)
+    {
+        printf("class created\n");
+        _value = value;
+    }
+
+    ~this()
+    {
+        printf("class killed (%d)\n", _value);
+    }
+
+    char value()
+    {
+        return _value;
+    }
+
+    private
+    {
+        char _value;
+    }
+}
+
+char[] allChars = [ 'a', 'b', 'c', 'e', 'z', 'q', 'x' ];
+
+SomeClass[char] _chars;
+
+void _realLoad()
+{
+    printf("Loading...\n");
+    foreach(char ch; allChars)
+    {
+        _chars[ch] = new SomeClass(ch);
+    }
+}
+
+
+
+void test15()
+{
+    _realLoad();
+    int j;
+
+    for (int i = 0; i < 10000; i++)
+    {
+        foreach(char ch; allChars)
+        {
+            SomeClass obj = _chars[ch];
+            j += obj.value;
+        }
+        GC.collect();
+    }
+    printf("j = %d\n", j);
+    assert(j == 7500000);
+}
+
+
+/************************************************/
+
+void test16()
+{
+    int[int] aa;
+
+    Random gen;
+    for (int i = 0; i < 50000; i++)
+    {
+        int key = uniform(0, int.max, gen);
+        int value = uniform(0, int.max, gen);
+
+        aa[key] = value;
+    }
+
+    int[] keys = aa.keys;
+    assert(keys.length == aa.length);
+
+    int j;
+    foreach (k; keys)
+    {
+        assert(k in aa);
+        j += aa[k];
+    }
+    printf("test16 = %d\n", j);
+
+    int m;
+    foreach (k, v; aa)
+    {
+        assert(k in aa);
+        assert(aa[k] == v);
+        m += v;
+    }
+    assert(j == m);
+
+    m = 0;
+    foreach (v; aa)
+    {
+        m += v;
+    }
+    assert(j == m);
+
+    int[] values = aa.values;
+    assert(values.length == aa.length);
+
+    foreach(k; keys)
+    {
+        aa.remove(k);
+    }
+    assert(aa.length == 0);
+
+    for (int i = 0; i < 1000; i++)
+    {
+        int key2 = uniform(0, int.max, gen);
+        int value2 = uniform(0, int.max, gen);
+
+        aa[key2] = value2;
+    }
+    foreach(k; aa)
+    {
+        if (k < 1000)
+            break;
+    }
+    foreach(k, v; aa)
+    {
+        if (k < 1000)
+            break;
+    }
+}
+
+/************************************************/
+
+void dummy17()
+{
+}
+
+int bb17[string];
+
+int foo17()
+{
+    foreach(string s, int i; bb17)
+    {
+        dummy17();
+    }
+
+    bb17["a"] = 1;
+
+    foreach(int b; bb17)
+    {
+        try{
+            throw new Error("foo");
+        }catch(Error e){
+            assert(e);
+            return 0;
+        }catch{
+            assert(0);
+        }
+        assert(0);
+    }
+
+    assert(0);
+}
+
+void test17()
+{
+    int i = foo17();
+    printf("foo17 = %d\n", i);
+    assert(i == 0);
+}
+
+/************************************************/
+
+void test18()
+{
+    int[uint] aa;
+
+    aa[1236448822] = 0;
+    aa[2716102924] = 1;
+    aa[ 315901071] = 2;
+
+    aa.remove(1236448822);
+    printf("%d\n", aa[2716102924]);
+    assert(aa[2716102924] == 1);
+}
+
+
+/************************************************/
+
+void test19()
+{
+    immutable(char[5])[int] aa = ([3:"hello", 4:"betty"]);
+
+    assert(aa[3] == "hello");
+    assert(aa[4] == "betty");
+
+    auto keys = aa.keys;
+    printf("%d\n", keys[0]);
+    printf("%d\n", keys[1]);
+
+    auto vs = aa.values;
+    printf("%.*s\n", vs[0].length, vs[0].ptr);
+    printf("%.*s\n", vs[1].length, vs[1].ptr);
+
+    string aavalue_typeid = typeid(typeof(aa.values)).toString();
+    printf("%.*s\n", aavalue_typeid.length, aavalue_typeid.ptr);
+
+    printf("%.*s\n", aa[3].length, aa[3].ptr);
+    printf("%.*s\n", aa[4].length, aa[4].ptr);
+}
+
+/************************************************/
+
+void test20()
+{
+    string[int] aa = ([3:"hello", 4:"betty"]);
+
+    assert(aa[3] == "hello");
+    assert(aa[4] == "betty");
+
+    auto keys = aa.keys;
+    printf("%d\n", keys[0]);
+    printf("%d\n", keys[1]);
+
+    auto values = aa.values;
+    printf("%.*s\n", values[0].length, values[0].ptr);
+    printf("%.*s\n", values[1].length, values[1].ptr);
+
+    string aavalue_typeid = typeid(typeof(aa.values)).toString();
+    printf("%.*s\n", aavalue_typeid.length, aavalue_typeid.ptr);
+
+    printf("%.*s\n", aa[3].length, aa[3].ptr);
+    printf("%.*s\n", aa[4].length, aa[4].ptr);
+}
+
+/************************************************/
+
+void test21()
+{
+    ushort[20] key = 23;
+    int[ushort[20]] aa;
+    aa[key] = 42;
+    auto x = aa[key];
+    assert(x == 42);
+    printf("foo\n");
+}
+
+/************************************************/
+
+void test22()
+{
+    int[string] stopWords = [ "abc"[]:1 ];
+    assert("abc"[] in stopWords);
+}
+
+/************************************************/
+
+void test23()
+{
+    uint[char[]][] fractal;
+    fractal.length = 10;
+}
+
+/************************************************/
+
+void test24()
+{
+    int[string] x;
+    char[] y;
+    if (y in x)
+    {
+        int z = x[y];
+    }
+}
+
+/************************************************/
+
+void test25()
+{
+    string[string] aa;
+    foreach (k,v; aa)
+    {
+    }
+}
+
+/************************************************/
+
+class Tag
+{
+    string[string] attr;
+}
+
+void foo26(const(Tag) tag_)
+{
+    foreach(k,v;tag_.attr) { }
+}
+
+void test26()
+{
+}
+
+/************************************************/
+
+void test27()
+{
+    int[int] s;
+    s = s.init;
+}
+
+/************************************************/
+
+void test28()
+{
+    auto a1 = [ 1:10.0, 2:20, 3:15 ];
+    auto a2 = [ 1:10.0, 2:20, 3:15 ];
+    assert(a1 !is a2);
+    assert(a1 == a2);
+    a2[7] = 23;
+    assert(a1 != a2);
+    a2.remove(7);
+    assert(a1 == a2);
+    a1.rehash;
+    assert(a1 == a2);
+    a2[2] = 18;
+    assert(a1 != a2);
+}
+
+/************************************************/
+
+void test29()
+{
+    auto gammaFunc = [-1.5:2.363, -0.5:-3.545, 0.5:1.772];
+
+    // write all keys
+    foreach (k; gammaFunc.byKey()) {
+       printf("%f\n", k);
+    }
+
+    // write all values
+    foreach (v; gammaFunc.byValue()) {
+       printf("%f\n", v);
+    }
+}
+
+/************************************************/
+
+string toString(int value)
+{
+    char[] result = new char[12];
+
+    uint ndigits = 0;
+    do
+    {
+        const c = cast(char) ((value % 10) + '0');
+        value /= 10;
+        ndigits++;
+        result[$ - ndigits] = c;
+    }
+    while (value);
+    return cast(string) result[$ - ndigits .. $];
+}
+
+void test30()
+{
+    int[string] aa;
+    for(int i = 0; i < 100000; i++)
+    {
+        string s = toString(i);
+        aa[s] = i;
+    }
+}
+
+/************************************************/
+
+void test31()
+{
+    int[int] test;
+    test[0] = 0;
+    test[1] = 1;
+    test[2] = 2;
+
+    bool flag = false;
+    foreach( k, v; test){
+        //printf("loop: %d %d\n", k, v);
+        assert(!flag);
+        flag = true;
+        break;
+    }
+}
+
+/************************************************/
+
+void test32()
+{
+    uint[ushort] aa;
+    aa[1] = 1;
+    aa[2] = 2;
+    aa[3] = 3;
+    aa[4] = 4;
+    aa[5] = 5;
+    foreach(v; aa)
+    {
+        printf("%x\n", v);
+        assert(v >= 1 && v <= 5);
+    }
+}
+
+/************************************************/
+
+template ICE3996(T : V[K], K, V) {}
+
+struct Bug3996 {}
+
+static assert(!is( ICE3996!(Bug3996) ));
+
+/************************************************/
+
+void bug4826c(T)(int[int] value, T x) {}
+
+void test4826c()
+{
+    AssociativeArray!(int, int) z;
+    bug4826c(z,1);
+}
+
+/************************************************/
+// 5131
+
+struct ICE5131
+{
+    this(int n) {}
+    ICE5131 opAssign(int x) { return this; }
+}
+
+void test5131()
+{
+    ICE5131[string] a;
+    a["ICE?"] = 1;  // call ctor
+    a["ICE?"] = 1;  // call opAssign
+}
+
+/************************************************/
+// 6178
+
+bool test6178a()
+{
+    // AA value setting through identity opAssign
+
+    int assign = 0;
+    struct S
+    {
+        int value = 10;
+
+        void opAssign(S rhs)
+        {
+            ++assign;
+            assert(value == 10);
+        }
+    }
+
+    int count = 0;
+    int makeKey() { return ++count; }
+
+    S[int] aa;
+    assert(aa.length == 0);
+
+    aa[makeKey()] = S();
+    assert(assign == 0);
+    assert(aa.length == 1 && 1 in aa);
+
+    aa[1] = S();
+    assert(assign == 1);
+    assert(aa.length == 1 && 1 in aa);
+
+    return true;
+}
+
+bool test6178b()
+{
+    // AA value setting through implicit ctor call + non-identity opAssign
+
+    int ctor = 0;
+    int assign = 0;
+    struct S
+    {
+        int value = 10;
+
+        @disable this();
+
+        this(int n)
+        {
+            ++ctor;
+            assert(value == 10);
+            value = 20;
+        }
+        void opAssign(int rhs)
+        {
+            ++assign;
+            assert(value == 20);
+            assert(rhs == 30);
+            value = rhs;
+        }
+    }
+
+    int count = 0;
+    int makeKey() { return ++count; }
+
+    S[int] aa;
+    assert(aa.length == 0);
+
+    aa[makeKey()] = 20;
+    assert(assign == 0 && ctor == 1 && count == 1);
+    assert(aa.length == 1 && (1 in aa));
+
+    aa[1] = 30;
+    assert(assign == 1 && ctor == 1);
+    assert(aa.length == 1 && 1 in aa);
+
+    return true;
+}
+
+bool test6178c()
+{
+    // AA value setting through non-identity opAssign
+
+    struct S
+    {
+        //this(int) {}
+        // not possible to perform implicit ctor call
+        void opAssign(int) {}
+    }
+
+    S[int] aa;
+    assert(aa.length == 0);
+
+    if (!__ctfe)
+    {
+        // currently CTFE does not support throwing RangeError
+        import core.exception : RangeError;
+        try { aa[1] = 1; assert(0); } catch (RangeError) {}
+
+        // The above line is exactly same as:
+        try { aa[1].opAssign(1); assert(0); } catch (RangeError) {}
+    }
+    assert(aa.length == 0);
+
+    aa[1] = S();
+    aa[1] = 1;
+    assert(aa.length == 1);
+
+    return true;
+}
+
+bool test6178d()
+{
+    // AA value setting through implicit ctor call + alias this
+
+    int ctor;
+    struct S
+    {
+        this(int n) { ++ctor; value = n; }
+
+        int value;
+        alias value this;
+    }
+
+    S[int] aa;
+    assert(ctor == 0);
+    assert(aa.length == 0);
+
+    aa[1] = 0;      // implicit ctor call + blit assign
+    assert(aa[1].value == 0 && ctor == 1);
+    assert(aa.length == 1);
+
+    aa[1] = 1;      // set through alias this
+    assert(aa[1].value == 1 && ctor == 1);
+    assert(aa.length == 1);
+
+    return true;
+}
+
+bool test6178e()
+{
+    // AA value setting through alias this
+
+    struct S
+    {
+        int value;
+        alias value this;
+    }
+
+    S[int] aa;
+    assert(aa.length == 0);
+
+    if (!__ctfe)
+    {
+        // currently CTFE does not support throwing RangeError
+        import core.exception : RangeError;
+        try { aa[1] = 1; assert(0); } catch (RangeError) {}
+
+        // The above line is exactly same as:
+        try { aa[1].value = 1; assert(0); } catch (RangeError) {}
+    }
+    assert(aa.length == 0);
+
+    aa[1] = S(0);   // construct + blit assign
+    assert(aa[1].value == 0 && aa.length == 1);
+
+    aa[1] = 1;      // set through alias this
+    assert(aa[1].value == 1 && aa.length == 1);
+
+    return true;
+}
+
+void test6178()
+{
+    static assert(test6178a()); // ctfe check
+    test6178a();                // runtime test
+
+    static assert(test6178b());
+    test6178b();
+
+    static assert(test6178c());
+    test6178c();
+
+    static assert(test6178d());
+    test6178d();
+
+    static assert(test6178e());
+    test6178e();
+}
+
+void test6178x()
+{
+    return; // depends on AA implementation
+    static int ctor, cpctor, dtor;
+
+    static struct S
+    {
+        this(int)  { ++ctor;   printf("ctor\n");   }
+        this(this) { ++cpctor; printf("cpctor\n"); }
+        ~this()    { ++dtor;   printf("dtor\n");   }
+    }
+    static struct X
+    {
+        this(int) {}
+        void opAssign(int) {}
+    }
+
+    X[S] aa1;
+    S[int] aa2;
+
+    {
+        auto value = S(1);
+        assert(ctor==1 && cpctor==0 && dtor==0);
+
+        ref getRef(ref S s = value) { return s; }
+        auto getVal() { return value; }
+
+        aa1[value] = 10;
+        assert(ctor==1 && cpctor==1 && dtor==0); //call copy ctor when we putting 'value' to aa1
+
+        aa1[getRef()] = 20;
+        assert(ctor==1 && cpctor==1 && dtor==0); //copy ctor wasn't called because we didn't create a new entry in aa, using an existing key
+
+        aa1[getVal()] = 20;
+        assert(ctor==1 && cpctor==2 && dtor==1); //call copy ctor and dtor, because we pass key by value
+
+        aa2[1] = value;
+        assert(ctor==1 && cpctor==3 && dtor==1); //call copy ctor when we putting `value` to aa2[1]
+
+        aa2[2] = getRef();
+        assert(ctor==1 && cpctor==4 && dtor==1); //call copy ctor when we putting `value` to aa2[2]
+    }
+    assert(ctor==1 && cpctor==4 && dtor==2);     //We've got 3 "S" instances that aren't destroyed yet: the key in aa1, aa2[1], aa2[2].
+    assert(ctor + cpctor - aa2.length - aa1.length == dtor);
+}
+
+/************************************************/
+// 10595
+
+struct S10595
+{
+    bool b = true;
+
+    bool test()
+    {
+        if (!b)  // note: must be a check, not 'return b;'
+            return false;
+
+        return true;
+    }
+}
+
+struct Wrap10595
+{
+    int i;
+    alias i this;
+    S10595 s;
+}
+
+void test10595()
+{
+    {
+        Wrap10595[int] wrap;
+
+        wrap[0] = Wrap10595();
+        wrap[0].i = 0;
+
+        assert(wrap[0].s.test());  // ok
+    }
+
+    {
+        Wrap10595[int] wrap;
+
+        wrap[0] = Wrap10595();
+        wrap[0] = 0;  // note: using 'alias this' to assign
+
+        assert(wrap[0].s.test());  // failure
+    }
+}
+
+/************************************************/
+// 10970
+
+struct RefCounted10970(T) //if (!is(T == class))
+{
+    struct RefCountedStore
+    {
+    }
+    RefCountedStore _refCounted;
+
+    this(this) {}
+
+    ~this() {}
+}
+
+struct Array10970(T) if (!is(T : const(bool)))
+{
+    struct Payload
+    {
+    }
+    RefCounted10970!Payload _data;
+}
+
+class C10970
+{
+    this(string name)
+    {
+        m[name] = Arr();
+    }
+
+    alias Array10970!C10970 Arr;
+    Arr[string] m;
+}
+
+void test10970()
+{
+    C10970 c = new C10970("test");
+}
+
+/************************************************/
+// 6433
+
+void test6433()
+{
+    int[int] aa;
+    static assert(aa.sizeof != 0);
+    static assert(aa.alignof != 0);
+    static assert(is(typeof(aa.init) == int[int]));
+    static assert(typeof(aa).mangleof == "Hii");
+    static assert(typeof(aa).stringof == "int[int]");
+    static struct AA { int[int] aa; }
+    static assert(AA.aa.offsetof == 0);
+
+    aa = aa.init;
+    aa[0] = 1;
+    assert(aa.length == 1 && aa[0] == 1);
+}
+
+/************************************************/
+// 6612
+
+void test6612()
+{
+    auto aa1 = [1: 2]; // OK
+    auto aa2 = [4: 5]; // OK
+    int[int[int]] aa3 = [aa1:3, aa2:6]; // OK
+    int[int[int]] aa4 = [[1:2]:3, [4:5]:6]; // error
+    int[int[string]] aa5 = [["a":1]:2, ["b":3]:4];
+}
+
+/************************************************/
+// 7365
+
+struct TickDuration
+{
+    bool opEquals(ref const TickDuration rhs) const
+    {
+        return true;
+    }
+}
+
+void test7365()
+{
+    TickDuration[Object] aa;
+    aa.keys;
+}
+
+/************************************************/
+
+enum aa5520 = [5 : "hello"];
+
+void test5520()
+{
+    auto a = aa5520.values;
+}
+
+/************************************************/
+
+enum size_t N6655 = 1;
+int[bar6655.length] foo6655;
+int[N6655] bar6655;
+
+/************************************************/
+
+struct ChunkLoc {}
+
+ChunkLoc Get()
+{
+    return ChunkLoc();
+}
+
+void test6799()
+{
+    int[ChunkLoc] aa;
+    aa.remove(Get());
+}
+
+/************************************************/
+// 11359
+
+void test11359()
+{
+    class Bar {}
+    static Bar[string] aa;
+    static ref fun() { return aa; }
+
+    string key = "test";
+
+    fun[key] = new Bar;
+    assert(aa.length == 1);
+    Bar bar = fun[key];
+}
+
+/************************************************/
+// 11730
+
+struct SysTime11730
+{
+    ref SysTime11730 opAssign(SysTime11730 rhs)
+    {
+        assert(0);
+    }
+}
+
+struct Nullable11730(T)
+{
+    T _value;
+
+    void opAssign()(T value)
+    {
+        assert(0);
+    }
+
+    @property ref inout(T) get() inout
+    {
+        assert(0);
+    }
+    alias get this;
+}
+
+void test11730()
+{
+    Nullable11730!SysTime11730[string] map;
+    map["foo"] = Nullable11730!SysTime11730();
+}
+
+/************************************************/
+// 14089
+
+struct S14089
+{
+    int num;
+    S14089 opAssign(S14089 val) { return this; }
+}
+
+void test14089()
+{
+    S14089[int] aa;
+    S14089 b = aa[1] = S14089(0);
+    assert(aa[1].num == 0);
+    assert(b.num == 0);
+}
+
+/************************************************/
+// 14144
+
+struct JSON14144
+{
+    union
+    {
+        double _floating;
+    }
+
+    this(typeof(null))
+    {
+    }
+
+    @trusted pure nothrow typeof(null) opAssign(typeof(null) nothing)
+    {
+        return null;
+    }
+}
+
+void test14144()
+{
+    JSON14144[string] x;
+    x["wat"] = null;
+    assert(x.length == 1);
+    assert("wat" in x);
+}
+
+/************************************************/
+// 14321
+
+void test14321()
+{
+    struct Foo
+    {
+        static char[8] buf;
+        static char[] op;
+
+        this(int id) { buf[op.length] = 'c'; op = buf[0..op.length + 1]; }
+        this(this) { buf[op.length] = 'p'; op = buf[0..op.length + 1]; }
+        ~this() { buf[op.length] = 'd'; op = buf[0..op.length + 1]; }
+    }
+    Foo[string] foos;
+    assert(Foo.op == "");
+    foos["test"] = Foo(42);     // initialization
+    assert(Foo.op == "c");
+    foos["test"] = Foo(42);     // assignment
+    assert(Foo.op == "ccd");
+
+    struct Bar
+    {
+        static char[8] buf;
+        static char[] op;
+
+        int id;
+        //this(int id) { op ~= "c"; }
+        this(this) { buf[op.length] = 'p'; op = buf[0..op.length + 1]; }
+        ~this() { buf[op.length] = 'd'; op = buf[0..op.length + 1]; }
+    }
+    Bar[string] bars;
+    assert(Bar.op == "");
+    bars["test"] = Bar(42);     // initialization
+    assert(Bar.op == "");
+    bars["test"] = Bar(42);     // assignment
+    assert(Bar.op == "d");
+}
+
+/************************************************/
+
+int main()
+{
+    printf("before test 1\n");   test1();
+    printf("before test 2\n");   test2();
+    printf("before test 4\n");   test4();
+    printf("before test 5\n");   test5();
+    printf("before test 6\n");   test6();
+    printf("before test 7\n");   test7();
+    printf("before test 8\n");   test8();
+    printf("before test 9\n");   test9();
+    printf("before test 10\n");   test10();
+    printf("before test 11\n");   test11();
+    printf("before test 12\n");   test12();
+    printf("before test 13\n");   test13();
+    printf("before test 14\n");   test14();
+    printf("before test 15\n");   test15();
+    printf("before test 16\n");   test16();
+    printf("before test 17\n");   test17();
+    printf("before test 18\n");   test18();
+    printf("before test 19\n");   test19();
+    printf("before test 20\n");   test20();
+    printf("before test 21\n");   test21();
+    printf("before test 22\n");   test22();
+    printf("before test 23\n");   test23();
+    printf("before test 24\n");   test24();
+    printf("before test 25\n");   test25();
+    printf("before test 26\n");   test26();
+    printf("before test 27\n");   test27();
+    printf("before test 28\n");   test28();
+    printf("before test 29\n");   test29();
+    printf("before test 30\n");   test30();
+    printf("before test 31\n");   test31();
+    printf("before test 32\n");   test32();
+
+    test4826c();
+    test5131();
+    test6178();
+    test6178x();
+    test10595();
+    test10970();
+    test6433();
+    test6612();
+    test7365();
+    test5520();
+    test6799();
+    test11359();
+    test11730();
+    test14089();
+    test14321();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testaa2.d b/gcc/testsuite/gdc.test/runnable/testaa2.d
new file mode 100644
index 00000000000..a8d98c49e9f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testaa2.d
@@ -0,0 +1,292 @@
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+/************************************************/
+
+int a[string];
+
+size_t foo(immutable char [3] s)
+{
+    printf("foo()\n");
+    int b[string];
+    string[] key;
+    int[] value;
+    printf("foo() 2\n");
+    key = a.keys;
+    printf("foo() 3\n");
+    value = a.values;
+    printf("foo() 4\n");
+    return a.length + b.length;
+}
+
+void foo2()
+{
+    int c[string];
+    string[] key;
+    int[] value;
+    int i;
+
+    assert(c.length == 0);
+    key = c.keys;
+    assert(key.length == 0);
+    value = c.values;
+    assert(value.length == 0);
+
+    c["foo"] = 3;
+    assert(c["foo"] == 3);
+    assert(c.length == 1);
+    key = c.keys;
+    assert(key.length == 1);
+    value = c.values;
+    assert(value.length == 1);
+    assert(value[0] == 3);
+
+    c["bar"] = 4;
+    assert(c["bar"] == 4);
+    assert(c.length == 2);
+    key = c.keys;
+    assert(key.length == 2);
+    value = c.values;
+    assert(value.length == 2);
+
+    for (i = 0; i < key.length; i++)
+    {
+        printf("c[\"%.*s\"] = %d\n", key[i].length, key[i].ptr, value[i]);
+    }
+
+    assert("foo" in c);
+    c.remove("foo");
+    assert(!("foo" in c));
+    assert(c.length == 1);
+
+    assert("bar" in c);
+    c.remove("bar");
+    assert(!("bar" in c));
+    assert(c.length == 0);
+}
+
+void testaa()
+{
+    size_t i = foo("abc");
+    printf("i = %d\n", i);
+    assert(i == 0);
+
+    foo2();
+}
+
+/************************************************/
+
+void test1899()
+{
+    int[3][string] AA;
+    int[3] x = [5,4,3];
+    AA["abc"] = x;
+    assert(AA["abc"] == x);
+    AA["def"] = [1,2,3];
+    assert(AA["def"]==[1,2,3]);
+}
+
+/************************************************/
+
+void foo4523()
+{
+   int[string] aa = ["test":0, "test2":1];
+
+   bool found = aa.remove("test");
+   assert(found);
+   bool notfound = aa.remove("nothing");
+   assert(!notfound);
+}
+
+void test4523()
+{
+    foo4523();
+    static assert({ foo4523(); return true; }());
+}
+
+/************************************************/
+// 3825
+
+import std.math;    // necessary for ^^=
+void test3825()
+{
+    // Check for RangeError is thrown
+    bool thrown(T)(lazy T cond)
+    {
+        import core.exception;
+        bool f = false;
+        try {
+            cond();
+        } catch (RangeError e) { f = true; }
+        return f;
+    }
+
+    int[int] aax;
+    int[][int] aay;
+
+    aax = null, aay = null;
+    assert(thrown(aax[0]));
+    assert(thrown(aax[0]   = aax[0]));  // rhs throws
+    assert(thrown(aax[0]  += aax[0]));  // rhs throws
+    assert(thrown(aax[0] ^^= aax[0]));  // rhs throws
+    assert(thrown(aay[0]  ~= aay[0]));  // rhs throws
+    aax = null;   aax[0]   = 1;  assert(aax[0] ==  1);  // setting aax[0] is OK
+    aax = null;   aax[0]  += 1;  assert(aax[0] == +1);  // setting aax[0] to 0 and modify it is OK
+    aax = null;   aax[0] ^^= 1;  assert(aax[0] ==  0);  // setting aax[0] to 0 and modify it is OK
+    aay = null;   aay[0]  ~= []; assert(aay[0] == []);  // setting aay[0] to 0 and modify it is OK
+    aax = null; ++aax[0];        assert(aax[0] == +1);  // setting aax[0] to 0 and modify it is OK
+    aax = null; --aax[0];        assert(aax[0] == -1);  // setting aax[0] to 0 and modify it is OK
+
+    aax = [0:0], aay = [0:null];
+    assert(thrown(aax[aax[1]]   = 1));  // accessing aax[1] in key part throws
+    assert(thrown(aax[aax[1]]  += 1));  // accessing aax[1] in key part throws
+    assert(thrown(aax[aax[1]] ^^= 1));  // accessing aax[1] in key part throws
+    assert(thrown(aay[aax[1]]  ~= [])); // accessing aax[1] in key part throws
+
+    //assert(thrown(aax[(  aax[1], 0)] = 0));
+    /* accessing aax[1] in key part, why doesn't throw?
+     * Because, in aax[(aax[1], 0)], aax[1] is in lhs of comma expression, and is treated
+     * it has no side effect. Then optimizer eliminate it completely, and
+     * whole expression succeed to run in runtime. */
+    int n = 0;
+    assert(thrown(aax[(n=aax[1], 0)] = 0)); // accessing aax[1] in key part, throws OK
+
+    // This works as expected.
+    int[int][int] aaa;
+    aaa[0][0] = 0;              assert(aaa[0][0] == 0); // setting aaa[0][0] is OK
+
+    // real test cases
+    void bug3825()
+    {
+        string[] words = ["how", "are", "you", "are"];
+
+        int[string] aa1;
+        foreach (w; words)
+            aa1[w] = ((w in aa1) ? (aa1[w] + 1) : 2);
+        //writeln(aa1); // Prints: [how:1,you:1,are:2]
+
+        int[string] aa2;
+        foreach (w; words)
+            if (w in aa2)
+                aa2[w]++;
+            else
+                aa2[w] = 2;
+        //writeln(aa2); // Prints: [how:2,you:2,are:3]
+
+        assert(aa1 == aa2);
+        assert(aa1 == ["how":2, "you":2, "are":3]);
+        assert(aa2 == ["how":2, "you":2, "are":3]);
+    }
+    void bug5021()
+    {
+        int func()
+        {
+            throw new Exception("It's an exception.");
+        }
+
+        int[string] arr;
+        try
+        {
+            arr["hello"] = func();
+        }
+        catch(Exception e)
+        {
+        }
+        assert(arr.length == 0);
+    }
+    void bug7914()
+    {
+        size_t[ubyte] aa;
+        aa[0] = aa.length;
+        assert(aa[0] == 0);
+    }
+    void bug8070()
+    {
+        Object[string] arr;
+
+        class A
+        {
+            this()
+            {
+                // at this point:
+                assert("x" !in arr);
+            }
+        }
+
+        arr["x"] = new A();
+    }
+    bug3825();
+    bug5021();
+    bug7914();
+    bug8070();
+}
+
+void test3825x()
+{
+    return; // depends on AA implementation
+    static int ctor, cpctor, dtor;
+
+    static struct S
+    {
+        this(int)  { ++ctor; }
+        this(this) { ++cpctor; }
+        ~this()    { ++dtor; }
+    }
+
+    int[S] aa;
+    {
+        auto value = S(1);
+        assert(ctor==1 && cpctor==0 && dtor==0);
+
+        ref getRef(ref S s = value) { return s; }
+        auto getVal() { return value; }
+
+        aa[value] = 10;
+        assert(ctor==1 && cpctor==1 && dtor==0);
+
+        aa[getRef()] += 1;
+        assert(ctor==1 && cpctor==1 && dtor==0);
+
+        aa[getVal()] += 1;
+        assert(ctor==1 && cpctor==2 && dtor==1);
+    }
+    assert(ctor==1 && cpctor==2 && dtor==2);
+    assert(ctor + cpctor - aa.length == dtor);
+}
+
+/************************************************/
+// 10106
+
+struct GcPolicy10106 {}
+
+struct Uint24Array10106(SP = GcPolicy10106)
+{
+    this(this) {}
+}
+
+struct InversionList10106(SP = GcPolicy10106)
+{
+    Uint24Array10106!SP data;
+}
+
+alias InversionList10106!GcPolicy10106 CodepointSet10106;
+
+struct PropertyTable10106
+{
+    CodepointSet10106[string] table;
+}
+
+/************************************************/
+
+int main()
+{
+    testaa();
+    test1899();
+    test4523();
+    test3825();
+    test3825x();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testaa3.d b/gcc/testsuite/gdc.test/runnable/testaa3.d
new file mode 100644
index 00000000000..3e3ae96ba02
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testaa3.d
@@ -0,0 +1,374 @@
+
+/***************************************************/
+
+/* Test all aa properties (length, values, keys, opApply(Key, Value), opApply_r(Value),
+ * dup, byKey, byValue, rehash, opIndex, opIndexAssign, opIn_r)
+ *
+ * With all aas: literal, variable, ref parameter, rvalue
+ */
+
+int testLiteral()
+{
+    assert([5 : 4].length == 1);
+    assert([5 : 4].values == [4]);
+    assert([5 : 4].keys == [5]);
+    foreach (k, v; [5 : 4])
+        assert(k == 5 && v == 4);
+    foreach (v; [5 : 4])
+        assert(v == 4);
+    assert([5 : 4].dup == [5 : 4]);
+    assert([5 : 4].dup);
+    if (!__ctfe)
+    foreach (k; [5 : 4].byKey)
+        assert(k == 5);
+    if (!__ctfe)
+    foreach (v; [5 : 4].byValue)
+        assert(v == 4);
+    assert([5 : 4].rehash == [5 : 4]);
+    assert([5 : 4][5] == 4);
+    assert([5 : 4].get(5, 2) == 4);
+    assert([5 : 4].get(1, 2) == 2);
+    //assert(([5 : 4][3] = 7) == 7);
+    assert(*(5 in [5 : 4]) == 4);
+    return 1;
+}
+
+int testVar()
+{
+    auto aa = [5 : 4];
+    assert(aa.length == 1);
+    assert(aa.values == [4]);
+    assert(aa.keys == [5]);
+    foreach (k, v; aa)
+        assert(k == 5 && v == 4);
+    foreach (v; aa)
+        assert(v == 4);
+    assert(aa.dup == aa);
+    assert(aa.dup);
+    {
+        auto bb = aa.dup();
+        assert(bb == aa);
+        //assert(aa !is bb);  // issue in ctfeIdentity
+        assert(&aa[5] !is &bb[5]);
+        bb[5] = 10;
+        assert(aa[5] == 4);
+        assert(bb[5] == 10);
+    }
+    if (!__ctfe)
+    foreach (k; aa.byKey)
+        assert(k == 5);
+    if (!__ctfe)
+    foreach (v; aa.byValue)
+        assert(v == 4);
+    assert(aa.rehash == aa);
+    assert(aa[5] == 4);
+    assert(aa.get(5, 2) == 4);
+    assert(aa.get(1, 2) == 2);
+    assert(*(5 in aa) == 4);
+    assert((aa[3] = 7) == 7);
+    return 1;
+}
+
+int testVarConst()
+{
+    const aa = [5 : 4];
+    assert(aa.length == 1);
+    assert(aa.values == [4]);
+    assert(aa.keys == [5]);
+    foreach (k, v; aa)
+        assert(k == 5 && v == 4);
+    foreach (v; aa)
+        assert(v == 4);
+    //assert(aa.dup == aa);
+    assert(aa.dup);
+    {
+        auto bb = aa.dup();
+        //assert(bb == aa);
+        //assert(aa !is bb);  // issue in ctfeIdentity
+        assert(&aa[5] !is &bb[5]);
+    }
+    if (!__ctfe)
+    foreach (k; aa.byKey)
+        assert(k == 5);
+    if (!__ctfe)
+    foreach (v; aa.byValue)
+        assert(v == 4);
+    //assert(aa.rehash == aa);
+    assert(aa[5] == 4);
+    assert(aa.get(5, 2) == 4);
+    assert(aa.get(1, 2) == 2);
+    assert(*(5 in aa) == 4);
+    //assert((aa[3] = 7) == 7);
+    return 1;
+}
+
+int testVarImmutable()
+{
+    immutable aa = [5 : 4];
+    assert(aa.length == 1);
+    assert(aa.values == [4]);
+    assert(aa.keys == [5]);
+    foreach (k, v; aa)
+        assert(k == 5 && v == 4);
+    foreach (v; aa)
+        assert(v == 4);
+    //assert(aa.dup == aa);
+    assert(aa.dup);
+    {
+        auto bb = aa.dup();
+        //assert(bb == aa);
+        //assert(aa !is bb);  // issue in ctfeIdentity
+        assert(&aa[5] !is &bb[5]);
+    }
+    if (!__ctfe)
+    foreach (k; aa.byKey)
+        assert(k == 5);
+    if (!__ctfe)
+    foreach (v; aa.byValue)
+        assert(v == 4);
+    // assert(aa.rehash == aa);
+    assert(aa[5] == 4);
+    assert(aa.get(5, 2) == 4);
+    assert(aa.get(1, 2) == 2);
+    assert(*(5 in aa) == 4);
+    //assert((aa[3] = 7) == 7);
+    return 1;
+}
+
+int testPointer()
+{
+    auto x = [5 : 4];
+    auto aa = &x;
+    assert(aa.length == 1);
+    assert(aa.values == [4]);
+    assert(aa.keys == [5]);
+    // foreach (k, v; aa)
+    //     assert(k == 5 && v == 4);
+    // foreach (v; aa)
+    //     assert(v == 4);
+    assert(aa.dup == *aa);
+    assert(aa.dup);
+    {
+        auto bb = aa.dup();
+        assert(bb == *aa);
+        //assert(aa !is bb);  // issue in ctfeIdentity
+        assert(&(*aa)[5] !is &bb[5]);
+        bb[5] = 10;
+        assert((*aa)[5] == 4);
+        assert(bb[5] == 10);
+    }
+    if (!__ctfe)
+    foreach (k; aa.byKey)
+        assert(k == 5);
+    if (!__ctfe)
+    foreach (v; aa.byValue)
+        assert(v == 4);
+    if (!__ctfe)
+    assert(aa.rehash == *aa);
+    assert((*aa)[5] == 4);
+    assert(aa.get(5, 2) == 4);
+    assert(aa.get(1, 2) == 2);
+    // assert(*(5 in aa) == 4);
+    if (!__ctfe)
+    assert(((*aa)[3] = 7) == 7);
+    return 1;
+}
+
+int testPointerConst()
+{
+    const x = [5 : 4];
+    const aa = &x;
+    assert(aa.length == 1);
+    assert(aa.values == [4]);
+    assert(aa.keys == [5]);
+    // foreach (k, v; aa)
+    //     assert(k == 5 && v == 4);
+    // foreach (v; aa)
+    //     assert(v == 4);
+    // assert(aa.dup == *aa);
+    assert(aa.dup);
+    {
+        auto bb = aa.dup();
+        //assert(bb == aa);
+        //assert(aa !is bb);  // issue in ctfeIdentity
+        assert(&(*aa)[5] !is &bb[5]);
+    }
+    if (!__ctfe)
+    foreach (k; aa.byKey)
+        assert(k == 5);
+    if (!__ctfe)
+    foreach (v; aa.byValue)
+        assert(v == 4);
+    // assert(aa.rehash == aa);
+    assert((*aa)[5] == 4);
+    assert(aa.get(5, 2) == 4);
+    assert(aa.get(1, 2) == 2);
+    // assert(*(5 in aa) == 4);
+    // assert(((*aa)[3] = 7) == 7);
+    return 1;
+}
+
+int testPointerImmutable()
+{
+    immutable x = [5 : 4];
+    auto aa = &x;
+    assert(aa.length == 1);
+    assert(aa.values == [4]);
+    assert(aa.keys == [5]);
+    // foreach (k, v; aa)
+    //     assert(k == 5 && v == 4);
+    // foreach (v; aa)
+    //     assert(v == 4);
+    // assert(aa.dup == *aa);
+    assert(aa.dup);
+    {
+        auto bb = aa.dup();
+        //assert(bb == (*aa));
+        //assert(aa !is bb);  // issue in ctfeIdentity
+        assert(&(*aa)[5] !is &bb[5]);
+    }
+    if (!__ctfe)
+    foreach (k; aa.byKey)
+        assert(k == 5);
+    if (!__ctfe)
+    foreach (v; aa.byValue)
+        assert(v == 4);
+    // assert(aa.rehash == aa);
+    assert((*aa)[5] == 4);
+    assert(aa.get(5, 2) == 4);
+    assert(aa.get(1, 2) == 2);
+    // assert(*(5 in aa) == 4);
+    // assert(((*aa)[3] = 7) == 7);
+    return 1;
+}
+
+int testRef()
+{
+    auto aa = [5 : 4];
+    return testRefx(aa);
+}
+int testRefx(ref int[int] aa)
+{
+    assert(aa.length == 1);
+    assert(aa.values == [4]);
+    assert(aa.keys == [5]);
+    foreach (k, v; aa)
+        assert(k == 5 && v == 4);
+    foreach (v; aa)
+        assert(v == 4);
+    assert(aa.dup == aa);
+    assert(aa.dup);
+    {
+        auto bb = aa.dup();
+        assert(bb == aa);
+        //assert(aa !is bb);  // issue in ctfeIdentity
+        assert(&aa[5] !is &bb[5]);
+        bb[5] = 10;
+        assert(aa[5] == 4);
+        assert(bb[5] == 10);
+    }
+    if (!__ctfe)
+    foreach (k; aa.byKey)
+        assert(k == 5);
+    if (!__ctfe)
+    foreach (v; aa.byValue)
+        assert(v == 4);
+    assert(aa.rehash == aa);
+    assert(aa[5] == 4);
+    assert(aa.get(5, 2) == 4);
+    assert(aa.get(1, 2) == 2);
+    assert((aa[3] = 7) == 7);
+    assert(*(5 in aa) == 4);
+    return 1;
+}
+
+int testRet()
+{
+    assert(testRetx().length == 1);
+    assert(testRetx().values == [4]);
+    assert(testRetx().keys == [5]);
+    foreach (k, v; testRetx())
+        assert(k == 5 && v == 4);
+    foreach (v; testRetx())
+        assert(v == 4);
+    assert(testRetx().dup == testRetx());
+    assert(testRetx().dup);
+    if (!__ctfe)
+    foreach (k; testRetx().byKey)
+        assert(k == 5);
+    if (!__ctfe)
+    foreach (v; testRetx().byValue)
+        assert(v == 4);
+    assert(testRetx().rehash == testRetx());
+    assert(testRetx()[5] == 4);
+    assert(testRetx().get(5, 2) == 4);
+    assert(testRetx().get(1, 2) == 2);
+    //assert((testRetx()[3] = 7) == 7);
+    assert(*(5 in testRetx()) == 4);
+    return 1;
+}
+int[int] testRetx()
+{
+    return [5 : 4];
+}
+
+void aafunc(int[int] aa) {}
+
+/***************************************************/
+// 12214
+
+void test12214() pure nothrow
+{
+    int[int] aa;
+    auto n = aa.length;
+}
+
+/***************************************************/
+// 12220 & 12221
+
+void test12220()
+{
+    short[short] hash;
+    short k = hash.get(1, 2);
+    assert(k == 2);
+
+    enum Key : short { a = 10 }
+    short a = hash.get(Key.a, Key.a);
+    assert(a == 10);
+}
+
+/***************************************************/
+// 12403
+
+void test12403()
+{
+    const(int)[int] m;
+    assert(m.get(0, 1) == 1);
+}
+
+/***************************************************/
+
+void main()
+{
+    assert(testLiteral());
+    static assert(testLiteral());
+    assert(testVar());
+    static assert(testVar());
+    assert(testVarConst());
+    static assert(testVarConst());
+    assert(testVarImmutable());
+    static assert(testVarImmutable());
+    assert(testPointer());
+    static assert(testPointer());
+    assert(testPointerConst());
+    static assert(testPointerConst());
+    assert(testPointerImmutable());
+    static assert(testPointerImmutable());
+    assert(testRef());
+    static assert(testRef());
+    assert(testRet());
+    static assert(testRet());
+
+    test12220();
+    test12403();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testabi.d b/gcc/testsuite/gdc.test/runnable/testabi.d
new file mode 100644
index 00000000000..579af04cc05
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testabi.d
@@ -0,0 +1,927 @@
+// PERMUTE_ARGS: -release -gc
+
+version(Windows) {}
+else version(X86_64)
+{
+        /* uncomment to enable tests! */
+        //version = Run_X86_64_Tests;
+}
+
+extern (C) int printf(const char*, ...);
+
+template tuple(A...) { alias A tuple; }
+
+alias byte   B;
+alias short  S;
+alias int    I;
+alias long   L;
+alias float  F;
+alias double D;
+alias real   R;
+
+// Single Type
+
+struct b        { B a;                  }
+struct bb       { B a,b;                }
+struct bbb      { B a,b,c;              }
+struct bbbb     { B a,b,c,d;            }
+struct bbbbb    { B a,b,c,d, e;         }
+struct b6       { B a,b,c,d, e,f;       }
+struct b7       { B a,b,c,d, e,f,g;     }
+struct b8       { B a,b,c,d, e,f,g,h;   }
+struct b9       { B a,b,c,d, e,f,g,h, i;                }
+struct b10      { B a,b,c,d, e,f,g,h, i,j;              }
+struct b11      { B a,b,c,d, e,f,g,h, i,j,k;            }
+struct b12      { B a,b,c,d, e,f,g,h, i,j,k,l;          }
+struct b13      { B a,b,c,d, e,f,g,h, i,j,k,l, m;       }
+struct b14      { B a,b,c,d, e,f,g,h, i,j,k,l, m,n;     }
+struct b15      { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o;   }
+struct b16      { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p; }
+struct b17      { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p, q;      }
+struct b18      { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p, q,r;    }
+struct b19      { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p, q,r,s;  }
+struct b20      { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p, q,r,s,t;}
+
+struct s        { S a;                  }
+struct ss       { S a,b;                }
+struct sss      { S a,b,c;              }
+struct ssss     { S a,b,c,d;            }
+struct sssss    { S a,b,c,d, e;         }
+struct s6       { S a,b,c,d, e,f;       }
+struct s7       { S a,b,c,d, e,f,g;     }
+struct s8       { S a,b,c,d, e,f,g,h;   }
+struct s9       { S a,b,c,d, e,f,g,h, i;  }
+struct s10      { S a,b,c,d, e,f,g,h, i,j;}
+
+struct i        { I a;          }       struct l        { L a;          }
+struct ii       { I a,b;        }       struct ll       { L a,b;        }
+struct iii      { I a,b,c;      }       struct lll      { L a,b,c;      }
+struct iiii     { I a,b,c,d;    }       struct llll     { L a,b,c,d;    }
+struct iiiii    { I a,b,c,d,e;  }       struct lllll    { L a,b,c,d,e;  }
+
+struct f        { F a;          }       struct d        { D a;          }
+struct ff       { F a,b;        }       struct dd       { D a,b;        }
+struct fff      { F a,b,c;      }       struct ddd      { D a,b,c;      }
+struct ffff     { F a,b,c,d;    }       struct dddd     { D a,b,c,d;    }
+struct fffff    { F a,b,c,d,e;  }       struct ddddd    { D a,b,c,d,e;  }
+
+// Mixed Size
+
+struct js       { I a;   S b;   }
+struct iss      { I a;   S b,c; }
+struct  si      { S a;   I b;   }
+struct ssi      { S a,b; I c;   }
+struct sis      { S a;   I b;  S c; }
+
+struct ls       { L a;   S b;   }
+struct lss      { L a;   S b,c; }
+struct  sl      { S a;   L b;   }
+struct ssl      { S a,b; L c;   }
+struct sls      { S a;   L b;  S c; }
+
+struct li       { L a;   I b;   }
+struct lii      { L a;   I b,c; }
+struct  il      { I a;   L b;   }
+struct iil      { I a,b; L c;   }
+struct ili      { I a;   L b;  I c; }
+
+struct df       { D a;   F b;   }
+struct dff      { D a;   F b,c; }
+struct  fd      { F a;   D b;   }
+struct ffd      { F a,b; D c;   }
+struct fdf      { F a;   D b;  F c; }
+
+// Mixed Types
+
+struct fi       { F a;   I b;   }
+struct fii      { F a;   I b,c; }
+struct  jf      { I a;   F b;   }
+struct iif      { I a,b; F c;   }
+struct ifi      { I a;   F b;  I c; }
+
+struct ffi      { F a,b; I c;           }
+struct ffii     { F a,b; I c,d;         }
+struct  iff     { I a;   F b,c;         }
+struct iiff     { I a,b; F c,d;         }
+struct ifif     { I a;   F b;  I c; F d;}
+
+struct di       { D a;   I b;   }
+struct dii      { D a;   I b,c; }
+struct  id      { I a;   D b;   }
+struct iid      { I a,b; D c;   }
+struct idi      { I a;   D b;  I c; }
+
+// Real ( long double )
+
+struct r        { R a;          }
+struct rr       { R a,b;        }
+struct rb       { R a;   B b;   }
+struct rf       { R a;   F b;   }
+struct fr       { F a;   R b;   }
+
+                // Int Registers only
+alias tuple!(   b,bb,bbb,bbbb,bbbbb,
+                b6, b7, b8, b9, b10,
+                b11,b12,b13,b14,b15,
+                b16,b17,b18,b19,b20,
+                s,ss,sss,ssss,sssss,
+                s6, s7, s8, s9, s10,
+                i,ii,iii,iiii,iiiii,
+                l,ll,lll,llll,lllll,
+                //
+                js,iss,si,ssi, sis,
+                ls,lss,sl,ssl, sls,
+                li,lii,il,iil, ili,
+                fi,fii,jf,iif, ifi,
+                ffi,ffii,iff,iiff,ifif, // INT_END
+
+                // SSE registers only
+                f,ff,fff,ffff,fffff,
+                d,dd,ddd,dddd,ddddd,
+                //
+                df,dff,fd,ffd, fdf,     // SSE_END
+
+                // Int and SSE
+                di,  dii,id, iid, idi,  // MIX_END
+                // ---
+            ) ALL_T;
+
+enum INT_END = 65;
+enum SSE_END = 80;
+enum MIX_END = ALL_T.length;
+
+                // x87
+alias tuple!(   r,rr,rb,rf,fr,
+                // ---
+            ) R_T;
+//"r","rr","rb","rf","fr",
+
+
+string[] ALL_S=[
+                "b","bb","bbb","bbbb","bbbbb",
+                "b6", "b7", "b8", "b9", "b10",
+                "b11","b12","b13","b14","b15",
+                "b16","b17","b18","b19","b20",
+                "s","ss","sss","ssss","sssss",
+                "s6","s7","s8","s9" , "s10",
+                "i","ii","iii","iiii","iiiii",
+                "l","ll","lll","llll","lllll",
+                // ---
+                "js","iss","si","ssi", "sis",
+                "ls","lss","sl","ssl", "sls",
+                "li","lii","il","iil", "ili",
+                "fi","fii","jf","iif", "ifi",
+                "ffi","ffii","iff","iiff","ifif",
+                // ---
+                "f","ff","fff","ffff","fffff",
+                "d","dd","ddd","dddd","ddddd",
+                "df","dff","fd","ffd", "dfd",
+                // ---
+                "di","dii","id","iid","idi",
+               ];
+
+/* ***********************************************************************
+                                   All
+ ************************************************************************/
+// test1 Struct passing and return
+
+int[MIX_END] results_1;
+
+T test1_out(T)( )
+{
+        T t;
+        foreach( i, ref e; t.tupleof )  e = i+1;
+        return t;
+}
+T test1_inout(T)( T t)
+{
+        foreach( i, ref e; t.tupleof )  e += 10;
+        return t;
+}
+
+void test1_call_out(T)( int n )
+{
+        T t1;
+        foreach( i, ref e; t1.tupleof ) e = i+1;
+        T t2 = test1_out!(T)();
+
+        if( t1 == t2 ) results_1[n] |= 1;
+}
+void test1_call_inout(T)( int n )
+{
+        T t1;
+        foreach( i, ref e; t1.tupleof ) e = i+1;
+        T t2 = test1_inout!(T)( t1 );
+        foreach( i, ref e; t1.tupleof ) e += 10;
+
+        if( t1 == t2 ) results_1[n] |= 2;
+}
+
+void D_test1( )
+{
+        // Run Tests
+        foreach( n, T; ALL_T )
+        {
+                test1_call_out!(T)(n);
+                test1_call_inout!(T)(n);
+        }
+
+        bool pass = true;
+        foreach( i, r; results_1 )
+        {
+                if( ~r & 1 )
+                {
+                pass = false;
+                printf( "Test1   out %s \tFail\n", ALL_S[i].ptr );
+                }
+                if( ~r & 2 )
+                {
+                pass = false;
+                printf( "Test1 inout %s \tFail\n", ALL_S[i].ptr );
+                }
+        }
+        assert( pass );
+
+        results_1[0..5] = 0;
+        foreach( n, T; R_T )
+        {
+                test1_call_out!(T)(n);
+                test1_call_inout!(T)(n);
+        }
+}
+
+/************************************************************************/
+// based on runnable/test23.d : test44()
+// Return Struct into an Array
+
+struct S1
+{       int i,j;
+
+        static S1 foo(int x)
+        {       S1 s;
+                s.i = x;
+                return s;
+}       }
+struct S2
+{       int i,j,k;
+
+        static S2 foo(int x)
+        {       S2 s;
+                s.i = x;
+                return s;
+}       }
+struct S3
+{       float i,j;
+
+        static S3 foo(int x)
+        {       S3 s;
+                s.i = x;
+                return s;
+}       }
+struct S4
+{       float i,j,k;
+
+        static S4 foo(int x)
+        {       S4 s;
+                s.i = x;
+                return s;
+}       }
+struct S5
+{       float i,j;
+        int   k;
+
+        static S5 foo(float x)
+        {       S5 s;
+                s.i = x;
+                return s;
+}       }
+
+void D_test2()
+{
+        S1[] s1;
+        S2[] s2;
+        S3[] s3;
+        S4[] s4;
+        S5[] s5;
+
+        s1 = s1 ~ S1.foo(6);    s1 = s1 ~ S1.foo(1);
+        s2 = s2 ~ S2.foo(6);    s2 = s2 ~ S2.foo(1);
+        s3 = s3 ~ S3.foo(6);    s3 = s3 ~ S3.foo(1);
+        s4 = s4 ~ S4.foo(6);    s4 = s4 ~ S4.foo(1);
+        s5 = s5 ~ S5.foo(6);    s5 = s5 ~ S5.foo(1);
+
+        assert( s1.length == 2 );
+        assert( s1[0].i == 6 );
+        assert( s1[1].i == 1 );
+
+        assert( s2.length == 2 );
+        assert( s2[0].i == 6 );
+        assert( s2[1].i == 1 );
+
+/+      // These Fail on Mainline DMD64 ( Should pass! )
+        assert( s3.length == 2 );
+        assert( s3[0].i == 6 );
+        assert( s3[1].i == 1 );
+
+        assert( s4.length == 2 );
+        assert( s4[0].i == 6 );
+        assert( s4[1].i == 1 );
++/
+        assert( s5.length == 2 );
+        assert( s5[0].i == 6 );
+        assert( s5[1].i == 1 );
+
+}
+
+/* ***********************************************************************
+                                X86_64
+ ************************************************************************/
+
+version(Run_X86_64_Tests)
+{
+
+
+struct TEST
+{
+        immutable int       num;
+        immutable string    desc;
+        bool[MIX_END] result;
+}
+
+/**
+ * 0 = Should Fail
+ * 1 = Should Pass
+ */
+immutable int[MIX_END] expected =
+        [
+        1,1,1,1,1, // b
+        1,1,1,1,1, // b6
+        1,1,1,1,1, // b11
+        1,0,0,0,0, // b16
+
+        1,1,1,1,1, // s
+        1,1,1,0,0, // s6
+        1,1,1,1,0, // i
+        1,1,0,0,0, // l
+        1,1,1,1,1, // si mix
+        1,1,1,1,0, // sl
+        1,1,1,1,0, // il
+        1,1,1,1,1, // int and float
+        1,1,1,1,1, // int and float
+
+        // SSE regs only
+        1,1,1,1,0, // f
+        1,1,0,0,0, // d
+        1,1,1,1,0, // float and double
+
+        // SSE + INT regs
+        1,1,1,1,0, // int and double
+        ];
+
+
+/**
+ * Describes value expected in registers
+ *
+ * null means do not test
+ * ( because value is passed on the stack ).
+ */
+
+immutable long[][] RegValue =
+        [
+/*   0  b       */ [ 0x0000000000000001,                    ],
+/*   1  bb      */ [ 0x0000000000000201,                    ],
+/*   2  bbb     */ [ 0x0000000000030201,                    ],
+/*   3  bbbb    */ [ 0x0000000004030201,                    ],
+/*   4  bbbbb   */ [ 0x0000000504030201,                    ],
+/*   5  b6      */ [ 0x0000060504030201,                    ],
+/*   6  b7      */ [ 0x0007060504030201,                    ],
+/*   7  b8      */ [ 0x0807060504030201,                    ],
+/*   8  b9      */ [ 0x0807060504030201, 0x0000000000000009 ],
+/*   9  b10     */ [ 0x0807060504030201, 0x0000000000000a09 ],
+/*  10  b11     */ [ 0x0807060504030201, 0x00000000000b0a09 ],
+/*  11  b12     */ [ 0x0807060504030201, 0x000000000c0b0a09 ],
+/*  12  b13     */ [ 0x0807060504030201, 0x0000000d0c0b0a09 ],
+/*  13  b14     */ [ 0x0807060504030201, 0x00000e0d0c0b0a09 ],
+/*  14  b15     */ [ 0x0807060504030201, 0x000f0e0d0c0b0a09 ],
+/*  15  b16     */ [ 0x0807060504030201, 0x100f0e0d0c0b0a09 ],
+/*  16  b17     */ null,
+/*  17  b18     */ null,
+/*  18  b19     */ null,
+/*  19  b20     */ null,
+/*  20  s       */ [ 0x0000000000000001,                    ],
+/*  21  ss      */ [ 0x0000000000020001,                    ],
+/*  22  sss     */ [ 0x0000000300020001,                    ],
+/*  23  ssss    */ [ 0x0004000300020001,                    ],
+/*  24  sssss   */ [ 0x0004000300020001, 0x0000000000000005 ],
+/*  25  s6      */ [ 0x0004000300020001, 0x0000000000060005 ],
+/*  26  s7      */ [ 0x0004000300020001, 0x0000000700060005 ],
+/*  27  s8      */ [ 0x0004000300020001, 0x0008000700060005 ],
+/*  28  s9      */ null,
+/*  29  s10     */ null,
+/*  30  i       */ [ 0x0000000000000001,                    ],
+/*  31  ii      */ [ 0x0000000200000001,                    ],
+/*  32  iii     */ [ 0x0000000200000001, 0x0000000000000003 ],
+/*  33  iiii    */ [ 0x0000000200000001, 0x0000000400000003 ],
+/*  34  iiiii   */ null,
+/*  35  l       */ [ 0x0000000000000001,                    ],
+/*  36  ll      */ [ 0x0000000000000001, 0x0000000000000002 ],
+/*  37  lll     */ null,
+/*  38  llll    */ null,
+/*  39  lllll   */ null,
+
+/*  40  js      */ [ 0x0000000200000001,                    ],
+/*  41  iss     */ [ 0x0003000200000001,                    ],
+/*  42  si      */ [ 0x0000000200000001,                    ],
+/*  43  ssi     */ [ 0x0000000300020001,                    ],
+/*  44  sis     */ [ 0x0000000200000001, 0x0000000000000003 ],
+/*  45  ls      */ [ 0x0000000000000001, 0x0000000000000002 ],
+/*  46  lss     */ [ 0x0000000000000001, 0x0000000000030002 ],
+/*  47  sl      */ [ 0x0000000000000001, 0x0000000000000002 ],
+/*  48  ssl     */ [ 0x0000000000020001, 0x0000000000000003 ],
+/*  49  sls     */ null,
+/*  50  li      */ [ 0x0000000000000001, 0x0000000000000002 ],
+/*  51  lii     */ [ 0x0000000000000001, 0x0000000300000002 ],
+/*  52  il      */ [ 0x0000000000000001, 0x0000000000000002 ],
+/*  53  iil     */ [ 0x0000000200000001, 0x0000000000000003 ],
+/*  54  ili     */ null,
+
+/*  55  fi      */ [ 0x000000023f800000,                    ],
+/*  56  fii     */ [ 0x000000023f800000, 0x0000000000000003 ],
+/*  57  jf      */ [ 0x4000000000000001,                    ],
+/*  58  iif     */ [ 0x0000000200000001, 0x0000000040400000 ],
+/*  59  ifi     */ [ 0x4000000000000001, 0x0000000000000003 ],
+
+/*  60  ffi     */ [ 0x0000000000000003, 0x400000003f800000 ],
+/*  61  ffii    */ [ 0x0000000400000003, 0x400000003f800000 ],
+/*  62  iff     */ [ 0x4000000000000001, 0x0000000040400000 ],
+/*  63  iiff    */ [ 0x0000000200000001, 0x4080000040400000 ],
+/*  64  ifif    */ [ 0x4000000000000001, 0x4080000000000003 ],
+
+/*  65  f       */ [ 0x000000003f800000,                    ],
+/*  66  ff      */ [ 0x400000003f800000,                    ],
+/*  67  fff     */ [ 0x400000003f800000, 0x0000000040400000 ],
+/*  68  ffff    */ [ 0x400000003f800000, 0x4080000040400000 ],
+/*  69  fffff   */ null,
+/*  70  d       */ [ 0x3ff0000000000000,                    ],
+/*  71  dd      */ [ 0x3ff0000000000000, 0x4000000000000000 ],
+/*  72  ddd     */ null,
+/*  73  dddd    */ null,
+/*  74  ddddd   */ null,
+
+/*  75  df      */ [ 0x3ff0000000000000, 0x0000000040000000 ],
+/*  76  dff     */ [ 0x3ff0000000000000, 0x4040000040000000 ],
+/*  77  fd      */ [ 0x000000003f800000, 0x4000000000000000 ],
+/*  78  ffd     */ [ 0x400000003f800000, 0x4008000000000000 ],
+/*  79  fdf     */ null,
+
+/*  80  di      */ [ 0x3ff0000000000000, 0x0000000000000002 ],
+/*  81  dii     */ [ 0x3ff0000000000000, 0x0000000300000002 ],
+/*  82  id      */ [ 0x4000000000000000, 0x0000000000000001 ],
+/*  83  iid     */ [ 0x4008000000000000, 0x0000000200000001 ],
+/*  84  idi     */ null,
+        ];
+
+/* Have to do it this way for OSX: Issue 7354 */
+__gshared long[2] dump;
+
+/**
+ * Generate Register capture
+ */
+string gen_reg_capture( int n, string registers )( )
+{
+        if( RegValue[n] == null ) return "return;";
+
+        string[] REG = mixin(registers); // ["RDI","RSI"];
+
+        // Which type of compare
+        static if(n < INT_END)
+                enum MODE = 1; // Int
+        else static if(n < SSE_END)
+                enum MODE = 2; // Float
+        else    enum MODE = 3; // Mix
+
+        /* Begin */
+
+        string code = "asm {\n";
+
+        final switch( MODE )
+        {
+                case 1: code ~= "mov [dump], "~REG[0]~";\n";
+                        REG = REG[1..$];
+                break;
+                case 2:
+                case 3: code ~= "movq [dump], XMM0;\n";
+        }
+
+        if( RegValue[n].length == 2 )
+        final switch( MODE )
+        {
+                case 1:
+                case 3: code ~= "mov [dump+8], "~REG[0]~";\n";
+                break;
+                case 2: code ~= "movq [dump+8], XMM1;\n";
+        } else {
+                code ~= "xor R8, R8;\n";
+                code ~= "mov [dump+8], R8;\n";
+        }
+
+        return code ~ "}\n";
+}
+
+/**
+ * Check the results
+ */
+bool check( TEST data )
+{
+        bool pass = true;
+        foreach( i, e; expected )
+        {
+                if( data.result[i] != (e & 1) )
+                {
+                        printf( "Test%d %s \tFail\n", data.num, ALL_S[i].ptr);
+                        pass = false;
+                }
+        }
+        return pass;
+}
+
+/************************************************************************/
+
+// test1 Return Struct in Registers
+// ( if RDI == 12 we have no hidden pointer )
+
+TEST data1 = { 1, "RDI hidden pointer" };
+
+T test1_asm( T, int n )( int i )
+{
+        asm {
+
+        cmp EDI, 12;
+        je L1;
+
+        leave; ret;
+        }
+L1:
+        data1.result[n] = true;
+}
+
+void test1()
+{
+        printf("\nRunning iasm Test 1 ( %s )\n", data1.desc.ptr);
+
+        foreach( int n, T; ALL_T )
+                test1_asm!(T,n)(12);
+
+        check( data1 );
+}
+
+/************************************************************************/
+// test2 Pass Struct in Registers
+// ( if RDI == 0 we have no stack pointer )
+
+TEST data2 = { 2, "RDI struct pointer" };
+
+T test2_asm( T, int n )( T t )
+{
+        asm {
+
+        mov [dump], RDI;
+        mov [dump+8], RSP;
+        cmp EDI, 0; // TODO test RDI is a ptr to stack ? ?
+        je L1;
+
+        leave; ret;
+        }
+L1:
+        data2.result[n] = true;
+}
+T test2f_asm( T, int n )( T t, int x )
+{
+        asm {
+
+        cmp EDI, 12;
+        je L1;
+
+        leave; ret;
+        }
+L1:
+        data2.result[n] = true;
+}
+
+void test2()
+{
+        printf("\nRunning iasm Test 2 ( %s )\n", data2.desc.ptr);
+
+        // Integer
+        foreach( int n, T; ALL_T ) {
+                T t = { 0 };
+                test2_asm!(T,n)( t );
+        }
+
+        // float alternative test
+        foreach( int n, T; ALL_T[INT_END..SSE_END] )
+        {
+                enum n2 = n + INT_END;
+                data2.result[n2] = false;
+                test2f_asm!(T,n2)( T.init, 12 );
+        }
+
+        check( data2 );
+}
+
+/************************************************************************/
+// test3
+
+TEST data3 = { 3, "Check Return Register value" };
+
+void test3_run( T, int n )( )
+{
+        test3_ret!T();
+        mixin( gen_reg_capture!(n,`["RAX","RDX"]`)() );
+
+        //dbg!(T,n)( );
+
+        enum len = RegValue[n].length;
+        if( dump[0..len] == RegValue[n] )
+                data3.result[n] = true;
+}
+
+T test3_ret( T )( )
+{
+        T t;
+        foreach( i, ref e; t.tupleof )  e = i+1;
+        return t;
+}
+
+void test3()
+{
+        printf("\nRunning iasm Test 3 ( %s )\n", data3.desc.ptr);
+
+        foreach( int n, T; ALL_T )
+                test3_run!(T,n)( );
+
+        check( data3 );
+}
+
+/************************************************************************/
+// test4
+
+TEST data4 = { 4, "Check Input Register value" };
+
+void test4_run( T, int n )( T t )
+{
+        mixin( gen_reg_capture!(n,`["RDI","RSI"]`)() );
+
+        //dbg!(T,n)( );
+
+        enum len = RegValue[n].length;
+        if( dump[0..len] == RegValue[n] )
+                data4.result[n] = true;
+}
+
+void dbg( T, int n )( )
+{
+        import std.stdio;
+        writefln( "D %s\t[ %16x, %16x ]", T.stringof, dump[0], dump[1], );
+        writef(   "C %s\t[ %16x", T.stringof, RegValue[n][0] );
+        if( RegValue[n].length == 2 )
+        writef( ", %16x", RegValue[n][1] );
+        writefln( " ]" );
+}
+void test4()
+{
+        printf("\nRunning iasm Test 4 ( %s )\n", data4.desc.ptr);
+
+        foreach( int n, T; ALL_T )
+        {
+                T t;
+                foreach( i, ref e; t.tupleof )  e = i+1;
+                test4_run!(T,n)( t );
+        }
+        check( data4 );
+}
+
+
+} // end version(Run_X86_64_Tests)
+
+/************************************************************************/
+
+
+void main()
+{
+        D_test1();
+        D_test2();
+
+        version(Run_X86_64_Tests)
+        {
+                test1();
+                test2();
+                test3();
+                test4();
+        }
+}
+
+/+
+/**
+ * C code to generate the table RegValue
+ */
+string c_generate_returns()
+{
+        string value =  " 1, 2, 3, 4, 5, 6, 7, 8, 9,10,"
+                        "11,12,13,14,15,16,17,18,19,20,";
+
+        string code = "#include \"cgen.h\"\n";
+
+        // Generate return functions
+        foreach( int n, T; ALL_T )
+        {
+                auto Ts  = T.stringof;
+                auto len = T.tupleof.length;
+
+                code ~= "struct "~Ts~" func_ret_"~Ts~"(void) { \n";
+                code ~= "struct "~Ts~" x = { ";
+                code ~= value[0..len*3] ~ " };\n";
+                code ~= "return x;\n}\n";
+        }
+        return code;
+}
+string c_generate_pass()
+{
+        string value =  " 1, 2, 3, 4, 5, 6, 7, 8, 9,10,"
+                        "11,12,13,14,15,16,17,18,19,20,";
+
+        string code;
+
+        // Generate return functions
+        foreach( int n, T; ALL_T )
+        {
+                auto Ts  = T.stringof;
+                auto len = T.tupleof.length;
+
+                code ~= "void func_pass_"~Ts~"( struct "~Ts~" x ) {\n";
+                ////////////////
+                // Which type of compare
+                static if(n < INT_END)
+                        enum MODE = 1; // Int
+                else static if(n < SSE_END)
+                        enum MODE = 2; // Float
+                else    enum MODE = 3; // Mix
+
+                auto nn  = n.stringof;
+
+                /* Begin */
+
+                code ~= "asm(\n";
+                final switch( MODE )
+                {
+                case 1:
+                code ~= `"movq  %rdi, reg\n" "movq  %rsi, reg+8\n"`;
+                break;
+                case 2:
+                code ~= `"movq %xmm0, reg\n" "movq %xmm1, reg+8\n"`;
+                break;
+                case 3:
+                code ~= `"movq %xmm0, reg\n" "movq  %rdi, reg+8\n"`;
+                }
+                code ~= "\n);\n";
+                code ~= "}\n";
+
+                ////////////////
+                code ~= "void func_call_"~Ts~"( void ) {\n";
+                code ~= "struct "~Ts~" x = { ";
+                code ~= value[0..len*3] ~ " };\n";
+                code ~= "func_pass_"~Ts~"( x );\n}\n";
+        }
+        return code;
+}
+string c_generate_main()
+{
+        string code = "void main() {\n";
+
+        foreach( int n, T; ALL_T )
+        {
+                // Which type of compare
+                static if(n < INT_END)
+                        enum MODE = 1; // Int
+                else static if(n < SSE_END)
+                        enum MODE = 2; // Float
+                else    enum MODE = 3; // Mix
+
+                auto nn  = n.stringof;
+                auto Ts  = T.stringof;
+
+                /* Begin */
+
+                code ~= `printf("/* %3d  `~Ts~`\t*/ ", `~nn~`);`"\n";
+                if( !(expected[n] & 1) )
+                {
+                        code ~= `printf("null,\n");`"\n";
+                        continue;
+                }
+                code ~= "asm(\n";
+                code ~= `"call func_ret_`~Ts~`\n"`"\n";
+                final switch( MODE )
+                {
+                case 1:
+                code ~= `"movq  %rax, reg\n" "movq  %rdx, reg+8\n"`;
+                break;
+                case 2:
+                code ~= `"movq %xmm0, reg\n" "movq %xmm1, reg+8\n"`;
+                break;
+                case 3:
+                code ~= `"movq %xmm0, reg\n" "movq  %rax, reg+8\n"`;
+                }
+                code ~= "\n);\n";
+
+                code ~= `printf("[ 0x%016lx", reg.r1 );`"\n";
+
+                if( T.sizeof > 8  || MODE == 3 )
+                        code ~= `printf(", 0x%016lx ],\n", reg.r2 );`"\n";
+                else    code ~= `printf(",   %015c  ],\n", ' '    );`"\n";
+        }
+
+        foreach( int n, T; ALL_T )
+        {
+                // Which type of compare
+                static if(n < INT_END)
+                        enum MODE = 1; // Int
+                else static if(n < SSE_END)
+                        enum MODE = 2; // Float
+                else    enum MODE = 3; // Mix
+
+                auto nn  = n.stringof;
+                auto Ts  = T.stringof;
+
+                /* Begin */
+
+                code ~= `printf("/* %3d  `~Ts~`\t*/ ", `~nn~`);`"\n";
+                if( !(expected[n] & 1) )
+                {
+                        code ~= `printf("null,\n");`"\n";
+                        continue;
+                }
+                code ~= "func_call_"~Ts~"();\n";
+
+                code ~= `printf("[ 0x%016lx", reg.r1 );`"\n";
+
+                if( T.sizeof > 8  || MODE == 3 )
+                        code ~= `printf(", 0x%016lx ],\n", reg.r2 );`"\n";
+                else    code ~= `printf(",   %015c  ],\n", ' '    );`"\n";
+        }
+
+
+        return code ~ "}";
+}
+pragma(msg, c_generate_returns() );
+pragma(msg, c_generate_pass() );
+pragma(msg, c_generate_main() );
+// +/
+
+/+
+/**
+ * Generate Functions that pass/return each Struct type
+ *
+ * ( Easier to look at objdump this way )
+ */
+string d_generate_functions( )
+{
+        string code = "extern(C) {";
+
+        // pass
+        foreach( s; ALL_T )
+        {
+                string ss = s.stringof;
+
+                code ~= "void func_in_"~ss~"( "~ss~" t ) { t.a = 12; }\n";
+        }
+        // return
+        foreach( s; ALL_T[0..10] )
+        {
+                string ss = s.stringof;
+
+                code ~= `
+                auto func_out_`~ss~`()
+                {
+                        `~ss~` t;
+                        foreach( i, ref e; t.tupleof )  e = i+1;
+                        return t;
+                }`;
+        }
+        // pass & return
+        foreach( s; ALL_T[0..10] )
+        {
+                string ss = s.stringof;
+
+                code ~= `
+                auto func_inout_`~ss~`( `~ss~` t )
+                {
+                        foreach( i, ref e; t.tupleof )  e += 10;
+                        return t;
+                }`;
+        }
+        return code ~ "\n} // extern(C)\n";
+}
+//pragma( msg, d_generate_functions() );
+mixin( d_generate_functions() );
+// +/
+
diff --git a/gcc/testsuite/gdc.test/runnable/testappend.d b/gcc/testsuite/gdc.test/runnable/testappend.d
new file mode 100644
index 00000000000..cbdae36b96c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testappend.d
@@ -0,0 +1,68 @@
+// PERMUTE_ARGS:
+
+import core.stdc.stdio;
+import core.stdc.math : isnan;
+
+void test12826()
+{
+    string s, t;
+    t = t ~ "1234567";
+    s = s ~ "1234567";
+
+    s ~= s;
+    assert(s == "12345671234567", s);
+    assert(t == "1234567", t);
+}
+
+
+int main()
+{
+    int[] a;
+
+    for (int i = 0; i < 1000; i++)
+    {
+        a.length = a.length + 100;
+    }
+    foreach (v; a)
+    {
+        assert(v == 0);
+    }
+
+    float[] b;
+    for (int i = 0; i < 2000; i++)
+    {
+        b.length = b.length + 100;
+    }
+    foreach (v; b)
+    {
+        assert(isnan(v));
+    }
+    delete a;
+    delete b;
+
+    a = null;
+    for (int i = 0; i < 100000; i++)
+    {
+        a ~= i;
+    }
+    foreach (k, v; a)
+    {
+        assert(v == k);
+    }
+
+    b = null;
+    for (int i = 0; i < 200000; i++)
+    {
+        b ~= i;
+    }
+    foreach (k, v; b)
+    {
+        assert(v == k);
+    }
+    delete a;
+    delete b;
+
+    test12826();
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testargtypes.d b/gcc/testsuite/gdc.test/runnable/testargtypes.d
new file mode 100644
index 00000000000..343a1c80e14
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testargtypes.d
@@ -0,0 +1,113 @@
+
+void chkArgTypes(S, V...)()
+{
+    pragma(msg, S);
+    static if (is(S U == __argTypes))
+    {
+        foreach (T; U) { pragma(msg, T); }
+        static assert(U.length == V.length);
+        foreach (i, T; U)
+            static assert(is(V[i] == T));
+    }
+    else
+        static assert(0);
+}
+
+void chkSingle(T,U)()
+{
+    struct S { T a; }
+    chkArgTypes!(S, U)();
+}
+
+void chkIdentity(T)()
+{
+    chkSingle!(T,T)();
+}
+
+void chkPair(T,U,V)()
+{
+    struct S { T a; U b; }
+    chkArgTypes!(S, V)();
+}
+
+version (X86_64)
+{
+    int main()
+    {
+        chkIdentity!byte();
+        chkIdentity!ubyte();
+        chkIdentity!short();
+        chkIdentity!ushort();
+        chkIdentity!int();
+        chkIdentity!uint();
+        chkIdentity!long();
+        chkIdentity!ulong();
+        chkSingle!(char,ubyte)();
+        chkSingle!(wchar,ushort)();
+        chkSingle!(dchar,uint)();
+
+        chkIdentity!float();
+        chkIdentity!double();
+        chkIdentity!real();
+
+        chkIdentity!(void*)();
+
+        chkIdentity!(__vector(byte[16]))();
+        chkIdentity!(__vector(ubyte[16]))();
+        chkIdentity!(__vector(short[8]))();
+        chkIdentity!(__vector(ushort[8]))();
+        chkIdentity!(__vector(int[4]))();
+        chkIdentity!(__vector(uint[4]))();
+        chkIdentity!(__vector(long[2]))();
+        chkIdentity!(__vector(ulong[2]))();
+
+        chkIdentity!(__vector(float[4]))();
+        chkIdentity!(__vector(double[2]))();
+
+        chkPair!(byte,byte,short);
+        chkPair!(ubyte,ubyte,short);
+        chkPair!(short,short,int);
+        chkPair!(int,int,long);
+
+        chkPair!(byte,short,int);
+        chkPair!(short,byte,int);
+
+        chkPair!(int,float,long);
+        chkPair!(float,int,long);
+        chkPair!(byte,float,long);
+        chkPair!(float,short,long);
+
+        //struct S1 { long a; long b; }
+        //chkArgTypes!(S1, long, long)();
+
+        struct S2 { union { long a; double d; }}
+        chkArgTypes!(S2, long)();
+
+        struct S3 { union { double d; long a; }}
+        chkArgTypes!(S3, long)();
+
+        struct S4 { int a,b,c,d,e; }
+        chkArgTypes!(S4)();
+
+        struct S5 { align(1): char a; int b; }
+        chkArgTypes!(S5)();
+
+        struct S6 { align(1): int a; void* b; }
+        chkArgTypes!(S5)();
+
+        struct S7 { union { void* p; real r; }}
+        chkArgTypes!(S7)();
+
+        struct S8 { union { real r; void* p; }}
+        chkArgTypes!(S8)();
+
+        return 0;
+    }
+}
+else
+{
+    int main()
+    {
+        return 0;
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testarray.d b/gcc/testsuite/gdc.test/runnable/testarray.d
new file mode 100644
index 00000000000..4784f47b5cb
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testarray.d
@@ -0,0 +1,65 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS:
+
+import core.memory;
+
+// see http://forum.dlang.org/thread/4BB6296E.6050506@digitalmars.com for more info
+
+// failure case for bug fixed by druntime rev 282
+// how it works:
+// The erroneous code used the first element in the LRU cache to determine the
+// length of the block, instead of looking at the current blocks blockinfo.  So
+// we need a somewhat alignment of moons to get this to fail.  First, we create
+// the perfect storm: 1) a long blockinfo at the beginning (size = 32), 2) the
+// second blockinfo is smaller (16 bytes) and 3) a block of memory that is
+// exactly 16 bytes past the element in the 2nd block.  While this seems kind
+// of unlikely, in code that uses a lot of appending, it can easily happen.
+//
+// The bug causes the array appender to think that a pointer in the 16 bytes
+// past the second blockinfo is actually in the second blockinfo.  This is
+// because it uses the length from the first blockinfo for checking (which is
+// 32, so since the pointer is only 16 bytes into the block, it is considered
+// inside).
+// On top of all this, the third block must be marked as containing pointers,
+// and the second block not containing pointers.  The reason is because, it's
+// impossible for the runtime to append in place, since the outside pointer
+// can't possibly match the array length in the block.  But because the runtime
+// copies the blockinfo's attributes when reallocating, it copies the
+// attributes from the *wrong* block.  The only way to make this cause a
+// problem would be to then collect memory, which should incorrectly deallocate
+// data that the array containing pointers points to, and then use those
+// pointers.  However, for our purposes, we know this is possible, but we can
+// deterministically check the attributes of the array after appending and
+// verify that they are wrong.
+//
+void main()
+{
+    // fill up the cache to make it wrap, The block info cache has 8 elements,
+    // and the first element is not the first one filled, so we want to wrap to
+    // that first element we want to fill in
+    for(int i = 0; i < 7; i++)
+    {
+        auto n = new int[1];
+        n ~= 1;
+    }
+
+    // this will allocate a 32-byte block, and appending will insert it into
+    // the cache at the beginning.
+    auto y = new int[4];
+    y ~= 1;
+
+    // now, allocate a 16 byte block with pointers, this will be our block that
+    // gets corrupted.  The current GC allocates down, so we allocate this one
+    // first.
+    auto x = new char[][1];
+
+    // this block contains no pointers, and appending will insert it into the
+    // second element of the cache
+    y = new int[1];
+    y ~= 1;
+
+    // verify the noscan flag is 0 on the pointer-containing blocks
+    assert((GC.getAttr(x.ptr) & GC.BlkAttr.NO_SCAN) == 0);
+    x ~= "hello".dup; // this should leave the attributes alone
+    assert((GC.getAttr(x.ptr) & GC.BlkAttr.NO_SCAN) == 0); // fails on 2.042
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testassign.d b/gcc/testsuite/gdc.test/runnable/testassign.d
new file mode 100644
index 00000000000..f20da4afdf2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testassign.d
@@ -0,0 +1,1199 @@
+import core.stdc.stdio;
+
+template TypeTuple(T...){ alias T TypeTuple; }
+
+/***************************************************/
+// 2625
+
+struct Pair {
+    immutable uint g1;
+    uint g2;
+}
+
+void test1() {
+    Pair[1] stuff;
+    static assert(!__traits(compiles, (stuff[0] = Pair(1, 2))));
+}
+
+/***************************************************/
+// 5327
+
+struct ID
+{
+    immutable int value;
+}
+
+struct Data
+{
+    ID id;
+}
+void test2()
+{
+    Data data = Data(ID(1));
+    immutable int* val = &data.id.value;
+    static assert(!__traits(compiles, data = Data(ID(2))));
+}
+
+/***************************************************/
+
+struct S31A
+{
+    union
+    {
+        immutable int field1;
+        immutable int field2;
+    }
+
+    enum result = false;
+}
+struct S31B
+{
+    union
+    {
+        immutable int field1;
+        int field2;
+    }
+
+    enum result = true;
+}
+struct S31C
+{
+    union
+    {
+        int field1;
+        immutable int field2;
+    }
+
+    enum result = true;
+}
+struct S31D
+{
+    union
+    {
+        int field1;
+        int field2;
+    }
+
+    enum result = true;
+}
+
+struct S32A
+{
+    int dummy0;
+    union
+    {
+        immutable int field1;
+        int field2;
+    }
+
+    enum result = true;
+}
+struct S32B
+{
+    immutable int dummy0;
+    union
+    {
+        immutable int field1;
+        int field2;
+    }
+
+    enum result = false;
+}
+
+
+struct S32C
+{
+    union
+    {
+        immutable int field1;
+        int field2;
+    }
+    int dummy1;
+
+    enum result = true;
+}
+struct S32D
+{
+    union
+    {
+        immutable int field1;
+        int field2;
+    }
+    immutable int dummy1;
+
+    enum result = false;
+}
+
+void test3()
+{
+    foreach (S; TypeTuple!(S31A,S31B,S31C,S31D, S32A,S32B,S32C,S32D))
+    {
+        S s;
+        static assert(__traits(compiles, s = s) == S.result);
+    }
+}
+
+/***************************************************/
+// 3511
+
+struct S4
+{
+    private int _prop = 42;
+    ref int property() { return _prop; }
+}
+
+void test4()
+{
+    S4 s;
+    assert(s.property == 42);
+    s.property = 23;    // Rewrite to s.property() = 23
+    assert(s.property == 23);
+}
+
+/***************************************************/
+
+struct S5
+{
+    int mX;
+    string mY;
+
+    ref int x()
+    {
+        return mX;
+    }
+    ref string y()
+    {
+        return mY;
+    }
+
+    ref int err(Object)
+    {
+        static int v;
+        return v;
+    }
+}
+
+void test5()
+{
+    S5 s;
+    s.x += 4;
+    assert(s.mX == 4);
+    s.x -= 2;
+    assert(s.mX == 2);
+    s.x *= 4;
+    assert(s.mX == 8);
+    s.x /= 2;
+    assert(s.mX == 4);
+    s.x %= 3;
+    assert(s.mX == 1);
+    s.x <<= 3;
+    assert(s.mX == 8);
+    s.x >>= 1;
+    assert(s.mX == 4);
+    s.x >>>= 1;
+    assert(s.mX == 2);
+    s.x &= 0xF;
+    assert(s.mX == 0x2);
+    s.x |= 0x8;
+    assert(s.mX == 0xA);
+    s.x ^= 0xF;
+    assert(s.mX == 0x5);
+
+    s.x ^^= 2;
+    assert(s.mX == 25);
+
+    s.mY = "ABC";
+    s.y ~= "def";
+    assert(s.mY == "ABCdef");
+
+    static assert(!__traits(compiles, s.err += 1));
+}
+
+/***************************************************/
+// 4424
+
+void test4424()
+{
+    static struct S
+    {
+        this(this) {}
+        void opAssign(T)(T rhs) if (!is(T == S)) {}
+    }
+}
+
+/***************************************************/
+// 6174
+
+struct CtorTest6174(Data)
+{
+    const Data data;
+
+    const Data[2] sa1;
+    const Data[2][1] sa2;
+    const Data[][2] sa3;
+
+    const Data[] da1;
+    const Data[2][] da2;
+
+    this(Data a)
+    {
+        auto pdata = &data;
+
+        // If compiler can determine that an assignment really sets the fields
+        // which belongs to `this` object, it can bypass const qualifier.
+        // For example, sa3, da1, da2, and pdata have indirections.
+        // As long as you don't try to rewrite values beyond the indirections,
+        // an assignment will always be succeeded inside constructor.
+
+        static assert( is(typeof( data        = a         )));    // OK
+      static if (is(Data == struct))
+      {
+        static assert( is(typeof( data.x      = 1         )));    // OK
+        static assert( is(typeof( data.y      = 2         )));    // OK
+      }
+        static assert(!is(typeof( *pdata      = a         )));    // NG
+        static assert( is(typeof( *&data      = a         )));    // OK
+
+        static assert( is(typeof( sa1         = [a,a]     )));    // OK
+        static assert( is(typeof( sa1[0]      = a         )));    // OK
+        static assert( is(typeof( sa1[]       = a         )));    // OK
+        static assert( is(typeof( sa1[][]     = a         )));    // OK
+
+        static assert( is(typeof( sa2         = [[a,a]]   )));    // OK
+        static assert( is(typeof( sa2[0][0]   = a         )));    // OK
+        static assert( is(typeof( sa2[][0][]  = a         )));    // OK
+        static assert( is(typeof( sa2[0][][0] = a         )));    // OK
+
+        static assert( is(typeof( sa3         = [[a],[]]  )));    // OK
+        static assert( is(typeof( sa3[0]      = [a,a]     )));    // OK
+        static assert(!is(typeof( sa3[0][0]   = a         )));    // NG
+        static assert( is(typeof( sa3[]       = [a]       )));    // OK
+        static assert( is(typeof( sa3[][0]    = [a]       )));    // OK
+        static assert(!is(typeof( sa3[][0][0] = a         )));    // NG
+
+        static assert( is(typeof( da1         = [a,a]     )));    // OK
+        static assert(!is(typeof( da1[0]      = a         )));    // NG
+        static assert(!is(typeof( da1[]       = a         )));    // NG
+
+        static assert( is(typeof( da2         = [[a,a]]   )));    // OK
+        static assert(!is(typeof( da2[0][0]   = a         )));    // NG
+        static assert(!is(typeof( da2[]       = [a,a]     )));    // NG
+        static assert(!is(typeof( da2[][0]    = a         )));    // NG
+        static assert(!is(typeof( da2[0][]    = a         )));    // NG
+    }
+    void func(Data a)
+    {
+        auto pdata = &data;
+
+        static assert(!is(typeof( data        = a         )));    // NG
+      static if (is(Data == struct))
+      {
+        static assert(!is(typeof( data.x      = 1         )));    // NG
+        static assert(!is(typeof( data.y      = 2         )));    // NG
+      }
+        static assert(!is(typeof( *pdata      = a         )));    // NG
+        static assert(!is(typeof( *&data      = a         )));    // NG
+
+        static assert(!is(typeof( sa1         = [a,a]     )));    // NG
+        static assert(!is(typeof( sa1[0]      = a         )));    // NG
+        static assert(!is(typeof( sa1[]       = a         )));    // NG
+        static assert(!is(typeof( sa1[][]     = a         )));    // NG
+
+        static assert(!is(typeof( sa2         = [[a,a]]   )));    // NG
+        static assert(!is(typeof( sa2[0][0]   = a         )));    // NG
+        static assert(!is(typeof( sa2[][0][]  = a         )));    // NG
+        static assert(!is(typeof( sa2[0][][0] = a         )));    // NG
+
+        static assert(!is(typeof( sa3         = [[a],[]]  )));    // NG
+        static assert(!is(typeof( sa3[0]      = [a,a]     )));    // NG
+        static assert(!is(typeof( sa3[0][0]   = a         )));    // NG
+        static assert(!is(typeof( sa3[]       = [a]       )));    // NG
+        static assert(!is(typeof( sa3[][0]    = [a]       )));    // NG
+        static assert(!is(typeof( sa3[][0][0] = a         )));    // NG
+
+        static assert(!is(typeof( da1         = [a,a]     )));    // NG
+        static assert(!is(typeof( da1[0]      = a         )));    // NG
+        static assert(!is(typeof( da1[]       = a         )));    // NG
+
+        static assert(!is(typeof( da2         = [[a,a]]   )));    // NG
+        static assert(!is(typeof( da2[0][0]   = a         )));    // NG
+        static assert(!is(typeof( da2[]       = [a,a]     )));    // NG
+        static assert(!is(typeof( da2[][0]    = a         )));    // NG
+        static assert(!is(typeof( da2[0][]    = a         )));    // NG
+    }
+}
+
+const char gc6174;
+const char[1] ga6174;
+static this()
+{
+    gc6174 = 'a';    // OK
+    ga6174[0] = 'a'; // line 5, Err
+}
+struct Foo6174
+{
+    const char cc;
+    const char[1] array;
+    const char[1] arr;
+    this(char c)
+    {
+        cc = c;       // OK
+        array = [c];  // line 12, Err
+        arr[0] = c;   // line 12, Err
+    }
+}
+void test6174a()
+{
+    static struct Pair
+    {
+        const int x;
+        int y;
+    }
+    alias CtorTest6174!long CtorTest1;
+    alias CtorTest6174!Pair CtorTest2;
+
+    auto foo = Foo6174('c');
+}
+
+/***************************************************/
+
+template Select(bool cond, T, F)
+{
+    static if (cond)
+        alias Select = T;
+    else
+        alias Select = F;
+}
+
+void test6174b()
+{
+    enum { none, unrelated, mutable, constant }
+
+    static struct FieldStruct(bool c, int k)
+    {
+        enum fieldConst = c;
+        enum assignKind = k;
+
+        Select!(fieldConst, const int, int) x;
+        int y;
+
+        static if (assignKind == none)      {}
+        static if (assignKind == unrelated) void opAssign(int) {}
+        static if (assignKind == mutable)   void opAssign(FieldStruct) {}
+        static if (assignKind == constant)  void opAssign(FieldStruct) const {}
+    }
+    static struct TestStruct(F, bool fieldConst)
+    {
+        int w;
+        Select!(fieldConst, const F, F) f;
+        Select!(fieldConst, const int, int) z;
+
+        this(int)
+        {
+            // If F has an identity `opAssign`,it is used even for initializing.
+            // Otherwise, initializing  will always succeed, by bypassing const qualifier.
+            static assert(is(typeof( f = F() )) == (
+                            F.assignKind == none ||
+                            F.assignKind == unrelated ||
+                            F.assignKind == mutable ||
+                            F.assignKind == constant));
+
+            static assert(is(typeof(   w = 1000 )) == true);
+            static assert(is(typeof( f.x = 1000 )) == true);
+            static assert(is(typeof( f.y = 1000 )) == true);
+            static assert(is(typeof(   z = 1000 )) == true);
+        }
+        void func()
+        {
+            // In mutable member functions, identity assignment is allowed
+            // when all of the fields are identity assignable,
+            // or identity `opAssign`, which callable from mutable object, is defined.
+            static assert(__traits(compiles, f = F()) == (
+                            F.assignKind == none      && !fieldConst && !F.fieldConst ||
+                            F.assignKind == unrelated && !fieldConst && !F.fieldConst ||
+                            F.assignKind == constant ||
+                            F.assignKind == mutable   && !fieldConst));
+
+            static assert(__traits(compiles,   w = 1000) == true);
+            static assert(__traits(compiles, f.x = 1000) == (!fieldConst && !F.fieldConst));
+            static assert(__traits(compiles, f.y = 1000) == (!fieldConst && true         ));
+            static assert(__traits(compiles,   z = 1000) == !fieldConst);
+        }
+        void func() const
+        {
+            // In non-mutable member functions, identity assignment is allowed
+            // just only user-defined identity `opAssign` is qualified.
+            static assert(__traits(compiles, f = F()) == (F.assignKind == constant));
+
+            static assert(__traits(compiles,   w = 1000) == false);
+            static assert(__traits(compiles, f.x = 1000) == false);
+            static assert(__traits(compiles, f.y = 1000) == false);
+            static assert(__traits(compiles,   z = 1000) == false);
+        }
+    }
+    foreach (fieldConst; TypeTuple!(false, true))
+    foreach (  hasConst; TypeTuple!(false, true))
+    foreach (assignKind; TypeTuple!(none, unrelated, mutable, constant))
+    {
+        alias TestStruct!(FieldStruct!(hasConst, assignKind), fieldConst) TestX;
+    }
+}
+
+void test6174c()
+{
+    static assert(!is(typeof({
+        int func1a(int n)
+        in{ n = 10; }
+        body { return n; }
+    })));
+    static assert(!is(typeof({
+        int func1b(int n)
+        out(r){ r = 20; }
+        body{ return n; }
+    })));
+
+    struct DataX
+    {
+        int x;
+    }
+    static assert(!is(typeof({
+        DataX func2a(DataX n)
+        in{ n.x = 10; }
+        body { return n; }
+    })));
+    static assert(!is(typeof({
+        DataX func2b(DataX n)
+        in{}
+        out(r){ r.x = 20; }
+        body{ return n; }
+    })));
+}
+
+/***************************************************/
+// 6216
+
+void test6216a()
+{
+    static class C{}
+
+    static struct Xa{ int n; }
+    static struct Xb{ int[] a; }
+    static struct Xc{ C c; }
+    static struct Xd{ void opAssign(typeof(this) rhs){} }
+    static struct Xe{ void opAssign(T)(T rhs){} }
+    static struct Xf{ void opAssign(int rhs){} }
+    static struct Xg{ void opAssign(T)(T rhs)if(!is(T==typeof(this))){} }
+
+    // has value type as member
+    static struct S1 (X){ static if (!is(X==void)) X x; int n; }
+
+    // has reference type as member
+    static struct S2a(X){ static if (!is(X==void)) X x; int[] a; }
+    static struct S2b(X){ static if (!is(X==void)) X x; C c; }
+
+    // has identity opAssign
+    static struct S3a(X){ static if (!is(X==void)) X x; void opAssign(typeof(this) rhs){} }
+    static struct S3b(X){ static if (!is(X==void)) X x; void opAssign(T)(T rhs){} }
+
+    // has non identity opAssign
+    static struct S4a(X){ static if (!is(X==void)) X x; void opAssign(int rhs){} }
+    static struct S4b(X){ static if (!is(X==void)) X x; void opAssign(T)(T rhs)if(!is(T==typeof(this))){} }
+
+    enum result = [
+        /*S1,   S2a,    S2b,    S3a,    S3b,    S4a,    S4b*/
+/*- */  [true,  true,   true,   true,   true,   true,   true],
+/*Xa*/  [true,  true,   true,   true,   true,   true,   true],
+/*Xb*/  [true,  true,   true,   true,   true,   true,   true],
+/*Xc*/  [true,  true,   true,   true,   true,   true,   true],
+/*Xd*/  [true,  true,   true,   true,   true,   true,   true],
+/*Xe*/  [true,  true,   true,   true,   true,   true,   true],
+/*Xf*/  [true,  true,   true,   true,   true,   true,   true],
+/*Xg*/  [true,  true,   true,   true,   true,   true,   true],
+    ];
+
+    pragma(msg, "\\\tS1\tS2a\tS2b\tS3a\tS3b\tS4a\tS4b");
+    foreach (i, X; TypeTuple!(void,Xa,Xb,Xc,Xd,Xe,Xf,Xg))
+    {
+        S1!X  s1;
+        S2a!X s2a;
+        S2b!X s2b;
+        S3a!X s3a;
+        S3b!X s3b;
+        S4a!X s4a;
+        S4b!X s4b;
+
+        pragma(msg,
+                is(X==void) ? "-" : X.stringof,
+                "\t", __traits(compiles, (s1  = s1)),
+                "\t", __traits(compiles, (s2a = s2a)),
+                "\t", __traits(compiles, (s2b = s2b)),
+                "\t", __traits(compiles, (s3a = s3a)),
+                "\t", __traits(compiles, (s3b = s3b)),
+                "\t", __traits(compiles, (s4a = s4a)),
+                "\t", __traits(compiles, (s4b = s4b))  );
+
+        static assert(result[i] ==
+            [   __traits(compiles, (s1  = s1)),
+                __traits(compiles, (s2a = s2a)),
+                __traits(compiles, (s2b = s2b)),
+                __traits(compiles, (s3a = s3a)),
+                __traits(compiles, (s3b = s3b)),
+                __traits(compiles, (s4a = s4a)),
+                __traits(compiles, (s4b = s4b))  ]);
+    }
+}
+
+void test6216b()
+{
+    static int cnt = 0;
+
+    static struct X
+    {
+        int n;
+        void opAssign(X rhs){ cnt = 1; }
+    }
+    static struct S
+    {
+        int n;
+        X x;
+    }
+
+    S s;
+    s = s;
+    assert(cnt == 1);
+    // Built-in opAssign runs member's opAssign
+}
+
+void test6216c()
+{
+    static int cnt = 0;
+
+    static struct X
+    {
+        int n;
+        void opAssign(const X rhs) const { cnt = 2; }
+    }
+    static struct S
+    {
+        int n;
+        const(X) x;
+    }
+
+    S s;
+    const(S) cs;
+    s = s;
+    s = cs;     // cs is copied as mutable and assigned into s
+    assert(cnt == 2);
+    static assert(!__traits(compiles, cs = cs));
+                // built-in opAssin is only allowed with mutable object
+}
+
+void test6216d()
+{
+    static int cnt = 0;
+
+    static struct X
+    {
+        int[] arr;  // X has mutable indirection
+        void opAssign(const X rhs) const { ++cnt; }
+    }
+    static struct S
+    {
+        int n;
+        const(X) x;
+    }
+
+    X mx;
+    const X cx;
+    mx = mx;    // copying mx to const X is possible
+    assert(cnt == 1);
+    mx = cx;
+    assert(cnt == 2);
+    cx = mx;    // copying mx to const X is possible
+    assert(cnt == 3);
+
+    S s;
+    const(S) cs;
+    s = s;
+    s = cs;
+    //assert(cnt == 4);
+    static assert(!__traits(compiles, cs = cs));
+                // built-in opAssin is only allowed with mutable object
+}
+
+void test6216e()
+{
+    static struct X
+    {
+        int x;
+        @disable void opAssign(X);
+    }
+    static struct S
+    {
+        X x;
+    }
+    S s;
+    static assert(!__traits(compiles, s = s));
+                // built-in generated opAssin is marked as @disable.
+}
+
+/***************************************************/
+// 6286
+
+void test6286()
+{
+    const(int)[4] src = [1, 2, 3, 4];
+    int[4] dst;
+    dst = src;
+    dst[] = src[];
+    dst = 4;
+    int[4][4] x;
+    x = dst;
+}
+
+/***************************************************/
+// 6336
+
+void test6336()
+{
+    // structs aren't identity assignable
+    static struct S1
+    {
+        immutable int n;
+    }
+    static struct S2
+    {
+        void opAssign(int n){ assert(0); }
+    }
+
+    S1 s1;
+    S2 s2;
+
+    void f(S)(out S s){}
+    static assert(!__traits(compiles, f(s1)));
+    f(s2);
+    // Out parameters refuse only S1 because it isn't blit assignable
+
+    ref S g(S)(ref S s){ return s; }
+    g(s1);
+    g(s2);
+    // Allow return by ref both S1 and S2
+}
+
+/***************************************************/
+// 8783
+
+struct Foo8783
+{
+    int[1] bar;
+}
+
+const Foo8783[1] foos8783;
+
+static this()
+{
+    foreach (i; 0 .. foos8783.length)
+        foos8783[i].bar[i] = 1; // OK
+    foreach (i, ref f; foos8783)
+        f.bar[i] = 1; // line 9, Error
+}
+
+/***************************************************/
+// 9077
+
+struct S9077a
+{
+    void opAssign(int n) {}
+    void test() { typeof(this) s; s = this; }
+    this(this) {}
+}
+struct S9077b
+{
+    void opAssign()(int n) {}
+    void test() { typeof(this) s; s = this; }
+    this(this) {}
+}
+
+/***************************************************/
+// 9140
+
+immutable(int)[] bar9140()
+out(result) {
+    foreach (ref r; result) {}
+} body {
+    return null;
+}
+
+/***************************************************/
+// 9154
+
+struct S9154a
+{
+    int x;
+    void opAssign(ref S9154a s) { }
+}
+struct S9154b
+{
+    int x;
+    void opAssign(X)(ref X s) { }
+}
+struct T9154
+{
+    S9154a member1;
+    S9154b member2;
+}
+
+void test9154()
+{
+    T9154 t1, t2;
+    t1 = t2;
+}
+
+/***************************************************/
+// 9258
+
+class A9258 {}
+class B9258 : A9258 // Error: class test.B9258 identity assignment operator overload is illegal
+{
+    void opAssign(A9258 b) {}
+}
+
+class C9258
+{
+    int n;
+    alias n this;
+    void opAssign(int n) {}
+}
+class D9258
+{
+    int n;
+    alias n this;
+    void opAssign(int n, int y = 0) {}
+}
+class E9258 : A9258
+{
+    void set(A9258 a) {}
+    alias set opAssign;
+}
+
+/***************************************************/
+// 9416
+
+struct S9416
+{
+    void opAssign()(S9416)
+    {
+        static assert(0);
+    }
+}
+struct U9416
+{
+    S9416 s;
+}
+void test9416()
+{
+    U9416 u;
+    static assert(__traits(allMembers, U9416)[$-1] == "opAssign");
+    static assert(!__traits(compiles, u = u));
+}
+
+/***************************************************/
+// 9658
+
+struct S9658
+{
+    private bool _isNull = true;
+    this(int v) const
+    {
+        _isNull = false;    // cannot modify const expression this._isNull
+    }
+}
+
+/***************************************************/
+// 11187
+
+void test11187()
+{
+    static struct X
+    {
+        int[] arr;
+    }
+    static struct S
+    {
+        const(X) cx;
+    }
+    static assert(is(typeof((const S).init.cx.arr) == const(int[])));
+    static assert(is(typeof((      S).init.cx.arr) == const(int[])));
+    const S sc;
+    S sm = sc;
+    static assert(is(const S : S));
+}
+
+/***************************************************/
+// 12131
+
+struct X12131
+{
+    void opAssign()(X12131 y) pure {}
+}
+
+struct Y12131
+{
+    X12131 a;
+}
+
+void test12131() pure
+{
+    X12131 x;
+    x = X12131();   // OK
+
+    Y12131 y;
+    y = Y12131();   // OK <- Error
+}
+
+/***************************************************/
+// 12211
+
+void test12211()
+{
+    int a = 0;
+    void foo(ref int x)
+    {
+        assert(x == 10);
+        assert(&x == &a);
+        x = 3;
+    }
+    foo(a = 10);
+    assert(a == 3);
+    foo(a += 7);
+    assert(a == 3);
+
+    // array ops should make rvalue
+    int[3] sa, sb;
+    void bar(ref int[]) {}
+    static assert(!__traits(compiles, bar(sa[]  = sb[])));
+    static assert(!__traits(compiles, bar(sa[] += sb[])));
+}
+
+/***************************************************/
+// 4791 (dup of 12212)
+
+void test4791()
+{
+    int[2] na;
+    na = na;
+
+    static struct S
+    {
+        static string res;
+        int n;
+        this(this) { ++n; res ~= "p" ~ cast(char)('0' + n); }
+        ~this()    {      res ~= "d" ~ cast(char)('0' + n); }
+    }
+    {
+        S[3] sa;
+        sa[0].n = 1, sa[1].n = 2, sa[2].n = 3;
+
+        S.res = null;
+        sa = sa;
+        assert(S.res == "p2d1p3d2p4d3");
+        assert(sa[0].n == 2 && sa[1].n == 3 && sa[2].n == 4);
+
+        S.res = null;
+    }
+    assert(S.res == "d4d3d2");
+}
+
+/***************************************************/
+// 12212
+
+void test12212()
+{
+    struct S
+    {
+        int x, y;
+        static int cpctor;
+        this(this) { cpctor++; }
+    }
+
+    void funcVal(E)(E[3] x) {}
+    auto funcRef(E)(ref E[3] x) { return &x; }
+    ref get(E)(ref E[3] a){ return a; }
+
+    {
+        int[3] a, b;
+        funcVal(a = b);
+
+        auto p = funcRef(a = b);
+        assert(p == &a);
+    }
+
+    {
+        S.cpctor = 0;
+
+        S[3] a, b;
+        assert(S.cpctor == 0);
+
+        S[3] c = a;
+        //printf("cpctpr = %d\n", S.cpctor);
+        assert(S.cpctor == 3);
+        S.cpctor = 0;
+
+        c = a;
+        //printf("cpctpr = %d\n", S.cpctor);
+        assert(S.cpctor == 3);
+        S.cpctor = 0;
+
+        c = (a = b);
+        //printf("cpctpr = %d\n", S.cpctor);
+        assert(S.cpctor == 6);
+        S.cpctor = 0;
+
+        c = (get(a) = b);
+        //printf("cpctpr = %d\n", S.cpctor);
+        assert(S.cpctor == 6);
+        S.cpctor = 0;
+    }
+    {
+        S.cpctor = 0;
+
+        S[3] a, b;
+        assert(S.cpctor == 0);
+
+        funcVal(a = b);
+        //printf("cpctpr = %d\n", S.cpctor);
+        assert(S.cpctor == 6);
+        S.cpctor = 0;
+
+        funcVal(get(a) = b);
+        //printf("cpctpr = %d\n", S.cpctor);
+        assert(S.cpctor == 6);
+        S.cpctor = 0;
+    }
+    {
+        S.cpctor = 0;
+
+        S[3] a, b;
+        assert(S.cpctor == 0);
+
+        S[3]* p;
+
+        p = funcRef(a = b);
+        //printf("cpctpr = %d\n", S.cpctor);
+        assert(p == &a);
+        assert(S.cpctor == 3);
+        S.cpctor = 0;
+
+        p = funcRef(get(a) = b);
+        assert(p == &a);
+        //printf("cpctpr = %d\n", S.cpctor);
+        assert(S.cpctor == 3);
+        S.cpctor = 0;
+    }
+}
+
+/***************************************************/
+// 12650
+
+void test12650()
+{
+    // AssignExp::toElem should make an lvalue of e1.
+    static class A1
+    {
+        struct S { int a; }
+
+        static foo(ref const(S) s)
+        {
+            assert(s.a == 2);
+            return &s;
+        }
+
+        S s;
+
+        this()
+        {
+            const v = S(2);
+
+            // (this.s = v) will become ConstructExp
+            auto p = foo(s = v);
+            assert(p == &s);
+        }
+    }
+    assert(new A1().s.a == 2);
+
+    static class A2
+    {
+        static foo(ref int[2] sa)
+        {
+            assert(sa[1] == 2);
+            return &sa;
+        }
+
+        int[2] sa;
+
+        this()
+        {
+            // (this.sa = [1,2]) will become ConstructExp
+            auto p = foo(sa = [1,2]);
+            assert(p == &sa);
+        }
+    }
+    assert(new A2().sa[1] == 2);
+
+    static class A3
+    {
+        static foo(ref int n)
+        {
+            assert(n == 2);
+            return &n;
+        }
+
+        int n;
+
+        this()
+        {
+            const v = 2;
+
+            // (this.n = v) will become ConstructExp
+            auto p = foo(n = v);
+            assert(p == &n);
+        }
+    }
+    assert(new A3().n == 2);
+}
+
+/***************************************************/
+// 13044
+
+void test13044()
+{
+    static struct Good
+    {
+        const int i;
+    }
+
+    static struct Bad
+    {
+        const int i;
+        ~this() {}
+    }
+
+    Good good1, good2;
+    static assert(!__traits(compiles, { good1 = good2; })); // OK
+
+    Bad bad1, bad2;
+    static assert(!__traits(compiles, { bad1 = bad2; }));   // OK <- fails
+}
+
+/***************************************************/
+// 12500
+
+void test12500()
+{
+    size_t foo;
+    ++foo *= 1.5;   // Rewrite to: (foo += 1) *= 1.5;
+}
+
+/***************************************************/
+// 14672
+
+void test14672()
+{
+    interface I {}
+
+    class B {}
+    class D : B, I {}
+
+    D d = new D();
+    D[] da = [d];
+    B[] ba = [null];
+    I[] ia = [null];
+
+    // ba and da points different payloads,
+    // so element-wise assignment should work.
+    ba[] = da[];    // OK <- e2ir ICE
+    assert(ba[0] is d);
+
+    // Today element-wise assignment is implemented as memcpy, For that reason
+    // the conversion from derived classes to base interfaces is disallowed
+    // because it requries offset adjustments.
+    static assert(!__traits(compiles, { ia[] = da[]; }));
+
+    // after the assignment, ba will wongly point the payload of da,
+    // that's typed as D[]. To aboid type system breaking, it's disallowed.
+    static assert(!__traits(compiles, { ba = da; }));
+
+    // the assigned array literal is a new payload,
+    // so rebinding ba should work.
+    ba = [d];       // OK
+    assert(ba[0] is d);
+}
+
+/***************************************************/
+// 15044
+
+void destroy15044(T)(ref T obj)
+{
+    static if (__traits(hasMember, T, "__xdtor"))
+        obj.__xdtor();
+    else
+        static assert(0, T.stringof);
+}
+
+struct V15044
+{
+    ~this()
+    {
+    }
+
+    RC15044!V15044 dup()
+    {
+        return RC15044!V15044(&this);
+    }
+}
+
+struct RC15044(T)
+{
+    ~this()
+    {
+        destroy15044(*t);
+        static assert(__traits(hasMember, T, "__xdtor"));
+    }
+    T* t;
+}
+
+/***************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test4424();
+    test6174a();
+    test6174b();
+    test6174c();
+    test6216a();
+    test6216b();
+    test6216c();
+    test6216d();
+    test6216e();
+    test6286();
+    test6336();
+    test9154();
+    test9416();
+    test11187();
+    test12131();
+    test12211();
+    test4791();
+    test12212();
+    test12650();
+    test13044();
+    test12500();
+    test14672();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testbitarray.d b/gcc/testsuite/gdc.test/runnable/testbitarray.d
new file mode 100644
index 00000000000..02044603e88
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testbitarray.d
@@ -0,0 +1,16 @@
+// PERMUTE_ARGS:
+
+import std.bitmanip;
+
+void main() {
+        BitArray a;
+        a.length = 5;
+        foreach (ref bool b; a) {
+                assert (b == 0);
+                b = 1;
+        }
+        foreach (bool b; a)
+                assert (b == 1); // FAILS, they're all 0
+}
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/testbounds.d b/gcc/testsuite/gdc.test/runnable/testbounds.d
new file mode 100644
index 00000000000..de031b90b29
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testbounds.d
@@ -0,0 +1,225 @@
+// REQUIRED_ARGS:
+
+// Test array bounds checking
+
+import core.exception;
+extern(C) int printf(const char*, ...);
+
+/******************************************/
+
+const int foos[10] = [1,2,3,4,5,6,7,8,9,10];
+const int food[]   = [21,22,23,24,25,26,27,28,29,30];
+const int *foop    = cast(int*) foos;
+
+static int x = 2;
+
+int index()
+{
+    return x++;
+}
+
+int tests(int i)
+{
+    return foos[index()];
+}
+
+int testd(int i)
+{
+    return food[index()];
+}
+
+int testp(int i)
+{
+    return foop[i];
+}
+
+const(int)[] slices(int lwr, int upr)
+{
+    return foos[lwr .. upr];
+}
+
+const(int)[] sliced(int lwr, int upr)
+{
+    return food[lwr .. upr];
+}
+
+const(int)[] slicep(int lwr, int upr)
+{
+    return foop[lwr .. upr];
+}
+
+void test1()
+{
+    int i;
+
+    i = tests(0);
+    assert(i == 3);
+
+    i = testd(0);
+    assert(i == 24);
+
+    i = testp(1);
+    assert(i == 2);
+
+    x = 10;
+    try
+    {
+        i = tests(0);
+    }
+    catch (RangeError a)
+    {
+        i = 73;
+    }
+    assert(i == 73);
+
+    x = -1;
+    try
+    {
+        i = testd(0);
+    }
+    catch (RangeError a)
+    {
+        i = 37;
+    }
+    assert(i == 37);
+
+    const(int)[] r;
+
+    r = slices(3,5);
+    assert(r[0] == foos[3]);
+    assert(r[1] == foos[4]);
+
+    r = sliced(3,5);
+    assert(r[0] == food[3]);
+    assert(r[1] == food[4]);
+
+    r = slicep(3,5);
+    assert(r[0] == foos[3]);
+    assert(r[1] == foos[4]);
+
+    try
+    {
+        i = 7;
+        r = slices(5,3);
+    }
+    catch (RangeError a)
+    {
+        i = 53;
+    }
+    assert(i == 53);
+
+    try
+    {
+        i = 7;
+        r = slices(5,11);
+    }
+    catch (RangeError a)
+    {
+        i = 53;
+    }
+    assert(i == 53);
+
+    try
+    {
+        i = 7;
+        r = sliced(5,11);
+    }
+    catch (RangeError a)
+    {
+        i = 53;
+    }
+    assert(i == 53);
+
+    try
+    {
+        i = 7;
+        r = slicep(5,3);
+    }
+    catch (RangeError a)
+    {
+        i = 53;
+    }
+    assert(i == 53);
+
+    // Take side effects into account
+    x = 1;
+    r = foos[index() .. 3];
+    assert(x == 2);
+    assert(r[0] == foos[1]);
+    assert(r[1] == foos[2]);
+
+    r = foos[1 .. index()];
+    assert(r.length == 1);
+    assert(x == 3);
+    assert(r[0] == foos[1]);
+
+    x = 1;
+    r = food[index() .. 3];
+    assert(x == 2);
+    assert(r[0] == food[1]);
+    assert(r[1] == food[2]);
+
+    r = food[1 .. index()];
+    assert(r.length == 1);
+    assert(x == 3);
+    assert(r[0] == food[1]);
+
+    x = 1;
+    r = foop[index() .. 3];
+    assert(x == 2);
+    assert(r[0] == foop[1]);
+    assert(r[1] == foop[2]);
+
+    r = foop[1 .. index()];
+    assert(r.length == 1);
+    assert(x == 3);
+    assert(r[0] == foop[1]);
+}
+
+/******************************************/
+// 13976
+
+void test13976()
+{
+    int[] da = new int[](10);
+    int[10] sa;
+    size_t l = 0;               // upperInRange
+    size_t u = 9;               // | lowerLessThan
+                                // | |  check code
+    { auto s = da[l .. u];   }  // 0 0  (u <= 10 && l <= u  )
+    { auto s = da[1 .. u];   }  // 0 0  (u <= 10 && l <= u  )
+    { auto s = da[l .. 10];  }  // 0 0  (u <= 10 && l <= u  )
+    { auto s = da[1 .. u%5]; }  // 0 0  (u <= 10 && l <= u%5)
+
+    { auto s = da[l .. u];   }  // 0 0  (u   <= 10 && l <= u)
+    { auto s = da[0 .. u];   }  // 0 1  (u   <= 10          )
+    { auto s = da[l .. 10];  }  // 0 0  (u   <= 10 && l <= u)
+    { auto s = da[0 .. u%5]; }  // 0 1  (u%5 <= 10          )
+
+    { auto s = sa[l .. u];   }  // 0 0  (u <= 10 && l <= u  )
+    { auto s = sa[1 .. u];   }  // 0 0  (u <= 10 && l <= u  )
+    { auto s = sa[l .. 10];  }  // 1 0  (           l <= u  )
+    { auto s = sa[1 .. u%5]; }  // 1 0  (           l <= u%5)
+
+    { auto s = sa[l .. u];   }  // 0 0  (u <= 10 && l <= u )
+    { auto s = sa[0 .. u];   }  // 0 1  (u <= 10           )
+    { auto s = sa[l .. 10];  }  // 1 0  (           l <= 10)
+    { auto s = sa[0 .. u%5]; }  // 1 1  NULL
+
+    int* p = new int[](10).ptr;
+    { auto s = p[0 .. u];    }  // 1 1  NULL
+    { auto s = p[l .. u];    }  // 1 0  (l <= u)
+    { auto s = p[0 .. u%5];  }  // 1 1  NULL
+    { auto s = p[1 .. u%5];  }  // 1 0  (l <= u%5)
+}
+
+/******************************************/
+
+int main()
+{
+    test1();
+    test13976();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testbounds2.d b/gcc/testsuite/gdc.test/runnable/testbounds2.d
new file mode 100644
index 00000000000..3884f5ffe2d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testbounds2.d
@@ -0,0 +1,299 @@
+// REQUIRED_ARGS:
+
+// Test compile time boundaries checking
+
+extern(C) int printf(const char*, ...);
+
+template TypeTuple(T...) { alias T TypeTuple; }
+
+/******************************************/
+// 3652
+
+void test3652()
+{
+    int foo(int[4] x)
+    {
+        return x[0] + x[1] * x[2] - x[3];
+    }
+
+    int[] xs = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
+
+    // simple case
+    foo(xs[0 .. 4]);
+
+  version(none)
+  {
+    // Need deformation of formula and detection of base point
+    int x = 0;
+    int y = 0;
+    foreach (i; 0 .. 4)
+    {
+        x += foo(xs[i .. i + 4]);
+        y += foo(xs[(i*4+10)/2 .. (i*8>>1)/2+9]);
+        // lwr = (i*4 + 10)/2 = i*4/2 + 10/2            = (i*2+5)
+        // upr = (i*8>>1)/2 + 5 = (i*4/2) + 5 = i*2 + 9 = (i*2+5) + 4
+    }
+    assert(x == (0,1,2,3) + (1,2,3, 4) + (2, 3, 4, 5) + ( 3, 4, 5, 6));
+    assert(y == (5,6,7,8) + (7,8,9,10) + (9,10,11,12) + (11,12,13,14));
+  }
+}
+
+void test3652a() @safe
+{
+    string str = "aaaabbbbccccdddd";
+    //printf("str.ptr = %p\n", str.ptr);
+
+    void foo(ref const(char)[16] buf)
+    {
+        //printf("buf.ptr = %p\n", buf.ptr);
+        assert(buf.ptr is str.ptr);
+    }
+
+    // can check length at runtime
+    assert(str.length == 16);
+
+    // compiler can check the length of string literal, so
+    // conversion from immutable(char)[] to ref const(char)[16] is allowed;
+    static assert(__traits(compiles, foo("aaaabbbbccccdddd")));
+
+    // OK, correctly rejected by the compiler.
+    static assert(!__traits(compiles, foo(str[])));
+
+    // Ugly, furthermore does not work in safe code!
+    //foo(*cast(const(char)[16]*)(str[0..16].ptr));
+
+    // New: compiler can check the length of slice, but currently it is not allowed.
+    enum size_t m = 0;
+    size_t calc(){ return 0; }
+    foo(str[0 .. 16]);
+    foo(str[m .. 16]);
+  //foo(str[calc() .. 16]); // with CTFE
+
+    // If boundaries cannot be calculated in compile time, it's rejected.
+    size_t n;
+    size_t calc2(){ return n; }
+    static assert(!__traits(compiles, foo(str[n .. 16])));
+    static assert(!__traits(compiles, foo(str[calc2() .. 16])));
+
+    void hoo1(size_t dim)(char[dim]) { static assert(dim == 2); }
+    void hoo2(char[2]) {}
+    void hoo3(size_t dim)(ref char[dim]) {}
+    void hoo4(ref char[2]) {}
+    hoo1(str[0 .. 2]);
+    hoo2(str[0 .. 2]);
+    static assert(!__traits(compiles, hoo3(str[0 .. 2])));
+    static assert(!__traits(compiles, hoo4(str[0 .. 2])));
+}
+void test3652b() @safe
+{
+    int[] da = [1,2,3,4,5];
+
+    void bar(int[3] sa1, ref int[3] sa2)
+    {
+        assert(sa1 == [1,2,3] && sa1.ptr !is da.ptr);
+        assert(sa2 == [1,2,3] && sa2.ptr  is da.ptr);
+    }
+    bar(da[0..3], da[0..3]);
+    static assert(!__traits(compiles, bar(da[0..4], da[0..4])));
+
+    void baz1(T)(T[3] sa1, ref T[3] sa2)
+    {
+        assert(sa1 == [1,2,3] && sa1.ptr !is da.ptr);
+        assert(sa2 == [1,2,3] && sa2.ptr  is da.ptr);
+    }
+    void baz2(T, size_t dim)(T[dim] sa1, ref T[dim] sa2, size_t result)
+    {
+        assert(dim == result);
+        static if (dim == 3)
+        {
+            assert(sa1 == [1,2,3] && sa1.ptr !is da.ptr);
+            assert(sa2 == [1,2,3] && sa2.ptr  is da.ptr);
+        }
+        else
+        {
+            assert(sa1 == [1,2,3,4] && sa1.ptr !is da.ptr);
+            assert(sa2 == [1,2,3,4] && sa2.ptr  is da.ptr);
+        }
+    }
+    baz1(da[0..3], da[0..3]);
+    static assert(!__traits(compiles, baz1(da[0..4], da[0..4])));
+    baz2(da[0..3], da[0..3], 3);
+    baz2(da[0..4], da[0..4], 4);
+
+    void hoo1(size_t dim)(int[dim]) { static assert(dim == 2); }
+    void hoo2(int[2]) {}
+    void hoo3(size_t dim)(ref int[dim]) {}
+    void hoo4(ref int[2]) {}
+    hoo1(da.idup[0 .. 2]);
+    hoo2(da.idup[0 .. 2]);
+    static assert(!__traits(compiles, hoo3(da.idup[0 .. 2])));
+    static assert(!__traits(compiles, hoo4(da.idup[0 .. 2])));
+}
+
+/**********************************/
+// 9654
+
+auto foo9654a(ref           char[8] str) { return str; }
+auto foo9654b(ref     const char[8] str) { return str; }
+auto foo9654c(ref immutable char[8] str) { return str; }
+static assert(!is(typeof(foo9654a("testinfo"))));
+static assert( is(typeof(foo9654b("testinfo")) ==     const char[8]));
+static assert( is(typeof(foo9654c("testinfo")) == immutable char[8]));
+
+auto bar9654a(T)(ref           T[8] str) { return str; static assert(is(T == immutable char)); }
+auto bar9654b(T)(ref     const T[8] str) { return str; static assert(is(T ==           char)); }
+auto bar9654c(T)(ref immutable T[8] str) { return str; static assert(is(T ==           char)); }
+static assert( is(typeof(bar9654a("testinfo")) == immutable char[8]));
+static assert( is(typeof(bar9654b("testinfo")) ==     const char[8]));
+static assert( is(typeof(bar9654c("testinfo")) == immutable char[8]));
+
+auto baz9654a(T, size_t dim)(ref           T[dim] str) { return str; static assert(is(T == immutable char)); }
+auto baz9654b(T, size_t dim)(ref     const T[dim] str) { return str; static assert(is(T ==           char)); }
+auto baz9654c(T, size_t dim)(ref immutable T[dim] str) { return str; static assert(is(T ==           char)); }
+static assert( is(typeof(baz9654a("testinfo")) == immutable char[8]));
+static assert( is(typeof(baz9654b("testinfo")) ==     const char[8]));
+static assert( is(typeof(baz9654c("testinfo")) == immutable char[8]));
+
+/******************************************/
+// 9712
+
+auto func9712(T)(T[2] arg) { return arg; }
+static assert(is(typeof(func9712([1,2])) == int[2]));
+
+auto deduceLength9712(T,size_t n)(T[n] a) { return a; }
+static assert(is(typeof(deduceLength9712([1,2,3])) == int[3]));
+
+/******************************************/
+// 9743
+
+void test9743()
+{
+    //    +-Char
+    //    |+-Immutable or Const or Mutable
+    //    ||+-Value or Ref
+    //    |||+-Function                           or +-Template
+    void fCIVF(    immutable  char[4]) {}   void fCIVT()(    immutable  char[4]) {}
+    void fCCVF(        const  char[4]) {}   void fCCVT()(        const  char[4]) {}
+    void fCMVF(               char[4]) {}   void fCMVT()(               char[4]) {}
+    void fCIRF(ref immutable  char[4]) {}   void fCIRT()(ref immutable  char[4]) {}
+    void fCCRF(ref     const  char[4]) {}   void fCCRT()(ref     const  char[4]) {}
+    void fCMRF(ref            char[4]) {}   void fCMRT()(ref            char[4]) {}
+    alias fcOK = TypeTuple!(fCIVF, fCIVT, fCCVF, fCCVT, fCMVF, fCMVT, fCIRF, fCIRT, fCCRF, fCCRT);
+    foreach (f; fcOK)                                   f("1234" )   ;
+    foreach (f; fcOK)                                   f("1234"c)   ;
+    foreach (f; fcOK) static assert(!__traits(compiles, f("1234"w) ));
+    foreach (f; fcOK) static assert(!__traits(compiles, f("1234"d) ));
+    alias fcNG = TypeTuple!(fCMRF, fCMRT);  // cannot hold immutable data by mutable ref
+    foreach (f; fcNG) static assert(!__traits(compiles, f("1234" ) ));
+    foreach (f; fcNG) static assert(!__traits(compiles, f("1234"c) ));
+    foreach (f; fcNG) static assert(!__traits(compiles, f("1234"w) ));
+    foreach (f; fcNG) static assert(!__traits(compiles, f("1234"d) ));
+
+    //    +-Wchar
+    void fWIVF(    immutable wchar[4]) {}   void fWIVT()(    immutable wchar[4]) {}
+    void fWCVF(        const wchar[4]) {}   void fWCVT()(        const wchar[4]) {}
+    void fWMVF(              wchar[4]) {}   void fWMVT()(              wchar[4]) {}
+    void fWIRF(ref immutable wchar[4]) {}   void fWIRT()(ref immutable wchar[4]) {}
+    void fWCRF(ref     const wchar[4]) {}   void fWCRT()(ref     const wchar[4]) {}
+    void fWMRF(ref           wchar[4]) {}   void fWMRT()(ref           wchar[4]) {}
+    alias fwOK = TypeTuple!(fWIVF, fWIVT, fWCVF, fWCVT, fWMVF, fWMVT, fWIRF, fWIRT, fWCRF, fWCRT);
+    foreach (f; fwOK)                                   f("1234" )   ;
+    foreach (f; fwOK) static assert(!__traits(compiles, f("1234"c) ));
+    foreach (f; fwOK)                                   f("1234"w)   ;
+    foreach (f; fwOK) static assert(!__traits(compiles, f("1234"d) ));
+    alias fwNG = TypeTuple!(fWMRF, fWMRT);  // cannot hold immutable data by mutable ref
+    foreach (f; fwNG) static assert(!__traits(compiles, f("1234" ) ));
+    foreach (f; fwNG) static assert(!__traits(compiles, f("1234"c) ));
+    foreach (f; fwNG) static assert(!__traits(compiles, f("1234"w) ));
+    foreach (f; fwNG) static assert(!__traits(compiles, f("1234"d) ));
+
+    //    +-Dchar
+    void fDIVF(    immutable dchar[4]) {}   void fDIVT()(    immutable dchar[4]) {}
+    void fDCVF(        const dchar[4]) {}   void fDCVT()(        const dchar[4]) {}
+    void fDMVF(              dchar[4]) {}   void fDMVT()(              dchar[4]) {}
+    void fDIRF(ref immutable dchar[4]) {}   void fDIRT()(ref immutable dchar[4]) {}
+    void fDCRF(ref     const dchar[4]) {}   void fDCRT()(ref     const dchar[4]) {}
+    void fDMRF(ref           dchar[4]) {}   void fDMRT()(ref           dchar[4]) {}
+    alias fdOK = TypeTuple!(fDIVF, fDIVT, fDCVF, fDCVT, fDMVF, fDMVT, fDIRF, fDIRT, fDCRF, fDCRT);
+    foreach (f; fdOK)                                   f("1234" )   ;
+    foreach (f; fdOK) static assert(!__traits(compiles, f("1234"c) ));
+    foreach (f; fdOK) static assert(!__traits(compiles, f("1234"w) ));
+    foreach (f; fdOK)                                   f("1234"d)   ;
+    alias fdNG = TypeTuple!(fDMRF, fDMRT);  // cannot hold immutable data by mutable ref
+    foreach (f; fdNG) static assert(!__traits(compiles, f("1234" ) ));
+    foreach (f; fdNG) static assert(!__traits(compiles, f("1234"c) ));
+    foreach (f; fdNG) static assert(!__traits(compiles, f("1234"w) ));
+    foreach (f; fdNG) static assert(!__traits(compiles, f("1234"d) ));
+}
+
+/******************************************/
+// 9747
+
+void foo9747A(T)(T[4]) {}
+void foo9747C(size_t dim)(char[dim]) {}
+void foo9747W(size_t dim)(wchar[dim]) {}
+void foo9747D(size_t dim)(dchar[dim]) {}
+
+void test9747()
+{
+    foo9747A("abcd"c);
+    foo9747A("abcd"w);
+    foo9747A("abcd"d);
+    foo9747C("abcd"c);
+    foo9747W("abcd"w);
+    foo9747D("abcd"d);
+}
+
+/******************************************/
+// 12876
+
+void test12876()
+{
+    void foo(int[4] b) {}
+    void bar(size_t n)(int[n] c) { static assert(n == 4); }
+
+    int[5] a;
+    foo(a[1 .. $]); // OK
+    bar(a[1 .. $]); // OK <- Error
+}
+
+/******************************************/
+// 13775
+
+void test13775()
+{
+    ubyte[4] ubytes = [1,2,3,4];
+
+    // CT-known slicing (issue 3652)
+    auto ok1 = cast(ubyte[2]) ubytes[0 .. 2];
+    assert(ok1 == [1, 2]);
+
+    // CT-known slicing with implicit conversion of SliceExp::e1 (issue 13154)
+    enum double[] arr = [1.0, 2.0, 3.0];
+    auto ok2 = cast(float[2]) [1.0, 2.0, 3.0][0..2];
+    auto ok3 = cast(float[2]) arr[1..3];    // currently this is accepted
+    assert(ok2 == [1f, 2f]);
+    assert(ok3 == [2f, 3f]);
+
+    // CT-known slicing with type coercing (issue 13775)
+    auto ok4 = cast( byte[2]) ubytes[0 .. 2];   // CT-known slicing + type coercing
+    auto ok5 = cast(short[1]) ubytes[0 .. 2];   // CT-known slicing + type coercing
+    assert(ok4 == [1, 2]);
+    version(LittleEndian) assert(ok5 == [0x0201]);
+    version(   BigEndian) assert(ok5 == [0x0102]);
+}
+
+/******************************************/
+
+int main()
+{
+    test3652();
+    test3652a();
+    test3652b();
+    test9743();
+    test9747();
+    test13775();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testbounds_off.d b/gcc/testsuite/gdc.test/runnable/testbounds_off.d
new file mode 100644
index 00000000000..6821f3e6458
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testbounds_off.d
@@ -0,0 +1,27 @@
+// REQUIRED_ARGS: -boundscheck=off
+// PERMUTE_ARGS: -inline -g -O
+
+import core.exception : RangeError;
+
+// Check for RangeError is thrown
+bool thrown(T)(lazy T cond)
+{
+    import core.exception;
+    bool f = false;
+    try { cond(); } catch (RangeError e) { f = true; }
+    return f;
+}
+
+@safe    int safeIndex   (int[] arr) { return arr[2]; }
+@trusted int trustedIndex(int[] arr) { return arr[2]; }
+@system  int systemIndex (int[] arr) { return arr[2]; }
+
+void main()
+{
+    int[3] data = [1,2,3];
+    int[] arr = data[0..2];
+
+    assert(arr.   safeIndex() == 3);
+    assert(arr.trustedIndex() == 3);
+    assert(arr. systemIndex() == 3);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testbounds_on.d b/gcc/testsuite/gdc.test/runnable/testbounds_on.d
new file mode 100644
index 00000000000..0506bb112d2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testbounds_on.d
@@ -0,0 +1,27 @@
+// REQUIRED_ARGS: -boundscheck=on
+// PERMUTE_ARGS: -inline -g -O
+
+import core.exception : RangeError;
+
+// Check for RangeError is thrown
+bool thrown(T)(lazy T cond)
+{
+    import core.exception;
+    bool f = false;
+    try { cond(); } catch (RangeError e) { f = true; }
+    return f;
+}
+
+@safe    int safeIndex   (int[] arr) { return arr[2]; }
+@trusted int trustedIndex(int[] arr) { return arr[2]; }
+@system  int systemIndex (int[] arr) { return arr[2]; }
+
+void main()
+{
+    int[3] data = [1,2,3];
+    int[] arr = data[0..2];
+
+    assert(arr.   safeIndex().thrown);
+    assert(arr.trustedIndex().thrown);
+    assert(arr. systemIndex().thrown);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testbounds_safeonly.d b/gcc/testsuite/gdc.test/runnable/testbounds_safeonly.d
new file mode 100644
index 00000000000..ae8e83137d7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testbounds_safeonly.d
@@ -0,0 +1,27 @@
+// REQUIRED_ARGS: -boundscheck=safeonly
+// PERMUTE_ARGS: -inline -g -O
+
+import core.exception : RangeError;
+
+// Check for RangeError is thrown
+bool thrown(T)(lazy T cond)
+{
+    import core.exception;
+    bool f = false;
+    try { cond(); } catch (RangeError e) { f = true; }
+    return f;
+}
+
+@safe    int safeIndex   (int[] arr) { return arr[2]; }
+@trusted int trustedIndex(int[] arr) { return arr[2]; }
+@system  int systemIndex (int[] arr) { return arr[2]; }
+
+void main()
+{
+    int[3] data = [1,2,3];
+    int[] arr = data[0..2];
+
+    assert(arr.   safeIndex().thrown);
+    assert(arr.trustedIndex() == 3);
+    assert(arr. systemIndex() == 3);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testclass.d b/gcc/testsuite/gdc.test/runnable/testclass.d
new file mode 100644
index 00000000000..c5480da0cc5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testclass.d
@@ -0,0 +1,78 @@
+extern(C) int printf(const char*, ...);
+
+/******************************************/
+// 12078
+
+class B12078(T)
+{
+    static assert(is(T : B12078!T), "not related");
+}
+class D12078 : B12078!D12078
+{
+}
+
+interface X12078(T)
+{
+    static assert(is(T : X12078!T), "not related");
+}
+interface Y12078 : X12078!Y12078
+{
+}
+
+void test12078()
+{
+    static assert(is(D12078 : B12078!D12078));
+    static assert(is(Y12078 : X12078!Y12078));
+}
+
+/******************************************/
+// 12143
+
+class Node12143
+{
+    alias typeof(true ? Node12143.init : Class12143.init) V;
+    static assert(is(V == Node12143));
+}
+
+class Type12143 : Node12143 {}
+
+class Class12143 : Type12143 {}
+
+/***************************************************/
+// 13353
+
+interface Base13353(T)
+{
+    static assert(is(T : Base13353!T));
+}
+
+interface Derived13353 : Base13353!Derived13353
+{
+    void func();
+}
+
+class Concrete13353 : Derived13353
+{
+    void func() {}
+}
+
+/***************************************************/
+// 15733
+
+class CStmt15733 : CNode15733 {}
+class CDecl15733 : CStmt15733 {}
+class CNode15733 { mixin CMix!CDecl15733; }
+template CMix(T){ mixin("static " ~ T.stringof ~ " x;"); }
+
+interface IStmt15733 : INode15733 {}
+interface IDecl15733 : IStmt15733 {}
+interface INode15733 { mixin IMix!IDecl15733; }
+template IMix(T){ mixin("static " ~ T.stringof ~ " x;"); }
+
+/***************************************************/
+
+int main()
+{
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testconst.d b/gcc/testsuite/gdc.test/runnable/testconst.d
new file mode 100644
index 00000000000..682b1fda704
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testconst.d
@@ -0,0 +1,3862 @@
+
+import core.stdc.stdio;
+
+class C { }
+
+int ctfe() { return 3; }
+
+template TypeTuple(T...) { alias T TypeTuple; }
+
+/************************************/
+
+void showf(string f)
+{
+    printf("%.*s\n", f.length, f.ptr);
+}
+
+/************************************/
+
+void test1()
+{
+    const int* p;
+    const(int)* cp;
+    cp = p;
+}
+
+/************************************/
+
+void test2()
+{
+    const int i = 3;
+    const(int) j = 0;
+    int k;
+//    j = i;
+    k = i;
+    k = j;
+//    assert(k == 3);
+}
+
+/************************************/
+
+void test3()
+{
+    char[3] p;
+    const(char)[] q;
+
+    q = p;
+}
+
+/************************************/
+
+void test4()
+{
+    char[] p;
+    const(char)[] q;
+
+    q = p;
+}
+
+/************************************/
+
+void test5()
+{
+    const(int**)* p;
+    const(int)*** cp;
+    p = cp;
+}
+
+/************************************/
+
+void test6()
+{
+    const(int***)[] p;
+    const(int)***[] cp;
+    p = cp;
+}
+
+/************************************/
+
+class C8 { }
+
+void foo8(const char[] s, const C8 c, const int x)
+{
+}
+
+void test8()
+{
+    auto p = &foo8;
+    showf(p.mangleof);
+    assert(typeof(p).mangleof == "PFxAaxC9testconst2C8xiZv");
+    assert(p.mangleof == "_D9testconst5test8FZ1pPFxAaxC9testconst2C8xiZv");
+}
+
+/************************************/
+
+void test9()
+{
+    int [ const (char[]) ] aa;
+    int [ char[] ] ab;
+    int [ const char[] ] ac;
+
+    aa["hello"] = 3;
+    ab["hello"] = 3;
+    ac["hello"] = 3;
+}
+
+/************************************/
+
+void test10()
+{
+    const(int) x = 3;
+    auto y = x;
+    //y++;
+    assert(is(typeof(y) == const(int)));
+}
+
+/************************************/
+
+void foo11(in char[] a1)
+{
+    char[3] c;
+    char[] a2 = c[];
+    a2[0..2] = a1;
+    a2[0..2] = 'c';
+
+    const char b = 'b';
+    a2[0..2] = b;
+}
+
+void test11()
+{
+}
+
+/************************************/
+
+void foo12(const char[] a1)
+{
+}
+
+void test12()
+{
+    foo12("hello");
+}
+
+/************************************/
+
+immutable char[16] hexdigits1 = "0123456789ABCDE1";
+immutable char[  ] hexdigits2 = "0123456789ABCDE2";
+
+const char[16] hexdigits3 = "0123456789ABCDE3";
+const char[  ] hexdigits4 = "0123456789ABCDE4";
+
+void test13()
+{
+}
+
+/************************************/
+
+void test14()
+{
+    string s;
+    s = s ~ "hello";
+}
+
+/************************************/
+
+class Foo15
+{
+    const string xxxx;
+
+    this(immutable char[] aaa)
+    {
+        this.xxxx = aaa;
+    }
+}
+
+void test15()
+{
+}
+
+/************************************/
+
+void test16()
+{
+    auto a = "abc";
+    immutable char[3] b = "abc";
+    const char[3] c = "abc";
+}
+
+/************************************/
+
+void test17()
+{
+    const(char)[3][] a = (["abc", "def"]);
+
+    assert(a[0] == "abc");
+    assert(a[1] == "def");
+}
+
+/************************************/
+
+class C18
+{
+    const(char)[] foo() { return "abc"; }
+}
+
+class D18 : C18
+{
+    override char[] foo() { return null; }
+}
+
+void test18()
+{
+}
+
+/************************************/
+
+void test19()
+{
+    char[] s;
+    if (s == "abc")
+        s = null;
+    if (s < "abc")
+        s = null;
+    if (s is "abc")
+        s = null;
+}
+
+/************************************/
+
+void test20()
+{
+    string p;
+    immutable char[] q;
+
+    p = p ~ q;
+    p ~= q;
+}
+
+/************************************/
+
+void test21()
+{
+    string s;
+    char[] p;
+    p = s.dup;
+}
+
+/************************************/
+
+void fill22(const(char)[] s)
+{
+}
+
+void test22()
+{
+}
+
+/************************************/
+
+
+struct S23
+{
+    int x;
+    int* p;
+}
+
+
+void foo23(const(S23) s, const(int) i)
+{
+    immutable int j = 3;
+//    j = 4;
+//    i = 4;
+//    s.x = 3;
+//    *s.p = 4;
+}
+
+void test23()
+{
+}
+
+/************************************/
+
+void test24()
+{
+    wchar[] r;
+
+    r ~= "\000"w;
+}
+
+/************************************/
+
+void test25()
+{
+    char* p;
+    if (p == cast(const(char)*)"abc")
+    {}
+}
+
+/************************************/
+
+void test26()
+{
+    struct S
+    {
+        char[3] a;
+    }
+
+    static S s = { "abc" };
+}
+
+/************************************/
+
+class C27
+{
+    int x;
+
+    void foo() { x = 3; }
+}
+
+void test27()
+{
+    C27 d = new C27;
+    d.foo();
+}
+
+/************************************/
+
+class C28
+{
+    int x;
+
+    void foo() immutable { }
+}
+
+void test28()
+{
+    immutable(C28) d = cast(immutable)new C28;
+    d.foo();
+}
+
+/************************************/
+
+struct S29 { }
+
+int foo29(const(S29)* s)
+{
+    S29 s2;
+    return *s == s2;
+}
+
+void test29()
+{
+}
+
+/************************************/
+
+struct S30
+{
+    int x;
+
+    void foo() { x = 3; }
+    void bar() const
+    {   //x = 4;
+        //this.x = 5;
+    }
+}
+
+class C30
+{
+    int x;
+
+    void foo() { x = 3; }
+    void bar() const
+    {   //x = 4;
+        //this.x = 5;
+    }
+}
+
+void test30()
+{   S30 s;
+
+    s.foo();
+    s.bar();
+
+    S30 t;
+    //t.foo();
+    t.bar();
+
+    C30 c = new C30;
+
+    c.foo();
+    c.bar();
+
+    C30 d = new C30;
+    d.foo();
+    d.bar();
+}
+
+
+/************************************/
+
+class Foo31
+{
+  int x;
+
+  immutable immutable(int)* geti()
+  {
+    return &x;
+  }
+
+  const const(int)* getc()
+  {
+    return &x;
+  }
+}
+
+void test31()
+{
+}
+
+/************************************/
+
+int bar32;
+
+struct Foo32
+{
+    int func() immutable
+    {
+        return bar32;
+    }
+}
+
+void test32()
+{
+    immutable(Foo32) foo;
+    printf("%d", foo.func());
+    printf("%d", foo.func());
+}
+
+/************************************/
+
+void test33()
+{
+    string d = "a"  ~  "b"  ~  (1?"a":"");
+    assert(d == "aba");
+}
+
+/************************************/
+
+struct S34
+{
+   int value;
+}
+
+const S34 s34 = { 5 };
+
+const S34 t34 = s34;
+const S34 u34 = s34;
+
+void test34()
+{
+    assert(u34.value == 5);
+}
+
+/************************************/
+
+const int i35 = 20;
+
+template Foo35(alias bar)
+{
+}
+
+alias Foo35!(i35) foo35;
+
+void test35()
+{
+}
+
+/************************************/
+
+immutable char[10] digits    = "0123456789";  /// 0..9
+immutable char[]  octdigits = digits[0 .. 8]; //// 0..7
+
+void test36()
+{
+}
+
+/************************************/
+
+void test37()
+{
+    int i = 3;
+    const int x = i;
+    i++;
+    assert(x == 3);
+}
+
+/************************************/
+
+void test38()
+{
+    static const string s = "hello"[1..$];
+    assert(s == "ello");
+}
+
+/************************************/
+
+static const int x39;
+const int y39;
+
+static this()
+{
+    x39 = 3;
+    y39 = 4;
+}
+
+void test39()
+{
+    const int i;
+    assert(x39 == 3);
+    assert(y39 == 4);
+    const p = &x39;
+//    assert(*p == 3);
+}
+
+/************************************/
+
+struct S40
+{
+    int a;
+    const int b = 3;    // shouldn't be allocated
+}
+
+void test40()
+{
+    assert(S40.sizeof == 8);
+    assert(S40.init.b == 3);
+}
+
+/************************************/
+
+struct S41
+{
+    int a;
+    const int b;
+    static const int c = ctfe() + 1;
+}
+
+void test41()
+{
+    assert(S41.sizeof == 8);
+    S41 s;
+    assert(s.b == 0);
+    assert(S41.c == 4);
+
+    const(int)*p;
+    p = &s.b;
+    assert(*p == 0);
+    p = &s.c;
+    assert(*p == 4);
+}
+
+/************************************/
+
+class C42
+{
+    int a = ctfe() - 2;
+    const int b;
+    const int c = ctfe();
+    static const int d;
+    static const int e = ctfe() + 2;
+
+    static this()
+    {
+        d = 4;
+    }
+
+    this()
+    {
+        b = 2;
+    }
+}
+
+void test42()
+{
+    printf("%d\n", C42.classinfo.initializer.length);
+    assert(C42.classinfo.initializer.length == 12 + (void*).sizeof +
+        (void*).sizeof);
+    C42 c = new C42;
+    assert(c.a == 1);
+    assert(c.b == 2);
+    assert(c.c == 3);
+    assert(c.d == 4);
+    assert(c.e == 5);
+
+    const(int)*p;
+    p = &c.b;
+    assert(*p == 2);
+    p = &c.c;
+    assert(*p == 3);
+    p = &c.d;
+    assert(*p == 4);
+    p = &c.e;
+    assert(*p == 5);
+}
+
+/************************************/
+
+template Foo43(T)
+{
+    alias T Foo43;
+}
+
+void test43()
+{
+  {
+    int x;
+    alias Foo43!(typeof(x)) f;
+    showf(typeid(f).toString());
+    assert(is(typeof(x) == int));
+    assert(is(f == int));
+  }
+
+  {
+    const int x;
+    alias Foo43!(typeof(x)) f;
+    showf(typeid(f).toString());
+    assert(is(typeof(x) == const(int)));
+    assert(is(f == const(int)));
+  }
+
+  {
+    immutable int x;
+    alias Foo43!(typeof(x)) f;
+    showf(typeid(f).toString());
+    assert(is(typeof(x) == immutable(int)));
+    assert(is(f == immutable(int)));
+  }
+}
+
+/************************************/
+
+template Foo44(T:T)
+{
+    alias T Foo44;
+}
+
+void test44()
+{
+  {
+    int x;
+    alias Foo44!(typeof(x)) f;
+    showf(typeid(f).toString());
+    assert(is(typeof(x) == int));
+    assert(is(f == int));
+  }
+
+  {
+    const int x;
+    alias Foo44!(typeof(x)) f;
+    showf(typeid(f).toString());
+    assert(is(typeof(x) == const(int)));
+    assert(is(f == const(int)));
+  }
+
+  {
+    immutable int x;
+    alias Foo44!(typeof(x)) f;
+    showf(typeid(f).toString());
+    assert(is(typeof(x) == immutable(int)));
+    assert(is(f == immutable(int)));
+  }
+}
+
+/************************************/
+
+template Foo45(T:const(T))
+{
+    alias T Foo45;
+}
+
+void test45()
+{
+  {
+    int x;
+    alias Foo45!(typeof(x)) f;
+    showf(typeid(f).toString());
+    assert(is(typeof(x) == int));
+    assert(is(f == int));
+  }
+
+  {
+    const int x;
+    alias Foo45!(typeof(x)) f;
+    showf(typeid(f).toString());
+    assert(is(typeof(x) == const(int)));
+    assert(is(f == int));
+  }
+
+  {
+    immutable int x;
+    alias Foo45!(typeof(x)) f;
+    showf(typeid(f).toString());
+    assert(is(typeof(x) == immutable(int)));
+    assert(is(f == int));
+  }
+}
+
+/************************************/
+
+template Foo46(T:immutable(T))
+{
+    alias T Foo46;
+}
+
+void test46()
+{
+  {
+    immutable int x;
+    alias Foo46!(typeof(x)) f;
+    showf(typeid(f).toString());
+    assert(is(typeof(x) == immutable(int)));
+    assert(is(f == int));
+  }
+}
+
+/************************************/
+
+template Foo47(T:T)            { const int Foo47 = 2; }
+template Foo47(T:const(T))     { const int Foo47 = 3; }
+template Foo47(T:immutable(T)) { const int Foo47 = 4; }
+
+void test47()
+{
+    int x2;
+    const int x3;
+    immutable int x4;
+
+    printf("%d\n", Foo47!(typeof(x2)));
+    printf("%d\n", Foo47!(typeof(x3)));
+    printf("%d\n", Foo47!(typeof(x4)));
+
+    assert(Foo47!(typeof(x2)) == 2);
+    assert(Foo47!(typeof(x3)) == 3);
+    assert(Foo47!(typeof(x4)) == 4);
+}
+
+/************************************/
+
+int foo48(T)(const(T) t) { return 3; }
+
+void test48()
+{
+    const int x = 4;
+    assert(foo48(x) == 3);
+}
+
+/************************************/
+
+void foo49(T)(T[] t)
+{
+    showf(typeid(typeof(t)).toString());
+    assert(is(T == immutable(char)));
+}
+
+void bar49(T)(const T t)
+{
+    showf(typeid(T).toString());
+    assert(is(T == const(int)) || is(T == immutable(int)) || is(T == int));
+}
+
+void test49()
+{
+    string s;
+    foo49(s);
+    foo49("hello");
+
+    const int c = 1;
+    bar49(c);
+
+    immutable int i = 1;
+    bar49(i);
+
+    bar49(1);
+}
+
+/************************************/
+
+void foo50(T)(T t)
+{
+    showf(typeid(typeof(t)).toString());
+    assert(is(T == C));
+}
+
+void baz50(T)(T t)
+{
+    showf(typeid(typeof(t)).toString());
+    assert(is(T == const(C)));
+}
+
+void bar50(T)(const T t)
+{
+    showf(typeid(T).toString());
+    showf(typeid(typeof(t)).toString());
+    assert(is(T == C));
+    assert(is(typeof(t) == const(C)));
+}
+
+void abc50(T)(const T t)
+{
+    showf(typeid(T).toString());
+    showf(typeid(typeof(t)).toString());
+    assert(is(T == C));
+    assert(is(typeof(t) == const(C)));
+}
+
+void test50()
+{
+    C c = new C;
+    const(C) d = new C;
+
+    foo50(c);
+    baz50(d);
+
+    bar50(c);
+    abc50(d);
+}
+
+/************************************/
+
+void test51()
+{
+    const(C) d = new C;
+    //d = new C;
+}
+
+/************************************/
+
+template isStaticArray(T)
+{
+    const bool isStaticArray = false;
+}
+
+template isStaticArray(T : T[N], size_t N)
+{
+    const bool isStaticArray = true;
+}
+
+template isDynamicArray(T, U = void)
+{
+    static const isDynamicArray = false;
+}
+
+template isDynamicArray(T : U[], U)
+{
+  static const isDynamicArray = !isStaticArray!(T);
+}
+
+void test52()
+{
+    immutable(char[5])[int] aa = ([3:"hello", 4:"betty"]);
+
+    showf(typeid(typeof(aa.values)).toString());
+    static assert(isDynamicArray!(typeof(aa.values)));
+}
+
+/************************************/
+
+void foo53(string n) { }
+
+void read53(in string name)
+{
+    foo53(name);
+}
+
+void test53()
+{
+    read53("hello");
+}
+
+/************************************/
+
+void bar54(const(wchar)[] s) { }
+
+void test54()
+{
+    const(wchar)[] fmt;
+    bar54("Orphan format specifier: %" ~ fmt);
+}
+
+/************************************/
+
+struct S55
+{
+    int foo() { return 1; }
+    int foo() const { return 2; }
+    int foo() immutable { return 3; }
+}
+
+void test55()
+{
+    S55 s1;
+    auto i = s1.foo();
+    assert(i == 1);
+
+    const S55 s2;
+    i = s2.foo();
+    assert(i == 2);
+
+    immutable S55 s3;
+    i = s3.foo();
+    assert(i == 3);
+}
+
+/************************************/
+
+const struct S56 { int a; }
+
+void test56()
+{
+    S56 s;
+    S56 t;
+    printf("S56.sizeof = %d\n", S56.sizeof);
+    //t = s;
+}
+
+/************************************/
+
+struct S57
+{
+    const void foo(this T)(int i)
+    {
+        showf(typeid(T).toString());
+        if (i == 1)
+            assert(is(T == const));
+        if (i == 2)
+            assert(!is(T == const));
+        if (i == 3)
+            assert(is(T == immutable));
+    }
+}
+
+void test57()
+{
+    const(S57) s;
+    (&s).foo(1);
+    S57 s2;
+    s2.foo(2);
+    immutable(S57) s3;
+    s3.foo(3);
+}
+
+/************************************/
+
+class C58
+{
+    const(C58) c;
+    const C58 y;
+
+    this()
+    {
+        y = null;
+        c = null;
+    }
+
+    const void foo()
+    {
+        //c = null; // should fail
+    }
+
+    void bar()
+    {
+        //c = null;
+    }
+}
+
+void test58()
+{
+}
+
+/************************************/
+
+class A59
+{
+    int[] a;
+    this() { a.length = 1; }
+
+    int* ptr() { return a.ptr; }
+    const const(int)* ptr() { return a.ptr; }
+    immutable immutable(int)* ptr() { return a.ptr; }
+}
+
+void test59()
+{
+    auto a = new A59;
+    const b = cast(const)new A59;
+    immutable c = cast(immutable)new A59;
+}
+
+/************************************/
+
+int foo60(int i) { return 1; }
+int foo60(const int i) { return 2; }
+int foo60(immutable int i) { return 3; }
+
+void test60()
+{
+    int i;
+    const int j;
+    immutable int k;
+
+    assert(foo60(i) == 1);
+    assert(foo60(j) == 2);
+    assert(foo60(k) == 3);
+}
+
+/************************************/
+
+void foo61(T)(T arg)
+{
+    alias const(T) CT;
+    assert(is(const(int) == CT));
+    //writeln(typeid(const(T)));
+    //writeln(typeid(CT));
+}
+
+void test61()
+{
+    int x = 42;
+    foo61(x);
+}
+
+/************************************/
+
+class Foo62(T) { }
+
+void test62()
+{
+    const(Foo62!(int)) f = new Foo62!(int);
+    assert(is(typeof(f) == const(Foo62!(int))));
+}
+
+/************************************/
+
+struct S63
+{
+    int x;
+}
+
+void foo63(const ref S63 scheme)
+{
+    //scheme.x = 3;
+}
+
+void test63()
+{
+        S63 scheme;
+        foo63(scheme);
+}
+
+/************************************/
+
+struct S64
+{
+    int a;
+    long b;
+}
+
+void test64()
+{
+    S64 s1 = S64(2,3);
+    const s2 = S64(2,3);
+    immutable S64 s3 = S64(2,3);
+
+    s1 = s1;
+    s1 = s2;
+    s1 = s3;
+}
+
+/************************************/
+
+struct S65
+{
+    int a;
+    long b;
+    char *p;
+}
+
+void test65()
+{   char c;
+    S65 s1 = S65(2,3);
+    const s2 = S65(2,3);
+    immutable S65 s3 = S65(2,3);
+
+    S65 t1 = S65(2,3,null);
+    const t2 = S65(2,3,null);
+    immutable S65 t3 = S65(2,3,null);
+}
+
+/************************************/
+
+struct S66
+{
+    int a;
+    long b;
+}
+
+void test66()
+{   char c;
+    S66 s1 = S66(2,3);
+    const s2 = S66(2,3);
+    immutable S66 s3 = S66(2,3);
+
+    S66 t1 = s1;
+    S66 t2 = s2;
+    S66 t3 = s3;
+
+    const(S66) u1 = s1;
+    const(S66) u2 = s2;
+    const(S66) u3 = s3;
+
+    immutable(S66) v1 = s1;
+    immutable(S66) v2 = s2;
+    immutable(S66) v3 = s3;
+}
+
+/************************************/
+
+struct Foo68
+{
+    int z;
+    immutable int x;
+    int y;
+}
+
+void test68()
+{
+    Foo68 bar;
+    bar.y = 2;
+}
+
+/************************************/
+
+class C69 {}
+struct S69 {}
+
+void test69()
+{
+        immutable(S69)* si;
+        S69* sm;
+        bool a = si is sm;
+
+        immutable(C69) ci;
+        const(C69) cm;
+        bool b = ci is cm;
+}
+
+/************************************/
+
+struct S70
+{
+  int i;
+}
+
+void test70()
+{
+  S70 s;
+  const(S70) cs = s;
+  S70 s1 = cs;
+  S70 s2 = cast(S70)cs;
+}
+
+/************************************/
+
+void test72()
+{
+    int a;
+    const int b;
+    enum { int c = 0 };
+    immutable int d = 0;
+
+    assert(__traits(isSame, a, a));
+    assert(__traits(isSame, b, b));
+    assert(__traits(isSame, c, c));
+    assert(__traits(isSame, d, d));
+}
+
+/************************************/
+
+void a73(const int [] data...)
+{
+    a73(1);
+}
+
+void test73()
+{
+}
+
+/************************************/
+
+struct S74 { int x; }
+
+const S74 s_const = {0};
+
+S74 s_mutable = s_const;
+
+void test74()
+{
+}
+
+/************************************/
+
+struct A75 { int x; }
+struct B75 { A75 s1; }
+
+const A75 s1_const = {0};
+const B75 s2_const = {s1_const};
+
+void test75()
+{
+}
+
+/************************************/
+
+void test76()
+{
+    int[int] array;
+    const(int[int]) a = array;
+}
+
+/************************************/
+
+void test77()
+{
+    int[][] intArrayArray;
+    int[][][] intArrayArrayArray;
+
+//    const(int)[][] f1 = intArrayArray;
+    const(int[])[] f2 = intArrayArray;
+
+//    const(int)[][][] g1 = intArrayArrayArray;
+//    const(int[])[][] g2 = intArrayArrayArray;
+    const(int[][])[] g3 = intArrayArrayArray;
+}
+
+/************************************/
+
+void foo78(T)(const(T)[] arg1, const(T)[] arg2) { }
+
+void test78()
+{
+    foo78("hello", "world".dup);
+    foo78("hello", "world");
+    foo78("hello".dup, "world".dup);
+    foo78(cast(const)"hello", cast(const)"world");
+}
+
+/************************************/
+
+const bool[string] stopWords79;
+
+static this()
+{
+    stopWords79 = [ "a"[]:1 ];
+}
+
+void test79()
+{
+    "abc" in stopWords79;
+}
+
+/************************************/
+
+void test80(inout(int) _ = 0)
+{
+    char x;
+    inout(char) y = x;
+
+    const(char)[] c;
+    immutable(char)[] i;
+    shared(char)[] s;
+    const(shared(char))[] sc;
+    inout(char)[] w;
+    inout(shared(char))[] sw;
+
+    c = c;
+    c = i;
+    static assert(!__traits(compiles, c = s));
+    static assert(!__traits(compiles, c = sc));
+    c = w;
+    static assert(!__traits(compiles, c = sw));
+
+    static assert(!__traits(compiles, i = c));
+    i = i;
+    static assert(!__traits(compiles, i = s));
+    static assert(!__traits(compiles, i = sc));
+    static assert(!__traits(compiles, i = w));
+    static assert(!__traits(compiles, i = sw));
+
+    static assert(!__traits(compiles, s = c));
+    static assert(!__traits(compiles, s = i));
+    s = s;
+    static assert(!__traits(compiles, s = sc));
+    static assert(!__traits(compiles, s = w));
+    static assert(!__traits(compiles, s = sw));
+
+    static assert(!__traits(compiles, sc = c));
+    sc = i;
+    sc = s;
+    sc = sc;
+    static assert(!__traits(compiles, sc = w));
+    sc = sw;
+
+    static assert(!__traits(compiles, w = c));
+    static assert(!__traits(compiles, w = i));
+    static assert(!__traits(compiles, w = s));
+    static assert(!__traits(compiles, w = sc));
+    w = w;
+    static assert(!__traits(compiles, w = sw));
+
+    static assert(!__traits(compiles, sw = c));
+    static assert(!__traits(compiles, sw = i));
+    static assert(!__traits(compiles, sw = s));
+    static assert(!__traits(compiles, sw = sc));
+    static assert(!__traits(compiles, sw = w));
+    sw = sw;
+}
+
+/************************************/
+
+void test81(inout(int) _ = 0)
+{
+    const(char)* c;
+    immutable(char)* i;
+    shared(char)* s;
+    const(shared(char))* sc;
+    inout(char)* w;
+
+    c = c;
+    c = i;
+    static assert(!__traits(compiles, c = s));
+    static assert(!__traits(compiles, c = sc));
+    c = w;
+
+    static assert(!__traits(compiles, i = c));
+    i = i;
+    static assert(!__traits(compiles, i = s));
+    static assert(!__traits(compiles, i = sc));
+    static assert(!__traits(compiles, i = w));
+
+    static assert(!__traits(compiles, s = c));
+    static assert(!__traits(compiles, s = i));
+    s = s;
+    static assert(!__traits(compiles, s = sc));
+    static assert(!__traits(compiles, s = w));
+
+    static assert(!__traits(compiles, sc = c));
+    sc = i;
+    sc = s;
+    sc = sc;
+    static assert(!__traits(compiles, sc = w));
+
+    static assert(!__traits(compiles, w = c));
+    static assert(!__traits(compiles, w = i));
+    static assert(!__traits(compiles, w = s));
+    static assert(!__traits(compiles, w = sc));
+    w = w;
+}
+
+/************************************/
+
+
+void test82(inout(int) _ = 0)
+{
+    const(immutable(char)*) c;
+    pragma(msg, typeof(c));
+    static assert(typeof(c).stringof == "const(immutable(char)*)");
+
+    inout(immutable(char)*) d;
+    pragma(msg, typeof(d));
+    static assert(typeof(d).stringof == "inout(immutable(char)*)");
+
+    inout(const(char)*) e;
+
+    pragma(msg, typeof(e));
+    static assert(is(typeof(e) == inout(const(char)*)));
+    static assert(typeof(e).stringof == "inout(const(char)*)");
+
+    pragma(msg, typeof(*e));
+    static assert(is(typeof(*e) == inout(const(char))));
+    static assert(typeof(*e).stringof == "inout(const(char))");
+
+    inout const(char)* f;
+    static assert(is(typeof(e) == typeof(f)));
+
+    inout(shared(char)) g;
+    pragma(msg, typeof(g));
+    static assert(typeof(g).stringof == "shared(inout(char))");
+
+    shared(inout(char)) h;
+    pragma(msg, typeof(h));
+    static assert(typeof(h).stringof == "shared(inout(char))");
+
+    inout(immutable(char)) i;
+    pragma(msg, typeof(i));
+    static assert(typeof(i).stringof == "immutable(char)");
+
+    immutable(inout(char)) j;
+    pragma(msg, typeof(j));
+    static assert(typeof(j).stringof == "immutable(char)");
+
+    inout(const(char)) k;
+    pragma(msg, typeof(k));
+    static assert(typeof(k).stringof == "inout(const(char))");
+
+    const(inout(char)) l;
+    pragma(msg, typeof(l));
+    static assert(typeof(l).stringof == "inout(const(char))");
+
+    shared(const(char)) m;
+    pragma(msg, typeof(m));
+    static assert(typeof(m).stringof == "shared(const(char))");
+
+    const(shared(char)) n;
+    pragma(msg, typeof(n));
+    static assert(typeof(n).stringof == "shared(const(char))");
+
+    inout(char*****) o;
+    pragma(msg, typeof(o));
+    static assert(typeof(o).stringof == "inout(char*****)");
+    pragma(msg, typeof(cast()o));
+    static assert(typeof(cast()o).stringof == "inout(char****)*");
+
+    const(char*****) p;
+    pragma(msg, typeof(p));
+    static assert(typeof(p).stringof == "const(char*****)");
+    pragma(msg, typeof(cast()p));
+    static assert(typeof(cast()p).stringof == "const(char****)*");
+
+    immutable(char*****) q;
+    pragma(msg, typeof(q));
+    static assert(typeof(q).stringof == "immutable(char*****)");
+    pragma(msg, typeof(cast()q));
+    static assert(typeof(cast()q).stringof == "immutable(char****)*");
+
+    shared(char*****) r;
+    pragma(msg, typeof(r));
+    static assert(typeof(r).stringof == "shared(char*****)");
+    pragma(msg, typeof(cast()r));
+    static assert(typeof(cast()r).stringof == "shared(char****)*");
+    pragma(msg, typeof(cast(const)r));
+    static assert(typeof(cast(const)r).stringof == "const(shared(char****)*)");
+    pragma(msg, typeof(cast(const shared)r));
+    static assert(typeof(cast(const shared)r).stringof == "shared(const(char*****))");
+    pragma(msg, typeof(cast(shared)r));
+    static assert(typeof(cast(shared)r).stringof == "shared(char*****)");
+    pragma(msg, typeof(cast(immutable)r));
+    static assert(typeof(cast(immutable)r).stringof == "immutable(char*****)");
+    pragma(msg, typeof(cast(inout)r));
+    static assert(typeof(cast(inout)r).stringof == "inout(shared(char****)*)");
+
+    inout(shared(char**)***) s;
+    pragma(msg, typeof(s));
+    static assert(typeof(s).stringof == "inout(shared(char**)***)");
+    pragma(msg, typeof(***s));
+    static assert(typeof(***s).stringof == "shared(inout(char**))");
+}
+
+/************************************/
+
+void test83(inout(int) _ = 0)
+{
+    static assert( __traits(compiles, typeid(int* function(inout int))));
+    static assert( __traits(compiles, typeid(int* delegate(inout int))));
+    static assert(!__traits(compiles, typeid(inout(int*) function(int))));
+    static assert(!__traits(compiles, typeid(inout(int*) delegate(int))));
+    static assert(!__traits(compiles, typeid(inout(int*) function())));
+    static assert(!__traits(compiles, typeid(inout(int*) delegate())));
+    inout(int*) function(inout(int)) fp;
+    inout(int*) delegate(inout(int)) dg;
+}
+
+/************************************/
+
+inout(char[]) foo84(inout char[] s) { return s; }
+
+void test84()
+{
+    char[] m;
+    const(char)[] c;
+    string s;
+    auto r = foo84(s);
+    pragma(msg, typeof(r).stringof);
+    static assert(typeof(r).stringof == "immutable(string)");
+
+    pragma(msg, typeof(foo84(c)).stringof);
+    static assert(typeof(foo84(c)).stringof == "const(char[])");
+
+    pragma(msg, typeof(foo84(m)).stringof);
+    static assert(typeof(foo84(m)).stringof == "char[]");
+}
+
+/************************************/
+
+class foo85 { }
+
+alias shared foo85 Y85;
+
+void test85()
+{
+   pragma(msg, Y85);
+   shared(foo85) x = new Y85;
+}
+
+/************************************/
+
+struct foo87
+{
+    int bar(T)(T t){ return 1; }
+    int bar(T)(T t) shared { return 2; }
+}
+
+void test87()
+{
+    foo87 x;
+    auto i = x.bar(1);
+    assert(i == 1);
+    shared foo87 y;
+    i = y.bar(1);
+    assert(i == 2);
+}
+
+/************************************/
+// 2751
+
+
+void test88(immutable(int[3]) a)
+{
+    const(char)[26] abc1 = "abcdefghijklmnopqrstuvwxyz";
+    const(char[26]) abc2 = "abcdefghijklmnopqrstuvwxyz";
+    immutable(const(char)[26]) abc3 = "abcdefghijklmnopqrstuvwxyz";
+    const(immutable(char)[26]) abc4 = "abcdefghijklmnopqrstuvwxyz";
+
+    auto abc5 = cast()"abcdefghijklmnopqrstuvwxyz";
+
+    pragma(msg, typeof(abc1).stringof);
+    pragma(msg, typeof(abc2).stringof);
+    pragma(msg, typeof(abc3).stringof);
+    pragma(msg, typeof(abc4).stringof);
+    pragma(msg, typeof(abc5).stringof);
+
+    static assert(is(typeof(abc1) == typeof(abc2)));
+    static assert(is(typeof(abc1) == const(char[26])));
+    static assert(is(typeof(abc3) == typeof(abc4)));
+    static assert(is(typeof(abc3) == immutable(char[26])));
+
+    auto b = cast()a;
+    pragma(msg, typeof(b).stringof);
+    static assert(is(typeof(b) == int[3]));
+}
+
+/************************************/
+// 3748
+
+// version = error8;
+// version = error11;
+
+class C3748
+{
+    private int _x;
+    this(int x) { this._x = x; }
+    @property inout(int)* xptr() inout { return &_x; }
+    @property void x(int newval) { _x = newval; }
+}
+
+struct S3748
+{
+    int x;
+    immutable int y = 5;
+    const int z = 6;
+    C3748 c;
+
+    inout(int)* getX() inout
+    {
+        static assert(!__traits(compiles, {
+            x = 4;
+        }));
+        return &x;
+    }
+    inout(int)* getCX(C3748 otherc) inout
+    {
+        inout(C3748) c2 = c;    // typeof(c) == inout(C3748)
+        static assert(!__traits(compiles, {
+            inout(C3748) err2 = new C3748(1);
+        }));
+        static assert(!__traits(compiles, {
+            inout(C3748) err3 = otherc;
+        }));
+
+        auto v1 = getLowestXptr(c, otherc);
+        static assert(is(typeof(v1) == const(int)*));
+        auto v2 = getLowestXptr(c, c);
+        static assert(is(typeof(v2) == inout(int)*));
+
+        alias typeof(return) R;
+        static assert(!__traits(compiles, {
+            c.x = 4;
+        }));
+        static assert(!__traits(compiles, {
+            R r = otherc.xptr;
+        }));
+        static assert(!__traits(compiles, {
+            R r = &y;
+        }));
+        static assert(!__traits(compiles, {
+            R r = &z;
+        }));
+
+        return c2.xptr;
+    }
+
+    version(error8)
+        inout(int) err8;    // see fail_compilation/failinout3748a.d
+}
+
+inout(int)* getLowestXptr(inout(C3748) c1, inout(C3748) c2)
+{
+    inout(int)* x1 = c1.xptr;
+    inout(int)* x2 = c2.xptr;
+    if(*x1 <= *x2)
+        return x1;
+    return x2;
+}
+
+ref inout(int) getXRef(inout(C3748) c1, inout(C3748) c2)
+{
+    return *getLowestXptr(c1, c2);
+}
+
+void test3748()
+{
+    S3748 s;
+    s.c = new C3748(1);
+    const(S3748)* sp = &s;
+    auto s2 = new S3748;
+    s2.x = 3;
+    s2.c = new C3748(2);
+    auto s3 = cast(immutable(S3748)*) s2;
+
+    auto v1 = s.getX;
+    static assert(is(typeof(v1) == int*));
+    auto v2 = sp.getX;
+    static assert(is(typeof(v2) == const(int)*));
+    auto v3 = s3.getX;
+    static assert(is(typeof(v3) == immutable(int)*));
+
+    static assert(!__traits(compiles, {
+        int *err9 = sp.getX;
+    }));
+    static assert(!__traits(compiles, {
+        int *err10 = s3.getX;
+    }));
+    version(error11)
+        inout(int)* err11;  // see fail_compilation/failinout3748b.d
+
+    auto v4 = getLowestXptr(s.c, s3.c);
+    static assert(is(typeof(v4) == const(int)*));
+    auto v5 = getLowestXptr(s.c, s.c);
+    static assert(is(typeof(v5) == int*));
+    auto v6 = getLowestXptr(s3.c, s3.c);
+    static assert(is(typeof(v6) == immutable(int)*));
+
+    getXRef(s.c, s.c) = 3;
+}
+
+/************************************/
+
+void test3748a(inout int = 1)
+{
+                 int[]    ma;
+           inout(int[])   wa;
+           const(int[])   ca;
+       immutable(int[])   ia;
+          shared(int[])   sa;
+    shared(inout(int[])) swa;
+    shared(const(int[])) sca;
+
+    static foo1(E)(inout(E[]) a) { return E.init; }
+    static assert( is( typeof(foo1( ma)) == int));
+    static assert( is( typeof(foo1( wa)) == int));
+    static assert( is( typeof(foo1( ca)) == int));
+    static assert( is( typeof(foo1( ia)) == int));
+    static assert( is( typeof(foo1( sa)) == shared int));
+    static assert( is( typeof(foo1(swa)) == shared int));
+    static assert( is( typeof(foo1(sca)) == shared int));
+
+    static foo2(E)(shared inout(E[]) a) { return E.init; }
+    static assert(!is( typeof(foo2( ma)) ));
+    static assert(!is( typeof(foo2( wa)) ));
+    static assert(!is( typeof(foo2( ca)) ));
+    static assert( is( typeof(foo2( ia)) == int));
+    static assert( is( typeof(foo2( sa)) == int));
+    static assert( is( typeof(foo2(swa)) == int));
+    static assert( is( typeof(foo2(sca)) == int));
+}
+
+void test3748b(inout int = 1)
+{
+    // Top of the parameter type is non-ref & qualified
+    static        inout(int[])  foo1(       inout(int[])  a);
+    static shared(inout(int[])) bar1(shared(inout(int[])) a);
+
+    // Top of the parameter type is non-ref & un-qualified
+    static        inout(int) [] foo2(       inout(int) [] a);
+    static shared(inout(int))[] bar2(shared(inout(int))[] a);
+
+    // Top of the argument type is qualified
+                 int[]    ma1;
+           inout(int[])   wa1;
+           const(int[])   ca1;
+          shared(int[])   sa1;
+    shared(inout(int[])) swa1;
+    shared(const(int[])) sca1;
+       immutable(int[])   ia1;
+
+    // Top of the argument type is un-qualified
+                 int  []  ma2;
+           inout(int) []  wa2;
+           const(int) []  ca2;
+          shared(int) []  sa2;
+    shared(inout(int))[] swa2;
+    shared(const(int))[] sca2;
+       immutable(int) []  ia2;
+
+    // --> non-ref qualified param VS qualified arg
+    static assert( is( typeof(foo1( ma1)) == typeof( ma1) ));
+    static assert( is( typeof(foo1( wa1)) == typeof( wa1) ));
+    static assert( is( typeof(foo1( ca1)) == typeof( ca1) ));
+    static assert( is( typeof(bar1( sa1)) == typeof( sa1) ));
+    static assert( is( typeof(bar1(swa1)) == typeof(swa1) ));
+    static assert( is( typeof(bar1(sca1)) == typeof(sca1) ));
+    static assert( is( typeof(foo1( ia1)) == typeof( ia1) ));
+
+    // --> non-ref un-qualified param VS qualified arg
+    static assert( is( typeof(foo2( ma1)) == typeof( ma2) ));
+    static assert( is( typeof(foo2( wa1)) == typeof( wa2) ));
+    static assert( is( typeof(foo2( ca1)) == typeof( ca2) ));
+    static assert( is( typeof(bar2( sa1)) == typeof( sa2) ));
+    static assert( is( typeof(bar2(swa1)) == typeof(swa2) ));
+    static assert( is( typeof(bar2(sca1)) == typeof(sca2) ));
+    static assert( is( typeof(foo2( ia1)) == typeof( ia2) ));
+
+    // --> non-ref qualified param VS un-qualified arg
+    static assert( is( typeof(foo1( ma2)) == typeof( ma1) ));
+    static assert( is( typeof(foo1( wa2)) ));
+    static assert( is( typeof(foo1( ca2)) ));
+    static assert( is( typeof(bar1( sa2)) == typeof( sa1) ));
+    static assert( is( typeof(bar1(swa2)) ));
+    static assert( is( typeof(bar1(sca2)) ));
+    static assert( is( typeof(foo1( ia2)) ));
+
+    // --> non-ref un-qualified param VS un-qualified arg
+    static assert( is( typeof(foo2( ma2)) == typeof( ma2) ));
+    static assert( is( typeof(foo2( wa2)) == typeof( wa2) ));
+    static assert( is( typeof(foo2( ca2)) == typeof( ca2) ));
+    static assert( is( typeof(bar2( sa2)) == typeof( sa2) ));
+    static assert( is( typeof(bar2(swa2)) == typeof(swa2) ));
+    static assert( is( typeof(bar2(sca2)) == typeof(sca2) ));
+    static assert( is( typeof(foo2( ia2)) == typeof( ia2) ));
+}
+
+void test3748c(inout int = 1)
+{
+    // Top of the parameter type is ref & qualified
+    static        inout(int[])  foo1(ref        inout(int[])  a);
+    static shared(inout(int[])) bar1(ref shared(inout(int[])) a);
+
+    // Top of the parameter type is ref & un-qualified
+    static        inout(int) [] foo2(ref        inout(int) [] a);
+    static shared(inout(int))[] bar2(ref shared(inout(int))[] a);
+
+    // Top of the argument type is qualified
+                 int[]    ma1;
+           inout(int[])   wa1;
+           const(int[])   ca1;
+          shared(int[])   sa1;
+    shared(inout(int[])) swa1;
+    shared(const(int[])) sca1;
+       immutable(int[])   ia1;
+
+    // Top of the argument type is un-qualified
+                 int  []  ma2;
+           inout(int) []  wa2;
+           const(int) []  ca2;
+          shared(int) []  sa2;
+    shared(inout(int))[] swa2;
+    shared(const(int))[] sca2;
+       immutable(int) []  ia2;
+
+    // --> ref qualified param VS qualified arg
+    static assert( is( typeof(foo1( ma1)) == typeof( ma1) ));
+    static assert( is( typeof(foo1( wa1)) == typeof( wa1) ));
+    static assert( is( typeof(foo1( ca1)) == typeof( ca1) ));
+    static assert( is( typeof(bar1( sa1)) == typeof( sa1) ));
+    static assert( is( typeof(bar1(swa1)) == typeof(swa1) ));
+    static assert( is( typeof(bar1(sca1)) == typeof(sca1) ));
+    static assert( is( typeof(foo1( ia1)) == typeof( ia1) ));
+
+    // --> ref un-qualified param VS qualified arg
+    static assert( is( typeof(foo2( ma1)) == typeof( ma2) ));
+    static assert(!is( typeof(foo2( wa1)) ));
+    static assert(!is( typeof(foo2( ca1)) ));
+    static assert(!is( typeof(bar2( sa1)) ));
+    static assert(!is( typeof(bar2(swa1)) ));
+    static assert(!is( typeof(bar2(sca1)) ));
+    static assert(!is( typeof(foo2( ia1)) ));
+
+    // --> ref qualified param VS un-qualified arg
+    static assert( is( typeof(foo1( ma2)) == typeof( ma1) ));
+    static assert(!is( typeof(foo1( wa2)) ));
+    static assert(!is( typeof(foo1( ca2)) ));  // why this is OK? --> [*]
+    static assert(!is( typeof(bar1( sa2)) ));
+    static assert(!is( typeof(bar1(swa2)) ));
+    static assert(!is( typeof(bar1(sca2)) ));
+    static assert(!is( typeof(foo1( ia2)) ));
+
+    // --> ref un-qualified param VS un-qualified arg
+    static assert( is( typeof(foo2( ma2)) == typeof( ma2) ));
+    static assert( is( typeof(foo2( wa2)) == typeof( wa2) ));
+    static assert( is( typeof(foo2( ca2)) == typeof( ca2) ));
+    static assert( is( typeof(bar2( sa2)) == typeof( sa2) ));
+    static assert( is( typeof(bar2(swa2)) == typeof(swa2) ));
+    static assert( is( typeof(bar2(sca2)) == typeof(sca2) ));
+    static assert( is( typeof(foo2( ia2)) == typeof( ia2) ));
+}
+
+/************************************/
+// 4968
+
+void test4968()
+{
+    inout(int) f1(inout(int) i) { return i; }
+    int mi;
+    const int ci;
+    immutable int ii;
+    static assert(is(typeof(f1(mi)) == int));
+    static assert(is(typeof(f1(ci)) == const(int)));
+    static assert(is(typeof(f1(ii)) == immutable(int)));
+
+    inout(int)* f2(inout(int)* p) { return p; }
+    int* mp;
+    const(int)* cp;
+    immutable(int)* ip;
+    static assert(is(typeof(f2(mp)) == int*));
+    static assert(is(typeof(f2(cp)) == const(int)*));
+    static assert(is(typeof(f2(ip)) == immutable(int)*));
+
+    inout(int)[] f3(inout(int)[] a) { return a; }
+    int[] ma;
+    const(int)[] ca;
+    immutable(int)[] ia;
+    static assert(is(typeof(f3(ma)) == int[]));
+    static assert(is(typeof(f3(ca)) == const(int)[]));
+    static assert(is(typeof(f3(ia)) == immutable(int)[]));
+
+    inout(int)[1] f4(inout(int)[1] sa) { return sa; }
+    int[1] msa;
+    const int[1] csa;
+    immutable int[1] isa;
+    static assert(is(typeof(f4(msa)) == int[1]));
+    static assert(is(typeof(f4(csa)) == const(int)[1]));
+    static assert(is(typeof(f4(isa)) == immutable(int)[1]));
+
+    inout(int)[string] f5(inout(int)[string] aa) { return aa; }
+    int[string] maa;
+    const(int)[string] caa;
+    immutable(int)[string] iaa;
+    static assert(is(typeof(f5(maa)) == int[string]));
+    static assert(is(typeof(f5(caa)) == const(int)[string]));
+    static assert(is(typeof(f5(iaa)) == immutable(int)[string]));
+}
+
+/************************************/
+// 1961
+
+inout(char)[] strstr(inout(char)[] source, const(char)[] pattern)
+{
+    /*
+     * this would be an error, as const(char)[] is not implicitly castable to
+     * inout(char)[]
+     */
+    // return pattern;
+
+    for(int i = 0; i + pattern.length <= source.length; i++)
+    {
+        inout(char)[] tmp = source[i..pattern.length]; // ok
+        if (tmp == pattern)         // ok, tmp implicitly casts to const(char)[]
+            return source[i..$];    // implicitly casts back to call-site source
+    }
+    return source[$..$];            // to be consistent with strstr.
+}
+
+void test1961a()
+{
+    auto a = "hello";
+    a = strstr(a, "llo");   // cf (constancy factor) == immutable
+    static assert(!__traits(compiles, { char[] b = strstr(a, "llo"); }));
+                            // error, cannot cast immutable to mutable
+    char[] b = "hello".dup;
+    b = strstr(b, "llo");   // cf == mutable (note that "llo" doesn't play a role
+                            // because that parameter is not inout)
+    const(char)[] c = strstr(b, "llo");
+                            // cf = mutable, ok because mutable
+                            // implicitly casts to const
+    c = strstr(a, "llo");   // cf = immutable, ok immutable casts to const
+}
+
+inout(T) min(T)(inout(T) a, inout(T) b)
+{
+    return a < b ? a : b;
+}
+
+void test1961b()
+{
+    immutable(char)[] i = "hello";
+    const(char)[] c = "there";
+    char[] m = "Walter".dup;
+
+    static assert(!__traits(compiles, { i = min(i, c); }));
+                            // error, since i and c vary in constancy, the result
+                            // is const, and you cannot implicitly cast const to immutable.
+
+    c = min(i, c);          // ok, cf == const, because not homogeneous
+    c = min(m, c);          // ok, cf == const
+    c = min(m, i);          // ok, cf == const
+    i = min(i, "blah");     // ok, cf == immutable, homogeneous
+    static assert(!__traits(compiles, { m = min(m, c); }));
+                            // error, cf == const because not homogeneous.
+    static assert(!__traits(compiles, { m = min(m, "blah"); }));
+                            // error, cf == const
+    m = min(m, "blah".dup); // ok
+}
+
+inout(T) min2(int i, int j, T)(inout(T) a, inout(T) b)
+{
+    //pragma(msg, "(", i, ", ", j, ") = ", T);
+    static assert(is(T == char[]));
+    return a < b ? a : b;
+}
+
+template seq(T...){ alias T seq; }
+
+void test1961c()
+{
+    immutable(char[]) iia = "hello1";
+    immutable(char)[] ima = "hello2";
+    const(char[]) cca = "there1";
+    const(char)[] cma = "there2";
+    char[] mma = "Walter".dup;
+
+    foreach (i, x; seq!(iia, ima, cca, cma, mma))
+    foreach (j, y; seq!(iia, ima, cca, cma, mma))
+    {
+        min2!(i, j)(x, y);
+        //pragma(msg, "x: ",typeof(x), ", y: ",typeof(y), " -> ", typeof(min2(x, y)), " : ", __traits(compiles, min2(x, y)));
+    }
+}
+
+/************************************/
+
+inout(int) function(inout(int))   notinoutfun1() { return null; }
+inout(int) function(inout(int))[] notinoutfun2() { return null; }
+inout(int) delegate(inout(int))   notinoutfun3() { return null; }
+inout(int) delegate(inout(int))[] notinoutfun4() { return null; }
+void notinoutfun1(inout(int) function(inout(int))   fn) {}
+void notinoutfun2(inout(int) function(inout(int))[] fn) {}
+void notinoutfun3(inout(int) delegate(inout(int))   dg) {}
+void notinoutfun4(inout(int) delegate(inout(int))[] dg) {}
+
+void test88()
+{
+    inout(int) function(inout int) fp;
+    inout(int) delegate(inout int) dg;
+
+    inout(int) function(inout int)*   fp2p;
+    inout(int) function(inout int)[]  fp2a;
+    inout(int) function(inout int)[3] fp2s;
+
+    inout(int) delegate(inout int)*   dg3p;
+    inout(int) delegate(inout int)[]  dg3a;
+    inout(int) delegate(inout int)[3] dg3s;
+
+    int delegate() inout*   dg4p;
+    int delegate() inout[]  dg4a;
+    int delegate() inout[3] dg4s;
+
+    static assert(!__traits(compiles, { inout(int)* p; }));
+    static assert(!__traits(compiles, { inout(int delegate()) dg; }));
+}
+
+/************************************/
+// 4251
+
+void test4251a()
+{
+    alias int T;
+
+    static assert(!is( immutable(T)** : const(T)** ));  // NG, tail difference
+    static assert( is( immutable(T)** : const(T**) ));  // OK, tail to const
+
+    static assert( is(           T *** :           T *** ));    // OK, tail is same
+    static assert(!is(           T *** :     const(T)*** ));
+    static assert(!is(           T *** :     const(T*)** ));
+    static assert( is(           T *** :     const(T**)* ));    // OK, tail to const
+    static assert( is(           T *** :     const(T***) ));    // OK, tail to const
+    static assert(!is(           T *** : immutable(T)*** ));
+    static assert(!is(           T *** : immutable(T*)** ));
+    static assert(!is(           T *** : immutable(T**)* ));
+    static assert(!is(           T *** : immutable(T***) ));
+
+    static assert(!is(     const(T)*** :           T *** ));
+    static assert( is(     const(T)*** :     const(T)*** ));    // OK, tail is same
+    static assert(!is(     const(T)*** :     const(T*)** ));
+    static assert( is(     const(T)*** :     const(T**)* ));    // OK, tail to const
+    static assert( is(     const(T)*** :     const(T***) ));    // OK, tail to const
+    static assert(!is(     const(T)*** : immutable(T)*** ));
+    static assert(!is(     const(T)*** : immutable(T*)** ));
+    static assert(!is(     const(T)*** : immutable(T**)* ));
+    static assert(!is(     const(T)*** : immutable(T***) ));
+
+    static assert(!is(     const(T*)** :           T *** ));
+    static assert(!is(     const(T*)** :     const(T)*** ));
+    static assert( is(     const(T*)** :     const(T*)** ));    // OK, tail is same
+    static assert( is(     const(T*)** :     const(T**)* ));    // OK, tail to const
+    static assert( is(     const(T*)** :     const(T***) ));    // OK, tail to const
+    static assert(!is(     const(T*)** : immutable(T)*** ));
+    static assert(!is(     const(T*)** : immutable(T*)** ));
+    static assert(!is(     const(T*)** : immutable(T**)* ));
+    static assert(!is(     const(T*)** : immutable(T***) ));
+
+    static assert(!is(     const(T**)* :           T *** ));
+    static assert(!is(     const(T**)* :     const(T)*** ));
+    static assert(!is(     const(T**)* :     const(T*)** ));
+    static assert( is(     const(T**)* :     const(T**)* ));    // OK, tail is same
+    static assert( is(     const(T**)* :     const(T***) ));    // OK, tail is same
+    static assert(!is(     const(T**)* : immutable(T)*** ));
+    static assert(!is(     const(T**)* : immutable(T*)** ));
+    static assert(!is(     const(T**)* : immutable(T**)* ));
+    static assert(!is(     const(T**)* : immutable(T***) ));
+
+    static assert(!is(     const(T***) :           T *** ));
+    static assert(!is(     const(T***) :     const(T)*** ));
+    static assert(!is(     const(T***) :     const(T*)** ));
+    static assert( is(     const(T***) :     const(T**)* ));    // OK, tail is same
+    static assert( is(     const(T***) :     const(T***) ));    // OK, tail is same
+    static assert(!is(     const(T***) :           T *** ));
+    static assert(!is(     const(T***) : immutable(T)*** ));
+    static assert(!is(     const(T***) : immutable(T*)** ));
+    static assert(!is(     const(T***) : immutable(T**)* ));
+    static assert(!is(     const(T***) : immutable(T***) ));
+
+    static assert(!is( immutable(T)*** :           T *** ));
+    static assert(!is( immutable(T)*** :     const(T)*** ));
+    static assert(!is( immutable(T)*** :     const(T*)** ));
+    static assert( is( immutable(T)*** :     const(T**)* ));    // OK, tail to const
+    static assert( is( immutable(T)*** :     const(T***) ));    // OK, tail to const
+    static assert( is( immutable(T)*** : immutable(T)*** ));    // OK, tail is same
+    static assert(!is( immutable(T)*** : immutable(T*)** ));
+    static assert(!is( immutable(T)*** : immutable(T**)* ));
+    static assert(!is( immutable(T)*** : immutable(T***) ));
+
+    static assert(!is( immutable(T*)** :           T *** ));
+    static assert(!is( immutable(T*)** :     const(T)*** ));
+    static assert(!is( immutable(T*)** :     const(T*)** ));
+    static assert( is( immutable(T*)** :     const(T**)* ));    // OK, tail to const
+    static assert( is( immutable(T*)** :     const(T***) ));    // OK, tail to const
+    static assert(!is( immutable(T*)** : immutable(T)*** ));
+    static assert( is( immutable(T*)** : immutable(T*)** ));    // OK, tail is same
+    static assert(!is( immutable(T*)** : immutable(T**)* ));
+    static assert(!is( immutable(T*)** : immutable(T***) ));
+
+    static assert(!is( immutable(T**)* :           T *** ));
+    static assert(!is( immutable(T**)* :     const(T)*** ));
+    static assert(!is( immutable(T**)* :     const(T*)** ));
+    static assert( is( immutable(T**)* :     const(T**)* ));    // OK, tail to const
+    static assert( is( immutable(T**)* :     const(T***) ));    // OK, tail to const
+    static assert(!is( immutable(T**)* : immutable(T)*** ));
+    static assert(!is( immutable(T**)* : immutable(T*)** ));
+    static assert( is( immutable(T**)* : immutable(T**)* ));    // OK, tail is same
+    static assert( is( immutable(T**)* : immutable(T***) ));    // OK, tail is same
+
+    static assert(!is( immutable(T***) :           T *** ));
+    static assert(!is( immutable(T***) :     const(T)*** ));
+    static assert(!is( immutable(T***) :     const(T*)** ));
+    static assert( is( immutable(T***) :     const(T**)* ));    // OK, tail to const
+    static assert( is( immutable(T***) :     const(T***) ));    // OK, tail to const
+    static assert(!is( immutable(T***) : immutable(T)*** ));
+    static assert(!is( immutable(T***) : immutable(T*)** ));
+    static assert( is( immutable(T***) : immutable(T**)* ));    // OK, tail is same
+    static assert( is( immutable(T***) : immutable(T***) ));    // OK, tail is same
+
+    static assert( is( immutable(int)** : const(immutable(int)*)* ));   // OK, tail to const
+
+    // shared level should be same
+    static assert(!is( shared(T)*** :        const(T***)  ));   // NG, tail to const but shared level is different
+    static assert( is( shared(T***) : shared(const(T***)) ));   // OK, tail to const and shared level is same
+
+    // head qualifier difference is ignored
+    static assert(is( shared(int)* : shared(int*) ));
+    static assert(is( inout (int)* : inout (int*) ));
+
+    //
+    static assert(!is( T** : T*** ));
+    static assert(!is( T[]** : T*** ));
+}
+
+void test4251b()
+{
+    class C {}
+    class D : C {}
+
+    static assert(!is( C[]* : const(C)[]* ));
+    static assert( is( C[]* : const(C[])* ));
+
+    // derived class to const(base class) in tail
+    static assert( is( D[]  : const(C)[] ));
+    static assert( is( D[]* : const(C[])* ));
+
+    static assert( is( D*  : const(C)* ));
+    static assert( is( D** : const(C*)* ));
+
+    // derived class to const(base interface) in tail
+    interface I {}
+    class X : I {}
+    static assert(!is( X[] : const(I)[] ));
+
+    // interface to const(base interface) in tail
+    interface J {}
+    interface K : I, J {}
+    static assert( is( K[] : const(I)[] )); // OK, runtime offset is same
+    static assert(!is( K[] : const(J)[] )); // NG, runtime offset is different
+}
+
+/************************************/
+// 5473
+
+void test5473()
+{
+    class C
+    {
+        int b;
+        void f(){}
+        static int x;
+        static void g(){};
+    }
+    struct S
+    {
+        int b;
+        void f(){}
+        static int x;
+        static void g(){};
+    }
+
+    void dummy();
+    alias typeof(dummy) VoidFunc;
+
+    const C c = new C;
+    const S s;
+
+    foreach (a; TypeTuple!(c, s))
+    {
+        alias typeof(a) A;
+
+        static assert(is(typeof(a.b) == const int));    // const(int)
+        static assert(is(typeof(a.f) == VoidFunc));
+        static assert(is(typeof(a.x) == int));
+        static assert(is(typeof(a.g) == VoidFunc));
+
+        static assert(is(typeof((const A).b) == const int));    // int, should be const(int)
+        static assert(is(typeof((const A).f) == VoidFunc));
+        static assert(is(typeof((const A).x) == int));
+        static assert(is(typeof((const A).g) == VoidFunc));
+    }
+}
+
+/************************************/
+// 5493
+
+void test5493()
+{
+    // non template function
+    void pifun(immutable(char)[]* a) {}
+    void rifun(ref immutable(char)[] a) {}
+
+    void pcfun(const(char)[]* a) {}
+    void rcfun(ref const(char)[] a) {}
+
+    immutable char[] buf1 = "hello";
+    static assert(!__traits(compiles, pifun(buf1)));
+    static assert(!__traits(compiles, pcfun(buf1)));
+    static assert(!__traits(compiles, rifun(buf1)));
+    static assert(!__traits(compiles, rcfun(buf1)));
+
+    immutable char[5] buf2 = "hello";
+    static assert(!__traits(compiles, pifun(buf2)));
+    static assert(!__traits(compiles, pcfun(buf2)));
+    static assert(!__traits(compiles, rifun(buf2)));
+    static assert(!__traits(compiles, rcfun(buf2)));
+
+    const char[] buf3 = "hello";
+    static assert(!__traits(compiles, pcfun(buf3)));
+    static assert(!__traits(compiles, rcfun(buf3)));
+
+    const char[5] buf4 = "hello";
+    static assert(!__traits(compiles, pcfun(buf4)));
+    static assert(!__traits(compiles, rcfun(buf4)));
+
+    // template function
+    void pmesswith(T)(const(T)[]* ts, const(T) t)
+    {
+        *ts ~= t;
+    }
+    void rmesswith(T)(ref const(T)[] ts, const(T) t)
+    {
+        ts ~= t;
+    }
+    class C
+    {
+        int x;
+        this(int i) immutable { x = i; }
+    }
+    C[] cs;
+    immutable C ci = new immutable(C)(6);
+    assert (ci.x == 6);
+    static assert(!__traits(compiles, pmesswith(&cs,ci)));
+    static assert(!__traits(compiles, rmesswith(cs,ci)));
+    //cs[$-1].x = 14;
+    //assert (ci.x == 14); //whoops.
+}
+
+/************************************/
+// 5493 + inout
+
+void test5493inout()
+{
+    int m;
+    const(int) c;
+    immutable(int) i;
+
+    inout(int) ptrfoo(inout(int)** a, inout(int)* b)
+    {
+        *a = b;
+        return 0;   // dummy
+    }
+    inout(int) reffoo(ref inout(int)* a, inout(int)* b)
+    {
+        a = b;
+        return 0;   // dummy
+    }
+
+    // wild matching: inout == mutable
+    int* pm;
+                                      ptrfoo(&pm, &m);    assert(pm == &m);
+    static assert(!__traits(compiles, ptrfoo(&pm, &c)));
+    static assert(!__traits(compiles, ptrfoo(&pm, &i)));
+                                      reffoo( pm, &m);    assert(pm == &m);
+    static assert(!__traits(compiles, reffoo( pm, &c)));
+    static assert(!__traits(compiles, reffoo( pm, &i)));
+
+    // wild matching: inout == const
+    const(int)* pc;
+    ptrfoo(&pc, &m);    assert(pc == &m);
+    ptrfoo(&pc, &c);    assert(pc == &c);
+    ptrfoo(&pc, &i);    assert(pc == &i);
+    reffoo( pc, &m);    assert(pc == &m);
+    reffoo( pc, &c);    assert(pc == &c);
+    reffoo( pc, &i);    assert(pc == &i);
+
+    // wild matching: inout == immutable
+    immutable(int)* pi;
+    static assert(!__traits(compiles, ptrfoo(&pi, &m)));
+    static assert(!__traits(compiles, ptrfoo(&pi, &c)));
+                                      ptrfoo(&pi, &i);    assert(pi == &i);
+    static assert(!__traits(compiles, reffoo( pi, &m)));
+    static assert(!__traits(compiles, reffoo( pi, &c)));
+                                      reffoo( pi, &i);    assert(pi == &i);
+}
+
+/************************************/
+// 6782
+
+struct Tuple6782(T...)
+{
+    T field;
+    alias field this;
+}
+auto tuple6782(T...)(T field)
+{
+    return Tuple6782!T(field);
+}
+
+struct Range6782a
+{
+    int *ptr;
+    @property inout(int)* front() inout { return ptr; }
+    @property bool empty() const { return ptr is null; }
+    void popFront() { ptr = null; }
+}
+struct Range6782b
+{
+    Tuple6782!(int, int*) e;
+    @property front() inout { return e; }
+    @property empty() const { return e[1] is null; }
+    void popFront() { e[1] = null; }
+}
+
+void test6782()
+{
+    int x = 5;
+    auto r1 = Range6782a(&x);
+    foreach(p; r1) {}
+
+    auto r2 = Range6782b(tuple6782(1, &x));
+    foreach(i, p; r2) {}
+}
+
+/************************************/
+// 6864
+
+int fn6864( const int n) { return 1; }
+int fn6864(shared int n) { return 2; }
+inout(int) fw6864(inout int s) { return 1; }
+inout(int) fw6864(shared inout int s) { return 2; }
+
+void test6864()
+{
+    int n;
+    assert(fn6864(n) == 1);
+    assert(fw6864(n) == 1);
+
+    shared int sn;
+    assert(fn6864(sn) == 2);
+    assert(fw6864(sn) == 2);
+}
+
+/************************************/
+// 6865
+
+shared(inout(int)) foo6865(shared(inout(int)) n){ return n; }
+void test6865()
+{
+    shared(const(int)) n;
+    static assert(is(typeof(foo6865(n)) == shared(const(int))));
+}
+
+/************************************/
+// 6866
+
+struct S6866
+{
+    const(char)[] val;
+    alias val this;
+}
+inout(char)[] foo6866(inout(char)[] s) { return s; }
+
+void test6866()
+{
+    S6866 s;
+    static assert(is(typeof(foo6866(s)) == const(char)[]));
+    // Assertion failure: 'targ' on line 2029 in file 'mtype.c'
+}
+
+/************************************/
+// 6867
+
+inout(char)[] test6867(inout(char)[] a)
+{
+   foreach(dchar d; a) // No error if 'dchar' is removed
+   {
+       foreach(c; a) // line 5
+       {
+       }
+   }
+   return [];
+}
+
+/************************************/
+// 6870
+
+void test6870()
+{
+   shared(int) x;
+   static assert(is(typeof(x) == shared(int))); // pass
+   const(typeof(x)) y;
+   const(shared(int)) z;
+   static assert(is(typeof(y) == typeof(z))); // fail!
+}
+
+/************************************/
+// 6338, 6922
+
+alias int T;
+
+static assert(is( immutable(       T )  == immutable(T) ));
+static assert(is( immutable( const(T))  == immutable(T) )); // 6922
+static assert(is( immutable(shared(T))  == immutable(T) ));
+static assert(is( immutable( inout(T))  == immutable(T) ));
+static assert(is(        immutable(T)   == immutable(T) ));
+static assert(is(  const(immutable(T))  == immutable(T) )); // 6922
+static assert(is( shared(immutable(T))  == immutable(T) )); // 6338
+static assert(is(  inout(immutable(T))  == immutable(T) ));
+
+static assert(is( immutable(shared(const(T))) == immutable(T) ));
+static assert(is( immutable(const(shared(T))) == immutable(T) ));
+static assert(is( shared(immutable(const(T))) == immutable(T) ));
+static assert(is( shared(const(immutable(T))) == immutable(T) ));
+static assert(is( const(shared(immutable(T))) == immutable(T) ));
+static assert(is( const(immutable(shared(T))) == immutable(T) ));
+
+static assert(is( immutable(shared(inout(T))) == immutable(T) ));
+static assert(is( immutable(inout(shared(T))) == immutable(T) ));
+static assert(is( shared(immutable(inout(T))) == immutable(T) ));
+static assert(is( shared(inout(immutable(T))) == immutable(T) ));
+static assert(is( inout(shared(immutable(T))) == immutable(T) ));
+static assert(is( inout(immutable(shared(T))) == immutable(T) ));
+
+/************************************/
+// 6912
+
+void test6912()
+{
+    //                 From                      To
+    static assert( is(                 int []  :                 int []  ));
+    static assert(!is(           inout(int []) :                 int []  ));
+    static assert(!is(                 int []  :           inout(int []) ));
+    static assert( is(           inout(int []) :           inout(int []) ));
+
+    static assert( is(                 int []  :           const(int)[]  ));
+    static assert( is(           inout(int []) :           const(int)[]  ));
+    static assert(!is(                 int []  :     inout(const(int)[]) ));
+    static assert( is(           inout(int []) :     inout(const(int)[]) ));
+
+    static assert( is(           const(int)[]  :           const(int)[]  ));
+    static assert( is(     inout(const(int)[]) :           const(int)[]  ));
+    static assert(!is(           const(int)[]  :     inout(const(int)[]) ));
+    static assert( is(     inout(const(int)[]) :     inout(const(int)[]) ));
+
+    static assert( is(       immutable(int)[]  :           const(int)[]  ));
+    static assert( is( inout(immutable(int)[]) :           const(int)[]  ));
+    static assert( is(       immutable(int)[]  :     inout(const(int)[]) ));
+    static assert( is( inout(immutable(int)[]) :     inout(const(int)[]) ));
+
+    static assert( is(       immutable(int)[]  :       immutable(int)[]  ));
+    static assert( is( inout(immutable(int)[]) :       immutable(int)[]  ));
+    static assert( is(       immutable(int)[]  : inout(immutable(int)[]) ));
+    static assert( is( inout(immutable(int)[]) : inout(immutable(int)[]) ));
+
+    static assert( is(           inout(int)[]  :           inout(int)[]  ));
+    static assert( is(     inout(inout(int)[]) :           inout(int)[]  ));
+    static assert( is(           inout(int)[]  :     inout(inout(int)[]) ));
+    static assert( is(     inout(inout(int)[]) :     inout(inout(int)[]) ));
+
+    static assert( is(           inout(int)[]  :           const(int)[]  ));
+    static assert( is(     inout(inout(int)[]) :           const(int)[]  ));
+    static assert( is(           inout(int)[]  :     inout(const(int)[]) ));
+    static assert( is(     inout(inout(int)[]) :     inout(const(int)[]) ));
+
+    //                 From                         To
+    static assert( is(                 int [int]  :                 int [int]  ));
+    static assert(!is(           inout(int [int]) :                 int [int]  ));
+    static assert(!is(                 int [int]  :           inout(int [int]) ));
+    static assert( is(           inout(int [int]) :           inout(int [int]) ));
+
+    static assert( is(                 int [int]  :           const(int)[int]  ));
+    static assert(!is(           inout(int [int]) :           const(int)[int]  ));
+    static assert(!is(                 int [int]  :     inout(const(int)[int]) ));
+    static assert( is(           inout(int [int]) :     inout(const(int)[int]) ));
+
+    static assert( is(           const(int)[int]  :           const(int)[int]  ));
+    static assert(!is(     inout(const(int)[int]) :           const(int)[int]  ));
+    static assert(!is(           const(int)[int]  :     inout(const(int)[int]) ));
+    static assert( is(     inout(const(int)[int]) :     inout(const(int)[int]) ));
+
+    static assert( is(       immutable(int)[int]  :           const(int)[int]  ));
+    static assert(!is( inout(immutable(int)[int]) :           const(int)[int]  ));
+    static assert(!is(       immutable(int)[int]  :     inout(const(int)[int]) ));
+    static assert( is( inout(immutable(int)[int]) :     inout(const(int)[int]) ));
+
+    static assert( is(       immutable(int)[int]  :       immutable(int)[int]  ));
+    static assert(!is( inout(immutable(int)[int]) :       immutable(int)[int]  ));
+    static assert(!is(       immutable(int)[int]  : inout(immutable(int)[int]) ));
+    static assert( is( inout(immutable(int)[int]) : inout(immutable(int)[int]) ));
+
+    static assert( is(           inout(int)[int]  :           inout(int)[int]  ));
+    static assert(!is(     inout(inout(int)[int]) :           inout(int)[int]  ));
+    static assert(!is(           inout(int)[int]  :     inout(inout(int)[int]) ));
+    static assert( is(     inout(inout(int)[int]) :     inout(inout(int)[int]) ));
+
+    static assert( is(           inout(int)[int]  :           const(int)[int]  ));
+    static assert(!is(     inout(inout(int)[int]) :           const(int)[int]  ));
+    static assert(!is(           inout(int)[int]  :     inout(const(int)[int]) ));
+    static assert( is(     inout(inout(int)[int]) :     inout(const(int)[int]) ));
+
+    // Regression check
+    static assert( is( const(int)[] : const(int[]) ) );
+
+    //                 From                     To
+    static assert( is(                 int *  :                 int *  ));
+    static assert(!is(           inout(int *) :                 int *  ));
+    static assert(!is(                 int *  :           inout(int *) ));
+    static assert( is(           inout(int *) :           inout(int *) ));
+
+    static assert( is(                 int *  :           const(int)*  ));
+    static assert( is(           inout(int *) :           const(int)*  ));
+    static assert(!is(                 int *  :     inout(const(int)*) ));
+    static assert( is(           inout(int *) :     inout(const(int)*) ));
+
+    static assert( is(           const(int)*  :           const(int)*  ));
+    static assert( is(     inout(const(int)*) :           const(int)*  ));
+    static assert(!is(           const(int)*  :     inout(const(int)*) ));
+    static assert( is(     inout(const(int)*) :     inout(const(int)*) ));
+
+    static assert( is(       immutable(int)*  :           const(int)*  ));
+    static assert( is( inout(immutable(int)*) :           const(int)*  ));
+    static assert( is(       immutable(int)*  :     inout(const(int)*) ));
+    static assert( is( inout(immutable(int)*) :     inout(const(int)*) ));
+
+    static assert( is(       immutable(int)*  :       immutable(int)*  ));
+    static assert( is( inout(immutable(int)*) :       immutable(int)*  ));
+    static assert( is(       immutable(int)*  : inout(immutable(int)*) ));
+    static assert( is( inout(immutable(int)*) : inout(immutable(int)*) ));
+
+    static assert( is(           inout(int)*  :           inout(int)*  ));
+    static assert( is(     inout(inout(int)*) :           inout(int)*  ));
+    static assert( is(           inout(int)*  :     inout(inout(int)*) ));
+    static assert( is(     inout(inout(int)*) :     inout(inout(int)*) ));
+
+    static assert( is(           inout(int)*  :           const(int)*  ));
+    static assert( is(     inout(inout(int)*) :           const(int)*  ));
+    static assert( is(           inout(int)*  :     inout(const(int)*) ));
+    static assert( is(     inout(inout(int)*) :     inout(const(int)*) ));
+}
+
+/************************************/
+// 6930
+
+void test6930a()
+{
+    inout(const int) f1(inout(const int) i) { return i; }
+              int mi;
+        const int ci;
+    immutable int ii;
+    static assert(is(typeof(f1(mi)) ==     const(int)));
+    static assert(is(typeof(f1(ci)) ==     const(int)));
+    static assert(is(typeof(f1(ii)) == immutable(int)));
+
+    inout(const int)* f2(inout(const int)* p) { return p; }
+              int * mp;
+        const(int)* cp;
+    immutable(int)* ip;
+    static assert(is(typeof(f2(mp)) ==     const(int)*));
+    static assert(is(typeof(f2(cp)) ==     const(int)*));
+    static assert(is(typeof(f2(ip)) == immutable(int)*));
+
+    inout(const int)[] f3(inout(const int)[] a) { return a; }
+              int [] ma;
+        const(int)[] ca;
+    immutable(int)[] ia;
+    static assert(is(typeof(f3(ma)) ==     const(int)[]));
+    static assert(is(typeof(f3(ca)) ==     const(int)[]));
+    static assert(is(typeof(f3(ia)) == immutable(int)[]));
+
+    inout(const int[1]) f4(inout(const int[1]) sa) { return sa; }
+              int[1] msa;
+        const int[1] csa;
+    immutable int[1] isa;
+    static assert(is(typeof(f4(msa)) ==     const(int)[1]));
+    static assert(is(typeof(f4(csa)) ==     const(int)[1]));
+    static assert(is(typeof(f4(isa)) == immutable(int)[1]));
+
+    inout(const int)[string] f5(inout(const int)[string] aa) { return aa; }
+              int [string] maa;
+        const(int)[string] caa;
+    immutable(int)[string] iaa;
+    static assert(is(typeof(f5(maa)) ==     const(int)[string]));
+    static assert(is(typeof(f5(caa)) ==     const(int)[string]));
+    static assert(is(typeof(f5(iaa)) == immutable(int)[string]));
+}
+
+inout(const(int[])) foo6930(inout(int)[] x)
+{
+    bool condition = cast(bool)(x.length / 2);
+    return condition ? x : new immutable(int[])(2);
+}
+
+void test6930b(inout int = 0)
+{
+    alias T1 = inout(shared(const(int)));
+    static assert(T1.stringof == "shared(inout(const(int)))");
+    static assert(is(T1 == shared) && is(T1 == const) && is(T1 == inout));
+
+    alias T2 = const(shared(inout(int)[]));
+    static assert(T2.stringof == "shared(const(inout(int)[]))");
+    static assert(is(T2 == shared) && is(T2 == const) && !is(T2 == inout) && is(typeof(T2.init[0]) == inout));
+
+              int [] ma;
+        const(int)[] ca;
+    immutable(int)[] ia;
+        inout(int)[] wa;
+    static assert(is(typeof(foo6930(ma)) ==       const int[]));
+    static assert(is(typeof(foo6930(ca)) ==       const int[]));
+    static assert(is(typeof(foo6930(ia)) ==   immutable int[]));
+    static assert(is(typeof(foo6930(wa)) == inout const int[]));
+}
+
+/************************************/
+// 11868
+
+void f11868(A...)(A) { }
+
+void g11868(inout(const(int))[] arr)
+{
+    f11868(arr[0]);
+}
+
+void test11868()
+{
+    auto arr = [1,2,3];
+    g11868(arr);
+}
+
+/************************************/
+// 11924
+
+inout(StringType) localize11924(StringType)(inout StringType str, string locale)
+{
+    return str;
+}
+
+struct S11924
+{
+    static menuItem_1(ARGS...)()
+    {
+        enum itemTitle = ARGS;
+    }
+
+    static content_left_1()
+    {
+        menuItem!(localize11924("Home", ""));
+    }
+    alias menuItem = menuItem_1;
+}
+
+/************************************/
+// 11966
+
+inout(char)[] stripped11966 (inout(char)[] path)
+{
+    return path;
+}
+
+struct PathParser11966
+{
+    inout(const(char))[] path() inout
+    {
+        return null;
+    }
+
+    inout(const(char))[] pop() inout
+    {
+        return stripped11966(path);
+    }
+}
+
+void test11966()
+{
+    auto a = PathParser11966().pop();
+}
+
+/************************************/
+// 12089
+
+void foo12089(inout(char[]) a)
+{
+    validate12089(a);
+}
+void validate12089(S)(in S str)
+{
+    decodeImpl12089(str);
+}
+void decodeImpl12089(S)(auto ref S str)
+{}
+
+/************************************/
+// 12524
+
+inout(int) dup12524(inout(const(int)) val)
+{
+    return val;
+}
+
+void test12524(inout(int))
+{
+    inout(const(int)) val;
+
+    auto bug = dup12524(val);
+
+    static assert(is(typeof(bug) == inout(int)));
+}
+
+/************************************/
+// 6941
+
+static assert((const(shared(int[])[])).stringof == "const(shared(int[])[])");   // fail
+static assert((const(shared(int[])[])).stringof != "const(shared(const(int[]))[])"); // fail
+
+static assert((inout(shared(int[])[])).stringof == "inout(shared(int[])[])");   // fail
+static assert((inout(shared(int[])[])).stringof != "inout(shared(inout(int[]))[])");    // fail
+
+/************************************/
+// 6872
+
+static assert((shared(inout(int)[])).stringof == "shared(inout(int)[])");
+static assert((shared(inout(const(int)[]))).stringof == "shared(inout(const(int)[]))");
+static assert((shared(inout(const(int)[])[])).stringof == "shared(inout(const(int)[])[])");
+static assert((shared(inout(const(immutable(int)[])[])[])).stringof == "shared(inout(const(immutable(int)[])[])[])");
+
+/************************************/
+// 6939
+
+void test6939()
+{
+    shared    int* x;
+    immutable int* y;
+    const     int* z;
+    static assert( is(typeof(1?x:y) == shared(const(int))*));  // fail
+    static assert(!is(typeof(1?x:y) == const(int)*));          // fail
+    static assert(!is(typeof(1?x:z)));                         // fail
+
+    shared    int[] a;
+    immutable int[] b;
+    const     int[] c;
+    static assert( is(typeof(1?a:b) == shared(const(int))[])); // pass (ok)
+    static assert(!is(typeof(1?a:b) == const(int)[]));         // pass (ok)
+    static assert(!is(typeof(1?a:c)));                         // fail
+}
+
+/************************************/
+// 6940
+
+void test6940()
+{
+    immutable(int*)*    x;
+    int**               y;
+    static assert(is(typeof(x) : const(int*)*)); // ok
+    static assert(is(typeof(y) : const(int*)*)); // ok
+    static assert(is(typeof(1?x:y) == const(int*)*));
+
+    immutable(int[])[]  a;
+    int[][]             b;
+    static assert(is(typeof(a) : const(int[])[])); // ok
+    static assert(is(typeof(b) : const(int[])[])); // ok
+    static assert(is(typeof(1?a:b) == const(int[])[]));
+
+    immutable(int)**    v;
+    int**               w;
+    static assert(is(typeof(1?v:w) == const(int*)*));
+}
+
+/************************************/
+// 6982
+
+void test6982()
+{
+    alias int Bla;
+    immutable(Bla[string]) ifiles = ["a":1, "b":2, "c":3];
+    static assert(!__traits(compiles, { immutable(Bla)[string] files = ifiles; }));  // (1)
+    static assert(!__traits(compiles, { ifiles.remove ("a"); }));                    // (2)
+
+          immutable(int)[int]  maa;
+    const(immutable(int)[int]) caa;
+    immutable(      int [int]) iaa;
+    static assert(!__traits(compiles, { maa = iaa; }));
+    static assert(!__traits(compiles, { maa = caa; }));
+}
+
+/************************************/
+// 7038
+
+static assert(is(S7038 == const));
+const struct S7038{ int x; }
+static assert(is(S7038 == const));
+
+shared struct S7038b{ int x; }
+static assert(is(S7038b == shared));
+
+immutable struct S7038c{ int x; }
+static assert(is(S7038c == immutable));
+
+static assert(!is(C7038 == const));
+const class C7038{ int x; }
+static assert(!is(C7038 == const));
+
+void test7038()
+{
+    S7038 s;
+    static assert(is(typeof(s) == const));
+    static assert(is(typeof(s.x) == const int));
+
+    C7038 c;
+    static assert(!is(typeof(c) == const));
+    static assert(is(typeof(c.x) == const int));
+}
+
+/************************************/
+// 7105
+
+void copy(inout(int)** tgt, inout(int)* src){ *tgt = src; }
+
+void test7105()
+{
+    int* pm;
+    int m;
+    copy(&pm, &m);
+    assert(pm == &m);
+
+    const(int)* pc;
+    const(int) c;
+    copy(&pc, &c);
+    assert(pc == &c);
+
+    immutable(int)* pi;
+    immutable(int) i;
+    copy(&pi, &i);
+    assert(pi == &i);
+
+    static assert(!__traits(compiles, copy(&pm, &c)));
+    static assert(!__traits(compiles, copy(&pm, &i)));
+
+    copy(&pc, &m);
+    assert(pc == &m);
+    copy(&pc, &i);
+    assert(pc == &i);
+
+    static assert(!__traits(compiles, copy(&pi, &m)));
+    static assert(!__traits(compiles, copy(&pi, &c)));
+}
+
+/************************************/
+// 7202
+
+void test7202()
+{
+    void writeln(string s) @system { printf("%.*s\n", s.length, s.ptr); }
+    void delegate() @system x = { writeln("I am @system"); };
+    void delegate() @safe y = {  };
+    auto px = &x;
+    auto py = &y;
+    static assert(!__traits(compiles, px = py)); // accepts-invalid
+    *px = x;
+    y(); // "I am @system" -> no output, OK
+}
+
+/************************************/
+// 7554
+
+T outer7554(T)(immutable T function(T) pure foo) pure {
+    pure int inner() {
+        return foo(5);
+    }
+    return inner();
+}
+int sqr7554(int x) pure {
+    return x * x;
+}
+void test7554()
+{
+    assert(outer7554(&sqr7554) == 25);
+
+    immutable(int function(int) pure) ifp = &sqr7554;
+}
+
+/************************************/
+
+bool empty(T)(in T[] a)
+{
+    assert(is(T == shared(string)));
+    return false;
+}
+
+
+void test7518() {
+    shared string[] stuff;
+    stuff.empty();
+}
+
+/************************************/
+// 7669
+
+shared(inout U)[n] id7669(U, size_t n)( shared(inout U)[n] );
+void test7669()
+{
+    static assert(is(typeof( id7669((shared(int)[3]).init)) == shared(int)[3]));
+}
+
+/************************************/
+// 7757
+
+inout(int)      foo7757a(int x, lazy inout(int)      def) { return def; }
+inout(int)[]    foo7757b(int x, lazy inout(int)[]    def) { return def; }
+inout(int)[int] foo7757c(int x, lazy inout(int)[int] def) { return def; }
+
+inout(T)      bar7757a(T)(T x, lazy inout(T)    def) { return def; }
+inout(T)[]    bar7757b(T)(T x, lazy inout(T)[]  def) { return def; }
+inout(T)[T]   bar7757c(T)(T x, lazy inout(T)[T] def) { return def; }
+
+inout(Object) get7757(lazy inout(Object) defVal) { return null; }
+
+void test7757()
+{
+          int       mx1  = foo7757a(1,2);
+    const(int)      cx1  = foo7757a(1,2);
+          int []    ma1  = foo7757b(1,[2]);
+    const(int)[]    ca1  = foo7757b(1,[2]);
+          int [int] maa1 = foo7757c(1,[2:3]);
+    const(int)[int] caa1 = foo7757c(1,[2:3]);
+
+          int       mx2  = bar7757a(1,2);
+    const(int)      cx2  = bar7757a(1,2);
+          int []    ma2  = bar7757b(1,[2]);
+    const(int)[]    ca2  = bar7757b(1,[2]);
+          int [int] maa2 = bar7757c(1,[2:3]);
+    const(int)[int] caa2 = bar7757c(1,[2:3]);
+
+    Object defObj = null;
+    auto resObj = get7757(defObj);
+}
+
+/************************************/
+// 8098
+
+class Outer8098
+{
+    int i = 6;
+
+    class Inner
+    {
+        int y=0;
+
+        void foo() const
+        {
+            static assert(is(typeof(this.outer) == const(Outer8098)));
+            static assert(is(typeof(i) == const(int)));
+            static assert(!__traits(compiles, ++i));
+        }
+    }
+
+    Inner inner;
+
+    this()
+    {
+        inner = new Inner;
+    }
+}
+
+void test8098()
+{
+    const(Outer8098) x = new Outer8098();
+    static assert(is(typeof(x) == const(Outer8098)));
+    static assert(is(typeof(x.inner) == const(Outer8098.Inner)));
+}
+
+/************************************/
+// 8099
+
+void test8099()
+{
+    static class Outer
+    {
+        class Inner {}
+    }
+
+    auto m = new Outer;
+    auto c = new const(Outer);
+    auto i = new immutable(Outer);
+
+    auto mm = m.new Inner;            // m -> m  OK
+    auto mc = m.new const(Inner);     // m -> c  OK
+  static assert(!__traits(compiles, {
+    auto mi = m.new immutable(Inner); // m -> i  bad
+  }));
+
+  static assert(!__traits(compiles, {
+    auto cm = c.new Inner;            // c -> m  bad
+  }));
+    auto cc = c.new const(Inner);     // c -> c  OK
+  static assert(!__traits(compiles, {
+    auto ci = c.new immutable(Inner); // c -> i  bad
+  }));
+
+  static assert(!__traits(compiles, {
+    auto im = i.new Inner;            // i -> m  bad
+  }));
+    auto ic = i.new const(Inner);     // i -> c  OK
+    auto ii = i.new immutable(Inner); // i -> i  OK
+}
+
+/************************************/
+// 8201
+
+void test8201()
+{
+    uint[2] msa;
+    immutable uint[2] isa = msa;
+
+    ubyte[] buffer = [0, 1, 2, 3, 4, 5];
+    immutable ubyte[4] iArr = buffer[0 .. 4];
+}
+
+/************************************/
+// 8212
+
+struct S8212 { int x; }
+
+shared S8212 s8212;
+
+shared int x8212;
+
+void test8212()
+{
+   int y = x8212;
+   S8212 s2 = s8212;
+}
+
+/************************************/
+// 8366
+
+class B8366
+{
+    bool foo(in Object o) const { return true; }
+}
+
+class C8366a : B8366
+{
+    bool foo(in Object o)              { return true; }
+  override
+    bool foo(in Object o) const        { return false; }
+    bool foo(in Object o) immutable    { return true; }
+    bool foo(in Object o) shared       { return true; }
+    bool foo(in Object o) shared const { return true; }
+}
+
+class C8366b : B8366
+{
+    bool foo(in Object o)              { return false; }
+    alias super.foo foo;
+    bool foo(in Object o) immutable    { return false; }
+    bool foo(in Object o) shared       { return false; }
+    bool foo(in Object o) shared const { return false; }
+}
+
+void test8366()
+{
+    {
+              C8366a mca = new C8366a();
+        const C8366a cca = new C8366a();
+              B8366  mb  = mca;
+        const B8366  cb  = cca;
+        assert(mca.foo(null) == true);
+        assert(cca.foo(null) == false);
+        assert(mb .foo(null) == false);
+        assert(cb .foo(null) == false);
+    }
+    {
+              C8366b mcb = new C8366b();
+        const C8366b ccb = new C8366b();
+              B8366  mb  = mcb;
+        const B8366  cb  = ccb;
+        assert(mcb.foo(null) == false);
+        assert(ccb.foo(null) == true);
+        assert(mb .foo(null) == true);
+        assert(cb .foo(null) == true);
+    }
+}
+
+/************************************/
+// 8408
+
+template hasMutableIndirection8408(T)
+{
+    template Unqual(T)
+    {
+             static if (is(T U == shared(const U))) alias U Unqual;
+        else static if (is(T U ==        const U )) alias U Unqual;
+        else static if (is(T U ==    immutable U )) alias U Unqual;
+        else static if (is(T U ==        inout U )) alias U Unqual;
+        else static if (is(T U ==       shared U )) alias U Unqual;
+        else                                        alias T Unqual;
+    }
+
+    enum hasMutableIndirection8408 = !is(typeof({ Unqual!T t = void; immutable T u = t; }));
+}
+static assert(!hasMutableIndirection8408!(int));
+static assert(!hasMutableIndirection8408!(int[3]));
+static assert( hasMutableIndirection8408!(Object));
+
+auto dup8408(E)(inout(E)[] arr) pure @trusted
+{
+    static if (hasMutableIndirection8408!E)
+    {
+        auto copy = new E[](arr.length);
+        copy[] = cast(E[])arr[];        // assume constant
+        return cast(inout(E)[])copy;    // assume constant
+    }
+    else
+    {
+        auto copy = new E[](arr.length);
+        copy[] = arr[];
+        return copy;
+    }
+}
+
+void test8408()
+{
+    void test(E, bool constConv)()
+    {
+                  E[] marr = [E.init, E.init, E.init];
+        immutable E[] iarr = [E.init, E.init, E.init];
+
+                  E[] m2m = marr.dup8408();    assert(m2m == marr);
+        immutable E[] i2i = iarr.dup8408();    assert(i2i == iarr);
+
+      static if (constConv)
+      { // If dup() hss strong purity, implicit conversion is allowed
+        immutable E[] m2i = marr.dup8408();    assert(m2i == marr);
+                  E[] i2m = iarr.dup8408();    assert(i2m == iarr);
+      }
+      else
+      {
+        static assert(!is(typeof({ immutable E[] m2i = marr.dup8408(); })));
+        static assert(!is(typeof({           E[] i2m = iarr.dup8408(); })));
+      }
+    }
+
+    class C {}
+    struct S1 { long n; }
+    struct S2 { int* p; }
+    struct T1 { S1 s; }
+    struct T2 { S2 s; }
+    struct T3 { S1 s1;  S2 s2; }
+
+    test!(int   , true )();
+    test!(int[3], true )();
+    test!(C     , false)();
+    test!(S1    , true )();
+    test!(S2    , false)();
+    test!(T1    , true )();
+    test!(T2    , false)();
+    test!(T3    , false)();
+}
+
+/************************************/
+// 8688
+
+void test8688()
+{
+    alias TypeTuple!(int) T;
+    foreach (i; TypeTuple!(0))
+    {
+        alias const(T[i]) X;
+        static assert(!is(X == int));           // fails
+        static assert( is(X == const(int)));    // fails
+    }
+}
+
+/************************************/
+// 10946 (regression by fixing bug 8688, from 2.061)
+
+enum xlen10946 = 4;
+alias immutable(char)[xlen10946] e3;
+alias immutable(char[xlen10946]) e4; // NG -> OK
+immutable vlen10946 = 4;
+alias immutable(char)[vlen10946] i3;
+alias immutable(char[vlen10946]) i4; // NG -> OK
+
+/************************************/
+// 9046
+
+void test9046()
+{
+    foreach (T; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong, char, wchar, dchar,
+                           float, double, real, ifloat, idouble, ireal, cfloat, cdouble, creal))
+    foreach (U; TypeTuple!(T, const T, immutable T, shared T, shared const T, inout T, shared inout T))
+    {
+        static assert(is(typeof(U.init) == U));
+    }
+
+    foreach (T; TypeTuple!(int[], const(char)[], immutable(string[]), shared(const(int)[])[],
+                           int[1], const(char)[1], immutable(string[1]), shared(const(int)[1])[],
+                           int[int], const(char)[long], immutable(string[string]), shared(const(int)[double])[]))
+    foreach (U; TypeTuple!(T, const T, immutable T, shared T, shared const T, inout T, shared inout T))
+    {
+        static assert(is(typeof(U.init) == U));
+    }
+
+    int i;
+    enum E { x, y }
+    static struct S {}
+    static class  C {}
+    struct NS { void f(){ i++; } }
+    class  NC { void f(){ i++; } }
+    foreach (T; TypeTuple!(E, S, C, NS, NC))
+    foreach (U; TypeTuple!(T, const T, immutable T, shared T, shared const T, inout T, shared inout T))
+    {
+        static assert(is(typeof(U.init) == U));
+    }
+
+    alias TL = TypeTuple!(int, string, int[int]);
+    foreach (U; TypeTuple!(TL, const TL, immutable TL, shared TL, shared const TL, inout TL, shared inout TL))
+    {
+        static assert(is(typeof(U.init) == U));
+    }
+}
+
+/************************************/
+// 9090
+
+void test9090()
+{
+    void test1(T)(auto ref const T[] val) {}
+
+    string a;
+    test1(a);
+}
+
+/************************************/
+// 9461
+
+void test9461()
+{
+    class A {}
+    class B : A {}
+
+    void conv(S, T)(ref S x) { T y = x; }
+
+    // should be NG
+    static assert(!__traits(compiles, conv!(inout(B)[],     inout(A)[])));
+    static assert(!__traits(compiles, conv!(int[inout(B)],  int[inout(A)])));
+    static assert(!__traits(compiles, conv!(inout(B)[int],  inout(A)[int])));
+    static assert(!__traits(compiles, conv!(inout(B)*,      inout(A)*)));
+    static assert(!__traits(compiles, conv!(inout(B)[1],    inout(A)[])));
+
+    // should be OK
+    static assert( __traits(compiles, conv!(inout(B),       inout(A))));
+}
+
+/************************************/
+
+struct S9209 { int x; }
+
+void bar9209(const S9209*) {}
+
+void test9209() {
+    const f = new S9209(1);
+    bar9209(f);
+}
+
+/************************************/
+// 10758
+
+struct X10758
+{
+static:
+        inout(int)   screwUpVal(ref inout(int) wx) { return wx; }
+    ref inout(int)   screwUpRef(ref inout(int) wx) { return wx; }
+        inout(int)*  screwUpPtr(ref inout(int) wx) { return &wx; }
+        inout(int)[] screwUpArr(ref inout(int) wx) { return (&wx)[0 .. 1]; }
+}
+
+struct S10758
+{
+    int x;
+        inout(int)   screwUpVal(ref inout(int) _) inout { return x; }
+    ref inout(int)   screwUpRef(ref inout(int) _) inout { return x; }
+        inout(int)*  screwUpPtr(ref inout(int) _) inout { return &x; }
+        inout(int)[] screwUpArr(ref inout(int) _) inout { return (&x)[0 .. 1]; }
+}
+
+void test10758(ref inout(int) wx, inout(int)* wp, inout(int)[] wa, inout(S10758) ws)
+{
+        inout(int)   screwUpVal(inout(int) _) { return wx; }
+    ref inout(int)   screwUpRef(inout(int) _) { return wx; }
+        inout(int)*  screwUpPtr(inout(int) _) { return &wx; }
+        inout(int)[] screwUpArr(inout(int) _) { return (&wx)[0 .. 1]; }
+
+    struct NS
+    {
+            inout(int)   screwUpVal() inout { return wx; }
+        ref inout(int)   screwUpRef() inout { return wx; }
+            inout(int)*  screwUpPtr() inout { return &wx; }
+            inout(int)[] screwUpArr() inout { return (&wx)[0 .. 1]; }
+    }
+
+              int  mx = 1;
+        const(int) cx = 1;
+    immutable(int) ix = 1;
+
+    // nested inout function may return an inout reference of the context,
+    // so substitude inout to mutable or immutable should be disallowed.
+    {
+        // value return does not leak any inout reference, so safe.
+        screwUpVal(mx);
+        screwUpVal(ix);
+        screwUpVal(wx);
+        screwUpVal(cx);
+
+        static assert(!__traits(compiles, screwUpRef(mx)));
+        static assert(!__traits(compiles, screwUpRef(ix)));
+        screwUpRef(wx);
+        screwUpRef(cx);
+
+        static assert(!__traits(compiles, screwUpPtr(mx)));
+        static assert(!__traits(compiles, screwUpPtr(ix)));
+        screwUpPtr(wx);
+        screwUpPtr(cx);
+
+        static assert(!__traits(compiles, screwUpArr(mx)));
+        static assert(!__traits(compiles, screwUpArr(ix)));
+        screwUpArr(cx);
+        screwUpArr(wx);
+    }
+
+    // inout method of the nested struct may return an inout reference of the context,
+    {
+        (          NS()).screwUpVal();
+        (immutable NS()).screwUpVal();
+        (    inout NS()).screwUpVal();
+        (    const NS()).screwUpVal();
+
+        static assert(!__traits(compiles, (          NS()).screwUpRef()));
+        static assert(!__traits(compiles, (immutable NS()).screwUpRef()));
+        (inout NS()).screwUpRef();
+        (const NS()).screwUpRef();
+
+        static assert(!__traits(compiles, (          NS()).screwUpPtr()));
+        static assert(!__traits(compiles, (immutable NS()).screwUpPtr()));
+        (inout NS()).screwUpPtr();
+        (const NS()).screwUpPtr();
+
+        static assert(!__traits(compiles, (          NS()).screwUpArr()));
+        static assert(!__traits(compiles, (immutable NS()).screwUpArr()));
+        (inout NS()).screwUpArr();
+        (const NS()).screwUpArr();
+    }
+
+    // function pointer holds no context, so there's no screw up.
+    {
+        auto fp_screwUpVal = &X10758.screwUpVal;
+        fp_screwUpVal(mx);
+        fp_screwUpVal(ix);
+        fp_screwUpVal(wx);
+        fp_screwUpVal(cx);
+
+        auto fp_screwUpRef = &X10758.screwUpRef;
+        fp_screwUpRef(mx);
+        fp_screwUpRef(ix);
+        fp_screwUpRef(wx);
+        fp_screwUpRef(cx);
+
+        auto fp_screwUpPtr = &X10758.screwUpVal;
+        fp_screwUpPtr(mx);
+        fp_screwUpPtr(ix);
+        fp_screwUpPtr(wx);
+        fp_screwUpPtr(cx);
+
+        auto fp_screwUpArr = &X10758.screwUpVal;
+        fp_screwUpArr(mx);
+        fp_screwUpArr(ix);
+        fp_screwUpArr(wx);
+        fp_screwUpArr(cx);
+    }
+
+    // inout delegate behaves same as nested functions.
+    {
+        auto dg_screwUpVal = &ws.screwUpVal;
+        dg_screwUpVal(mx);
+        dg_screwUpVal(ix);
+        dg_screwUpVal(wx);
+        dg_screwUpVal(cx);
+
+        auto dg_screwUpRef = &ws.screwUpRef;
+        static assert(!__traits(compiles, dg_screwUpRef(mx)));
+        static assert(!__traits(compiles, dg_screwUpRef(ix)));
+        dg_screwUpRef(wx);
+        dg_screwUpRef(cx);
+
+        auto dg_screwUpPtr = &ws.screwUpPtr;
+        static assert(!__traits(compiles, dg_screwUpPtr(mx)));
+        static assert(!__traits(compiles, dg_screwUpPtr(ix)));
+        dg_screwUpPtr(wx);
+        dg_screwUpPtr(cx);
+
+        auto dg_screwUpArr = &ws.screwUpArr;
+        static assert(!__traits(compiles, dg_screwUpArr(mx)));
+        static assert(!__traits(compiles, dg_screwUpArr(ix)));
+        dg_screwUpArr(cx);
+        dg_screwUpArr(wx);
+    }
+}
+
+/************************************/
+// 10761
+
+inout(int)* function(inout(int)*) fptr10761(inout(int)*)
+{
+    static inout(int)* screwUp(inout(int)* x) { return x; }
+    auto fp = &screwUp;
+    static assert(is(typeof(fp) == inout(int)* function(inout(int)*) pure nothrow @nogc @safe));
+    return fp;
+}
+
+inout(int)* delegate(inout(int)*) nest10761(inout(int)* x)
+{
+    inout(int)* screwUp(inout(int)* _) { return x; }
+    auto dg = &screwUp;
+    static assert(is(typeof(dg) == inout(int)* delegate(inout(int)*) pure nothrow @nogc @safe));
+    return dg;
+}
+
+struct S10761
+{
+    int x;
+    inout(int)* screwUp() inout { return &x; }
+}
+
+inout(int)* delegate() inout memfn10761(inout(int)* x)
+{
+    auto s = new inout S10761(1);
+    auto dg = &s.screwUp;
+    static assert(is(typeof(dg) == inout(int)* delegate() inout));
+    return dg;
+}
+
+void test10761()
+{
+              int  mx = 1;
+        const(int) cx = 1;
+    immutable(int) ix = 1;
+
+    // inout substitution has no effect on function pointer type
+    {
+        auto fp_m = fptr10761(&mx);
+        auto fp_c = fptr10761(&cx);
+        auto fp_i = fptr10761(&ix);
+        alias FP = inout(int)* function(inout(int)*);
+        static assert(is(typeof(fp_m) == FP));
+        static assert(is(typeof(fp_c) == FP));
+        static assert(is(typeof(fp_i) == FP));
+    }
+
+    // inout substitution on delegate type should always
+    // modify inout to const.
+    {
+        auto dg_m = nest10761(&mx);
+        auto dg_c = nest10761(&cx);
+        auto dg_i = nest10761(&ix);
+        alias DG = const(int)* delegate(const(int)*);
+        static assert(is(typeof(dg_m) == DG));
+        static assert(is(typeof(dg_c) == DG));
+        static assert(is(typeof(dg_i) == DG));
+    }
+
+    // same as above
+    {
+        auto dg_m = memfn10761(&mx);
+        auto dg_c = memfn10761(&cx);
+        auto dg_i = memfn10761(&ix);
+        alias DG = const(int)* delegate() const;
+        static assert(is(typeof(dg_m) == DG));
+        static assert(is(typeof(dg_c) == DG));
+        static assert(is(typeof(dg_i) == DG));
+    }
+}
+
+/************************************/
+// 11226
+
+void test11226()
+{
+    typeof(null) m;
+    const typeof(null) c = m;
+    immutable typeof(null) i = m;
+
+    m = m, m = c, m = i;
+    assert(m == c);
+    assert(m == i);
+    assert(c == i);
+    static assert(is(typeof(true ? m : m) ==           typeof(null)));
+    static assert(is(typeof(true ? m : c) ==     const typeof(null)));
+    static assert(is(typeof(true ? m : i) ==     const typeof(null)));
+    static assert(is(typeof(true ? c : m) ==     const typeof(null)));
+    static assert(is(typeof(true ? c : c) ==     const typeof(null)));
+    static assert(is(typeof(true ? c : i) ==     const typeof(null)));
+    static assert(is(typeof(true ? i : m) ==     const typeof(null)));
+    static assert(is(typeof(true ? i : c) ==     const typeof(null)));
+    static assert(is(typeof(true ? i : i) == immutable typeof(null)));
+
+    static assert(typeof(m).stringof ==           "typeof(null)" );
+    static assert(typeof(c).stringof ==     "const(typeof(null))");
+    static assert(typeof(i).stringof == "immutable(typeof(null))");
+}
+
+/************************************/
+// 11257
+
+struct R11257
+{
+    union
+    {
+        const(Object) original;
+        Object stripped;
+    }
+}
+void test11257()
+{
+    const(R11257) cr;
+    R11257 mr = cr;  // Error: cannot implicitly convert expression (cr) of type const(R) to R
+}
+
+/************************************/
+// 11215
+
+shared(inout(void)**) f11215(inout int);
+
+static assert(is(typeof(f11215(0)) == shared(void**)));
+static assert(is(typeof(f11215((const int).init)) == shared(const(void)**)));
+
+/************************************/
+// 11489
+
+void test11489(inout int = 0)
+{
+    static class B {}
+    static class D : B {}
+
+                 D [] dm;
+           const(D)[] dc;
+           inout(D)[] dw;
+          shared(D)[] dsm;
+    shared(const D)[] dsc;
+    shared(inout D)[] dsw;
+       immutable(D)[] di;
+
+    static assert(!__traits(compiles, {              B [] b = dm; }));
+    static assert( __traits(compiles, {        const(B)[] b = dm; }));
+    static assert(!__traits(compiles, {        inout(B)[] b = dm; }));
+    static assert(!__traits(compiles, {       shared(B)[] b = dm; }));
+    static assert(!__traits(compiles, { shared(const B)[] b = dm; }));
+    static assert(!__traits(compiles, { shared(inout B)[] b = dm; }));
+    static assert(!__traits(compiles, {    immutable(B)[] b = dm; }));
+
+    static assert(!__traits(compiles, {              B [] b = dc; }));
+    static assert( __traits(compiles, {        const(B)[] b = dc; }));
+    static assert(!__traits(compiles, {        inout(B)[] b = dc; }));
+    static assert(!__traits(compiles, {       shared(B)[] b = dc; }));
+    static assert(!__traits(compiles, { shared(const B)[] b = dc; }));
+    static assert(!__traits(compiles, { shared(inout B)[] b = dc; }));
+    static assert(!__traits(compiles, {    immutable(B)[] b = dc; }));
+
+    static assert(!__traits(compiles, {              B [] b = dw; }));
+    static assert( __traits(compiles, {        const(B)[] b = dw; }));
+    static assert(!__traits(compiles, {        inout(B)[] b = dw; }));
+    static assert(!__traits(compiles, {       shared(B)[] b = dw; }));
+    static assert(!__traits(compiles, { shared(const B)[] b = dw; }));
+    static assert(!__traits(compiles, { shared(inout B)[] b = dw; }));
+    static assert(!__traits(compiles, {    immutable(B)[] b = dw; }));
+
+    static assert(!__traits(compiles, {              B [] b = dsm; }));
+    static assert(!__traits(compiles, {        const(B)[] b = dsm; }));
+    static assert(!__traits(compiles, {        inout(B)[] b = dsm; }));
+    static assert(!__traits(compiles, {       shared(B)[] b = dsm; }));
+    static assert( __traits(compiles, { shared(const B)[] b = dsm; }));
+    static assert(!__traits(compiles, { shared(inout B)[] b = dsm; }));
+    static assert(!__traits(compiles, {    immutable(B)[] b = dsm; }));
+
+    static assert(!__traits(compiles, {              B [] b = dsc; }));
+    static assert(!__traits(compiles, {        const(B)[] b = dsc; }));
+    static assert(!__traits(compiles, {        inout(B)[] b = dsc; }));
+    static assert(!__traits(compiles, {       shared(B)[] b = dsc; }));
+    static assert( __traits(compiles, { shared(const B)[] b = dsc; }));
+    static assert(!__traits(compiles, { shared(inout B)[] b = dsc; }));
+    static assert(!__traits(compiles, {    immutable(B)[] b = dsc; }));
+
+    static assert(!__traits(compiles, {              B [] b = dsw; }));
+    static assert(!__traits(compiles, {        const(B)[] b = dsw; }));
+    static assert(!__traits(compiles, {        inout(B)[] b = dsw; }));
+    static assert(!__traits(compiles, {       shared(B)[] b = dsw; }));
+    static assert( __traits(compiles, { shared(const B)[] b = dsw; }));
+    static assert(!__traits(compiles, { shared(inout B)[] b = dsw; }));
+    static assert(!__traits(compiles, {    immutable(B)[] b = dsw; }));
+
+    static assert(!__traits(compiles, {              B [] b = di; }));
+    static assert( __traits(compiles, {        const(B)[] b = di; }));
+    static assert(!__traits(compiles, {        inout(B)[] b = di; }));
+    static assert(!__traits(compiles, {       shared(B)[] b = di; }));
+    static assert( __traits(compiles, { shared(const B)[] b = di; }));
+    static assert(!__traits(compiles, { shared(inout B)[] b = di; }));
+    static assert( __traits(compiles, {    immutable(B)[] b = di; }));
+}
+
+/************************************/
+// 11768
+
+void test11768(inout int = 0)
+{
+    const(inout(char)) k1;
+    inout(const(char)) k2;
+    static assert(typeof(k1).stringof == "inout(const(char))"); // OK
+    static assert(typeof(k2).stringof == "inout(const(char))"); // fails
+    static assert(is(typeof(k1) == typeof(k2)));                // fails
+}
+
+/************************************/
+// 12403
+
+void test12403()
+{
+    void func(K, V)(inout(V[K]) aa)
+    {
+        static assert(is(V == const int));
+        static assert(is(K == int));
+    }
+
+    const(int)[int] m;
+    func(m);
+}
+
+/************************************/
+// 13011
+
+void test13011()
+{
+    static size_t hashOf(int delegate() inout val)
+    {
+        return 0;
+    }
+
+    int delegate() inout dg;
+    auto h = hashOf(dg);
+}
+
+/************************************/
+// 13030
+
+void va13030(Args...)(const Args args) {}
+
+void func13030(int delegate(int n) a)
+{
+    va13030(a);
+}
+
+/************************************/
+// 13802 & 13803
+
+static assert((              string     ).stringof ==               "string"       );
+static assert((              string[]   ).stringof ==               "string[]"     );
+static assert((              string[1]  ).stringof ==               "string[1]"    );
+static assert((              string[int]).stringof ==               "string[int]"  );
+static assert((       const  string     ).stringof ==         "const(string)"      );
+static assert((       const  string[]   ).stringof ==         "const(string[])"    );
+static assert((       const  string[1]  ).stringof ==         "const(string[1])"   );
+static assert((       const  string[int]).stringof ==         "const(string[int])" );
+static assert((shared        string     ).stringof ==        "shared(string)"      );
+static assert((shared        string[]   ).stringof ==        "shared(string[])"    );
+static assert((shared        string[1]  ).stringof ==        "shared(string[1])"   );
+static assert((shared        string[int]).stringof ==        "shared(string[int])" );
+static assert((shared const  string     ).stringof ==  "shared(const(string))"     );
+static assert((shared const  string[]   ).stringof ==  "shared(const(string[]))"   );
+static assert((shared const  string[1]  ).stringof ==  "shared(const(string[1]))"  );
+static assert((shared const  string[int]).stringof ==  "shared(const(string[int]))");
+static assert((   immutable  string     ).stringof ==     "immutable(string)"      );
+static assert((   immutable  string[]   ).stringof ==     "immutable(string[])"    );
+static assert((   immutable  string[1]  ).stringof ==     "immutable(string[1])"   );
+static assert((   immutable  string[int]).stringof ==     "immutable(string[int])" );
+
+static assert((             wstring     ).stringof ==              "wstring"       );
+static assert((             wstring[]   ).stringof ==              "wstring[]"     );
+static assert((             wstring[1]  ).stringof ==              "wstring[1]"    );
+static assert((             wstring[int]).stringof ==              "wstring[int]"  );
+static assert((       const wstring     ).stringof ==        "const(wstring)"      );
+static assert((       const wstring[]   ).stringof ==        "const(wstring[])"    );
+static assert((       const wstring[1]  ).stringof ==        "const(wstring[1])"   );
+static assert((       const wstring[int]).stringof ==        "const(wstring[int])" );
+static assert((shared       wstring     ).stringof ==       "shared(wstring)"      );
+static assert((shared       wstring[]   ).stringof ==       "shared(wstring[])"    );
+static assert((shared       wstring[1]  ).stringof ==       "shared(wstring[1])"   );
+static assert((shared       wstring[int]).stringof ==       "shared(wstring[int])" );
+static assert((shared const wstring     ).stringof == "shared(const(wstring))"     );
+static assert((shared const wstring[]   ).stringof == "shared(const(wstring[]))"   );
+static assert((shared const wstring[1]  ).stringof == "shared(const(wstring[1]))"  );
+static assert((shared const wstring[int]).stringof == "shared(const(wstring[int]))");
+static assert((   immutable wstring     ).stringof ==    "immutable(wstring)"      );
+static assert((   immutable wstring[]   ).stringof ==    "immutable(wstring[])"    );
+static assert((   immutable wstring[1]  ).stringof ==    "immutable(wstring[1])"   );
+static assert((   immutable wstring[int]).stringof ==    "immutable(wstring[int])" );
+
+static assert((             dstring     ).stringof ==              "dstring"       );
+static assert((             dstring[]   ).stringof ==              "dstring[]"     );
+static assert((             dstring[1]  ).stringof ==              "dstring[1]"    );
+static assert((             dstring[int]).stringof ==              "dstring[int]"  );
+static assert((       const dstring     ).stringof ==        "const(dstring)"      );
+static assert((       const dstring[]   ).stringof ==        "const(dstring[])"    );
+static assert((       const dstring[1]  ).stringof ==        "const(dstring[1])"   );
+static assert((       const dstring[int]).stringof ==        "const(dstring[int])" );
+static assert((shared       dstring     ).stringof ==       "shared(dstring)"      );
+static assert((shared       dstring[]   ).stringof ==       "shared(dstring[])"    );
+static assert((shared       dstring[1]  ).stringof ==       "shared(dstring[1])"   );
+static assert((shared       dstring[int]).stringof ==       "shared(dstring[int])" );
+static assert((shared const dstring     ).stringof == "shared(const(dstring))"     );
+static assert((shared const dstring[]   ).stringof == "shared(const(dstring[]))"   );
+static assert((shared const dstring[1]  ).stringof == "shared(const(dstring[1]))"  );
+static assert((shared const dstring[int]).stringof == "shared(const(dstring[int]))");
+static assert((   immutable dstring     ).stringof ==    "immutable(dstring)"      );
+static assert((   immutable dstring[]   ).stringof ==    "immutable(dstring[])"    );
+static assert((   immutable dstring[1]  ).stringof ==    "immutable(dstring[1])"   );
+static assert((   immutable dstring[int]).stringof ==    "immutable(dstring[int])" );
+
+/************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test56();
+    test57();
+    test58();
+    test59();
+    test60();
+    test61();
+    test62();
+    test63();
+    test64();
+    test65();
+    test66();
+    test68();
+    test69();
+    test70();
+    test72();
+    test73();
+    test74();
+    test75();
+    test76();
+    test77();
+    test78();
+    test79();
+    test80();
+    test81();
+    test82();
+    test83();
+    test84();
+    test85();
+    test87();
+    test4968();
+    test3748();
+    test1961a();
+    test1961b();
+    test1961c();
+    test88();
+    test4251a();
+    test4251b();
+    test5473();
+    test5493();
+    test5493inout();
+    test6782();
+    test6864();
+    test6865();
+    test6866();
+    test6870();
+    test6912();
+    test6930a();
+    test6930b();
+    test11868();
+    test6939();
+    test6940();
+    test6982();
+    test7038();
+    test7105();
+    test7202();
+    test7554();
+    test7518();
+    test7669();
+    test7757();
+    test8098();
+    test8099();
+    test8201();
+    test8212();
+    test8366();
+    test8408();
+    test8688();
+    test9046();
+    test9090();
+    test9461();
+    test9209();
+    test11226();
+    test11768();
+    test13011();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testconstsection.d b/gcc/testsuite/gdc.test/runnable/testconstsection.d
new file mode 100644
index 00000000000..54a80abb431
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testconstsection.d
@@ -0,0 +1,61 @@
+
+string tls_var = "tls_string";
+
+__gshared string data_var = "data_string";
+
+__gshared string bss_var;
+
+struct Range
+{
+    const(void)* bot;
+    const(void)* top; // consider inclusive
+
+    void addPtr(const(void)* p)
+    {
+        if (!bot || p < bot)
+            bot = p;
+        if (!top || p > top)
+            top = p;
+    }
+
+    bool intersect(Range other)
+    {
+        return (bot <= other.top && top >= other.bot);
+    }
+}
+
+void testStrings()
+{
+    // check that the strings don't overlap with the variables
+    Range tls;
+    Range data;
+    Range bss;
+    Range cdata;
+
+    static string local_tls_var = "tls_string";
+    static __gshared string local_data_var = "data_string";
+    static __gshared string local_bss_var;
+
+    tls.addPtr(&tls_var);
+    tls.addPtr(&local_tls_var);
+
+    data.addPtr(&data_var);
+    data.addPtr(&local_data_var);
+
+    bss.addPtr(&bss_var);
+    bss.addPtr(&local_bss_var);
+
+    cdata.addPtr(tls_var.ptr);
+    cdata.addPtr(local_tls_var.ptr);
+    cdata.addPtr(data_var.ptr);
+    cdata.addPtr(local_data_var.ptr);
+
+    assert(!cdata.intersect(tls),  "overlap with tls");
+    assert(!cdata.intersect(data), "overlap with data");
+    assert(!cdata.intersect(bss),  "overlap with bss");
+}
+
+void main()
+{
+    testStrings();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testcontracts.d b/gcc/testsuite/gdc.test/runnable/testcontracts.d
new file mode 100644
index 00000000000..23a02253525
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testcontracts.d
@@ -0,0 +1,933 @@
+// PERMUTE_ARGS: -inline -g -O
+
+extern(C) int printf(const char*, ...);
+
+/*******************************************/
+
+class A
+{
+    int x = 7;
+
+    int foo(int i)
+    in
+    {
+        printf("A.foo.in %d\n", i);
+        assert(i == 2);
+        assert(x == 7);
+        printf("A.foo.in pass\n");
+    }
+    out (result)
+    {
+        assert(result & 1);
+        assert(x == 7);
+    }
+    body
+    {
+        return i;
+    }
+}
+
+class B : A
+{
+    override int foo(int i)
+    in
+    {
+        float f;
+        printf("B.foo.in %d\n", i);
+        assert(i == 4);
+        assert(x == 7);
+        f = f + i;
+    }
+    out (result)
+    {
+        assert(result < 8);
+        assert(x == 7);
+    }
+    body
+    {
+        return i - 1;
+    }
+}
+
+void test1()
+{
+    auto b = new B();
+    b.foo(2);
+    b.foo(4);
+}
+
+/*******************************************/
+
+class A2
+{
+    int x = 7;
+
+    int foo(int i)
+    in
+    {
+        printf("A2.foo.in %d\n", i);
+        assert(i == 2);
+        assert(x == 7);
+        printf("A2.foo.in pass\n");
+    }
+    out (result)
+    {
+        assert(result & 1);
+        assert(x == 7);
+    }
+    body
+    {
+        return i;
+    }
+}
+
+class B2 : A2
+{
+    override int foo(int i)
+    in
+    {
+        float f;
+        printf("B2.foo.in %d\n", i);
+        assert(i == 4);
+        assert(x == 7);
+        f = f + i;
+    }
+    out (result)
+    {
+        assert(result < 8);
+        assert(x == 7);
+    }
+    body
+    {
+        return i - 1;
+    }
+}
+
+class C : B2
+{
+    override int foo(int i)
+    in
+    {
+        float f;
+        printf("C.foo.in %d\n", i);
+        assert(i == 6);
+        assert(x == 7);
+        f = f + i;
+    }
+    out (result)
+    {
+        assert(result == 1 || result == 3 || result == 5);
+        assert(x == 7);
+    }
+    body
+    {
+        return i - 1;
+    }
+}
+
+void test2()
+{
+    auto c = new C();
+    c.foo(2);
+    c.foo(4);
+    c.foo(6);
+}
+
+/*******************************************/
+
+void fun(int x)
+in {
+    if (x < 0) throw new Exception("a");
+}
+body {
+}
+
+void test3()
+{
+    fun(1);
+}
+
+/*******************************************/
+
+interface Stack {
+    int pop()
+//   in { printf("pop.in\n"); }
+    out(result) {
+        printf("pop.out\n");
+        assert(result == 3);
+    }
+}
+
+class CC : Stack
+{
+    int pop()
+    //out (result) { printf("CC.pop.out\n"); } body
+    {
+        printf("CC.pop.in\n");
+        return 3;
+    }
+}
+
+void test4()
+{
+    auto cc = new CC();
+    cc.pop();
+}
+
+/*******************************************/
+
+int mul100(int n)
+out(result)
+{
+    assert(result == 500);
+}
+body
+{
+    return n * 100;
+}
+
+void test5()
+{
+    mul100(5);
+}
+
+/*******************************************/
+// 3273
+
+// original case
+struct Bug3273
+{
+    ~this() {}
+    invariant() {}
+}
+
+// simplest case
+ref int func3273()
+out(r)
+{
+    // Regression check of issue 3390
+    static assert(!__traits(compiles, r = 1));
+}
+body
+{
+    static int dummy;
+    return dummy;
+}
+
+void test6()
+{
+    func3273() = 1;
+    assert(func3273() == 1);
+}
+
+/*******************************************/
+
+/+
+// http://d.puremagic.com/issues/show_bug.cgi?id=3722
+
+class Bug3722A
+{
+    void fun() {}
+}
+class Bug3722B : Bug3722A
+{
+    override void fun() in { assert(false); } body {}
+}
+
+void test6()
+{
+    auto x = new Bug3722B();
+    x.fun();
+}
++/
+
+/*******************************************/
+
+auto test7foo()
+in{
+    ++cnt;
+}body{
+    ++cnt;
+    return "str";
+}
+
+void test7()
+{
+    cnt = 0;
+    assert(test7foo() == "str");
+    assert(cnt == 2);
+}
+
+/*******************************************/
+
+auto foo8()
+out(r){
+    ++cnt;
+    assert(r == 10);
+}body{
+    ++cnt;
+    return 10;
+}
+
+auto bar8()
+out{
+    ++cnt;
+}body{
+    ++cnt;
+}
+
+void test8()
+{
+    cnt = 0;
+    assert(foo8() == 10);
+    assert(cnt == 2);
+
+    cnt = 0;
+    bar8();
+    assert(cnt == 2);
+}
+
+/*******************************************/
+// from fail317
+
+void test9()
+{
+    auto f1 = function() body { }; // fine
+    auto f2 = function() in { } body { }; // fine
+    auto f3 = function() out { } body { }; // error
+    auto f4 = function() in { } out { } body { }; // error
+
+    auto d1 = delegate() body { }; // fine
+    auto d2 = delegate() in { } body { }; // fine
+    auto d3 = delegate() out { } body { }; // error
+    auto d4 = delegate() in { } out { } body { }; // error
+}
+
+/*******************************************/
+// 4785
+
+int cnt;
+
+auto foo4785()
+in{
+    int r;
+    ++cnt;
+}
+out(r){
+    assert(r == 10);
+    ++cnt;
+}body{
+    ++cnt;
+    int r = 10;
+    return r;
+}
+void test4785()
+{
+    cnt = 0;
+    assert(foo4785() == 10);
+    assert(cnt == 3);
+}
+
+/*******************************************/
+// 5039
+
+class C5039 {
+    int x;
+
+    invariant() {
+        assert( x < int.max );
+    }
+
+    auto foo() {
+        return x;
+    }
+}
+
+/*******************************************/
+// 5204
+
+interface IFoo5204
+{
+    IFoo5204 bar()
+    out {}
+}
+class Foo5204 : IFoo5204
+{
+    Foo5204 bar() { return null; }
+}
+
+/*******************************************/
+// 6417
+
+class Bug6417
+{
+    void bar()
+    in
+    {
+        int i = 14;
+        assert(i == 14);
+        auto dg = (){
+            //printf("in: i = %d\n", i);
+            assert(i == 14, "in contract failure");
+        };
+        dg();
+    }
+    out
+    {
+        int j = 10;
+        assert(j == 10);
+        auto dg = (){
+            //printf("out: j = %d\n", j);
+            assert(j == 10, "out contract failure");
+        };
+        dg();
+    }
+    body {}
+}
+
+void test6417()
+{
+    (new Bug6417).bar();
+}
+
+/*******************************************/
+// 7218
+
+void test7218()
+{
+    size_t foo()  in{}  out{}  body{ return 0; } // OK
+    size_t bar()  in{}/*out{}*/body{ return 0; } // OK
+    size_t hoo()/*in{}*/out{}  body{ return 0; } // NG1
+    size_t baz()/*in{}  out{}*/body{ return 0; } // NG2
+}
+
+/*******************************************/
+// 7699
+
+class P7699
+{
+    void f(int n) in {
+        assert (n);
+    } body { }
+}
+class D7699 : P7699
+{
+    override void f(int n) in { } body { }
+}
+
+/*******************************************/
+// 7883
+
+// Segmentation fault
+class AA7883
+{
+    int foo()
+    out (r1) { }
+    body { return 1; }
+}
+
+class BA7883 : AA7883
+{
+    override int foo()
+    out (r2) { }
+    body { return 1; }
+}
+
+class CA7883 : BA7883
+{
+    override int foo()
+    body { return 1; }
+}
+
+// Error: undefined identifier r2, did you mean variable r3?
+class AB7883
+{
+    int foo()
+    out (r1) { }
+    body { return 1; }
+}
+
+class BB7883 : AB7883
+{
+    override int foo()
+    out (r2) { }
+    body { return 1; }
+
+}
+
+class CB7883 : BB7883
+{
+    override int foo()
+    out (r3) { }
+    body { return 1; }
+}
+
+// Error: undefined identifier r3, did you mean variable r4?
+class AC7883
+{
+    int foo()
+    out (r1) { }
+    body { return 1; }
+}
+
+class BC7883 : AC7883
+{
+    override int foo()
+    out (r2) { }
+    body { return 1; }
+}
+
+class CC7883 : BC7883
+{
+    override int foo()
+    out (r3) { }
+    body { return 1; }
+}
+
+class DC7883 : CC7883
+{
+    override int foo()
+    out (r4) { }
+    body { return 1; }
+}
+
+/*******************************************/
+// 7892
+
+struct S7892
+{
+    @disable this();
+    this(int x) {}
+}
+
+S7892 f7892()
+out (result) {}     // case 1
+body
+{
+    return S7892(1);
+}
+
+interface I7892
+{
+    S7892 f();
+}
+class C7892
+{
+    invariant() {}  // case 2
+
+    S7892 f()
+    {
+        return S7892(1);
+    }
+}
+
+/*******************************************/
+// 8066
+
+struct CLCommandQueue
+{
+    invariant() {}
+
+//private:
+    int enqueueNativeKernel()
+    {
+        assert(0, "implement me");
+    }
+}
+
+/*******************************************/
+// 8073
+
+struct Container8073
+{
+    int opApply (int delegate(ref int) dg) { return 0; }
+}
+
+class Bug8073
+{
+    static int test;
+    int foo()
+    out(r) { test = 7; } body
+    {
+        Container8073 ww;
+        foreach( xxx ; ww ) {  }
+        return 7;
+    }
+
+    ref int bar()
+    out { } body
+    {
+        Container8073 ww;
+        foreach( xxx ; ww ) {  }
+        test = 7;
+        return test;
+    }
+}
+void test8073()
+{
+    auto c = new Bug8073();
+    assert(c.foo() == 7);
+    assert(c.test == 7);
+
+    auto p = &c.bar();
+    assert(p == &c.test);
+    assert(*p == 7);
+}
+
+/*******************************************/
+// 8093
+
+void test8093()
+{
+    static int g = 10;
+    static int* p;
+
+    enum fbody = q{
+        static struct S {
+            int opApply(scope int delegate(ref int) dg) { return dg(g); }
+        }
+        S s;
+        foreach (ref e; s)
+            return g;
+        assert(0);
+    };
+
+    ref int foo_ref1() out(r) { assert(&r is &g && r == 10); }
+    body { mixin(fbody); }
+
+    ref int foo_ref2()
+    body { mixin(fbody); }
+
+    { auto q = &foo_ref1(); assert(q is &g && *q == 10); }
+    { auto q = &foo_ref2(); assert(q is &g && *q == 10); }
+
+    int foo_val1() out(r) { assert(&r !is &g && r == 10); }
+    body { mixin(fbody); }
+
+    int foo_val2()
+    body { mixin(fbody); }
+
+    { auto n = foo_val1(); assert(&n !is &g && n == 10); }
+    { auto n = foo_val2(); assert(&n !is &g && n == 10); }
+}
+
+/*******************************************/
+// 9383
+
+class A9383
+{
+    static void delegate() dg;
+    static int val;
+
+    void failInBase() { assert(typeid(this) is typeid(A9383)); }
+
+    // in-contract tests
+    void foo1(int i) in  { A9383.val = i; failInBase; } body { }                        // no closure
+    void foo2(int i) in  { A9383.val = i; failInBase; } body { int x; dg = { ++x; }; }  // closure [local]
+    void foo3(int i) in  { A9383.val = i; failInBase; } body {        dg = { ++i; }; }  // closure [parameter]
+    void foo4(int i) in  { A9383.val = i; failInBase; } body { }                        // no closure
+    void foo5(int i) in  { A9383.val = i; failInBase; } body { }                        // no closure
+    void foo6(int i) in  { A9383.val = i; failInBase; } body { int x; dg = { ++x; }; }  // closure [local]
+    void foo7(int i) in  { A9383.val = i; failInBase; } body {        dg = { ++i; }; }  // closure [parameter]
+
+    // out-contract tests
+    void bar1(int i) out { A9383.val = i;             } body { }                        // no closure
+    void bar2(int i) out { A9383.val = i;             } body { int x; dg = { ++x; }; }  // closure [local]
+    void bar3(int i) out { A9383.val = i;             } body {        dg = { ++i; }; }  // closure [parameter]
+    void bar4(int i) out { A9383.val = i;             } body { }                        // no closure
+    void bar5(int i) out { A9383.val = i;             } body { }                        // no closure
+    void bar6(int i) out { A9383.val = i;             } body { int x; dg = { ++x; }; }  // closure [local]
+    void bar7(int i) out { A9383.val = i;             } body {        dg = { ++i; }; }  // closure [parameter]
+}
+
+class B9383 : A9383
+{
+    static int val;
+
+    // in-contract tests
+    override void foo1(int i) in  { B9383.val = i; } body { }                           // -> no closure
+    override void foo2(int i) in  { B9383.val = i; } body { int x; dg = { ++x; }; }     // -> closure [local] appears
+    override void foo3(int i) in  { B9383.val = i; } body {        dg = { ++i; }; }     // -> closure [parameter]
+    override void foo4(int i) in  { B9383.val = i; } body { int x; dg = { ++x; }; }     // -> closure [local] appears
+    override void foo5(int i) in  { B9383.val = i; } body {        dg = { ++i; }; }     // -> closure [parameter] appears
+    override void foo6(int i) in  { B9383.val = i; } body { }                           // -> closure [local] disappears
+    override void foo7(int i) in  { B9383.val = i; } body { }                           // -> closure [parameter] disappears
+
+    // out-contract tests
+    override void bar1(int i) out { B9383.val = i; } body { }                           // -> no closure
+    override void bar2(int i) out { B9383.val = i; } body { int x; dg = { ++x; }; }     // -> closure [local] appears
+    override void bar3(int i) out { B9383.val = i; } body {        dg = { ++i; }; }     // -> closure [parameter]
+    override void bar4(int i) out { B9383.val = i; } body { int x; dg = { ++x; }; }     // -> closure [local] appears
+    override void bar5(int i) out { B9383.val = i; } body {        dg = { ++i; }; }     // -> closure [parameter] appears
+    override void bar6(int i) out { B9383.val = i; } body { }                           // -> closure [local] disappears
+    override void bar7(int i) out { B9383.val = i; } body { }                           // -> closure [parameter] disappears
+}
+
+void test9383()
+{
+    auto a = new A9383();
+    auto b = new B9383();
+
+    // base class in-contract is used from derived class.       // base                   derived
+    b.foo1(101); assert(A9383.val == 101 && B9383.val == 101);  // no closure          -> no closure
+    b.foo2(102); assert(A9383.val == 102 && B9383.val == 102);  // closure [local]     -> closure [local] appears
+    b.foo3(103); assert(A9383.val == 103 && B9383.val == 103);  // closure [parameter] -> closure [parameter]
+    b.foo4(104); assert(A9383.val == 104 && B9383.val == 104);  // no closure          -> closure [local] appears
+    b.foo5(105); assert(A9383.val == 105 && B9383.val == 105);  // no closure          -> closure [parameter] appears
+    b.foo6(106); assert(A9383.val == 106 && B9383.val == 106);  // closure [local]     -> closure [local] disappears
+    b.foo7(107); assert(A9383.val == 107 && B9383.val == 107);  // closure [parameter] -> closure [parameter] disappears
+
+    // base class out-contract is used from derived class.      // base                   derived
+    b.bar1(101); assert(A9383.val == 101 && B9383.val == 101);  // no closure          -> no closure
+    b.bar2(102); assert(A9383.val == 102 && B9383.val == 102);  // closure [local]     -> closure [local] appears
+    b.bar3(103); assert(A9383.val == 103 && B9383.val == 103);  // closure [parameter] -> closure [parameter]
+    b.bar4(104); assert(A9383.val == 104 && B9383.val == 104);  // no closure          -> closure [local] appears
+    b.bar5(105); assert(A9383.val == 105 && B9383.val == 105);  // no closure          -> closure [parameter] appears
+    b.bar6(106); assert(A9383.val == 106 && B9383.val == 106);  // closure [local]     -> closure [local] disappears
+    b.bar7(107); assert(A9383.val == 107 && B9383.val == 107);  // closure [parameter] -> closure [parameter] disappears
+
+    // in-contract in base class.
+    a.foo1(101); assert(A9383.val == 101);      // no closure
+    a.foo2(102); assert(A9383.val == 102);      // closure [local]
+    a.foo3(103); assert(A9383.val == 103);      // closure [parameter]
+
+    // out-contract in base class.
+    a.bar1(101); assert(A9383.val == 101);      // no closure
+    a.bar2(102); assert(A9383.val == 102);      // closure [local]
+    a.bar3(103); assert(A9383.val == 103);      // closure [parameter]
+}
+
+/*******************************************/
+// 15524 - Different from issue 9383 cases, closed variable size is bigger than REGSIZE.
+
+class A15524
+{
+    static void delegate() dg;
+    static string val;
+
+    void failInBase() { assert(typeid(this) is typeid(A15524)); }
+
+    // in-contract tests
+    void foo1(string s) in  { A15524.val = s; failInBase; } body { }                                // no closure
+    void foo2(string s) in  { A15524.val = s; failInBase; } body { string x; dg = { x = null; }; }  // closure [local]
+    void foo3(string s) in  { A15524.val = s; failInBase; } body {           dg = { s = null; }; }  // closure [parameter]
+    void foo4(string s) in  { A15524.val = s; failInBase; } body { }                                // no closure
+    void foo5(string s) in  { A15524.val = s; failInBase; } body { }                                // no closure
+    void foo6(string s) in  { A15524.val = s; failInBase; } body { string x; dg = { x = null; }; }  // closure [local]
+    void foo7(string s) in  { A15524.val = s; failInBase; } body {           dg = { s = null; }; }  // closure [parameter]
+
+    // out-contract tests
+    void bar1(string s) out { A15524.val = s;             } body { }                                // no closure
+    void bar2(string s) out { A15524.val = s;             } body { string x; dg = { x = null; }; }  // closure [local]
+    void bar3(string s) out { A15524.val = s;             } body {           dg = { s = null; }; }  // closure [parameter]
+    void bar4(string s) out { A15524.val = s;             } body { }                                // no closure
+    void bar5(string s) out { A15524.val = s;             } body { }                                // no closure
+    void bar6(string s) out { A15524.val = s;             } body { string x; dg = { x = null; }; }  // closure [local]
+    void bar7(string s) out { A15524.val = s;             } body {           dg = { s = null; }; }  // closure [parameter]
+}
+
+class B15524 : A15524
+{
+    static string val;
+
+    // in-contract tests
+    override void foo1(string s) in  { B15524.val = s; } body { }                                   // -> no closure
+    override void foo2(string s) in  { B15524.val = s; } body { string x; dg = { x = null; }; }     // -> closure [local] appears
+    override void foo3(string s) in  { B15524.val = s; } body {           dg = { s = null; }; }     // -> closure [parameter]
+    override void foo4(string s) in  { B15524.val = s; } body { string x; dg = { x = null; }; }     // -> closure [local] appears
+    override void foo5(string s) in  { B15524.val = s; } body {           dg = { s = null; }; }     // -> closure [parameter] appears
+    override void foo6(string s) in  { B15524.val = s; } body { }                                   // -> closure [local] disappears
+    override void foo7(string s) in  { B15524.val = s; } body { }                                   // -> closure [parameter] disappears
+
+    // out-contract tests
+    override void bar1(string s) out { B15524.val = s; } body { }                                   // -> no closure
+    override void bar2(string s) out { B15524.val = s; } body { string x; dg = { x = null; }; }     // -> closure [local] appears
+    override void bar3(string s) out { B15524.val = s; } body {           dg = { s = null; }; }     // -> closure [parameter]
+    override void bar4(string s) out { B15524.val = s; } body { string x; dg = { x = null; }; }     // -> closure [local] appears
+    override void bar5(string s) out { B15524.val = s; } body {           dg = { s = null; }; }     // -> closure [parameter] appears
+    override void bar6(string s) out { B15524.val = s; } body { }                                   // -> closure [local] disappears
+    override void bar7(string s) out { B15524.val = s; } body { }                                   // -> closure [parameter] disappears
+}
+
+void test15524()
+{
+    auto a = new A15524();
+    auto b = new B15524();
+
+    // base class in-contract is used from derived class.           // base                   derived
+    b.foo1("1"); assert(A15524.val == "1" && B15524.val == "1");    // no closure          -> no closure
+    b.foo2("2"); assert(A15524.val == "2" && B15524.val == "2");    // closure [local]     -> closure [local] appears
+    b.foo3("3"); assert(A15524.val == "3" && B15524.val == "3");    // closure [parameter] -> closure [parameter]
+    b.foo4("4"); assert(A15524.val == "4" && B15524.val == "4");    // no closure          -> closure [local] appears
+    b.foo5("5"); assert(A15524.val == "5" && B15524.val == "5");    // no closure          -> closure [parameter] appears
+    b.foo6("6"); assert(A15524.val == "6" && B15524.val == "6");    // closure [local]     -> closure [local] disappears
+    b.foo7("7"); assert(A15524.val == "7" && B15524.val == "7");    // closure [parameter] -> closure [parameter] disappears
+
+    // base class out-contract is used from derived class.          // base                   derived
+    b.bar1("1"); assert(A15524.val == "1" && B15524.val == "1");    // no closure          -> no closure
+    b.bar2("2"); assert(A15524.val == "2" && B15524.val == "2");    // closure [local]     -> closure [local] appears
+    b.bar3("3"); assert(A15524.val == "3" && B15524.val == "3");    // closure [parameter] -> closure [parameter]
+    b.bar4("4"); assert(A15524.val == "4" && B15524.val == "4");    // no closure          -> closure [local] appears
+    b.bar5("5"); assert(A15524.val == "5" && B15524.val == "5");    // no closure          -> closure [parameter] appears
+    b.bar6("6"); assert(A15524.val == "6" && B15524.val == "6");    // closure [local]     -> closure [local] disappears
+    b.bar7("7"); assert(A15524.val == "7" && B15524.val == "7");    // closure [parameter] -> closure [parameter] disappears
+
+    // in-contract in base class.
+    a.foo1("1"); assert(A15524.val == "1");     // no closure
+    a.foo2("2"); assert(A15524.val == "2");     // closure [local]
+    a.foo3("3"); assert(A15524.val == "3");     // closure [parameter]
+
+    // out-contract in base class.
+    a.bar1("1"); assert(A15524.val == "1");     // no closure
+    a.bar2("2"); assert(A15524.val == "2");     // closure [local]
+    a.bar3("3"); assert(A15524.val == "3");     // closure [parameter]
+}
+
+void test15524a()
+{
+    auto t1 = new Test15524a();
+    t1.infos["first"] = 0; //t1.add("first");
+    t1.add("second");
+
+    auto t2 = new Test15524b();
+    t2.add("second");
+}
+
+class Test15524a
+{
+    int[string] infos;
+
+    void add(string key)
+    in
+    {
+        assert(key !in infos); // @@@ crash here at second
+    }
+    body
+    {
+        auto item = new class
+        {
+            void notCalled()
+            {
+                infos[key] = 0;
+                    // affects, key parameter is made a closure variable.
+            }
+        };
+    }
+}
+
+class Test15524b
+{
+    void add(string key)
+    in
+    {
+        assert(key == "second"); // @@@ fails
+    }
+    body
+    {
+        static void delegate() dg;
+        dg = { auto x = key; };
+            // affects, key parameter is made a closure variable.
+    }
+}
+
+/*******************************************/
+// 10479
+
+class B10479
+{
+    B10479 foo()
+    out { } body { return null; }
+}
+
+class D10479 : B10479
+{
+    override D10479 foo() { return null; }
+}
+
+/*******************************************/
+// 10596
+
+class Foo10596
+{
+    auto bar()
+    out (result) { }
+    body { return 0; }
+}
+
+/*******************************************/
+// 10721
+
+class Foo10721
+{
+    this()
+    out { }
+    body { }
+
+    ~this()
+    out { }
+    body { }
+}
+
+struct Bar10721
+{
+    this(this)
+    out { }
+    body { }
+}
+
+/*******************************************/
+// 10981
+
+class C10981
+{
+    void foo(int i) pure
+    in { assert(i); }
+    out { assert(i); }
+    body {}
+}
+
+/*******************************************/
+// 14779
+
+class C14779
+{
+    final void foo(int v)
+    in  { assert(v == 0); }
+    out { assert(v == 0); }
+    body
+    {
+    }
+}
+
+void test14779()
+{
+    auto c = new C14779();
+    c.foo(0);
+}
+
+/*******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+//    test6();
+    test7();
+    test8();
+    test9();
+    test4785();
+    test6417();
+    test7218();
+    test8073();
+    test8093();
+    test9383();
+    test15524();
+    test15524a();
+    test14779();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testdstress.d b/gcc/testsuite/gdc.test/runnable/testdstress.d
new file mode 100644
index 00000000000..ee36d345b1d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testdstress.d
@@ -0,0 +1,932 @@
+// PERMUTE_ARGS:
+
+module dstress.run.module_01;
+
+import core.memory;
+import core.exception;
+import core.vararg;
+
+extern(C) void* malloc(size_t size);
+
+/* ================================ */
+
+struct MyStruct
+{
+        int i;
+}
+
+void test1()
+{
+        MyStruct inner()
+        in{
+                assert(1);
+        }out (result){
+                assert(result.i==1);
+        }body{
+                MyStruct s;
+                s.i = 1;
+                return s;
+        }
+        assert(inner.i==1);
+}
+
+/* ================================ */
+
+void foo2()
+in{
+        assert(0);
+}
+body{
+}
+
+void test2()
+{
+        try{
+                foo2();
+        }catch(Error ie){
+                return;
+        }
+        assert(0);
+}
+
+/* ================================ */
+
+class MyClass3
+{
+
+        private int g() const {
+                return 1;
+        }
+
+        invariant()
+        {
+                assert(g()==1);
+        }
+}
+
+void test3()
+{
+        MyClass3 c = new MyClass3();
+        assert(c);
+}
+
+/* ================================ */
+
+class A
+{
+        int x;
+
+        this(){
+            printf("A.this()\n");
+            x=3;
+        }
+
+        invariant()
+        {
+            printf("A.invariant\n");
+            assert(x>2);
+        }
+}
+
+class B : A
+{
+        int y;
+
+        this(){
+            printf("B.this()\n");
+            y=5;
+        }
+
+        invariant()
+        {
+            printf("B.invariant\n");
+            assert(y>4);
+        }
+}
+
+void test4()
+{
+        B gc = new B();
+}
+
+/* ================================ */
+
+class A5
+{
+
+        int x;
+
+        this(){
+            printf("A5.this()\n");
+            x=3;
+        }
+
+        invariant()
+        {
+            printf("A5.invariant\n");
+            assert(x>2);
+        }
+}
+
+class C5 : A5 { }
+
+class B5 : C5
+{
+
+        int y;
+
+        this(){
+            printf("B5.this()\n");
+            y=5;
+        }
+
+        invariant()
+        {
+            printf("B5.invariant\n");
+            assert(y>4);
+        }
+}
+
+void test5()
+{
+        B5 gc = new B5();
+}
+
+/* ================================ */
+
+void test6()
+{
+        long a;
+        assert(a.max == 0x7FFF_FFFF_FFFF_FFFFL);
+        //assert(a.min == 0xFFFF_FFFF_FFFF_FFFFL);
+        assert(a.min == 0x8000_0000_0000_0000L);
+        assert(a.init == 0);
+        assert(a.sizeof == 8);
+}
+
+/* ================================ */
+
+int i;
+
+void test7()
+{
+        assert(dstress.run.module_01.i==0);
+        dstress.run.module_01.i++;
+        assert(dstress.run.module_01.i==1);
+}
+
+/* ================================ */
+
+template mix(){
+        int x;
+}
+
+mixin .mix;
+
+void test8()
+{
+}
+
+/* ================================ */
+
+struct A9
+{
+    B9 next;
+}
+
+alias A9* B9;
+
+void test9()
+{
+    B9 n = new A9;
+}
+
+/* ================================ */
+
+
+struct TestStruct
+{
+        void add(...)
+        {
+                TestStruct other = va_arg!TestStruct(_argptr);
+                foreach(int value; other)
+                {
+                        foo();
+                }
+        }
+
+        void foo()
+        {
+                assert(left is null);
+                bar();
+        }
+
+        void bar()
+        {
+                assert(left is null);
+        }
+
+        int opApply(int delegate(ref int val) dg)
+        {
+                return 0;
+        }
+
+        void* left;
+}
+
+void test10()
+{
+        TestStruct t;
+        t.foo();
+}
+
+/* ================================ */
+
+int status11;
+
+void check(int x){
+        status11++;
+}
+
+class MyClass11{
+        void test(){
+                assert(status11==0);
+                .check(0);
+                assert(status11==1);
+                check();
+                assert(status11==3);
+        }
+
+        void check(){
+                assert(status11==1);
+                status11+=2;
+        }
+}
+
+void test11()
+{
+        MyClass11 c = new MyClass11();
+        assert(status11==0);
+        c.test();
+        assert(status11==3);
+        check(0);
+        assert(status11==4);
+}
+
+/* ================================ */
+
+int status12;
+
+class C12{
+        void foo(){
+                status12='N';
+        }
+
+        static void foo(int x){
+                status12=x;
+        }
+}
+
+void test12()
+{
+        C12 m = new C12();
+
+        C12.foo('S');
+        assert(status12=='S');
+
+        m.foo('s');
+        assert(status12=='s');
+
+        m.foo();
+        assert(status12=='N');
+}
+
+/* ================================ */
+
+void test13()
+{
+        wstring a="abc";
+        wstring b="efg";
+        wstring c=a~"d"~b;
+
+        assert(c == "abcdefg");
+}
+
+/* ================================ */
+
+void test14()
+{
+        dstring a="abc";
+        dstring b="efg";
+        dstring c=a~"d"~b;
+
+        assert(c == "abcdefg");
+}
+
+/* ================================ */
+
+class Parent15
+{
+        void test(int i){
+        }
+
+        int opCast(){
+                return 0;
+        }
+}
+
+class Child15 : Parent15
+{
+}
+
+void test15()
+{
+        (new Child15()).test(2);
+}
+
+/* ================================ */
+
+class Parent16
+{
+        void test(int i){
+        }
+}
+
+class Child16 : Parent16
+{
+        int opCast(){
+                return 0;
+        }
+}
+
+void test16()
+{
+        (new Child16()).test=2;
+}
+
+/* ================================ */
+
+void foo17(){
+        class MyClass{
+                static int x;
+        }
+}
+
+void foo17(int i){
+        class MyClass{
+                static int x;
+        }
+}
+
+void test17()
+{
+}
+
+/* ================================ */
+
+void foo18(){
+        struct MyStruct{
+                static int x;
+        }
+}
+
+void foo18(int i){
+        struct MyStruct{
+                static int x;
+        }
+}
+
+void test18()
+{
+}
+
+/* ================================ */
+
+class Class19 : Throwable
+{
+    this() { super(""); }
+}
+
+alias Class19 Alias19;
+
+void test19()
+{
+        try{
+                throw new Alias19();
+        }catch{
+                return;
+        }
+        assert(0);
+}
+
+/* ================================ */
+
+public static const uint U20 = (cast(uint)(-1)) >>> 2;
+
+alias uint myType20;
+public static const myType20 T20 = (cast(myType20)(-1)) >>> 2;
+
+void test20()
+{
+        assert(U20 == 0x3FFFFFFF);
+        assert(T20 == 0x3FFFFFFF);
+}
+
+/* ================================ */
+
+class C21(T1){
+        alias T1 type1;
+}
+
+class C21(T1, T2){
+        alias T1 type1;
+        alias .C21!(T2) type2;
+}
+
+void test21()
+{
+        alias C21!(int,long) CT;
+        CT c = new CT();
+}
+
+/* ================================ */
+
+scope class AutoClass{
+}
+
+void test22()
+{
+        scope AutoClass ac = new AutoClass();
+
+        with(ac){
+        }
+}
+
+/* ================================ */
+
+int status23;
+
+scope class C23{
+        ~this(){
+                assert(status23==0);
+                status23--;
+                throw new Exception("error msg");
+        }
+}
+
+void foo23(){
+        assert(status23==0);
+        scope C23 ac = new C23();
+}
+
+void test23()
+{
+        try{
+                foo23();
+        }catch{
+        }
+        assert(status23==-1);
+}
+
+/* ================================ */
+
+int status24;
+
+scope class C24{
+        this(){
+                assert(status24==0);
+                status24+=2;
+        }
+        ~this(){
+                assert(status24==2);
+                status24--;
+                throw new Exception("error msg");
+        }
+}
+
+void check24(){
+        scope C24 ac = new C24();
+        throw new Exception("check error");
+}
+
+void test24()
+{
+        assert(status24==0);
+        try{
+                check24();
+        }catch{
+                assert(status24==1);
+                status24-=5;
+        }
+        assert(status24==-4);
+}
+
+/* ================================ */
+
+struct S25{
+        S25 opSub(int i) { S25 s; return s; }
+}
+
+struct GeomObject{
+        S25     mesh;
+        int     xlate;
+}
+
+
+void extractTriangles(GeomObject g)
+{
+    void foobar()
+    {
+        g.mesh - g.xlate;
+        //g.mesh.opSub(g.xlate);
+    }
+
+    foobar();
+}
+
+void test25()
+{
+}
+
+/* ================================ */
+
+struct S26{
+        int i;
+
+        void display(){
+                assert(i==10);
+        }
+
+        void someFunc(){
+                // We never call this function
+                void bug(S26[] array){
+                        array[0].i = i+1;
+                }
+
+                assert(i==10);
+                display();
+                assert(i==10);
+        }
+}
+
+void test26()
+{
+        S26 m;
+        m.i = 10;
+        assert(m.i==10);
+        m.someFunc();
+        assert(m.i==10);
+}
+
+/* ================================ */
+
+template foo27(T:T[],alias S) {
+        string foo(T[] a, T[] b) {
+                return a ~ S ~ b;
+        }
+}
+
+string comma = ", ";
+alias foo27!(string,comma).foo catComma;
+
+void test27()
+{
+        string a = "Heath";
+        string b = "Regan";
+
+        assert("Heath, Regan"==catComma(a,b));
+}
+
+/* ================================ */
+
+void test28()
+{
+        assert((new S28!()).i==int.sizeof);
+}
+
+struct S28(){
+        int i=func28(0).sizeof;
+}
+
+int func28(...){
+        return 0;
+}
+
+/* ================================ */
+
+void test29()
+{
+        uint u;
+        u = 1 << 31;
+        assert( u == 0b1000_0000__0000_0000__0000_0000__0000_0000u);
+}
+
+/* ================================ */
+// Test for FinalizeError - it will be thrown if an Exception is thrown
+// during the class object finalization.
+
+int status30;
+
+class C30
+{
+    this()
+    {
+        status30++;
+    }
+
+    ~this()
+    {
+        status30--;
+        throw new Exception("E2");
+    }
+}
+
+void test30()
+{
+    try
+    {
+        //scope C30 m = new C30();
+        // It will insert one more `delete m` for the scope destruction, and it will be
+        // called during stack unwinding.
+        // Instead use bare memory chunk on stack to construct dummy class instance.
+        void[__traits(classInstanceSize, C30)] payload =
+            typeid(C30).initializer[];
+        C30 m = cast(C30)payload.ptr;
+        m.__ctor();
+
+        assert(status30 == 1);
+
+        delete m;   // _d_callfinalizer
+    }
+    catch (Error e) // FinalizeError
+    {
+        assert(status30 == 0);
+        status30--;
+    }
+
+    assert(status30 == -1);
+}
+
+/* ================================ */
+
+void test31()
+{
+        string str = x"F0 9D 83 93"; // utf-8 for U+1D0D3
+
+        int count=0;
+        dchar tmp;
+        foreach(dchar value ; str){
+                tmp=value;
+                count++;
+        }
+        assert(count==1);
+        assert(tmp==0x01D0D3);
+}
+
+/* ================================ */
+
+import std.stdio;
+
+union MyUnion32
+{
+        int i;
+        byte b;
+}
+
+void test32()
+{
+        TypeInfo ti = typeid(MyUnion32*);
+        assert(!(ti is null));
+        writefln("%s %d %d", ti.toString(), ti.tsize, (MyUnion32*).sizeof);
+        assert(ti.tsize==(MyUnion32*).sizeof);
+        assert(ti.toString()=="dstress.run.module_01.MyUnion32*");
+}
+
+/* ================================ */
+
+void test33()
+{
+        creal a=1.3L+9.7Li;
+        assert(a.re == 1.3L);
+        assert(a.im == 9.7L);
+}
+
+/* ================================ */
+
+void test34()
+{
+        creal c = 2.7L + 0i;
+        assert(c.re==2.7L);
+        assert(c.im==0.0L);
+}
+
+/* ================================ */
+
+void test35()
+{
+        try{
+                onOutOfMemoryError();
+        }catch(OutOfMemoryError e){
+                return;
+        }
+        assert(0);
+}
+
+/* ================================ */
+
+void test36()
+{
+        try{
+                onOutOfMemoryError();
+        }catch(OutOfMemoryError e){
+                return;
+        }
+        assert(0);
+}
+
+/* ================================ */
+
+struct S37{
+        int a;
+}
+
+const int i37 = 15;
+
+const S37 s1 = { i37+1 };
+const S37 s2 = s1;
+
+void test37()
+{
+        assert(s1.a == 16);
+        assert(s2.a == 16);
+}
+
+/* ================================ */
+
+class Foo38
+{
+        enum MyEnum{
+                VALUE_A=1,
+        }
+}
+
+class Bar38
+{
+        enum MyEnum{
+                VALUE_B=2,
+        }
+}
+
+void test38()
+{
+        assert(Foo38.MyEnum.VALUE_A==1);
+        assert(Bar38.MyEnum.VALUE_B==2);
+}
+
+/* ================================ */
+
+void test39()
+{
+        bool[] bArray;
+        int[] iArray;
+
+        bArray[]=false;
+
+        foreach(int c; iArray){
+                assert(0);
+        }
+}
+
+/* ================================ */
+
+bool checked40;
+
+class Parent40{
+        int x;
+
+        void test(){
+        }
+
+        invariant()
+        {
+                assert(!checked40);
+                checked40=true;
+                // even number
+                assert((x&1u)==0);
+        }
+}
+
+class Child40 : Parent40{
+}
+
+class GrandChild40 : Child40{
+        this(){
+                x=5;
+        }
+}
+
+void test40()
+{
+        try{
+                assert(!checked40);
+                GrandChild40 gc = new GrandChild40();
+        }catch{
+                assert(checked40);
+                return;
+        }
+        assert(0);
+}
+
+/* ================================ */
+
+int counter41;
+
+class C41{
+        this(){
+                printf("this: counter41 = %d\n", counter41);
+                assert(counter41==1);
+                counter41+=2;
+        }
+
+        new(size_t size){
+                printf("new: size = %d\n", size);
+                assert(counter41==0);
+                counter41++;
+                return malloc(size);
+        }
+}
+
+void test41()
+{
+        C41 c;
+        assert(counter41==0);
+        c = new C41();
+        assert(counter41==3);
+}
+
+/* ================================ */
+
+struct S42{
+        int y;
+        void* x;
+}
+
+void test42()
+{
+        size_t t;
+        t = S42.y.offsetof;
+        assert(t == 0);
+        t = S42.x.offsetof;
+        assert((t % (void*).sizeof) == 0);
+}
+
+/* ================================ */
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testdt.d b/gcc/testsuite/gdc.test/runnable/testdt.d
new file mode 100644
index 00000000000..8224abc1356
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testdt.d
@@ -0,0 +1,172 @@
+// PERMUTE_ARGS:
+
+/******************************************/
+
+static int bigarray[100][100];
+
+void test1()
+{
+  for (int i = 0; i < 100; i += 1)
+  {
+    for (int j = 0; j < 100; j += 1)
+    {
+      //printf("Array %i %i\n", i, j);
+      bigarray[i][j] = 0;
+    }
+  }
+}
+
+/******************************************/
+// 10629
+
+class Foo10629 {}
+
+struct Bar10629
+{
+    void[__traits(classInstanceSize, Foo10629)] x;
+}
+
+/******************************************/
+// 11233
+
+struct S11233
+{
+    uint[0x100000] arr;
+}
+
+/******************************************/
+// 11672
+
+void test11672()
+{
+    struct V { float f; }
+    struct S
+    {
+        V[3] v = V(1);
+    }
+
+    S s;
+    assert(s.v == [V(1), V(1), V(1)]); /* was [V(1), V(nan), V(nan)] */
+}
+
+/******************************************/
+// 12509
+
+struct A12509
+{
+    int member;
+}
+struct B12509
+{
+    A12509[0x10000] array;
+}
+
+/******************************************/
+// 13505
+
+class C13505 { void[10] x; }
+struct S13505 { void[10] x; }
+
+void test13505()
+{
+    auto c = new C13505();
+    auto s = S13505();
+}
+
+/******************************************/
+// 14699
+
+struct S14699a { ubyte[0][10] values; }
+struct S14699b { S14699a tbl; }
+// +/
+
+ubyte[0][1] sa14699;
+
+void test14699()
+{
+    //auto p = &sa14699;  // Cannot work in Win32 (OMF)
+}
+
+/******************************************/
+// 14805
+
+struct S14805
+{
+    ushort one;
+}
+auto a14805 = new S14805[513*513];
+
+/******************************************/
+// 15664
+
+struct Data15664A
+{
+    int[2] a;
+    int[2][2] b;
+    int c;
+}
+
+             Data15664A d15664a1 = {[1, 2], [[3, 4], [5, 6]], 7};   // OK
+       const Data15664A d15664a2 = {[1, 2], [[3, 4], [5, 6]], 7};   // OK <- NG
+shared       Data15664A d15664a3 = {[1, 2], [[3, 4], [5, 6]], 7};   // OK <- NG
+shared const Data15664A d15664a4 = {[1, 2], [[3, 4], [5, 6]], 7};   // OK <- NG
+   immutable Data15664A d15664a5 = {[1, 2], [[3, 4], [5, 6]], 7};   // OK <- NG
+
+struct Data15664B
+{
+    int[2] a;
+    const int[2][2] b;
+    int c;
+}
+
+             Data15664B d15664b1 = {[1, 2], [[3, 4], [5, 6]], 7};   // OK
+       const Data15664B d15664b2 = {[1, 2], [[3, 4], [5, 6]], 7};   // OK
+shared       Data15664B d15664b3 = {[1, 2], [[3, 4], [5, 6]], 7};   // OK <- NG
+shared const Data15664B d15664b4 = {[1, 2], [[3, 4], [5, 6]], 7};   // OK <- NG
+   immutable Data15664B d15664b5 = {[1, 2], [[3, 4], [5, 6]], 7};   // OK <- NG
+
+void test15664()
+{
+    assert(d15664a1.a == [1, 2]);
+    assert(d15664a2.a == [1, 2]);
+    assert(d15664a3.a == cast(shared)[1, 2]);
+    assert(d15664a4.a == cast(shared)[1, 2]);
+    assert(d15664a5.a == [1, 2]);
+    assert(d15664a1.b == [[3, 4], [5, 6]]);
+    assert(d15664a2.b == [[3, 4], [5, 6]]);
+    assert(d15664a3.b == cast(shared)[[3, 4], [5, 6]]);
+    assert(d15664a4.b == cast(shared)[[3, 4], [5, 6]]);
+    assert(d15664a5.b == [[3, 4], [5, 6]]);
+    assert(d15664a1.c == 7);    // OK
+    assert(d15664a2.c == 7);    // OK <- BG
+    assert(d15664a3.c == 7);    // OK <- NG
+    assert(d15664a4.c == 7);    // OK <- NG
+    assert(d15664a5.c == 7);    // OK <- NG
+
+    assert(d15664b1.a == [1, 2]);
+    assert(d15664b2.a == [1, 2]);
+    assert(d15664b3.a == cast(shared)[1, 2]);
+    assert(d15664b4.a == cast(shared)[1, 2]);
+    assert(d15664b5.a == [1, 2]);
+    assert(d15664b1.b == [[3, 4], [5, 6]]);
+    assert(d15664b2.b == [[3, 4], [5, 6]]);
+    assert(d15664b3.b == cast(shared)[[3, 4], [5, 6]]);
+    assert(d15664b4.b == cast(shared)[[3, 4], [5, 6]]);
+    assert(d15664b5.b == [[3, 4], [5, 6]]);
+    assert(d15664b1.c == 7);    // OK
+    assert(d15664b2.c == 7);    // OK
+    assert(d15664b3.c == 7);    // OK <- NG
+    assert(d15664b4.c == 7);    // OK <- NG
+    assert(d15664b5.c == 7);    // OK <- NG
+}
+
+/******************************************/
+
+int main()
+{
+    test1();
+    test11672();
+    test15664();
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testenum.d b/gcc/testsuite/gdc.test/runnable/testenum.d
new file mode 100644
index 00000000000..9ecf97a4b28
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testenum.d
@@ -0,0 +1,447 @@
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+/**********************************************/
+
+enum Bar
+{
+    bar2 = 2,
+    bar3,
+    bar4 = 0
+}
+
+void test1()
+{
+    Bar b;
+
+    assert(b == 2);
+}
+
+/**********************************************/
+
+void test2()
+{
+    enum E
+    {
+        a=-1
+    }
+
+    assert(E.min == -1);
+    assert(E.max == -1);
+}
+
+
+/**********************************************/
+
+void test3()
+{
+    enum E
+    {
+        a = 1,
+        b = -1,
+        c = 3,
+        d = 2
+    }
+
+    assert(E.min == -1);
+    assert(E.max == 3);
+}
+
+/**********************************************/
+
+void test4()
+{
+    enum E
+    {
+        a = -1,
+        b = -1,
+        c = -3,
+        d = -3
+    }
+
+    assert(E.min==-3);
+    assert(E.max==-1);
+}
+
+/**********************************************/
+
+enum Enum5
+{
+    A = 3,
+    B = 10,
+    E = -5,
+}
+
+void test5()
+{
+    assert(Enum5.init == Enum5.A);
+    assert(Enum5.init == 3);
+    Enum5 e;
+    assert(e == Enum5.A);
+    assert(e == 3);
+}
+
+/***********************************/
+
+enum E6 : byte
+{
+    NORMAL_VALUE = 0,
+    REFERRING_VALUE = NORMAL_VALUE + 1,
+    OTHER_NORMAL_VALUE = 2
+}
+
+void foo6(E6 e)
+{
+}
+
+void test6()
+{
+     foo6(E6.NORMAL_VALUE);
+     foo6(E6.REFERRING_VALUE);
+     foo6(E6.OTHER_NORMAL_VALUE);
+}
+
+/**********************************************/
+// 2407
+
+int i2407;
+
+void add2407() { ++i2407; }
+void sub2407() { --i2407; }
+
+enum EF2407f : void function()
+{
+    a = &add2407,
+    s = &sub2407,
+}
+
+enum EF2407s
+{
+    a = &add2407,
+    s = &sub2407,
+}
+
+enum
+{
+    a2407 = &add2407,
+    s2407 = &sub2407,
+}
+
+enum : void function()
+{
+    at2407 = &add2407,
+    st2407 = &sub2407,
+}
+
+enum EEF2407 : EF2407s
+{
+    a = EF2407s.a,
+    s = EF2407s.s,
+}
+
+void test2407()
+{
+    alias i2407 i;
+
+    EF2407f.a();
+    assert(i == 1);
+    EF2407f.s();
+    assert(i == 0);
+
+    EF2407s.a();
+    assert(i == 1);
+    EF2407s.s();
+    assert(i == 0);
+
+    a2407();
+    assert(i == 1);
+    s2407();
+    assert(i == 0);
+
+    at2407();
+    assert(i == 1);
+    st2407();
+    assert(i == 0);
+
+    EEF2407.a();
+    assert(i == 1);
+    EEF2407.s();
+    assert(i == 0);
+
+    EEF2407.init();
+    assert(i == 1);
+
+    struct S { int i; }
+    enum ES : S
+    {
+        a = S(1),
+        b = S(3),
+        c = S(2),
+    }
+    static assert(ES.init == S(1));
+    static assert(!__traits(compiles, ES.min));
+    static assert(!__traits(compiles, ES.max));
+
+    enum EES : ES
+    {
+        a = ES.a,
+        b = ES.b,
+        c = ES.c,
+    }
+    static assert(EES.init == ES.init);
+    static assert(EES.init == S(1));
+    static assert(!__traits(compiles, EES.min));
+    static assert(!__traits(compiles, EES.max));
+
+    ES es = ES.c;
+    assert(es.i == 2);
+    es = ES.b;
+    assert(es.i == 3);
+
+    class C { this(int i) { this.i = i; } int i; }
+    enum EC : C
+    {
+        a = new C(42),
+        b = null,
+        c = new C(1),
+        d = new C(33),
+    }
+    static assert(EC.init.i == (new C(42)).i);
+    static assert(!__traits(compiles, EC.min));
+    static assert(!__traits(compiles, EC.max));
+
+    EC ec = EC.d;
+    assert(ec.i == 33);
+    ec = EC.b;
+    assert(ec is null);
+}
+
+/**********************************************/
+// 3096
+
+void test3096()
+{
+    template Tuple(T...) { alias Tuple = T; }
+
+    template Base(E)
+    {
+        static if(is(E B == enum))
+            alias Base = B;
+    }
+
+    template GetEnum(T)
+    {
+        enum GetEnum { v = T.init }
+    }
+
+    struct S { }
+    class C { }
+
+    foreach (Type; Tuple!(char, wchar, dchar, byte, ubyte,
+                          short, ushort, int, uint, long,
+                          ulong, float, double, real, S, C))
+    {
+        static assert(is(Base!(GetEnum!Type) == Type));
+    }
+}
+
+/**********************************************/
+// 7719
+
+enum foo7719 = bar7719;
+enum { bar7719 = 1 }
+
+/**********************************************/
+// 9845
+
+enum { A9845 = B9845 }
+enum { B9845 = 1 }
+
+/**********************************************/
+// 9846
+
+const int A9846 = B9846;
+enum { B9846 = 1 }
+
+/**********************************************/
+// 10105
+
+enum E10105 : char[1] { a = "a" }
+
+/**********************************************/
+// 10113
+
+enum E10113 : string
+{
+    a = "a",
+    b = "b",
+    abc = "abc"
+}
+
+void test10113()
+{
+    E10113 v = E10113.b;
+    bool check = false;
+
+    final switch (v) {
+    case E10113.a: assert(false);
+    case E10113.b: check = true; break;
+    case E10113.abc: assert(false);
+    }
+
+    assert(check);
+}
+
+/**********************************************/
+// 10503
+
+@property int octal10503(string num)()
+{
+    return num.length;
+}
+
+enum
+{
+    A10503 = octal10503!"2000000",
+    B10503 = octal10503!"4000",
+}
+
+/**********************************************/
+// 10505
+
+enum
+{
+    a10505 = true,
+    b10505 = 10.0f,
+    c10505 = false,
+    d10505 = 10,
+    e10505 = null
+}
+
+static assert(is(typeof(a10505) == bool));
+static assert(is(typeof(b10505) == float));
+static assert(is(typeof(c10505) == bool));
+static assert(is(typeof(d10505) == int));
+static assert(is(typeof(e10505) == typeof(null)));
+
+/**********************************************/
+// 10561
+
+void test10561()
+{
+    template Tuple(T...) { alias Tuple = T; }
+
+    foreach (Type; Tuple!(char, wchar, dchar, byte, ubyte,
+                          short, ushort, int, uint, long,
+                          ulong, float, double, real))
+    {
+        enum : Type { v = 0, w = 0, x, y = x }
+        static assert(is(typeof(v) == Type));
+        static assert(is(typeof(w) == Type));
+        static assert(is(typeof(x) == Type));
+        static assert(is(typeof(y) == Type));
+    }
+
+    class B { }
+    class D : B { }
+    enum : B { a = new D, b = new B, c = null }
+    static assert(is(typeof(a) == B));
+    static assert(is(typeof(b) == B));
+    static assert(is(typeof(c) == B));
+
+    struct S { this(int) { } }
+    enum : S { d = S(1), e = S(2) }
+    static assert(is(typeof(d) == S));
+    static assert(is(typeof(e) == S));
+
+    enum : float[] { f = [], g = [1.0, 2.0], h = [1.0f] }
+    static assert(is(typeof(f) == float[]));
+    static assert(is(typeof(g) == float[]));
+    static assert(is(typeof(h) == float[]));
+}
+
+/**********************************************/
+// 10612
+
+int[E10612] ie10612;
+E10612[int] ei10612;
+E10612[E10612] ee10612;
+
+enum E10612 { a }
+
+/**********************************************/
+// 10788
+
+enum v10788 = e10788;
+enum : int { e10788 }
+
+/**********************************************/
+
+class C7
+{
+    enum Policy
+    {
+        PREFER_READERS,
+        PREFER_WRITERS
+    }
+
+    void foo1( Policy policy = Policy.PREFER_READERS ) { }
+    void foo2( Policy policy = Policy.PREFER_WRITERS ) { }
+}
+
+/**********************************************/
+
+void test8()
+{
+    enum E
+    {
+        A = B,
+        E = D + 7,
+        B = 3,
+        C,
+        D,
+    }
+
+    assert(E.A == 3);
+    assert(E.B == 3);
+    assert(E.C == 4);
+    assert(E.D == 5);
+    assert(E.E == 12);
+    assert(E.max == 12);
+}
+
+/**********************************************/
+// 13220
+
+enum E13220a;
+@(1) enum E13220b;
+
+void test13220()
+{
+    auto prot = __traits(getProtection, E13220a);
+    assert(prot == "public");
+
+    auto udas = __traits(getAttributes, E13220b);
+    assert(udas[0] == 1);
+}
+
+/**********************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test2407();
+    test10113();
+    test10561();
+    test8();
+    test13220();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testfile.d b/gcc/testsuite/gdc.test/runnable/testfile.d
new file mode 100644
index 00000000000..70059008616
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testfile.d
@@ -0,0 +1,24 @@
+// PERMUTE_ARGS:
+
+import std.file;
+import std.stdio;
+
+/***********************************************/
+
+void test1()
+{
+    auto p = std.file.getcwd();
+
+    writefln("%s '%s'\n", p.length, p);
+    assert(p[$ - 1] != 0);
+}
+
+/***********************************************/
+
+int main()
+{
+    test1();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testformat.d b/gcc/testsuite/gdc.test/runnable/testformat.d
new file mode 100644
index 00000000000..e209b855b59
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testformat.d
@@ -0,0 +1,125 @@
+// PERMUTE_ARGS:
+
+import std.stdio;
+import std.string;
+
+/*************************************************************/
+
+void test1()
+{
+    double x = 1e6;
+    float f;
+    double d;
+    real r;
+
+    while (x > 1e-5)
+    {   double y = x / 101.0;
+
+        std.stdio.writef("x = %g\t%f\t%e\n",x/101.0,x/101.0,x/101.0);
+        x /= 10.0;
+    }
+
+    double a = 123456789.0;
+    for (int i = 20; i--; a /= 10)
+        std.stdio.writef("%20.6g|%20.6e|%20.6f\n",a,a,a);
+
+    std.stdio.writef("%e %e %e %e\n",float.nan,double.nan,real.nan,double.infinity);
+    std.stdio.writef("%e %e %e\n",-float.nan,-double.nan,-double.infinity);
+    std.stdio.writef("%-5E %5E %E\n",float.nan,double.nan,double.infinity);
+
+    std.stdio.writef("%f %f %f\n",float.nan,double.nan,double.infinity);
+    std.stdio.writef("%f %f %f\n",-float.nan,-double.nan,-double.infinity);
+    std.stdio.writef("%+F %+ F %F\n",float.nan,double.nan,double.infinity);
+
+    std.stdio.writef("%g %g %g\n",float.nan,double.nan,double.infinity);
+    std.stdio.writef("%g %g %g\n",-float.nan,-double.nan,-double.infinity);
+    std.stdio.writef("% G %G %G\n",float.nan,double.nan,double.infinity);
+
+    r = 0x1.AAp+3L;
+    std.stdio.writef(" r = %g\n", r);
+    std.stdio.writef(" r = %a\n", r);
+    std.stdio.writef(" r = %A\n", r);
+
+    d = 0x1.AAp+3;
+    std.stdio.writef(" d = %.5a\n", d);
+    std.stdio.writef(" d = %A\n", d);
+
+    f = 0x1.AAp+3f;
+    std.stdio.writef(" f = %a\n", f);
+    std.stdio.writef(" f = %A\n", f);
+
+    f = 0x1.FFp+3f;
+    std.stdio.writef(" f = %.1a\n", f);
+    std.stdio.writef(" f = %A\n", f);
+
+    r = 0;
+    std.stdio.writef(" r = %a\n", r);
+    std.stdio.writef(" r = %A\n", r);
+
+    std.stdio.writef("%e\n", 1e+300);
+    std.stdio.writef("%.0f\n%.307f\n", 1e+300, 1e-300);
+    std.stdio.writef("%.0A\n%.307A\n", 1e+300, 1e-300);
+}
+
+/*************************************************************/
+
+void test2()
+{
+   writefln("%o", 9);
+   assert(std.string.format("%o", 9) == "11");
+   assert(std.string.format("%o", 10) == "12");
+   assert(std.string.format("%b", 9) == "1001");
+   assert(std.string.format("%b", 10) == "1010");
+}
+
+
+/*************************************************************/
+
+void test3()
+{
+    Object e = new Exception("hello");
+    writeln(e.toString());
+    //assert(e.toString() == "object.Exception: hello");
+    //assert(format(e) == "object.Exception: hello");
+
+    alias char[] xstring;
+    assert(format(cast(xstring)"world") == "world");
+}
+
+/*************************************************************/
+
+void test4()
+{
+   const char[][] x = ["%s","123"];
+   writeln(x);
+   assert(std.string.format("%s", x) == `["%s", "123"]`);
+}
+
+/*************************************************************/
+
+void test5()
+{
+    int[int] foo;
+
+    foo[1] = 2;
+    foo[7] = 28;
+
+    writefln("%s", foo);
+
+    void[0] v;
+    assert(format("%s", v) == "[]");
+}
+
+/*************************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+
+    std.stdio.writefln("Success");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testgc2.d b/gcc/testsuite/gdc.test/runnable/testgc2.d
new file mode 100644
index 00000000000..0d7ab8c4e3e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testgc2.d
@@ -0,0 +1,45 @@
+// PERMUTE_ARGS:
+
+module testgc2;
+
+import core.stdc.stdio;
+import core.exception : OutOfMemoryError;
+
+/*******************************************/
+
+void test1()
+{
+    printf("This should not take a while\n");
+    try
+    {
+        long[] l = new long[ptrdiff_t.max];
+        printf("%lu\n", cast(ulong)l.capacity); // Make sure l is not optimized out.
+        assert(0);
+    }
+    catch (OutOfMemoryError o)
+    {
+    }
+
+    printf("This may take a while\n");
+    try
+    {
+        byte[] b = new byte[size_t.max / 3];
+        printf("%lu\n", cast(ulong)b.capacity); // Make sure b is not optimized out.
+        version (Windows)
+            assert(0);
+    }
+    catch (OutOfMemoryError o)
+    {
+    }
+}
+
+/*******************************************/
+
+void main()
+{
+    test1();
+
+    printf("Success\n");
+}
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/testgc3.d b/gcc/testsuite/gdc.test/runnable/testgc3.d
new file mode 100644
index 00000000000..88232fefe36
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testgc3.d
@@ -0,0 +1,24 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS:
+
+import core.stdc.stdio;
+
+/* This isn't a very good test. If it 'fails' it just takes a very
+ * long time. The performance improved by a factor of five between
+ * 2.042 and 2.043.
+ */
+void main()
+{
+    uint[uint][] aa;
+    aa.length = 10000;
+    for(int i = 0; i < 10_000_000; i++)
+    {
+        size_t j = i % aa.length;
+        uint k = i;
+        uint l = i;
+        aa[j][k] = l;
+    }
+    printf("finished\n");
+    aa[] = null;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/testinvariant.d b/gcc/testsuite/gdc.test/runnable/testinvariant.d
new file mode 100644
index 00000000000..b115dc05f73
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testinvariant.d
@@ -0,0 +1,187 @@
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+class Foo : Object
+{
+    void test() { }
+
+    invariant()
+    {
+        printf("in invariant %p\n", this);
+    }
+}
+
+int testinvariant()
+{
+    printf("hello\n");
+    Foo f = new Foo();
+    printf("f = %p\n", f);
+    printf("f.sizeof = x%x\n", Foo.sizeof);
+    printf("f.classinfo = %p\n", f.classinfo);
+    printf("f.classinfo._invariant = %p\n", f.classinfo.base);
+    f.test();
+    printf("world\n");
+    return 0;
+}
+
+/***************************************************/
+// 6453
+
+void test6453()
+{
+    static class C
+    {
+        static uint called;
+        invariant() { called += 1; }
+        invariant() { called += 4; }
+        invariant() { called += 16; }
+
+        void publicMember() { assert(called == 21); }
+    }
+
+    static struct S
+    {
+        static uint called;
+        invariant() { called += 1; }
+        invariant() { called += 4; }
+        invariant() { called += 16; }
+
+        void publicMember() { assert(called == 21); }
+    }
+
+    auto c = new C();
+    C.called = 0;
+    c.publicMember();
+    assert(C.called == 42);
+
+    auto s = new S();
+    S.called = 0;
+    s.publicMember();
+    assert(S.called == 42);
+
+    // Defined symbols in one invariant cannot be seen from others.
+    static struct S6453
+    {
+        invariant()
+        {
+            struct S {}
+            int x;
+            static assert(!__traits(compiles, y));
+            static assert(!__traits(compiles, z));
+        }
+        invariant()
+        {
+            struct S {}
+            int y;
+            static assert(!__traits(compiles, x));
+            static assert(!__traits(compiles, z));
+        }
+        invariant()
+        {
+            struct S {}
+            int z;
+            static assert(!__traits(compiles, x));
+            static assert(!__traits(compiles, y));
+        }
+    }
+
+    static struct S6453a
+    {
+        pure    invariant() {}
+        nothrow invariant() {}
+        @safe   invariant() {}
+    }
+    static struct S6453b
+    {
+        pure    shared invariant() {}
+        nothrow shared invariant() {}
+        @safe   shared invariant() {}
+    }
+    static class C6453c
+    {
+        pure    synchronized invariant() {}
+        nothrow synchronized invariant() {}
+        @safe   synchronized invariant() {}
+    }
+}
+
+/***************************************************/
+// 13113
+
+struct S13113
+{
+    static int count;
+    invariant() // impure, throwable, system, and gc-able
+    {
+        ++count;    // impure
+    }
+
+    this(int) pure nothrow @safe @nogc {}
+    // post invaiant is called directly but doesn't interfere with constructor attributes
+
+    ~this() pure nothrow @safe @nogc {}
+    // pre invaiant is called directly but doesn't interfere with destructor attributes
+
+    void foo() pure nothrow @safe @nogc {}
+    // pre & post invariant calls don't interfere with method attributes
+}
+
+void test13113()
+{
+    assert(S13113.count == 0);
+    {
+        auto s = S13113(1);
+        assert(S13113.count == 1);
+        s.foo();
+        assert(S13113.count == 3);
+    }
+    assert(S13113.count == 4);
+}
+
+/***************************************************/
+// 13147
+
+version (D_InlineAsm_X86)
+    enum x86iasm = true;
+else version (D_InlineAsm_X86_64)
+    enum x86iasm = true;
+else
+    enum x86iasm = false;
+
+class C13147
+{
+    extern (C++) C13147 test()
+    {
+        static if (x86iasm)
+            asm { naked; ret; }
+        return this;
+    }
+}
+
+struct S13147
+{
+    void test()
+    {
+        static if (x86iasm)
+            asm { naked; ret; }
+    }
+}
+
+void test13147()
+{
+    auto c = new C13147();
+    c.test();
+    S13147 s;
+    s.test();
+}
+
+/***************************************************/
+
+void main()
+{
+    testinvariant();
+    test6453();
+    test13113();
+    test13147();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testkeyword.d b/gcc/testsuite/gdc.test/runnable/testkeyword.d
new file mode 100644
index 00000000000..79f2c29b24b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testkeyword.d
@@ -0,0 +1,152 @@
+// PERMUTE_ARGS:
+// EXTRA_SOURCES: imports/testkwd_file.d
+module testkeyword;
+import imports.testkwd;
+
+/****************************************/
+// calee test
+
+static assert(getCalleeFile()  == thatFile);
+static assert(getCalleeLine()  == thatLine);
+static assert(getCalleeMod()   == thatMod);
+static assert(getCalleeFunc()  == thatFunc);
+static assert(getCalleeFunc2() == thatFunc2);
+
+void testCallee()
+{
+    static assert(getCalleeFile()  == thatFile);
+    static assert(getCalleeLine()  == thatLine);
+    static assert(getCalleeMod()   == thatMod);
+    static assert(getCalleeFunc()  == thatFunc);
+    static assert(getCalleeFunc2() == thatFunc2);
+}
+
+/****************************************/
+// caller test
+
+version(Windows) enum sep = "\\";  else enum sep = "/";
+
+enum thisFile = "runnable"~sep~"testkeyword.d";
+enum thisMod  = "testkeyword";
+
+static assert(getFuncArgFile()  == thisFile);
+static assert(getFuncArgLine()  == 33);
+static assert(getFuncArgMod()   == thisMod);
+static assert(getFuncArgFunc()  == "");
+static assert(getFuncArgFunc2() == "");
+
+static assert(getFuncTiargFile()  == thisFile);
+static assert(getFuncTiargLine()  == 39);
+static assert(getFuncTiargMod()   == thisMod);
+static assert(getFuncTiargFunc()  == "");
+static assert(getFuncTiargFunc2() == "");
+
+static assert(getInstTiargFile!()  == thisFile);
+static assert(getInstTiargLine!()  == 45);
+static assert(getInstTiargMod!()   == thisMod);
+static assert(getInstTiargFunc!()  == "");
+static assert(getInstTiargFunc2!() == "");
+
+void main(string[] args) nothrow
+{
+    enum thisFunc       = "testkeyword.main";
+    enum thisFunc2 = "void testkeyword.main(string[] args) nothrow";
+
+    static assert(getFuncArgFile()  == thisFile);
+    static assert(getFuncArgLine()  == 56);
+    static assert(getFuncArgMod()   == thisMod);
+    static assert(getFuncArgFunc()  == thisFunc);
+    static assert(getFuncArgFunc2() == thisFunc2);
+
+    static assert(getFuncTiargFile()  == thisFile);
+    static assert(getFuncTiargLine()  == 62);
+    static assert(getFuncTiargMod()   == thisMod);
+    static assert(getFuncTiargFunc()  == thisFunc);
+    static assert(getFuncTiargFunc2() == thisFunc2);
+
+    static assert(getInstTiargFile!()  == thisFile);
+    static assert(getInstTiargLine!()  == 68);
+    static assert(getInstTiargMod!()   == thisMod);
+    static assert(getInstTiargFunc!()  == thisFunc);
+    static assert(getInstTiargFunc2!() == thisFunc2);
+
+    void nested(int x, float y) nothrow
+    {
+        enum thisFunc       = "testkeyword.main.nested";
+        enum thisFunc2 = "void testkeyword.main.nested(int x, float y) nothrow";
+
+        static assert(getFuncArgFile()  == thisFile);
+        static assert(getFuncArgLine()  == 79);
+        static assert(getFuncArgMod()   == thisMod);
+        static assert(getFuncArgFunc()  == thisFunc);
+        static assert(getFuncArgFunc2() == thisFunc2);
+
+        static assert(getFuncTiargFile()  == thisFile);
+        static assert(getFuncTiargLine()  == 85);
+        static assert(getFuncTiargMod()   == thisMod);
+        static assert(getFuncTiargFunc()  == thisFunc);
+        static assert(getFuncTiargFunc2() == thisFunc2);
+
+        static assert(getInstTiargFile!()  == thisFile);
+        static assert(getInstTiargLine!()  == 91);
+        static assert(getInstTiargMod!()   == thisMod);
+        static assert(getInstTiargFunc!()  == thisFunc);
+        static assert(getInstTiargFunc2!() == thisFunc2);
+    }
+    nested(1, 1.0);
+
+    auto funcLiteral = (int x, int y)
+    {
+        enum thisFunc  = "testkeyword.main.__lambda3";
+        enum thisFunc2 = "testkeyword.main.__lambda3(int x, int y)";
+
+        static assert(getFuncArgFile()  == thisFile);
+        static assert(getFuncArgLine()  == 104);
+        static assert(getFuncArgMod()   == thisMod);
+        static assert(getFuncArgFunc()  == thisFunc);
+        static assert(getFuncArgFunc2() == thisFunc2);
+
+        static assert(getFuncTiargFile()  == thisFile);
+        static assert(getFuncTiargLine()  == 110);
+        static assert(getFuncTiargMod()   == thisMod);
+        static assert(getFuncTiargFunc()  == thisFunc);
+        static assert(getFuncTiargFunc2() == thisFunc2);
+
+        static assert(getInstTiargFile!()  == thisFile);
+        static assert(getInstTiargLine!()  == 116);
+        static assert(getInstTiargMod!()   == thisMod);
+        static assert(getInstTiargFunc!()  == thisFunc);
+        static assert(getInstTiargFunc2!() == thisFunc2);
+    };
+    funcLiteral(1, 2);
+
+    static struct S
+    {
+        void func(string cs, T1, alias T2, T...)(int x) const
+        {
+            enum thisFunc       = `testkeyword.main.S.func!("foo", int, symbol, int[], float[]).func`;
+            enum thisFunc2 = `void testkeyword.main.S.func!("foo", int, symbol, int[], float[]).func(int x) const`;
+
+            static assert(getFuncArgFile()  == thisFile);
+            static assert(getFuncArgLine()  == 131);
+            static assert(getFuncArgMod()   == thisMod);
+            static assert(getFuncArgFunc()  == thisFunc);
+            static assert(getFuncArgFunc2() == thisFunc2);
+
+            static assert(getFuncTiargFile()  == thisFile);
+            static assert(getFuncTiargLine()  == 137);
+            static assert(getFuncTiargMod()   == thisMod);
+            static assert(getFuncTiargFunc()  == thisFunc);
+            static assert(getFuncTiargFunc2() == thisFunc2);
+
+            static assert(getInstTiargFile!()  == thisFile);
+            static assert(getInstTiargLine!()  == 143);
+            static assert(getInstTiargMod!()   == thisMod);
+            static assert(getInstTiargFunc!()  == thisFunc);
+            static assert(getInstTiargFunc2!() == thisFunc2);
+        }
+    }
+    static int symbol;
+    S s;
+    s.func!("foo", int, symbol, int[], float[])(1);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testline.d b/gcc/testsuite/gdc.test/runnable/testline.d
new file mode 100644
index 00000000000..22117bd385c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testline.d
@@ -0,0 +1,43 @@
+// PERMUTE_ARGS:
+
+// $HeadURL$
+// $Date$
+// $Author$
+
+module dstress.run.line_token_03;
+
+import std.stdio;
+import core.exception;
+
+int main(){
+        try{
+                #line 1 ""
+                assert(0);
+        }catch(AssertError o){
+                checkFileSpec(o);
+                return 0;
+        }
+
+        assert(0);
+}
+
+import std.stdio;
+
+/*
+ * @WARNING@: this code depends on the phobos implementation.
+ * char[]s returned by wrong assertions have to look like:
+ *       "blah blah "filename" blah blah"
+ */
+void checkFileSpec(Object o){
+        string str=o.toString();
+
+        int start;
+        for(start=0; start<str.length; start++){
+                if(str[start]=='('){
+                        break;
+                }
+        }
+
+writeln(str);
+        assert(str[start .. start+3]=="(1)");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testminit.d b/gcc/testsuite/gdc.test/runnable/testminit.d
new file mode 100644
index 00000000000..52c99bbf28f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testminit.d
@@ -0,0 +1,20 @@
+// EXTRA_SOURCES: imports/testminitAA.d imports/testminitBB.d
+// PERMUTE_ARGS:
+
+import core.stdc.stdio;
+
+import imports.testminitAA;
+private import imports.testminitBB;
+
+static this()
+{
+    printf("hello\n");
+    assert(aa == 1);
+    assert(bb == 1);
+}
+
+int main()
+{
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testmmfile.d b/gcc/testsuite/gdc.test/runnable/testmmfile.d
new file mode 100644
index 00000000000..f0b3340905a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testmmfile.d
@@ -0,0 +1,119 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS:
+
+import std.file;
+import std.mmfile;
+
+int main()
+{
+    static string name = "test.tmp";
+    static string s = "abcd";
+
+    write(name, s);
+
+    {   scope MmFile mmf = new MmFile(name);
+        string p;
+
+        assert(mmf[0] == 'a');
+        p = cast(string)mmf[];
+        //printf("p.length = %d\n", p.length);
+        assert(p[1] == 'b');
+        p = cast(string)mmf[0 .. 4];
+        assert(p[2] == 'c');
+    }
+
+    {   scope MmFile mmf = new MmFile(name, MmFile.Mode.read, 0, null);
+        string p;
+
+        assert(mmf[0] == 'a');
+        p = cast(string)mmf[];
+        //printf("p.length = %d\n", p.length);
+        assert(mmf.length == 4);
+        assert(p[1] == 'b');
+        p = cast(string)mmf[0 .. 4];
+        assert(p[2] == 'c');
+    }
+
+    remove(name);
+
+    {   scope MmFile mmf = new MmFile(name, MmFile.Mode.readWriteNew, 4, null);
+        char[] p;
+
+        p = cast(char[])mmf[];
+        p[] = "1234";
+        mmf[3] = '5';
+        assert(mmf[2] == '3');
+        assert(mmf[3] == '5');
+    }
+
+    {   string p = cast(string)read(name);
+
+        assert(p[] == "1235");
+    }
+
+    {   scope MmFile mmf = new MmFile(name, MmFile.Mode.readWriteNew, 4, null);
+        char[] p;
+
+        p = cast(char[])mmf[];
+        p[] = "5678";
+        mmf[3] = '5';
+        assert(mmf[2] == '7');
+        assert(mmf[3] == '5');
+        assert(cast(string)mmf[] == "5675");
+    }
+
+    {   string p = cast(string)read(name);
+
+        assert(p[] == "5675");
+    }
+
+    {   scope MmFile mmf = new MmFile(name, MmFile.Mode.readWrite, 4, null);
+        char[] p;
+
+        p = cast(char[])mmf[];
+        assert(cast(char[])mmf[] == "5675");
+        p[] = "9102";
+        mmf[2] = '5';
+        assert(cast(string)mmf[] == "9152");
+    }
+
+    {   string p = cast(string)read(name);
+
+        assert(p[] == "9152");
+    }
+
+    remove(name);
+
+    {   scope MmFile mmf = new MmFile(name, MmFile.Mode.readWrite, 4, null);
+        char[] p;
+
+        p = cast(char[])mmf[];
+        p[] = "abcd";
+        mmf[2] = '5';
+        assert(cast(string)mmf[] == "ab5d");
+    }
+
+    {   string p = cast(string)read(name);
+
+        assert(p[] == "ab5d");
+    }
+
+    {   scope MmFile mmf = new MmFile(name, MmFile.Mode.readCopyOnWrite, 4, null);
+        char[] p;
+
+        p = cast(char[])mmf[];
+        assert(cast(string)mmf[] == "ab5d");
+        p[] = "9102";
+        mmf[2] = '5';
+        assert(cast(string)mmf[] == "9152");
+    }
+
+    {   string p = cast(string)read(name);
+
+        assert(p[] == "ab5d");
+    }
+
+    remove(name);
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testmod1.d b/gcc/testsuite/gdc.test/runnable/testmod1.d
new file mode 100644
index 00000000000..6d9aa9eff28
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testmod1.d
@@ -0,0 +1,13 @@
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/testmod1a.d imports/testmod1b.d
+// PERMUTE_ARGS:
+
+struct Foo(T) {
+  void foo(T arg) { }
+}
+
+
+int main()
+{
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testmod2.d b/gcc/testsuite/gdc.test/runnable/testmod2.d
new file mode 100644
index 00000000000..c03a8c790c5
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testmod2.d
@@ -0,0 +1,12 @@
+// EXTRA_SOURCES: imports/testmod2a.d
+
+/**********************************/
+// bug 1904
+
+import imports.testmod2a;
+void main()
+{
+    void whatever() {}
+    foo!(whatever)();
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/testmodule.d b/gcc/testsuite/gdc.test/runnable/testmodule.d
new file mode 100644
index 00000000000..5d81588de9d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testmodule.d
@@ -0,0 +1,21 @@
+// PERMUTE_ARGS:
+
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@     Anders F Björklund <afb@algonet.se>
+// @date@       2005-01-25
+// @uri@        news:ct428n$2qoe$1@digitaldaemon.com
+// @url@        nntp://news.digitalmars.com/D.gnu/983
+
+module dstress.run.unicode_06_哪里;
+
+int 哪里(int ö){
+        return ö+2;
+}
+
+int main(){
+        assert(dstress.run.unicode_06_哪里.哪里(2)==4);
+        return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testpic.d b/gcc/testsuite/gdc.test/runnable/testpic.d
new file mode 100644
index 00000000000..487c16ba305
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testpic.d
@@ -0,0 +1,30 @@
+// PERMUTE_ARGS: -fPIC -O
+
+extern (C) int printf(const char*, ...);
+
+/***************************************************/
+
+align(16) struct S41
+{
+    int[4] a;
+}
+
+shared int x41;
+shared S41 s41;
+
+void test11310()
+{
+    printf("&x = %p\n", &x41);
+    printf("&s = %p\n", &s41);
+    assert((cast(int)&s41 & 0xF) == 0);
+}
+
+/***************************************************/
+
+int main()
+{
+    test11310();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testprofile.d b/gcc/testsuite/gdc.test/runnable/testprofile.d
new file mode 100644
index 00000000000..291ac47bdde
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testprofile.d
@@ -0,0 +1,70 @@
+// REQUIRED_ARGS: -profile
+
+module testprofile;
+
+// ------------------
+
+struct FourUShort {
+    this(ushort a, ushort b, ushort c, ushort d) {
+        this.a = a;
+        this.b = b;
+        this.c = c;
+        this.d = d;
+    }
+    ushort a, b, c, d;
+}
+
+void test1()
+{
+    auto f = FourUShort(0, 1, 2, 3);
+    assert(f.a == 0);
+    assert(f.b == 1);
+    assert(f.c == 2);
+    assert(f.d == 3);
+}
+
+// ------------------
+
+void foo5689(double a, double b)
+{
+    assert(a == 17.0);
+    assert(b == 12.0);
+}
+
+__gshared fun5689 = &foo5689;
+
+void test5689()
+{
+    fun5689(17.0, 12.0);
+}
+
+// ------------------
+
+class Foo10617
+{
+    void foo() nothrow pure @safe
+    in { }
+    out { }
+    body { }
+}
+
+// ------------------
+
+class C10953
+{
+    void func() nothrow pure @safe
+    in {} out {} body {}
+}
+class D10953 : C10953
+{
+    override void func()    // inherits attributes of Foo.func
+    in {} out {} body {}
+}
+
+// ------------------
+
+void main()
+{
+    test1();
+    test5689();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testptrref.d b/gcc/testsuite/gdc.test/runnable/testptrref.d
new file mode 100644
index 00000000000..5bcf444c739
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testptrref.d
@@ -0,0 +1,168 @@
+
+version(CRuntime_Microsoft)
+{
+    extern(C)
+    {
+        extern __gshared uint _DP_beg;
+        extern __gshared uint _DP_end;
+        extern __gshared uint _TP_beg;
+        extern __gshared uint _TP_end;
+        extern int _tls_start;
+        extern int _tls_end;
+    }
+    alias _DPbegin = _DP_beg;
+    alias _DPend = _DP_end;
+    alias _TPbegin = _TP_beg;
+    alias _TPend = _TP_end;
+    alias _tlsstart = _tls_start;
+    alias _tlsend = _tls_end;
+
+    __gshared void[] dataSection;
+    shared static this()
+    {
+        import core.internal.traits : externDFunc;
+        alias findImageSection = externDFunc!("rt.sections_win64.findImageSection",
+                                              void[] function(string name) nothrow @nogc);
+        dataSection = findImageSection(".data");
+    }
+    
+    version = ptrref_supported;
+}
+else version(Win32)
+{
+    extern(C)
+    {
+        extern __gshared void* _DPbegin;
+        extern __gshared void* _DPend;
+        extern __gshared uint _TPbegin;
+        extern __gshared uint _TPend;
+        extern int _tlsstart;
+        extern int _tlsend;
+    }
+    version = ptrref_supported;
+}
+
+struct Struct
+{
+    int x;
+    Struct* next;
+}
+
+class Class
+{
+    void* ptr;
+}
+
+struct Struc(T)
+{
+	static T vtls;
+	static __gshared T vgshared;
+}
+
+__gshared Struct* gsharedStrctPtr2 = new Struct(7, new Struct(8, null));
+
+int tlsInt;
+void* tlsVar;
+
+shared int sharedInt;
+shared void* sharedVar;
+__gshared void* gsharedVar;
+__gshared void* gsharedVar2;
+immutable int[] arr = [1, 2, 3];
+string tlsStr;
+
+__gshared Struct gsharedStrct;
+Struct[3] tlsStrcArr;
+Class tlsClss;
+
+// expression initializers
+string[] strArr = [ "a", "b" ];
+__gshared Class gsharedClss = new Class;
+__gshared Struct* gsharedStrctPtr = new Struct(7, new Struct(8, null));
+
+debug(PRINT) import core.stdc.stdio;
+
+void main()
+{
+    version(ptrref_supported)
+        testRefPtr();
+}
+
+version(ptrref_supported):
+
+bool findTlsPtr(const(void)* ptr)
+{    
+    debug(PRINT) printf("findTlsPtr %p\n", ptr);
+    for (uint* p = &_TPbegin; p < &_TPend; p++)
+    {
+        void* addr = cast(void*) &_tlsstart + *p;
+        debug(PRINT) printf("  try %p\n", addr);
+        assert(addr < &_tlsend);
+        if (addr == ptr)
+            return true;
+    }
+    return false;
+}
+
+bool findDataPtr(const(void)* ptr)
+{
+    debug(PRINT) printf("findDataPtr %p\n", ptr);
+    for (auto p = &_DPbegin; p < &_DPend; p++)
+    {
+        debug(PRINT) printf("  try %p\n", cast(void*) cast(size_t) *p);
+        version(CRuntime_Microsoft)
+            void* addr = dataSection.ptr + *p;
+        else
+            void* addr = *p;
+        
+        if (addr == ptr)
+            return true;
+    }
+    return false;
+}
+
+void testRefPtr()
+{
+    debug(PRINT) printf("&_DPbegin %p\n", &_DPbegin);
+    debug(PRINT) printf("&_DPend   %p\n", &_DPend);
+
+    assert(!findDataPtr(cast(void*)&sharedInt));
+    assert(!findTlsPtr(&tlsInt));
+
+    assert(findDataPtr(cast(void*)&sharedVar));
+    assert(findDataPtr(&gsharedVar));
+    assert(findDataPtr(&gsharedStrct.next));
+    assert(findDataPtr(&(gsharedClss)));
+    assert(findDataPtr(&(gsharedClss.ptr)));
+
+    assert(findTlsPtr(&tlsVar));
+    assert(findTlsPtr(&tlsClss));
+    assert(findTlsPtr(&tlsStrcArr[0].next));
+    assert(findTlsPtr(&tlsStrcArr[1].next));
+    assert(findTlsPtr(&tlsStrcArr[2].next));
+
+    assert(!findTlsPtr(cast(size_t*)&tlsStr)); // length
+    assert(findTlsPtr(cast(size_t*)&tlsStr + 1)); // ptr
+    
+    // monitor is manually managed
+    assert(!findDataPtr(cast(size_t*)cast(void*)Class.classinfo + 1));
+    assert(!findDataPtr(cast(size_t*)cast(void*)Class.classinfo + 1));
+
+    assert(!findDataPtr(&arr));
+    assert(!findTlsPtr(&arr));
+    assert(!findDataPtr(cast(size_t*)&arr + 1));
+    assert(!findTlsPtr(cast(size_t*)&arr + 1));
+    
+    assert(findDataPtr(cast(size_t*)&strArr[0] + 1)); // ptr in _DATA!
+    assert(findDataPtr(cast(size_t*)&strArr[1] + 1)); // ptr in _DATA!
+    strArr[1] = "c";
+
+    assert(findDataPtr(&gsharedStrctPtr));
+    assert(findDataPtr(&gsharedStrctPtr.next));
+    assert(findDataPtr(&gsharedStrctPtr.next.next));
+
+    assert(findDataPtr(&(Struc!(int*).vgshared)));
+    assert(!findDataPtr(&(Struc!(int).vgshared)));
+    assert(findTlsPtr(&(Struc!(int*).vtls)));
+    assert(!findTlsPtr(&(Struc!(int).vtls)));
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testreturn.d b/gcc/testsuite/gdc.test/runnable/testreturn.d
new file mode 100644
index 00000000000..7aa32788456
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testreturn.d
@@ -0,0 +1,160 @@
+extern(C) int printf(const char*, ...);
+
+alias TypeTuple(T...) = T;
+
+/***************************************************/
+// 13336
+
+struct S13336
+{
+    int opApply(scope int delegate(int) dg)
+    {
+        return dg(0);
+    }
+}
+
+double result13336;
+
+enum fbody13336 =
+q{
+    static if (n == 1)
+    {
+        if (f)
+            return sx;
+        return sy;
+    }
+    static if (n == 2)
+    {
+        foreach (e; S13336())
+        {
+            if (f)
+                return sx;
+            return sy;
+        }
+        assert(0);
+    }
+    static if (n == 3)
+    {
+        if (f)
+            return sx;
+        foreach (e; S13336())
+        {
+            return sy;
+        }
+        assert(0);
+    }
+    static if (n == 4)
+    {
+        foreach (e; S13336())
+        {
+            if (f)
+                return sx;
+        }
+        return sy;
+    }
+    static if (n == 5)
+    {
+        if (false)
+            return 99;
+        foreach (e; S13336())
+        {
+            if (f)
+                return sx;
+            return sy;
+        }
+        assert(0);
+    }
+    static if (n == 6)
+    {
+        foreach (e; S13336())
+        {
+            if (f)
+                return sx;
+            return sy;
+        }
+        return 99;
+    }
+};
+
+// auto ref without out contract
+auto ref f13336a(int n, alias sx, alias sy)(bool f)
+{
+    mixin(fbody13336);
+}
+
+// auto without out contract
+auto f13336b(int n, alias sx, alias sy)(bool f)
+{
+    mixin(fbody13336);
+}
+
+// auto ref with out contract
+auto ref f13336c(int n, alias sx, alias sy)(bool f)
+out(r)
+{
+    static assert(is(typeof(r) == const double));
+    assert(r == (f ? sx : sy));
+    result13336 = r;
+}
+body
+{
+    mixin(fbody13336);
+}
+
+// auto with out contract
+auto f13336d(int n, alias sx, alias sy)(bool f)
+out(r)
+{
+    static assert(is(typeof(r) == const double));
+    assert(r == (f ? sx : sy));
+    result13336 = r;
+}
+body
+{
+    mixin(fbody13336);
+}
+
+void test13336()
+{
+    static int sx = 1;
+    static double sy = 2.5;
+
+    foreach (num; TypeTuple!(1, 2, 3, 4, 5, 6))
+    {
+        foreach (foo; TypeTuple!(f13336a, f13336b))
+        {
+            alias fooxy = foo!(num, sx, sy);
+            static assert(is(typeof(&fooxy) : double function(bool)));
+            assert(fooxy(1) == 1.0);
+            assert(fooxy(0) == 2.5);
+
+            alias fooyx = foo!(num, sy, sx);
+            static assert(is(typeof(&fooyx) : double function(bool)));
+            assert(fooyx(1) == 2.5);
+            assert(fooyx(0) == 1.0);
+        }
+
+        foreach (foo; TypeTuple!(f13336c, f13336d))
+        {
+            alias fooxy = foo!(num, sx, sy);
+            static assert(is(typeof(&fooxy) : double function(bool)));
+            assert(fooxy(1) == 1.0 && result13336 == 1.0);
+            assert(fooxy(0) == 2.5 && result13336 == 2.5);
+
+            alias fooyx = foo!(num, sy, sx);
+            static assert(is(typeof(&fooyx) : double function(bool)));
+            assert(fooyx(1) == 2.5 && result13336 == 2.5);
+            assert(fooyx(0) == 1.0 && result13336 == 1.0);
+        }
+    }
+}
+
+/***************************************************/
+
+int main()
+{
+    test13336();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testrightthis.d b/gcc/testsuite/gdc.test/runnable/testrightthis.d
new file mode 100644
index 00000000000..40675e15b26
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testrightthis.d
@@ -0,0 +1,612 @@
+// runnable/traits.d    9091,8972,8971,7027
+// runnable/test4.d     test6()
+
+extern(C) int printf(const char*, ...);
+
+template TypeTuple(TL...) { alias TypeTuple = TL; }
+
+/********************************************************/
+
+mixin("struct S1 {"~aggrDecl1~"}");
+mixin("class  C1 {"~aggrDecl1~"}");
+enum aggrDecl1 =
+q{
+    alias Type = typeof(this);
+
+    int x = 2;
+
+    void foo()
+    {
+        static assert( is(typeof(Type.x.offsetof)));
+        static assert( is(typeof(Type.x.mangleof)));
+        static assert( is(typeof(Type.x.sizeof  )));
+        static assert( is(typeof(Type.x.alignof )));
+        static assert( is(typeof({ auto n = Type.x.offsetof; })));
+        static assert( is(typeof({ auto n = Type.x.mangleof; })));
+        static assert( is(typeof({ auto n = Type.x.sizeof;   })));
+        static assert( is(typeof({ auto n = Type.x.alignof;  })));
+        static assert( is(typeof(Type.x)));
+        static assert( is(typeof({ auto n = Type.x; })));
+        static assert( __traits(compiles, Type.x));
+        static assert( __traits(compiles, { auto n = Type.x; }));
+
+        static assert( is(typeof(x.offsetof)));
+        static assert( is(typeof(x.mangleof)));
+        static assert( is(typeof(x.sizeof  )));
+        static assert( is(typeof(x.alignof )));
+        static assert( is(typeof({ auto n = x.offsetof; })));
+        static assert( is(typeof({ auto n = x.mangleof; })));
+        static assert( is(typeof({ auto n = x.sizeof;   })));
+        static assert( is(typeof({ auto n = x.alignof;  })));
+        static assert( is(typeof(x)));
+        static assert( is(typeof({ auto n = x; })));
+        static assert( __traits(compiles, x));
+        static assert( __traits(compiles, { auto n = x; }));
+
+        with (this)
+        {
+            static assert( is(typeof(x.offsetof)));
+            static assert( is(typeof(x.mangleof)));
+            static assert( is(typeof(x.sizeof  )));
+            static assert( is(typeof(x.alignof )));
+            static assert( is(typeof({ auto n = x.offsetof; })));
+            static assert( is(typeof({ auto n = x.mangleof; })));
+            static assert( is(typeof({ auto n = x.sizeof;   })));
+            static assert( is(typeof({ auto n = x.alignof;  })));
+            static assert( is(typeof(x)));
+            static assert( is(typeof({ auto n = x; })));
+            static assert( __traits(compiles, x));
+            static assert( __traits(compiles, { auto n = x; }));
+        }
+    }
+
+    static void bar()
+    {
+        static assert( is(typeof(Type.x.offsetof)));
+        static assert( is(typeof(Type.x.mangleof)));
+        static assert( is(typeof(Type.x.sizeof  )));
+        static assert( is(typeof(Type.x.alignof )));
+        static assert( is(typeof({ auto n = Type.x.offsetof; })));
+        static assert( is(typeof({ auto n = Type.x.mangleof; })));
+        static assert( is(typeof({ auto n = Type.x.sizeof;   })));
+        static assert( is(typeof({ auto n = Type.x.alignof;  })));
+        static assert( is(typeof(Type.x)));
+        static assert(!is(typeof({ auto n = Type.x; })));
+        static assert( __traits(compiles, Type.x));
+        static assert(!__traits(compiles, { auto n = Type.x; }));
+
+        static assert( is(typeof(x.offsetof)));
+        static assert( is(typeof(x.mangleof)));
+        static assert( is(typeof(x.sizeof  )));
+        static assert( is(typeof(x.alignof )));
+        static assert( is(typeof({ auto n = x.offsetof; })));
+        static assert( is(typeof({ auto n = x.mangleof; })));
+        static assert( is(typeof({ auto n = x.sizeof;   })));
+        static assert( is(typeof({ auto n = x.alignof;  })));
+        static assert( is(typeof(x)));
+        static assert(!is(typeof({ auto n = x; })));
+        static assert( __traits(compiles, x));
+        static assert(!__traits(compiles, { auto n = x; }));
+
+        Type t;
+        with (t)
+        {
+            static assert( is(typeof(x.offsetof)));
+            static assert( is(typeof(x.mangleof)));
+            static assert( is(typeof(x.sizeof  )));
+            static assert( is(typeof(x.alignof )));
+            static assert( is(typeof({ auto n = x.offsetof; })));
+            static assert( is(typeof({ auto n = x.mangleof; })));
+            static assert( is(typeof({ auto n = x.sizeof;   })));
+            static assert( is(typeof({ auto n = x.alignof;  })));
+            static assert( is(typeof(x)));
+            static assert( is(typeof({ auto n = x; })));
+            static assert( __traits(compiles, x));
+            static assert( __traits(compiles, { auto n = x; }));
+        }
+    }
+};
+void test1()
+{
+    foreach (Type; TypeTuple!(S1, C1))
+    {
+        static assert( is(typeof(Type.x.offsetof)));
+        static assert( is(typeof(Type.x.mangleof)));
+        static assert( is(typeof(Type.x.sizeof  )));
+        static assert( is(typeof(Type.x.alignof )));
+        static assert( is(typeof({ auto n = Type.x.offsetof; })));
+        static assert( is(typeof({ auto n = Type.x.mangleof; })));
+        static assert( is(typeof({ auto n = Type.x.sizeof;   })));
+        static assert( is(typeof({ auto n = Type.x.alignof;  })));
+        static assert( is(typeof(Type.x)));
+        static assert(!is(typeof({ auto n = Type.x; })));
+        static assert( __traits(compiles, Type.x));
+        static assert(!__traits(compiles, { auto n = Type.x; }));
+
+        Type t;
+        static assert( is(typeof(t.x.offsetof)));
+        static assert( is(typeof(t.x.mangleof)));
+        static assert( is(typeof(t.x.sizeof  )));
+        static assert( is(typeof(t.x.alignof )));
+        static assert( is(typeof({ auto n = t.x.offsetof; })));
+        static assert( is(typeof({ auto n = t.x.mangleof; })));
+        static assert( is(typeof({ auto n = t.x.sizeof;   })));
+        static assert( is(typeof({ auto n = t.x.alignof;  })));
+        static assert( is(typeof(t.x)));
+        static assert( is(typeof({ auto n = t.x; })));
+        static assert( __traits(compiles, t.x));
+        static assert( __traits(compiles, { auto n = t.x; }));
+
+        with (t)
+        {
+            static assert( is(typeof(x.offsetof)));
+            static assert( is(typeof(x.mangleof)));
+            static assert( is(typeof(x.sizeof  )));
+            static assert( is(typeof(x.alignof )));
+            static assert( is(typeof({ auto n = x.offsetof; })));
+            static assert( is(typeof({ auto n = x.mangleof; })));
+            static assert( is(typeof({ auto n = x.sizeof;   })));
+            static assert( is(typeof({ auto n = x.alignof;  })));
+            static assert( is(typeof(x)));
+            static assert( is(typeof({ auto n = x; })));
+            static assert( __traits(compiles, x));
+            static assert( __traits(compiles, { auto n = x; }));
+        }
+    }
+}
+
+/********************************************************/
+
+void test2()
+{
+    struct S
+    {
+        int val;
+        int[] arr;
+        int[int] aar;
+
+        void foo() {}
+        void boo()() {}
+
+        static void test()
+        {
+            static assert(!__traits(compiles, S.foo()));
+            static assert(!__traits(compiles, S.boo()));
+            static assert(!__traits(compiles, foo()));
+            static assert(!__traits(compiles, boo()));
+        }
+    }
+    int v;
+    int[] a;
+    void f(int n) {}
+
+    static assert( __traits(compiles, S.val));  // 'S.val' is treated just a symbol
+    static assert(!__traits(compiles, { int n = S.val; }));
+    static assert(!__traits(compiles, f(S.val)));
+
+    static assert(!__traits(compiles, v = S.val) && !__traits(compiles, S.val = v));
+
+    static assert(!__traits(compiles, 1 + S.val) && !__traits(compiles, S.val + 1));
+    static assert(!__traits(compiles, 1 - S.val) && !__traits(compiles, S.val - 1));
+    static assert(!__traits(compiles, 1 * S.val) && !__traits(compiles, S.val * 1));
+    static assert(!__traits(compiles, 1 / S.val) && !__traits(compiles, S.val / 1));
+    static assert(!__traits(compiles, 1 % S.val) && !__traits(compiles, S.val % 1));
+    static assert(!__traits(compiles, 1 ~ S.arr) && !__traits(compiles, S.arr ~ 1));
+
+    static assert(!__traits(compiles, 1 & S.val) && !__traits(compiles, S.val & 1));
+    static assert(!__traits(compiles, 1 | S.val) && !__traits(compiles, S.val | 1));
+    static assert(!__traits(compiles, 1 ^ S.val) && !__traits(compiles, S.val ^ 1));
+    static assert(!__traits(compiles, 1 ~ S.val) && !__traits(compiles, S.val ~ 1));
+
+    static assert(!__traits(compiles, 1 ^^ S.val) && !__traits(compiles, S.val ^^ 1));
+    static assert(!__traits(compiles, 1 << S.val) && !__traits(compiles, S.val << 1));
+    static assert(!__traits(compiles, 1 >> S.val) && !__traits(compiles, S.val >> 1));
+    static assert(!__traits(compiles, 1 >>>S.val) && !__traits(compiles, S.val >>>1));
+    static assert(!__traits(compiles, 1 && S.val) && !__traits(compiles, S.val && 1));
+    static assert(!__traits(compiles, 1 || S.val) && !__traits(compiles, S.val || 1));
+    static assert(!__traits(compiles, 1 in S.aar) && !__traits(compiles, S.val || [1:1]));
+
+    static assert(!__traits(compiles, 1 <= S.val) && !__traits(compiles, S.val <= 1));
+    static assert(!__traits(compiles, 1 == S.val) && !__traits(compiles, S.val == 1));
+    static assert(!__traits(compiles, 1 is S.val) && !__traits(compiles, S.val is 1));
+
+    static assert(!__traits(compiles, 1? 1:S.val) && !__traits(compiles, 1? S.val:1));
+    static assert(!__traits(compiles, (1, S.val)) && !__traits(compiles, (S.val, 1)));
+
+    static assert(!__traits(compiles, &S.val));
+    static assert(!__traits(compiles, S.arr[0]) && !__traits(compiles, [1,2][S.val]));
+    static assert(!__traits(compiles, S.val++) && !__traits(compiles, S.val--));
+    static assert(!__traits(compiles, ++S.val) && !__traits(compiles, --S.val));
+
+    static assert(!__traits(compiles, v += S.val) && !__traits(compiles, S.val += 1));
+    static assert(!__traits(compiles, v -= S.val) && !__traits(compiles, S.val -= 1));
+    static assert(!__traits(compiles, v *= S.val) && !__traits(compiles, S.val *= 1));
+    static assert(!__traits(compiles, v /= S.val) && !__traits(compiles, S.val /= 1));
+    static assert(!__traits(compiles, v %= S.val) && !__traits(compiles, S.val %= 1));
+    static assert(!__traits(compiles, v &= S.val) && !__traits(compiles, S.val &= 1));
+    static assert(!__traits(compiles, v |= S.val) && !__traits(compiles, S.val |= 1));
+    static assert(!__traits(compiles, v ^= S.val) && !__traits(compiles, S.val ^= 1));
+    static assert(!__traits(compiles, a ~= S.val) && !__traits(compiles, S.arr ~= 1));
+
+    static assert(!__traits(compiles, v ^^= S.val) && !__traits(compiles, S.val ^^= 1));
+    static assert(!__traits(compiles, v <<= S.val) && !__traits(compiles, S.val <<= 1));
+    static assert(!__traits(compiles, v >>= S.val) && !__traits(compiles, S.val >>= 1));
+    static assert(!__traits(compiles, v >>>=S.val) && !__traits(compiles, S.val >>>=1));
+
+    static assert(!__traits(compiles, { auto x = 1 + S.val; }) && !__traits(compiles, { auto x = S.val + 1; }));
+    static assert(!__traits(compiles, { auto x = 1 - S.val; }) && !__traits(compiles, { auto x = S.val - 1; }));
+    static assert(!__traits(compiles, { auto x = S.arr ~ 1; }) && !__traits(compiles, { auto x = 1 ~ S.arr; }));
+
+    static assert(!__traits(compiles, S.foo()));
+    static assert(!__traits(compiles, S.boo()));
+    S.test();
+    alias foo = S.foo;
+    alias boo = S.boo;
+    static assert(!__traits(compiles, foo()));
+    static assert(!__traits(compiles, boo()));
+
+//  static assert(S.val);
+
+    struct SW { int a; }
+    class CW { int a; }
+    static assert(!__traits(compiles, { with (SW) { int n = a; } }));
+    static assert(!__traits(compiles, { with (CW) { int n = a; } }));
+}
+
+/********************************************************/
+
+struct S3
+{
+    struct T3 { int val; void foo() {} }
+    T3 member;
+    alias member this;
+
+    static void test()
+    {
+        static assert(!__traits(compiles,   S3.val = 1   ));
+        static assert(!__traits(compiles, { S3.val = 1; }));
+        static assert(!__traits(compiles,   T3.val = 1   ));
+        static assert(!__traits(compiles, { T3.val = 1; }));
+        static assert(!__traits(compiles,   __traits(getMember, S3, "val") = 1   ));
+        static assert(!__traits(compiles, { __traits(getMember, S3, "val") = 1; }));
+        static assert(!__traits(compiles,   __traits(getMember, T3, "val") = 1   ));
+        static assert(!__traits(compiles, { __traits(getMember, T3, "val") = 1; }));
+
+        static assert(!__traits(compiles,   S3.foo()   ));
+        static assert(!__traits(compiles, { S3.foo(); }));
+        static assert(!__traits(compiles,   T3.foo()   ));
+        static assert(!__traits(compiles, { T3.foo(); }));
+        static assert(!__traits(compiles,   __traits(getMember, S3, "foo")()   ));
+        static assert(!__traits(compiles, { __traits(getMember, S3, "foo")(); }));
+        static assert(!__traits(compiles,   __traits(getMember, T3, "foo")()   ));
+        static assert(!__traits(compiles, { __traits(getMember, T3, "foo")(); }));
+        static assert(!__traits(compiles,   __traits(getOverloads, S3, "foo")[0]()   ));
+        static assert(!__traits(compiles, { __traits(getOverloads, S3, "foo")[0](); }));
+        static assert(!__traits(compiles,   __traits(getOverloads, T3, "foo")[0]()   ));
+        static assert(!__traits(compiles, { __traits(getOverloads, T3, "foo")[0](); }));
+    }
+}
+
+void test3()
+{
+}
+
+/********************************************************/
+
+void test4()
+{
+    static struct R
+    {
+        void opIndex(int) {}
+        void opSlice() {}
+        void opSlice(int, int) {}
+        int opDollar() { return 1; }
+        alias length = opDollar;
+    }
+
+    R val;
+    static struct S
+    {
+        R val;
+        void foo()
+        {
+            static assert(__traits(compiles, val[1]));              // TypeSArray
+            static assert(__traits(compiles, val[]));               // TypeDArray
+            static assert(__traits(compiles, val[0..val.length]));  // TypeSlice
+        }
+    }
+}
+
+/********************************************************/
+
+template Test5(string name, bool result)
+{
+    mixin(`static assert(__traits(compiles, `~name~`.add!"months"(1)) == result);`);
+}
+
+static struct Begin5
+{
+    void add(string s)(int n) {}
+}
+
+struct IntervalX5(TP)
+{
+    Begin5 begin;
+
+    static assert(__traits(compiles, begin.add!"months"(1)) == true);
+    mixin Test5!("begin", true);
+
+    void foo()
+    {
+        static assert(__traits(compiles, begin.add!"months"(1)) == true);
+        mixin Test5!("begin", true);
+    }
+    static test()
+    {
+        static assert(__traits(compiles, begin.add!"months"(1)) == false);
+        mixin Test5!("begin", false);
+    }
+}
+
+alias IX5 = IntervalX5!int;
+alias beginX5 = IX5.begin;
+static assert(__traits(compiles, beginX5.add!"months"(1)) == false);
+mixin Test5!("beginG5", false);
+
+void test5()
+{
+    static struct IntervalY5(TP)
+    {
+        Begin5 begin;
+
+        static assert(__traits(compiles, begin.add!"months"(1)) == true);
+        mixin Test5!("begin", true);
+
+        void foo()
+        {
+            static assert(__traits(compiles, begin.add!"months"(1)) == true);
+            mixin Test5!("begin", true);
+        }
+        static test()
+        {
+            static assert(__traits(compiles, begin.add!"months"(1)) == false);
+            mixin Test5!("begin", false);
+        }
+    }
+
+    alias IX = IntervalX5!int;
+    alias beginX = IX.begin;
+    static assert(__traits(compiles, beginX.add!"months"(1)) == false);
+    mixin Test5!("beginX", false);
+
+    alias IY = IntervalY5!int;
+    alias beginY = IY.begin;
+    static assert(__traits(compiles, beginY.add!"months"(1)) == false);
+    mixin Test5!("beginY", false);
+}
+
+/********************************************************/
+
+void test6()
+{
+    static struct Foo
+    {
+        static struct Bar
+        {
+            static int get() { return 0; }
+            static int val;
+            void set() { assert(0); }
+            int num;
+        }
+        static class Baz
+        {
+            static int get() { return 0; }
+            static int val;
+            void set() { assert(0); }
+            int num;
+        }
+        Bar bar;
+        Baz baz;
+    }
+
+    // allowed cases that do 'use' Foo.bar without this
+    assert(Foo.bar.get() == 0);         // Foo.bar.get()
+    assert(Foo.baz.get() == 0);         // Foo.bar.get()
+    static assert(!__traits(compiles, Foo.bar.set()));
+    static assert(!__traits(compiles, Foo.baz.set()));
+
+    assert(Foo.bar.val == 0);           // Foo.bar.val
+    assert(Foo.baz.val == 0);           // Foo.baz.val
+    static assert(!__traits(compiles, Foo.bar.num = 1));
+    static assert(!__traits(compiles, Foo.baz.num = 1));
+}
+
+/********************************************************/
+
+struct Tuple7(T...)
+{
+    T field;
+
+    enum check1 = is(typeof(field[0] = 1));
+    enum check2 = is(typeof({ field[0] = 1; }));
+
+    this(U, size_t n)(U[n] values)
+    if (is(typeof({ foreach (i, _; T) field[0] = values[0]; })))
+    {}
+}
+
+void test7()
+{
+    alias Tuple7!(int, int) Tup7;
+    static assert(Tup7.check1);
+    static assert(Tup7.check2);
+    int[2] ints = [ 1, 2 ];
+    Tup7 t = ints;
+
+    struct S7
+    {
+        int value;
+
+        enum check1 = is(typeof(value = 1));
+        enum check2 = is(typeof({ value = 1; }));
+
+        void foo()(int v)
+        if (is(typeof({
+            value = v;  // valid
+        }))) {}
+
+        static void bar()(int v)
+        if (is(typeof({
+            value = v;  // always invalid
+        }))) {}
+    }
+    static assert(S7.check1);
+    static assert(S7.check2);
+    S7 s;
+    s.foo(1);
+    static assert(!__traits(compiles, S7.bar(1)));
+}
+
+/********************************************************/
+// 6430
+
+auto bug6430(int a)
+{
+    static struct Result2 {}
+    return 4;
+}
+auto bug6430(int a, int b)
+{
+    static struct Result2
+    {
+        int z;
+        int y() { return z; }
+    }
+    auto t = Result2(1);
+    return 5;
+}
+
+/********************************************************/
+// 9619
+
+struct Foo9619 { int x; }
+void test9619()
+{
+    void bar()
+    {
+        typeof(Foo9619.x) y;
+    }
+}
+
+/********************************************************/
+// 9633
+
+class Foo9633
+{
+    void baz() {}
+    void bar()
+    {
+        // CallExp::e1->op == TOKvar
+        static assert(!compilesWithoutThis9633!baz);
+    }
+    void vaz()()
+    {
+        static class C
+        {
+            // CallExp::e1->op == TOKtemplate
+            static assert(!__traits(compiles, vaz()));
+        }
+    }
+}
+
+template compilesWithoutThis9633(alias F)
+{
+    enum bool compilesWithoutThis9633 = __traits(compiles, F());
+}
+
+void test9633()
+{
+    auto foo = new Foo9633;
+    foo.bar();
+    foo.vaz();
+}
+
+/********************************************************/
+// 11245
+
+struct Vec11245
+{
+    float[2] f;
+}
+
+class Bar11245
+{
+    void func()
+    {
+        pragma(msg, "====");
+        float[Vec11245.f.length] newVal;
+    }
+}
+
+/********************************************************/
+// 11614
+
+struct Tuple11614(T...)
+{
+    T field;
+    alias field this;
+}
+
+struct Foo11614
+{
+    alias Tuple11614!(int) NEW_ARGS;
+
+    NEW_ARGS args;
+
+    void foo()
+    {
+        static if (NEW_ARGS.length == 1)
+        {}
+        else
+            static assert(0);
+    }
+}
+
+/********************************************************/
+// 11993
+
+struct S11993
+{
+    void foo()() const
+    if (is(typeof(this) == const(S11993)))
+    {}
+
+    const void bar()()
+    if (is(typeof(this) == const(S11993)))
+    {}
+}
+
+void test11993()
+{
+    S11993 s;
+    s.foo();
+    s.bar();
+}
+
+/********************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test9619();
+    test9633();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testsafe.d b/gcc/testsuite/gdc.test/runnable/testsafe.d
new file mode 100644
index 00000000000..d41de317632
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testsafe.d
@@ -0,0 +1,506 @@
+// PERMUTE_ARGS:
+
+//http://d.puremagic.com/issues/show_bug.cgi?id=5415
+
+@safe
+void pointercast()
+{
+    int* a;
+    void* b;
+
+    static assert( __traits(compiles, cast(void*)a));
+    static assert(!__traits(compiles, cast(int*)b));
+    static assert(!__traits(compiles, cast(int*)b));
+    static assert(!__traits(compiles, cast(short*)b));
+    static assert(!__traits(compiles, cast(byte*)b));
+    static assert( __traits(compiles, cast(short*)a));
+    static assert( __traits(compiles, cast(byte*)a));
+}
+
+@safe
+void pointercast2()
+{
+    size_t a;
+    int b;
+    Object c;
+
+    static assert(!__traits(compiles, cast(void*)a));
+    static assert(!__traits(compiles, cast(void*)b));
+    static assert(!__traits(compiles, cast(void*)c));
+}
+
+@safe
+void pointerarithmetic()
+{//http://d.puremagic.com/issues/show_bug.cgi?id=4132
+    void* a;
+    int b;
+
+    static assert(!__traits(compiles, a + b));
+    static assert(!__traits(compiles, a - b));
+    static assert(!__traits(compiles, a += b));
+    static assert(!__traits(compiles, a -= b));
+    static assert(!__traits(compiles, a++));
+    static assert(!__traits(compiles, a--));
+    static assert(!__traits(compiles, ++a));
+    static assert(!__traits(compiles, --a));
+    static assert( __traits(compiles, a + 0));
+    static assert( __traits(compiles, a - 0));
+    static assert( __traits(compiles, 0 + a));
+    static assert(!__traits(compiles, a + 1));
+    static assert(!__traits(compiles, a - 1));
+    static assert(!__traits(compiles, 1 + a));
+    static assert( __traits(compiles, a += 0));
+    static assert( __traits(compiles, a -= 0));
+    static assert(!__traits(compiles, a += 1));
+    static assert(!__traits(compiles, a -= 1));
+}
+
+
+
+union SafeUnion1
+{
+    int a;
+    struct
+    {
+        int b;
+        int* c;
+    }
+}
+union SafeUnion2
+{
+    int a;
+    struct
+    {
+        int b;
+        int c;
+    }
+}
+union UnsafeUnion1
+{
+    int a;
+    int* c;
+}
+union UnsafeUnion2
+{
+    int a;
+    align(1)
+    struct
+    {
+        byte b;
+        int* c;
+    }
+}
+union UnsafeUnion3
+{
+    int a;
+    Object c;
+}
+union UnsafeUnion4
+{
+    int a;
+    align(1)
+    struct
+    {
+        byte b;
+        Object c;
+    }
+}
+struct pwrapper
+{
+    int* a;
+}
+union UnsafeUnion5
+{
+    SafeUnion2 x;
+    pwrapper b;
+}
+
+union uA
+{
+    struct
+    {
+        int* a;
+        void* b;
+    }
+}
+struct uB
+{
+    uA a;
+}
+struct uC
+{
+    uB a;
+}
+struct uD
+{
+    uC a;
+}
+
+@safe
+void safeunions()   // improved for issue 11510
+{
+    SafeUnion1 su1;
+    SafeUnion2 su2;
+    UnsafeUnion1 uu1;
+    UnsafeUnion2 uu2;
+    UnsafeUnion3 uu3;
+    UnsafeUnion4 uu4;
+    UnsafeUnion5 uu5;
+    uD uud;
+
+    int n;
+    void* p;
+    Object o;
+
+    // Writing field is always allowed, even if it is overlapped.
+    su1.a = 7, su1.b = 8, su1.c = null;
+    su2.a = 7, su2.b = 8, su2.c = 9;
+    uu1.a = 7,            //uu1.c = null;
+    uu2.a = 7; uu2.b = 8, //uu2.c = null;
+    uu3.a = 7;            //uu3.c = null;
+    uu4.a = 7; uu4.b = 8, //uu4.c = null;
+    uu5.x.a = 7; uu5.x.b = 8, uu5.x.c = 9;
+    uud.a.a.a.a = null, uud.a.a.a.b = null;
+
+    // Reading field is allowed, if it is not overlapped or has no pointers.
+    n = su1.a, n = su1.b, p = su1.c;
+    n = su2.a, n = su2.b, n = su2.c;
+    n = uu1.a;
+    n = uu2.a, n = uu2.b;
+    n = uu3.a;
+    n = uu4.a, n = uu4.b;
+    n = uu5.x.a, n = uu5.x.b, n = uu5.x.c;
+    p = uud.a.a.a.a, p = uud.a.a.a.b;
+
+    // Reading overlapped pointer field is not allowed.
+    static assert(!__traits(compiles, () @safe { auto p = uu1.c; }));
+    static assert(!__traits(compiles, () @safe { auto p = uu2.c; }));
+    static assert(!__traits(compiles, () @safe { auto c = uu3.c; }));
+    static assert(!__traits(compiles, () @safe { auto c = uu4.c; }));
+    static assert(!__traits(compiles, () @safe { auto p = uu5.b.a; }));
+}
+
+
+
+@safe
+void safeexception()
+{
+    try {}
+    catch(Exception e) {}
+
+    static assert(!__traits(compiles, () @safe {
+        try {}
+        catch(Error e) {}
+    }));
+
+    static assert(!__traits(compiles, () @safe {
+        try {}
+        catch(Throwable e) {}
+    }));
+
+    static assert(!__traits(compiles, () @safe {
+        try {}
+        catch {}
+    }));
+}
+
+@safe
+void inlineasm()
+{
+    version(GNU)
+    {
+        version(X86)
+            static assert(!__traits(compiles, { asm { "nop"; } }() ));
+        else version(X86_64)
+            static assert(!__traits(compiles, { asm { "nop"; } }() ));
+        else version(ARM)
+            static assert(!__traits(compiles, { asm { "nop"; } }() ));
+        else
+            static assert(false, "ASM code not implemented for this architecture");
+    }
+    else
+        static assert(!__traits(compiles, { asm { int 3; } }() ));
+}
+
+@safe
+void multablecast()
+{
+    Object m;
+    const(Object) c;
+    immutable(Object) i;
+
+    static assert( __traits(compiles, cast(const(Object))m));
+    static assert( __traits(compiles, cast(const(Object))i));
+
+    static assert(!__traits(compiles, cast(immutable(Object))m));
+    static assert(!__traits(compiles, cast(immutable(Object))c));
+
+    static assert(!__traits(compiles, cast(Object)c));
+    static assert(!__traits(compiles, cast(Object)i));
+
+    void* mp;
+    const(void)* cp;
+    immutable(void)* ip;
+
+    static assert( __traits(compiles, cast(const(void)*)mp));
+    static assert( __traits(compiles, cast(const(void)*)ip));
+
+    static assert(!__traits(compiles, cast(immutable(void)*)mp));
+    static assert(!__traits(compiles, cast(immutable(void)*)cp));
+
+    static assert(!__traits(compiles, cast(void*)cp));
+    static assert(!__traits(compiles, cast(void*)ip));
+}
+
+@safe
+void sharedcast()
+{
+    Object local;
+    shared(Object) xshared;
+    immutable(Object) ishared;
+
+    static assert(!__traits(compiles, cast()xshared));
+    static assert(!__traits(compiles, cast(shared)local));
+
+    static assert(!__traits(compiles, cast(immutable)xshared));
+    static assert(!__traits(compiles, cast(shared)ishared));
+}
+
+int threadlocalvar;
+
+@safe
+void takeaddr()
+{
+    static assert(!__traits(compiles, (int x) @safe { auto y = &x; } ));
+    static assert(!__traits(compiles, () @safe { int x; auto y = &x; } ));
+    static assert( __traits(compiles, () @safe { static int x; auto y = &x; } ));
+    static assert( __traits(compiles, () @safe { auto y = &threadlocalvar; } ));
+}
+
+__gshared int gsharedvar;
+
+@safe
+void use__gshared()
+{
+    static assert(!__traits(compiles, () @safe { int x = gsharedvar; } ));
+}
+
+@safe
+void voidinitializers()
+{//http://d.puremagic.com/issues/show_bug.cgi?id=4885
+    static assert(!__traits(compiles, () @safe { uint* ptr = void; } ));
+    static assert( __traits(compiles, () @safe { uint i = void; } ));
+    static assert( __traits(compiles, () @safe { uint[2] a = void; } ));
+
+    struct ValueStruct { int a; }
+    struct NonValueStruct { int* a; }
+    static assert( __traits(compiles, () @safe { ValueStruct a = void; } ));
+    static assert(!__traits(compiles, () @safe { NonValueStruct a = void; } ));
+
+    static assert(!__traits(compiles, () @safe { uint[] a = void; } ));
+    static assert(!__traits(compiles, () @safe { int** a = void; } ));
+    static assert(!__traits(compiles, () @safe { int[int] a = void; } ));
+}
+
+@safe
+void pointerindex()
+{//http://d.puremagic.com/issues/show_bug.cgi?id=9195
+    static assert(!__traits(compiles, () @safe { int* p; auto a = p[30]; }));
+    static assert( __traits(compiles, () @safe{ int* p; auto a = p[0]; }));
+}
+
+@safe
+void basiccast()
+{//http://d.puremagic.com/issues/show_bug.cgi?id=5088
+    auto a = cast(int)cast(const int)1;
+    auto b = cast(real)cast(const int)1;
+    auto c = cast(real)cast(const real)2.0;
+}
+
+@safe
+void arraycast()
+{
+    int[] x;
+    void[] y = x;
+    static assert( __traits(compiles, cast(void[])x));
+    static assert(!__traits(compiles, cast(int[])y));
+    static assert(!__traits(compiles, cast(int*[])y));
+    static assert(!__traits(compiles, cast(void[][])y));
+
+    int[3] a;
+    int[] b = cast(int[])a;
+    uint[3] c = cast(uint[3])a;
+
+    const char[] cc;
+    static assert( __traits(compiles, cast(const(ubyte)[])cc));
+    static assert( __traits(compiles, cast(const(ubyte[]))cc));
+    static assert(!__traits(compiles, cast(shared(ubyte)[])cc));
+
+    shared char[] sc;
+    static assert( __traits(compiles, cast(shared(ubyte)[])sc));
+    static assert( __traits(compiles, cast(shared(ubyte[]))sc));
+    static assert(!__traits(compiles, cast(const(ubyte)[])sc));
+}
+
+@safe
+void structcast()
+{
+    struct A { ptrdiff_t x; }
+    struct B { size_t x; }
+    struct C { void* x; }
+    A a;
+    B b;
+    C c;
+
+    static assert( __traits(compiles, a = cast(A)b));
+    static assert( __traits(compiles, a = cast(A)c));
+    static assert( __traits(compiles, b = cast(B)a));
+    static assert( __traits(compiles, b = cast(B)c));
+    static assert(!__traits(compiles, c = cast(C)a));
+    static assert(!__traits(compiles, c = cast(C)b));
+}
+
+@safe void test6497()
+{
+    int n;
+    (0 ? n : n) = 3;
+}
+
+@safe
+void varargs()
+{
+    static void fun(string[] val...) {}
+    fun("a");
+}
+
+extern(C++) interface E {}
+extern(C++) interface F : E {}
+
+@safe
+void classcast()
+{
+    class A {};
+    class B : A {};
+
+    A a;
+    B b;
+
+    static assert( __traits(compiles, cast(A)a));
+    static assert( __traits(compiles, cast(B)a));
+    static assert( __traits(compiles, cast(A)b));
+    static assert( __traits(compiles, cast(B)b));
+
+    const A ca;
+    const B cb;
+
+    static assert( __traits(compiles, cast(const(A))ca));
+    static assert( __traits(compiles, cast(const(B))ca));
+    static assert( __traits(compiles, cast(const(A))cb));
+    static assert( __traits(compiles, cast(const(B))cb));
+
+    static assert(!__traits(compiles, cast(A)ca));
+    static assert(!__traits(compiles, cast(B)ca));
+    static assert(!__traits(compiles, cast(A)cb));
+    static assert(!__traits(compiles, cast(B)cb));
+
+    interface C {};
+    interface D : C {};
+
+    C c;
+    D d;
+
+    static assert( __traits(compiles, cast(C)c));
+    static assert( __traits(compiles, cast(D)c));
+    static assert( __traits(compiles, cast(C)d));
+    static assert( __traits(compiles, cast(D)d));
+
+    E e;
+    F f;
+
+    static assert( __traits(compiles, cast(E)e));
+    static assert(!__traits(compiles, cast(F)e));
+    static assert( __traits(compiles, cast(E)f));
+    static assert( __traits(compiles, cast(F)f));
+}
+
+/***************************************************/
+// 6278
+
+@safe
+{
+
+class A6278 {
+    int test()
+    in { assert(0); }
+    body { return 1; }
+}
+class B6278 : A6278 {
+    override int test()
+    in { assert(0); }
+    body { return 1; }
+}
+
+}
+
+/***************************************************/
+// 7803
+
+@safe int f7803() {
+    scope(success) {/* ... */}
+    return 3;
+}
+
+nothrow int g7803() {
+    scope(success) {/* ... */}
+    return 3;
+}
+
+/***************************************************/
+// 6405
+
+void foo6405(int[][] args...) @trusted { }
+void test6405() @safe { foo6405([1,2,3], [1,2,3]); }
+
+/***************************************************/
+// 12502
+
+void test12502() @safe
+{
+    const char[1] arr;
+    auto ax = cast(const(char) []) arr[]; // ok
+    auto a1 = cast(const(ubyte)[]) arr[]; // ok
+    auto a2 = cast(const(char) []) arr;   // ok
+    auto a3 = cast(const(ubyte)[]) arr;   // ok <- error
+}
+
+/***************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=14162
+
+@trusted auto trusted(alias fun)() { return fun(); }
+
+@safe void func1()()
+{
+    char[3] s = "abc";
+    string t = trusted!(() => cast(string)(s[]));
+    assert(t == "abc");
+}
+
+@safe void func2()()
+{
+    char[3] s = "abc";
+    string t = trusted!(() => cast(string)(s[]));
+    assert(t == "abc");
+}
+
+@safe void test14162()
+{
+    func1();
+    func2();
+}
+
+/***************************************************/
+
+void main()
+{
+    test14162();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testscope.d b/gcc/testsuite/gdc.test/runnable/testscope.d
new file mode 100644
index 00000000000..f731ac46750
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testscope.d
@@ -0,0 +1,333 @@
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+class Eh : Exception
+{
+    this()
+    {
+        super("Eh thrown");
+    }
+}
+
+
+/********************************************/
+
+class Foo
+{
+    static int x;
+
+    this()
+    {
+        assert(x == 0);
+        x++;
+        printf("Foo.this()\n");
+        throw new Eh();
+        assert(0);
+    }
+
+    ~this()
+    {
+        printf("Foo.~this()\n");
+    }
+}
+
+void test1()
+{
+    try
+    {
+        scope Foo f = new Foo();
+        assert(0);
+    }
+    catch (Eh)
+    {
+        assert(Foo.x == 1);
+        Foo.x++;
+    }
+    finally
+    {
+        assert(Foo.x == 2);
+        Foo.x++;
+    }
+    assert(Foo.x == 3);
+}
+
+/********************************************/
+
+void test2()
+{
+    int x;
+    {
+        scope (exit) { printf("test1\n"); assert(x == 3); x = 4; }
+        scope (exit) { printf("test2\n"); assert(x == 2); x = 3; }
+        scope (exit) { printf("test3\n"); assert(x == 1); x = 2; }
+        printf("test4\n"); assert(x == 0); x = 1;
+    }
+    assert(x == 4);
+}
+
+/********************************************/
+
+void test3()
+{
+    int x;
+    {
+        scope (success) { printf("test1\n"); assert(x == 3); x = 4; }
+        scope (success) { printf("test2\n"); assert(x == 2); x = 3; }
+        scope (success) { printf("test3\n"); assert(x == 1); x = 2; }
+        printf("test4\n"); assert(x == 0); x = 1;
+    }
+    assert(x == 4);
+}
+
+/********************************************/
+
+void test4()
+{
+    int x;
+    try
+    {
+        scope (exit) { printf("test1\n"); assert(x == 3); x = 4; }
+        scope (exit) { printf("test2\n"); assert(x == 2); x = 3; }
+        x = 2;
+        throw new Eh;
+        scope (exit) { printf("test3\n"); assert(x == 1); x = 2; }
+        printf("test4\n"); assert(x == 0); x = 1;
+    }
+    catch (Eh e)
+    {
+    }
+    assert(x == 4);
+}
+
+/********************************************/
+
+void test5()
+{
+    int x;
+    try
+    {
+        scope (success) { printf("test1\n"); assert(x == 3); x = 4; }
+        scope (success) { printf("test2\n"); assert(x == 2); x = 3; }
+        x = 2;
+        throw new Eh;
+        scope (success) { printf("test3\n"); assert(x == 1); x = 2; }
+        printf("test4\n"); assert(x == 0); x = 1;
+    }
+    catch (Eh e)
+    {
+    }
+    assert(x == 2);
+}
+
+/********************************************/
+
+void test6()
+{
+    int x;
+    scope (failure) { assert(0); }
+    try
+    {
+        scope (failure) { printf("test1\n"); assert(x == 3); x = 4; }
+        scope (failure) { printf("test2\n"); assert(x == 2); x = 3; }
+        x = 2;
+        throw new Eh;
+        scope (failure) { printf("test3\n"); assert(x == 1); x = 2; }
+        printf("test4\n"); assert(x == 0); x = 1;
+    }
+    catch (Eh e)
+    {
+    }
+    assert(x == 4);
+}
+
+/********************************************/
+
+void test7()
+{   int i;
+    int x;
+
+    void foo()
+    {
+        scope (success) { assert(x == 1); x = 2; }
+        i = 2;
+        if (i == 2)
+            return;
+    }
+
+    i = 1;
+    x = 1;
+    foo();
+    assert(x == 2);
+}
+
+/********************************************/
+
+
+void test8()
+{
+    int i;
+    {
+        version (all)
+        {
+            scope (exit) i += 2;
+        }
+        assert(i == 0);
+        i += 1;
+        printf("betty\n");
+    }
+    assert(i == 3);
+}
+
+/********************************************/
+
+char[] r9;
+
+int scp( int n )
+{
+    if( n==0 ) return 0;
+    scope(exit)
+    {   printf("%d",n);
+        r9 ~= cast(char)(n + '0');
+    }
+    return scp(n-1);
+}
+
+void test9()
+{
+    scp(5);
+    assert(r9 == "12345");
+}
+
+/********************************************/
+
+alias real T;
+
+T readMessageBegin() { return 3.0; }
+
+T bar10() { return 8.0; }
+
+T foo10() {
+  // Send RPC request, etc.
+  readMessageBegin();
+  scope (exit) readMessageEnd();
+
+  T result = bar10();
+  // Read message off the wire.
+  return result;
+}
+
+void test10()
+{
+    if (foo10() != 8.0)
+        assert(0);
+}
+
+T readMessageEnd() {
+    static T d;
+    d = 4.0;
+    d = (((((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d))))+(((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d)))))/((((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d))))+(((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d)))))+((((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d))))+(((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d)))))/((((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d))))+(((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d))))))*(((((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d))))+(((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d)))))/((((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d))))+(((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d)))))+((((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d))))+(((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d)))))/((((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d))))+(((d-(2*d))+(d-(2*d)))*((d-(2*d))+(d-(2*d))))));
+    return 4.0;
+}
+
+/********************************************/
+
+void test7435() {
+  scope(failure)
+    debug printf("error\n");
+
+  printf("do something\n");
+}
+
+/********************************************/
+
+void test7049() @safe
+{
+    int count = 0;
+    @safe void foo()
+    {
+        scope (failure) { count++; }
+        scope (failure) { count++; }
+        throw new Exception("failed");
+    }
+
+    try {
+        foo();
+    } catch(Exception e) {
+    }
+    assert(count == 2);
+}
+
+/********************************************/
+
+// https://issues.dlang.org/show_bug.cgi?id=16747
+
+void test16747() @safe
+{
+    scope o = new Object();
+}
+
+/********************************************/
+// https://issues.dlang.org/show_bug.cgi?id=17432
+
+int test17432(scope int delegate() dg)
+{
+        return dg();
+}
+
+// stripped down version of std.traits.Parameters
+template Parameters(alias func)
+{
+    static if (is(typeof(func) P == function))
+        alias Parameters = P;
+    else
+        static assert(0, "unsupported");
+}
+
+alias op = Parameters!(test17432)[0];
+enum typeString = op.stringof;
+static assert(typeString == "int delegate()"); // no scope added?
+mixin(typeString ~ " dg;");
+alias ty = typeof(dg);
+
+static assert(op.stringof == ty.stringof);
+static assert(op.mangleof == ty.mangleof);
+
+void test17432_2()(scope void delegate () dg) { dg(); }
+
+static assert(typeof(&test17432_2!()).stringof == "void function(scope void delegate() dg) @system");
+
+/********************************************/
+
+byte typify13(T)(byte val) { return val; }
+alias INT8_C13  = typify13!byte;
+
+/********************************************/
+
+template test14(T)
+{
+    alias test14 = int;
+}
+
+test14!(char[] function(return char[])) x14;
+
+/********************************************/
+
+void main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test7435();
+    test7049();
+    test16747();
+
+    printf("Success\n");
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testscope2.d b/gcc/testsuite/gdc.test/runnable/testscope2.d
new file mode 100644
index 00000000000..ae4e3d7249c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testscope2.d
@@ -0,0 +1,248 @@
+// REQUIRED_ARGS: -dip25
+
+import core.stdc.stdio;
+
+/********************************************/
+
+struct SS
+{
+    ref ulong foo1(return ref int* delegate() return p) return;
+    ref int foo2(return ref int delegate() p);
+    ref int foo3(inout ref int* p);
+    ref int foo4(return inout ref int* p);
+}
+
+pragma(msg, "foo1 ", typeof(&SS.foo1));
+pragma(msg, "foo2 ", typeof(&SS.foo2));
+pragma(msg, "foo3 ", typeof(&SS.foo3));
+pragma(msg, "foo4 ", typeof(&SS.foo4));
+
+
+void test3()
+{
+    version (all)
+    {
+        import std.stdio;
+        writeln(SS.foo1.mangleof);
+        writeln(SS.foo2.mangleof);
+        writeln(SS.foo3.mangleof);
+        writeln(SS.foo4.mangleof);
+        writeln(typeof(SS.foo1).stringof);
+        writeln(typeof(SS.foo2).stringof);
+        writeln(typeof(SS.foo3).stringof);
+        writeln(typeof(SS.foo4).stringof);
+    }
+
+    version (all)
+    {
+        // Test scope mangling
+        assert(SS.foo1.mangleof == "_D10testscope22SS4foo1MFNcNjNkKDFNjZPiZm");
+        assert(SS.foo2.mangleof == "_D10testscope22SS4foo2MFNcNkKDFZiZi");
+        assert(SS.foo3.mangleof == "_D10testscope22SS4foo3MFNcNkKNgPiZi");
+        assert(SS.foo4.mangleof == "_D10testscope22SS4foo4MFNcNkKNgPiZi");
+
+        // Test scope pretty-printing
+        assert(typeof(SS.foo1).stringof == "ref return ulong(return ref int* delegate() return p)");
+        assert(typeof(SS.foo2).stringof == "ref int(return ref int delegate() p)");
+        assert(typeof(SS.foo3).stringof == "ref int(return ref inout(int*) p)");
+        assert(typeof(SS.foo4).stringof == "ref int(return ref inout(int*) p)");
+    }
+}
+
+/********************************************/
+
+ref int foo(return ref int x)
+{
+    return x;
+}
+
+struct S
+{
+    int x;
+
+    ref S bar() return
+    {
+        return this;
+    }
+}
+
+ref T foo2(T)(ref T x)
+{
+    return x;
+}
+
+void test4()
+{
+    int x;
+    foo2(x);
+}
+
+/********************************************/
+
+ref int foo(return ref int x, ref int y)
+{
+    return x;
+}
+
+ref int bar()
+{
+    int x;
+    static int y = 7;
+    return foo(y, x);
+}
+
+void test5()
+{
+    int x = bar();
+    assert(x == 7);
+}
+
+/********************************************/
+
+struct S6
+{
+    int x = 8;
+
+    ref int bar() return
+    {
+        return x;
+    }
+}
+
+void test6()
+{
+    S6 s;
+    int b = s.bar();
+    assert(b == 8);
+}
+
+/********************************************/
+
+class C
+{
+    int x;
+    ref int foo(return ref int x) { return x; }
+    ref int bar() return { return x; }
+}
+
+class D : C
+{
+    override ref int foo(ref int x) { static int y; return y; }
+    override ref int bar() { static int y; return y; }
+}
+
+void test7()
+{
+}
+
+/********************************************/
+
+struct S8(T)
+{
+    int x;
+
+    ref int bar() // infer 'return'
+    {
+        return x;
+    }
+}
+
+ref int test8a(return ref S8!int s)
+{
+    return s.bar();
+}
+
+void test8()
+{
+}
+
+/********************************************/
+
+char[] foo9(return out char[4] buf)
+{
+    return buf[0 .. 1];
+}
+
+/********************************************/
+
+struct S10
+{
+    int x;
+
+    ref inout(int) foo() inout
+    {
+        return x;
+    }
+}
+
+/********************************************/
+
+struct RC
+{
+    this(this) { }
+}
+
+struct S11
+{
+    @disable this(this);
+
+    void remove()
+    {
+        _ptr[0] = _ptr[1];
+    }
+
+    RC* _ptr;
+}
+
+
+void test11()
+{
+    S11 ary;
+}
+
+/********************************************/
+
+int[10] a12;
+
+int* foo12()
+{
+    foreach (ref x; a12)
+        return &x;
+    return null;
+}
+
+/********************************************/
+
+struct FullCaseEntry
+{
+    dchar[3] seq;
+    ubyte n, size;// n number in batch, size - size of batch
+    ubyte entry_len;
+
+    @property auto value() const @trusted pure nothrow @nogc return
+    {
+        return seq[0..entry_len];
+    }
+}
+
+/********************************************/
+
+class C12
+{
+    void member() scope { }
+}
+
+/********************************************/
+
+void main()
+{
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test11();
+    printf("Success\n");
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/testsignals.d b/gcc/testsuite/gdc.test/runnable/testsignals.d
new file mode 100644
index 00000000000..619be73d2f8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testsignals.d
@@ -0,0 +1,113 @@
+import std.stdio;
+import std.signals;
+
+class Observer
+{   // our slot
+    void watch(string msg, int i)
+    {
+        writefln("Observed msg '%s' and value %s", msg, i);
+    }
+
+    void watch2(int i, int j)
+    {
+        writefln("Observed msg %s,%s", i, j);
+    }
+}
+
+class Foo
+{
+    int value() { return _value; }
+
+    int value(int v)
+    {
+        if (v != _value)
+        {   _value = v;
+            // call all the connected slots with the two parameters
+            emit("setting new value", v);
+        }
+        return v;
+    }
+
+    // Mix in all the code we need to make Foo into a signal
+    mixin Signal!(string, int);
+
+  private :
+    int _value;
+}
+
+void test1()
+{
+    Foo a = new Foo;
+    Observer o = new Observer;
+
+    a.value = 3;                // should not call o.watch()
+    a.connect(&o.watch);        // o.watch is the slot
+    a.value = 4;                // should call o.watch()
+    a.disconnect(&o.watch);     // o.watch is no longer a slot
+    a.value = 5;                // so should not call o.watch()
+    a.connect(&o.watch);        // connect again
+    a.value = 6;                // should call o.watch()
+    delete o;                   // destroying o should automatically disconnect it
+    a.value = 7;                // should not call o.watch()
+}
+
+/******************************************/
+
+class Input
+{
+    mixin Signal!(int, int) click;
+    mixin Signal!(char) keyDown;
+}
+
+void test2()
+{
+    Observer o = new Observer();
+    Input a = new Input();
+    a.click.connect(&o.watch2);
+    a.click.emit(5,6);
+}
+
+/******************************************/
+
+class Args3
+{
+        int foo;
+}
+
+class Base3
+{
+        ~this()
+        {
+                writefln("Base3 dtor!");
+        }
+}
+
+class Test3 : Base3
+{
+        mixin Signal!(Args3) A;
+        mixin Signal!(Args3) B;
+
+        ~this()
+        {
+                writefln("Test3 dtor");
+        }
+}
+
+
+void test3()
+{
+        auto test = new Test3;
+}
+
+
+/******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testsocket.d b/gcc/testsuite/gdc.test/runnable/testsocket.d
new file mode 100644
index 00000000000..3d153d61b0e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testsocket.d
@@ -0,0 +1,50 @@
+// PERMUTE_ARGS:
+
+import std.stdio;
+import std.socket;
+
+class Connection
+{
+        private
+        {
+                Socket sock;
+        }
+
+        void connect (string host, ushort port)
+        {
+                sock.connect (new InternetAddress (host, port));
+        }
+
+        void poll ()
+        {
+                SocketSet rset = new SocketSet (1); /** XXX: here is the bug */
+
+                rset.reset ();
+                rset.add (sock);
+        }
+
+        this ()
+        {
+
+                sock = new TcpSocket;
+                sock.blocking = false;
+        }
+}
+
+int main ()
+{
+        try
+        {
+            Connection ns;
+            ns = new Connection ();
+            ns.connect ("localhost", 80);
+            ns.poll ();
+            delete ns;
+        }
+        catch(SocketException e)
+        {
+        }
+        return 0;
+}
+
+
diff --git a/gcc/testsuite/gdc.test/runnable/teststdio.d b/gcc/testsuite/gdc.test/runnable/teststdio.d
new file mode 100644
index 00000000000..b5cc44480dc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/teststdio.d
@@ -0,0 +1,33 @@
+// PERMUTE_ARGS:
+// EXTRA_FILES: extra-files/teststdio.txt
+
+import std.stdio;
+import core.stdc.stdio;
+
+void main()
+{
+    auto f = std.stdio.File("runnable/extra-files/teststdio.txt", "r");
+    FILE* fp = f.getFP();
+    string buf;
+    int i;
+    do
+    {
+        buf = f.readln('\n');
+        foreach (c; buf)
+            printf("%x\n", c);
+        printf("\n");
+        switch (i)
+        {
+            case 0:     assert(buf == "asdfasdf\n"); break;
+            case 1:     assert(buf == "a\n"); break;
+            case 2:     assert(buf == "sdf\n"); break;
+            case 3:     assert(buf == "asdf\n"); break;
+            case 4:     assert(buf == "\n"); break;
+            case 5:     assert(buf == "\n"); break;
+            case 6:     assert(buf == null); break;
+            default:    assert(0);
+        }
+        i++;
+    } while (!feof(fp));
+    //fclose(fp);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testswitch.d b/gcc/testsuite/gdc.test/runnable/testswitch.d
new file mode 100644
index 00000000000..16843842b56
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testswitch.d
@@ -0,0 +1,716 @@
+// PERMUTE_ARGS: -w
+
+extern(C) int printf(const char*, ...);
+
+int testswitch(string h)
+{
+    int x;
+
+    switch (h)
+    {
+        case "abc":
+            printf("abc\n");
+            x = 4;
+            break;
+        case "foo":
+            printf("foo\n");
+            x = 1;
+            break;
+        case "bar":
+            printf("bar\n");
+            x = 2;
+            break;
+        default:
+            printf("default\n");
+            x = 3;
+            break;
+    }
+    return x;
+}
+
+void test1()
+{
+    int i;
+
+    i = testswitch("foo");
+    printf("i = %d\n", i);
+    assert(i == 1);
+    assert(testswitch("abc") == 4);
+    assert(testswitch("bar") == 2);
+    assert(testswitch("hello") == 3);
+    printf("Success\n");
+}
+
+/*****************************************/
+
+void test2()
+{
+    int i;
+
+    switch (5)
+    {
+        case 3,4,5,6:
+            i = 20;
+            break;
+
+        case 7:
+        default:
+            assert(0);
+    }
+    assert(i == 20);
+}
+
+
+/*****************************************/
+
+void test3()
+{
+    int i;
+
+    switch (5)
+    {
+        case 7:
+            i = 6;
+            goto default;
+        default:
+            i = 8;
+            break;
+
+        case 3,4,5,6:
+            i = 20;
+            goto default;
+    }
+    assert(i == 8);
+}
+
+
+/*****************************************/
+
+void test4()
+{   int i;
+
+    switch (5)
+    {
+        case 3,4,5,6:
+            i = 20;
+            goto default;
+
+        case 7:
+            i = 6;
+            goto default;
+
+        default:
+            i = 8;
+            break;
+    }
+    assert(i == 8);
+}
+
+
+/*****************************************/
+
+void test5()
+{   int i;
+
+    switch (5)
+    {
+        case 7:
+            i = 6;
+            goto case;
+        default:
+            i = 8;
+            break;
+
+        case 3,4,5,6:
+            i = 20;
+            break;
+    }
+    assert(i == 20);
+}
+
+
+/*****************************************/
+
+void test6()
+{
+    int i;
+
+    switch (5)
+    {
+        case 7:
+            i = 6;
+            goto case 4;
+        default:
+            i = 8;
+            break;
+
+        case 3,4,5,6:
+            i = 20;
+            break;
+    }
+    assert(i == 20);
+}
+
+
+/*****************************************/
+
+void test7()
+{
+    int i;
+
+    switch (5)
+    {
+        case 3,4,5,6:
+            i = 20;
+            break;
+
+        case 7:
+            i = 6;
+            goto case 4;
+        default:
+            i = 8;
+            break;
+    }
+    assert(i == 20);
+}
+
+
+/*****************************************/
+
+void test8()
+{
+    dstring str = "xyz";
+    switch (str)
+    {
+        case "xyz":
+            printf("correct\n");
+            return;
+
+        case "abc":
+            break;
+
+        default:
+            assert(0);
+    }
+    assert(0);
+}
+
+/*****************************************/
+
+void test9()
+{
+    int i = 1;
+
+    switch(i)
+    {
+        case 2:
+            return;
+        case 1:
+            switch(i)
+            {
+                case 1:
+                    goto case 2;
+                default:
+                    assert(0);
+            }
+        default:
+            assert(0);
+    }
+    assert(0);
+}
+
+/*****************************************/
+
+void test10()
+{
+    int id1 = 0;
+    int id;
+    switch (id1)
+    {
+        case 0: ++id; goto case;
+        case 7: ++id; goto case;
+        case 6: ++id; goto case;
+        case 5: ++id; goto case;
+        case 4: ++id; goto case;
+        case 3: ++id; goto case;
+        case 2: ++id; goto case;
+        case 1: ++id; goto default;
+        default:
+            break;
+    }
+    assert(id == 8);
+}
+
+/*****************************************/
+
+void test11()
+{
+    long foo = 4;
+    switch (foo)
+    {
+        case 2: assert (false);
+        case 3: break;
+        case 4: break;
+        case 5: break;
+        default: assert(0);
+    }
+}
+
+/*****************************************/
+
+void test12()
+{
+    switch("#!")
+    {
+        case "#!": printf("----Found #!\n");    break;
+        case "\xFF\xFE"c:                       break;
+        default:
+            assert(0);
+    }
+}
+
+/*****************************************/
+
+void test13()
+{
+    switch("#!")
+    {
+        case "#!": printf("----Found #!\n");    break;
+        case "#\xFE"c:                          break;
+        default:
+            assert(0);
+    }
+}
+
+/*****************************************/
+
+void foo14(A...)(int i)
+{
+    switch (i)
+    {
+            foreach(a; A)
+            {
+                goto case;
+            case a:
+                printf("%d\n", a);
+            }
+            break;
+        default:
+            assert(0);
+    }
+}
+
+void bar14(A...)(int i)
+{
+    switch (i)
+    {
+        foreach(j, a; A)
+        {
+            goto case;
+        case A[j]:
+            printf("a = %d, A[%d] = %d\n", a, j, A[j]);
+        }
+        break;
+    default:
+        assert(0);
+    }
+}
+
+void test14()
+{
+    foo14!(1,2,3,4,5)(1);
+    bar14!(1,2,3,4,5)(1);
+}
+
+/*****************************************/
+
+const int X15;
+immutable int Y15;
+const int Z15;
+
+int foo15(int i)
+{
+    auto y = 1;
+    switch (i)
+    {
+        case X15:
+            y += 1;
+            goto case;
+        case 3:
+            y += 2;
+            break;
+        case Y15:
+            y += 20;
+            goto case;
+        case Z15:
+            y += 10;
+            break;
+        default:
+            y += 4;
+            break;
+    }
+    printf("y = %d\n", y);
+    return y;
+}
+
+static this()
+{
+    X15 = 4;
+    Y15 = 4;
+    Z15 = 5;
+}
+
+void test15()
+{
+    auto i = foo15(3);
+    assert(i == 3);
+    i = foo15(4);
+    assert(i == 4);
+    i = foo15(7);
+    assert(i == 5);
+    i = foo15(5);
+    assert(i == 11);
+}
+
+/*****************************************/
+
+enum E16
+{
+    A,B,C
+}
+
+void test16()
+{
+    E16 e = E16.A;
+    final switch (e)
+    {
+        case E16.A:
+        case E16.B:
+        case E16.C:
+        {}
+    }
+}
+
+/*****************************************/
+
+void test17()
+{
+    int i = 2;
+    switch (i)
+    {
+        case 1: .. case 3:
+            i = 5;
+            break;
+        default:
+            assert(0);
+    }
+    if (i != 5)
+        assert(0);
+
+    switch (i)
+    {
+        case 1: .. case 3:
+            i = 4;
+            break;
+        case 5:
+            i = 6;
+            break;
+        default:
+            assert(0);
+    }
+    if (i != 6)
+        assert(0);
+}
+
+/*****************************************/
+
+int test19()
+{
+    enum foo{ bar }
+    foo x;
+    final switch(x){ case foo.bar: return 0; }
+}
+
+/*****************************************/
+
+void test20()
+{
+    switch(1)
+    {
+        mixin("case 0:{}");
+        case 1:
+        case 2:
+        default:
+    }
+}
+
+/*****************************************/
+
+void hang3139(int x)
+{
+   switch(x) {
+        case -9: .. case -1:
+        default:
+   }
+}
+
+int wrongcode3139(int x)
+{
+   switch(x) {
+        case -9: .. case 2: return 3;
+        default:
+        return 4;
+   }
+}
+
+static assert(wrongcode3139(-5)==3);
+
+// bug 3139
+static assert(!is(typeof(
+        (long x) { switch(x) { case long.max: .. case -long.max:
+        default:} return 4; }(3)
+   )));
+
+
+/*****************************************/
+
+void test7358()
+{
+    static void test7358a()
+    {
+        enum X { A = 1, B = 2 }
+
+        auto x = X.A | X.B;
+
+        final switch(x)
+        {
+        case X.A:
+        case X.B:
+            break;
+        }
+    }
+
+    bool exception;
+    try
+        test7358a();
+    catch (Error)
+        exception = true;
+    assert(exception);
+}
+
+/*****************************************/
+// 9263
+
+void test9263()
+{
+    enum Foo { A }
+
+    Foo f;
+    final switch (f) with(Foo)
+    {
+        case A:
+            return;
+    }
+}
+
+/*****************************************/
+
+int bar21(int i)
+{
+    switch (i)
+    {
+//      case 1: return 11;
+        case 2: return 12;
+        case 3: return 13;
+        case 4: return 14;
+        case 5: return 15;
+        case 6: return 16;
+        case 7: return 17;
+        case 8: return 18;
+        case 9: return 19;
+        case 10: return 20;
+        default: break;
+    }
+
+    switch (i)
+    {
+        case 11: return 21;
+        case 12: return 22;
+        case 13: return 23;
+        case 14: return 24;
+        case 15: return 25;
+        case 16: return 26;
+        case 17: return 27;
+        case 18: return 28;
+        case 19: return 29;
+        case 20: return 30;
+        default: return 31;
+    }
+}
+
+void test21()
+{
+//      int j = bar(12);
+//      printf("j = %d\n", j);
+
+    for (int i = 2; i < 21; i++)
+    {
+        int j = bar21(i);
+        //printf("j = %d\n", j);
+        assert(j == i + 10);
+    }
+}
+
+/*****************************************/
+
+int bar22(int i)
+{
+    switch (i)
+    {
+        case 1: return i + 1;
+        case 10: return i + 2;
+        case 20: return i + 3;
+        case 50: return i + 4;
+        case 1000: return i + 5;
+        default: return 28;
+    }
+}
+
+void test22()
+{
+    assert(bar22(1) == 2);
+    assert(bar22(10) == 12);
+    assert(bar22(20) == 23);
+    assert(bar22(50) == 54);
+    assert(bar22(1000) == 1005);
+    assert(bar22(0) == 28);
+    assert(bar22(5) == 28);
+    assert(bar22(15) == 28);
+    assert(bar22(25) == 28);
+    assert(bar22(58) == 28);
+    assert(bar22(2000) == 28);
+}
+
+/*****************************************/
+
+long bar23(long i)
+{
+    switch (i)
+    {
+        case 1: return i + 1;
+        case 0x10_0000_0000L: return i + 2;
+        case 0x20_0070_0000L: return i + 3;
+        case 0x50_0000_0000L: return i + 4;
+        case 0x1000_0000_8000L: return i + 5;
+        default: return 28;
+    }
+}
+
+void test23()
+{
+    assert(bar23(1) == 2);
+    assert(bar23(0x10_0000_0000L) == 0x10_0000_0000L + 2);
+    assert(bar23(0x20_0070_0000L) == 0x20_0070_0000L + 3);
+    assert(bar23(0x50_0000_0000L) == 0x50_0000_0000L + 4);
+    assert(bar23(0x1000_0000_8000L) == 0x1000_0000_8000L + 5);
+    assert(bar23(0) == 28);
+    assert(bar23(58) == 28);
+    assert(bar23(0x10_0000_0000L+1) == 28);
+    assert(bar23(0x20_0070_0000L+5) == 28);
+    assert(bar23(0x50_0000_0000L+25) == 28);
+    assert(bar23(0x1000_0000_8000L+1) == 28);
+}
+
+/*****************************************/
+// 14352
+
+int transmogrify14352(int input)
+{
+    int output = 0;
+    switch (input)
+    {
+        case 0, 1:
+            if (input == 0)
+                goto case;
+            else
+                output++;
+            goto case;
+        case 2:
+            output += 5;
+            goto case;
+        case 3:
+            output += 5;
+            break;
+        case 4, 5, 6:
+            goto default;
+        case 7:
+        case 8:
+            output += 20;
+            break;
+        default:
+            return -1;
+    }
+    return output;
+}
+
+void test14352()
+{
+    assert(transmogrify14352(0) == 10);
+}
+
+/*****************************************/
+// Issue 14587 - DMD 2.067.1 generating crashing binary on OSX
+
+struct Card {
+    int value;
+    int suit;
+}
+
+void foo14587(Card card) {
+    switch(card.value) {
+    case 4: case 5: case 6: case 11:
+        break;
+    default:
+    }
+}
+
+void test14587() {
+    auto card = Card(11, 1);
+    foo14587(card);
+}
+
+/*****************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test19();
+    test20();
+    test7358();
+    test9263();
+    test21();
+    test22();
+    test23();
+    test14352();
+    test14587();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/testthread.d b/gcc/testsuite/gdc.test/runnable/testthread.d
new file mode 100644
index 00000000000..4ae43950863
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testthread.d
@@ -0,0 +1,63 @@
+// PERMUTE_ARGS:
+
+import core.stdc.stdio;
+import core.thread;
+
+version (CRuntime_DigitalMars)
+{
+    extern (C)
+    {
+        extern int _tlsstart;
+        extern int _tlsend;
+    }
+}
+
+int tlsx;
+
+class Foo
+{
+    int x;
+
+    void bar()
+    {
+        printf("bar()\n");
+        assert(tlsx == 0);
+        tlsx = 5;
+        Thread t = Thread.getThis();
+
+        version (CRuntime_DigitalMars)
+            printf("thread ptr=%p, %p &tlsx = %p %p\n", t, &_tlsstart, &tlsx, &_tlsend);
+        x = 3;
+        printf("-bar()\n");
+    }
+}
+
+
+int main()
+{
+    Foo f = new Foo();
+
+    Thread t = new Thread(&f.bar);
+    t.start();
+    printf("t.start() done\n");
+    // There is no analog for these in druntime.
+    //t.pause();
+    //t.resume();
+    Thread.yield();
+    t.join();
+    printf("Done waiting\n");
+    assert(f.x == 3);
+
+    int i;
+    Thread tx[5];
+    for (i = 0; i < tx.length; i++)
+        tx[i] = new Thread(&f.bar);
+    for (i = 0; i < tx.length; i++)
+        tx[i].start();
+    for (i = 0; i < tx.length; i++)
+        tx[i].join();
+    Thread.sleep(dur!"msecs"(1));
+
+    printf("**Success**\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testthread2.d b/gcc/testsuite/gdc.test/runnable/testthread2.d
new file mode 100644
index 00000000000..008d4253a5a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testthread2.d
@@ -0,0 +1,108 @@
+// PERMUTE_ARGS:
+
+import std.algorithm : map;
+import std.random : Random, uniform, unpredictableSeed;
+import std.range : repeat;
+import std.stdio : writeln;
+
+// Quick, dirty and inefficient AA using linear search, useful for testing.
+struct LinearAA(K, V) {
+    K[] keys;
+    V[] values;
+
+    V opIndex(K key) {
+        foreach(i, k; keys) {
+            if(k == key) {
+                return values[i];
+            }
+        }
+
+        assert(0, "Key not present.");
+    }
+
+    V opIndexAssign(V val, K key) {
+        foreach(i, k; keys) {
+            if(k == key) {
+                return values[i] = val;
+            }
+        }
+
+        keys ~= key;
+        values ~= val;
+        return val;
+    }
+
+    V* opIn_r(K key) {
+        foreach(i, k; keys) {
+            if(key == k) {
+                return values.ptr + i;
+            }
+        }
+
+        return null;
+    }
+
+    void remove(K key) {
+        size_t i = 0;
+        for(; i < keys.length; i++) {
+            if(keys[i] == key) {
+                break;
+            }
+        }
+
+        assert(i < keys.length);
+
+        for(; i < keys.length - 1; i++) {
+            keys[i] = keys[i + 1];
+            values[i] = values[i + 1];
+        }
+
+        keys = keys[0..$ - 1];
+        values = values[0..$ - 1];
+    }
+
+    size_t length() {
+        return values.length;
+    }
+}
+
+void main() {
+    Random gen;
+    uint[] seed;
+    gen.seed(map!((a) {
+        seed ~= unpredictableSeed;
+        return seed[$-1]; })(repeat(0)));
+    writeln(seed);
+    foreach(iter; 0..10) {  // Bug only happens after a few iterations.
+        writeln(iter);
+        uint[size_t] builtin;
+        LinearAA!(size_t, uint) linAA;
+        uint[] nums = new uint[100_000];
+        foreach(ref num; nums) {
+            num = uniform(0U, uint.max, gen);
+        }
+
+        foreach(i; 0..10_000) {
+            auto index = uniform(0, nums.length, gen);
+            if(index in builtin) {
+                assert(index in linAA);
+                assert(builtin[index] == nums[index]);
+                assert(linAA[index] == nums[index]);
+                builtin.remove(index);
+                linAA.remove(index);
+            } else {
+                assert(!(index in linAA));
+                builtin[index] = nums[index];
+                linAA[index] = nums[index];
+            }
+        }
+
+        assert(builtin.length == linAA.length);
+        foreach(k, v; builtin) {
+            assert(k in linAA);
+            assert(*(k in builtin) == *(k in linAA));
+            assert(linAA[k] == v);
+        }
+    }
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/testtypeid.d b/gcc/testsuite/gdc.test/runnable/testtypeid.d
new file mode 100644
index 00000000000..3849613423a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testtypeid.d
@@ -0,0 +1,632 @@
+
+import core.vararg;
+import std.stdio;
+
+/******************************************************/
+
+void test2()
+{
+    assert(typeid(int) == typeid(int));
+    assert(typeid(int) != typeid(uint));
+}
+
+/******************************************************/
+
+class FOO3 { }
+
+FOO3 foox3;
+
+void foo3(int x, ...)
+{
+    printf("%d arguments\n", _arguments.length);
+    for (int i = 0; i < _arguments.length; i++)
+    {
+        writeln(_arguments[i].toString());
+
+        if (_arguments[i] is typeid(int))
+        {
+            int j = va_arg!int(_argptr);
+            printf("\t%d\n", j);
+            assert(j == 2);
+        }
+        else if (_arguments[i] == typeid(long))
+        {
+            long j = va_arg!long(_argptr);
+            printf("\t%lld\n", j);
+            assert(j == 3);
+        }
+        else if (_arguments[i] is typeid(double))
+        {
+            double d = va_arg!double(_argptr);
+            printf("\t%g\n", d);
+            assert(d == 4.5);
+        }
+        else if (_arguments[i] is typeid(FOO3))
+        {
+            FOO3 f = va_arg!FOO3(_argptr);
+            printf("\t%p\n", f);
+            assert(f is foox3);
+        }
+        else
+            assert(0);
+    }
+}
+
+void test3()
+{
+    FOO3 f = new FOO3();
+
+    printf("\t%p\n", f);
+    foox3 = f;
+
+    foo3(1,2,3L,4.5,f);
+    foo3(1,2,3L,4.5,f);
+}
+
+/******************************************************/
+
+void test4()
+{
+    TypeInfo ti;
+
+    ti = typeid(float[]);
+    assert(!(ti is null));
+    ti = typeid(double[]);
+    assert(!(ti is null));
+    ti = typeid(real[]);
+    assert(!(ti is null));
+
+    ti = typeid(ifloat[]);
+    assert(!(ti is null));
+    ti = typeid(idouble[]);
+    assert(!(ti is null));
+    ti = typeid(ireal[]);
+    assert(!(ti is null));
+
+    ti = typeid(cfloat[]);
+    assert(!(ti is null));
+    ti = typeid(cdouble[]);
+    assert(!(ti is null));
+    ti = typeid(creal[]);
+    assert(!(ti is null));
+
+    ti = typeid(void);
+    assert(!(ti is null));
+    ti = typeid(void[]);
+    assert(!(ti is null));
+    ti = typeid(bool[]);
+    assert(!(ti is null));
+}
+
+/******************************************************/
+
+void test6()
+{
+    TypeInfo ti = typeid(void*);
+    assert(!(ti is null));
+    assert(ti.tsize==(void*).sizeof);
+    assert(ti.toString()=="void*");
+}
+
+/******************************************************/
+
+void test7()
+{
+    TypeInfo ti = typeid(bool*);
+    assert(!(ti is null));
+    assert(ti.tsize==(bool*).sizeof);
+    assert(ti.toString()=="bool*");
+}
+
+/******************************************************/
+
+void test8()
+{
+    TypeInfo ti = typeid(byte*);
+    assert(!(ti is null));
+    assert(ti.tsize==(byte*).sizeof);
+    assert(ti.toString()=="byte*");
+}
+
+/******************************************************/
+
+void test9()
+{
+    TypeInfo ti = typeid(byte[]);
+    assert(!(ti is null));
+    assert(ti.tsize==(byte[]).sizeof);
+    assert(ti.toString()=="byte[]");
+}
+
+/******************************************************/
+
+void test10()
+{
+    TypeInfo ti = typeid(short*);
+    assert(!(ti is null));
+    assert(ti.tsize==(short*).sizeof);
+    assert(ti.toString()=="short*");
+}
+
+/******************************************************/
+
+void test11()
+{
+    TypeInfo ti = typeid(ushort*);
+    assert(!(ti is null));
+    assert(ti.tsize==(ushort*).sizeof);
+    assert(ti.toString()=="ushort*");
+}
+
+/******************************************************/
+
+void test12()
+{
+    TypeInfo ti = typeid(int*);
+    assert(!(ti is null));
+    assert(ti.tsize==(int*).sizeof);
+    assert(ti.toString()=="int*");
+}
+
+/******************************************************/
+
+void test13()
+{
+    TypeInfo ti = typeid(uint*);
+    assert(!(ti is null));
+    assert(ti.tsize==(uint*).sizeof);
+    assert(ti.toString()=="uint*");
+}
+
+/******************************************************/
+
+void test14()
+{
+    TypeInfo ti = typeid(ulong*);
+    assert(!(ti is null));
+    assert(ti.tsize==(ulong*).sizeof);
+    assert(ti.toString()=="ulong*");
+}
+
+/******************************************************/
+
+void test15()
+{
+    TypeInfo ti = typeid(long*);
+    assert(!(ti is null));
+    assert(ti.tsize==(long*).sizeof);
+    assert(ti.toString()=="long*");
+}
+
+/******************************************************/
+
+void test16()
+{
+    TypeInfo ti = typeid(float*);
+    assert(!(ti is null));
+    assert(ti.tsize==(float*).sizeof);
+    assert(ti.toString()=="float*");
+}
+
+/******************************************************/
+
+void test17()
+{
+    TypeInfo ti = typeid(ifloat*);
+    assert(!(ti is null));
+    assert(ti.tsize==(ifloat*).sizeof);
+    assert(ti.toString()=="ifloat*");
+}
+
+/******************************************************/
+
+void test18()
+{
+    TypeInfo ti = typeid(cfloat*);
+    assert(!(ti is null));
+    assert(ti.tsize==(cfloat*).sizeof);
+    assert(ti.toString()=="cfloat*");
+}
+
+/******************************************************/
+
+void test19()
+{
+    TypeInfo ti = typeid(double*);
+    assert(!(ti is null));
+    assert(ti.tsize==(double*).sizeof);
+    assert(ti.toString()=="double*");
+}
+
+/******************************************************/
+
+void test20()
+{
+    TypeInfo ti = typeid(idouble*);
+    assert(!(ti is null));
+    assert(ti.tsize==(idouble*).sizeof);
+    assert(ti.toString()=="idouble*");
+}
+
+/******************************************************/
+
+void test21()
+{
+    TypeInfo ti = typeid(cdouble*);
+    assert(!(ti is null));
+    assert(ti.tsize==(cdouble*).sizeof);
+    assert(ti.toString()=="cdouble*");
+}
+
+/******************************************************/
+
+void test22()
+{
+    TypeInfo ti = typeid(real*);
+    assert(!(ti is null));
+    assert(ti.tsize==(real*).sizeof);
+    assert(ti.toString()=="real*");
+}
+
+/******************************************************/
+
+void test23()
+{
+    TypeInfo ti = typeid(ireal*);
+    assert(!(ti is null));
+    assert(ti.tsize==(ireal*).sizeof);
+    assert(ti.toString()=="ireal*");
+}
+
+/******************************************************/
+
+void test24()
+{
+    TypeInfo ti = typeid(creal*);
+    assert(!(ti is null));
+    assert(ti.tsize==(creal*).sizeof);
+    assert(ti.toString()=="creal*");
+}
+
+/******************************************************/
+
+void test25()
+{
+    TypeInfo ti = typeid(char*);
+    assert(!(ti is null));
+    assert(ti.tsize==(char*).sizeof);
+    assert(ti.toString()=="char*");
+}
+
+/******************************************************/
+
+void test26()
+{
+    TypeInfo ti = typeid(wchar*);
+    assert(!(ti is null));
+    assert(ti.tsize==(wchar*).sizeof);
+    assert(ti.toString()=="wchar*");
+}
+
+/******************************************************/
+
+void test27()
+{
+    TypeInfo ti = typeid(dchar*);
+    assert(!(ti is null));
+    assert(ti.tsize==(dchar*).sizeof);
+    assert(ti.toString()=="dchar*");
+}
+
+/******************************************************/
+
+enum MyEnum { A, B }
+
+void test28()
+{
+    TypeInfo ti = typeid(MyEnum);
+    assert(!(ti is null));
+    assert(ti.tsize==(MyEnum).sizeof);
+    assert(ti.toString()=="testtypeid.MyEnum");
+}
+
+/******************************************************/
+
+void test29()
+{
+    alias void function() func;
+    TypeInfo ti = typeid(func);
+    assert(ti !is null);
+    assert(ti.tsize == func.sizeof);
+}
+
+/******************************************************/
+
+void test30()
+{
+    alias int delegate() del;
+    TypeInfo ti = typeid(del);
+    assert(ti !is null);
+    assert(ti.tsize == del.sizeof);
+}
+
+/******************************************************/
+
+void test31()
+{
+    TypeInfo ti = typeid(void);
+    assert(!(ti is null));
+    assert(ti.tsize == void.sizeof);
+    assert(ti.toString()=="void");
+}
+
+/******************************************************/
+
+class Foo32 { int x = 3; }
+class Bar32 { long y = 4; }
+
+void printargs(int x, ...)
+{
+    printf("%d arguments\n", _arguments.length);
+    for (int i = 0; i < _arguments.length; i++)
+    {
+        writeln(_arguments[i].toString());
+
+        if (_arguments[i] == typeid(int))
+        {
+            int j = va_arg!int(_argptr);
+            printf("\t%d\n", j);
+        }
+        else if (_arguments[i] == typeid(long))
+        {
+            long j = va_arg!long(_argptr);
+            printf("\t%lld\n", j);
+        }
+        else if (_arguments[i] == typeid(double))
+        {
+            double d = va_arg!double(_argptr);
+            printf("\t%g\n", d);
+        }
+        else if (_arguments[i] == typeid(Foo32))
+        {
+            Foo32 f = va_arg!Foo32(_argptr);
+            assert(f.x == 3);
+            printf("\t%p\n", f);
+        }
+        else if (_arguments[i] == typeid(Bar32))
+        {
+            Bar32 b = va_arg!Bar32(_argptr);
+            assert(b.y == 4);
+            printf("\t%p\n", b);
+        }
+        else
+            assert(0);
+    }
+}
+
+void test32()
+{
+    Foo32 f = new Foo32();
+    Bar32 b = new Bar32();
+
+    printf("%p\n", f);
+    printargs(1, 2, 3L, 4.5, f, b);
+}
+
+/******************************************************/
+
+void test33()
+{
+}
+
+/******************************************************/
+
+void test34()
+{
+    class C { }
+    C c;
+    auto a = typeid(C).info;
+}
+
+/******************************************************/
+
+void test35()
+{
+    auto ti = typeid(shared(int));
+
+    auto sti = cast(TypeInfo_Shared)ti;
+    assert(sti);
+
+    // allow both next and base as field names in TypeInfo_Const
+    static if (is(typeof(&sti.base) == TypeInfo*))
+        assert(sti.base == typeid(int));
+    else
+        assert(sti.next == typeid(int));
+}
+
+/******************************************************/
+
+void test36()
+{
+    int i;
+    assert(typeid(i++) == typeid(int));
+    assert(i == 1);
+    assert(typeid(i + 1) == typeid(int));
+}
+
+/******************************************************/
+
+class A37 {}
+class B37 : A37 {}
+
+void test37()
+{
+    auto a = new B37;
+    //writeln(typeid(A));
+    assert(typeid(a) == typeid(B37));
+}
+
+/******************************************************/
+// 9442
+
+class C
+{
+    this()
+    {
+        c = this;
+        auto x = typeid(c);         // NG
+        auto y = typeid(this.c);    // ok
+    }
+
+    C c;
+}
+
+void test9442()
+{
+    auto c = new C();
+}
+
+/******************************************************/
+// 10451
+
+struct Foo10451;
+
+struct Bar10451
+{
+    Foo10451*[] foos;
+}
+
+void test10451()
+{
+    Foo10451*[] foos = [];
+    foos ~= null;
+    foos = new Foo10451*[2];
+}
+
+/******************************************************/
+// 11010
+
+struct S11010 { S11010* p; }
+
+class C11010 { C11010 p; }
+class D11010 : C11010 {}
+
+void test11010()
+{
+    TypeInfo ti;
+
+    S11010 s;
+    ti = typeid(s.p);
+    assert(cast(TypeInfo_Pointer)ti !is null);
+    assert(ti.toString() == "testtypeid.S11010*");
+
+    C11010 c = new C11010();
+    c.p = new D11010();
+    ti = typeid(c.p);
+    assert(cast(TypeInfo_Class)ti !is null);
+    assert(ti.toString() == "testtypeid.D11010");
+}
+
+/******************************************************/
+// 13045
+
+void test13045a()
+{
+    static struct S
+    {
+        int[] a;
+    }
+
+    auto s1 = S([1,2]);
+    auto s2 = S([1,2]);
+    assert(s1 !is s2);
+    assert(s1 == s2);
+    assert(typeid(S).getHash(&s1) == typeid(S).getHash(&s2));   // should succeed
+}
+
+void test13045b()
+{
+    bool thrown(T)(lazy T cond)
+    {
+        import core.exception;
+        try
+            cond();
+        catch (Error e)
+            return true;
+        return false;
+    }
+
+    struct S
+    {
+        size_t toHash() const nothrow @safe
+        {
+            // all getHash call should reach here
+            throw new Error("");
+        }
+    }
+    struct T
+    {
+        S s;
+    }
+    S s;
+    assert(thrown(typeid(S).getHash(&s)));      // OK
+    S[1] ssa;
+    assert(thrown(typeid(S[1]).getHash(&ssa))); // OK
+    S[] sda = [S(), S()];
+    assert(thrown(typeid(S[]).getHash(&sda)));  // OK
+
+    T t;
+    assert(thrown(typeid(T).getHash(&t)));      // OK <- NG
+    T[1] tsa;
+    assert(thrown(typeid(T[1]).getHash(&tsa))); // OK <- NG
+    T[] tda = [T(), T()];
+    assert(thrown(typeid(T[]).getHash(&tda)));  // OK <- NG
+}
+
+/******************************************************/
+
+int main()
+{
+    test2();
+    test3();
+    test4();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test9442();
+    test10451();
+    test11010();
+    test13045a();
+    test13045b();
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/testv.d b/gcc/testsuite/gdc.test/runnable/testv.d
new file mode 100644
index 00000000000..d146fd49dbf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/testv.d
@@ -0,0 +1,147 @@
+
+extern(C) int printf(const char*, ...);
+
+/*********************************************************/
+
+int sum(int[] xx ...)
+{
+    int s;
+
+    foreach (int x; xx)
+        s += x;
+    return s;
+}
+
+void test1()
+{
+    static int[3] a = [5, 8, 10];
+    int[] b = a;
+    int i;
+
+    i = sum();
+    assert(i == 0);
+    i = sum(10);
+    assert(i == 10);
+    i = sum(10, 20);
+    assert(i == 30);
+    i = sum(11, 22, 34);
+    assert(i == 67);
+    i = sum(a);
+    assert(i == 23);
+    i = sum(b);
+    assert(i == 23);
+    printf("%d\n", sum());
+}
+
+/*********************************************************/
+
+int sum2(int[3] xx ...)
+{
+    int s;
+
+    foreach (int x; xx)
+        s += x;
+    return s;
+}
+
+void test2()
+{
+    static int[3] a = [5, 8, 10];
+    int i;
+
+    i = sum2(11, 22, 34);
+    assert(i == 67);
+    i = sum2(a);
+    assert(i == 23);
+    printf("%d\n", i);
+}
+
+/*********************************************************/
+
+int[4] bb3 = [5,6,7,8];
+
+int sum3(int[] xx = bb3 ...)
+{
+    int s;
+
+    foreach (int x; xx)
+        s += x;
+    return s;
+}
+
+void test3()
+{
+    static int[3] a = [5, 8, 10];
+    int i;
+
+    i = sum3(11, 22, 34);
+    assert(i == 67);
+    i = sum3(a);
+    assert(i == 23);
+    i = sum3();
+    assert(i == 26);
+    printf("%d\n", i);
+}
+
+/*********************************************************/
+
+class Foo4
+{
+    int a;
+    float f;
+    double d;
+
+    this(int a, float f, double d)
+    {
+        this.a = a;
+        this.f = f;
+        this.d = d;
+    }
+}
+
+int sum4(Foo4 f ...)
+{
+    return cast(int)(f.a + f.f + f.d);
+}
+
+void test4()
+{
+    int i;
+    Foo4 foo = new Foo4(1, 2f, 3.0);
+
+    i = sum4(foo);
+    assert(i == 1+2+3);
+    i = sum4(4, 5f, 6.0);
+    assert(i == 4+5+6);
+
+    printf("%d\n", i);
+}
+
+/*********************************************************/
+
+
+void bug1993(int[][] y...)
+{
+}
+void test5()
+{
+    bug1993(null);
+    bug1993(null, null);
+    bug1993([0], null);
+    bug1993([0], [0]);
+    bug1993(null, [0]);
+}
+
+/*********************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/tls.d b/gcc/testsuite/gdc.test/runnable/tls.d
new file mode 100644
index 00000000000..7b59509241d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/tls.d
@@ -0,0 +1,99 @@
+// EXTRA_SOURCES: imports/tlsa.d
+
+import core.stdc.stdio;
+import imports.tlsa;
+
+int x = 3;
+
+void bar()
+{
+    int* px = &x;
+    assert(x == 3);
+    x++;
+    printf("x = %d\n", x);
+    px = &x;
+    printf("px = %p\n", px);
+    assert(*px == 4);
+    (*px)++;
+    assert(x == 5);
+}
+
+
+void test1()
+{
+    bar();
+    printf("%d\n", x);
+    printf("%d\n", foo!()());
+}
+
+/************************************/
+
+long fooa;
+long foob;
+int bara = 0x12345678;
+int barb = 0x9ABCDEFF;
+
+void test2()
+{
+    fooa++;
+    foob--;
+    bara++;
+    barb++;
+    printf("%lld %lld %x %x\n", fooa, foob, bara, barb);
+    assert(fooa == 1);
+    assert(foob == -1);
+    assert(bara == 0x12345679);
+    assert(barb == 0x9ABCDF00);
+}
+
+/************************************/
+
+int abc3(T)(T t)
+{
+    static T qqq;
+    static T rrr;
+    static T sss = 8;
+    static T ttt = 9;
+    printf("qqq = %d, rrr = %d, sss = %d, ttt = %d\n", qqq, rrr, sss, ttt);
+    assert(sss == 8);
+    assert(ttt == 9);
+    rrr += 7;
+    return t + ++qqq + rrr;
+}
+
+void test3()
+{
+    auto i = abc3(3);
+    printf("i = x%x\n", i);
+    assert(i == 11);
+    i = abc3(4);
+    printf("i = x%x\n", i);
+    assert(i == 20);
+}
+
+/************************************/
+
+void test4()
+{
+
+    auto i = bar4();
+    printf("i = x%x\n", i);
+    assert(i == 0x23);
+    i = abc4(4);
+    printf("i = x%x\n", i);
+    assert(i == 0x31);
+}
+
+/************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/tls_dup.d b/gcc/testsuite/gdc.test/runnable/tls_dup.d
new file mode 100644
index 00000000000..e55f7e5a017
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/tls_dup.d
@@ -0,0 +1,104 @@
+// NOTE: this is a dup of runnable/tls.d strictly to test the same code compiled
+// separately rather than together like the original is.
+
+// COMPILE_SEPARATELY
+// EXTRA_SOURCES: imports/tlsa.d
+// PERMUTE_ARGS:
+
+import core.stdc.stdio;
+import imports.tlsa;
+
+int x = 3;
+
+void bar()
+{
+    int* px = &x;
+    assert(x == 3);
+    x++;
+    printf("x = %d\n", x);
+    px = &x;
+    printf("px = %p\n", px);
+    assert(*px == 4);
+    (*px)++;
+    assert(x == 5);
+}
+
+
+void test1()
+{
+    bar();
+    printf("%d\n", x);
+    printf("%d\n", foo!()());
+}
+
+/************************************/
+
+long fooa;
+long foob;
+int bara = 0x12345678;
+int barb = 0x9ABCDEFF;
+
+void test2()
+{
+    fooa++;
+    foob--;
+    bara++;
+    barb++;
+    printf("%lld %lld %x %x\n", fooa, foob, bara, barb);
+    assert(fooa == 1);
+    assert(foob == -1);
+    assert(bara == 0x12345679);
+    assert(barb == 0x9ABCDF00);
+}
+
+/************************************/
+
+int abc3(T)(T t)
+{
+    static T qqq;
+    static T rrr;
+    static T sss = 8;
+    static T ttt = 9;
+    printf("qqq = %d, rrr = %d, sss = %d, ttt = %d\n", qqq, rrr, sss, ttt);
+    assert(sss == 8);
+    assert(ttt == 9);
+    rrr += 7;
+    return t + ++qqq + rrr;
+}
+
+void test3()
+{
+    auto i = abc3(3);
+    printf("i = x%x\n", i);
+    assert(i == 11);
+    i = abc3(4);
+    printf("i = x%x\n", i);
+    assert(i == 20);
+}
+
+/************************************/
+
+void test4()
+{
+
+    auto i = bar4();
+    printf("i = x%x\n", i);
+    assert(i == 0x23);
+    i = abc4(4);
+    printf("i = x%x\n", i);
+    assert(i == 0x31);
+}
+
+/************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+
+    printf("Success\n");
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/traits.d b/gcc/testsuite/gdc.test/runnable/traits.d
new file mode 100644
index 00000000000..ef23e9f32be
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/traits.d
@@ -0,0 +1,1572 @@
+// PERMUTE_ARGS:
+module traits;
+
+import std.stdio;
+
+alias int myint;
+struct S { void bar() { } int x = 4; static int z = 5; }
+class C { void bar() { } final void foo() { } static void abc() { } }
+abstract class AC { }
+class AC2 { abstract void foo(); }
+class AC3 : AC2 { }
+final class FC { void foo() { } }
+enum E { EMEM }
+
+/********************************************************/
+
+void test1()
+{
+    auto t = __traits(isArithmetic, int);
+    writeln(t);
+    assert(t == true);
+
+    assert(__traits(isArithmetic) == false);
+    assert(__traits(isArithmetic, myint) == true);
+    assert(__traits(isArithmetic, S) == false);
+    assert(__traits(isArithmetic, C) == false);
+    assert(__traits(isArithmetic, E) == true);
+    assert(__traits(isArithmetic, void*) == false);
+    assert(__traits(isArithmetic, void[]) == false);
+    assert(__traits(isArithmetic, void[3]) == false);
+    assert(__traits(isArithmetic, int[char]) == false);
+    assert(__traits(isArithmetic, int, int) == true);
+    assert(__traits(isArithmetic, int, S) == false);
+
+    assert(__traits(isArithmetic, void) == false);
+    assert(__traits(isArithmetic, byte) == true);
+    assert(__traits(isArithmetic, ubyte) == true);
+    assert(__traits(isArithmetic, short) == true);
+    assert(__traits(isArithmetic, ushort) == true);
+    assert(__traits(isArithmetic, int) == true);
+    assert(__traits(isArithmetic, uint) == true);
+    assert(__traits(isArithmetic, long) == true);
+    assert(__traits(isArithmetic, ulong) == true);
+    assert(__traits(isArithmetic, float) == true);
+    assert(__traits(isArithmetic, double) == true);
+    assert(__traits(isArithmetic, real) == true);
+    assert(__traits(isArithmetic, ifloat) == true);
+    assert(__traits(isArithmetic, idouble) == true);
+    assert(__traits(isArithmetic, ireal) == true);
+    assert(__traits(isArithmetic, cfloat) == true);
+    assert(__traits(isArithmetic, cdouble) == true);
+    assert(__traits(isArithmetic, creal) == true);
+    assert(__traits(isArithmetic, char) == true);
+    assert(__traits(isArithmetic, wchar) == true);
+    assert(__traits(isArithmetic, dchar) == true);
+
+    int i;
+    assert(__traits(isArithmetic, i, i+1, int) == true);
+    assert(__traits(isArithmetic) == false);
+}
+
+/********************************************************/
+
+void test2()
+{
+    auto t = __traits(isScalar, int);
+    writeln(t);
+    assert(t == true);
+
+    assert(__traits(isScalar) == false);
+    assert(__traits(isScalar, myint) == true);
+    assert(__traits(isScalar, S) == false);
+    assert(__traits(isScalar, C) == false);
+    assert(__traits(isScalar, E) == true);
+    assert(__traits(isScalar, void*) == true);
+    assert(__traits(isScalar, void[]) == false);
+    assert(__traits(isScalar, void[3]) == false);
+    assert(__traits(isScalar, int[char]) == false);
+    assert(__traits(isScalar, int, int) == true);
+    assert(__traits(isScalar, int, S) == false);
+
+    assert(__traits(isScalar, void) == false);
+    assert(__traits(isScalar, byte) == true);
+    assert(__traits(isScalar, ubyte) == true);
+    assert(__traits(isScalar, short) == true);
+    assert(__traits(isScalar, ushort) == true);
+    assert(__traits(isScalar, int) == true);
+    assert(__traits(isScalar, uint) == true);
+    assert(__traits(isScalar, long) == true);
+    assert(__traits(isScalar, ulong) == true);
+    assert(__traits(isScalar, float) == true);
+    assert(__traits(isScalar, double) == true);
+    assert(__traits(isScalar, real) == true);
+    assert(__traits(isScalar, ifloat) == true);
+    assert(__traits(isScalar, idouble) == true);
+    assert(__traits(isScalar, ireal) == true);
+    assert(__traits(isScalar, cfloat) == true);
+    assert(__traits(isScalar, cdouble) == true);
+    assert(__traits(isScalar, creal) == true);
+    assert(__traits(isScalar, char) == true);
+    assert(__traits(isScalar, wchar) == true);
+    assert(__traits(isScalar, dchar) == true);
+}
+
+/********************************************************/
+
+void test3()
+{
+    assert(__traits(isIntegral) == false);
+    assert(__traits(isIntegral, myint) == true);
+    assert(__traits(isIntegral, S) == false);
+    assert(__traits(isIntegral, C) == false);
+    assert(__traits(isIntegral, E) == true);
+    assert(__traits(isIntegral, void*) == false);
+    assert(__traits(isIntegral, void[]) == false);
+    assert(__traits(isIntegral, void[3]) == false);
+    assert(__traits(isIntegral, int[char]) == false);
+    assert(__traits(isIntegral, int, int) == true);
+    assert(__traits(isIntegral, int, S) == false);
+
+    assert(__traits(isIntegral, void) == false);
+    assert(__traits(isIntegral, byte) == true);
+    assert(__traits(isIntegral, ubyte) == true);
+    assert(__traits(isIntegral, short) == true);
+    assert(__traits(isIntegral, ushort) == true);
+    assert(__traits(isIntegral, int) == true);
+    assert(__traits(isIntegral, uint) == true);
+    assert(__traits(isIntegral, long) == true);
+    assert(__traits(isIntegral, ulong) == true);
+    assert(__traits(isIntegral, float) == false);
+    assert(__traits(isIntegral, double) == false);
+    assert(__traits(isIntegral, real) == false);
+    assert(__traits(isIntegral, ifloat) == false);
+    assert(__traits(isIntegral, idouble) == false);
+    assert(__traits(isIntegral, ireal) == false);
+    assert(__traits(isIntegral, cfloat) == false);
+    assert(__traits(isIntegral, cdouble) == false);
+    assert(__traits(isIntegral, creal) == false);
+    assert(__traits(isIntegral, char) == true);
+    assert(__traits(isIntegral, wchar) == true);
+    assert(__traits(isIntegral, dchar) == true);
+}
+
+/********************************************************/
+
+void test4()
+{
+    assert(__traits(isFloating) == false);
+    assert(__traits(isFloating, S) == false);
+    assert(__traits(isFloating, C) == false);
+    assert(__traits(isFloating, E) == false);
+    assert(__traits(isFloating, void*) == false);
+    assert(__traits(isFloating, void[]) == false);
+    assert(__traits(isFloating, void[3]) == false);
+    assert(__traits(isFloating, int[char]) == false);
+    assert(__traits(isFloating, float, float) == true);
+    assert(__traits(isFloating, float, S) == false);
+
+    assert(__traits(isFloating, void) == false);
+    assert(__traits(isFloating, byte) == false);
+    assert(__traits(isFloating, ubyte) == false);
+    assert(__traits(isFloating, short) == false);
+    assert(__traits(isFloating, ushort) == false);
+    assert(__traits(isFloating, int) == false);
+    assert(__traits(isFloating, uint) == false);
+    assert(__traits(isFloating, long) == false);
+    assert(__traits(isFloating, ulong) == false);
+    assert(__traits(isFloating, float) == true);
+    assert(__traits(isFloating, double) == true);
+    assert(__traits(isFloating, real) == true);
+    assert(__traits(isFloating, ifloat) == true);
+    assert(__traits(isFloating, idouble) == true);
+    assert(__traits(isFloating, ireal) == true);
+    assert(__traits(isFloating, cfloat) == true);
+    assert(__traits(isFloating, cdouble) == true);
+    assert(__traits(isFloating, creal) == true);
+    assert(__traits(isFloating, char) == false);
+    assert(__traits(isFloating, wchar) == false);
+    assert(__traits(isFloating, dchar) == false);
+}
+
+/********************************************************/
+
+void test5()
+{
+    assert(__traits(isUnsigned) == false);
+    assert(__traits(isUnsigned, S) == false);
+    assert(__traits(isUnsigned, C) == false);
+    assert(__traits(isUnsigned, E) == false);
+    assert(__traits(isUnsigned, void*) == false);
+    assert(__traits(isUnsigned, void[]) == false);
+    assert(__traits(isUnsigned, void[3]) == false);
+    assert(__traits(isUnsigned, int[char]) == false);
+    assert(__traits(isUnsigned, float, float) == false);
+    assert(__traits(isUnsigned, float, S) == false);
+
+    assert(__traits(isUnsigned, void) == false);
+    assert(__traits(isUnsigned, byte) == false);
+    assert(__traits(isUnsigned, ubyte) == true);
+    assert(__traits(isUnsigned, short) == false);
+    assert(__traits(isUnsigned, ushort) == true);
+    assert(__traits(isUnsigned, int) == false);
+    assert(__traits(isUnsigned, uint) == true);
+    assert(__traits(isUnsigned, long) == false);
+    assert(__traits(isUnsigned, ulong) == true);
+    assert(__traits(isUnsigned, float) == false);
+    assert(__traits(isUnsigned, double) == false);
+    assert(__traits(isUnsigned, real) == false);
+    assert(__traits(isUnsigned, ifloat) == false);
+    assert(__traits(isUnsigned, idouble) == false);
+    assert(__traits(isUnsigned, ireal) == false);
+    assert(__traits(isUnsigned, cfloat) == false);
+    assert(__traits(isUnsigned, cdouble) == false);
+    assert(__traits(isUnsigned, creal) == false);
+    assert(__traits(isUnsigned, char) == true);
+    assert(__traits(isUnsigned, wchar) == true);
+    assert(__traits(isUnsigned, dchar) == true);
+}
+
+/********************************************************/
+
+void test6()
+{
+    assert(__traits(isAssociativeArray) == false);
+    assert(__traits(isAssociativeArray, S) == false);
+    assert(__traits(isAssociativeArray, C) == false);
+    assert(__traits(isAssociativeArray, E) == false);
+    assert(__traits(isAssociativeArray, void*) == false);
+    assert(__traits(isAssociativeArray, void[]) == false);
+    assert(__traits(isAssociativeArray, void[3]) == false);
+    assert(__traits(isAssociativeArray, int[char]) == true);
+    assert(__traits(isAssociativeArray, float, float) == false);
+    assert(__traits(isAssociativeArray, float, S) == false);
+
+    assert(__traits(isAssociativeArray, void) == false);
+    assert(__traits(isAssociativeArray, byte) == false);
+    assert(__traits(isAssociativeArray, ubyte) == false);
+    assert(__traits(isAssociativeArray, short) == false);
+    assert(__traits(isAssociativeArray, ushort) == false);
+    assert(__traits(isAssociativeArray, int) == false);
+    assert(__traits(isAssociativeArray, uint) == false);
+    assert(__traits(isAssociativeArray, long) == false);
+    assert(__traits(isAssociativeArray, ulong) == false);
+    assert(__traits(isAssociativeArray, float) == false);
+    assert(__traits(isAssociativeArray, double) == false);
+    assert(__traits(isAssociativeArray, real) == false);
+    assert(__traits(isAssociativeArray, ifloat) == false);
+    assert(__traits(isAssociativeArray, idouble) == false);
+    assert(__traits(isAssociativeArray, ireal) == false);
+    assert(__traits(isAssociativeArray, cfloat) == false);
+    assert(__traits(isAssociativeArray, cdouble) == false);
+    assert(__traits(isAssociativeArray, creal) == false);
+    assert(__traits(isAssociativeArray, char) == false);
+    assert(__traits(isAssociativeArray, wchar) == false);
+    assert(__traits(isAssociativeArray, dchar) == false);
+}
+
+/********************************************************/
+
+void test7()
+{
+    assert(__traits(isStaticArray) == false);
+    assert(__traits(isStaticArray, S) == false);
+    assert(__traits(isStaticArray, C) == false);
+    assert(__traits(isStaticArray, E) == false);
+    assert(__traits(isStaticArray, void*) == false);
+    assert(__traits(isStaticArray, void[]) == false);
+    assert(__traits(isStaticArray, void[3]) == true);
+    assert(__traits(isStaticArray, int[char]) == false);
+    assert(__traits(isStaticArray, float, float) == false);
+    assert(__traits(isStaticArray, float, S) == false);
+
+    assert(__traits(isStaticArray, void) == false);
+    assert(__traits(isStaticArray, byte) == false);
+    assert(__traits(isStaticArray, ubyte) == false);
+    assert(__traits(isStaticArray, short) == false);
+    assert(__traits(isStaticArray, ushort) == false);
+    assert(__traits(isStaticArray, int) == false);
+    assert(__traits(isStaticArray, uint) == false);
+    assert(__traits(isStaticArray, long) == false);
+    assert(__traits(isStaticArray, ulong) == false);
+    assert(__traits(isStaticArray, float) == false);
+    assert(__traits(isStaticArray, double) == false);
+    assert(__traits(isStaticArray, real) == false);
+    assert(__traits(isStaticArray, ifloat) == false);
+    assert(__traits(isStaticArray, idouble) == false);
+    assert(__traits(isStaticArray, ireal) == false);
+    assert(__traits(isStaticArray, cfloat) == false);
+    assert(__traits(isStaticArray, cdouble) == false);
+    assert(__traits(isStaticArray, creal) == false);
+    assert(__traits(isStaticArray, char) == false);
+    assert(__traits(isStaticArray, wchar) == false);
+    assert(__traits(isStaticArray, dchar) == false);
+}
+
+/********************************************************/
+
+void test8()
+{
+    assert(__traits(isAbstractClass) == false);
+    assert(__traits(isAbstractClass, S) == false);
+    assert(__traits(isAbstractClass, C) == false);
+    assert(__traits(isAbstractClass, AC) == true);
+    assert(__traits(isAbstractClass, E) == false);
+    assert(__traits(isAbstractClass, void*) == false);
+    assert(__traits(isAbstractClass, void[]) == false);
+    assert(__traits(isAbstractClass, void[3]) == false);
+    assert(__traits(isAbstractClass, int[char]) == false);
+    assert(__traits(isAbstractClass, float, float) == false);
+    assert(__traits(isAbstractClass, float, S) == false);
+
+    assert(__traits(isAbstractClass, void) == false);
+    assert(__traits(isAbstractClass, byte) == false);
+    assert(__traits(isAbstractClass, ubyte) == false);
+    assert(__traits(isAbstractClass, short) == false);
+    assert(__traits(isAbstractClass, ushort) == false);
+    assert(__traits(isAbstractClass, int) == false);
+    assert(__traits(isAbstractClass, uint) == false);
+    assert(__traits(isAbstractClass, long) == false);
+    assert(__traits(isAbstractClass, ulong) == false);
+    assert(__traits(isAbstractClass, float) == false);
+    assert(__traits(isAbstractClass, double) == false);
+    assert(__traits(isAbstractClass, real) == false);
+    assert(__traits(isAbstractClass, ifloat) == false);
+    assert(__traits(isAbstractClass, idouble) == false);
+    assert(__traits(isAbstractClass, ireal) == false);
+    assert(__traits(isAbstractClass, cfloat) == false);
+    assert(__traits(isAbstractClass, cdouble) == false);
+    assert(__traits(isAbstractClass, creal) == false);
+    assert(__traits(isAbstractClass, char) == false);
+    assert(__traits(isAbstractClass, wchar) == false);
+    assert(__traits(isAbstractClass, dchar) == false);
+
+    assert(__traits(isAbstractClass, AC2) == true);
+    assert(__traits(isAbstractClass, AC3) == true);
+}
+
+/********************************************************/
+
+void test9()
+{
+    assert(__traits(isFinalClass) == false);
+    assert(__traits(isFinalClass, C) == false);
+    assert(__traits(isFinalClass, FC) == true);
+}
+
+/********************************************************/
+
+void test10()
+{
+    assert(__traits(isVirtualFunction, C.bar) == true);
+    assert(__traits(isVirtualFunction, S.bar) == false);
+}
+
+/********************************************************/
+
+void test11()
+{
+    assert(__traits(isAbstractFunction, C.bar) == false);
+    assert(__traits(isAbstractFunction, S.bar) == false);
+    assert(__traits(isAbstractFunction, AC2.foo) == true);
+}
+
+/********************************************************/
+
+void test12()
+{
+    assert(__traits(isFinalFunction, C.bar) == false);
+    assert(__traits(isFinalFunction, S.bar) == false);
+    assert(__traits(isFinalFunction, AC2.foo) == false);
+    assert(__traits(isFinalFunction, FC.foo) == true);
+    assert(__traits(isFinalFunction, C.foo) == true);
+}
+
+/********************************************************/
+
+void test13()
+{
+    S s;
+    __traits(getMember, s, "x") = 7;
+    auto i = __traits(getMember, s, "x");
+    assert(i == 7);
+    auto j = __traits(getMember, S, "z");
+    assert(j == 5);
+
+    writeln(__traits(hasMember, s, "x"));
+    assert(__traits(hasMember, s, "x") == true);
+    assert(__traits(hasMember, S, "z") == true);
+    assert(__traits(hasMember, S, "aaa") == false);
+
+    auto k = __traits(classInstanceSize, C);
+    writeln(k);
+    assert(k == C.classinfo.initializer.length);
+}
+
+/********************************************************/
+// 7123
+
+private struct DelegateFaker7123(F)
+{
+    template GeneratingPolicy() {}
+    enum WITH_BASE_CLASS = __traits(hasMember, GeneratingPolicy!(), "x");
+}
+
+auto toDelegate7123(F)(F fp)
+{
+    alias DelegateFaker7123!F Faker;
+}
+
+
+void test7123()
+{
+    static assert(is(typeof(toDelegate7123(&main))));
+}
+
+/********************************************************/
+
+class D14
+{
+    this() { }
+    ~this() { }
+    void foo() { }
+    int foo(int) { return 0; }
+}
+
+void test14()
+{
+    auto a = [__traits(derivedMembers, D14)];
+    writeln(a);
+    assert(a == ["__ctor","__dtor","foo", "__xdtor"]);
+}
+
+/********************************************************/
+
+class D15
+{
+    this() { }
+    ~this() { }
+    void foo() { }
+    int foo(int) { return 2; }
+}
+
+void test15()
+{
+    D15 d = new D15();
+
+    foreach (t; __traits(getVirtualFunctions, D15, "foo"))
+        writeln(typeid(typeof(t)));
+
+    alias typeof(__traits(getVirtualFunctions, D15, "foo")) b;
+    foreach (t; b)
+        writeln(typeid(t));
+
+    auto i = __traits(getVirtualFunctions, d, "foo")[1](1);
+    assert(i == 2);
+}
+
+/********************************************************/
+
+struct S16 { }
+
+int foo16();
+int bar16();
+
+void test16()
+{
+    assert(__traits(isSame, foo16, foo16) == true);
+    assert(__traits(isSame, foo16, bar16) == false);
+    assert(__traits(isSame, foo16, S16) == false);
+    assert(__traits(isSame, S16, S16) == true);
+    assert(__traits(isSame, std, S16) == false);
+    assert(__traits(isSame, std, std) == true);
+}
+
+/********************************************************/
+
+struct S17
+{
+    static int s1;
+    int s2;
+}
+
+int foo17();
+
+void test17()
+{
+    assert(__traits(compiles) == false);
+    assert(__traits(compiles, foo17) == true);
+    assert(__traits(compiles, foo17 + 1) == true);
+    assert(__traits(compiles, &foo17 + 1) == false);
+    assert(__traits(compiles, typeof(1)) == true);
+    assert(__traits(compiles, S17.s1) == true);
+    assert(__traits(compiles, S17.s3) == false);
+    assert(__traits(compiles, 1,2,3,int,long,std) == true);
+    assert(__traits(compiles, 3[1]) == false);
+    assert(__traits(compiles, 1,2,3,int,long,3[1]) == false);
+}
+
+/********************************************************/
+
+interface D18
+{
+  extern(Windows):
+    void foo();
+    int foo(int);
+}
+
+void test18()
+{
+    auto a = __traits(allMembers, D18);
+    writeln(a);
+    assert(a.length == 1);
+}
+
+
+/********************************************************/
+
+class C19
+{
+    void mutating_method(){}
+
+    const void const_method(){}
+
+    void bastard_method(){}
+    const void bastard_method(int){}
+}
+
+
+void test19()
+{
+    auto a = __traits(allMembers, C19);
+    writeln(a);
+    assert(a.length == 9);
+
+    foreach( m; __traits(allMembers, C19) )
+        writeln(m);
+}
+
+
+/********************************************************/
+
+void test20()
+{
+    void fooref(ref int x)
+    {
+        static assert(__traits(isRef, x));
+        static assert(!__traits(isOut, x));
+        static assert(!__traits(isLazy, x));
+    }
+
+    void fooout(out int x)
+    {
+        static assert(!__traits(isRef, x));
+        static assert(__traits(isOut, x));
+        static assert(!__traits(isLazy, x));
+    }
+
+    void foolazy(lazy int x)
+    {
+        static assert(!__traits(isRef, x));
+        static assert(!__traits(isOut, x));
+        static assert(__traits(isLazy, x));
+    }
+}
+
+/********************************************************/
+
+void test21()
+{
+    assert(__traits(isStaticFunction, C.bar) == false);
+    assert(__traits(isStaticFunction, C.abc) == true);
+    assert(__traits(isStaticFunction, S.bar) == false);
+}
+
+/********************************************************/
+
+class D22
+{
+    this() { }
+    ~this() { }
+    void foo() { }
+    int foo(int) { return 2; }
+}
+
+void test22()
+{
+    D22 d = new D22();
+
+    foreach (t; __traits(getOverloads, D22, "foo"))
+        writeln(typeid(typeof(t)));
+
+    alias typeof(__traits(getOverloads, D22, "foo")) b;
+    foreach (t; b)
+        writeln(typeid(t));
+
+    auto i = __traits(getOverloads, d, "foo")[1](1);
+    assert(i == 2);
+}
+
+/********************************************************/
+
+string toString23(E)(E value) if (is(E == enum)) {
+   foreach (s; __traits(allMembers, E)) {
+      if (value == mixin("E." ~ s)) return s;
+   }
+   return null;
+}
+
+enum OddWord { acini, alembicated, prolegomena, aprosexia }
+
+void test23()
+{
+   auto w = OddWord.alembicated;
+   assert(toString23(w) == "alembicated");
+}
+
+/********************************************************/
+
+struct Test24
+{
+    public void test24(int){}
+    private void test24(int, int){}
+}
+
+static assert(__traits(getProtection, __traits(getOverloads, Test24, "test24")[1]) == "private");
+
+/********************************************************/
+// 1369
+
+void test1369()
+{
+    class C1
+    {
+        static int count;
+        void func() { count++; }
+    }
+
+    // variable symbol
+    C1 c1 = new C1;
+    __traits(getMember, c1, "func")();      // TypeIdentifier -> VarExp
+    __traits(getMember, mixin("c1"), "func")(); // Expression -> VarExp
+    assert(C1.count == 2);
+
+    // nested function symbol
+    @property C1 get() { return c1; }
+    __traits(getMember, get, "func")();
+    __traits(getMember, mixin("get"), "func")();
+    assert(C1.count == 4);
+
+    class C2
+    {
+        C1 c1;
+        this() { c1 = new C1; }
+        void test()
+        {
+            // variable symbol (this.outer.c1)
+            __traits(getMember, c1, "func")();      // TypeIdentifier -> VarExp -> DotVarExp
+            __traits(getMember, mixin("c1"), "func")(); // Expression -> VarExp -> DotVarExp
+            assert(C1.count == 6);
+
+            // nested function symbol (this.outer.get)
+            __traits(getMember, get, "func")();
+            __traits(getMember, mixin("get"), "func")();
+            assert(C1.count == 8);
+        }
+    }
+    C2 c2 = new C2;
+    c2.test();
+}
+
+/********************************************************/
+
+template Foo2234(){ int x; }
+
+struct S2234a{ mixin Foo2234; }
+struct S2234b{ mixin Foo2234; mixin Foo2234; }
+struct S2234c{ alias Foo2234!() foo; }
+
+static assert([__traits(allMembers, S2234a)] == ["x"]);
+static assert([__traits(allMembers, S2234b)] == ["x"]);
+static assert([__traits(allMembers, S2234c)] == ["foo"]);
+
+/********************************************************/
+// 5878
+
+template J5878(A)
+{
+    static if (is(A P == super))
+        alias P J5878;
+}
+
+alias J5878!(A5878) Z5878;
+
+class X5878 {}
+class A5878 : X5878 {}
+
+/********************************************************/
+
+mixin template Members6674()
+{
+    static int i1;
+    static int i2;
+    static int i3;  //comment out to make func2 visible
+    static int i4;  //comment out to make func1 visible
+}
+
+class Test6674
+{
+    mixin Members6674;
+
+    alias void function() func1;
+    alias bool function() func2;
+}
+
+static assert([__traits(allMembers,Test6674)] == [
+    "i1","i2","i3","i4",
+    "func1","func2",
+    "toString","toHash","opCmp","opEquals","Monitor","factory"]);
+
+/********************************************************/
+// 6073
+
+struct S6073 {}
+
+template T6073(M...) {
+    //alias int T;
+}
+alias T6073!traits V6073;                       // ok
+alias T6073!(__traits(parent, S6073)) U6073;    // error
+static assert(__traits(isSame, V6073, U6073));  // same instantiation == same arguemnts
+
+/********************************************************/
+// 7027
+
+struct Foo7027 { int a; }
+static assert(!__traits(compiles, { return Foo7027.a; }));
+
+/********************************************************/
+// 9213
+
+class Foo9213 { int a; }
+static assert(!__traits(compiles, { return Foo9213.a; }));
+
+/********************************************************/
+
+interface AA
+{
+     int YYY();
+}
+
+class CC : AA
+{
+    final int YYY() { return 4; }
+}
+
+static assert(__traits(isVirtualMethod, CC.YYY));
+static assert(__traits(getVirtualMethods, CC, "YYY").length == 1);
+
+class DD
+{
+    final int YYY() { return 4; }
+}
+
+static assert(__traits(isVirtualMethod, DD.YYY) == false);
+static assert(__traits(getVirtualMethods, DD, "YYY").length == 0);
+
+class EE
+{
+     int YYY() { return 0; }
+}
+
+class FF : EE
+{
+    final override int YYY() { return 4; }
+}
+
+static assert(__traits(isVirtualMethod, FF.YYY));
+static assert(__traits(getVirtualMethods, FF, "YYY").length == 1);
+
+/********************************************************/
+// 7608
+
+struct S7608a(bool T)
+{
+    static if (T) { int x; }
+    int y;
+}
+struct S7608b
+{
+    version(none) { int x; }
+    int y;
+}
+template TypeTuple7608(T...){ alias T TypeTuple7608; }
+void test7608()
+{
+    alias TypeTuple7608!(__traits(allMembers, S7608a!false)) MembersA;
+    static assert(MembersA.length == 1);
+    static assert(MembersA[0] == "y");
+
+    alias TypeTuple7608!(__traits(allMembers, S7608b)) MembersB;
+    static assert(MembersB.length == 1);
+    static assert(MembersB[0] == "y");
+}
+
+/********************************************************/
+// 7858
+
+void test7858()
+{
+    class C
+    {
+        final void ffunc(){}
+        final void ffunc(int){}
+
+        void vfunc(){}
+        void vfunc(int){}
+
+        abstract void afunc();
+        abstract void afunc(int);
+
+        static void sfunc(){}
+        static void sfunc(int){}
+    }
+
+    static assert(__traits(isFinalFunction, C.ffunc) ==
+                  __traits(isFinalFunction, __traits(getOverloads, C, "ffunc")[0]));    // NG
+    static assert(__traits(isVirtualFunction, C.vfunc) ==
+                  __traits(isVirtualFunction, __traits(getOverloads, C, "vfunc")[0]));  // NG
+    static assert(__traits(isVirtualMethod, C.vfunc) ==
+                  __traits(isVirtualMethod, __traits(getOverloads, C, "vfunc")[0]));    // NG
+    static assert(__traits(isAbstractFunction, C.afunc) ==
+                  __traits(isAbstractFunction, __traits(getOverloads, C, "afunc")[0])); // OK
+    static assert(__traits(isStaticFunction, C.sfunc) ==
+                  __traits(isStaticFunction, __traits(getOverloads, C, "sfunc")[0]));   // OK
+
+    static assert(__traits(isSame, C.ffunc, __traits(getOverloads, C, "ffunc")[0]));    // NG
+    static assert(__traits(isSame, C.vfunc, __traits(getOverloads, C, "vfunc")[0]));    // NG
+    static assert(__traits(isSame, C.afunc, __traits(getOverloads, C, "afunc")[0]));    // NG
+    static assert(__traits(isSame, C.sfunc, __traits(getOverloads, C, "sfunc")[0]));    // NG
+}
+
+/********************************************************/
+// 8971
+
+template Tuple8971(TL...){ alias TL Tuple8971; }
+
+class A8971
+{
+    void bar() {}
+
+    void connect()
+    {
+        alias Tuple8971!(__traits(getOverloads, typeof(this), "bar")) overloads;
+        static assert(__traits(isSame, overloads[0], bar));
+    }
+}
+
+/********************************************************/
+// 8972
+
+struct A8972
+{
+    void foo() {}
+
+    void connect()
+    {
+        alias Tuple8971!(__traits(getOverloads, typeof(this), "foo")) overloads;
+        static assert(__traits(isSame, overloads[0], foo));
+    }
+}
+
+/********************************************************/
+
+private   struct TestProt1 {}
+package   struct TestProt2 {}
+protected struct TestProt3 {}
+public    struct TestProt4 {}
+export    struct TestProt5 {}
+
+void getProtection()
+{
+    class Test
+    {
+        private   { int va; void fa(){} }
+        package   { int vb; void fb(){} }
+        protected { int vc; void fc(){} }
+        public    { int vd; void fd(){} }
+        export    { int ve; void fe(){} }
+    }
+    Test t;
+
+    // TOKvar and VarDeclaration
+    static assert(__traits(getProtection, Test.va) == "private");
+    static assert(__traits(getProtection, Test.vb) == "package");
+    static assert(__traits(getProtection, Test.vc) == "protected");
+    static assert(__traits(getProtection, Test.vd) == "public");
+    static assert(__traits(getProtection, Test.ve) == "export");
+
+    // TOKdotvar and VarDeclaration
+    static assert(__traits(getProtection, t.va) == "private");
+    static assert(__traits(getProtection, t.vb) == "package");
+    static assert(__traits(getProtection, t.vc) == "protected");
+    static assert(__traits(getProtection, t.vd) == "public");
+    static assert(__traits(getProtection, t.ve) == "export");
+
+    // TOKvar and FuncDeclaration
+    static assert(__traits(getProtection, Test.fa) == "private");
+    static assert(__traits(getProtection, Test.fb) == "package");
+    static assert(__traits(getProtection, Test.fc) == "protected");
+    static assert(__traits(getProtection, Test.fd) == "public");
+    static assert(__traits(getProtection, Test.fe) == "export");
+
+    // TOKdotvar and FuncDeclaration
+    static assert(__traits(getProtection, t.fa) == "private");
+    static assert(__traits(getProtection, t.fb) == "package");
+    static assert(__traits(getProtection, t.fc) == "protected");
+    static assert(__traits(getProtection, t.fd) == "public");
+    static assert(__traits(getProtection, t.fe) == "export");
+
+    // TOKtype
+    static assert(__traits(getProtection, TestProt1) == "private");
+    static assert(__traits(getProtection, TestProt2) == "package");
+    static assert(__traits(getProtection, TestProt3) == "protected");
+    static assert(__traits(getProtection, TestProt4) == "public");
+    static assert(__traits(getProtection, TestProt5) == "export");
+
+    // This specific pattern is important to ensure it always works
+    // through reflection, however that becomes implemented
+    static assert(__traits(getProtection, __traits(getMember, t, "va")) == "private");
+    static assert(__traits(getProtection, __traits(getMember, t, "vb")) == "package");
+    static assert(__traits(getProtection, __traits(getMember, t, "vc")) == "protected");
+    static assert(__traits(getProtection, __traits(getMember, t, "vd")) == "public");
+    static assert(__traits(getProtection, __traits(getMember, t, "ve")) == "export");
+    static assert(__traits(getProtection, __traits(getMember, t, "fa")) == "private");
+    static assert(__traits(getProtection, __traits(getMember, t, "fb")) == "package");
+    static assert(__traits(getProtection, __traits(getMember, t, "fc")) == "protected");
+    static assert(__traits(getProtection, __traits(getMember, t, "fd")) == "public");
+    static assert(__traits(getProtection, __traits(getMember, t, "fe")) == "export");
+}
+
+/********************************************************/
+// 9546
+
+void test9546()
+{
+    import imports.a9546 : S;
+
+    S s;
+    static assert(__traits(getProtection, s.privA) == "private");
+    static assert(__traits(getProtection, s.protA) == "protected");
+    static assert(__traits(getProtection, s.packA) == "package");
+    static assert(__traits(getProtection, S.privA) == "private");
+    static assert(__traits(getProtection, S.protA) == "protected");
+    static assert(__traits(getProtection, S.packA) == "package");
+
+    static assert(__traits(getProtection, mixin("s.privA")) == "private");
+    static assert(__traits(getProtection, mixin("s.protA")) == "protected");
+    static assert(__traits(getProtection, mixin("s.packA")) == "package");
+    static assert(__traits(getProtection, mixin("S.privA")) == "private");
+    static assert(__traits(getProtection, mixin("S.protA")) == "protected");
+    static assert(__traits(getProtection, mixin("S.packA")) == "package");
+
+    static assert(__traits(getProtection, __traits(getMember, s, "privA")) == "private");
+    static assert(__traits(getProtection, __traits(getMember, s, "protA")) == "protected");
+    static assert(__traits(getProtection, __traits(getMember, s, "packA")) == "package");
+    static assert(__traits(getProtection, __traits(getMember, S, "privA")) == "private");
+    static assert(__traits(getProtection, __traits(getMember, S, "protA")) == "protected");
+    static assert(__traits(getProtection, __traits(getMember, S, "packA")) == "package");
+
+    static assert(__traits(getProtection, s.privF) == "private");
+    static assert(__traits(getProtection, s.protF) == "protected");
+    static assert(__traits(getProtection, s.packF) == "package");
+    static assert(__traits(getProtection, S.privF) == "private");
+    static assert(__traits(getProtection, S.protF) == "protected");
+    static assert(__traits(getProtection, S.packF) == "package");
+
+    static assert(__traits(getProtection, mixin("s.privF")) == "private");
+    static assert(__traits(getProtection, mixin("s.protF")) == "protected");
+    static assert(__traits(getProtection, mixin("s.packF")) == "package");
+    static assert(__traits(getProtection, mixin("S.privF")) == "private");
+    static assert(__traits(getProtection, mixin("S.protF")) == "protected");
+    static assert(__traits(getProtection, mixin("S.packF")) == "package");
+
+    static assert(__traits(getProtection, __traits(getMember, s, "privF")) == "private");
+    static assert(__traits(getProtection, __traits(getMember, s, "protF")) == "protected");
+    static assert(__traits(getProtection, __traits(getMember, s, "packF")) == "package");
+    static assert(__traits(getProtection, __traits(getMember, S, "privF")) == "private");
+    static assert(__traits(getProtection, __traits(getMember, S, "protF")) == "protected");
+    static assert(__traits(getProtection, __traits(getMember, S, "packF")) == "package");
+}
+
+/********************************************************/
+// 9091
+
+template isVariable9091(X...) if (X.length == 1)
+{
+    enum isVariable9091 = true;
+}
+class C9091
+{
+    int x;  // some class members
+    void func(int n){ this.x = n; }
+
+    void test()
+    {
+        alias T = C9091;
+        enum is_x = isVariable9091!(__traits(getMember, T, "x"));
+
+        foreach (i, m; __traits(allMembers, T))
+        {
+            enum x = isVariable9091!(__traits(getMember, T, m));
+            static if (i == 0)  // x
+            {
+                __traits(getMember, T, m) = 10;
+                assert(this.x == 10);
+            }
+            static if (i == 1)  // func
+            {
+                __traits(getMember, T, m)(20);
+                assert(this.x == 20);
+            }
+        }
+    }
+}
+struct S9091
+{
+    int x;  // some struct members
+    void func(int n){ this.x = n; }
+
+    void test()
+    {
+        alias T = S9091;
+        enum is_x = isVariable9091!(__traits(getMember, T, "x"));
+
+        foreach (i, m; __traits(allMembers, T))
+        {
+            enum x = isVariable9091!(__traits(getMember, T, m));
+            static if (i == 0)  // x
+            {
+                __traits(getMember, T, m) = 10;
+                assert(this.x == 10);
+            }
+            static if (i == 1)  // func
+            {
+                __traits(getMember, T, m)(20);
+                assert(this.x == 20);
+            }
+        }
+    }
+}
+
+void test9091()
+{
+    auto c = new C9091();
+    c.test();
+
+    auto s = S9091();
+    s.test();
+}
+
+/********************************************************/
+
+struct CtorS_9237 { this(int x) { } }       // ctor -> POD
+struct DtorS_9237 { ~this() { } }           // dtor -> nonPOD
+struct PostblitS_9237 { this(this) { } }    // cpctor -> nonPOD
+
+struct NonPOD1_9237
+{
+    DtorS_9237 field;  // nonPOD -> ng
+}
+
+struct NonPOD2_9237
+{
+    DtorS_9237[2] field;  // static array of nonPOD -> ng
+}
+
+struct POD1_9237
+{
+    DtorS_9237* field;  // pointer to nonPOD -> ok
+}
+
+struct POD2_9237
+{
+    DtorS_9237[] field;  // dynamic array of nonPOD -> ok
+}
+
+struct POD3_9237
+{
+    int x = 123;
+}
+
+class C_9273 { }
+
+void test9237()
+{
+    int x;
+    struct NS_9237  // acceses .outer -> nested
+    {
+        void foo() { x++; }
+    }
+
+    struct NonNS_9237 { }  // doesn't access .outer -> non-nested
+    static struct StatNS_9237 { }  // can't access .outer -> non-nested
+
+    static assert(!__traits(isPOD, NS_9237));
+    static assert(__traits(isPOD, NonNS_9237));
+    static assert(__traits(isPOD, StatNS_9237));
+    static assert(__traits(isPOD, CtorS_9237));
+    static assert(!__traits(isPOD, DtorS_9237));
+    static assert(!__traits(isPOD, PostblitS_9237));
+    static assert(!__traits(isPOD, NonPOD1_9237));
+    static assert(!__traits(isPOD, NonPOD2_9237));
+    static assert(__traits(isPOD, POD1_9237));
+    static assert(__traits(isPOD, POD2_9237));
+    static assert(__traits(isPOD, POD3_9237));
+
+    // static array of POD/non-POD types
+    static assert(!__traits(isPOD, NS_9237[2]));
+    static assert(__traits(isPOD, NonNS_9237[2]));
+    static assert(__traits(isPOD, StatNS_9237[2]));
+    static assert(__traits(isPOD, CtorS_9237[2]));
+    static assert(!__traits(isPOD, DtorS_9237[2]));
+    static assert(!__traits(isPOD, PostblitS_9237[2]));
+    static assert(!__traits(isPOD, NonPOD1_9237[2]));
+    static assert(!__traits(isPOD, NonPOD2_9237[2]));
+    static assert(__traits(isPOD, POD1_9237[2]));
+    static assert(__traits(isPOD, POD2_9237[2]));
+    static assert(__traits(isPOD, POD3_9237[2]));
+
+    // non-structs are POD types
+    static assert(__traits(isPOD, C_9273));
+    static assert(__traits(isPOD, int));
+    static assert(__traits(isPOD, int*));
+    static assert(__traits(isPOD, int[]));
+    static assert(!__traits(compiles, __traits(isPOD, 123) ));
+}
+
+/*************************************************************/
+// 5978
+
+void test5978()
+{
+    () {
+        int x;
+        pragma(msg, __traits(identifier, __traits(parent, x)));
+    } ();
+}
+
+/*************************************************************/
+
+template T7408() { }
+
+void test7408()
+{
+    auto x = T7408!().stringof;
+    auto y = T7408!().mangleof;
+    static assert(__traits(compiles, T7408!().stringof));
+    static assert(__traits(compiles, T7408!().mangleof));
+    static assert(!__traits(compiles, T7408!().init));
+    static assert(!__traits(compiles, T7408!().offsetof));
+}
+
+/*************************************************************/
+// 9552
+
+class C9552
+{
+    int f() { return 10; }
+    int f(int n) { return n * 2; }
+}
+
+void test9552()
+{
+    auto c = new C9552;
+    auto dg1 = &(__traits(getOverloads, c, "f")[0]); // DMD crashes
+    assert(dg1() == 10);
+    auto dg2 = &(__traits(getOverloads, c, "f")[1]);
+    assert(dg2(10) == 20);
+}
+
+/*************************************************************/
+
+void test9136()
+{
+    int x;
+    struct S1 { void f() { x++; } }
+    struct U1 { void f() { x++; } }
+    static struct S2 { }
+    static struct S3 { S1 s; }
+    static struct U2 { }
+    void f1() { x++; }
+    static void f2() { }
+
+    static assert(__traits(isNested, S1));
+    static assert(__traits(isNested, U1));
+    static assert(!__traits(isNested, S2));
+    static assert(!__traits(isNested, S3));
+    static assert(!__traits(isNested, U2));
+    static assert(!__traits(compiles, __traits(isNested, int) ));
+    static assert(!__traits(compiles, __traits(isNested, f1, f2) ));
+    static assert(__traits(isNested, f1));
+    static assert(!__traits(isNested, f2));
+
+    static class A { static class SC { } class NC { } }
+    static assert(!__traits(isNested, A));
+    static assert(!__traits(isNested, A.SC));
+    static assert(__traits(isNested, A.NC));
+}
+
+/********************************************************/
+// 9939
+
+struct Test9939
+{
+    int f;
+    enum /*Anonymous enum*/
+    {
+        A,
+        B
+    }
+    enum NamedEnum
+    {
+        C,
+        D
+    }
+}
+
+static assert([__traits(allMembers, Test9939)] == ["f", "A", "B", "NamedEnum"]);
+
+/********************************************************/
+// 10043
+
+void test10043()
+{
+    struct X {}
+    X d1;
+    static assert(!__traits(compiles, d1.structuralCast!Refleshable));
+}
+
+/********************************************************/
+// 10096
+
+struct S10096X
+{
+    string str;
+
+    invariant() {}
+    invariant() {}
+    unittest {}
+
+    this(int) {}
+    this(this) {}
+    ~this() {}
+}
+static assert(
+    [__traits(allMembers, S10096X)] ==
+    ["str", "__ctor", "__postblit", "__dtor", "__xdtor", "__xpostblit", "opAssign"]);
+
+// --------
+
+string foo10096(alias var, T = typeof(var))()
+{
+    foreach (idx, member; __traits(allMembers, T))
+    {
+        auto x = var.tupleof[idx];
+    }
+
+    return "";
+}
+
+string foo10096(T)(T var)
+{
+    return "";
+}
+
+struct S10096
+{
+    int i;
+    string s;
+}
+
+void test10096()
+{
+    S10096 s = S10096(1, "");
+    auto x = foo10096!s;
+}
+
+/********************************************************/
+
+unittest { }
+
+struct GetUnitTests
+{
+    unittest { }
+}
+
+void test_getUnitTests ()
+{
+    // Always returns empty tuple if the -unittest flag isn't used
+    static assert(__traits(getUnitTests, mixin(__MODULE__)).length == 0);
+    static assert(__traits(getUnitTests, GetUnitTests).length == 0);
+}
+
+/********************************************************/
+
+void test_getFunctionAttributes()
+{
+    alias tuple(T...) = T;
+
+    struct S
+    {
+        int noF() { return 0; }
+        int constF() const { return 0; }
+        int immutableF() immutable { return 0; }
+        int inoutF() inout { return 0; }
+        int sharedF() shared { return 0; }
+
+        int x;
+        ref int refF() { return x; }
+        int propertyF() @property { return 0; }
+        int nothrowF() nothrow { return 0; }
+        int nogcF() @nogc { return 0; }
+
+        int systemF() @system { return 0; }
+        int trustedF() @trusted { return 0; }
+        int safeF() @safe { return 0; }
+
+        int pureF() pure { return 0; }
+    }
+
+    static assert(__traits(getFunctionAttributes, S.noF) == tuple!("@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S.noF)) == tuple!("@system"));
+
+    static assert(__traits(getFunctionAttributes, S.constF) == tuple!("const", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S.constF)) == tuple!("const", "@system"));
+
+    static assert(__traits(getFunctionAttributes, S.immutableF) == tuple!("immutable", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S.immutableF)) == tuple!("immutable", "@system"));
+
+    static assert(__traits(getFunctionAttributes, S.inoutF) == tuple!("inout", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S.inoutF)) == tuple!("inout", "@system"));
+
+    static assert(__traits(getFunctionAttributes, S.sharedF) == tuple!("shared", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S.sharedF)) == tuple!("shared", "@system"));
+
+    static assert(__traits(getFunctionAttributes, S.refF) == tuple!("ref", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S.refF)) == tuple!("ref", "@system"));
+
+    static assert(__traits(getFunctionAttributes, S.propertyF) == tuple!("@property", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(&S.propertyF)) == tuple!("@property", "@system"));
+
+    static assert(__traits(getFunctionAttributes, S.nothrowF) == tuple!("nothrow", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S.nothrowF)) == tuple!("nothrow", "@system"));
+
+    static assert(__traits(getFunctionAttributes, S.nogcF) == tuple!("@nogc", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S.nogcF)) == tuple!("@nogc", "@system"));
+
+    static assert(__traits(getFunctionAttributes, S.systemF) == tuple!("@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S.systemF)) == tuple!("@system"));
+
+    static assert(__traits(getFunctionAttributes, S.trustedF) == tuple!("@trusted"));
+    static assert(__traits(getFunctionAttributes, typeof(S.trustedF)) == tuple!("@trusted"));
+
+    static assert(__traits(getFunctionAttributes, S.safeF) == tuple!("@safe"));
+    static assert(__traits(getFunctionAttributes, typeof(S.safeF)) == tuple!("@safe"));
+
+    static assert(__traits(getFunctionAttributes, S.pureF) == tuple!("pure", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S.pureF)) == tuple!("pure", "@system"));
+
+    int pure_nothrow() nothrow pure { return 0; }
+    static ref int static_ref_property() @property { return *(new int); }
+    ref int ref_property() @property { return *(new int); }
+    void safe_nothrow() @safe nothrow { }
+
+    static assert(__traits(getFunctionAttributes, pure_nothrow) == tuple!("pure", "nothrow", "@nogc", "@safe"));
+    static assert(__traits(getFunctionAttributes, typeof(pure_nothrow)) == tuple!("pure", "nothrow", "@nogc", "@safe"));
+
+    static assert(__traits(getFunctionAttributes, static_ref_property) == tuple!("pure", "nothrow", "@property", "ref", "@safe"));
+    static assert(__traits(getFunctionAttributes, typeof(&static_ref_property)) == tuple!("pure", "nothrow", "@property", "ref", "@safe"));
+
+    static assert(__traits(getFunctionAttributes, ref_property) == tuple!("pure", "nothrow", "@property", "ref", "@safe"));
+    static assert(__traits(getFunctionAttributes, typeof(&ref_property)) == tuple!("pure", "nothrow", "@property", "ref", "@safe"));
+
+    static assert(__traits(getFunctionAttributes, safe_nothrow) == tuple!("pure", "nothrow", "@nogc", "@safe"));
+    static assert(__traits(getFunctionAttributes, typeof(safe_nothrow)) == tuple!("pure", "nothrow", "@nogc", "@safe"));
+
+    struct S2
+    {
+        int pure_const() const pure { return 0; }
+        int pure_sharedconst() const shared pure { return 0; }
+    }
+
+    static assert(__traits(getFunctionAttributes, S2.pure_const) == tuple!("const", "pure", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S2.pure_const)) == tuple!("const", "pure", "@system"));
+
+    static assert(__traits(getFunctionAttributes, S2.pure_sharedconst) == tuple!("const", "shared", "pure", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(S2.pure_sharedconst)) == tuple!("const", "shared", "pure", "@system"));
+
+    static assert(__traits(getFunctionAttributes, (int a) { }) == tuple!("pure", "nothrow", "@nogc", "@safe"));
+    static assert(__traits(getFunctionAttributes, typeof((int a) { })) == tuple!("pure", "nothrow", "@nogc", "@safe"));
+
+    auto safeDel = delegate() @safe { };
+    static assert(__traits(getFunctionAttributes, safeDel) == tuple!("pure", "nothrow", "@nogc", "@safe"));
+    static assert(__traits(getFunctionAttributes, typeof(safeDel)) == tuple!("pure", "nothrow", "@nogc", "@safe"));
+
+    auto trustedDel = delegate() @trusted { };
+    static assert(__traits(getFunctionAttributes, trustedDel) == tuple!("pure", "nothrow", "@nogc", "@trusted"));
+    static assert(__traits(getFunctionAttributes, typeof(trustedDel)) == tuple!("pure", "nothrow", "@nogc", "@trusted"));
+
+    auto systemDel = delegate() @system { };
+    static assert(__traits(getFunctionAttributes, systemDel) == tuple!("pure", "nothrow", "@nogc", "@system"));
+    static assert(__traits(getFunctionAttributes, typeof(systemDel)) == tuple!("pure", "nothrow", "@nogc", "@system"));
+}
+
+/********************************************************/
+
+class TestIsOverrideFunctionBase
+{
+    void bar () {}
+}
+
+class TestIsOverrideFunctionPass : TestIsOverrideFunctionBase
+{
+    override void bar () {}
+}
+
+void test_isOverrideFunction ()
+{
+    assert(__traits(isOverrideFunction, TestIsOverrideFunctionPass.bar) == true);
+    assert(__traits(isOverrideFunction, TestIsOverrideFunctionBase.bar) == false);
+}
+
+/********************************************************/
+// 11711 - Add __traits(getAliasThis)
+
+alias TypeTuple(T...) = T;
+
+void test11711()
+{
+    struct S1
+    {
+        string var;
+        alias var this;
+    }
+    static assert(__traits(getAliasThis, S1) == TypeTuple!("var"));
+    static assert(is(typeof(__traits(getMember, S1.init, __traits(getAliasThis, S1)[0]))
+                == string));
+
+    struct S2
+    {
+        TypeTuple!(int, string) var;
+        alias var this;
+    }
+    static assert(__traits(getAliasThis, S2) == TypeTuple!("var"));
+    static assert(is(typeof(__traits(getMember, S2.init, __traits(getAliasThis, S2)[0]))
+                == TypeTuple!(int, string)));
+}
+
+
+/********************************************************/
+// Issue 12278
+
+class Foo12278
+{
+    InPlace12278!Bar12278 inside;
+}
+
+class Bar12278 { }
+
+struct InPlace12278(T)
+{
+    static assert(__traits(classInstanceSize, T) != 0);
+}
+
+/********************************************************/
+// 12571
+
+mixin template getScopeName12571()
+{
+    enum string scopeName = __traits(identifier, __traits(parent, scopeName));
+}
+
+void test12571()
+{
+    mixin getScopeName12571;
+    static assert(scopeName == "test12571");
+}
+
+/********************************************************/
+// 12237
+
+auto f12237(T)(T a)
+{
+    static if (is(typeof(a) == int))
+        return f12237("");
+    else
+        return 10;
+}
+
+void test12237()
+{
+    assert(f12237(1) == 10);
+
+    assert((a){
+        static if (is(typeof(a) == int))
+        {
+            int x;
+            return __traits(parent, x)("");
+        }
+        else
+            return 10;
+    }(1) == 10);
+}
+
+/********************************************************/
+
+void async(ARGS...)(ARGS)
+{
+        static void compute(ARGS)
+        {
+        }
+
+        auto x = __traits(getParameterStorageClasses, compute, 1);
+}
+
+alias test17495 = async!(int, int);
+
+/********************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test7123();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test1369();
+    test7608();
+    test7858();
+    test9091();
+    test5978();
+    test7408();
+    test9552();
+    test9136();
+    test10096();
+    test_getUnitTests();
+    test_getFunctionAttributes();
+    test_isOverrideFunction();
+    test12237();
+
+    writeln("Success");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/traits_getPointerBitmap.d b/gcc/testsuite/gdc.test/runnable/traits_getPointerBitmap.d
new file mode 100644
index 00000000000..a3c630cf04b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/traits_getPointerBitmap.d
@@ -0,0 +1,266 @@
+
+module traits_getPointerBitmap;
+
+import std.stdio;
+static import std.traits;
+
+// version = RTInfo;
+// debug = LOG;
+
+version(RTInfo)
+    import gc.rtinfo;
+else
+    enum bool RTInfoMark__Monitor = false; // is __monitor GC allocated?
+
+
+enum bytesPerPtr = (size_t.sizeof);
+enum bytesPerBitmapWord = bytesPerPtr * bytesPerPtr * 8;
+
+template allocatedSize(T)
+{
+    static if (is (T == class))
+        enum allocatedSize = __traits(classInstanceSize, T);
+    else
+        enum allocatedSize = T.sizeof;
+}
+
+bool testBit(const(size_t)* p, size_t biti)
+{
+    enum BITS_SHIFT = (size_t.sizeof == 8 ? 6 : 5);
+    enum BITS_MASK = (bytesPerPtr - 1);
+
+    return (p[biti >> BITS_SHIFT] & (1 << (biti & BITS_MASK))) != 0;
+}
+
+void __testType(T)(size_t[] expected)
+{
+    // check compile time info
+    enum bits  = (T.sizeof + bytesPerPtr - 1) / bytesPerPtr;
+    enum words = (T.sizeof + bytesPerBitmapWord - 1) / bytesPerBitmapWord;
+    version(RTInfo)
+        enum info = RTInfoImpl2!(Unqual!T); // we want the array, not the pointer
+    else
+        enum info = __traits(getPointerBitmap,T); // we want the array, not the pointer
+
+    debug(LOG) writef("%-20s:", T.stringof);
+    debug(LOG) writef(" CT:%s", info);
+    debug(LOG) writef(" EXP:%d %s", allocatedSize!T, expected);
+    assert(info[0] == allocatedSize!T);
+    assert(info[1..$] == expected);
+    assert(words == expected.length);
+
+    debug(LOG) writeln();
+}
+
+///////////////////////////////////////
+struct S(T, aliasTo = void)
+{
+    static if(!is(aliasTo == void))
+    {
+        aliasTo a;
+        alias a this;
+    }
+
+    size_t x;
+    T t = void;
+    void* p;
+
+}
+
+template tOff(T)
+{
+    enum tOff = T.t.offsetof / bytesPerPtr;
+}
+
+template pOff(T)
+{
+    enum pOff = T.p.offsetof / bytesPerPtr;
+}
+
+class C(T, aliasTo = void)
+{
+    static if(!is(aliasTo == void))
+    {
+        aliasTo a;
+        alias a this;
+    }
+
+    size_t x;
+    T t = void;
+    void* p;
+}
+
+///////////////////////////////////////
+
+void _testType(T)(size_t[] expected)
+{
+    __testType!(T)(expected);
+    __testType!(const(T))(expected);
+    __testType!(immutable(T))(expected);
+    version(RTInfo) {} else // Unqual does not work with shared(T[N])
+        __testType!(shared(T))(expected);
+}
+
+void testType(T)(size_t[] expected)
+{
+    _testType!(T)(expected);
+
+    // generate bit pattern for S!T
+    assert(expected.length == 1);
+    size_t[] sexp;
+
+    sexp ~= (expected[0] << tOff!(S!T)) | (1 << pOff!((S!T)));
+    _testType!(S!T)(sexp);
+
+    // prepend Object
+    sexp[0] = (expected[0] << tOff!(S!(T, Object))) | (1 << pOff!(S!(T, Object))) | 1;
+    _testType!(S!(T, Object))(sexp);
+
+    // prepend string
+    sexp[0] = (expected[0] << tOff!(S!(T, string))) | (1 << pOff!(S!(T, string))) | 2; // arr ptr
+    _testType!(S!(T, string))(sexp);
+
+    // generate bit pattern for C!T
+    C!T ct = null;
+    size_t mutexBit = (RTInfoMark__Monitor ? 2 : 0);
+    size_t ctpOff = ct.p.offsetof / bytesPerPtr;
+    size_t cttOff = ct.t.offsetof / bytesPerPtr;
+    sexp[0] = (expected[0] << cttOff) | (1 << ctpOff) | mutexBit;
+    _testType!(C!(T))(sexp);
+
+    C!(T, string) cts = null;
+    size_t ctspOff = cts.p.offsetof / bytesPerPtr;
+    size_t ctstOff = cts.t.offsetof / bytesPerPtr;
+    // generate bit pattern for C!T
+    sexp[0] = (expected[0] << ctstOff) | (1 << ctspOff) | mutexBit | 0b1000; // arr ptr
+    _testType!(C!(T, string))(sexp);
+}
+
+///////////////////////////////////////
+alias void[2*size_t.sizeof] void2;
+alias size_t[3] int3;
+alias size_t*[3] pint3;
+alias string[3] sint3;
+alias string[3][2] sint3_2;
+alias int delegate() dg;
+alias int function() fn;
+
+// span multiple bitmap elements
+struct Large
+{
+    size_t[30] data1;
+    void* p1;
+    size_t[1] val1;
+
+    size_t[28] data2;
+    void* p2;
+    size_t[3] val2;
+
+    size_t[16] data3;
+    void* p3;
+    size_t[15] val3;
+}
+
+class N
+{
+    struct Nested
+    {
+        // no outer for structs
+        size_t x;
+        void* p1;
+        Large* s;
+
+        void foo() {} // need member fnction to not be POD
+    }
+    class CNested
+    {
+        // implicit vtptr,monitor
+        size_t x;
+        void* p1;
+        size_t y;
+        // implicit outer
+    }
+    class CNestedDerived : CNested
+    {
+        size_t[3] z;
+        void* p;
+    }
+}
+
+union U
+{
+    size_t data[4];
+    Large*[] arr; // { length, ptr }
+
+    struct
+    {
+        size_t d1;
+        size_t d2;
+        size_t d3;
+        void* p;
+    }
+}
+
+void testRTInfo()
+{
+    testType!(bool)         ([ 0b0 ]);
+    testType!(ubyte)        ([ 0b0 ]);
+    testType!(short)        ([ 0b0 ]);
+    testType!(int)          ([ 0b0 ]);
+    testType!(long)         ([ 0b00 ]);
+    testType!(double)       ([ 0b00 ]);
+    testType!(ifloat)       ([ 0b0 ]);
+    testType!(cdouble)      ([ 0b0000 ]);
+    testType!(dg)           ([ 0b01 ]);
+    testType!(fn)           ([ 0b0 ]);
+    testType!(S!fn)         ([ 0b100 ]);
+    version(D_LP64)
+        testType!(__vector(float[4]))  ([ 0b00 ]);
+
+    testType!(Object[int])       ([ 0b1 ]);
+    testType!(Object[])       ([ 0b10 ]);
+    testType!(string)         ([ 0b10 ]);
+
+    testType!(int3)           ([ 0b000 ]);
+    testType!(pint3)          ([ 0b111 ]);
+    testType!(sint3)          ([ 0b101010 ]);
+    testType!(sint3_2)        ([ 0b101010101010 ]);
+    testType!(void2)          ([ 0b11 ]);
+    testType!(U)              ([ 0b1010 ]);
+
+    version(D_LP64)
+        _testType!(Large)          ([ 0x1000_0000__4000_0000, 0x0001_0000 ]);
+    else
+        _testType!(Large)          ([ 0x4000_0000, 0x1000_0000, 0x0001_0000 ]);
+
+    _testType!(N.CNested)     ([ 0b101000 ]);
+    _testType!(N.CNestedDerived) ([ 0b1000101000 ]);
+
+    testType!(N.Nested)       ([ 0b110 ]);
+
+    struct SFNested
+    {
+        size_t[2] d;
+        void* p1;
+        fn f;
+        // implicite outer
+
+        void foo() {} // need member fnction to not be POD
+    }
+
+    class CFNested
+    {
+        // implicit vtptr,monitor
+        size_t[2] d;
+        void* p1;
+        // implicite outer
+    }
+
+    testType!(SFNested)      ([ 0b10100 ]);
+    _testType!(CFNested)     ([ 0b110000 ]);
+}
+
+void main()
+{
+    testRTInfo();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/traits_getUnitTests.d b/gcc/testsuite/gdc.test/runnable/traits_getUnitTests.d
new file mode 100644
index 00000000000..38295ae446a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/traits_getUnitTests.d
@@ -0,0 +1,76 @@
+// REQUIRED_ARGS: -unittest
+// EXTRA_SOURCES: imports/traits_getUnitTests_import.d
+module traits_getUnitTests;
+
+import imports.traits_getUnitTests_import;
+
+template Tuple (T...)
+{
+    alias Tuple = T;
+}
+
+int i;
+
+unittest
+{
+    i++;
+}
+
+void test_getUnitTestsFromModule ()
+{
+   static assert(__traits(getUnitTests, mixin(__MODULE__)).length == 1);
+}
+
+struct SGetUnitTestsFromAggregate
+{
+    unittest {}
+}
+
+class CGetUnitTestsFromAggregate
+{
+    unittest {}
+}
+
+void test_getUnitTestsFromAggregate ()
+{
+    static assert(__traits(getUnitTests, SGetUnitTestsFromAggregate).length == 1);
+    static assert(__traits(getUnitTests, CGetUnitTestsFromAggregate).length == 1);
+}
+
+void test_callUnitTestFunction ()
+{
+    __traits(getUnitTests, mixin(__MODULE__))[0]();
+    assert(i == 2); // 2, because the standard unit test runner
+                    // will call the unit test function as well
+}
+
+struct GetUnitTestsWithUDA
+{
+   @("asd") unittest {}
+}
+
+void test_getUnitTestsWithUDA ()
+{
+    alias tests = Tuple!(__traits(getUnitTests, GetUnitTestsWithUDA));
+    static assert(tests.length == 1);
+    static assert(__traits(getAttributes, tests[0]).length == 1);
+}
+
+void test_getUnitTestsFromImport ()
+{
+   static assert(__traits(getUnitTests, imports.traits_getUnitTests_import).length == 1);
+   static assert(__traits(getUnitTests, mixin("imports.traits_getUnitTests_import")).length == 1);
+}
+
+// 11358
+debug {  }
+enum len11358 = __traits(getUnitTests, mixin(__MODULE__)).length;
+
+void main ()
+{
+    test_getUnitTestsFromModule();
+    test_getUnitTestsFromAggregate();
+    test_callUnitTestFunction();
+    test_getUnitTestsWithUDA();
+    test_getUnitTestsFromImport();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/traits_getVirtualIndex.d b/gcc/testsuite/gdc.test/runnable/traits_getVirtualIndex.d
new file mode 100644
index 00000000000..aeb6de6a630
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/traits_getVirtualIndex.d
@@ -0,0 +1,100 @@
+module traits_getVirtualIndex;
+
+class VirtualIndexBase
+{
+    protected int _foo;
+
+    int doubler()
+    {
+        return foo * 2;
+    }
+
+    @property int foo() const
+    {
+        return _foo;
+    }
+
+    @property void foo(int val)
+    {
+        _foo = val;
+    }
+
+    final void finalFunc()
+    {
+
+    }
+}
+
+class VirtualIndexDerived : VirtualIndexBase
+{
+    @property override int foo() const
+    {
+        return super.foo;
+    }
+
+    @property override void foo(int val)
+    {
+        super.foo = val;
+    }
+
+    @property @safe int foo() pure nothrow
+    {
+        return _foo * 2;
+    }
+
+    final void otherFinalFunc()
+    {
+
+    }
+}
+
+final class VirtualIndexFinal : VirtualIndexDerived
+{
+    @property final override int foo() const
+    {
+        return super.foo;
+    }
+
+    @property final override void foo(int val)
+    {
+        super.foo = val;
+    }
+
+    @property @safe final override int foo() pure nothrow
+    {
+        return super.foo;
+    }
+}
+
+private @property ptrdiff_t getIndex(T, string m, size_t index = 0)()
+{
+    return __traits(getVirtualIndex, __traits(getOverloads, T, m)[index]);
+}
+
+void main()
+{
+    ptrdiff_t doublerIndex = getIndex!(VirtualIndexBase, "doubler");
+    assert(doublerIndex > 0);
+    ptrdiff_t firstIndex = getIndex!(VirtualIndexBase, "foo", 0);
+    ptrdiff_t secondIndex = getIndex!(VirtualIndexBase, "foo", 1);
+    assert(firstIndex > 0 && secondIndex > 0);
+    // Virtual index is in definition order.
+    assert(secondIndex == firstIndex + 1);
+    assert(firstIndex == doublerIndex + 1);
+    ptrdiff_t finalIndex = getIndex!(VirtualIndexBase, "finalFunc");
+    assert(finalIndex == -1);
+    assert(getIndex!(VirtualIndexDerived, "doubler") == doublerIndex);
+    assert(getIndex!(VirtualIndexDerived, "foo", 0) == firstIndex);
+    assert(getIndex!(VirtualIndexDerived, "foo", 1) == secondIndex);
+    assert(getIndex!(VirtualIndexDerived, "finalFunc") == finalIndex);
+    assert(getIndex!(VirtualIndexDerived, "otherFinalFunc") == -1);
+    ptrdiff_t newOverloadIndex = getIndex!(VirtualIndexDerived, "foo", 2);
+    assert(newOverloadIndex == secondIndex + 1);
+    foreach(i, overload; __traits(getOverloads, VirtualIndexFinal, "foo"))
+    {
+        // It should still return the initial virtual index even if overridden to be final.
+        ptrdiff_t finalOverrideIndex = getIndex!(VirtualIndexFinal, __traits(identifier, overload), i);
+        ptrdiff_t originalIndex = getIndex!(VirtualIndexDerived, __traits(identifier, overload), i);
+        assert(finalOverrideIndex == originalIndex);
+    }
+}
diff --git a/gcc/testsuite/gdc.test/runnable/uda.d b/gcc/testsuite/gdc.test/runnable/uda.d
new file mode 100644
index 00000000000..c1782c90a7b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/uda.d
@@ -0,0 +1,488 @@
+
+import core.stdc.stdio;
+
+template Tuple(T...)
+{
+     alias T Tuple;
+}
+
+
+
+enum EEE = 7;
+@("hello") struct SSS { }
+
+@(3) { @(4)@(EEE)@(SSS) int foo; }
+
+pragma(msg, __traits(getAttributes, foo));
+
+alias Tuple!(__traits(getAttributes, foo)) TP;
+
+pragma(msg, TP);
+pragma(msg, TP[2]);
+TP[3] a;
+pragma(msg, typeof(a));
+
+
+alias Tuple!(__traits(getAttributes, typeof(a))) TT;
+
+pragma(msg, TT);
+
+@('c') string s;
+pragma(msg, __traits(getAttributes, s));
+
+/************************************************/
+
+enum FFF;
+@(FFF) int x1;
+pragma(msg, __traits(getAttributes, x1));
+
+void test1()
+{
+    alias Tuple!(__traits(getAttributes, x1)) tp;
+    assert(tp.length == 1);
+    if (!is(FFF == tp[0]))
+        assert(0);
+}
+
+/************************************************/
+
+void test2()
+{
+    int x;
+    alias Tuple!(__traits(getAttributes, x)) tp;
+    assert(tp.length == 0);
+}
+
+/************************************************/
+
+void test3()
+{
+    alias Tuple!(__traits(getAttributes, foo)) tp;
+    assert(tp.length == 4);
+    assert(tp[0] == 3);
+    assert(tp[1] == 4);
+    assert(tp[2] == 7);
+}
+
+/************************************************/
+
+@(1) void foo4();
+@(2) void foo4(int x);
+
+void test4()
+{
+    int i = 1;
+    foreach (o; __traits(getOverloads, uda, "foo4"))
+    {
+        alias Tuple!(__traits(getAttributes, o)) attrs;
+        pragma(msg, attrs.stringof);
+        assert(attrs[0] == i);
+        ++i;
+    }
+}
+
+/************************************************/
+
+pragma(msg, __traits(getAttributes, aa));
+alias Tuple!(__traits(getAttributes, aa)) Taa;
+@(10) int aa;
+
+pragma(msg, __traits(getAttributes, bb));
+alias Tuple!(__traits(getAttributes, bb)) Tbb;
+@(20) int bb;
+alias Tuple!(__traits(getAttributes, bb)) Tbbc;
+
+@(30) int cc;
+pragma(msg, __traits(getAttributes, cc));
+alias Tuple!(__traits(getAttributes, cc)) Tcc;
+
+void test5()
+{
+    assert(Taa[0] == 10);
+    assert(Tbb[0] == 20);
+    assert(Tbbc[0] == 20);
+    assert(Tcc[0] == 30);
+}
+
+/************************************************/
+
+enum Test6;
+@Test6 int x6;
+pragma(msg, __traits(getAttributes, x6));
+
+void test6()
+{
+    alias Tuple!(__traits(getAttributes, x6)) tp;
+
+    assert(tp.length == 1);
+
+    if (!is(Test6 == tp[0]))
+        assert(0);
+}
+
+/************************************************/
+
+struct Test7
+{
+    int a;
+    string b;
+}
+
+@Test7(3, "foo") int x7;
+pragma(msg, __traits(getAttributes, x7));
+
+void test7()
+{
+    alias Tuple!(__traits(getAttributes, x7)) tp;
+
+    assert(tp.length == 1);
+
+    if (!is(Test7 == typeof(tp[0])))
+        assert(0);
+
+    assert(tp[0] == Test7(3, "foo"));
+}
+
+/************************************************/
+
+struct Test8 (string foo) {}
+
+@Test8!"foo" int x8;
+pragma(msg, __traits(getAttributes, x8));
+
+void test8()
+{
+    alias Tuple!(__traits(getAttributes, x8)) tp;
+
+    assert(tp.length == 1);
+
+    if (!is(Test8!("foo") == tp[0]))
+        assert(0);
+}
+
+/************************************************/
+
+struct Test9 (string foo) {}
+
+@Test9!("foo") int x9;
+pragma(msg, __traits(getAttributes, x9));
+
+void test9()
+{
+    alias Tuple!(__traits(getAttributes, x9)) tp;
+
+    assert(tp.length == 1);
+
+    if (!is(Test9!("foo") == tp[0]))
+        assert(0);
+}
+
+/************************************************/
+
+struct Test10 (string foo)
+{
+    int a;
+}
+
+@Test10!"foo"(3) int x10;
+pragma(msg, __traits(getAttributes, x10));
+
+void test10()
+{
+    alias Tuple!(__traits(getAttributes, x10)) tp;
+
+    assert(tp.length == 1);
+
+    if (!is(Test10!("foo") == typeof(tp[0])))
+        assert(0);
+
+    assert(tp[0] == Test10!("foo")(3));
+}
+
+/************************************************/
+
+struct Test11 (string foo)
+{
+    int a;
+}
+
+@Test11!("foo")(3) int x11;
+pragma(msg, __traits(getAttributes, x11));
+
+void test11()
+{
+    alias Tuple!(__traits(getAttributes, x11)) tp;
+
+    assert(tp.length == 1);
+
+    if (!is(Test11!("foo") == typeof(tp[0])))
+        assert(0);
+
+    assert(tp[0] == Test11!("foo")(3));
+}
+
+/************************************************/
+
+void test12()
+{
+    @(1) static struct S1 { }
+    S1 s1;
+    static @(2) struct S2 { }
+    S2 s2;
+    @(1) @(2) struct S3 { }
+
+    @(1) static @(2) struct S { }
+    alias Tuple!(__traits(getAttributes, S)) tps;
+    assert(tps.length == 2);
+    assert(tps[0] == 1);
+    assert(tps[1] == 2);
+
+    @(3) int x;
+    alias Tuple!(__traits(getAttributes, x)) tpx;
+    assert(tpx.length == 1);
+    assert(tpx[0] == 3);
+    x = x + 1;
+
+    @(4) int bar() { return x; }
+    alias Tuple!(__traits(getAttributes, bar)) tpb;
+    assert(tpb.length == 1);
+    assert(tpb[0] == 4);
+    bar();
+}
+
+/************************************************/
+// 9178
+
+void test9178()
+{
+    static class Foo { @(1) int a; }
+
+    Foo foo = new Foo;
+    static assert(__traits(getAttributes, foo.tupleof[0])[0] == 1);
+}
+
+/************************************************/
+// 9652
+
+struct Bug9652
+{
+    pragma(msg, __traits(getAttributes, enum_field));
+    alias Tuple!(__traits(getAttributes, enum_field)) Tenum_field;
+    private @(10) enum enum_field = 42;
+
+    static assert(Tenum_field[0] == 10);
+    static assert(__traits(getAttributes, enum_field)[0] == 10);
+    static assert(__traits(getProtection, enum_field) == "private");
+    static assert(__traits(isSame, __traits(parent, enum_field), Bug9652));
+    static assert(__traits(isSame, enum_field, enum_field));
+
+    pragma(msg, __traits(getAttributes, anon_enum_member));
+    alias Tuple!(__traits(getAttributes, anon_enum_member)) Tanon_enum_member;
+    private @(20) enum {anon_enum_member}
+
+    static assert(Tanon_enum_member[0] == 20);
+    static assert(__traits(getAttributes, anon_enum_member)[0] == 20);
+    static assert(__traits(getProtection, anon_enum_member) == "private");
+    static assert(__traits(isSame, __traits(parent, anon_enum_member), Bug9652));
+    static assert(__traits(isSame, anon_enum_member, anon_enum_member));
+
+    pragma(msg, __traits(getAttributes, Foo.enum_member));
+    alias Tuple!(__traits(getAttributes, Foo.enum_member)) Tfoo_enum_member;
+    private @(30) enum Foo {enum_member}
+    static assert(Tfoo_enum_member.length == 0); //Foo has attributes, not Foo.enum_member
+    static assert(__traits(getAttributes, Foo.enum_member).length == 0);
+    static assert(__traits(getProtection, Foo.enum_member) == "public");
+    static assert(__traits(isSame, __traits(parent, Foo.enum_member), Foo));
+    static assert(__traits(isSame, Foo.enum_member, Foo.enum_member));
+
+    pragma(msg, __traits(getAttributes, anon_enum_member_2));
+    alias Tuple!(__traits(getAttributes, anon_enum_member_2)) Tanon_enum_member_2;
+    private @(40) enum {long anon_enum_member_2 = 2L}
+
+    static assert(Tanon_enum_member_2[0] == 40);
+    static assert(__traits(getAttributes, anon_enum_member_2)[0] == 40);
+    static assert(__traits(getProtection, anon_enum_member_2) == "private");
+    static assert(__traits(isSame, __traits(parent, anon_enum_member_2), Bug9652));
+    static assert(__traits(isSame, anon_enum_member_2, anon_enum_member_2));
+
+    template Bug(alias X, bool is_exp)
+    {
+        static assert(is_exp == !__traits(compiles, __traits(parent, X)));
+        static assert(is_exp == !__traits(compiles, __traits(getAttributes, X)));
+        static assert(is_exp == !__traits(compiles, __traits(getProtection, X)));
+        enum Bug = 0;
+    }
+    enum en = 0;
+    enum dummy1 = Bug!(5, true);
+    enum dummy2 = Bug!(en, false);
+}
+
+/************************************************/
+// 9741
+
+import imports.a9741;
+
+struct A9741 {}
+
+alias X9741 = ShowAttributes!(B9741);
+
+@A9741 struct B9741 {}
+
+/************************************************/
+// 12160
+
+auto before12160(alias Hook)(string) { return 0; }
+
+template checkUDAs12160(alias Func)
+{
+    enum x = __traits(getAttributes, Func).length;
+}
+
+void test12160()
+{
+    int foo() { return 42; }    // OK <- NG
+
+    @before12160!foo("name1")
+    void bar(int name1, double name2) {}
+
+    alias X = checkUDAs12160!(bar);
+}
+
+/************************************************/
+// 10208
+
+@( 10)                enum int x10208_01 =  100;
+@( 20)                     int x10208_02;
+@( 30)               const int x10208_03;
+@( 40)           immutable int x10208_04;
+@( 50)                     int x10208_05 =  500;
+@( 60)               const int x10208_06 =  600;
+@( 70)           immutable int x10208_07 =  700;
+@( 80) __gshared      enum int x10208_08 =  800;
+@( 90) __gshared           int x10208_09;
+@(100) __gshared     const int x10208_10;
+@(110) __gshared immutable int x10208_11;
+@(120) __gshared           int x10208_12 = 1200;
+@(130) __gshared     const int x10208_13 = 1300;
+@(140) __gshared immutable int x10208_14 = 1400;
+static assert(__traits(getAttributes, x10208_01)[0] ==  10); // OK
+static assert(__traits(getAttributes, x10208_02)[0] ==  20); // OK
+static assert(__traits(getAttributes, x10208_03)[0] ==  30); // OK
+static assert(__traits(getAttributes, x10208_04)[0] ==  40); // OK
+static assert(__traits(getAttributes, x10208_05)[0] ==  50); // OK
+static assert(__traits(getAttributes, x10208_06)[0] ==  60); // Error -> OK
+static assert(__traits(getAttributes, x10208_07)[0] ==  70); // Error -> OK
+static assert(__traits(getAttributes, x10208_08)[0] ==  80); // OK
+static assert(__traits(getAttributes, x10208_09)[0] ==  90); // OK
+static assert(__traits(getAttributes, x10208_10)[0] == 100); // OK
+static assert(__traits(getAttributes, x10208_11)[0] == 110); // OK
+static assert(__traits(getAttributes, x10208_12)[0] == 120); // OK
+static assert(__traits(getAttributes, x10208_13)[0] == 130); // Error -> OK
+static assert(__traits(getAttributes, x10208_14)[0] == 140); // Error -> OK
+
+/************************************************/
+// 11677, 11678
+
+bool test_uda(alias func)() @safe
+{
+    alias Tuple!(__traits(getAttributes, func)) udas;
+    static assert([udas] == [10, 20]);
+
+    func(); // @safe attribute check
+
+    return true;
+}
+
+@(10) @(20) @safe void func11677a() {}  // OK
+@safe @(10) @(20) void func11677b() {}  // OK <- NG
+@(10) @safe @(20) void func11677c() {}  // OK <- NG
+
+static assert(test_uda!func11677a());
+static assert(test_uda!func11677b());
+static assert(test_uda!func11677c());
+
+void func11678a() @safe @(10) @(20) {}  // OK <- NG
+void func11678b() @(10) @safe @(20) {}  // OK <- NG
+void func11678c() @(10) @(20) @safe {}  // OK <- NG
+
+static assert(test_uda!func11678a());
+static assert(test_uda!func11678b());
+static assert(test_uda!func11678c());
+
+/************************************************/
+// 11678
+
+class C11678
+{
+    this() @(10) @(20) {}
+    ~this() @(10) @(20) {}
+}
+
+//static this() @(10) @(20) {}
+static ~this() @(10) @(20) {}
+
+//shared static this() @(10) @(20) {}
+shared static ~this() @(10) @(20) {}
+
+/************************************************/
+// 11679
+
+void test11679()
+{
+    @(10) @(20) auto var = 1;
+    static assert([__traits(getAttributes, var)] == [10, 20]);
+}
+
+/************************************************/
+// 11680
+
+@(10) gvar11680 = 1;  // OK <- NG
+@(10) gfun11680() {}  // OK <- NG
+
+void test11680()
+{
+    @(10) lvar11680 = 1;  // OK <- NG
+    @(10) lfun11680() {}  // OK <- NG
+}
+
+/************************************************/
+// 11844
+
+auto make_encode11844(T, string name)()
+{
+    return mixin("function(T self) { return self.encodeField!\""~ name ~ "\"();}");
+}
+
+class FileData11844
+{
+    ulong _member;
+
+    @make_encode11844!(FileData11844, "member")()
+    ulong member() const { return _member; }
+
+    ubyte[] encodeField(string key)() { return [1,2,3]; }
+}
+
+static assert(__traits(getAttributes, FileData11844.member)[0](new FileData11844()) == [1,2,3]);
+
+/************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test9178();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/ufcs.d b/gcc/testsuite/gdc.test/runnable/ufcs.d
new file mode 100644
index 00000000000..494a26f0b91
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/ufcs.d
@@ -0,0 +1,844 @@
+// EXTRA_SOURCES: imports/ufcs5a.d imports/ufcs5b.d imports/ufcs5c.d imports/ufcs5d.d imports/ufcs5e.d
+
+module ufcs;
+
+extern (C) int printf(const char*, ...);
+
+/*******************************************/
+
+struct S {}
+
+int foo(int n)          { return 1; }
+int foo(int n, int m)   { return 2; }
+int goo(int[] a)        { return 1; }
+int goo(int[] a, int m) { return 2; }
+int bar(S s)            { return 1; }
+int bar(S s, int n)     { return 2; }
+
+int baz(X)(X x)         { return 1; }
+int baz(X)(X x, int n)  { return 2; }
+
+int temp;
+ref int boo(int n)      { return temp; }
+ref int coo(int[] a)    { return temp; }
+ref int mar(S s)        { return temp; }
+
+ref int maz(X)(X x)     { return temp; }
+
+void test1()
+{
+    int n;
+    int[] a;
+    S s;
+
+    assert(   foo(4)    == 1);      assert(   baz(4)    == 1);
+    assert( 4.foo()     == 1);      assert( 4.baz()     == 1);
+    assert( 4.foo       == 1);      assert( 4.baz       == 1);
+    assert(   foo(4, 2) == 2);      assert(   baz(4, 2) == 2);
+    assert( 4.foo(2)    == 2);      assert( 4.baz(2)    == 2);
+    assert((4.foo = 2)  == 2);      assert((4.baz = 2)  == 2);
+
+    assert(   goo(a)    == 1);      assert(   baz(a)    == 1);
+    assert( a.goo()     == 1);      assert( a.baz()     == 1);
+    assert( a.goo       == 1);      assert( a.baz       == 1);
+    assert(   goo(a, 2) == 2);      assert(   baz(a, 2) == 2);
+    assert( a.goo(2)    == 2);      assert( a.baz(2)    == 2);
+    assert((a.goo = 2)  == 2);      assert((a.baz = 2)  == 2);
+
+    assert(   bar(s)    == 1);      assert(   baz(s)    == 1);
+    assert( s.bar()     == 1);      assert( s.baz()     == 1);
+    assert( s.bar       == 1);      assert( s.baz       == 1);
+    assert(   bar(s, 2) == 2);      assert(   baz(s, 2) == 2);
+    assert( s.bar(2)    == 2);      assert( s.baz(2)    == 2);
+    assert((s.bar = 2)  == 2);      assert((s.baz = 2)  == 2);
+
+    assert((  boo(4) = 2) == 2);    assert((  maz(4) = 2) == 2);
+    assert((4.boo    = 2) == 2);    assert((4.maz    = 2) == 2);
+    assert((  coo(a) = 2) == 2);    assert((  maz(a) = 2) == 2);
+    assert((a.coo    = 2) == 2);    assert((a.maz    = 2) == 2);
+    assert((  mar(s) = 2) == 2);    assert((  maz(s) = 2) == 2);
+    assert((s.mar    = 2) == 2);    assert((s.maz    = 2) == 2);
+}
+
+int hoo(T)(int n)          { return 1; }
+int hoo(T)(int n, int m)   { return 2; }
+int koo(T)(int[] a)        { return 1; }
+int koo(T)(int[] a, int m) { return 2; }
+int var(T)(S s)            { return 1; }
+int var(T)(S s, int n)     { return 2; }
+
+int vaz(T, X)(X x)         { return 1; }
+int vaz(T, X)(X x, int n)  { return 2; }
+
+//int temp;
+ref int voo(T)(int n)      { return temp; }
+ref int woo(T)(int[] a)    { return temp; }
+ref int nar(T)(S s)        { return temp; }
+
+ref int naz(T, X)(X x)     { return temp; }
+
+void test2()
+{
+    int n;
+    int[] a;
+    S s;
+
+    assert(   hoo!int(4)    == 1);  assert(   vaz!int(4)    == 1);
+    assert( 4.hoo!int()     == 1);  assert( 4.vaz!int()     == 1);
+    assert( 4.hoo!int       == 1);  assert( 4.vaz!int       == 1);
+    assert(   hoo!int(4, 2) == 2);  assert(   vaz!int(4, 2) == 2);
+    assert( 4.hoo!int(2)    == 2);  assert( 4.vaz!int(2)    == 2);
+    assert((4.hoo!int = 2)  == 2);  assert((4.vaz!int = 2)  == 2);
+
+    assert(   koo!int(a)    == 1);  assert(   vaz!int(a)    == 1);
+    assert( a.koo!int()     == 1);  assert( a.vaz!int()     == 1);
+    assert( a.koo!int       == 1);  assert( a.vaz!int       == 1);
+    assert(   koo!int(a, 2) == 2);  assert(   vaz!int(a, 2) == 2);
+    assert( a.koo!int(2)    == 2);  assert( a.vaz!int(2)    == 2);
+    assert((a.koo!int = 2)  == 2);  assert((a.vaz!int = 2)  == 2);
+
+    assert(   var!int(s)    == 1);  assert(   vaz!int(s)    == 1);
+    assert( s.var!int()     == 1);  assert( s.vaz!int()     == 1);
+    assert( s.var!int       == 1);  assert( s.vaz!int       == 1);
+    assert(   var!int(s, 2) == 2);  assert(   vaz!int(s, 2) == 2);
+    assert( s.var!int(2)    == 2);  assert( s.vaz!int(2)    == 2);
+    assert((s.var!int = 2)  == 2);  assert((s.vaz!int = 2)  == 2);
+
+    assert((  voo!int(4) = 2) == 2);    assert((  naz!int(4) = 2) == 2);
+    assert((4.voo!int    = 2) == 2);    assert((4.naz!int    = 2) == 2);
+    assert((  woo!int(a) = 2) == 2);    assert((  naz!int(a) = 2) == 2);
+    assert((a.woo!int    = 2) == 2);    assert((a.naz!int    = 2) == 2);
+    assert((  nar!int(s) = 2) == 2);    assert((  naz!int(s) = 2) == 2);
+    assert((s.nar!int    = 2) == 2);    assert((s.naz!int    = 2) == 2);
+}
+
+/*******************************************/
+
+auto init(T)(T val) { return 1; }
+
+auto sort(alias fun, T)(T val) { return 1; }
+
+@property auto max(alias fun, T)(T val) { return 1; }
+
+@property auto infinity(alias opt, T)(T val) { return 1; }
+
+void test3()
+{
+    // See built-in 'init' property
+    assert(1    .init == 0);
+    assert([1]  .init == null);
+    assert([1:1].init == null);
+    assert(1.0  .init is double.nan);
+    assert(10i  .init is idouble.nan);
+    assert('c'  .init == 0xFF);
+    assert("s"  .init == null);
+
+    // x.init() has parens, so it runs UFCS call
+    assert( 1   .init() == 1);
+    assert([1]  .init() == 1);
+    assert([1:1].init() == 1);
+    assert(1.0  .init() == 1);
+    assert(10i  .init() == 1);
+    assert('c'  .init() == 1);
+    assert("s"  .init() == 1);
+
+    // x.init!YYY matches templatized UFCS call.
+    assert( 1   .init!int()        == 1);
+    assert([1]  .init!(int[])()    == 1);
+    assert([1:1].init!(int[int])() == 1);
+    assert(1.0  .init!double()     == 1);
+    assert(10i  .init!idouble()    == 1);
+    assert('c'  .init!char()       == 1);
+    assert("s"  .init!string()     == 1);
+
+    assert([1].sort!"a<b"() == 1);
+
+    // templatized properties runs UFCS call.
+    assert(1024.max!"a<b" == 1);
+    assert(1024.max  == int.max);
+
+    assert(3.14.infinity!"+" == 1);
+    assert(3.14.infinity == (double).infinity);
+}
+
+/*******************************************/
+
+template Signal4()
+{
+    void connect(){}
+}
+struct S4
+{
+    mixin Signal4!() s;
+}
+void test4()
+{
+    S4 s;
+    s.s.connect();  // s.s is TOKdotexp, so never match UFCS
+}
+
+/*******************************************/
+
+auto f5_1(int)    { return 1; }
+auto f5_2(string) { return 2; }
+auto f5_3(double) { return 3; }
+alias f5_4 = f5_1, f5_4 = f5_2;
+alias f5_5 = f5_3, f5_5 = f5_4;
+
+@property p5_1(int)    { return 1; }    @property p5_1(int,    int) { return 1; }
+@property p5_2(string) { return 2; }    @property p5_2(string, int) { return 2; }
+@property p5_3(double) { return 3; }    @property p5_3(double, int) { return 3; }
+alias p5_4 = p5_1, p5_4 = p5_2;         alias p5_4 = p5_1, p5_4 = p5_2;
+alias p5_5 = p5_3, p5_5 = p5_4;         alias p5_5 = p5_3, p5_5 = p5_4;
+
+// import overload set 'f5ov' and 'p5ov'
+import imports.ufcs5b, imports.ufcs5c;
+
+void test5()
+{
+    {
+        // f5_1 .. f5_5 are symbols which declared in module scope
+        assert(100.f5_1() == 1);
+        assert("s".f5_2() == 2);
+        assert(1.4.f5_3() == 3);
+        assert(100.f5_4() == 1);
+        assert("s".f5_4() == 2);
+        assert(100.f5_5() == 1);
+        assert("s".f5_5() == 2);
+        assert(1.4.f5_5() == 3);
+        // overload set
+        assert(100.f5ov() == 1);
+        assert("s".f5ov() == 2);
+        // UFCS does not see function local alias
+        alias func5 = f5_1;
+        static assert(!__traits(compiles, { 1.func5(); }));
+
+        // property getter/setter
+        assert(100.p5_1 == 1);      assert((100.p5_1 = 1) == 1);
+        assert("s".p5_2 == 2);      assert(("s".p5_2 = 1) == 2);
+        assert(1.4.p5_3 == 3);      assert((1.4.p5_3 = 1) == 3);
+        assert(100.p5_4 == 1);      assert((100.p5_4 = 1) == 1);
+        assert("s".p5_4 == 2);      assert(("s".p5_4 = 1) == 2);
+        assert(100.p5_5 == 1);      assert((100.p5_5 = 1) == 1);
+        assert("s".p5_5 == 2);      assert(("s".p5_5 = 1) == 2);
+        assert(1.4.p5_5 == 3);      assert((1.4.p5_5 = 1) == 3);
+        // overload set     );      assert(
+        assert(100.p5ov == 1);      assert((100.p5ov = 1) == 1);
+        assert("s".p5ov == 2);      assert(("s".p5ov = 1) == 2);
+        // local alias
+        alias prop5 = p5_1;
+        static assert(!__traits(compiles, { 1.prop5; }));
+        static assert(!__traits(compiles, { 1.prop5 = 1; }));
+    }
+
+    {
+        // f5a1 .. f5a5 are symbols which declared in module scope
+        import imports.ufcs5a;
+        // overload set 'f5ov' and 'p5ov'
+        import imports.ufcs5b, imports.ufcs5c;
+
+        assert(100.f5a1() == 1);
+        assert("s".f5a2() == 2);
+        assert(1.4.f5a3() == 3);
+        assert(100.f5a4() == 1);
+        assert("s".f5a4() == 2);
+        assert(100.f5a5() == 1);
+        assert("s".f5a5() == 2);
+        assert(1.4.f5a5() == 3);
+        assert(100.f5ov() == 1);
+        assert("s".f5ov() == 2);
+
+        assert(100.p5a1 == 1);      assert((100.p5a1 = 1) == 1);
+        assert("s".p5a2 == 2);      assert(("s".p5a2 = 1) == 2);
+        assert(1.4.p5a3 == 3);      assert((1.4.p5a3 = 1) == 3);
+        assert(100.p5a4 == 1);      assert((100.p5a4 = 1) == 1);
+        assert("s".p5a4 == 2);      assert(("s".p5a4 = 1) == 2);
+        assert(100.p5a5 == 1);      assert((100.p5a5 = 1) == 1);
+        assert("s".p5a5 == 2);      assert(("s".p5a5 = 1) == 2);
+        assert(1.4.p5a5 == 3);      assert((1.4.p5a5 = 1) == 3);
+        assert(100.p5ov == 1);      assert((100.p5ov = 1) == 1);
+        assert("s".p5ov == 2);      assert(("s".p5ov = 1) == 2);
+    }
+
+    {
+        // selective imports also work as expected
+        import imports.ufcs5a : f5a1, f5a2;
+        import imports.ufcs5a : p5a1, p5a2;
+
+        assert(100.f5a1() == 1);
+        assert("s".f5a2() == 2);
+        static assert(!__traits(compiles, { 1.4.f5a3(); }));
+        static assert(!__traits(compiles, { 100.f5a4(); }));
+        static assert(!__traits(compiles, { "s".f5a4(); }));
+        static assert(!__traits(compiles, { 100.f5a5(); }));
+        static assert(!__traits(compiles, { "s".f5a5(); }));
+        static assert(!__traits(compiles, { 1.4.f5a5(); }));
+
+        assert(100.p5a1 == 1);      assert((100.p5a1 = 1) == 1);
+        assert("s".p5a2 == 2);      assert(("s".p5a2 = 1) == 2);
+        static assert(!__traits(compiles, { 1.4.p5a3; }) && !__traits(compiles, { 1.4.p5a3 = 1; }));
+        static assert(!__traits(compiles, { 100.p5a4; }) && !__traits(compiles, { 100.p5a4 = 1; }));
+        static assert(!__traits(compiles, { "s".p5a4; }) && !__traits(compiles, { "s".p5a4 = 1; }));
+        static assert(!__traits(compiles, { 100.p5a5; }) && !__traits(compiles, { 100.p5a5 = 1; }));
+        static assert(!__traits(compiles, { "s".p5a5; }) && !__traits(compiles, { "s".p5a5 = 1; }));
+        static assert(!__traits(compiles, { 1.4.p5a5; }) && !__traits(compiles, { 1.4.p5a5 = 1; }));
+    }
+
+    {
+        // renamed imports also work as expected
+        import imports.ufcs5a : f5x1 = f5a1, f5x2 = f5a2;
+        import imports.ufcs5a : p5x1 = p5a1, p5x2 = p5a2;
+
+        assert(100.f5x1() == 1);
+        assert("s".f5x2() == 2);
+        static assert(!__traits(compiles, { 100.f5a1(); }));
+        static assert(!__traits(compiles, { "s".f5a2(); }));
+        static assert(!__traits(compiles, { 1.4.f5a3(); }));
+        static assert(!__traits(compiles, { 100.f5a4(); }));
+        static assert(!__traits(compiles, { "s".f5a4(); }));
+        static assert(!__traits(compiles, { 100.f5a5(); }));
+        static assert(!__traits(compiles, { "s".f5a5(); }));
+        static assert(!__traits(compiles, { 1.4.f5a5(); }));
+
+        assert(100.p5x1 == 1);      assert((100.p5x1 = 1) == 1);
+        assert("s".p5x2 == 2);      assert(("s".p5x2 = 1) == 2);
+        static assert(!__traits(compiles, { 100.p5a1; }) && !__traits(compiles, { 100.p5a1 = 1; }));
+        static assert(!__traits(compiles, { "s".p5a2; }) && !__traits(compiles, { "s".p5a2 = 1; }));
+        static assert(!__traits(compiles, { 1.4.p5a3; }) && !__traits(compiles, { 1.4.p5a3 = 1; }));
+        static assert(!__traits(compiles, { 100.p5a4; }) && !__traits(compiles, { 100.p5a4 = 1; }));
+        static assert(!__traits(compiles, { "s".p5a4; }) && !__traits(compiles, { "s".p5a4 = 1; }));
+        static assert(!__traits(compiles, { 100.p5a5; }) && !__traits(compiles, { 100.p5a5 = 1; }));
+        static assert(!__traits(compiles, { "s".p5a5; }) && !__traits(compiles, { "s".p5a5 = 1; }));
+        static assert(!__traits(compiles, { 1.4.p5a5; }) && !__traits(compiles, { 1.4.p5a5 = 1; }));
+    }
+
+    {
+        auto c5 = new C5();
+        foreach (name; __traits(allMembers, C5))
+        {
+            static if (name.length >= 4 && name[0..4] == "test")
+            {
+                mixin("c5."~name~"();");    // call test function
+            }
+        }
+    }
+}
+
+class B5
+{
+    int g5bm(int) { return 0; }
+    static int g5bs(int) { return 0; }
+
+}
+class C5 : B5
+{
+    // normal import works.
+    import imports.ufcs5a;
+    void test1()
+    {
+        assert(100.f5a1() == 1);
+        assert("s".f5a2() == 2);
+        assert(1.4.f5a3() == 3);
+        assert(100.f5a4() == 1);
+        assert("s".f5a4() == 2);
+        assert(100.f5a5() == 1);
+        assert("s".f5a5() == 2);
+        assert(1.4.f5a5() == 3);
+
+        assert(100.p5a1 == 1);      assert((100.p5a1 = 1) == 1);
+        assert("s".p5a2 == 2);      assert(("s".p5a2 = 1) == 2);
+        assert(1.4.p5a3 == 3);      assert((1.4.p5a3 = 1) == 3);
+        assert(100.p5a4 == 1);      assert((100.p5a4 = 1) == 1);
+        assert("s".p5a4 == 2);      assert(("s".p5a4 = 1) == 2);
+        assert(100.p5a5 == 1);      assert((100.p5a5 = 1) == 1);
+        assert("s".p5a5 == 2);      assert(("s".p5a5 = 1) == 2);
+        assert(1.4.p5a5 == 3);      assert((1.4.p5a5 = 1) == 3);
+    }
+
+    // selective imports also work as expected
+    import imports.ufcs5d : f5d1, f5d2;
+    import imports.ufcs5d : p5d1, p5d2;
+    void test2()
+    {
+        assert(100.f5d1() == 1);
+        assert("s".f5d2() == 2);
+        static assert(!__traits(compiles, { 1.4.f5d3(); }));
+        static assert(!__traits(compiles, { 100.f5d4(); }));
+        static assert(!__traits(compiles, { "s".f5d4(); }));
+        static assert(!__traits(compiles, { 100.f5d5(); }));
+        static assert(!__traits(compiles, { "s".f5d5(); }));
+        static assert(!__traits(compiles, { 1.4.f5d5(); }));
+
+        assert(100.p5d1 == 1);  assert((100.p5d1 = 1) == 1);
+        assert("s".p5d2 == 2);  assert(("s".p5d2 = 1) == 2);
+        static assert(!__traits(compiles, { 1.4.p5d3; }) && !__traits(compiles, { 1.4.p5d3 = 1; }));
+        static assert(!__traits(compiles, { 100.p5d4; }) && !__traits(compiles, { 100.p5d4 = 1; }));
+        static assert(!__traits(compiles, { "s".p5d4; }) && !__traits(compiles, { "s".p5d4 = 1; }));
+        static assert(!__traits(compiles, { 100.p5d5; }) && !__traits(compiles, { 100.p5d5 = 1; }));
+        static assert(!__traits(compiles, { "s".p5d5; }) && !__traits(compiles, { "s".p5d5 = 1; }));
+        static assert(!__traits(compiles, { 1.4.p5d5; }) && !__traits(compiles, { 1.4.p5d5 = 1; }));
+    }
+
+    // renamed imports also work as expected
+    import imports.ufcs5e : f5y1 = f5e1, f5y2 = f5e2;
+    import imports.ufcs5e : p5y1 = p5e1, p5y2 = p5e2;
+    void test3()
+    {
+        assert(100.f5y1() == 1);
+        assert("s".f5y2() == 2);
+        static assert(!__traits(compiles, { 100.f5e1(); }));
+        static assert(!__traits(compiles, { "s".f5e2(); }));
+        static assert(!__traits(compiles, { 1.4.f5e3(); }));
+        static assert(!__traits(compiles, { 100.f5e4(); }));
+        static assert(!__traits(compiles, { "s".f5e4(); }));
+        static assert(!__traits(compiles, { 100.f5e5(); }));
+        static assert(!__traits(compiles, { "s".f5e5(); }));
+        static assert(!__traits(compiles, { 1.4.f5e5(); }));
+
+        assert(100.p5y1 == 1);  assert((100.p5y1 = 1) == 1);
+        assert("s".p5y2 == 2);  assert(("s".p5y2 = 1) == 2);
+        static assert(!__traits(compiles, { 100.p5e1; }) && !__traits(compiles, { (100.p5e1 = 1); }));
+        static assert(!__traits(compiles, { "s".p5e2; }) && !__traits(compiles, { ("s".p5e2 = 1); }));
+        static assert(!__traits(compiles, { 1.4.p5e3; }) && !__traits(compiles, { (1.4.p5e3 = 1); }));
+        static assert(!__traits(compiles, { 100.p5e4; }) && !__traits(compiles, { (100.p5e4 = 1); }));
+        static assert(!__traits(compiles, { "s".p5e4; }) && !__traits(compiles, { ("s".p5e4 = 1); }));
+        static assert(!__traits(compiles, { 100.p5e5; }) && !__traits(compiles, { (100.p5e5 = 1); }));
+        static assert(!__traits(compiles, { "s".p5e5; }) && !__traits(compiles, { ("s".p5e5 = 1); }));
+        static assert(!__traits(compiles, { 1.4.p5e5; }) && !__traits(compiles, { (1.4.p5e5 = 1); }));
+    }
+
+    int g5cm(int) { return 0; }
+    static int g5cs(int) { return 0; }
+    void test4()
+    {
+        // UFCS does not see aggregate members
+        static assert(!__traits(compiles, { 1.g5cm(); }));
+        static assert(!__traits(compiles, { 1.g5cs(); }));
+
+        // Even if it is in base class
+        static assert(!__traits(compiles, { 1.g5bm(); }));
+        static assert(!__traits(compiles, { 1.g5bs(); }));
+    }
+}
+
+/*******************************************/
+// 662
+
+import std.stdio,std.string, std.conv;
+
+enum Etest
+{
+    a,b,c,d
+}
+
+//typedef int testi = 10;
+//typedef Test Test2;
+
+int test() { return 33; }
+
+class Test
+{
+    static int test(int i) { return i; }
+}
+
+int test(Etest test)
+{
+    return cast(int)test;
+}
+
+//int test(testi i)
+//{
+//  return cast(int)i;
+//}
+
+void test682()
+{
+    assert(22.to!string() == "22");
+    assert((new Test).test(11) == 11);
+    assert(Test.test(11) == 11);
+    //assert(Test2.test(11) == 11);
+    assert(test() == 33);
+    assert(ufcs.test() == 33);
+    assert(Etest.d.test() == Etest.d);
+    //testi i;
+    //assert(i.test() == i.init);
+}
+
+/*******************************************/
+// 3382
+
+import std.range, std.algorithm;
+
+@property T twice(T)(T x){ return x * x; }
+real toreal(ireal x){ return x.im; }
+char toupper(char c){ return ('a'<=c && c<='z') ? cast(char)(c - 'a' + 'A') : c; }
+
+@property ref T setter(T)(ref T x, T v){ x = v; return x; }
+
+void test3382()
+{
+    auto r = iota(0, 10).map!"a*3"().filter!"a%2 != 0"();
+    foreach (e; r)
+        printf("e = %d\n", e);
+
+    assert(10.twice == 100);
+    assert(0.5.twice == 0.25);
+    assert(1.4i.toreal() == 1.4);
+    assert('c'.toupper() == 'C');
+}
+
+/*******************************************/
+// 6185
+
+void test6185()
+{
+    import std.algorithm;
+
+    auto r1 = [1,2,3].map!"a*2";
+    assert(equal(r1, [2,4,6]));
+
+    auto r2 = r1.map!"a+2"();
+    assert(equal(r2, [4,6,8]));
+}
+
+/*******************************************/
+// 6070
+
+enum test6070a = ["test"].foo6070();
+enum test6070b = foo6070(["test"]);
+
+string foo6070(string[] s) { return ""; }
+
+/*******************************************/
+// 7670
+
+struct A7670
+{
+    double x;
+}
+@property ref double y7670(ref A7670 a)
+{
+    return a.x;
+}
+void test7670()
+{
+    A7670 a1;
+    a1.y7670() = 2.0; // OK
+    a1.y7670 = 2.0; // Error
+}
+
+/*******************************************/
+// 7703
+void f7703(T)(T a) { }
+
+void test7703()
+{
+    int x;
+    x.f7703;        // accepted
+    x.f7703();      // accepted
+    x.f7703!int;    // rejected -- "f(x) isn't a template"
+    x.f7703!int();  // accepted
+}
+
+/*******************************************/
+// 7773
+
+//import std.stdio;
+void writeln7773(int n){}
+void test7773()
+{
+    (int.max).writeln7773(); // OK
+    int.max.writeln7773();   // error
+}
+
+/*******************************************/
+// 7943
+
+struct Foo7943
+{
+    int _member;
+    alias _member this;
+}
+
+int foo7943(Foo7943 f) { return 1; }
+int foo7943(int i) { return 2; }
+
+void test7943()
+{
+    Foo7943 f;
+    assert(f.foo7943() == 1);
+}
+
+/*******************************************/
+// 8180
+
+int writeln8180(T...)(T args) { return 1; }
+
+struct Tuple8180(T...)
+{
+    T field;
+    alias field this;
+}
+
+void test8180()
+{
+    auto t = Tuple8180!(int)(10);
+    assert(t.writeln8180() == 1);
+}
+
+/*******************************************/
+// 8245
+
+          string toStr8245(immutable(char)* p) { return null; }
+@property string asStr8245(immutable(char)* p) { return null; }
+
+void test8245()
+{
+    immutable(char)* p = "foobar".ptr;
+    p.toStr8245();
+    p.asStr8245;    // Error: no property 'asStr' for type 'immutable(char)'
+}
+
+/*******************************************/
+// 8252
+
+bool f(int x) { return !x; }
+
+void test8252()
+{
+    static assert(!1.f); // ok
+    static assert( 0.f); // fail
+}
+
+/*******************************************/
+// 8453
+
+T[] sort8453(T)(T[] a) { return a; }
+
+void test8453()
+{
+    int[int] foo;
+    auto bar1 = foo.keys().sort8453(); // OK
+    auto bar2 = foo.keys.sort8453();   // Error
+}
+
+/*******************************************/
+// 8503
+
+void α8503(int i) {}
+
+void test8503()
+{
+    0.α8503();  // Error
+    1.α8503();  // Error
+}
+
+/*******************************************/
+// 9014
+
+@property ref int foo9014(int[] a)
+{
+    return a[0];
+}
+void test9014()
+{
+    int[] bar;
+  static assert(!__traits(compiles, {
+    bar.foo9014 = missing.foo9014;
+  }));
+}
+
+/*******************************************/
+// 9590
+
+auto func9590(E)(lazy E expr) { }
+
+int f9590a()  { assert(0); }
+void f9590b() { assert(0); }
+
+void test9590()
+{
+    func9590(f9590a());  // ok, no exceptions (lazy)
+    f9590a().func9590;   // ok, no exceptions (lazy)
+
+    func9590(f9590b());  // ok, no exceptions (lazy)
+    f9590b().func9590;   // L12: NG
+}
+
+/*******************************************/
+// 9946
+
+size_t count9946(alias x)(int[] haystack)
+{
+    return 0;
+}
+void test9946()
+{
+    int[] data;
+    auto n1 = count9946!5(data);          // OK
+    auto n2 = data.count9946!5;           // OK
+    auto a1 = new int[count9946!5(data)]; // OK
+    auto a2 = new int[data.count9946!5];  // Error
+}
+
+/*******************************************/
+// 10618
+
+template Temp10618(T)
+{
+    size_t len = 1;
+}
+void test10618()
+{
+    auto arr = new int[Temp10618!int.len];
+    assert(arr.length == 1);
+}
+
+/*******************************************/
+// 10003
+
+void foo10003(void *p) {}
+void test10003()
+{
+    void* p;
+    p.foo10003();
+}
+
+/*******************************************/
+// 10041
+
+auto writeln10041(T...)(T args) { return typeof(args[0]).stringof; }
+
+void test10041()
+{
+    auto aa = [1: 2];
+    assert(aa.writeln10041 == "int[int]");
+    assert(writeln10041(aa) == "int[int]");
+}
+
+/*******************************************/
+// 10047
+
+struct Typedef10047(T)
+{
+    template opDispatch(string name)
+    {
+        static assert(0);
+    }
+}
+
+struct A10047 {}
+int foo10047(Typedef10047!A10047 a) { return 10; }
+
+void test10047()
+{
+    Typedef10047!A10047 a;
+    assert(a.foo10047() == 10);
+}
+
+/*******************************************/
+// 10166
+
+auto foo10166()
+{
+    0.bar10166!({})(0);
+}
+
+void bar10166(alias handler, T)(T t, int i)
+{
+    t.bar10166!buzz10166(i);
+}
+
+void buzz10166() {}
+
+/*******************************************/
+// 10526
+
+struct S10526
+{
+    int opDispatch(string s, A...)(A args)
+    if (s[0..3] == "foo")
+    {
+        return 1;
+    }
+}
+int bar10526(X)(X) { return 2; }
+int baz10526(T, X)(X) { return 3; }
+
+void test10526()
+{
+    S10526 s;
+
+    // with parenthesis
+    assert(s.foo10526() == 1);
+    assert(s.bar10526() == 2);
+    assert(s.baz10526!string() == 3);
+
+    // without parenthesis
+    assert(s.foo10526 == 1);
+    assert(s.bar10526 == 2);
+    assert(s.baz10526!string == 3);
+}
+
+/********************************************************/
+// 10609
+
+int foo10609(int x) { return x; }
+
+void test10609()
+{
+    int x = 1;
+    static assert(__traits(compiles, foo10609(x)));
+    static assert(__traits(compiles, 1.foo10609 ));
+    static assert(__traits(compiles, x.foo10609 ));
+}
+
+/*******************************************/
+// 11312
+
+struct S11312;
+
+S11312* getS11312() { return null; }
+int getValue(S11312*) { return 10; }
+
+void test11312()
+{
+    S11312* op = getS11312();
+    int x = op.getValue();
+    assert(x == 10);
+}
+
+/*******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test682();
+    test3382();
+    test6185();
+    test7670();
+    test7703();
+    test7773();
+    test7943();
+    test8180();
+    test8245();
+    test8252();
+    test8453();
+    test8503();
+    test9014();
+    test9590();
+    test9946();
+    test10618();
+    test10003();
+    test10041();
+    test10047();
+    test10526();
+    test11312();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/uniformctor.d b/gcc/testsuite/gdc.test/runnable/uniformctor.d
new file mode 100644
index 00000000000..d56c782bf9e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/uniformctor.d
@@ -0,0 +1,157 @@
+extern(C) int printf(const char*, ...);
+template TypeTuple(TL...) { alias TypeTuple = TL; }
+
+import core.stdc.math : isnan;
+
+/********************************************/
+// 9112
+
+void test9112a()    //  T() and T(v)
+{
+    void test(T)(T v)
+    {
+        foreach (string qual; TypeTuple!("", "const ", "immutable "))
+        {
+            mixin("alias U = "~qual~T.stringof~";");
+            //pragma(msg, U);
+
+            mixin("auto x1 = "~qual~T.stringof~"();");      // U()      default construction syntax
+            mixin("auto x2 = "~qual~T.stringof~"(v);");     // U(v)
+            static assert(!__traits(compiles, mixin(qual~T.stringof~"(v, v)")));    // U(v, v)
+            static assert(is(typeof(x1) == U));
+            static assert(is(typeof(x2) == U));
+            static if ( is(typeof(U.nan) :  real)) assert( isnan(x1.re) && !isnan(x1.im), U.stringof);
+            static if ( is(typeof(U.nan) : ireal)) assert(!isnan(x1.re) &&  isnan(x1.im), U.stringof);
+            static if ( is(typeof(U.nan) : creal)) assert( isnan(x1.re) &&  isnan(x1.im), U.stringof);
+            static if (!is(typeof(U.nan)))         assert( x1 == U.init,                  U.stringof);
+            assert(x2 == v, U.stringof);
+        }
+    }
+    static assert(!__traits(compiles, { auto x1 = void(); }));
+    static assert(!__traits(compiles, { auto x2 = void(1); }));
+    test!( byte  )(10);
+    test!(ubyte  )(10);
+    test!( short )(10);
+    test!(ushort )(10);
+    test!( int   )(10);
+    test!(uint   )(10);
+    test!( long  )(10);
+    test!(ulong  )(10);
+    test!( float )(3.14);
+    test!( double)(3.14);
+    test!( real  )(3.14);
+    test!(ifloat )(1.4142i);
+    test!(idouble)(1.4142i);
+    test!(ireal  )(1.4142i);
+    test!(cfloat )(1.2+3.4i);
+    test!(cdouble)(1.2+3.4i);
+    test!(creal  )(1.2+3.4i);
+    test!( char  )('A');
+    test!(wchar  )('A');
+    test!(dchar  )('A');
+    test!(bool   )(true);
+
+    static assert(!__traits(compiles, int(1.42)));  // in curre,t this is disallowed
+    static assert(!__traits(compiles, double(3.14i)));
+
+    {
+        int x;
+        alias T = int*;
+      //auto p = int*(&x);      // Error: found '*' when expecting '.' following int
+      //auto p = (int*)(&x);    // Error: C style cast illegal, use cast(int*)&x
+        auto p = T(&x);
+        assert( p == &x);
+        assert(*p ==  x);
+    }
+}
+
+enum Enum : long { a = 10, b = 20 }
+
+void test9112b()    // new T(v)
+{
+    void test(T)(T v)
+    {
+        foreach (string qual; TypeTuple!("", "const ", "immutable "))
+        {
+            mixin("alias U = "~qual~T.stringof~";");
+            //pragma(msg, U);
+
+            mixin("auto p1 = new "~qual~T.stringof~"();");      // U()      default construction syntax
+            mixin("auto p2 = new "~qual~T.stringof~"(v);");     // U(v)
+            static assert(!__traits(compiles, mixin("new "~qual~T.stringof~"(v, v)")));    // U(v, v)
+            static assert(is(typeof(p1) == U*));
+            static assert(is(typeof(p2) == U*));
+            assert( p1 !is null);
+            assert( p2 !is null);
+            auto x1 = *p1;
+            auto x2 = *p2;
+            static if ( is(typeof(U.nan) :  real)) assert( isnan(x1.re) && !isnan(x1.im), U.stringof);
+            static if ( is(typeof(U.nan) : ireal)) assert(!isnan(x1.re) &&  isnan(x1.im), U.stringof);
+            static if ( is(typeof(U.nan) : creal)) assert( isnan(x1.re) &&  isnan(x1.im), U.stringof);
+            static if (!is(typeof(U.nan)))         assert( x1 == U.init,                  U.stringof);
+            assert(x2 == v, U.stringof);
+        }
+    }
+
+    static assert(!__traits(compiles, { auto x1 = new void(); }));
+    static assert(!__traits(compiles, { auto x2 = new void(1); }));
+    static assert(!__traits(compiles, { auto x2 = new void(1, 2); }));
+    test!( byte  )(10);
+    test!(ubyte  )(10);
+    test!( short )(10);
+    test!(ushort )(10);
+    test!( int   )(10);
+    test!(uint   )(10);
+    test!( long  )(10);
+    test!(ulong  )(10);
+    test!( float )(3.14);
+    test!( double)(3.14);
+    test!( real  )(3.14);
+    test!(ifloat )(1.4142i);
+    test!(idouble)(1.4142i);
+    test!(ireal  )(1.4142i);
+    test!(cfloat )(1.2+3.4i);
+    test!(cdouble)(1.2+3.4i);
+    test!(creal  )(1.2+3.4i);
+    test!( char  )('A');
+    test!(wchar  )('A');
+    test!(dchar  )('A');
+    test!(bool   )(true);
+    test!(Enum   )(Enum.a);
+
+    void testPtr(T)(T v)
+    {
+        T* pv = &v;
+        T** ppv = new T*(pv);
+        assert( *ppv == pv);
+        assert(**ppv ==  v);
+    }
+    foreach (T; TypeTuple!(int, const long, immutable double))
+    {
+        testPtr!T(10);
+    }
+    foreach (T; TypeTuple!(Enum, const Enum, immutable Enum))
+    {
+        testPtr!T(Enum.a);
+    }
+
+    static assert(!__traits(compiles, new const int(1, 2)));
+
+    static assert(!__traits(compiles, new int(1.42)));  // in curre,t this is disallowed
+    static assert(!__traits(compiles, new double(3.14i)));
+
+    // int(1) in directly on statement scope should be parsed as an expression, but
+    // would fail to compile because of "has no effect" error.
+    static assert(!__traits(compiles, { int(1); }));
+}
+
+/********************************************/
+
+int main()
+{
+    test9112a();
+    test9112b();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/untag.d b/gcc/testsuite/gdc.test/runnable/untag.d
new file mode 100644
index 00000000000..f542a99dfe2
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/untag.d
@@ -0,0 +1,190 @@
+//#!/home/aalexandre/dmd2/linux/bin/rdmd
+// PERMUTE_ARGS:
+// EXTRA_FILES: extra-files/untag.html
+
+import std.algorithm, std.ascii, std.conv, std.exception,
+    std.file, std.getopt, std.path, std.range, std.stdio,
+    std.string, std.traits;
+
+auto binaryFun(string pred, T, U)(T a, U b)
+{
+    return(mixin(pred));
+}
+
+/**
+If $(D startsWith(r1, r2)), consume the corresponding elements off $(D
+r1) and return $(D true). Otherwise, leave $(D r1) unchanged and
+return $(D false).
+*/
+bool startsWithConsume(alias pred = "a == b", R1, R2)(ref R1 r1, R2 r2)
+{
+    auto r = r1; // .save();
+    while (!r2.empty && !r.empty && binaryFun!pred(r.front, r2.front))
+    {
+        r.popFront();
+        r2.popFront();
+    }
+    return r2.empty ? (r1 = r, true) : false;
+}
+
+
+uint bug = 1;
+
+int main(string args[]) {
+    getopt(args, "bug", &bug);
+    enforce(bug <= 2);
+    auto txt = readText("runnable/extra-files/untag.html");
+    untag(txt, "runnable/extra-files/untag.html");
+    return 0;
+}
+
+void untag(string txt, string filename) {
+    string currentParagraph;
+    string origtxt = txt;
+    string origtxtcopy = txt.idup;
+
+    // Find beginning of content
+    txt = std.algorithm.find(txt, "<!-- start content -->\n");
+
+    // Ancillary function that commits the current paragraph for
+    // writing
+    void commit() {
+        writeParagraph(strip(currentParagraph));
+    }
+
+    void writeChar(dchar c) {
+        immutable lastWritten = currentParagraph.length
+            ? currentParagraph.back
+            : dchar.init;
+        if (lastWritten == ' ' && c == ' ') {
+            // Two consecutive spaces fused
+        } else {
+            // Normal case
+            currentParagraph ~= c;
+        }
+    }
+
+    void writeWords(string s) {
+        if (bug == 0) {
+            foreach (dchar c; s) {
+                currentParagraph ~= c;
+            }
+        } else if (bug == 1) {
+            reserve(currentParagraph, currentParagraph.length + s.length);
+            currentParagraph ~= s;
+        } else {
+            currentParagraph = currentParagraph ~ s;
+        }
+    }
+
+    // Parse the content
+    while (!txt.empty) {
+        size_t i = 0;
+        while (i < txt.length && txt[i] != '<' && txt[i] != '&') {
+            ++i;
+        }
+        writeWords(txt[0 .. i]);
+        if (i == txt.length) {
+            commit();
+            return;
+        }
+        txt = txt[i .. $];
+        auto c = txt[0];
+        txt = txt[1 .. $];
+        if (c == '<') { // This is a tag
+            if (startsWithConsume(txt, `/p>`) ||
+                    startsWithConsume(txt, `/li>`)) {
+                // End of paragraph
+                commit();
+            } else {
+                // This is an uninteresting tag
+                enforce(findConsume(txt, '>'),
+                        "Could not find closing tag: "~txt);
+            }
+        } else {
+            auto app = appender!string();
+            findConsume(txt, ';', app);
+            switch (app.data) {
+            case "#160;": case "#32;": case "reg;": case "nbsp;":
+                writeChar(' ');
+                break;
+            case "amp;":
+                writeChar('&');
+                break;
+            case "gt;":
+                writeChar('>');
+                break;
+            case "lt;":
+                writeChar('<');
+                break;
+            case "quot;":
+                writeChar('"');
+                break;
+            default:
+                throw new Exception(text("Unknown code: &", app.data));
+                break;
+            }
+        }
+    }
+}
+
+void writeParagraph(string sentence) {
+    static bool isSeparator(dchar a) {
+        return !(isAlpha(a) /*|| a == '.'*/);
+    }
+
+    foreach (string cand; std.algorithm.splitter(sentence, ' ')) {
+        cand = toLower(cand);
+    }
+}
+
+/**
+If $(D r2) can not be found in $(D r1), leave $(D r1) unchanged and
+return $(D false). Otherwise, consume elements in $(D r1) until $(D
+startsWithConsume(r1, r2)), and return $(D true). Effectively
+positions $(D r1) right after $(D r2).
+ */
+bool findConsume(R1, R2)(ref R1 r1, R2 r2) if (isForwardRange!R2) {
+    auto r = r1; // .save();
+    while (!r.empty) {
+        if (startsWithConsume(r, r2)) {
+            r1 = r;
+            return true;
+        }
+        r.popFront();
+    }
+    return false;
+}
+
+/**
+If $(D r2) can not be found in $(D r1), leave $(D r1) unchanged and
+return $(D false). Otherwise, consume elements in $(D r1) until $(D
+startsWith(r1, r2)), and return $(D true).
+ */
+bool findConsume(R, E)(ref R r, E e) if (is(typeof(r.front == e))) {
+    auto r1 = std.algorithm.find(r, e);
+    if (r1.empty) return false;
+    r = r1;
+    r.popFront();
+    return true;
+}
+
+/**
+If $(D r2) can not be found in $(D r1), leave $(D r1) unchanged and
+return $(D false). Otherwise, consume elements in $(D r1) until $(D
+startsWith(r1, r2)), and return $(D true).
+ */
+bool findConsume(R1, E, R2)(ref R1 r1, E e, R2 r2) if (is(typeof(r1.front == e))) {
+    auto r = r1;
+    while (!r.empty) {
+        r2.put(r.front);
+        if (r.front == e) {
+            r.popFront();
+            r1 = r;
+            return true;
+        }
+        r.popFront();
+    }
+    return false;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/variadic.d b/gcc/testsuite/gdc.test/runnable/variadic.d
new file mode 100644
index 00000000000..ce48e7a95f4
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/variadic.d
@@ -0,0 +1,1129 @@
+alias TypeTuple(T...) = T;
+
+class A { }
+class B : A { }
+class C : B { }
+
+/***************************************/
+
+template Foo(int a, int b, int c)
+{
+    const int Foo = 1;
+}
+
+template Foo(A...)
+{
+    const int Foo = 2;
+}
+
+void test1()
+{
+    int y = Foo!(1,2,3);
+    assert(y == 1);
+
+    y = Foo!(1,2);
+    assert(y == 2);
+
+    y = Foo!(1,2,3,4);
+    assert(y == 2);
+}
+
+/***************************************/
+
+template Foo2(int a, int b, int c)
+{
+    const int Foo2 = 1;
+}
+
+template Foo2(int a, int b, int c, A...)
+{
+    const int Foo2 = 2;
+}
+
+void test2()
+{
+    int y = Foo2!(1,2,3);
+    assert(y == 1);
+
+    y = Foo2!(1,2,3,4);
+    assert(y == 2);
+}
+
+/***************************************/
+
+void bar3(int x, int y)
+{
+    assert(x == 2);
+    assert(y == 3);
+}
+
+template Foo3(T, A...)
+{
+    int Foo3(T t, A a)
+    {
+        assert(A.length == 2);
+        assert(a.length == 2);
+        bar3(a);
+        assert([a] == [2, 3]);
+        assert([cast(double)a] == [2.0, 3.0]);
+        assert(a[0] == 2);
+        assert(a[1] == 3);
+        assert(a[$ - 2] == 2);
+        assert(a[$ - 1] == 3);
+        static if (1 || a[6])
+            assert(1);
+        assert([a[]] == [2, 3]);
+        assert([a[0 .. $]] == [2, 3]);
+        assert([a[0 .. $ - 1]] == [2]);
+        return 3;
+    }
+}
+
+void test3()
+{
+    int y = Foo3(1,2,3);
+    assert(y == 3);
+}
+
+/***************************************/
+
+
+void foo4(A...)()
+{
+    int[] ai;
+    int[] aa;
+
+    aa = null;
+    foreach (a; A)
+    {
+        aa ~= a;
+    }
+    assert(aa == [7,4,9]);
+
+    aa = null;
+    foreach (int a; A)
+    {
+        aa ~= a;
+    }
+    assert(aa == [7,4,9]);
+
+    ai = null;
+    aa = null;
+    foreach (int i, a; A)
+    {
+        ai ~= i;
+        aa ~= a;
+    }
+    assert(ai == [0,1,2]);
+    assert(aa == [7,4,9]);
+
+    ai = null;
+    aa = null;
+    foreach_reverse (uint i, a; A)
+    {
+        ai ~= i;
+        aa ~= a;
+    }
+    assert(ai == [2,1,0]);
+    assert(aa == [9,4,7]);
+
+    ai = null;
+    aa = null;
+    foreach_reverse (i, a; A)
+    {
+        ai ~= i;
+        aa ~= a;
+    }
+    assert(ai == [2,1,0]);
+    assert(aa == [9,4,7]);
+
+    ai = null;
+    aa = null;
+    foreach (int i, a; A)
+    {
+        ai ~= i;
+        aa ~= a;
+        if (i == 1)
+            break;
+        continue;
+    }
+    assert(ai == [0,1]);
+    assert(aa == [7,4]);
+}
+
+void test4()
+{
+    foo4!(7,4,9)();
+}
+
+/***************************************/
+
+int a12(TypeTuple!(int, int) t)
+{
+    return t[0] + t[1];
+}
+
+int b12(TypeTuple!(TypeTuple!(int), TypeTuple!(int)) t)
+{
+    return t[0] + t[1];
+}
+
+int c12(TypeTuple!(TypeTuple!(int), TypeTuple!(TypeTuple!(), int), TypeTuple!()) t)
+{
+    return t[0] + t[1];
+}
+
+void test12()
+{
+    assert(a12(1, 2) == 3);
+    assert(b12(1, 2) == 3);
+    assert(c12(1, 2) == 3);
+}
+
+/***************************************/
+
+
+int plus13(TypeTuple!(int, long, float)[0 .. 2] t)
+{
+    typeof(t)[0] e;
+    assert(typeid(typeof(e)) == typeid(int));
+    typeof(t)[1] f;
+    assert(typeid(typeof(f)) == typeid(long));
+    return t[0] + cast(int)t[1];
+}
+
+void test13()
+{
+    assert(plus13(5, 6) == 11);
+}
+
+/***************************************/
+
+int plus14(TypeTuple!(int, long, float)[0 .. $ - 1] t)
+{
+    typeof(t)[$ - 2] e;
+    assert(typeid(typeof(e)) == typeid(int));
+    typeof(t)[1] f;
+    assert(typeid(typeof(f)) == typeid(long));
+    return t[0] + cast(int)t[1];
+}
+
+void test14()
+{
+    assert(plus14(5, 6) == 11);
+}
+
+/***************************************/
+
+void returnAndArgs(T, U...) (T delegate(U) dg)
+{
+    static if (U.length == 0)
+        assert(dg() == 0);
+    else static if (U.length == 1)
+        assert(dg(false) == 1);
+    else
+        assert(dg(false, 63L) == 2);
+}
+
+void test24()
+{
+    returnAndArgs(delegate int(){ return 0; });
+    returnAndArgs(delegate int(bool b){ return 1; });
+    returnAndArgs(delegate int(bool b, long c){ return 2; });
+}
+
+/***************************************/
+
+void test28()
+{
+    alias TypeTuple!(int, long, double) TL;
+
+    foreach (int i, T; TL)
+    {
+        switch (i)
+        {
+            case 0: assert(is(T == int));    break;
+            case 1: assert(is(T == long));   break;
+            case 2: assert(is(T == double)); break;
+            default:assert(0);
+        }
+    }
+}
+
+/***************************************/
+
+template g32(alias B)
+{
+    int g32 = 2;
+}
+
+int f32(A...)(A a)
+{
+    return g32!(a);
+}
+
+void test32()
+{
+    assert(f32(4) == 2);
+}
+
+/***************************************/
+
+struct S34
+{
+    int x;
+    long y;
+    double z;
+}
+
+void foo34(int x, long y, double z)
+{
+    assert(x == 3);
+    assert(y == 8);
+    assert(z == 6.8);
+}
+
+void test34()
+{
+    S34 s;
+
+    s.x = 3;
+    s.y = 8;
+    s.z = 6.8;
+    foo34(s.tupleof);
+}
+
+/***************************************/
+
+alias TypeTuple!(int, long, double) TL35;
+
+struct S35
+{
+    TL35 tl;
+}
+
+void foo35(int x, long y, double z)
+{
+    assert(x == 3);
+    assert(y == 8);
+    assert(z == 6.8);
+}
+
+void test35()
+{
+    S35 s;
+
+    s.tl[0] = 3;
+    s.tl[1] = 8;
+    s.tl[2] = 6.8;
+    foo35(s.tupleof);
+    foo35(s.tl);
+}
+
+/***************************************/
+
+alias TypeTuple!(int, long, double) TL36;
+
+class C36
+{
+    TL36 tl;
+}
+
+void foo36(int x, long y, double z)
+{
+    assert(x == 3);
+    assert(y == 8);
+    assert(z == 6.8);
+}
+
+void test36()
+{
+    C36 s = new C36;
+
+    s.tl[0] = 3;
+    s.tl[1] = 8;
+    s.tl[2] = 6.8;
+    foo36(s.tupleof);
+    foo36(s.tl);
+}
+
+/***************************************/
+
+
+alias TypeTuple!(int, long, double) TL37;
+
+class C37
+{
+    TL37 tl;
+}
+
+void foo37(int x, long y, double z)
+{
+    assert(x == 3);
+    assert(y == 8);
+    assert(z == 6.8);
+}
+
+void test37()
+{
+    C37 s = new C37;
+
+    s.tl[0] = 3;
+    s.tl[1] = 8;
+    s.tl[2] = 6.8;
+    foo37(s.tupleof);
+
+    TL37 x;
+    assert(x[0] == 0);
+    x[0] = 3;
+    assert(x[0] == 3);
+    assert(x[1] == 0);
+    x[1] = 8;
+    x[2] = 6.8;
+    foo37(x);
+}
+
+/***************************************/
+
+interface I38A { }
+interface I38B { }
+
+alias TypeTuple!(I38A, I38B) IL38;
+
+class C38 : IL38
+{
+}
+
+void test38()
+{
+    auto c = new C38;
+}
+
+/***************************************/
+
+void test39()
+{
+    static const string a = "\x01";
+    static const char b = a[0];
+    static const string c = "test";
+    static assert(c[a[0]] == 'e');
+
+    alias TypeTuple!(ulong,uint,ushort,ubyte) tuple;
+    static assert(is(tuple[1] == uint));
+    static assert(is(tuple[a[0]] == uint));
+}
+
+/***************************************/
+
+struct Foo45
+{
+    static TypeTuple!(int) selements1;
+    TypeTuple!(int) elements1;
+    static TypeTuple!() selements0;
+    TypeTuple!() elements0;
+}
+
+void test45()
+{
+    Foo45 foo;
+
+    static assert(Foo45.selements1.length == 1);
+    static assert(Foo45.elements1.length == 1);
+    static assert(Foo45.selements0.length == 0);
+    static assert(Foo45.elements0.length == 0);
+
+    static assert(foo.selements1.length == 1);
+    static assert(foo.elements1.length == 1);
+    static assert(foo.selements0.length == 0);
+    static assert(foo.elements0.length == 0);
+}
+
+/***************************************/
+
+template Tuple46(E ...) { alias E Tuple46; }
+
+alias Tuple46!(float, float, 3) TP46;
+alias TP46[1..$] TQ46;
+
+void test46()
+{
+    TQ46[0] f = TQ46[1];
+    assert(is(typeof(f) == float));
+    assert(f == 3);
+}
+
+/***************************************/
+
+template Foo47(T, Args...)
+{
+    void bar(Args args, T t)
+    {
+    }
+}
+
+void test47()
+{
+    alias Foo47!(int) aFoo;
+}
+
+/***************************************/
+
+template Tuple48(E...)
+{
+    alias E Tuple48;
+}
+
+void VarArg48(T...)(T args)
+{
+}
+
+void test48()
+{
+    VarArg48( );
+    VarArg48( Tuple48!(1,2,3) );
+    VarArg48( Tuple48!()      );
+}
+
+/***************************************/
+
+alias TypeTuple!(int, long) TX49;
+
+void foo49(TX49 t)
+{
+    TX49 s;
+    s = t;
+    assert(s[0] == 1);
+    assert(s[1] == 2);
+}
+
+void test49()
+{
+    foo49(1, 2);
+}
+
+/***************************************/
+
+void foo51(U...)(int t, U u)
+{
+    assert(t == 1);
+    assert(u[0] == 2);
+    assert(u[1] == 3);
+}
+
+void bar51(U...)(U u, int t)
+{
+    assert(u[0] == 1);
+    assert(u[1] == 2);
+    assert(t == 3);
+}
+
+void abc51(U...)(int s, U u, int t)
+{
+    assert(s == 1);
+    assert(u[0] == 2);
+    assert(u[1] == 3);
+    assert(t == 4);
+}
+
+void test51()
+{
+  foo51(1, 2, 3);
+  bar51(1, 2, 3);
+  bar51!(int, int)(1, 2, 3);
+  abc51(1,2,3,4);
+}
+
+/***************************************/
+
+string to55(U, V)(V s) { return "he"; }
+
+private S wyda(S, T...)(T args)
+{
+    S result;
+    foreach (i, arg; args)
+    {
+        result ~= to55!(S)(args[i]);
+    }
+    return result;
+}
+
+string giba(U...)(U args)
+{
+    return wyda!(string, U)(args);
+}
+
+void test55()
+{
+    assert(giba(42, ' ', 1.5, ": xyz") == "hehehehe");
+}
+
+/***************************************/
+
+private template implicitlyConverts(U, V)
+{
+    enum bool implicitlyConverts = V.sizeof >= U.sizeof
+        && is(typeof({U s; V t = s;}()));
+}
+
+T to56(T, S)(S s)
+    if (!implicitlyConverts!(S, T) /*&& isSomeString!(T)
+        && isSomeString!(S)*/)
+{
+    return T.init;
+}
+
+void test56()
+{
+    auto x = to56!(int)("4");
+    assert(x == 0);
+    assert(!implicitlyConverts!(const(char)[], string));
+    assert(implicitlyConverts!(string, const(char)[]));
+}
+
+/***************************************/
+
+struct A57(B...) {}
+
+void test57()
+{
+    alias A57!(int, float) X;
+    static if (!is(X Y == A57!(Z), Z...))
+    {
+        static assert(false);
+    }
+}
+
+/***************************************/
+
+struct A58(B...) {}
+
+void test58()
+{
+    alias A58!(int, float) X;
+    static if (!is(X Y == A58!(Z), Z...))
+    {
+        static assert(false);
+    }
+}
+
+/***************************************/
+
+struct Tuple59(T...)
+{
+    T field;
+}
+
+template reduce(fun...)
+{
+    alias Reduce!(fun).reduce reduce;
+}
+
+template Reduce(fun...)
+{
+    Tuple59!(double, double)
+    reduce(Range)(Range r)
+    {
+        typeof(Tuple59!(double,double).field)[0] y;
+        typeof(typeof(return).field)[0] x;
+        Tuple59!(double, double) s;
+        return s;
+    }
+}
+
+void test59()
+{
+    double[] a = [ 3.0, 4, 7, 11, 3, 2, 5 ];
+    static double sum(double a, double b) {return a + b;}
+    auto r = reduce!((a, b) { return a + b; },
+                     (a, b) { return a + b; })(a);
+}
+
+/***************************************/
+
+template tuple60(T...)
+{
+    alias T tuple60;
+}
+
+template Foo60(S : void delegate(tuple60!(int))) {}
+template Foo60(S : void delegate(tuple60!(int, int))) {}
+
+alias Foo60!(void delegate(int)) Bar60;
+
+void test60()
+{
+}
+
+/***************************************/
+
+template TypeTuple61(TList...){
+    alias TList TypeTuple61;
+}
+template List61(lst...) { alias lst list; }
+alias TypeTuple61!(List61!(void)) A61;
+alias TypeTuple61!(A61[0].list) B61;
+
+void test61()
+{
+}
+
+/***************************************/
+
+template Tuple63(T...){
+    alias T Tuple63;
+}
+// Bugzilla 3336
+static assert(!is(int[ Tuple63!(int, int) ]));
+
+void test63()
+{
+}
+
+/***************************************/
+
+template Tuple1411(T ...) { alias T Tuple1411; }
+
+void test1411()
+{
+    int delegate(ref Tuple1411!(int, char[], real)) dg; // (*)
+    int f(ref int a, ref char[] b, ref real c) { return 77; }
+    dg = &f;
+}
+
+/***************************************/
+// Bugzilla 4444
+
+void test4444()
+{
+    alias TypeTuple!(1) index;
+    auto arr = new int[4];
+    auto x = arr[index];    // error
+}
+
+/***************************************/
+// 13864
+
+struct Tuple13864(T...)
+{
+    T expand;
+    alias expand this;
+}
+auto tuple13864(T...)(T args)
+{
+    return Tuple13864!T(args);
+}
+
+void test13864()
+{
+    int[] x = [2,3,4];
+    auto y = x[tuple13864(0).expand];
+    assert(y == 2);
+}
+
+/***************************************/
+// 4884
+
+struct A4884(T...)
+{
+    void foo(T) {}
+    void bar(bool, T) {}
+}
+
+void test4884()
+{
+    auto a1 = A4884!(int)();
+    auto a2 = A4884!(int, long)();
+}
+
+/***************************************/
+// 4920
+
+struct Test4920(parameters_...)
+{
+    alias parameters_ parameters;
+}
+
+void test4920()
+{
+    Test4920!(10, 20, 30) test;
+    static assert(typeof(test).parameters[1] == 20); // okay
+    static assert(       test .parameters[1] == 20); // (7)
+}
+
+/***************************************/
+// 4940
+
+template Tuple4940(T...)
+{
+    alias T Tuple4940;
+}
+
+struct S4940
+{
+    Tuple4940!(int, int) x;
+    this(int) { }
+}
+
+void test4940()
+{
+    auto w = S4940(0).x;
+}
+
+//----
+
+struct S4940add
+{
+    string s;
+    long x;
+}
+
+ref S4940add get4940add(ref S4940add s){ return s; }
+
+void test4940add()
+{
+    S4940add s;
+    get4940add(s).tupleof[1] = 20;
+    assert(s.x == 20);
+}
+
+/***************************************/
+// 6530
+
+struct S6530
+{
+    int a, b, c;
+}
+
+struct HasPostblit6530
+{
+    this(this) {}  // Bug goes away without this.
+}
+
+auto toRandomAccessTuple6530(T...)(T input, HasPostblit6530 hasPostblit)
+{
+    return S6530(1, 2, 3);
+}
+
+void doStuff6530(T...)(T args)
+{
+    HasPostblit6530 hasPostblit;
+
+    // Bug goes away without the .tupleof.
+    auto foo = toRandomAccessTuple6530(args, hasPostblit).tupleof;
+}
+
+void test6530()
+{
+    doStuff6530(1, 2, 3);
+}
+
+/***************************************/
+
+import core.stdc.stdarg;
+
+extern(C)
+void func9495(int a, string format, ...)
+{
+    va_list ap;
+    va_start(ap, format);
+    auto a1 = va_arg!int(ap);
+    auto a2 = va_arg!int(ap);
+    auto a3 = va_arg!int(ap);
+    assert(a1 == 0x11111111);
+    assert(a2 == 0x22222222);
+    assert(a3 == 0x33333333);
+    va_end(ap);
+}
+
+void test9495()
+{
+    func9495(0, "", 0x11111111, 0x22222222, 0x33333333);
+}
+
+/***************************************/
+
+void copya(int a, string format, ...)
+{
+    va_list ap;
+    va_start(ap, format);
+
+    va_list ap2;
+    va_copy(ap2, ap);
+
+    auto a1 = va_arg!int(ap);
+    auto a2 = va_arg!int(ap);
+    auto a3 = va_arg!int(ap);
+
+    assert(a1 == 0x11111111);
+    assert(a2 == 0x22222222);
+    assert(a3 == 0x33333333);
+
+    auto b1 = va_arg!int(ap2);
+    auto b2 = va_arg!int(ap2);
+    auto b3 = va_arg!int(ap2);
+
+    assert(b1 == 0x11111111);
+    assert(b2 == 0x22222222);
+    assert(b3 == 0x33333333);
+
+    va_end(ap);
+    va_end(ap2);
+}
+
+void testCopy()
+{
+    copya(0, "", 0x11111111, 0x22222222, 0x33333333);
+}
+
+/***************************************/
+// 6700
+
+template bug6700(TList ...) {
+    const int bug6700 = 2;
+}
+TypeTuple!(int, long) TT6700;
+
+static assert(bug6700!( (TT6700[1..$]) )==2);
+
+/***************************************/
+// 6966
+
+template X6966(T...)
+{
+    alias const(T[0]) X6966;
+}
+static assert(is(X6966!(int) == const(int)));
+static assert(is(X6966!(int, 0) == const(int)));
+
+/***************************************/
+// 7233
+
+struct Foo7233 { int x, y; }
+Foo7233[] front7233(Foo7233[][] a)
+{
+    return a[0];
+}
+
+class Bar7233 { int x, y; }
+Bar7233[] front7233(Bar7233[][] a)
+{
+    return a[0];
+}
+
+void test7233()
+{
+    Foo7233[][] b1 = [[Foo7233()]];
+    auto xy1 = b1.front7233[0].tupleof;
+
+    Bar7233[][] b2 = [[new Bar7233()]];
+    auto xy2 = b2.front7233[0].tupleof;
+}
+
+/***************************************/
+// 7263
+
+template TypeTuple7263(T...){ alias T TypeTuple7263; }
+
+struct tuple7263
+{
+    TypeTuple7263!(int, int) field;
+    alias field this;
+}
+
+auto front7263(T)(ref T arr){ return arr[0]; }
+
+void test7263()
+{
+    auto bars = [tuple7263(0, 0), tuple7263(1, 1)];
+    auto spam1 = bars.front7263[1];
+    auto spam2 = bars.front7263[1..2];
+}
+
+/***************************************/
+// 8244
+
+TypeTuple!(int,int)[] x8244;
+static assert(is(typeof(x8244) == TypeTuple!(int, int)));
+
+/***************************************/
+// 9017
+
+template X9017(Args...)
+{
+    static if(__traits(compiles, { enum e = Args; }))
+        enum e = Args;
+}
+alias X9017!0 x9017;
+static assert(x9017.e[0] == 0);
+
+void test9017()
+{
+    enum tup1 = TypeTuple!(11, 22);
+    enum tup2 = TypeTuple!("one", "two");
+    static assert(tup1 == TypeTuple!(11, 22));
+    static assert(tup2 == TypeTuple!("one", "two"));
+    static assert(tup1[0] == 11 && tup1[1] == 22);
+    static assert(tup2[0] == "one" && tup2[1] == "two");
+
+    shared const tup3 = TypeTuple!(10, 3.14);
+    immutable    tup4 = TypeTuple!("a", [1,2]);
+    static assert(is(typeof(tup3[0]) == shared const int));
+    static assert(is(typeof(tup3[1]) == shared const double));
+    static assert(is(typeof(tup4[0]) == immutable string));
+    static assert(is(typeof(tup4[1]) == immutable int[]));
+}
+
+/***************************************/
+// 10279
+
+void foo10279(int[][] strs...) @trusted { }
+void bar10279() @safe { foo10279(); }
+
+/***************************************/
+// 13508
+
+struct S13508
+{
+    this(T)(T[] t...) {}
+}
+
+template make13508(T)
+{
+    T make13508(Args...)(Args args)
+    {
+        return T(args);
+    }
+}
+
+void test13508() @safe @nogc
+{
+    S13508 s = make13508!S13508(5);
+}
+
+/***************************************/
+// 14395
+
+int v2u14395(uint[1] ar...)
+{
+    return ar[0];
+}
+
+void print14395(int size = v2u14395(7))
+{
+    assert(size == 7);
+}
+
+void test14395()
+{
+    print14395();
+}
+
+/***************************************/
+// 10414
+
+void foo10414(void delegate()[] ...) { }
+
+void bar10414() { }
+
+void test10414()
+{
+    foo10414
+    (
+        { bar10414(); },
+        { bar10414(); },
+    );
+}
+
+/***************************************/
+
+import core.stdc.stdarg;
+
+struct S14179
+{
+    const(char)* filename;
+    uint linnum;
+    uint charnum;
+}
+
+extern(C++) const(char)* func14179(S14179 x, const(char)* string, ...)
+{
+    return string;
+}
+
+void test14179()
+{
+    const(char)* s = "hello";
+    assert(func14179(S14179(), s) == s);
+}
+
+/***************************************/
+// 10722
+
+struct S10722
+{
+    int x;
+}
+
+template GetSomething10722(S...)
+{
+    alias GetSomething = int;
+}
+
+void test10722()
+{
+    alias X10722 = GetSomething10722!(S10722.tupleof[0]);
+}
+
+/***************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test12();
+    test13();
+    test14();
+    test24();
+    test28();
+    test32();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test51();
+    test55();
+    test56();
+    test57();
+    test58();
+    test59();
+    test60();
+    test61();
+    test63();
+    test1411();
+    test4444();
+    test13864();
+    test4884();
+    test4920();
+    test4940();
+    test4940add();
+    test6530();
+    test7233();
+    test7263();
+    test9017();
+    test14395();
+    test10414();
+    test9495();
+    testCopy();
+    test14179();
+
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/version.d b/gcc/testsuite/gdc.test/runnable/version.d
new file mode 100644
index 00000000000..67da1885882
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/version.d
@@ -0,0 +1,67 @@
+// PERMUTE_ARGS:
+// REQUIRED_ARGS: -version=3 -version=foo
+
+extern(C) int printf(const char*, ...);
+
+/*******************************************/
+
+void test1()
+{
+    int i = 3;
+
+    version(2)
+    {
+        i = 2;
+    }
+    else
+    {
+        i = 0;
+    }
+    printf("i = %d\n", i);
+    assert(i == 2);
+
+    i = 3;
+
+    version(foo)
+    {
+        i = 2;
+    }
+    else
+    {
+        i = 0;
+    }
+    printf("i = %d\n", i);
+    assert(i == 2);
+}
+
+/*******************************************/
+
+version(foo)
+{
+    version = bar;
+}
+else
+{
+    version = 4;
+}
+
+void test2()
+{
+    version(bar)
+    {
+    }
+    else
+        assert(0);
+
+    version(4) assert(0);
+}
+
+/*******************************************/
+
+int main()
+{
+    test1();
+    test2();
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/warning1.d b/gcc/testsuite/gdc.test/runnable/warning1.d
new file mode 100644
index 00000000000..9dcbea9f471
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/warning1.d
@@ -0,0 +1,191 @@
+// REQUIRED_ARGS: -w
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+/******************************************/
+
+class F { }
+int foo()
+{
+    scope F f = new F(); // comment out and warning goes away
+    return 0;
+}
+
+/******************************************/
+
+int foo2()
+{
+    try
+    {
+        return 0;
+    }
+    finally { }
+}
+
+/******************************************/
+
+private int getNthInt(A...)(uint index, A args)
+{
+    foreach (i, arg; args)
+    {
+        static if (is(typeof(arg) : long) || is(typeof(arg) : ulong))
+        {
+            if (i != index) continue;
+            return cast(int)(arg);
+        }
+        else
+        {
+            if (i == index) break;
+        }
+    }
+    throw new Error("int expected");
+}
+
+/******************************************/
+
+class Foo2 {
+    int foo() {
+        synchronized(this){
+            return 8;
+        }
+    }
+}
+
+/******************************************/
+
+void mainX()
+{
+    int i=0;
+    printf("This number is zero: ");
+    goto inloop;
+    for(; i<10; i++) {              // this is line 7
+        printf("This number is nonzero: ");
+inloop:
+        printf("%d\n", i);
+    }
+}
+
+/******************************************/
+
+string foo3(int bar)
+{
+    switch (bar)
+    {
+        case 1:
+            return "1";
+        case 2:
+            return "2";
+        default:
+            return "3";
+    }
+}
+
+
+/******************************************/
+
+int foo4()
+{
+    int i;
+    for (;; ++i)
+    {
+        if (i == 10) return 0;
+    }
+}
+
+/******************************************/
+
+int foo5()
+{
+    do {
+        if (false)
+            return 1;
+    } while (true);
+}
+
+/******************************************/
+
+nothrow int foo6()
+{
+    int x = 2;
+    try
+    {
+    }
+    catch(Exception e)
+    {
+        x = 4;
+        throw new Exception("xxx");
+    }
+    return x;
+}
+
+/******************************************/
+// 6518
+
+template TypeTuple(T...) { alias T TypeTuple; }
+void test6518()
+{
+    switch(2)
+    {
+        foreach(v; TypeTuple!(1, 2, 3))
+            case v: break;
+        default: assert(0);
+    }
+}
+
+/******************************************/
+// 7232
+
+bool test7232()
+{
+    scope(failure) return false;
+    return true;
+}
+
+/***************************************************/
+
+struct S9332
+{
+    this(S9332)
+    {
+//      while (1) { }
+        assert(0, "unreachable?");
+    }
+}
+
+/******************************************/
+// 13201
+
+class C13201
+{
+    void foo()
+    {
+        synchronized(this)
+        {
+            assert(0);
+        }
+    }
+}
+
+void test13201a()
+{
+    auto c = new C13201();
+    synchronized(c)
+    {
+        assert(0);
+    }
+}
+
+void test13201b()
+{
+    struct S { ~this() {} }
+
+    S s;
+    assert(0);
+}
+
+/******************************************/
+
+void main()
+{
+}
diff --git a/gcc/testsuite/gdc.test/runnable/wc.d b/gcc/testsuite/gdc.test/runnable/wc.d
new file mode 100644
index 00000000000..7ee35861a40
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/wc.d
@@ -0,0 +1,50 @@
+// PERMUTE_ARGS:
+// EXECUTE_ARGS: runnable/wc.d
+
+import std.file;
+
+extern(C) int printf(const char*, ...);
+
+int main (string[] args)
+{
+    int w_total;
+    int l_total;
+    int c_total;
+
+    printf ("   lines   words   bytes file\n");
+    foreach (arg; args[1 .. args.length])
+    {
+        string input;
+        int w_cnt, l_cnt, c_cnt;
+        int inword;
+
+        input = cast(string)std.file.read(arg);
+
+        foreach (char c; input)
+        {
+            if (c == '\n')
+                ++l_cnt;
+            if (c != ' ')
+            {
+                if (!inword)
+                {
+                    inword = 1;
+                    ++w_cnt;
+                }
+            }
+            else
+                inword = 0;
+            ++c_cnt;
+        }
+        printf ("%8lu%8lu%8lu %.*s\n", l_cnt, w_cnt, c_cnt, arg.length, arg.ptr);
+        l_total += l_cnt;
+        w_total += w_cnt;
+        c_total += c_cnt;
+    }
+    if (args.length > 2)
+    {
+        printf ("--------------------------------------\n%8lu%8lu%8lu total",
+            l_total, w_total, c_total);
+    }
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/wc2.d b/gcc/testsuite/gdc.test/runnable/wc2.d
new file mode 100644
index 00000000000..7514f5fd34a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/wc2.d
@@ -0,0 +1,75 @@
+// PERMUTE_ARGS:
+// EXECUTE_ARGS: runnable/wc2.d
+
+import std.file;
+
+extern(C) int printf(const char*, ...);
+
+int main (string[] args)
+{
+    int w_total;
+    int l_total;
+    int c_total;
+    int[string] dictionary;
+
+    printf("   lines   words   bytes file\n");
+    foreach (string arg; args[1 .. args.length])
+    {
+        string input;
+        int w_cnt, l_cnt, c_cnt;
+        int inword;
+        int wstart;
+
+        input = cast(string)std.file.read(arg);
+
+        for (int j = 0; j < input.length; j++)
+        {   char c;
+
+            c = input[j];
+            if (c == '\n')
+                ++l_cnt;
+            if (c >= '0' && c <= '9')
+            {
+            }
+            else if (c >= 'a' && c <= 'z' ||
+                c >= 'A' && c <= 'Z')
+            {
+                if (!inword)
+                {
+                    wstart = j;
+                    inword = 1;
+                    ++w_cnt;
+                }
+            }
+            else if (inword)
+            {   string word = input[wstart .. j];
+
+                dictionary[word]++;
+                inword = 0;
+            }
+            ++c_cnt;
+        }
+        if (inword)
+        {   string w = input[wstart .. input.length];
+            dictionary[w]++;
+        }
+        printf("%8lu%8lu%8lu %.*s\n", l_cnt, w_cnt, c_cnt, arg.length, arg.ptr);
+        l_total += l_cnt;
+        w_total += w_cnt;
+        c_total += c_cnt;
+    }
+
+    if (args.length > 2)
+    {
+        printf("--------------------------------------\n%8lu%8lu%8lu total",
+            l_total, w_total, c_total);
+    }
+
+    printf("--------------------------------------\n");
+
+    foreach (string word1; dictionary.keys)
+    {
+        printf("%3d %.*s\n", dictionary[word1], word1.length, word1.ptr);
+    }
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/wc3.d b/gcc/testsuite/gdc.test/runnable/wc3.d
new file mode 100644
index 00000000000..3cb4e25c235
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/wc3.d
@@ -0,0 +1,72 @@
+// PERMUTE_ARGS:
+// EXECUTE_ARGS: runnable/extra-files/alice30.txt
+// EXTRA_FILES: extra-files/alice30.txt
+
+import std.stdio;
+import std.file;
+
+int main (string[] args)
+{
+    int w_total;
+    int l_total;
+    int c_total;
+    int[string] dictionary;
+
+    writefln("   lines   words   bytes file");
+    foreach (arg; args[1 .. args.length])
+    {
+        int w_cnt, l_cnt, c_cnt;
+        size_t wstart;
+        bool inword;
+
+        auto input = cast(string)std.file.read(arg);
+
+        foreach (j, c; input)
+        {
+            if (c == '\n')
+                ++l_cnt;
+            if (c >= '0' && c <= '9')
+            {
+            }
+            else if (c >= 'a' && c <= 'z' ||
+                     c >= 'A' && c <= 'Z')
+            {
+                if (!inword)
+                {
+                    wstart = j;
+                    inword = true;
+                    ++w_cnt;
+                }
+            }
+            else if (inword)
+            {   auto word = input[wstart .. j];
+
+                dictionary[word]++;
+                inword = false;
+            }
+            ++c_cnt;
+        }
+        if (inword)
+        {   auto w = input[wstart .. input.length];
+            dictionary[w]++;
+        }
+        writefln("%8s%8s%8s %s", l_cnt, w_cnt, c_cnt, arg);
+        l_total += l_cnt;
+        w_total += w_cnt;
+        c_total += c_cnt;
+    }
+
+    if (args.length > 2)
+    {
+        writefln("--------------------------------------\n%8s%8s%8s total",
+            l_total, w_total, c_total);
+    }
+
+    writefln("--------------------------------------");
+
+    foreach (word1; dictionary.keys)
+    {
+        writefln("%3s %s", dictionary[word1], word1);
+    }
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/xdtor.d b/gcc/testsuite/gdc.test/runnable/xdtor.d
new file mode 100644
index 00000000000..df3a4d18c44
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/xdtor.d
@@ -0,0 +1,86 @@
+// PERMUTE_ARGS:
+
+struct Field
+{
+    ~this() @safe @nogc pure nothrow {}
+}
+
+struct Counter
+{
+    static size_t cnt;
+    ~this() @safe @nogc nothrow { ++cnt; }
+}
+
+struct Foo
+{
+    ~this() @safe @nogc pure nothrow {}
+    Field field;
+}
+
+class Bar
+{
+    ~this() @safe @nogc pure nothrow {}
+    Field field;
+}
+
+void test1() @nogc pure nothrow
+{
+    Foo foo;
+    foo.__xdtor();
+    scope bar = new Bar();
+    bar.__xdtor();
+}
+
+static assert(__traits(hasMember, Foo, "__xdtor"));
+static assert(__traits(hasMember, Bar, "__xdtor"));
+
+//
+
+struct FieldDtor
+{
+    Counter counter;
+}
+
+struct AggrDtor
+{
+    static size_t cnt;
+    ~this() @safe @nogc nothrow { ++cnt; }
+}
+
+struct MixedDtor
+{
+    static size_t cnt;
+    Counter counter;
+    ~this() @safe @nogc nothrow { ++cnt; }
+}
+
+struct SNoDtor {}
+class CNoDtor {}
+
+static assert(!__traits(hasMember, SNoDtor, "__xdtor"));
+static assert(!__traits(hasMember, CNoDtor, "__xdtor"));
+
+void test2() @safe @nogc nothrow
+{
+    FieldDtor a;
+    assert(Counter.cnt == 0);
+    a.__xdtor();
+    assert(Counter.cnt == 1);
+    AggrDtor b;
+    assert(AggrDtor.cnt == 0);
+    b.__xdtor();
+    assert(AggrDtor.cnt == 1);
+    Counter.cnt = 0;
+    MixedDtor c;
+    assert(MixedDtor.cnt == 0);
+    assert(Counter.cnt == 0);
+    c.__xdtor();
+    assert(MixedDtor.cnt == 1);
+    assert(Counter.cnt == 1);
+}
+
+void main()
+{
+    test1();
+    test2();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/xpostblit.d b/gcc/testsuite/gdc.test/runnable/xpostblit.d
new file mode 100644
index 00000000000..b364c4cff63
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/xpostblit.d
@@ -0,0 +1,77 @@
+// PERMUTE_ARGS:
+
+struct Field
+{
+    this(this) @safe @nogc pure nothrow {}
+}
+
+struct Counter
+{
+    static size_t cnt;
+    this(this) @safe @nogc nothrow { ++cnt; }
+}
+
+struct Foo
+{
+    this(this) @safe @nogc pure nothrow {}
+    Field field;
+}
+
+void test1() @safe @nogc pure nothrow
+{
+    Foo foo;
+    foo.__xpostblit();
+}
+
+static assert(__traits(hasMember, Foo, "__xpostblit"));
+
+//
+
+struct FieldPostblit
+{
+    Counter counter;
+}
+
+struct AggrPostblit
+{
+    static size_t cnt;
+    this(this) @safe @nogc nothrow { ++cnt; }
+}
+
+struct MixedPostblit
+{
+    static size_t cnt;
+    Counter counter;
+    this(this) @safe @nogc nothrow { ++cnt; }
+}
+
+struct SNoPostblit {}
+class CNoPostblit {}
+
+static assert(!__traits(hasMember, SNoPostblit, "__xpostblit"));
+static assert(!__traits(hasMember, CNoPostblit, "__xpostblit"));
+
+void test2() @safe @nogc nothrow
+{
+    FieldPostblit a;
+    assert(Counter.cnt == 0);
+    a.__xpostblit();
+    assert(Counter.cnt == 1);
+    AggrPostblit b;
+    assert(AggrPostblit.cnt == 0);
+    b.__xpostblit();
+    assert(AggrPostblit.cnt == 1);
+    Counter.cnt = 0;
+    MixedPostblit c;
+    assert(MixedPostblit.cnt == 0);
+    assert(Counter.cnt == 0);
+    c.__xpostblit();
+    assert(MixedPostblit.cnt == 1);
+    assert(Counter.cnt == 1);
+}
+
+void main()
+{
+    test1();
+    test2();
+}
diff --git a/gcc/testsuite/gdc.test/runnable/xtest46.d b/gcc/testsuite/gdc.test/runnable/xtest46.d
new file mode 100644
index 00000000000..99f79b01949
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/xtest46.d
@@ -0,0 +1,8098 @@
+import std.stdio;
+import core.stdc.stdio;
+
+/******************************************/
+
+struct S
+{
+    int opStar() { return 7; }
+}
+
+void test1()
+{
+    S s;
+
+    printf("%d\n", *s);
+    assert(*s == 7);
+}
+
+/******************************************/
+
+void test2()
+{
+  double[1][2] bar;
+  bar[0][0] = 1.0;
+  bar[1][0] = 2.0;
+  foo2(bar);
+}
+
+void foo2(T...)(T args)
+{
+    foreach (arg; args[0 .. $])
+    {
+        //writeln(arg);
+        bar2!(typeof(arg))(&arg);
+    }
+}
+
+
+void bar2(D)(const(void)* arg)
+{
+    D obj = *cast(D*) arg;
+}
+
+/***************************************************/
+
+void test3()
+{
+    version (unittest)
+    {
+        printf("unittest!\n");
+    }
+    else
+    {
+        printf("no unittest!\n");
+    }
+
+    version (assert)
+    {
+        printf("assert!\n");
+    }
+    else
+    {
+        printf("no assert!\n");
+    }
+}
+
+
+/***************************************************/
+
+void test4()
+{
+  immutable int maxi = 8;
+  int[][maxi] neighbors = [ cast(int[])[ ], [ 0 ], [ 0, 1], [ 0, 2], [1, 2], [1, 2, 3, 4],
+[ 2, 3, 5], [ 4, 5, 6 ] ];
+  int[maxi] grid;
+
+  // neighbors[0].length = 0;
+
+  void place(int k, uint mask)
+  { if(k<maxi) {
+      for(uint m = 1, d = 1; d <= maxi; d++, m<<=1)
+        if(!(mask & m)) {
+          bool ok = true;
+          int dif;
+          foreach(nb; neighbors[k])
+            if((dif=grid[nb]-d)==1 || dif==-1) {
+              ok = false; break;
+            }
+          if(ok) {
+            grid[k] = d;
+            place(k+1, mask | m);
+          }
+        }
+    } else {
+      printf("  %d\n%d %d %d\n%d %d %d\n  %d\n\n",
+             grid[0], grid[1], grid[2], grid[3], grid[4], grid[5], grid[6], grid[7]);
+    }
+  }
+  place(0, 0);
+}
+
+
+/***************************************************/
+
+struct S5
+{
+  enum S5 some_constant = {2};
+
+  int member;
+}
+
+void test5()
+{
+}
+
+/***************************************************/
+
+struct S6
+{
+    int a, b, c;
+}
+
+struct T6
+{
+    S6 s;
+    int b = 7;
+
+    S6* opDot()
+    {
+        return &s;
+    }
+}
+
+void test6()
+{
+    T6 t;
+    t.a = 4;
+    t.b = 5;
+    t.c = 6;
+    assert(t.a == 4);
+    assert(t.b == 5);
+    assert(t.c == 6);
+    assert(t.s.b == 0);
+    assert(t.sizeof == 4*4);
+    assert(t.init.sizeof == 4*4);
+}
+
+/***************************************************/
+
+struct S7
+{
+    int a, b, c;
+}
+
+class C7
+{
+    S7 s;
+    int b = 7;
+
+    S7* opDot()
+    {
+        return &s;
+    }
+}
+
+void test7()
+{
+    C7 t = new C7();
+    t.a = 4;
+    t.b = 5;
+    t.c = 6;
+    assert(t.a == 4);
+    assert(t.b == 5);
+    assert(t.c == 6);
+    assert(t.s.b == 0);
+    assert(t.sizeof == (void*).sizeof);
+    assert(t.init is null);
+}
+
+/***************************************************/
+
+void foo8(int n1 = __LINE__ + 0, int n2 = __LINE__, string s = __FILE__)
+{
+    assert(n1 < n2);
+    printf("n1 = %d, n2 = %d, s = %.*s\n", n1, n2, s.length, s.ptr);
+}
+
+void test8()
+{
+    foo8();
+}
+
+/***************************************************/
+
+void foo9(int n1 = __LINE__ + 0, int n2 = __LINE__, string s = __FILE__)()
+{
+    assert(n1 < n2);
+    printf("n1 = %d, n2 = %d, s = %.*s\n", n1, n2, s.length, s.ptr);
+}
+
+void test9()
+{
+    foo9();
+}
+
+/***************************************************/
+
+int foo10(char c) pure nothrow
+{
+    return 1;
+}
+
+void test10()
+{
+    int function(char c) fp;
+    int function(char c) pure nothrow fq;
+
+    fp = &foo10;
+    fq = &foo10;
+}
+
+/***************************************************/
+
+class Base11 {}
+class Derived11 : Base11 {}
+class MoreDerived11 : Derived11 {}
+
+int fun11(Base11) { return 1; }
+int fun11(Derived11) { return 2; }
+
+void test11()
+{
+    MoreDerived11 m;
+
+    auto i = fun11(m);
+    assert(i == 2);
+}
+
+/***************************************************/
+
+interface ABC {};
+interface AB: ABC {};
+interface BC: ABC {};
+interface AC: ABC {};
+interface A: AB, AC {};
+interface B: AB, BC {};
+interface C: AC, BC {};
+
+int f12(AB ab) { return 1; }
+int f12(ABC abc) { return 2; }
+
+void test12()
+{
+    A a;
+    auto i = f12(a);
+    assert(i == 1);
+}
+
+/***************************************************/
+
+template Foo13(alias x)
+{
+    enum bar = x + 1;
+}
+
+static assert(Foo13!(2+1).bar == 4);
+
+template Bar13(alias x)
+{
+    enum bar = x;
+}
+
+static assert(Bar13!("abc").bar == "abc");
+
+void test13()
+{
+}
+
+/***************************************************/
+
+template Foo14(alias a)
+{
+    alias Bar14!(a) Foo14;
+}
+
+int Bar14(alias a)()
+{
+    return a.sizeof;
+}
+
+void test14()
+{
+    auto i = Foo14!("hello")();
+    printf("i = %d\n", i);
+    assert(i == "hello".sizeof);
+    i = Foo14!(1)();
+    printf("i = %d\n", i);
+    assert(i == 4);
+}
+
+/***************************************************/
+
+auto foo15()(int x)
+{
+    return 3 + x;
+}
+
+void test15()
+{
+
+    auto bar()(int x)
+    {
+        return 5 + x;
+    }
+
+    printf("%d\n", foo15(4));
+    printf("%d\n", bar(4));
+}
+
+/***************************************************/
+
+int foo16(int x) { return 1; }
+int foo16(ref int x) { return 2; }
+
+void test16()
+{
+    int y;
+    auto i = foo16(y);
+    printf("i == %d\n", i);
+    assert(i == 2);
+    i = foo16(3);
+    assert(i == 1);
+}
+
+/***************************************************/
+
+class A17 { }
+class B17 : A17 { }
+class C17 : B17 { }
+
+int foo17(A17, ref int x) { return 1; }
+int foo17(B17, ref int x) { return 2; }
+
+void test17()
+{
+    C17 c;
+    int y;
+    auto i = foo17(c, y);
+    printf("i == %d\n", i);
+    assert(i == 2);
+}
+
+/***************************************************/
+
+class C18
+{
+    void foo(int x) { foo("abc"); }
+    void foo(string s) { }  // this is hidden, but that's ok 'cuz no overlap
+    void bar()
+    {
+        foo("abc");
+    }
+}
+
+class D18 : C18
+{
+    override void foo(int x) { }
+}
+
+void test18()
+{
+    D18 d = new D18();
+    d.bar();
+}
+
+/***************************************************/
+
+int foo19(alias int a)() { return a; }
+
+void test19()
+{
+    int y = 7;
+    auto i = foo19!(y)();
+    printf("i == %d\n", i);
+    assert(i == 7);
+
+    i = foo19!(4)();
+    printf("i == %d\n", i);
+    assert(i == 4);
+}
+
+/***************************************************/
+
+template Foo20(int x) if (x & 1)
+{
+    const int Foo20 = 6;
+}
+
+template Foo20(int x) if ((x & 1) == 0)
+{
+    const int Foo20 = 7;
+}
+
+void test20()
+{
+    int i = Foo20!(3);
+    printf("%d\n", i);
+    assert(i == 6);
+    i = Foo20!(4);
+    printf("%d\n", i);
+    assert(i == 7);
+}
+
+/***************************************************/
+
+template isArray21(T : U[], U)
+{
+  static const isArray21 = 1;
+}
+
+template isArray21(T)
+{
+  static const isArray21 = 0;
+}
+
+int foo21(T)(T x) if (isArray21!(T))
+{
+    return 1;
+}
+
+int foo21(T)(T x) if (!isArray21!(T))
+{
+    return 2;
+}
+
+void test21()
+{
+    auto i = foo21(5);
+    assert(i == 2);
+    int[] a;
+    i = foo21(a);
+    assert(i == 1);
+}
+
+/***************************************************/
+
+void test22()
+{
+    immutable uint x, y;
+    foreach (i; x .. y) {}
+}
+
+/***************************************************/
+
+const bool foo23 = is(typeof(function void() { }));
+const bar23      = is(typeof(function void() { }));
+
+void test23()
+{
+    assert(foo23 == true);
+    assert(bar23 == true);
+}
+
+/***************************************************/
+
+ref int foo24(int i)
+{
+    static int x;
+    x = i;
+    return x;
+}
+
+void test24()
+{
+    int x = foo24(3);
+    assert(x == 3);
+}
+
+/***************************************************/
+
+ref int foo25(int i)
+{
+    static int x;
+    x = i;
+    return x;
+}
+
+int bar25(ref int x)
+{
+    return x + 1;
+}
+
+void test25()
+{
+    int x = bar25(foo25(3));
+    assert(x == 4);
+}
+
+/***************************************************/
+
+static int x26;
+
+ref int foo26(int i)
+{
+    x26 = i;
+    return x26;
+}
+
+void test26()
+{
+    int* p = &foo26(3);
+    assert(*p == 3);
+}
+
+/***************************************************/
+
+static int x27 = 3;
+
+ref int foo27(int i)
+{
+    return x27;
+}
+
+void test27()
+{
+    foo27(3) = 4;
+    assert(x27 == 4);
+}
+
+/***************************************************/
+
+ref int foo28(ref int x) { return x; }
+
+void test28()
+{
+    int a;
+    foo28(a);
+}
+
+/***************************************************/
+
+void wyda(int[] a) { printf("aaa\n"); }
+void wyda(int[int] a) { printf("bbb\n"); }
+
+struct S29
+{
+    int[] a;
+
+    void wyda()
+    {
+        a.wyda;
+        a.wyda();
+    }
+}
+
+void test29()
+{
+    int[] a;
+    a.wyda;
+    int[5] b;
+    b.wyda;
+    int[int] c;
+    c.wyda;
+
+    S29 s;
+    s.wyda();
+}
+
+/***************************************************/
+
+void foo30(D)(D arg) if (isIntegral!D)
+{
+}
+
+struct S30(T) { }
+struct U30(int T) { }
+
+alias int myint30;
+
+void test30()
+{
+
+    S30!myint30 u;
+    S30!int s;
+    S30!(int) t = s;
+
+//    U30!3 v = s;
+}
+
+/***************************************************/
+
+class A31
+{
+    void foo(int* p) { }
+}
+
+class B31 : A31
+{
+    override void foo(scope int* p) { }
+}
+
+void test31()
+{
+}
+
+/***************************************************/
+
+void bar32() { }
+
+nothrow void foo32(int* p)
+{
+    //try { bar32(); } catch (Object o) { }
+    try { bar32(); } catch (Throwable o) { }
+    try { bar32(); } catch (Exception o) { }
+}
+
+void test32()
+{   int i;
+
+    foo32(&i);
+}
+
+/***************************************************/
+
+struct Integer
+{
+    this(int i)
+    {
+        this.i = i;
+    }
+
+    this(long ii)
+    {
+      i = 3;
+    }
+
+    const int i;
+}
+
+void test33()
+{
+}
+
+/***************************************************/
+
+void test34()
+{
+  alias uint Uint;
+  foreach(Uint u;1..10) {}
+  for(Uint u=1;u<10;u++) {}
+}
+
+/***************************************************/
+
+ref int foo35(bool condition, ref int lhs, ref int rhs)
+{
+        if ( condition ) return lhs;
+        return rhs;
+}
+
+ref int bar35()(bool condition, ref int lhs, ref int rhs)
+{
+        if ( condition ) return lhs;
+        return rhs;
+}
+
+void test35()
+{
+        int a = 10, b = 11;
+
+        foo35(a<b, a, b) = 42;
+        printf("a = %d and b = %d\n", a, b); // a = 42 and b = 11
+        assert(a == 42 && b == 11);
+
+        bar35(a<b, a, b) = 52;
+        printf("a = %d and b = %d\n", a, b);
+        assert(a == 42 && b == 52);
+}
+
+/***************************************************/
+
+int foo36(T...)(T ts)
+if (T.length > 1)
+{
+    return T.length;
+}
+
+int foo36(T...)(T ts)
+if (T.length <= 1)
+{
+    return T.length * 7;
+}
+
+void test36()
+{
+    auto i = foo36!(int,int)(1, 2);
+    assert(i == 2);
+    i = foo36(1, 2, 3);
+    assert(i == 3);
+    i = foo36(1);
+    assert(i == 7);
+    i = foo36();
+    assert(i == 0);
+}
+
+
+/***************************************************/
+
+void test6685()
+{
+    struct S { int x; };
+    with({ return S(); }())
+    {
+        x++;
+    }
+}
+
+/***************************************************/
+
+struct A37(alias T)
+{
+}
+
+void foo37(X)(X x) if (is(X Y == A37!(U), alias U))
+{
+}
+
+void bar37() {}
+
+void test37()
+{
+    A37!(bar37) a2;
+    foo37(a2);
+    foo37!(A37!bar37)(a2);
+}
+
+/***************************************************/
+
+struct A38
+{
+    this(this)
+    {
+        printf("B's copy\n");
+    }
+    bool empty() {return false;}
+    void popFront() {}
+    int front() { return 1; }
+//    ref A38 opSlice() { return this; }
+}
+
+void test38()
+{
+    A38 a;
+    int i;
+    foreach (e; a) { if (++i == 100) break; }
+}
+
+/***************************************************/
+
+alias int function() Fun39;
+alias ref int function() Gun39;
+static assert(!is(Fun39 == Gun39));
+
+void test39()
+{
+}
+
+/***************************************************/
+
+int x40;
+
+struct Proxy
+{
+    ref int at(int i)() { return x40; }
+}
+
+void test40()
+{
+    Proxy p;
+    auto x = p.at!(1);
+}
+
+/***************************************************/
+
+template Foo41(TList...)
+{
+    alias TList Foo41;
+}
+
+alias Foo41!(immutable(ubyte)[], ubyte[]) X41;
+
+void test41()
+{
+}
+
+
+/***************************************************/
+
+bool endsWith(A1, A2)(A1 longer, A2 shorter)
+{
+    static if (is(typeof(longer[0 .. 0] == shorter)))
+    {
+    }
+    else
+    {
+    }
+    return false;
+}
+
+void test42()
+{
+    char[] a;
+    byte[] b;
+    endsWith(a, b);
+}
+
+/***************************************************/
+
+void f43(S...)(S s) if (S.length > 3)
+{
+}
+
+void test43()
+{
+    f43(1, 2, 3, 4);
+}
+
+
+/***************************************************/
+
+struct S44(int x = 1){}
+
+void fun()(S44!(1) b) { }
+
+void test44()
+{
+    S44!() s;
+    fun(s);
+}
+
+/***************************************************/
+// 2006
+
+void test2006()
+{
+    string [][] aas = [];
+    assert(aas.length == 0);
+    aas ~= cast (string []) [];
+    assert(aas.length == 1);
+    aas = aas ~ cast (string []) [];
+    assert(aas.length == 2);
+}
+
+/***************************************************/
+// 8442
+
+void test8442()
+{
+    enum int[] fooEnum = [];
+    immutable fooImmutable = fooEnum;
+}
+
+/***************************************************/
+
+class A45
+{
+  int x;
+  int f()
+  {
+    printf("A\n");
+    return 1;
+  }
+}
+
+class B45 : A45
+{
+  override const int f()
+  {
+    printf("B\n");
+    return 2;
+  }
+}
+
+void test45()
+{
+    A45 y = new B45;
+    int i = y.f;
+    assert(i == 2);
+}
+
+/***************************************************/
+
+void text10682()
+{
+    ulong x = 1;
+    ulong y = 2 ^^ x;
+}
+
+/***************************************************/
+
+struct Test46
+{
+ int foo;
+}
+
+void test46()
+{
+    enum Test46 test = {};
+    enum q = test.foo;
+}
+
+/***************************************************/
+
+pure int double_sqr(int x) {
+    int y = x;
+    void do_sqr() { y *= y; }
+    do_sqr();
+    return y;
+}
+
+void test47()
+{
+   assert(double_sqr(10) == 100);
+}
+
+/***************************************************/
+
+void sort(alias less)(string[] r)
+{
+            bool pred()
+            {
+                return less("a", "a");
+            }
+            .sort!(less)(r);
+}
+
+void foo48()
+{
+    int[string] freqs;
+    string[] words;
+
+sort!((a, b) { return freqs[a] > freqs[b]; })(words);
+sort!((string a, string b) { return freqs[a] > freqs[b]; })(words);
+//sort!(bool (a, b) { return freqs[a] > freqs[b]; })(words);
+//sort!(function (a, b) { return freqs[a] > freqs[b]; })(words);
+//sort!(function bool(a, b) { return freqs[a] > freqs[b]; })(words);
+sort!(delegate bool(string a, string b) { return freqs[a] > freqs[b]; })(words);
+
+}
+
+void test48()
+{
+}
+
+/***************************************************/
+// 6408
+
+static assert(!is(typeof(string[0..1].init)));
+static assert(is(typeof(string[].init) == string[]));
+static assert(is(typeof(string[][].init) == string[][]));
+static assert(is(typeof(string[][][].init) == string[][][]));
+
+static assert(is(typeof(string[1].init) == string[1]));
+static assert(is(typeof(string[1][1].init) == string[1][1]));
+static assert(is(typeof(string[1][1][1].init) == string[1][1][1]));
+
+static assert(is(typeof(string[string].init) == string[string]));
+static assert(is(typeof(string[string][string].init) == string[string][string]));
+static assert(is(typeof(string[string][string][string].init) == string[string][string][string]));
+
+template TT6408(T...) { alias T TT6408; }
+static assert(is(typeof(TT6408!(int, int)[].init) == TT6408!(int, int)));
+static assert(is(typeof(TT6408!(int, int)[0..$].init) == TT6408!(int, int)));
+static assert(is(typeof(TT6408!(int, int)[$-1].init) == int));
+
+/***************************************************/
+// 9409
+
+template TT9409(T...) { alias T TT9409; }
+
+template idxTypes9409(Prefix...)
+{
+    TT9409!((Prefix[$-1])) idxTypes9409;
+}
+
+alias idxTypes9409!(int) Types9409;
+
+/***************************************************/
+
+struct S49
+{
+    static void* p;
+
+    this( string name )
+    {
+        printf( "(ctor) &%.*s.x = %p\n", name.length, name.ptr, &x );
+        p = cast(void*)&x;
+    }
+
+    invariant() {}
+
+    int x;
+}
+
+void test49()
+{
+    auto s = new S49("s2");
+
+    printf( "&s2.x = %p\n", &s.x );
+    assert(cast(void*)&s.x == S49.p);
+}
+
+/***************************************************/
+
+auto max50(Ts...)(Ts args)
+  if (Ts.length >= 2
+        && is(typeof(Ts[0].init > Ts[1].init ? Ts[1].init : Ts[0].init)))
+{
+    static if (Ts.length == 2)
+        return args[1] > args[0] ? args[1] : args[0];
+    else
+        return max50(max50(args[0], args[1]), args[2 .. $]);
+}
+
+void test50()
+{
+   assert(max50(4, 5) == 5);
+   assert(max50(2.2, 4.5) == 4.5);
+   assert(max50("Little", "Big") == "Little");
+
+   assert(max50(4, 5.5) == 5.5);
+   assert(max50(5.5, 4) == 5.5);
+}
+
+/***************************************************/
+
+void test51()
+{
+    static immutable int[2] array = [ 42 ];
+    enum e = array[1];
+    static immutable int[1] array2 = [ 0: 42 ];
+    enum e2 = array2[0];
+    assert(e == 0);
+    assert(e2 == 42);
+}
+
+/***************************************************/
+
+enum ubyte[4] a52 = [5,6,7,8];
+
+void test52()
+{
+  int x=3;
+  assert(a52[x]==8);
+}
+
+/***************************************************/
+
+void test53()
+{
+    size_t func2(immutable(void)[] t)
+    {
+        return 0;
+    }
+}
+
+/***************************************************/
+
+void foo54(void delegate(void[]) dg) { }
+
+void test54()
+{
+    void func(void[] t) pure { }
+    foo54(&func);
+
+//    void func2(const(void)[] t) { }
+//    foo54(&func2);
+}
+
+/***************************************************/
+
+class Foo55
+{
+    synchronized void noop1() { }
+    void noop2() shared { }
+}
+
+void test55()
+{
+    auto foo = new shared(Foo55);
+    foo.noop1();
+    foo.noop2();
+}
+
+/***************************************************/
+
+enum float one56 = 1 * 1;
+template X56(float E) { int X56 = 2; }
+alias X56!(one56 * one56) Y56;
+
+void test56()
+{
+    assert(Y56 == 2);
+}
+
+/***************************************************/
+
+void test57()
+{
+    alias shared(int) T;
+    assert (is(T == shared));
+}
+
+/***************************************************/
+
+struct A58
+{
+  int a,b;
+}
+
+void test58()
+{
+  A58[2] rg=[{1,2},{5,6}];
+  assert(rg[0].a == 1);
+  assert(rg[0].b == 2);
+  assert(rg[1].a == 5);
+  assert(rg[1].b == 6);
+}
+
+/***************************************************/
+
+class A59 {
+    const foo(int i)  { return i; }
+}
+
+/***************************************************/
+
+void test60()
+{
+    enum real ONE = 1.0;
+    real x;
+    for (x=0.0; x<10.0; x+=ONE)
+        printf("%Lg\n", x);
+    printf("%Lg\n", x);
+    assert(x == 10);
+}
+
+/***************************************************/
+
+pure immutable(T)[] fooPT(T)(immutable(T)[] x, immutable(T)[] y){
+
+  immutable(T)[] fooState;
+
+  immutable(T)[] bar(immutable(T)[] x){
+    fooState = "hello ";
+    return x ~ y;
+  }
+
+  return fooState ~ bar(x);
+
+}
+
+
+void test61()
+{
+  writeln(fooPT("p", "c"));
+}
+
+/***************************************************/
+
+void test9577()
+{
+    static int function(int)[] foo = [x => x];
+    foo[0](0);
+}
+
+/***************************************************/
+
+int[3] foo62(int[3] a)
+{
+    a[1]++;
+    return a;
+}
+
+void test62()
+{
+    int[3] b;
+    b[0] = 1;
+    b[1] = 2;
+    b[2] = 3;
+    auto c = foo62(b);
+    assert(b[0] == 1);
+    assert(b[1] == 2);
+    assert(b[2] == 3);
+
+    assert(c[0] == 1);
+    assert(c[1] == 3);
+    assert(c[2] == 3);
+}
+
+/***************************************************/
+
+void test3927()
+{
+    int[] array;
+    assert(array.length++ == 0);
+    assert(array.length == 1);
+    assert(array.length-- == 1);
+    assert(array.length == 0);
+}
+
+/***************************************************/
+
+void test63()
+{
+    int[3] b;
+    b[0] = 1;
+    b[1] = 2;
+    b[2] = 3;
+    auto c = b;
+    b[1]++;
+    assert(b[0] == 1);
+    assert(b[1] == 3);
+    assert(b[2] == 3);
+
+    assert(c[0] == 1);
+    assert(c[1] == 2);
+    assert(c[2] == 3);
+}
+
+/***************************************************/
+
+void test64()
+{
+    int[3] b;
+    b[0] = 1;
+    b[1] = 2;
+    b[2] = 3;
+    int[3] c;
+    c = b;
+    b[1]++;
+    assert(b[0] == 1);
+    assert(b[1] == 3);
+    assert(b[2] == 3);
+
+    assert(c[0] == 1);
+    assert(c[1] == 2);
+    assert(c[2] == 3);
+}
+
+/***************************************************/
+
+int[2] foo65(int[2] a)
+{
+    a[1]++;
+    return a;
+}
+
+void test65()
+{
+    int[2] b;
+    b[0] = 1;
+    b[1] = 2;
+    int[2] c = foo65(b);
+    assert(b[0] == 1);
+    assert(b[1] == 2);
+
+    assert(c[0] == 1);
+    assert(c[1] == 3);
+}
+
+/***************************************************/
+
+int[1] foo66(int[1] a)
+{
+    a[0]++;
+    return a;
+}
+
+void test66()
+{
+    int[1] b;
+    b[0] = 1;
+    int[1] c = foo66(b);
+    assert(b[0] == 1);
+    assert(c[0] == 2);
+}
+
+/***************************************************/
+
+int[2] foo67(out int[2] a)
+{
+    a[0] = 5;
+    a[1] = 6;
+    return a;
+}
+
+void test67()
+{
+    int[2] b;
+    b[0] = 1;
+    b[1] = 2;
+    int[2] c = foo67(b);
+    assert(b[0] == 5);
+    assert(b[1] == 6);
+
+    assert(c[0] == 5);
+    assert(c[1] == 6);
+}
+
+/***************************************************/
+
+void test68()
+{
+    digestToString(cast(ubyte[16])x"c3fcd3d76192e4007dfb496cca67e13b");
+}
+
+void digestToString(const ubyte[16] digest)
+{
+    assert(digest[0] == 0xc3);
+    assert(digest[15] == 0x3b);
+}
+
+/***************************************************/
+
+void test69()
+{
+    digestToString69(cast(ubyte[16])x"c3fcd3d76192e4007dfb496cca67e13b");
+}
+
+void digestToString69(ref const ubyte[16] digest)
+{
+    assert(digest[0] == 0xc3);
+    assert(digest[15] == 0x3b);
+}
+
+/***************************************************/
+
+void test70()
+{
+    digestToString70("1234567890123456");
+}
+
+void digestToString70(ref const char[16] digest)
+{
+    assert(digest[0] == '1');
+    assert(digest[15] == '6');
+}
+
+/***************************************************/
+
+void foo71(out shared int o) {}
+
+/***************************************************/
+
+struct foo72
+{
+  int bar() shared { return 1; }
+}
+
+void test72()
+{
+  shared foo72 f;
+  auto x = f.bar;
+}
+
+/***************************************************/
+
+class Foo73
+{
+  static if (is(typeof(this) T : shared T))
+    static assert(0);
+  static if (is(typeof(this) U == shared U))
+    static assert(0);
+  static if (is(typeof(this) U == const U))
+    static assert(0);
+  static if (is(typeof(this) U == immutable U))
+    static assert(0);
+  static if (is(typeof(this) U == const shared U))
+    static assert(0);
+
+  static assert(!is(int == const));
+  static assert(!is(int == immutable));
+  static assert(!is(int == shared));
+
+  static assert(is(int == int));
+  static assert(is(const(int) == const));
+  static assert(is(immutable(int) == immutable));
+  static assert(is(shared(int) == shared));
+  static assert(is(const(shared(int)) == shared));
+  static assert(is(const(shared(int)) == const));
+
+  static assert(!is(const(shared(int)) == immutable));
+  static assert(!is(const(int) == immutable));
+  static assert(!is(const(int) == shared));
+  static assert(!is(shared(int) == const));
+  static assert(!is(shared(int) == immutable));
+  static assert(!is(immutable(int) == const));
+  static assert(!is(immutable(int) == shared));
+}
+
+template Bar(T : T)
+{
+    alias T Bar;
+}
+
+template Barc(T : const(T))
+{
+    alias T Barc;
+}
+
+template Bari(T : immutable(T))
+{
+    alias T Bari;
+}
+
+template Bars(T : shared(T))
+{
+    alias T Bars;
+}
+
+template Barsc(T : shared(const(T)))
+{
+    alias T Barsc;
+}
+
+
+void test73()
+{
+    auto f = new Foo73;
+
+    alias int T;
+
+    // 5*5 == 25 combinations, plus 2 for swapping const and shared
+
+    static assert(is(Bar!(T) == T));
+    static assert(is(Bar!(const(T)) == const(T)));
+    static assert(is(Bar!(immutable(T)) == immutable(T)));
+    static assert(is(Bar!(shared(T)) == shared(T)));
+    static assert(is(Bar!(shared(const(T))) == shared(const(T))));
+
+    static assert(is(Barc!(const(T)) == T));
+    static assert(is(Bari!(immutable(T)) == T));
+    static assert(is(Bars!(shared(T)) == T));
+    static assert(is(Barsc!(shared(const(T))) == T));
+
+    static assert(is(Barc!(T) == T));
+    static assert(is(Barc!(immutable(T)) == T));
+    static assert(is(Barc!(const(shared(T))) == shared(T)));
+    static assert(is(Barsc!(immutable(T)) == T));
+
+    static assert(is(Bars!(const(shared(T))) == const(T)));
+    static assert(is(Barsc!(shared(T)) == T));
+
+    Bars!(shared(const(T))) b;
+    pragma(msg, typeof(b));
+
+    static assert(is(Bars!(shared(const(T))) == const(T)));
+    static assert(is(Barc!(shared(const(T))) == shared(T)));
+
+    static assert(!is(Bari!(T)));
+    static assert(!is(Bari!(const(T))));
+    static assert(!is(Bari!(shared(T))));
+    static assert(!is(Bari!(const(shared(T)))));
+
+    static assert(is(Barc!(shared(T))));
+
+    static assert(!is(Bars!(T)));
+    static assert(!is(Bars!(const(T))));
+    static assert(!is(Bars!(immutable(T))));
+    static assert(!is(Barsc!(T)));
+    static assert(!is(Barsc!(const(T))));
+}
+
+/***************************************************/
+
+pure nothrow {
+  alias void function(int) A74;
+}
+
+alias void function(int) pure nothrow B74;
+alias pure nothrow void function(int) C74;
+
+void test74()
+{
+    A74 a = null;
+    B74 b = null;
+    C74 c = null;
+    a = b;
+    a = c;
+}
+
+/***************************************************/
+
+void test9212()
+{
+    int[int] aa;
+    foreach (const key, const val; aa) {}
+    foreach (size_t key, size_t val; aa) {}
+}
+
+/***************************************************/
+
+class A75
+{
+    pure static void raise(string s)
+    {
+        throw new Exception(s);
+    }
+}
+
+void test75()
+{   int x = 0;
+    try
+    {
+        A75.raise("a");
+    } catch (Exception e)
+    {
+        x = 1;
+    }
+    assert(x == 1);
+}
+
+/***************************************************/
+
+void test76()
+{
+    int x, y;
+    bool which;
+    (which ? x : y) += 5;
+    assert(y == 5);
+}
+
+/***************************************************/
+
+void test77()
+{
+    auto a = ["hello", "world"];
+    pragma(msg, typeof(a));
+    auto b = a;
+    assert(a is b);
+    assert(a == b);
+    b = a.dup;
+    assert(a == b);
+    assert(a !is b);
+}
+
+/***************************************************/
+
+void test78()
+{
+    auto array = [0, 2, 4, 6, 8, 10];
+    array = array[0 .. $ - 2];         // Right-shrink by two elements
+    assert(array == [0, 2, 4, 6]);
+    array = array[1 .. $];             // Left-shrink by one element
+    assert(array == [2, 4, 6]);
+    array = array[1 .. $ - 1];         // Shrink from both sides
+    assert(array == [4]);
+}
+
+/***************************************************/
+
+void test79()
+{
+    auto a = [87, 40, 10];
+    a ~= 42;
+    assert(a == [87, 40, 10, 42]);
+    a ~= [5, 17];
+    assert(a == [87, 40, 10, 42, 5, 17]);
+}
+
+/***************************************************/
+
+void test6317()
+{
+    int b = 12345;
+    struct nested { int a; int fun() { return b; } }
+    static assert(!__traits(compiles, { nested x = { 3, null }; }));
+    nested g = { 7 };
+    auto h = nested(7);
+    assert(g.fun() == 12345);
+    assert(h.fun() == 12345);
+}
+
+/***************************************************/
+
+void test80()
+{
+    auto array = new int[10];
+    array.length += 1000;
+    assert(array.length == 1010);
+    array.length /= 10;
+    assert(array.length == 101);
+    array.length -= 1;
+    assert(array.length == 100);
+    array.length |= 1;
+    assert(array.length == 101);
+    array.length ^= 3;
+    assert(array.length == 102);
+    array.length &= 2;
+    assert(array.length == 2);
+    array.length *= 2;
+    assert(array.length == 4);
+    array.length <<= 1;
+    assert(array.length == 8);
+    array.length >>= 1;
+    assert(array.length == 4);
+    array.length >>>= 1;
+    assert(array.length == 2);
+    array.length %= 2;
+    assert(array.length == 0);
+
+    int[]* foo()
+    {
+        static int x;
+        x++;
+        assert(x == 1);
+        auto p = &array;
+        return p;
+    }
+
+    (*foo()).length += 2;
+    assert(array.length == 2);
+}
+
+/***************************************************/
+
+void test81()
+{
+    int[3] a = [1, 2, 3];
+    int[3] b = a;
+    a[1] = 42;
+    assert(b[1] == 2); // b is an independent copy of a
+    int[3] fun(int[3] x, int[3] y) {
+       // x and y are copies of the arguments
+       x[0] = y[0] = 100;
+       return x;
+    }
+    auto c = fun(a, b);         // c has type int[3]
+    assert(c == [100, 42, 3]);
+    assert(b == [1, 2, 3]);     // b is unaffected by fun
+}
+
+/***************************************************/
+
+void test82()
+{
+    auto a1 = [ "Jane":10.0, "Jack":20, "Bob":15 ];
+    auto a2 = a1;                    // a1 and a2 refer to the same data
+    a1["Bob"] = 100;                 // Changing a1
+    assert(a2["Bob"] == 100);        //is same as changing a2
+    a2["Sam"] = 3.5;                 //and vice
+    assert(a2["Sam"] == 3.5);        //    versa
+}
+
+/***************************************************/
+
+void test7942()
+{
+    string a = "a";
+    wstring b = "b";
+    dstring c = "c";
+
+    a ~= "a"c;
+    static assert(!is(typeof(a ~= "b"w)));
+    static assert(!is(typeof(a ~= "c"d)));
+    static assert(!is(typeof(b ~= "a"c)));
+    b ~= "b"w;
+    static assert(!is(typeof(b ~= "c"d)));
+    static assert(!is(typeof(c ~= "a"c)));
+    static assert(!is(typeof(c ~= "b"w)));
+    c ~= "c"d;
+
+    assert(a == "aa");
+    assert(b == "bb");
+    assert(c == "cc");
+}
+
+/***************************************************/
+
+void bump(ref int x) { ++x; }
+
+void test83()
+{
+   int x = 1;
+   bump(x);
+   assert(x == 2);
+}
+
+/***************************************************/
+
+interface Test4174
+{
+    void func(T)() {}
+}
+
+/***************************************************/
+
+auto foo84 = [1, 2.4];
+
+void test84()
+{
+    pragma(msg, typeof([1, 2.4]));
+    static assert(is(typeof([1, 2.4]) == double[]));
+
+    pragma(msg, typeof(foo84));
+    static assert(is(typeof(foo84) == double[]));
+}
+
+/***************************************************/
+
+void test85()
+{
+    dstring c = "V\u00E4rld";
+    c = c ~ '!';
+    assert(c == "V\u00E4rld!");
+    c = '@' ~ c;
+    assert(c == "@V\u00E4rld!");
+
+    wstring w = "V\u00E4rld";
+    w = w ~ '!';
+    assert(w == "V\u00E4rld!");
+    w = '@' ~ w;
+    assert(w == "@V\u00E4rld!");
+
+    string s = "V\u00E4rld";
+    s = s ~ '!';
+    assert(s == "V\u00E4rld!");
+    s = '@' ~ s;
+    assert(s == "@V\u00E4rld!");
+}
+
+/***************************************************/
+
+void test86()
+{
+    int[][] a = [ [1], [2,3], [4] ];
+    int[][] w = [ [1, 2], [3], [4, 5], [] ];
+    int[][] x = [ [], [1, 2], [3], [4, 5], [] ];
+}
+
+/***************************************************/
+
+// Bugzilla 3379
+
+T1[] find(T1, T2)(T1[] longer, T2[] shorter)
+   if (is(typeof(longer[0 .. 1] == shorter) : bool))
+{
+   while (longer.length >= shorter.length) {
+      if (longer[0 .. shorter.length] == shorter) break;
+      longer = longer[1 .. $];
+   }
+   return longer;
+}
+
+auto max(T...)(T a)
+      if (T.length == 2
+         && is(typeof(a[1] > a[0] ? a[1] : a[0]))
+       || T.length > 2
+         && is(typeof(max(max(a[0], a[1]), a[2 .. $])))) {
+   static if (T.length == 2) {
+      return a[1] > a[0] ? a[1] : a[0];
+   } else {
+      return max(max(a[0], a[1]), a[2 .. $]);
+   }
+}
+
+// Cases which would ICE or segfault
+struct Bulldog(T){
+    static void cat(Frog)(Frog f) if (true)
+    {    }
+}
+
+void mouse(){
+    Bulldog!(int).cat(0);
+}
+
+void test87()
+{
+    double[] d1 = [ 6.0, 1.5, 2.4, 3 ];
+    double[] d2 = [ 1.5, 2.4 ];
+    assert(find(d1, d2) == d1[1 .. $]);
+    assert(find(d1, d2) == d1[1 .. $]); // Check for memory corruption
+    assert(max(4, 5) == 5);
+    assert(max(3, 4, 5) == 5);
+}
+
+/***************************************************/
+
+template test4284(alias v) { enum test4284 = v.length == 0; }
+static assert(test4284!(cast(string)null));
+static assert(test4284!(cast(string[])null));
+
+/***************************************************/
+
+struct S88
+{
+    void opDispatch(string s, T)(T i)
+    {
+        printf("S.opDispatch('%.*s', %d)\n", s.length, s.ptr, i);
+    }
+}
+
+class C88
+{
+    void opDispatch(string s)(int i)
+    {
+        printf("C.opDispatch('%.*s', %d)\n", s.length, s.ptr, i);
+    }
+}
+
+struct D88
+{
+    template opDispatch(string s)
+    {
+        enum int opDispatch = 8;
+    }
+}
+
+void test88()
+{
+    S88 s;
+    s.opDispatch!("hello")(7);
+    s.foo(7);
+
+    auto c = new C88();
+    c.foo(8);
+
+    D88 d;
+    printf("d.foo = %d\n", d.foo);
+    assert(d.foo == 8);
+}
+
+/***************************************************/
+
+void test89() {
+    static struct X {
+        int x;
+        int bar() { return x; }
+    }
+    X s;
+    printf("%d\n", s.sizeof);
+    assert(s.sizeof == 4);
+}
+
+/***************************************************/
+
+struct S90
+{
+    void opDispatch( string name, T... )( T values )
+    {
+        assert(values[0] == 3.14);
+    }
+}
+
+void test90( )
+{   S90 s;
+    s.opDispatch!("foo")( 3.14 );
+    s.foo( 3.14 );
+}
+
+/***************************************************/
+
+struct A7439(int r, int c)
+{
+    alias r R;
+    alias c C;
+    alias float[R * C] Data;
+    Data _data;
+    alias _data this;
+
+    this(Data ar){ _data = ar; }
+
+    pure ref float opIndex(size_t rr, size_t cc){ return _data[cc + rr * C]; }
+}
+
+void test7439()
+{
+    A7439!(2, 2) a = A7439!(2, 2)([8, 3, 2, 9]);
+    a[0,0] -= a[0,0] * 2.0;
+}
+
+/***************************************************/
+
+void foo91(uint line = __LINE__) { printf("%d\n", line); }
+
+void test91()
+{
+    foo91();
+    printf("%d\n", __LINE__);
+}
+
+/***************************************************/
+
+bool fun13468(Object e, typeof(null) needle)
+{
+    return (e == needle);
+}
+
+void test13468()
+{
+    assert(fun13468(null, null));
+}
+
+/***************************************************/
+
+auto ref foo92(ref int x) { return x; }
+int bar92(ref int x) { return x; }
+
+void test92()
+{
+    int x = 3;
+    int i = bar92(foo92(x));
+    assert(i == 3);
+}
+
+/***************************************************/
+
+struct Foo93
+{
+    public int foo() const
+    {
+        return 2;
+    }
+}
+
+void test93()
+{
+    const Foo93 bar = Foo93();
+    enum bla = bar.foo();
+    assert(bla == 2);
+}
+
+/***************************************************/
+
+
+extern(C++) class C1687
+{
+    void func() {}
+}
+
+void test1687()
+{
+    auto c = new C1687();
+    assert(c.__vptr[0] == (&c.func).funcptr);
+}
+
+/***************************************************/
+
+struct Foo94
+{
+    int x, y;
+    real z;
+}
+
+pure nothrow Foo94 makeFoo(const int x, const int y)
+{
+    return Foo94(x, y, 3.0);
+}
+
+void test94()
+{
+    auto f = makeFoo(1, 2);
+    assert(f.x==1);
+    assert(f.y==2);
+    assert(f.z==3);
+}
+
+/***************************************************/
+
+struct T95
+{
+    @disable this(this)
+    {
+    }
+}
+
+struct S95
+{
+    T95 t;
+}
+
+@disable void foo95() { }
+
+struct T95A
+{
+    @disable this(this);
+}
+
+struct S95A
+{
+    T95A t;
+}
+
+@disable void foo95A() { }
+
+void test95()
+{
+    S95 s;
+    S95 t;
+    static assert(!__traits(compiles, t = s));
+    static assert(!__traits(compiles, foo95()));
+
+    S95A u;
+    S95A v;
+    static assert(!__traits(compiles, v = u));
+    static assert(!__traits(compiles, foo95A()));
+}
+
+/***************************************************/
+
+struct S96(alias init)
+{
+    int[] content = init;
+}
+
+void test96()
+{
+    S96!([12, 3]) s1;
+    S96!([1, 23]) s2;
+    writeln(s1.content);
+    writeln(s2.content);
+    assert(!is(typeof(s1) == typeof(s2)));
+}
+
+/***************************************************/
+
+struct A97
+{
+    const bool opEquals(ref const A97) { return true; }
+    ref A97 opUnary(string op)() if (op == "++")
+    {
+        return this;
+    }
+}
+
+void test97()
+{
+    A97 a, b;
+    foreach (e; a .. b) {
+    }
+}
+
+/***************************************************/
+
+void test98()
+{
+    auto a = new int[2];
+    // the name "length" should not pop up in an index expression
+    static assert(!is(typeof(a[length - 1])));
+}
+
+/***************************************************/
+
+string s99;
+
+void bar99(string i)
+{
+}
+
+void function(string) foo99(string i)
+{
+    return &bar99;
+}
+
+void test99()
+{
+    foo99 (s99 ~= "a") (s99 ~= "b");
+    assert(s99 == "ab");
+}
+
+/***************************************************/
+// 5081
+
+void test5081()
+{
+    static pure immutable(int[]) x1()
+    {
+        int[] a = new int[](10);
+        return a;
+    }
+    static pure immutable(int[]) x2(int len)
+    {
+        int[] a = new int[](len);
+        return a;
+    }
+    static pure immutable(int[]) x3(immutable(int[]) org)
+    {
+        int[] a = new int[](org.length);
+        return a;
+    }
+
+    immutable a1 = x1();
+    immutable a2 = x2(10);
+    immutable a3 = x3([1,2]);
+
+    static pure int[] y1()
+    {
+        return new int[](10);
+    }
+
+    immutable b1 = y1();
+}
+
+/***************************************************/
+
+void test100()
+{
+   string s;
+
+   /* Testing order of evaluation */
+   void delegate(string, string) fun(string) {
+      s ~= "b";
+      return delegate void(string x, string y) { s ~= "e"; };
+   }
+   fun(s ~= "a")(s ~= "c", s ~= "d");
+   assert(s == "abcde", s);
+}
+
+/***************************************************/
+
+void test101()
+{
+   int[] d1 = [ 6, 1, 2 ];
+   byte[] d2 = [ 6, 1, 2 ];
+   assert(d1 == d2);
+   d2 ~= [ 6, 1, 2 ];
+   assert(d1 != d2);
+}
+
+/***************************************************/
+
+
+void test5403()
+{
+    struct S
+    {
+        static int front;
+        enum back = "yes!";
+        bool empty;
+        void popAny() { empty = true; }
+        alias popAny popFront;
+        alias popAny popBack;
+    }
+    S.front = 7;
+    foreach(int i; S()) assert(i == 7);
+    S.front = 2;
+    foreach(i; S()) assert(i == 2);
+    foreach_reverse(i; S()) assert(i == "yes!");
+}
+
+/***************************************************/
+
+static assert([1,2,3] == [1.0,2,3]);
+
+/***************************************************/
+
+int transmogrify(uint) { return 1; }
+int transmogrify(long) { return 2; }
+
+void test103()
+{
+    assert(transmogrify(42) == 1);
+}
+
+/***************************************************/
+
+int foo104(int x)
+{
+    int* p = &(x += 1);
+    return *p;
+}
+
+int bar104(int *x)
+{
+    int* p = &(*x += 1);
+    return *p;
+}
+
+void test104()
+{
+    auto i = foo104(1);
+    assert(i == 2);
+    i = bar104(&i);
+    assert(i == 3);
+}
+
+/***************************************************/
+
+ref int bump105(ref int x) { return ++x; }
+
+void test105()
+{
+   int x = 1;
+   bump105(bump105(x)); // two increments
+   assert(x == 3);
+}
+
+/***************************************************/
+
+pure int genFactorials(int n) {
+    static pure int factorial(int n) {
+      if (n==2) return 1;
+      return factorial(2);
+    }
+    return factorial(n);
+}
+
+/***************************************************/
+
+void test107()
+{
+    int[6] a;
+    writeln(a);
+    writeln(a.init);
+    assert(a.init == [0,0,0,0,0,0]);
+}
+
+/***************************************************/
+
+class A109 {}
+
+void test109()
+{
+    immutable(A109) b;
+    A109 c;
+    auto z = true ? b : c;
+    //writeln(typeof(z).stringof);
+    static assert(is(typeof(z) == const(A109)));
+}
+
+/***************************************************/
+
+template Boo(T) {}
+struct Foo110(T, alias V = Boo!T)
+{
+    pragma(msg, V.stringof);
+    static const s = V.stringof;
+}
+alias Foo110!double B110;
+alias Foo110!int A110;
+
+static assert(B110.s == "Boo!double");
+static assert(A110.s == "Boo!int");
+
+/***************************************************/
+
+int test11247()
+{
+    static assert(is(byte[typeof(int.init).sizeof] == byte[4]));
+    static assert(is(byte[typeof(return).sizeof] == byte[4]));
+    return 0;
+}
+
+/***************************************************/
+
+// 3716
+void test111()
+{
+    auto k1 = true ? [1,2] : []; // OK
+    auto k2 = true ? [[1,2]] : [[]];
+    auto k3 = true ? [] : [[1,2]];
+    auto k4 = true ? [[[]]] : [[[1,2]]];
+    auto k5 = true ? [[[1,2]]] : [[[]]];
+    auto k6 = true ? [] : [[[]]];
+    static assert(!is(typeof(true ? [[[]]] : [[1,2]]))); // Must fail
+}
+
+/***************************************************/
+// 658
+
+void test658()
+{
+    struct S { int i; }
+    class C { int i; }
+
+    S s;
+    S* sp = &s;
+    with (sp) i = 42;
+    assert(s.i == 42);
+    with (&s) i = 43;
+    assert(s.i == 43);
+
+    C c = new C;
+    C* cp = &c;
+    with (cp) i = 42;
+    assert(c.i == 42);
+    with (&c) i = 43;
+    assert(c.i == 43);
+}
+
+/***************************************************/
+
+void test3069()
+{
+    ubyte id = 0;
+    void[] v = [id] ~ [id];
+}
+
+/***************************************************/
+// 4303
+
+template foo112() if (__traits(compiles,undefined))
+{
+    enum foo112 = false;
+}
+
+template foo112() if (true)
+{
+    enum foo112 = true;
+}
+
+pragma(msg,__traits(compiles,foo112!()));
+static assert(__traits(compiles,foo112!()));
+
+const bool bar112 = foo112!();
+
+
+/***************************************************/
+
+struct File113
+{
+    this(int name) { }
+
+    ~this() { }
+
+    void opAssign(File113 rhs) { }
+
+    struct ByLine
+    {
+        File113 file;
+
+        this(int) { }
+
+    }
+
+    ByLine byLine()
+    {
+        return ByLine(1);
+    }
+}
+
+auto filter113(File113.ByLine rs)
+{
+    struct Filter
+    {
+        this(File113.ByLine r) { }
+    }
+
+    return Filter(rs);
+}
+
+void test113()
+{
+    auto f = File113(1);
+    auto rx = f.byLine();
+    auto file = filter113(rx);
+}
+
+/***************************************************/
+
+template foo114(fun...)
+{
+    auto foo114(int[] args)
+    {
+        return 1;
+    }
+}
+
+pragma(msg, typeof(foo114!"a + b"([1,2,3])));
+
+/***************************************************/
+// Bugzilla 3935
+
+struct Foo115 {
+    void opBinary(string op)(Foo other) {
+        pragma(msg, "op: " ~ op);
+        assert(0);
+    }
+}
+
+void test115()
+{
+    Foo115 f;
+    f = f;
+}
+
+/***************************************************/
+// Bugzilla 2477
+
+void foo116(T,)(T t) { T x; }
+
+void test116()
+{
+    int[] data = [1,2,3,];  // OK
+
+    data = [ 1,2,3, ];  // fails
+    auto i = data[1,];
+    foo116!(int)(3);
+    foo116!(int,)(3);
+    foo116!(int,)(3,);
+}
+
+/***************************************************/
+
+void test1891()
+{
+    struct C {
+        char[8] x = "helloabc";
+    }
+
+    int main()
+    {
+        C* a = new C;
+        C*[] b;
+        b ~= new C;
+
+        auto g = a ~ b;
+        assert(g[0] && g[1] && g[0].x == g[1].x);
+
+        return 0;
+    }
+}
+
+/***************************************************/
+// Bugzilla 4291
+
+void test117() pure
+{
+    mixin declareVariable;
+    var = 42;
+    mixin declareFunction;
+    readVar();
+}
+template declareVariable() { int var; }
+template declareFunction()
+{
+    int readVar() { return var; }
+}
+
+/***************************************************/
+// Bugzilla 4177
+
+pure real log118(real x) {
+    if (__ctfe)
+        return 0.0;
+    else
+        return 1.0;
+}
+
+enum x118 = log118(4.0);
+
+void test118() {}
+
+/***************************************************/
+
+void bug4465()
+{
+    const a = 2 ^^ 2;
+    int b = a;
+}
+
+/***************************************************/
+
+pure void foo(int *p)
+{
+    *p = 3;
+}
+
+pure void test120()
+{
+    int i;
+    foo(&i);
+    assert(i == 3);
+}
+
+/***************************************************/
+// 4866
+
+immutable int[3] statik = [ 1, 2, 3 ];
+enum immutable(int)[] dynamic = statik;
+
+static assert(is(typeof(dynamic) == immutable(int)[]));
+static if (! is(typeof(dynamic) == immutable(int)[]))
+{
+    static assert(0);   // (7)
+}
+pragma(msg, "!! ", typeof(dynamic));
+
+/***************************************************/
+// 2943
+
+struct Foo2943
+{
+    int a;
+    int b;
+    alias b this;
+}
+
+void test122()
+{
+    Foo2943 foo, foo2;
+    foo.a = 1;
+    foo.b = 2;
+    foo2.a = 3;
+    foo2.b = 4;
+
+    foo2 = foo;
+    assert(foo2.a == foo.a);
+}
+
+/***************************************************/
+// 4641
+
+struct S123 {
+    int i;
+    alias i this;
+}
+
+void test123() {
+    S123[int] ss;
+    ss[0] = S123.init; // This line causes Range Violation.
+}
+
+/***************************************************/
+// 2451
+
+struct Foo124 {
+    int z = 3;
+    void opAssign(Foo124 x) { z= 2;}
+}
+
+struct Bar124 {
+    int z = 3;
+    this(this){ z = 17; }
+}
+
+void test124() {
+    Foo124[string] stuff;
+    stuff["foo"] = Foo124.init;
+    assert(stuff["foo"].z == 3);
+    stuff["foo"] = Foo124.init;
+    assert(stuff["foo"].z == 2);
+
+    Bar124[string] stuff2;
+    Bar124 q;
+    stuff2["dog"] = q;
+    assert(stuff2["dog"].z == 17);
+}
+
+/***************************************************/
+
+void test3022()
+{
+    static class Foo3022
+    {
+        new(size_t)
+        {
+            assert(0);
+        }
+    }
+
+    scope x = new Foo3022;
+}
+
+/***************************************************/
+
+void doNothing() {}
+
+void bug5071(short d, ref short c) {
+   assert(c==0x76);
+
+    void closure() {
+        auto c2 = c;
+        auto d2 = d;
+        doNothing();
+    }
+    auto useless = &closure;
+}
+
+void test125()
+{
+   short c = 0x76;
+   bug5071(7, c);
+}
+
+/***************************************************/
+
+struct Foo126
+{
+   static Foo126 opCall(in Foo126 _f) pure
+   {
+       return _f;
+   }
+}
+
+/***************************************************/
+
+void test796()
+{
+    struct S { invariant() { throw new Exception(""); } }
+    S* s;
+    try {
+        assert(s);
+    } catch (Error) {
+    }
+}
+
+/***************************************************/
+
+void test7077()
+{
+    if(0) mixin("auto x = 2;");
+    auto x = 1;
+}
+
+/***************************************************/
+
+struct Tuple127(S...)
+{
+    S expand;
+    alias expand this;
+}
+
+alias Tuple127!(int, int) Foo127;
+
+void test127()
+{
+    Foo127[] m_array;
+    Foo127 f;
+    m_array ~= f;
+}
+
+/***************************************************/
+
+struct Bug4434 {}
+alias const Bug4434* IceConst4434;
+alias shared Bug4434* IceShared4434;
+alias shared Bug4434[] IceSharedArray4434;
+alias immutable Bug4434* IceImmutable4434;
+alias shared const Bug4434* IceSharedConst4434;
+
+alias int MyInt4434;
+alias const MyInt4434[3] IceConstInt4434;
+
+alias immutable string[] Bug4830;
+
+/***************************************************/
+// 4254
+
+void bub(const inout int other) {}
+
+void test128()
+{
+    bub(1);
+}
+
+
+/***************************************************/
+
+pure nothrow @safe auto bug4915a() {  return 0; }
+pure nothrow @safe int  bug4915b() { return bug4915a(); }
+
+void bug4915c()
+{
+    pure nothrow @safe int d() { return 0; }
+    int e() pure nothrow @safe { return d(); }
+}
+
+/***************************************************/
+// 5164
+
+static if (is(int Q == int, Z...))  { }
+
+/***************************************************/
+// 5195
+
+alias typeof(foo5195) food5195;
+const int * foo5195 = null;
+alias typeof(foo5195) good5195;
+static assert( is (food5195 == good5195));
+
+/***************************************************/
+
+version (Windows)
+{
+}
+else
+{
+int[0] var5332;
+void test5332() { auto x = var5332; }
+}
+
+/***************************************************/
+// 5191
+
+struct Foo129
+{
+    void add(T)(T value) nothrow
+    {
+        this.value += value;
+    }
+
+    this(int value)
+    {
+        this.value = value;
+    }
+
+    int value;
+}
+
+void test129()
+{
+    auto foo = Foo129(5);
+    assert(foo.value == 5);
+
+    foo.add(2);
+    writeln(foo.value);
+    assert(foo.value == 7);
+
+    foo.add(3);
+    writeln(foo.value);
+    assert(foo.value == 10);
+
+    foo.add(3);
+    writeln(foo.value);
+    assert(foo.value == 13);
+
+    void delegate (int) nothrow dg = &foo.add!(int);
+    dg(7);
+    assert(foo.value == 20);
+}
+
+/***************************************************/
+// 6169
+
+auto ctfefunc6169() { return ";"; }
+enum ctfefptr6169 = &ctfefunc6169;
+int ctfefunc6169a() { return 1; }
+template x6169(string c) { alias int x6169; }
+template TT6169(T...) { alias T TT6169; }
+@property ctfeprop6169() { return "g"; }
+
+void test6169() pure @safe
+{
+    enum a = ctfefunc6169();
+    static b = ctfefunc6169();
+    x6169!(ctfefunc6169()) tt;
+    mixin(ctfefunc6169());
+    static if(ctfefunc6169()) {}
+    pragma(msg, ctfefunc6169());
+    enum xx
+    {
+        k = 0,
+        j = ctfefunc6169a()
+    }
+    auto g = mixin('"' ~ ctfefunc6169() ~ '"');
+    //auto h = import("testx.d" ~ false ? ctfefunc() : "");
+    alias TT6169!(int, int)[ctfefunc6169a()..ctfefunc6169a()] i;
+    alias TT6169!(int, int)[ctfefunc6169a()] j;
+    int[ctfefunc6169a()+1] k;
+    alias int[ctfefunc6169a()] l;
+    switch(1)
+    {
+    //case ctfefunc6169a(): // Can't do this because of case variables
+    case ctfefunc6169a()+1:
+        ..
+    case ctfefunc6169a()+2:
+    default:
+        break;
+    }
+    static assert(ctfefunc6169a());
+    void fun(int i : ctfefunc6169a() = ctfefunc6169a(), alias j)() if (ctfefunc6169a()) {}
+    fun!(ctfefunc6169a(), ctfefunc6169())();
+    enum z = ctfefptr6169();
+
+    auto p = mixin(ctfeprop6169);
+}
+
+/***************************************************/
+// 10506
+
+void impureFunc10506() {}
+string join10506(RoR)(RoR ror)
+{
+    impureFunc10506();
+    return ror[0] ~ ror[1];
+}
+
+void test10506() pure
+{
+    void foobar() {}
+
+    mixin(["foo", "bar"].join10506()~";");
+}
+
+/***************************************************/
+
+const shared class C5107
+{
+    int x;
+}
+
+static assert(is(typeof(C5107.x) ==  const)); // okay
+static assert(is(typeof(C5107.x) == shared)); // fails!
+
+/***************************************************/
+
+immutable struct S3598
+{
+    static void funkcja() { }
+}
+
+/***************************************************/
+// 4211
+
+@safe struct X130
+{
+    void func() {  }
+}
+
+@safe class Y130
+{
+    void func() {  }
+}
+
+@safe void test130()
+{
+    X130 x;
+    x.func();
+    auto y = new Y130;
+    y.func();
+}
+
+/***************************************************/
+
+template Return(alias fun)
+{
+    static if (is(typeof(fun) R == return)) alias R Return;
+}
+
+interface I4217
+{
+    int  square(int  n);
+    real square(real n);
+}
+alias Return!( __traits(getOverloads, I4217, "square")[0] ) R4217;
+alias Return!( __traits(getOverloads, I4217, "square")[1] ) S4217;
+
+static assert(! is(R4217 == S4217));
+
+/***************************************************/
+// 5094
+
+void test131()
+{
+    S131 s;
+    int[] conv = s;
+}
+
+struct S131
+{
+    @property int[] get() { return [1,2,3]; }
+    alias get this;
+}
+
+/***************************************************/
+
+struct S7545
+{
+    uint id;
+    alias id this;
+}
+
+void test7545()
+{
+    auto id = 0 ? S7545() : -1;
+}
+
+/***************************************************/
+// 5020
+
+void test132()
+{
+    S132 s;
+    if (!s) {}
+}
+
+struct S132
+{
+    bool cond;
+    alias cond this;
+}
+
+/***************************************************/
+// 5343
+
+struct Tuple5343(Specs...)
+{
+    Specs[0] field;
+}
+
+struct S5343(E)
+{
+    immutable E x;
+}
+enum A5343{a,b,c}
+alias Tuple5343!(A5343) TA5343;
+alias S5343!(A5343) SA5343;
+
+/***************************************************/
+// 5365
+
+interface IFactory
+{
+    void foo();
+}
+
+class A133
+{
+    protected static class Factory : IFactory
+    {
+        void foo()
+        {
+        }
+    }
+
+    this()
+    {
+        _factory = createFactory();
+    }
+
+    protected IFactory createFactory()
+    {
+        return new Factory;
+    }
+
+    private IFactory _factory;
+    @property final IFactory factory()
+    {
+        return _factory;
+    }
+
+    alias factory this;
+}
+
+void test133()
+{
+
+    IFactory f = new A133;
+    f.foo(); // segfault
+}
+
+/***************************************************/
+// 5365
+
+class B134
+{
+}
+
+class A134
+{
+
+    B134 _b;
+
+    this()
+    {
+        _b = new B134;
+    }
+
+    B134 b()
+    {
+        return _b;
+    }
+
+    alias b this;
+}
+
+void test134()
+{
+
+    auto a = new A134;
+    B134 b = a; // b is null
+    assert(a._b is b); // fails
+}
+
+/***************************************************/
+// 5025
+
+struct S135 {
+  void delegate() d;
+}
+
+void test135()
+{
+  shared S135[] s;
+  if (0)
+    s[0] = S135();
+}
+
+/***************************************************/
+// 5545
+
+bool enforce136(bool value, lazy const(char)[] msg = null) {
+    if(!value) {
+        return false;
+    }
+
+    return value;
+}
+
+struct Perm {
+    byte[3] perm;
+    ubyte i;
+
+    this(byte[] input) {
+        foreach(elem; input) {
+            enforce136(i < 3);
+            perm[i++] = elem;
+            std.stdio.stderr.writeln(i);  // Never gets incremented.  Stays at 0.
+        }
+    }
+}
+
+void test136() {
+    byte[] stuff = [0, 1, 2];
+    auto perm2 = Perm(stuff);
+    writeln(perm2.perm);  // Prints [2, 0, 0]
+    assert(perm2.perm[] == [0, 1, 2]);
+}
+
+/***************************************************/
+// 4097
+
+void foo4097() { }
+alias typeof(&foo4097) T4097;
+static assert(is(T4097 X : X*) && is(X == function));
+
+static assert(!is(X));
+
+/***************************************************/
+// 5798
+
+void assign9(ref int lhs) pure {
+    lhs = 9;
+}
+
+void assign8(ref int rhs) pure {
+    rhs = 8;
+}
+
+int test137(){
+    int a=1,b=2;
+    assign8(b),assign9(a);
+    assert(a == 9);
+    assert(b == 8);   // <-- fail
+
+    assign9(b),assign8(a);
+    assert(a == 8);
+    assert(b == 9);   // <-- fail
+
+    return 0;
+}
+
+/***************************************************/
+
+// 9366
+static assert(!is(typeof((void[]).init ~ cast(void)0)));
+static assert(!is(typeof(cast(void)0 ~ (void[]).init)));
+
+/***************************************************/
+
+struct Size138
+{
+    union
+    {
+        struct
+        {
+            int width;
+            int height;
+        }
+
+        long size;
+    }
+}
+
+enum Size138 foo138 = {2 ,5};
+
+Size138 bar138 = foo138;
+
+void test138()
+{
+    assert(bar138.width == 2);
+    assert(bar138.height == 5);
+}
+
+/***************************************************/
+
+void test3822()
+{
+    import core.stdc.stdlib;
+    int i = 0;
+    void* ptr;
+    while(i++ != 2)
+    {
+        auto p = alloca(2);
+        assert(p != ptr);
+        ptr = p;
+    }
+}
+
+/***************************************************/
+
+// 5939, 5940
+
+template map(fun...)
+{
+    auto map(double[] r)
+    {
+        struct Result
+        {
+            this(double[] input)
+            {
+            }
+        }
+
+        return Result(r);
+    }
+}
+
+
+void test139()
+{
+    double[] x;
+    alias typeof(map!"a"(x)) T;
+    T a = void;
+    auto b = map!"a"(x);
+    auto c = [map!"a"(x)];
+    T[3] d = void;
+}
+
+
+/***************************************************/
+// 5966
+
+string[] foo5966(string[] a)
+{
+    a[0] = a[0][0..$];
+    return a;
+}
+
+enum var5966 = foo5966([""]);
+
+/***************************************************/
+// 5975
+
+int foo5975(wstring replace)
+{
+  wstring value = "";
+  value ~= replace;
+  return 1;
+}
+
+enum X5975 = foo5975("X"w);
+
+/***************************************************/
+// 5965
+
+template mapx(fun...) if (fun.length >= 1)
+{
+    int mapx(Range)(Range r)
+    {
+        return 1;
+    }
+}
+
+void test140()
+{
+   int foo(int i) { return i; }
+
+   int[] arr;
+   auto x = mapx!( (int a){return foo(a);} )(arr);
+}
+
+/***************************************************/
+
+void bug5976()
+{
+    int[] barr;
+    int * k;
+    foreach (ref b; barr)
+    {
+        scope(failure)
+            k = &b;
+        k = &b;
+    }
+}
+
+/***************************************************/
+// 5771
+
+struct S141
+{
+    this(A)(auto ref A a){}
+}
+
+void test141()
+{
+    S141 s = S141(10);
+}
+
+/***************************************************/
+
+class test5498_A {}
+class test5498_B : test5498_A {}
+class test5498_C : test5498_A {}
+
+static assert(is(typeof([test5498_B.init, test5498_C.init]) == test5498_A[]));
+
+/***************************************************/
+// 3688
+
+struct S142
+{
+    int v;
+    this(int n) pure { v = n; }
+    const bool opCast(T:bool)() { return true; }
+}
+
+void test142()
+{
+    if (int a = 1)
+        assert(a == 1);
+    else assert(0);
+
+    if (const int a = 2)
+        assert(a == 2);
+    else assert(0);
+
+    if (immutable int a = 3)
+        assert(a == 3);
+    else assert(0);
+
+    if (auto s = S142(10))
+        assert(s.v == 10);
+    else assert(0);
+
+    if (auto s = const(S142)(20))
+        assert(s.v == 20);
+    else assert(0);
+
+    if (auto s = immutable(S142)(30))
+        assert(s.v == 30);
+    else assert(0);
+}
+
+/***************************************************/
+// 6072
+
+static assert({
+    if (int x = 5) {}
+    return true;
+}());
+
+/***************************************************/
+// 5959
+
+int n;
+
+void test143()
+{
+    ref int f(){ return n; }            // NG
+    f() = 1;
+    assert(n == 1);
+
+    nothrow ref int f1(){ return n; }    // OK
+    f1() = 2;
+    assert(n == 2);
+
+    auto ref int f2(){ return n; }       // OK
+    f2() = 3;
+    assert(n == 3);
+}
+
+/***************************************************/
+// 6119
+
+void startsWith(alias pred) ()   if (is(typeof(pred('c', 'd')) : bool))
+{
+}
+
+void startsWith(alias pred) ()   if (is(typeof(pred('c', "abc")) : bool))
+{
+}
+
+void test144()
+{
+    startsWith!((a, b) { return a == b; })();
+}
+
+/***************************************************/
+
+void test145()
+{
+    import core.stdc.stdio;
+    printf("hello world 145\n");
+}
+
+void test146()
+{
+    test1();
+    static import core.stdc.stdio;
+    core.stdc.stdio.printf("hello world 146\n");
+}
+
+/***************************************************/
+// 5856
+
+struct X147
+{
+    void f()       { writeln("X.f mutable"); }
+    void f() const { writeln("X.f const"); }
+
+    void g()()       { writeln("X.g mutable"); }
+    void g()() const { writeln("X.g const"); }
+
+    void opOpAssign(string op)(int n)       { writeln("X+= mutable"); }
+    void opOpAssign(string op)(int n) const { writeln("X+= const"); }
+}
+
+void test147()
+{
+    X147 xm;
+    xm.f();     // prints "X.f mutable"
+    xm.g();     // prints "X.g mutable"
+    xm += 10;   // should print "X+= mutable" (1)
+
+    const(X147) xc;
+    xc.f();     // prints "X.f const"
+    xc.g();     // prints "X.g const"
+    xc += 10;   // should print "X+= const" (2)
+}
+
+
+/***************************************************/
+
+void test3559()
+{
+    static class A
+    {
+        int foo(int a)   { return 0; }
+        int foo(float a) { return 1; }
+
+        int bar(float a) { return 1; }
+        int bar(int a) { return 0; }
+    }
+
+    static class B : A
+    {
+        override int foo(float a) { return 2; }
+        alias A.foo foo;
+
+        alias A.bar bar;
+        override int bar(float a) { return 2; }
+    }
+
+    {
+        auto x = new A;
+        auto f1 = cast(int delegate(int))&x.foo;
+        auto f2 = cast(int delegate(float))&x.foo;
+        int delegate(int) f3 = &x.foo;
+        int delegate(float) f4 = &x.foo;
+
+        assert(f1(0) == 0);
+        assert(f2(0) == 1);
+        assert(f3(0) == 0);
+        assert(f4(0) == 1);
+    }
+
+    {
+        auto x = new B;
+        auto f1 = cast(int delegate(int))&x.foo;
+        auto f2 = cast(int delegate(float))&x.foo;
+        int delegate(int) f3 = &x.foo;
+        int delegate(float) f4 = &x.foo;
+
+        assert(f1(0) == 0);
+        assert(f2(0) == 2);
+        assert(f3(0) == 0);
+        assert(f4(0) == 2);
+    }
+
+    {
+        auto x = new A;
+        auto f1 = cast(int delegate(int))&x.bar;
+        auto f2 = cast(int delegate(float))&x.bar;
+        int delegate(int) f3 = &x.bar;
+        int delegate(float) f4 = &x.bar;
+
+        assert(f1(0) == 0);
+        assert(f2(0) == 1);
+        assert(f3(0) == 0);
+        assert(f4(0) == 1);
+    }
+
+    {
+        auto x = new B;
+        auto f1 = cast(int delegate(int))&x.bar;
+        auto f2 = cast(int delegate(float))&x.bar;
+        int delegate(int) f3 = &x.bar;
+        int delegate(float) f4 = &x.bar;
+
+        assert(f1(0) == 0);
+        assert(f2(0) == 2);
+        assert(f3(0) == 0);
+        assert(f4(0) == 2);
+    }
+}
+
+/***************************************************/
+
+extern(C++)
+class C13182
+{
+}
+
+void test13182()
+{
+    scope C13182 c = new C13182();
+}
+
+/***************************************************/
+// 5897
+
+struct A148{ int n; }
+struct B148{
+    int n, m;
+    this(A148 a){ n = a.n, m = a.n*2; }
+}
+
+struct C148{
+    int n, m;
+    static C148 opCall(A148 a)
+    {
+        C148 b;
+        b.n = a.n, b.m = a.n*2;
+        return b;
+    }
+}
+
+void test148()
+{
+    auto a = A148(10);
+    auto b = cast(B148)a;
+    assert(b.n == 10 && b.m == 20);
+    auto c = cast(C148)a;
+    assert(c.n == 10 && c.m == 20);
+}
+
+/***************************************************/
+// 4969
+
+class MyException : Exception
+{
+    this()
+    {
+        super("An exception!");
+    }
+}
+
+void throwAway()
+{
+    throw new MyException;
+}
+
+void cantthrow() nothrow
+{
+    try
+        throwAway();
+    catch(MyException me)
+        assert(0);
+    catch(Exception e)
+        assert(0);
+}
+
+/***************************************************/
+// 2356
+
+void test2356()
+{
+    int[3] x = [1,2,3];
+    printf("x[] = [%d %d %d]\n", x[0], x[1], x[2]);
+    assert(x[0] == 1 && x[1] == 2 && x[2] == 3);
+
+    struct S
+    {
+        static int pblit;
+        int n;
+        this(this) { ++pblit; printf("postblit: %d\n", n); }
+    }
+    S s2 = S(2);
+    S[3] s = [S(1), s2, S(3)];
+    assert(s[0].n == 1 && s[1].n == 2 && s[2].n == 3);
+    printf("s[].n = [%d %d %d]\n", s[0].n, s[1].n, s[2].n);
+    assert(S.pblit == 1);
+
+    ubyte[1024] v;
+    v = typeof(v).init;
+    printf("v[] = [%d %d %d, ..., %d]\n", v[0], v[1], v[2], v[$-1]);
+    foreach (ref a; v) assert(a == 0);
+
+    int n = 5;
+    int[3] y = [n, n, n];
+    printf("y[] = [%d %d %d]\n", y[0], y[1], y[2]);
+    assert(y[0] == 5 && y[1] == 5 && y[2] == 5);
+
+    S[3] z = [s2, s2, s2];
+    assert(z[0].n == 2 && z[1].n == 2 && z[2].n == 2);
+    printf("z[].n = [%d %d %d]\n", z[0].n, z[1].n, z[2].n);
+    assert(S.pblit == 1 + 3);
+
+    int[0] nsa0 = [];
+    void[0] vsa0 = [];
+
+    void foo(T)(T){}
+    foo(vsa0);
+
+    ref int[0] bar() { static int[1] sa; return *cast(int[0]*)&sa; }
+    bar() = [];
+}
+
+/***************************************************/
+// 11238
+
+void test11238()
+{
+    int[2] m;
+    m[0] = 4,m[1] = 6;
+    //printf("%d,%d\n", m[0], m[1]);
+    assert(m[0] == 4 && m[1] == 6);
+
+    m = [m[1], m[0]];   // swap
+    assert(m[0] == 6 && m[1] == 4);
+    //printf("%d,%d\n", m[0], m[1]);
+
+    m = [m[1], m[0]];   // swap
+    //printf("%d,%d\n", m[0], m[1]);
+    assert(m[0] == 4 && m[1] == 6);
+}
+
+/***************************************************/
+
+void test11805()
+{
+    int i;
+
+    i = 47;
+    i = 1 && i;
+    assert(i == 1);
+    i = 0 || i;
+    assert(i == 1);
+}
+
+/***************************************************/
+
+class A2540
+{
+    int a;
+    int foo() { return 0; }
+    alias int X;
+}
+
+class B2540 : A2540
+{
+    int b;
+    override super.X foo() { return 1; }
+
+    alias this athis;
+    alias this.b thisb;
+    alias super.a supera;
+    alias super.foo superfoo;
+    alias this.foo thisfoo;
+}
+
+struct X2540
+{
+    alias this athis;
+}
+
+void test2540()
+{
+    auto x = X2540.athis.init;
+    static assert(is(typeof(x) == X2540));
+
+    B2540 b = new B2540();
+
+    assert(&b.a == &b.supera);
+    assert(&b.b == &b.thisb);
+    assert(b.thisfoo() == 1);
+}
+
+/***************************************************/
+
+class B14348
+{
+    int foo() { return 0; }
+}
+
+class C14348 : B14348
+{
+    override int foo() { return 1; }
+
+    alias superfoo = typeof(super).foo;
+    alias thisfoo = typeof(this).foo;
+}
+
+B14348 test14348()
+{
+    alias foo = typeof(return).foo;  // currently doesn't work.
+    assert(&B14348.foo is &C14348.superfoo);
+    assert(&C14348.foo is &C14348.thisfoo);
+    return null;
+}
+
+/***************************************************/
+// 7295
+
+struct S7295
+{
+    int member;
+    @property ref int refCountedPayload() { return member; }
+    alias refCountedPayload this;
+}
+
+void foo7295(S)(immutable S t, int qq) pure { }
+void foo7295(S)(S s) pure { }
+
+void bar7295() pure
+{
+    S7295 b;
+    foo7295(b);
+}
+
+/***************************************************/
+// 5659
+
+void test149()
+{
+    import std.traits;
+
+    char a;
+    immutable(char) b;
+
+    static assert(is(typeof(true ? a : b) == const(char)));
+    static assert(is(typeof([a, b][0]) == const(char)));
+
+    static assert(is(CommonType!(typeof(a), typeof(b)) == const(char)));
+}
+
+
+/***************************************************/
+// 1373
+
+void func1373a(){}
+
+static assert(typeof(func1373a).stringof == "void()");
+static assert(typeof(func1373a).mangleof == "FZv");
+static assert(!__traits(compiles, typeof(func1373a).alignof));
+static assert(!__traits(compiles, typeof(func1373a).init));
+static assert(!__traits(compiles, typeof(func1373a).offsetof));
+
+void func1373b(int n){}
+
+static assert(typeof(func1373b).stringof == "void(int n)");
+static assert(typeof(func1373b).mangleof == "FiZv");
+static assert(!__traits(compiles, typeof(func1373b).alignof));
+static assert(!__traits(compiles, typeof(func1373b).init));
+static assert(!__traits(compiles, typeof(func1373b).offsetof));
+
+/***************************************************/
+
+void bar150(T)(T n) {  }
+
+@safe void test150()
+{
+    bar150(1);
+}
+
+/***************************************************/
+
+void test5785()
+{
+    static struct x { static int y; }
+    assert(x.y !is 1);
+    assert(x.y !in [1:0]);
+}
+
+/***************************************************/
+
+void bar151(T)(T n) {  }
+
+nothrow void test151()
+{
+    bar151(1);
+}
+
+/***************************************************/
+
+@property int coo() { return 1; }
+@property auto doo(int i) { return i; }
+
+@property int eoo() { return 1; }
+@property auto ref hoo(int i) { return i; }
+
+// 3359
+
+int goo(int i) pure { return i; }
+auto ioo(int i) pure { return i; }
+auto ref boo(int i) pure nothrow { return i; }
+
+class A152 {
+    auto hoo(int i) pure  { return i; }
+    const boo(int i) nothrow { return i; }
+    auto coo(int i) const { return i; }
+    auto doo(int i) immutable { return i; }
+    auto eoo(int i) shared { return i; }
+}
+
+// 4706
+
+struct Foo152(T) {
+    @property auto ref front() {
+        return T.init;
+    }
+
+    @property void front(T num) {}
+}
+
+void test152() {
+    Foo152!int foo;
+    auto a = foo.front;
+    foo.front = 2;
+}
+
+/***************************************************/
+// 6733
+
+void bug6733(int a, int b) pure nothrow { }
+void test6733() {
+   int z = 1;
+   bug6733(z++, z++);
+   assert(z==3);
+}
+
+/***************************************************/
+// 3799
+
+void test153()
+{
+    void bar()
+    {
+    }
+
+    static assert(!__traits(isStaticFunction, bar));
+}
+
+/***************************************************/
+// 3632
+
+
+void test154() {
+    float f;
+    assert(f is float.init);
+    double d;
+    assert(d is double.init);
+    real r;
+    assert(r is real.init);
+
+    assert(float.nan is float.nan);
+    assert(double.nan is double.nan);
+    assert(real.nan is real.nan);
+}
+
+/***************************************************/
+
+void test6545()
+{
+    static int[] func()
+    {
+        auto a = [1, 2, 3];
+        auto b = [2, 3, 4];
+        auto c = [3, 4, 5];
+
+        a[] = b[] + c[];
+
+        return a;
+    }
+
+    auto a = func();
+    enum b = func();
+    assert(a == b);
+}
+
+/***************************************************/
+// 3147
+
+
+void test155()
+{
+    byte b = 1;
+    short s;
+    int i;
+    long l;
+
+    s = b + b;
+    b = s % b;
+    s = s >> b;
+    b = 1;
+    b = i % b;
+    b = b >> i;
+}
+
+/***************************************************/
+// 2486
+
+void test2486()
+{
+    void foo(ref int[] arr) {}
+
+    int[] arr = [1,2,3];
+    foo(arr);   //OK
+    static assert(!__traits(compiles, foo(arr[1..2]))); // should be NG
+
+    struct S
+    {
+        int[] a;
+        auto ref opSlice(){ return a[]; }  // line 4
+    }
+    S s;
+    s[];
+    // opSlice should return rvalue
+    static assert(is(typeof(&S.opSlice) == int[] function() pure nothrow @nogc @safe));
+    static assert(!__traits(compiles, foo(s[])));       // should be NG
+}
+
+/***************************************************/
+// 2521
+
+immutable int val = 23;
+const int val2 = 23;
+
+ref immutable(int) func2521_() {
+    return val;
+}
+ref immutable(int) func2521_2() {
+    return *&val;
+}
+ref immutable(int) func2521_3() {
+    return func2521_;
+}
+ref const(int) func2521_4() {
+    return val2;
+}
+ref const(int) func2521_5() {
+    return val;
+}
+auto ref func2521_6() {
+    return val;
+}
+ref func2521_7() {
+    return val;
+}
+
+/***************************************************/
+
+void test5554()
+{
+    class MA { }
+    class MB : MA { }
+    class MC : MB { }
+
+    class A { abstract MA foo(); }
+    interface I { MB foo(); }
+    class B : A
+    {
+        override MC foo() { return null; }
+    }
+    class C : B, I
+    {
+        override MC foo() { return null; }
+    }
+}
+
+/***************************************************/
+// 5962
+
+struct S156
+{
+          auto g()(){ return 1; }
+    const auto g()(){ return 2; }
+}
+
+void test156()
+{
+    auto ms = S156();
+    assert(ms.g() == 1);
+    auto cs = const(S156)();
+    assert(cs.g() == 2);
+}
+
+/***************************************************/
+
+void test10724()
+{
+    const(char)* s = "abc"[0..$-1];
+    assert(s[2] == '\0');
+}
+
+/***************************************************/
+
+void test6708(const ref int y)
+{
+    immutable int x;
+    test6708(x);
+}
+
+/***************************************************/
+// 4258
+
+struct Vec4258 {
+    Vec4258 opOpAssign(string Op)(auto ref Vec4258 other) if (Op == "+") {
+        return this;
+    }
+    Vec4258 opBinary(string Op:"+")(Vec4258 other) {
+        Vec4258 result;
+        return result += other;
+    }
+}
+void test4258() {
+    Vec4258 v;
+    v += Vec4258() + Vec4258(); // line 12
+}
+
+// regression fix test
+
+struct Foo4258 {
+    // binary ++/--
+    int opPostInc()() if (false) { return 0; }
+
+    // binary 1st
+    int opAdd(R)(R rhs) if (false) { return 0; }
+    int opAdd_r(R)(R rhs) if (false) { return 0; }
+
+    // compare
+    int opCmp(R)(R rhs) if (false) { return 0; }
+
+    // binary-op assign
+    int opAddAssign(R)(R rhs) if (false) { return 0; }
+}
+struct Bar4258 {
+    // binary commutive 1
+    int opAdd_r(R)(R rhs) if (false) { return 0; }
+
+    // binary-op assign
+    int opOpAssign(string op, R)(R rhs) if (false) { return 0; }
+}
+struct Baz4258 {
+    // binary commutive 2
+    int opAdd(R)(R rhs) if (false) { return 0; }
+}
+static assert(!is(typeof(Foo4258.init++)));
+static assert(!is(typeof(Foo4258.init + 1)));
+static assert(!is(typeof(1 + Foo4258.init)));
+static assert(!is(typeof(Foo4258.init < Foo4258.init)));
+static assert(!is(typeof(Foo4258.init += 1)));
+static assert(!is(typeof(Bar4258.init + 1)));
+static assert(!is(typeof(Bar4258.init += 1)));
+static assert(!is(typeof(1 + Baz4258.init)));
+
+/***************************************************/
+// 4539
+
+void test4539()
+{
+    static assert(!__traits(compiles, "hello" = "red"));
+
+    void foo1(ref string s){}
+    void foo2(ref const char[10] s){}
+    void foo3(ref char[5] s){}
+
+    void foo4(ref const char[5] s)
+    {
+        assert(s[0] == 'h');
+        assert(s[4] == 'o');
+    }
+    void foo5(ref const ubyte[5] s)
+    {
+        assert(s[0] == 0xc3);
+        assert(s[4] == 0x61);
+    }
+
+    static assert(!__traits(compiles, foo1("hello")));
+    static assert(!__traits(compiles, foo2("hello")));
+    static assert(!__traits(compiles, foo3("hello")));
+
+    // same as test68, 69, 70
+    foo4("hello");
+    foo5(cast(ubyte[5])x"c3fcd3d761");
+
+    //import std.conv;
+    //static assert(!__traits(compiles, parse!int("10") == 10));
+}
+
+/***************************************************/
+// 1471
+
+void test1471()
+{
+    int n;
+    string bar = "BOOM"[n..$-1];
+    assert(bar == "BOO");
+}
+
+/***************************************************/
+
+deprecated @disable int bug6389;
+static assert(!is(typeof(bug6389 = bug6389)));
+
+/***************************************************/
+
+void test10927()
+{
+    static assert( (1+2i) ^^ 3 == -11 - 2i );
+    auto a = (1+2i) ^^ 3;
+}
+
+/***************************************************/
+
+void test4963()
+{
+    struct Value {
+        byte a;
+    };
+    Value single()
+    {
+        return Value();
+    }
+
+    Value[] list;
+    auto x = single() ~ list;
+}
+
+/***************************************************/
+
+pure int test4031()
+{
+    static const int x = 8;
+    return x;
+}
+
+/***************************************************/
+// 5437
+
+template EnumMembers5437(E)
+{
+    template TypeTuple(T...){ alias T TypeTuple; }
+
+    alias TypeTuple!("A", "B") EnumMembers5437;
+}
+template IntValue5437()
+{
+    int IntValue5437 = 10;
+}
+
+void test5437()
+{
+    enum Foo { A, B }
+    alias EnumMembers5437!Foo members;      // OK
+    enum n1 = members.length;               // OK
+    enum n2 = (EnumMembers5437!Foo).length; // NG, type -> symbol
+
+    enum s1 = IntValue5437!().sizeof;       // OK
+    enum s2 = (IntValue5437!()).sizeof;     // NG, type -> expression
+}
+
+/***************************************************/
+// 1962
+
+
+void test1962()
+{
+    class C { abstract void x(); }
+    assert(C.classinfo.create() is null);
+}
+
+/***************************************************/
+// 6228
+
+
+void test6228()
+{
+    const(int)* ptr;
+    const(int)  temp;
+    auto x = (*ptr) ^^ temp;
+}
+
+/***************************************************/
+
+int test7544()
+{
+    try { throw new Exception(""); }
+    catch (Exception e) static assert(1);
+    return 1;
+}
+
+static assert(test7544());
+
+/***************************************************/
+
+struct S6230 {
+    int p;
+    int q() const pure {
+        return p;
+    }
+    void r() pure {
+        p = 231;
+    }
+}
+class C6230 {
+    int p;
+    int q() const pure {
+        return p;
+    }
+    void r() pure {
+        p = 552;
+    }
+}
+int q6230(ref const S6230 s) pure {    // <-- Currently OK
+    return s.p;
+}
+int q6230(ref const C6230 c) pure {    // <-- Currently OK
+    return c.p;
+}
+void r6230(ref S6230 s) pure {
+    s.p = 244;
+}
+void r6230(ref C6230 c) pure {
+    c.p = 156;
+}
+bool test6230pure() pure {
+    auto s = S6230(4);
+    assert(s.p == 4);
+    assert(q6230(s) == 4);
+    assert(s.q == 4);
+
+    auto c = new C6230;
+    c.p = 6;
+    assert(q6230(c) == 6);
+    assert(c.q == 6);
+
+    r6230(s);
+    assert(s.p == 244);
+    s.r();
+    assert(s.p == 231);
+
+    r6230(c);
+    assert(c.p == 156);
+    c.r();
+    assert(c.p == 552);
+
+    return true;
+}
+void test6230() {
+    assert(test6230pure());
+}
+
+/***************************************************/
+
+void test6264()
+{
+    struct S { auto opSlice() { return this; } }
+    int[] a;
+    S s;
+    static assert(!is(typeof(a[] = s[])));
+    int*[] b;
+    static assert(is(typeof(b[] = [new immutable(int)])));
+    char[] c = new char[](5);
+    c[] = "hello";
+}
+
+/***************************************************/
+// 5046
+
+void test5046()
+{
+    auto va = S5046!("", int)();
+    auto vb = makeS5046!("", int)();
+}
+
+struct S5046(alias p, T)
+{
+    T s;
+    T fun() { return s; }   // (10)
+}
+
+S5046!(p, T) makeS5046(alias p, T)()
+{
+    return typeof(return)();
+}
+
+/***************************************************/
+// 6335
+
+struct S6335
+{
+    const int value;
+    this()(int n){ value = n; }
+}
+void test6335()
+{
+    S6335 s = S6335(10);
+}
+
+/***************************************************/
+
+struct S6295(int N) {
+    int[N] x;
+    const nothrow pure @safe f() { return x.length; }
+}
+
+void test6295() {
+    auto bar(T: S6295!(N), int N)(T x) {
+        return x.f();
+    }
+    S6295!4 x;
+    assert(bar(x) == 4);
+}
+
+/***************************************************/
+
+template TT4536(T...) { alias T TT4536; }
+
+void test4536()
+{
+    auto x = TT4536!(int, long, [1, 2]).init;
+    assert(x[0] is int.init);
+    assert(x[1] is long.init);
+    assert(x[2] is [1, 2].init);
+}
+
+/***************************************************/
+
+struct S6284 {
+    int a;
+}
+class C6284 {
+    int a;
+}
+pure int bug6284a() {
+    S6284 s = {4};
+    auto b = s.a;   // ok
+    with (s) {
+        b += a;     // should be ok.
+    }
+    return b;
+}
+pure int bug6284b() {
+    auto s = new S6284;
+    s.a = 4;
+    auto b = s.a;
+    with (*s) {
+        b += a;
+    }
+    return b;
+}
+pure int bug6284c() {
+    auto s = new C6284;
+    s.a = 4;
+    auto b = s.a;
+    with (s) {
+        b += a;
+    }
+    return b;
+}
+void test6284() {
+    assert(bug6284a() == 8);
+    assert(bug6284b() == 8);
+    assert(bug6284c() == 8);
+}
+
+/***************************************************/
+
+class C6293 {
+    C6293 token;
+}
+void f6293(in C6293[] a) pure {
+    auto x0 = a[0].token;
+    assert(x0 is a[0].token.token.token);
+    assert(x0 is (&x0).token);
+    auto p1 = &x0 + 1;
+    assert(x0 is (p1 - 1).token);
+    int c = 0;
+    assert(x0 is a[c].token);
+}
+void test6293() {
+    auto x = new C6293;
+    x.token = x;
+    f6293([x]);
+}
+
+/***************************************************/
+// 3733
+
+class C3733
+{
+    int foo()        { return 1; }
+    int foo() shared { return 2; }
+
+    int bar()        { return foo(); }
+}
+void test3733()
+{
+    auto c = new C3733();
+    assert(c.bar() == 1);
+}
+
+/***************************************************/
+// 4392
+
+class C4392
+{
+    int foo() const { return 1; }
+    int foo()       { return 2; }
+
+    int bar() const { return foo(); }
+}
+void test4392()
+{
+    auto c = new C4392();
+    assert(c.bar() == 1);
+}
+
+/***************************************************/
+// 6220
+
+void test6220() {
+    struct Foobar { real x; real y; real z;};
+    switch("x") {
+        foreach(i,member; __traits(allMembers, Foobar)) {
+            case member : break;
+        }
+    default : break;
+    }
+}
+
+/***************************************************/
+// 5799
+
+void test5799()
+{
+    int a;
+    int *u = &(a ? a : (a ? a : a));
+    assert(u == &a);
+}
+
+/***************************************************/
+// 6529
+
+enum Foo6529 : char { A='a' }
+ref const(Foo6529) func6529(const(Foo6529)[] arr){ return arr[0]; }
+
+/***************************************************/
+
+void test783()
+{
+    const arr = [ 1,2,3 ];
+    const i = 2;
+    auto jhk = new int[arr[i]]; // "need size of rightmost array, not type arr[i]"
+}
+
+/***************************************************/
+
+template X157(alias x)
+{
+    alias x X157;
+}
+
+template Parent(alias foo)
+{
+    alias X157!(__traits(parent, foo)) Parent;
+}
+
+template ParameterTypeTuple(alias foo)
+{
+    static if (is(typeof(foo) P == function))
+        alias P ParameterTypeTuple;
+    else
+        static assert(0, "argument has no parameters");
+}
+
+template Mfp(alias foo)
+{
+    auto Mfp = function(Parent!foo self, ParameterTypeTuple!foo i) { return self.foo(i); };
+}
+
+class C157 {
+ int a = 3;
+ int foo(int i, int y) { return i + a + y; }
+}
+
+void test157()
+{
+    auto c = new C157();
+    auto mfp = Mfp!(C157.foo);
+    auto i = mfp(c, 1, 7);
+    assert(i == 11);
+}
+
+/***************************************************/
+// 6473
+
+struct Eins6473
+{
+    ~this() {}
+}
+
+struct Zwei6473
+{
+    void build(Eins6473 devices = Eins6473())
+    {
+    }
+}
+
+void build(Eins6473 devices = Eins6473())
+{}
+
+void test6473()
+{
+    void build(Eins6473 devices = Eins6473())
+    {}
+}
+
+/***************************************************/
+
+uint rol11417(uint n)(in uint x)
+{
+    return x << n | x >> 32 - n;
+}
+
+uint ror11417(uint n)(in uint x)
+{
+    return x >> n | x << 32 - n;
+}
+
+void test11417()
+{
+    assert(rol11417!1(0x8000_0000) == 0x1);
+    assert(ror11417!1(0x1) == 0x8000_0000);
+}
+
+/***************************************************/
+
+void test6578()
+{
+    static struct Foo
+    {
+        this(int x) pure {}
+    }
+    auto f1 = new const(Foo)(1);
+    auto f2 = new immutable(Foo)(1);
+    auto f3 = new shared(Foo)(1);
+    auto f4 = const(Foo)(1);
+    auto f5 = immutable(Foo)(1);
+    auto f6 = shared(Foo)(1);
+    static assert(is(typeof(f1) == const(Foo)*));
+    static assert(is(typeof(f2) == immutable(Foo)*));
+    static assert(is(typeof(f3) == shared(Foo)*));
+    static assert(is(typeof(f4) == const(Foo)));
+    static assert(is(typeof(f5) == immutable(Foo)));
+    static assert(is(typeof(f6) == shared(Foo)));
+
+    static struct Bar
+    {
+        this(int x) const pure {}
+    }
+    auto g1 = new const(Bar)(1);
+    auto g2 = new immutable(Bar)(1);
+    auto g3 = new shared(Bar)(1);
+    auto g4 = const(Bar)(1);
+    auto g5 = immutable(Bar)(1);
+    auto g6 = shared(Bar)(1);
+    static assert(is(typeof(g1) == const(Bar)*));
+    static assert(is(typeof(g2) == immutable(Bar)*));
+    static assert(is(typeof(g3) == shared(Bar)*));
+    static assert(is(typeof(g4) == const(Bar)));
+    static assert(is(typeof(g5) == immutable(Bar)));
+    static assert(is(typeof(g6) == shared(Bar)));
+
+    static struct Baz
+    {
+        this()(int x) const pure {}
+    }
+    auto h1 = new const(Baz)(1);
+    auto h2 = new immutable(Baz)(1);
+    auto h3 = new shared(const(Baz))(1);
+    auto h4 = const(Baz)(1);
+    auto h5 = immutable(Baz)(1);
+    auto h6 = shared(const(Baz))(1);
+    static assert(is(typeof(h1) == const(Baz)*));
+    static assert(is(typeof(h2) == immutable(Baz)*));
+    static assert(is(typeof(h3) == shared(const(Baz))*));
+    static assert(is(typeof(h4) == const(Baz)));
+    static assert(is(typeof(h5) == immutable(Baz)));
+    static assert(is(typeof(h6) == shared(const(Baz))));
+}
+
+/***************************************************/
+// 6630
+
+void test6630()
+{
+    static class B {}
+
+    static class A
+    {
+        this() { b = new B(); }
+        B b;
+        alias b this;
+    }
+
+    void fun(A a)
+    {
+        a = null;
+        assert(a is null);
+    }
+
+    auto a = new A;
+    assert(a.b !is null);
+    fun(a);
+    assert(a !is null);
+    assert(a.b !is null);
+}
+
+/***************************************************/
+
+int i199 = 1;
+
+void test199()
+{
+    label:
+    {
+        int i199 = 2;
+    }
+    assert(i199 == 1);
+}
+
+/***************************************************/
+// 6690
+
+T useLazy6690(T)(lazy T val)
+{
+    return val;
+    // val is converted to delegate call, but it is typed as int delegate() - not @safe!
+}
+void test6690() @safe
+{
+    useLazy6690(0);
+    // Error: safe function 'test6690' cannot call system function 'useLazy6690'
+}
+
+/***************************************************/
+
+template Hoge6691()
+{
+    immutable static int[int] dict;
+    immutable static int value;
+
+    static this()
+    {
+        dict = [1:1, 2:2];
+        value = 10;
+    }
+}
+alias Hoge6691!() H6691;
+
+/***************************************************/
+
+void test10626()
+{
+    double[2] v, x;
+    struct Y { double u; }
+    double z;
+    Y y;
+    double[2] r = v[] * x[0];
+    //double[2] s = v[] * z++;
+    //double[2] t = v[] * z--;
+    double[2] a = v[] * ++z;
+    double[2] b = v[] * --z;
+    double[2] c = v[] * y.u;
+    double[2] d = v[] * (x[] = 3, x[0]);
+    double[2] e = v[] * (v[] ~ z)[0];
+}
+
+
+/***************************************************/
+// 2953
+
+template Tuple2953(T...)
+{
+    alias T Tuple2953;
+}
+template Range2953(int b)
+{
+    alias Tuple2953!(1) Range2953;
+}
+void foo2953()()
+{
+    Tuple2953!(int, int) args;
+    foreach( x ; Range2953!(args.length) ){ }
+}
+void test2953()
+{
+    foo2953!()();
+}
+
+/***************************************************/
+// 2997
+
+abstract class B2997 { void foo(); }
+interface I2997 { void bar(); }
+abstract class C2997 : B2997, I2997 {}
+//pragma(msg, __traits(allMembers, C).stringof);
+
+void test2997()
+{
+    enum ObjectMembers = ["toString","toHash","opCmp","opEquals","Monitor","factory"];
+
+    static assert([__traits(allMembers, C2997)] == ["foo"] ~ ObjectMembers ~ ["bar"]);
+}
+
+/***************************************************/
+// 6596
+
+extern (C) int function() pfunc6596;
+extern (C) int cfunc6596(){ return 0; }
+static assert(typeof(pfunc6596).stringof == "extern (C) int function()");
+static assert(typeof(cfunc6596).stringof == "extern (C) int()");
+
+
+/***************************************************/
+// 4423
+
+struct S4423
+{
+    this(string phrase, int num)
+    {
+        this.phrase = phrase;
+        this.num = num;
+    }
+
+    int opCmp(const ref S4423 rhs)
+    {
+        if (phrase < rhs.phrase)
+            return -1;
+        else if (phrase > rhs.phrase)
+            return 1;
+
+        if (num < rhs.num)
+            return -1;
+        else if (num > rhs.num)
+            return 1;
+
+        return 0;
+    }
+
+    string phrase;
+    int    num;
+}
+
+enum E4423 : S4423
+{
+    a = S4423("hello", 1),
+    b = S4423("goodbye", 45),
+    c = S4423("world", 22),
+};
+
+void test4423()
+{
+    E4423 e;
+    assert(e.phrase == "hello");
+
+    e = E4423.b;
+    assert(e.phrase == "goodbye");
+}
+
+/***************************************************/
+// 4647
+
+interface Timer
+{
+    final int run() { printf("Timer.run()\n"); fun(); return 1; };
+    int fun();
+}
+
+interface Application
+{
+    final int run() { printf("Application.run()\n"); fun(); return 2; };
+    int fun();
+}
+
+class TimedApp : Timer, Application
+{
+    int funCalls;
+    override int fun()
+    {
+        printf("TimedApp.fun()\n");
+        funCalls++;
+        return 2;
+    }
+}
+
+class SubTimedApp : TimedApp
+{
+    int subFunCalls;
+
+    override int fun()
+    {
+        printf("SubTimedApp.fun()\n");
+        subFunCalls++;
+        return 1;
+    }
+}
+
+void test4647()
+{
+    //Test access to TimedApps base interfaces
+    auto app = new TimedApp();
+    assert((cast(Application)app).run() == 2);
+    assert((cast(Timer)app).run() == 1);
+    assert(app.Timer.run() == 1); // error, no Timer property
+    assert(app.Application.run() == 2); // error, no Application property
+    assert(app.run() == 1);             // This would call Timer.run() if the two calls
+                                        // above were commented out
+    assert(app.funCalls == 5);
+
+    assert(app.TimedApp.fun() == 2);
+    assert(app.funCalls == 6);
+
+    //Test direct access to SubTimedApp interfaces
+    auto app2 = new SubTimedApp();
+    assert((cast(Application)app2).run() == 2);
+    assert((cast(Timer)app2).run() == 1);
+    assert(app2.Application.run() == 2);
+    assert(app2.Timer.run() == 1);
+    assert(app2.funCalls == 0);
+    assert(app2.subFunCalls == 4);
+
+    assert(app2.fun() == 1);
+    assert(app2.SubTimedApp.fun() == 1);
+    assert(app2.funCalls == 0);
+    assert(app2.subFunCalls == 6);
+
+    //Test access to SubTimedApp interfaces via TimedApp
+    auto app3 = new SubTimedApp();
+    (cast(Timer)cast(TimedApp)app3).run();
+    app3.TimedApp.Timer.run();
+    assert((cast(Application)cast(TimedApp)app3).run() == 2);
+    assert((cast(Timer)cast(TimedApp)app3).run() == 1);
+    assert(app3.TimedApp.Application.run() == 2);
+    assert(app3.TimedApp.Timer.run() == 1);
+    assert(app3.funCalls == 0);
+    assert(app3.subFunCalls == 6);
+}
+
+/***************************************************/
+
+template T1064(E...) { alias E T1064; }
+
+int[] var1064 = [ T1064!(T1064!(T1064!(1, 2), T1064!(), T1064!(3)), T1064!(4, T1064!(T1064!(T1064!(T1064!(5)))), T1064!(T1064!(T1064!(T1064!())))),6) ];
+
+void test1064()
+{
+    assert(var1064 == [1,2,3,4,5,6]);
+}
+
+/***************************************************/
+// 5696
+
+template Seq5696(T...){ alias T Seq5696; }
+template Pred5696(T) { alias T Pred5696; }  // TOKtemplate
+template Scope5696(int n){ template X(T) { alias T X; } }   // TOKimport
+T foo5696(T)(T x) { return x; }
+void test5696()
+{
+    foreach (pred; Seq5696!(Pred5696, Pred5696))
+    {
+        static assert(is(pred!int == int));
+    }
+
+    foreach (scop; Seq5696!(Scope5696!0, Scope5696!1))
+    {
+        static assert(is(scop.X!int == int));
+    }
+
+    alias Seq5696!(foo5696, foo5696) funcs;
+    assert(funcs[0](0) == 0);
+    assert(funcs[1](1) == 1);
+    foreach (i, fn; funcs)
+    {
+        assert(fn(i) == i);
+    }
+}
+
+/***************************************************/
+// 5933
+
+int dummyfunc5933();
+alias typeof(dummyfunc5933) FuncType5933;
+
+struct S5933a { auto x() { return 0; } }
+static assert(is(typeof(&S5933a.init.x) == int delegate() pure nothrow @nogc @safe));
+
+struct S5933b { auto x() { return 0; } }
+//static assert(is(typeof(S5933b.init.x) == FuncType5933));
+
+struct S5933c { auto x() { return 0; } }
+static assert(is(typeof(&S5933c.x) == int function()));
+
+struct S5933d { auto x() { return 0; } }
+static assert(is(typeof(S5933d.x) == FuncType5933));
+
+
+class C5933a { auto x() { return 0; } }
+static assert(is(typeof(&(new C5933b()).x) == int delegate()));
+
+class C5933b { auto x() { return 0; } }
+//static assert(is(typeof((new C5933b()).x) == FuncType5933));
+
+class C5933c { auto x() { return 0; } }
+static assert(is(typeof(&C5933c.x) == int function()));
+
+class C5933d { auto x() { return 0; } }
+static assert(is(typeof(C5933d.x) == FuncType5933));
+
+/***************************************************/
+// 6084
+
+template TypeTuple6084(T...){ alias T TypeTuple6084; }
+void test6084()
+{
+    int foo(int x)() { return x; }
+    foreach(i; TypeTuple6084!(0))
+        foo!(i);
+}
+
+/***************************************************/
+// 6763
+
+template TypeTuple6763(TList...)
+{
+    alias TList TypeTuple6763;
+}
+
+alias TypeTuple6763!(int) T6763;
+
+void f6763(      T6763) { } ///
+void c6763(const T6763) { } ///T now is (const int)
+void r6763(ref   T6763) { } ///T now is(ref const int)
+void i6763(in    T6763) { } ///Uncomment to get an Assertion failure in 'mtype.c'
+void o6763(out   T6763) { } ///ditto
+
+void test6763()
+{
+    int n;
+
+    f6763(0);   //With D2: Error: function main.f ((ref const const(int) _param_0)) is not callable using argument types (int)
+    c6763(0);
+    r6763(n);   static assert(!__traits(compiles, r6763(0)));
+    i6763(0);
+    o6763(n);   static assert(!__traits(compiles, o6763(0)));
+
+    // 6755
+    static assert(typeof(f6763).stringof == "void(int _param_0)");
+    static assert(typeof(c6763).stringof == "void(const(int) _param_0)");
+    static assert(typeof(r6763).stringof == "void(ref int _param_0)");
+    static assert(typeof(i6763).stringof == "void(const(int) _param_0)");
+    static assert(typeof(o6763).stringof == "void(out int _param_0)");
+}
+
+/***************************************************/
+// 6695
+
+struct X6695
+{
+    void mfunc()
+    {
+        static assert(is(typeof(this) == X6695));
+    }
+    void cfunc() const
+    {
+        static assert(is(typeof(this) == const(X6695)));
+    }
+    void ifunc() immutable
+    {
+        static assert(is(typeof(this) == immutable(X6695)));
+    }
+    void sfunc() shared
+    {
+        static assert(is(typeof(this) == shared(X6695)));
+    }
+    void scfunc() shared const
+    {
+        static assert(is(typeof(this) == shared(const(X6695))));
+    }
+    void wfunc() inout
+    {
+        static assert(is(typeof(this) == inout(X6695)));
+    }
+    void swfunc() shared inout
+    {
+        static assert(is(typeof(this) == shared(inout(X6695))));
+    }
+
+    static assert(is(typeof(this) == X6695));
+}
+
+/***************************************************/
+// 6087
+
+template True6087(T)
+{
+    immutable True6087 = true;
+}
+struct Foo6087
+{
+    static assert( True6087!(typeof(this)) );
+}
+
+struct Bar6087
+{
+    static assert( is(typeof(this) == Bar6087) );
+}
+
+/***************************************************/
+// 6848
+
+class Foo6848 {}
+
+class Bar6848 : Foo6848
+{
+    void func() immutable
+    {
+        static assert(is(typeof(this) == immutable(Bar6848)));  // immutable(Bar6848)
+        auto t = this;
+        static assert(is(typeof(t) == immutable(Bar6848)));     // immutable(Bar6848)
+
+        static assert(is(typeof(super) == immutable(Foo6848))); // Foo6848 instead of immutable(Foo6848)
+        auto s = super;
+        static assert(is(typeof(s) == immutable(Foo6848)));     // Foo6848 instead of immutable(Foo6848)
+    }
+}
+
+/***************************************************/
+
+version(none)
+{
+    cent issue785;
+    ucent issue785;
+}
+
+static assert(!is(cent) && !is(ucent));
+static assert(!__traits(compiles, { cent x; }));
+
+/***************************************************/
+// 6847
+
+template True6847(T)
+{
+    immutable True6847 = true;
+}
+class Foo6847
+{}
+
+class Bar6847 : Foo6847
+{
+    static assert( True6847!(typeof(super)) );
+    static assert( is(typeof(super) == Foo6847) );
+}
+
+/***************************************************/
+// http://d.puremagic.com/issues/show_bug.cgi?id=6488
+
+struct TickDuration
+{
+    template to(T) if (__traits(isIntegral,T))
+    {
+        const T to()
+        {
+            return 1;
+        }
+    }
+
+    template to(T) if (__traits(isFloating,T))
+    {
+        const T to()
+        {
+            return 0;
+        }
+    }
+
+    const long seconds()
+    {
+        return to!(long)();
+    }
+
+}
+
+void test6488()
+{
+    TickDuration d;
+    d.seconds();
+}
+
+/***************************************************/
+// 6565
+
+void foo6565(out int[2][2] m) {}
+
+void test6565()
+{
+    int[2][2] mat = [[1, 2], [3, 4]];
+    foo6565(mat);
+    assert(mat == [[0, 0], [0, 0]]);
+}
+
+/***************************************************/
+// 6836
+
+template map6836(fun...) if (fun.length >= 1)
+{
+    auto map6836(Range)(Range r)
+    {
+    }
+}
+void test6836()
+{
+    [1].map6836!"a"();
+}
+
+/***************************************************/
+
+string func12864() { return ['a', 'b', 'c']; }
+
+void test12864(string s)
+{
+    switch (s)
+    {
+    case func12864():
+        break;
+
+    default:
+        break;
+    }
+}
+
+/***************************************************/
+
+void test5448()
+{
+    int[int][] aaa = [[1: 2]];
+    int[string][] a2 = [["cc":0], ["DD":10]];
+}
+
+/***************************************************/
+// 6837
+
+struct Ref6837a(T)
+{
+    T storage;
+    alias storage this;
+}
+
+struct Ref6837b(T)
+{
+    T storage;
+    @property ref T get(){ return storage; }
+    alias get this;
+}
+
+int front6837(int[] arr){ return arr[0]; }
+
+void popFront6837(ref int[] arr){ arr = arr[1..$]; }
+
+void test6837()
+{
+    assert([1,2,3].front6837 == 1);
+
+    auto r1 = Ref6837a!(int[])([1,2,3]);
+    assert(r1.front6837() == 1);    // ng
+    assert(r1.front6837 == 1);      // ok
+    r1.popFront6837();              // ng
+    r1.storage.popFront6837();      // ok
+
+    auto r2 = Ref6837b!(int[])([1,2,3]);
+    assert(r2.front6837() == 1);    // ng
+    assert(r2.front6837 == 1);      // ok
+    r2.popFront6837();              // ng
+    r2.get.popFront6837();          // ng
+    r2.get().popFront6837();        // ok
+}
+
+/***************************************************/
+// 6927
+
+@property int[] foo6927()
+{
+    return [1, 2];
+}
+int[] bar6927(int[] a)
+{
+    return a;
+}
+void test6927()
+{
+    bar6927(foo6927); // OK
+    foo6927.bar6927(); // line 9, Error
+}
+
+/***************************************************/
+
+struct Foo6813(T)
+{
+    Foo6813 Bar()
+    {
+        return Foo6813(_indices.abc());
+    }
+
+    T _indices;
+}
+
+struct SortedRange(alias pred)
+{
+    SortedRange abc()
+    {
+        return SortedRange();
+    }
+}
+
+void test6813() {
+    auto ind = SortedRange!({ })();
+    auto a = Foo6813!(typeof(ind))();
+}
+
+/***************************************************/
+
+struct Interval6753{ int a,b; }
+@safe struct S6753
+{
+    int[] arr;
+    @trusted @property auto byInterval() const
+    {
+        return cast(const(Interval6753)[])arr;
+    }
+}
+
+/***************************************************/
+// 6859
+
+class Parent6859
+{
+public:
+    bool isHage() const @property;
+
+public:
+    abstract void fuga()
+    out
+    {
+        assert(isHage);
+    }
+    body { }
+}
+
+class Child6859 : Parent6859
+{
+    override bool isHage() const @property
+    {
+        return true;
+    }
+    override void fuga()
+    {
+        //nop
+    }
+}
+
+void test6859()
+{
+    auto t = new Child6859;
+    t.fuga();
+    printf("done.\n");
+}
+
+/***************************************************/
+// 6910
+
+template Test6910(alias i, B)
+{
+    void fn()
+    {
+        foreach(t; B.Types)
+        {
+            switch(i)
+            {
+                case 0://IndexOf!(t, B.Types):
+                {
+                    pragma(msg, __traits(allMembers, t));
+                    pragma(msg, __traits(hasMember, t, "m"));
+                    static assert(__traits(hasMember, t, "m")); // test
+                    break;
+                }
+                default: {}
+            }
+        }
+    }
+}
+void test6910()
+{
+    static struct Bag(S...)
+    {
+        alias S Types;
+    }
+    static struct A
+    {
+        int m;
+    }
+
+    int i;
+    alias Test6910!(i, Bag!(A)).fn func;
+}
+
+/***************************************************/
+
+void fun12503()
+{
+    string b = "abc";
+    try
+    {
+        try
+        {
+            b = null;
+            return;
+        }
+        catch
+        {
+        }
+    }
+    finally
+    {
+        assert("abc" !is b);
+    }
+}
+
+void test12503()
+{
+    fun12503();
+}
+
+/***************************************************/
+// 6902
+
+void test6902()
+{
+    static assert(is(typeof({
+        return int.init; // int, long, real, etc.
+    })));
+
+    int f() pure nothrow { assert(0); }
+    alias int T() pure nothrow @safe @nogc;
+    static if(is(typeof(&f) DT == delegate))
+    {
+        static assert(is(DT* == T*));  // ok
+
+        // Error: static assert  (is(pure nothrow int() == pure nothrow int())) is false
+        static assert(is(DT == T));
+    }
+}
+
+/***************************************************/
+// 6330
+
+struct S6330
+{
+    void opAssign(S6330 s) @disable
+    {
+        assert(0);  // This fails.
+    }
+}
+
+void test6330()
+{
+    S6330 s;
+    S6330 s2;
+    static assert(!is(typeof({ s2 = s; })));
+}
+
+/***************************************************/
+
+struct S8269
+{
+    bool dtor = false;
+    ~this()
+    {
+        dtor = true;
+    }
+}
+
+void test8269()
+{
+    with(S8269())
+    {
+        assert(!dtor);
+    }
+}
+
+/***************************************************/
+// 5311
+
+class C5311
+{
+    private static int globalData;
+
+    void breaksPure() pure const
+    {
+        static assert(!__traits(compiles, { globalData++; }));      // SHOULD BE ERROR
+        static assert(!__traits(compiles, { C5311.globalData++; }));// SHOULD BE ERROR
+        static assert(!__traits(compiles, { this.globalData++; })); // SHOULD BE ERROR
+
+        static assert(!__traits(compiles, { int a = this.globalData; }));
+    }
+}
+static void breaksPure5311a(C5311 x) pure
+{
+    static assert(!__traits(compiles, { x.globalData++; }));        // SHOULD BE ERROR
+
+    static assert(!__traits(compiles, { int a = x.globalData; }));
+}
+
+struct S5311
+{
+    private static int globalData;
+
+    void breaksPure() pure const
+    {
+        static assert(!__traits(compiles, { globalData++; }));      // SHOULD BE ERROR
+        static assert(!__traits(compiles, { S5311.globalData++; }));// SHOULD BE ERROR
+        static assert(!__traits(compiles, { this.globalData++; })); // SHOULD BE ERROR
+
+        static assert(!__traits(compiles, { int a = this.globalData; }));
+    }
+}
+static void breaksPure5311b(S5311 x) pure
+{
+    static assert(!__traits(compiles, { x.globalData++; }));        // SHOULD BE ERROR
+
+    static assert(!__traits(compiles, { int a = x.globalData; }));
+}
+
+/***************************************************/
+// 6868
+
+@property bool empty6868(T)(in T[] a) @safe pure nothrow
+{
+    return !a.length;
+}
+
+void test6868()
+{
+    alias int[] Range;
+    static if (is(char[1 + Range.empty6868]))  // Line 9
+        enum bool isInfinite = true;
+
+    char[0] s;  // need
+}
+
+/***************************************************/
+// 2856
+
+struct foo2856    { static void opIndex(int i) { printf("foo\n"); } }
+struct bar2856(T) { static void opIndex(int i) { printf("bar\n"); } }
+
+void test2856()
+{
+    foo2856[1];
+    bar2856!(float)[1];     // Error (# = __LINE__)
+    alias bar2856!(float) B;
+    B[1];                   // Okay
+}
+
+/***************************************************/
+
+void test13947()
+{
+    struct S {}
+    static assert(S.sizeof == 1);
+
+    S a;
+    S b;
+    *cast(ubyte*)&a = 1;
+    *cast(ubyte*)&b = 2;
+    assert(a == b);
+    assert(a is b);
+    assert(!(a != b));
+    assert(!(a !is b));
+    static assert(S() == S());
+    static assert(S() is S());
+    static assert(!(S() != S()));
+    static assert(!(S() !is S()));
+}
+
+/***************************************************/
+// 3091
+
+void test3091(inout int = 0)
+{
+    struct Foo {}
+
+    auto  pm = new Foo;                 static assert(is( typeof( pm) ==              Foo  * ));
+    auto  pc = new const Foo;           static assert(is( typeof( pc) ==        const(Foo) * ));
+    auto  pw = new inout Foo;           static assert(is( typeof( pw) ==        inout(Foo) * ));
+    auto psm = new shared Foo;          static assert(is( typeof(psm) ==       shared(Foo) * ));
+    auto psc = new shared const Foo;    static assert(is( typeof(psc) == shared(const(Foo))* ));
+    auto psw = new shared inout Foo;    static assert(is( typeof(psw) == shared(inout(Foo))* ));
+    auto  pi = new immutable Foo;       static assert(is( typeof( pi) ==    immutable(Foo) * ));
+
+    auto  m = Foo();                    static assert(is( typeof( m) ==              Foo   ));
+    auto  c = const Foo();              static assert(is( typeof( c) ==        const(Foo)  ));
+    auto  w = inout Foo();              static assert(is( typeof( w) ==        inout(Foo)  ));
+    auto sm = shared Foo();             static assert(is( typeof(sm) ==       shared(Foo)  ));
+    auto sc = shared const Foo();       static assert(is( typeof(sc) == shared(const(Foo)) ));
+    auto sw = shared inout Foo();       static assert(is( typeof(sw) == shared(inout(Foo)) ));
+    auto  i = immutable Foo();          static assert(is( typeof( i) ==    immutable(Foo)  ));
+}
+
+/***************************************************/
+// 6837
+
+template Id6837(T)
+{
+    alias T Id6837;
+}
+static assert(is(Id6837!(shared const int) == shared const int));
+static assert(is(Id6837!(shared inout int) == shared inout int));
+
+/***************************************************/
+// 6056 fixup
+
+template ParameterTypeTuple6056(func)
+{
+    static if (is(func Fptr : Fptr*) && is(Fptr P == function))
+        alias P ParameterTypeTuple6056;
+    else
+        static assert(0, "argument has no parameters");
+}
+
+extern(C) alias void function() fpw_t;
+
+alias void function(fpw_t fp) cb_t;
+
+void bar6056(ParameterTypeTuple6056!(cb_t) args) {
+      pragma (msg, "TFunction1: " ~ typeof(args[0]).stringof);
+}
+
+extern(C) void foo6056() { }
+
+void test6056()
+{
+    bar6056(&foo6056);
+}
+
+/***************************************************/
+// 6356
+
+int f6356()(int a)
+{
+    return a*a;
+}
+
+alias f6356!() g6356;     // comment this out to eliminate the errors
+
+pure nothrow @safe int i6356()
+{
+    return f6356(1);
+}
+
+void test6356()
+{
+    assert(i6356() == 1);
+}
+
+/***************************************************/
+// 7108
+
+static assert(!__traits(hasMember, int, "x"));
+static assert( __traits(hasMember, int, "init"));
+
+/***************************************************/
+// 7073
+
+void test7073()
+{
+    string f(int[] arr...)
+    {
+        return "";
+    }
+}
+
+/***************************************************/
+// 7104
+
+void test7104()
+{
+    typeof(new class {}) c;
+    c = new typeof(c);
+}
+
+/***************************************************/
+// 7150
+
+struct A7150
+{
+    static int cnt;
+
+    this(T)(T thing, int i)
+    {
+        this(thing, i > 0); // Error: constructor call must be in a constructor
+        ++cnt;
+    }
+    this(T)(T thing, bool b)
+    {
+        ++cnt;
+    }
+}
+
+void test7150()
+{
+    auto a = A7150(5, 5); // Error: template instance constructtest.A.__ctor!(int) error instantiating
+    assert(A7150.cnt == 2);
+}
+
+/***************************************************/
+// 7159
+
+alias void delegate()  Void7159;
+
+class HomeController7159 {
+    Void7159 foo() {
+        return cast(Void7159)&HomeController7159.displayDefault;
+    }
+    auto displayDefault() {
+        return 1;
+    }
+}
+
+/***************************************************/
+// 7160
+
+class HomeController {
+    static if (false) {
+        mixin(q{ int a; });
+    }
+    void foo() {
+        foreach (m; __traits(derivedMembers, HomeController)) {
+        }
+    }
+}
+
+void test7160()
+{}
+
+/***************************************************/
+// 7168
+
+void test7168()
+{
+    static class X
+    {
+        void foo(){}
+    }
+    static class Y : X
+    {
+        void bar(){}
+    }
+
+    enum ObjectMembers = ["toString","toHash","opCmp","opEquals","Monitor","factory"];
+
+    static assert([__traits(allMembers, X)] == ["foo"]~ObjectMembers);          // pass
+    static assert([__traits(allMembers, Y)] == ["bar", "foo"]~ObjectMembers);   // fail
+    static assert([__traits(allMembers, Y)] != ["bar", "foo"]);                 // fail
+}
+
+/***************************************************/
+// 7170
+
+T to7170(T)(string x) { return 1; }
+void test7170()
+{
+//  auto i = to7170!int("1");   // OK
+    auto j = "1".to7170!int();  // NG, Internal error: e2ir.c 683
+}
+
+/***************************************************/
+// 7196
+
+auto foo7196(int x){return x;}
+auto foo7196(double x){return x;}
+
+void test7196()
+{
+    auto x = (&foo7196)(1);   // ok
+    auto y = (&foo7196)(1.0); // fail
+}
+
+/***************************************************/
+// 7285
+
+int[2] spam7285()
+{
+    int[2] ab;
+    if (true)
+        return (true) ? ab : [0, 0]; // Error
+    else
+        return (true) ? [0, 0] : ab; // OK
+}
+
+void test7285()
+{
+    auto sa = spam7285();
+}
+
+/***************************************************/
+// 14737
+
+void test14737()
+{
+    // compile-time
+    enum string[2] a1 = ["d", "e"];
+    enum b1x = ["a", "b", "c"] ~ a1;        // Tarray vs Tsarray
+    enum b1y = a1 ~ ["a", "b", "c"];        // Tsarray vs Tarray
+    static assert(is(typeof(b1x) == string[]));
+    static assert(is(typeof(b1y) == string[]));
+    static assert(b1x == ["a", "b", "c", "d", "e"]);
+    static assert(b1y == ["d", "e", "a", "b", "c"]);
+
+    // runtime
+    string[2] a2 = ["d", "e"];
+    auto b2x = ["a", "b", "c"] ~ a2;        // Tarray vs Tsarray
+    auto b2y = a2 ~ ["a", "b", "c"];        // Tsarray vs Tarray
+    static assert(is(typeof(b2x) == string[]));
+    static assert(is(typeof(b2y) == string[]));
+    assert(b2x == ["a", "b", "c", "d", "e"]);
+    assert(b2y == ["d", "e", "a", "b", "c"]);
+}
+
+/***************************************************/
+// 7321
+
+void test7321()
+{
+    static assert(is(typeof((){})==void function()pure nothrow @nogc @safe));         // ok
+    static assert(is(typeof((){return;})==void function()pure nothrow @nogc @safe));  // fail
+}
+
+/***************************************************/
+
+class A158
+{
+    pure void foo1() { }
+    const void foo2() { }
+    nothrow void foo3() { }
+    @safe void foo4() { }
+}
+
+class B158 : A158
+{
+    override void foo1() { }
+    override void foo2() const { }
+    override void foo3() { }
+    override void foo4() { }
+}
+
+/***************************************************/
+// 9231
+
+class B9231 { void foo() inout pure {} }
+class D9231 : B9231 { override void foo() inout {} }
+
+/***************************************************/
+// 3282
+
+class Base3282
+{
+    string f()
+    {
+        return "Base.f()";
+    }
+}
+class Derived3282 : Base3282
+{
+    override string f()
+    {
+        return "Derived.f()";
+    }
+  /*override*/ string f() const
+    {
+        return "Derived.f() const";
+    }
+}
+
+void test3282()
+{
+    auto x = new Base3282;
+    assert(x.f() == "Base.f()");
+    auto y = new Derived3282;
+    assert(y.f() == "Derived.f()");// calls "Derived.f() const", but it is expected that be called non-const.
+    auto z = new const(Derived3282);
+    assert(z.f() == "Derived.f() const");
+}
+
+/***************************************************/
+// 7534
+
+class C7534
+{
+    int foo(){ return 1; }
+}
+class D7534 : C7534
+{
+    override int foo(){ return 2; }
+  /*override*/ int foo() const { return 3; }
+    // Error: D.foo multiple overrides of same function
+}
+void test7534()
+{
+    C7534 mc = new C7534();
+    assert(mc.foo() == 1);
+
+    D7534 md = new D7534();
+    assert(md.foo() == 2);
+    mc = md;
+    assert(mc.foo() == 2);
+
+    const(D7534) cd = new const(D7534)();
+    assert(cd.foo() == 3);
+    md = cast()cd;
+    assert(md.foo() == 2);
+}
+
+/***************************************************/
+// 7534 + return type covariance
+
+class X7534 {}
+class Y7534 : X7534
+{
+    int value; this(int n){ value = n; }
+}
+
+class V7534
+{
+    X7534 foo(){ return new X7534(); }
+}
+class W7534 : V7534
+{
+    override Y7534 foo(){ return new Y7534(1); }
+  /*override*/ Y7534 foo() const { return new Y7534(2); }
+}
+
+void test7534cov()
+{
+    auto mv = new V7534();
+    assert(typeid(mv.foo()) == typeid(X7534));
+
+    auto mw = new W7534();
+    assert(typeid(mw.foo()) == typeid(Y7534));
+    assert(mw.foo().value == 1);
+    mv = mw;
+    assert(typeid(mv.foo()) == typeid(Y7534));
+    assert((cast(Y7534)mv.foo()).value == 1);
+
+    auto cw = new const(W7534)();
+    assert(typeid(cw.foo()) == typeid(Y7534));
+    assert(cw.foo().value == 2);
+}
+
+/***************************************************/
+// 7562
+
+static struct MyInt
+{
+    private int value;
+    mixin ProxyOf!value;
+}
+mixin template ProxyOf(alias a)
+{
+    template X1(){}
+    template X2(){}
+    template X3(){}
+    template X4(){}
+    template X5(){}
+    template X6(){}
+    template X7(){}
+    template X8(){}
+    template X9(){}
+    template X10(){}
+
+    void test1(this X)(){}
+    void test2(this Y)(){}
+}
+
+/***************************************************/
+
+import core.stdc.stdlib;
+
+void test13427(void* buffer = alloca(100))
+{
+}
+
+/***************************************************/
+// 7583
+
+template Tup7583(E...) { alias E Tup7583; }
+
+struct S7583
+{
+    Tup7583!(float, char) field;
+    alias field this;
+    this(int x) {    }
+}
+
+int bug7583() {
+    S7583[] arr;
+    arr ~= S7583(0);
+    return 1;
+}
+
+static assert (bug7583());
+
+/***************************************************/
+// 7618
+
+void test7618(const int x = 1)
+{
+    int func(ref int x) { return 1; }
+    static assert(!__traits(compiles, func(x)));
+    // Error: function test.foo.func (ref int _param_0) is not callable using argument types (const(int))
+
+    int delegate(ref int) dg = (ref int x) => 1;
+    static assert(!__traits(compiles, dg(x)));
+    // --> no error, bad!
+
+    int function(ref int) fp = (ref int x) => 1;
+    static assert(!__traits(compiles, fp(x)));
+    // --> no error, bad!
+}
+
+/***************************************************/
+// 7621
+
+void test7621()
+{
+    enum uint N = 4u;
+    char[] A = "hello".dup;
+    uint[immutable char[4u]] dict;
+    dict[*cast(immutable char[4]*)(A[0 .. N].ptr)] = 0; // OK
+    dict[*cast(immutable char[N]*)(A[0 .. N].ptr)] = 0; // line 6, error
+}
+
+/***************************************************/
+// 7682
+
+template ConstOf7682(T)
+{
+    alias const(T) ConstOf7682;
+}
+bool pointsTo7682(S)(ref const S source) @trusted pure nothrow
+{
+    return true;
+}
+void test7682()
+{
+    shared(ConstOf7682!(int[])) x;  // line A
+
+    struct S3 { int[10] a; }
+    shared(S3) sh3;
+    shared(int[]) sh3sub = sh3.a[];
+    assert(pointsTo7682(sh3sub));   // line B
+}
+
+/***************************************************/
+// 7735
+
+void a7735(void[][] data...)
+{
+    //writeln(data);
+    assert(data.length == 1);
+    b7735(data);
+}
+
+void b7735(void[][] data...)
+{
+    //writeln(data);
+    assert(data.length == 1);
+    c7735(data);
+}
+
+void c7735(void[][] data...)
+{
+    //writeln(data);
+    assert(data.length == 1);
+}
+
+void test7735()
+{
+    a7735([]);
+    a7735([]);
+}
+
+/***************************************************/
+
+struct A7823 {
+    long a;
+    enum A7823 b = {0};
+}
+
+void test7823(A7823 a = A7823.b) { }
+
+/***************************************************/
+// 7871
+
+struct Tuple7871
+{
+    string field;
+    alias field this;
+}
+
+//auto findSplitBefore(R1)(R1 haystack)
+auto findSplitBefore7871(string haystack)
+{
+    return Tuple7871(haystack);
+}
+
+void test7871()
+{
+    string line = `<bookmark href="https://stuff">`;
+    auto a = findSplitBefore7871(line[0 .. $])[0];
+}
+
+/***************************************************/
+// 7906
+
+void test7906()
+{
+    static assert(!__traits(compiles, { enum s = [string.min]; }));
+}
+
+/***************************************************/
+// 7907
+
+template Id7907(E)
+{
+    alias E Id7907;
+}
+template Id7907(alias E)
+{
+    alias E Id7907;
+}
+
+void test7907()
+{
+    static assert(!__traits(compiles, { alias Id7907!([string.min]) X; }));
+}
+
+/***************************************************/
+// 1175
+
+class A1175
+{
+    class I1 { }
+}
+
+class B1175 : A1175
+{
+    class I2 : I1 { }
+
+    I1 getI() { return new I2; }
+}
+
+/***************************************************/
+// 7983
+
+class A7983 {
+        void f() {
+                g7983(this);
+        }
+        unittest {
+        }
+}
+
+void g7983(T)(T a)
+{
+        foreach (name; __traits(allMembers, T)) {
+                pragma(msg, name);
+                static if (__traits(compiles, &__traits(getMember, a, name)))
+                {
+                }
+        }
+}
+
+/***************************************************/
+// 8004
+
+void test8004()
+{
+    auto n = (int n = 10){ return n; }();
+    assert(n == 10);
+}
+
+/***************************************************/
+// 8064
+
+void test8064()
+{
+    uint[5] arry;
+    ref uint acc(size_t i) {
+        return arry[i];
+    }
+    auto arryacc = &acc;
+    arryacc(3) = 5; // same error
+}
+
+/***************************************************/
+// 8220
+
+void foo8220(int){}
+static assert(!__traits(compiles, foo8220(typeof(0)))); // fail
+
+/***************************************************/
+
+void func8105(in ref int x) { }
+
+void test8105()
+{
+}
+
+/***************************************************/
+
+template ParameterTypeTuple159(alias foo)
+{
+    static if (is(typeof(foo) P == __parameters))
+        alias P ParameterTypeTuple159;
+    else
+        static assert(0, "argument has no parameters");
+}
+
+int func159(int i, long j = 7) { return 3; }
+
+alias ParameterTypeTuple159!func159 PT;
+
+int bar159(PT) { return 4; }
+
+pragma(msg, typeof(bar159));
+pragma(msg, PT[1]);
+
+PT[1] boo159(PT[1..2] a) { return a[0]; }
+
+void test159()
+{
+    assert(bar159(1) == 4);
+    assert(boo159() == 7);
+}
+
+/***************************************************/
+// 8283
+
+struct Foo8283 {
+    this(long) { }
+}
+
+struct FooContainer {
+    Foo8283 value;
+}
+
+auto get8283() {
+    union Buf { FooContainer result; }
+    Buf buf = {};
+    return buf.result;
+}
+
+void test8283() {
+    auto a = get8283();
+}
+
+
+/***************************************************/
+// 8395
+
+struct S8395
+{
+    int v;
+    this(T : long)(T x) { v = x * 2; }
+}
+void test8395()
+{
+    S8395 ms = 6;
+    assert(ms.v == 12);
+    const S8395 cs = 7;
+    assert(cs.v == 14);
+}
+
+/***************************************************/
+// 5749
+
+void test5749()
+{
+    static struct A
+    {
+        A foo(int x, int i)
+        {
+            //printf("this = %p, %d: i=%d\n", &this, x, i);
+            assert(i == x);
+            return this;
+        }
+        A bar(int x, ref int i)
+        {
+            //printf("this = %p, %d: i=%d\n", &this, x, i);
+            assert(i == x);
+            return this;
+        }
+    }
+
+    static     int inc1(ref int i) { return ++i; }
+    static ref int inc2(ref int i) { return ++i; }
+
+    int i;
+    A a;
+    //printf("&a = %p\n", &a);
+
+    i = 0;  a.foo(1, ++i).foo(2, ++i);          // OK <-- 2 1
+    i = 0;  a.bar(1, ++i).bar(2, ++i);          // OK <-- 2 2
+    i = 0;  a.foo(1, inc1(i)).foo(2, inc1(i));  // OK <-- 2 1
+    i = 0;  a.bar(1, inc2(i)).bar(2, inc2(i));  // OK <-- 2 2
+    //printf("\n");
+
+    A getVal() { static A a; return a; }
+    i = 0;  getVal().foo(1, ++i).foo(2, ++i);           // OK <-- 2 1
+    i = 0;  getVal().bar(1, ++i).bar(2, ++i);           // OK <-- 2 2
+    i = 0;  getVal().foo(1, inc1(i)).foo(2, inc1(i));   // OK <-- 2 1
+    i = 0;  getVal().bar(1, inc2(i)).bar(2, inc2(i));   // OK <-- 2 2
+    //printf("\n");
+
+    ref A getRef() { static A a; return a; }
+    i = 0;  getRef().foo(1, ++i).foo(2, ++i);           // OK <-- 2 1
+    i = 0;  getRef().bar(1, ++i).bar(2, ++i);           // OK <-- 2 2
+    i = 0;  getRef().foo(1, inc1(i)).foo(2, inc1(i));   // OK <-- 2 1
+    i = 0;  getRef().bar(1, inc2(i)).bar(2, inc2(i));   // OK <-- 2 2
+}
+
+/***************************************************/
+// 8396
+
+void test8396()
+{
+    static int g;
+
+    static extern(C) int bar(int a, int b)
+    {
+        //printf("a = %d, b = %d\n", a, b);
+        assert(b - a == 1);
+        return ++g;
+    }
+    static auto getFunc(int n)
+    {
+        assert(++g == n);
+        return &bar;
+    }
+
+    static struct Tuple { int _a, _b; }
+    static Tuple foo(int n)
+    {
+        assert(++g == n);
+        return Tuple(1, 2);
+    }
+
+    g = 0;
+    assert(bar(foo(1).tupleof) == 2);
+
+    g = 0;
+    assert(getFunc(1)(foo(2).tupleof) == 3);
+}
+
+/***************************************************/
+
+enum E160 : ubyte { jan = 1 }
+
+struct D160
+{
+    short _year  = 1;
+    E160 _month = E160.jan;
+    ubyte _day   = 1;
+
+    this(int year, int month, int day) pure
+    {
+        _year  = cast(short)year;
+        _month = cast(E160)month;
+        _day   = cast(ubyte)day;
+    }
+}
+
+struct T160
+{
+    ubyte _hour;
+    ubyte _minute;
+    ubyte _second;
+
+    this(int hour, int minute, int second = 0) pure
+    {
+        _hour   = cast(ubyte)hour;
+        _minute = cast(ubyte)minute;
+        _second = cast(ubyte)second;
+    }
+}
+
+struct DT160
+{
+    D160 _date;
+    T160 _tod;
+
+    this(int year, int month, int day,
+         int hour = 0, int minute = 0, int second = 0) pure
+    {
+        _date = D160(year, month, day);
+        _tod = T160(hour, minute, second);
+    }
+}
+
+void foo160(DT160 dateTime)
+{
+    printf("test7 year %d, day %d\n", dateTime._date._year, dateTime._date._day);
+    assert(dateTime._date._year == 1999);
+    assert(dateTime._date._day == 6);
+}
+
+void test160()
+{
+    auto dateTime = DT160(1999, 7, 6, 12, 30, 33);
+    printf("test5 year %d, day %d\n", dateTime._date._year, dateTime._date._day);
+    assert(dateTime._date._year == 1999);
+    assert(dateTime._date._day == 6);
+    foo160(DT160(1999, 7, 6, 12, 30, 33));
+}
+
+/***************************************************/
+// 8437
+
+class Cgi8437
+{
+    struct PostParserState {
+        UploadedFile piece;
+    }
+
+    static struct UploadedFile {
+        string contentFilename;
+    }
+}
+
+/***************************************************/
+// 8665
+
+auto foo8665a(bool val)
+{
+    if (val)
+        return 42;
+    else
+        return 1.5;
+}
+auto foo8665b(bool val)
+{
+    if (!val)
+        return 1.5;
+    else
+        return 42;
+}
+
+void test8665()
+{
+    static assert(is(typeof(foo8665a(true))  == double));
+    static assert(is(typeof(foo8665b(false)) == double));
+    assert(foo8665a(true) == 42); // assertion failure
+    assert(foo8665b(true) == 42); // assertion failure
+    assert(foo8665a(false) == 1.5);
+    assert(foo8665b(false) == 1.5);
+
+    static assert(foo8665a(true) == 42);
+    static assert(foo8665b(true) == 42);
+    static assert(foo8665a(false) == 1.5);
+    static assert(foo8665b(false) == 1.5);
+}
+
+/***************************************************/
+
+int foo8108(int, int);
+
+int foo8108(int a, int b)
+{
+    return a + b;
+}
+
+void test8108()
+{
+    foo8108(1,2);
+}
+
+/***************************************************/
+// 8360
+
+struct Foo8360
+{
+    int value = 0;
+    int check = 1337;
+
+    this(int value)
+    {
+        assert(0);
+        this.value = value;
+    }
+
+    ~this()
+    {
+        assert(0);
+        assert(check == 1337);
+    }
+
+    string str()
+    {
+        assert(0);
+        return "Foo";
+    }
+}
+
+Foo8360 makeFoo8360()
+{
+    assert(0);
+    return Foo8360(2);
+}
+
+void test8360()
+{
+    size_t length = 0;
+
+    // The message part 'makeFoo().str()' should not be evaluated at all.
+    assert(length < 5, makeFoo8360().str());
+}
+
+/***************************************************/
+// 8361
+
+struct Foo8361
+{
+    string bar = "hello";
+    ~this() {}
+}
+
+void test8361()
+{
+    assert(true, Foo8361().bar);
+}
+
+/***************************************************/
+// 6141 + 8526
+
+void test6141()
+{
+    static void takeADelegate(void delegate()) {}
+    auto items = new int[1];
+    items[0] = 17;
+    foreach (ref item; items)
+    {
+        // both asserts fail
+        assert(item == 17);
+        assert(&item == items.ptr);
+
+        takeADelegate({ auto x = &item; });
+    }
+
+    foreach(ref val; [3])
+    {
+        auto dg = { int j = val; };
+        assert(&val != null); // Assertion failure
+        assert(val == 3);
+    }
+
+    static void f(lazy int) {}
+    int i = 0;
+    auto dg = { int j = i; };
+    foreach(ref val; [3])
+    {
+        f(val);
+        assert(&val != null); // Assertion failure
+        assert(val == 3);
+    }
+}
+
+void test8526()
+{
+    static void call(void delegate() dg) { dg(); }
+
+    foreach (i, j; [0])
+    {
+        call({
+            assert(i == 0); // fails, i is corrupted
+        });
+    }
+
+    foreach (n; 0..1)
+    {
+        call({
+            assert(n == 0); // fails, n is corrupted
+        });
+    }
+}
+
+/***************************************************/
+
+template ParameterTuple(alias func)
+{
+    static if(is(typeof(func) P == __parameters))
+        alias P ParameterTuple;
+    else
+        static assert(0);
+}
+
+int foo161(ref float y);
+
+void test161()
+{
+    alias PT = ParameterTuple!foo161;
+    auto x = __traits(identifier, PT);
+    assert(x == "y");
+}
+
+/***************************************************/
+// 7175
+
+void test7175()
+{
+    struct S { ubyte[0] arr; }
+    S s;
+    assert(s.arr.ptr !is null);
+    assert(cast(void*)s.arr.ptr is cast(void*)&s);
+}
+
+/***************************************************/
+// 8819
+
+void test8819()
+{
+    void[1] sa1 = (void[1]).init;
+    assert((cast(ubyte*)sa1.ptr)[0] == 0);
+
+    void[4] sa4 = [cast(ubyte)1,cast(ubyte)2,cast(ubyte)3,cast(ubyte)4];
+    assert((cast(ubyte*)sa4.ptr)[0] == 1);
+    assert((cast(ubyte*)sa4.ptr)[1] == 2);
+    assert((cast(ubyte*)sa4.ptr)[2] == 3);
+    assert((cast(ubyte*)sa4.ptr)[3] == 4);
+
+    auto sa22 = (void[2][2]).init;
+    static assert(sa22.sizeof == ubyte.sizeof * 2 * 2);
+    ubyte[4]* psa22 = cast(ubyte[4]*)sa22.ptr;
+    assert((*psa22)[0] == 0);
+    assert((*psa22)[1] == 0);
+    assert((*psa22)[2] == 0);
+    assert((*psa22)[3] == 0);
+}
+
+/***************************************************/
+// 8897
+
+class C8897
+{
+    static mixin M8897!(int);
+    static class causesAnError  {}
+}
+
+template M8897 ( E ) { }
+
+/***************************************************/
+// 8917
+
+void test8917()
+{
+    int[3] a;
+    int[3] a2;
+    int[3] b = a[] + a2[];
+}
+
+/***************************************************/
+// 8945
+
+struct S8945 // or `class`, or `union`
+{
+    struct S0(T) { int i; }
+    struct S1(T) { this(int){} }
+}
+
+void test8945()
+{
+    auto cs0a = const S8945.S0!int();  // ok
+    auto cs0b = const S8945.S0!int(1); // ok
+    auto cs1  = const S8945.S1!int(1); // ok
+
+    auto s0a = S8945.S0!int();  // Error: struct S0 does not overload ()
+    auto s0b = S8945.S0!int(1); // Error: struct S0 does not overload ()
+    auto s1  = S8945.S1!int(1); // Error: struct S1 does not overload ()
+}
+
+/***************************************************/
+
+struct S162
+{
+    static int generateMethodStubs( Class )()
+    {
+        int text;
+
+        foreach( m; __traits( allMembers, Class ) )
+        {
+            static if( is( typeof( mixin( m ) ) ) && is( typeof( mixin( m ) ) == function ) )
+            {
+                pragma(msg, __traits( getOverloads, Class, m ));
+            }
+        }
+
+        return text;
+    }
+
+    enum int ttt = generateMethodStubs!( S162 )();
+
+    float height();
+    int get( int );
+    int get( long );
+    void clear();
+
+    void draw( int );
+    void draw( long );
+}
+
+/***************************************************/
+
+void test163() {
+    static class C { int x; int y; }
+
+    immutable C c = new C();
+    shared C c2 = new C();
+    shared const C c3 = new C();
+
+    class D { int x; int y; }
+    immutable D d;
+    assert(!__traits(compiles, d = new D()));
+
+    static struct S { int x; int y; }
+
+    immutable S* s = new S();
+    shared S* s2 = new S();
+    shared const S* s3 = new S();
+
+    shared S* s4;
+    assert(__traits(compiles, s4 = new immutable(S)()));
+
+    struct T { int x; int y; }
+    immutable T* t;
+    assert(!__traits(compiles, t = new T()));
+
+    immutable int* pi = new int();
+    immutable void* pv = new int();
+
+    immutable int[] ai = new int[1];
+    immutable void[] av = new int[2];
+}
+
+/***************************************************/
+struct S9000
+{ ubyte i = ubyte.max; }
+
+enum E9000 = S9000.init;
+
+/***************************************************/
+
+mixin template DefineCoreType(string type)
+{
+    struct Faulty
+    {
+        static int x;
+
+        static void instance()
+        {
+            x = 3;
+        }
+
+        X164!() xxx;
+    }
+}
+
+mixin DefineCoreType!("");
+
+
+mixin template A164()
+{
+    static this()
+    {
+    }
+}
+
+struct X164()
+{
+    mixin A164!();
+}
+
+
+/***************************************************/
+// 9428
+
+void test9428()
+{
+    int[2][] items = [[1, 2]];
+    int[2] x = [3, 4];
+
+    auto r1 = items ~ [x];
+    assert(r1.length == 2);
+    assert(r1[0][0] == 1);
+    assert(r1[0][1] == 2);
+    assert(r1[1][0] == 3);
+    assert(r1[1][1] == 4);
+
+    auto r2 = items ~ x;
+    assert(r2.length == 2);
+    assert(r2[0][0] == 1);
+    assert(r2[0][1] == 2);
+    assert(r2[1][0] == 3);
+    assert(r2[1][1] == 4);
+
+    auto r3 = [x] ~ items;
+    assert(r3.length == 2);
+    assert(r3[0][0] == 3);
+    assert(r3[0][1] == 4);
+    assert(r3[1][0] == 1);
+    assert(r3[1][1] == 2);
+
+    auto r4 = x ~ items;
+    assert(r4.length == 2);
+    assert(r4[0][0] == 3);
+    assert(r4[0][1] == 4);
+    assert(r4[1][0] == 1);
+    assert(r4[1][1] == 2);
+}
+
+/***************************************************/
+// 9477
+
+template Tuple9477(T...) { alias T Tuple9477; }
+template Select9477(bool b, T, U) { static if (b) alias T Select9477; else alias U Select9477; }
+
+void test9477()
+{
+    static bool isEq (T1, T2)(T1 s1, T2 s2) { return s1 == s2; }
+    static bool isNeq(T1, T2)(T1 s1, T2 s2) { return s1 != s2; }
+
+    // Must be outside the loop due to http://d.puremagic.com/issues/show_bug.cgi?id=9748
+    int order;
+    // Must be outside the loop due to http://d.puremagic.com/issues/show_bug.cgi?id=9756
+    auto checkOrder(bool dyn, uint expected)()
+    {
+        assert(order==expected);
+        order++;
+        // Use temporary ("v") to work around http://d.puremagic.com/issues/show_bug.cgi?id=9402
+        auto v = cast(Select9477!(dyn, string, char[1]))"a";
+        return v;
+    }
+
+    foreach (b1; Tuple9477!(false, true))
+        foreach (b2; Tuple9477!(false, true))
+        {
+            version (D_PIC) {} else // Work around http://d.puremagic.com/issues/show_bug.cgi?id=9754
+            {
+                assert( isEq (cast(Select9477!(b1, string, char[0]))"" , cast(Select9477!(b2, string, char[0]))""  ));
+                assert(!isNeq(cast(Select9477!(b1, string, char[0]))"" , cast(Select9477!(b2, string, char[0]))""  ));
+
+                assert(!isEq (cast(Select9477!(b1, string, char[0]))"" , cast(Select9477!(b2, string, char[1]))"a" ));
+                assert( isNeq(cast(Select9477!(b1, string, char[0]))"" , cast(Select9477!(b2, string, char[1]))"a" ));
+            }
+
+            assert( isEq (cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[1]))"a" ));
+            assert(!isNeq(cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[1]))"a" ));
+
+            assert(!isEq (cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[1]))"b" ));
+            assert( isNeq(cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[1]))"b" ));
+
+            assert(!isEq (cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[2]))"aa"));
+            assert( isNeq(cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[2]))"aa"));
+
+            // Note: order of evaluation was not followed before this patch
+            // (thus, the test below will fail without the patch).
+            // Although the specification mentions that as implementation-defined behavior,
+            // I understand that this isn't by design, but rather an inconvenient aspect of DMD
+            // that has been moved to the specification.
+            order = 0;
+            bool result = checkOrder!(b1, 0)() == checkOrder!(b2, 1)();
+            assert(result);
+            assert(order == 2);
+        }
+
+    ubyte[64] a1, a2;
+    foreach (T; Tuple9477!(void, ubyte, ushort, uint, ulong, char, wchar, dchar, float, double))
+    {
+        auto s1 = cast(T[])(a1[]);
+        auto s2 = cast(T[])(a2[]);
+        assert(s1 == s2);
+        a2[$-1]++;
+        assert(s1 != s2);
+        assert(s1[0..$-1]==s2[0..$-1]);
+        a2[$-1]--;
+    }
+}
+
+/***************************************************/
+// 9504
+
+struct Bar9504
+{
+    template Abc(T)
+    {
+        T y;
+    }
+
+    enum size_t num = 123;
+
+    class Def {}
+}
+
+template GetSym9504(alias sym) { static assert(__traits(isSame, sym, Bar9504.Abc)); }
+template GetExp9504(size_t n) { static assert(n == Bar9504.num); }
+template GetTyp9504(T) { static assert(is(T == Bar9504.Def)); }
+
+alias GetSym9504!(typeof(Bar9504.init).Abc) X9504; // NG
+alias GetExp9504!(typeof(Bar9504.init).num) Y9504; // NG
+alias GetTyp9504!(typeof(Bar9504.init).Def) Z9504;
+
+Bar9504 test9504()
+{
+    alias GetSym9504!(typeof(return).Abc) V9504; // NG
+    alias GetExp9504!(typeof(return).num) W9504; // NG
+    alias GetTyp9504!(typeof(return).Def) X9504;
+    return Bar9504();
+}
+
+/***************************************************/
+// 9538
+
+void test9538()
+{
+    void*[1] x;
+    auto ti = typeid(x.ptr);
+}
+
+/***************************************************/
+// 9539
+
+void test9539()
+{
+    void f(int** ptr)
+    {
+        assert(**ptr == 10);
+    }
+    int* p = new int;
+    *p = 10;
+    int*[1] x = [p];
+    f(&x[0]);
+
+    int*[] arr = [null];
+    static assert(!__traits(compiles, p = arr));    // bad!
+}
+
+/***************************************************/
+// 9700
+
+mixin template Proxy9700(alias a)
+{
+    auto ref opOpAssign(string op, V)(V v) { return a += v; }  // NG
+  //auto ref opOpAssign(string op, V)(V v) { a += v; } // OK
+}
+struct MyInt9700
+{
+    int value;
+    invariant() { assert(value >= 0); }
+    mixin Proxy9700!value;
+}
+void test9700()
+{
+    MyInt9700 a = { 2 };
+    a *= 3;   // object.Error: Access Violation
+}
+
+/***************************************************/
+// 9834
+
+struct Event9834
+{
+    void delegate() dg;
+    void set(void delegate() h) pure { dg = h; }  // AV occurs
+    void call() { dg(); }
+}
+void test9834()
+{
+    Event9834 ev;
+    auto a = new class
+    {
+        Object o;
+        this()
+        {
+            o = new Object;
+            ev.set((){ o.toString(); });
+        }
+    };
+    ev.call();
+}
+
+/***************************************************/
+// 9859
+
+void test9859(inout int[] arr)
+{
+    auto dg1 = { foreach (i, e; arr) { } };
+    dg1();
+
+    void foo() { auto v = arr; auto w = arr[0]; }
+    void bar(inout int i) { auto v = arr[i]; }
+
+    auto dg2 =
+    {
+        auto dg =
+        {
+            void foo(T)()
+            {
+                auto dg =
+                {
+                    auto dg =
+                    {
+                        auto v = arr;
+                    };
+                };
+            }
+            foo!int;
+        };
+    };
+
+    void qux(T)()
+    {
+        auto v = arr;
+        auto dg1 = { auto v = arr; };
+        auto dg2 =
+        {
+            auto dg =
+            {
+                auto v = arr;
+            };
+        };
+    }
+    qux!int;
+}
+
+/***************************************************/
+// 9912
+
+template TypeTuple9912(Stuff...)
+{
+    alias Stuff TypeTuple9912;
+}
+
+struct S9912
+{
+    int i;
+    alias TypeTuple9912!i t;
+
+    void testA() {
+        auto x = t;
+    }
+
+    void testB() {
+        auto x = t;
+    }
+}
+
+/***************************************************/
+// 9883
+
+struct S9883
+{
+    @property size_t p9883(T)() { return 0; }
+}
+
+@property size_t p9883(T)() { return 0; }
+
+void test9883()
+{
+    S9883 s;
+    auto n1 = p9883!int; // OK
+    auto n2 = s.p9883!int; // OK
+    auto a1 = new int[p9883!int]; // Error: need size of rightmost array, not type p!(int)
+    auto a2 = new int[s.p9883!int]; // Error: no property 'p!(int)' for type 'S'
+}
+
+
+/***************************************************/
+// 10091
+
+struct S10091
+{
+    enum e = "a";
+}
+
+void test10091()
+{
+    auto arr = cast(ubyte[1]) S10091.e;
+}
+
+/***************************************************/
+
+void test12824()
+{
+label:
+    static if (0)
+    {
+    }
+}
+
+/***************************************************/
+// 9130
+
+class S9130 { void bar() { } }
+
+import core.stdc.stdio : printf;
+
+struct Function
+{
+    int[] ai = [1,2,3];
+}
+
+@property void meta(alias m)()
+{
+    static Function md;
+    printf("length = %d\n", md.ai.length);
+    printf("ptr = %p\n", md.ai.ptr);
+    md.ai[0] = 0;
+}
+
+void test9130()
+{
+    meta!(__traits(getOverloads, S9130, "bar")[0]);
+    meta!(S9130.bar);
+}
+
+/***************************************************/
+// 10390
+
+class C10390 { this() { this.c = this; } C10390 c; }
+const c10390 = new C10390();
+pragma(msg, c10390);
+
+/***************************************************/
+// 10542
+
+class B10542
+{
+    this() nothrow pure @safe { }
+}
+
+class D10542 : B10542
+{
+}
+
+void test10542() nothrow pure @safe
+{
+    new D10542;
+}
+
+/***************************************************/
+// 10539
+
+void test10539()
+{
+    int[2][2] a;
+    int* p1 = a.ptr.ptr;    // OK <- error
+    int* p2 = (*a.ptr).ptr; // OK
+    assert(p1 is p2);
+}
+
+/***************************************************/
+
+struct TimeOfDay
+{
+    ubyte h, m, s;
+}
+
+__gshared byte glob;
+
+struct DateTime
+{
+    this(ubyte _d, ubyte _m, ubyte _y, TimeOfDay _tod = TimeOfDay.init)
+    {
+        d = _d;
+        m = _m;
+        y = _y;
+        tod = _tod;
+    }
+    TimeOfDay tod;
+    ubyte d, m, y;
+}
+
+
+void test10634()
+{
+    glob = 123;
+    DateTime date1 = DateTime(0, 0, 0);
+    DateTime date2;
+    assert(date1 == date2);
+}
+
+/***************************************************/
+
+immutable(char)[4] bar7254(int i)
+{
+    if (i)
+    {
+        immutable(char)[4] r; return r;
+    }
+    else
+        return "1234";
+}
+
+void test7254()
+{
+    assert(bar7254(0) == "1234");
+}
+
+/***************************************************/
+
+struct S11075() { int x = undefined_expr; }
+
+class C11075() { int x = undefined_expr; }
+
+interface I11075() { enum int x = undefined_expr; }
+
+void test11075()
+{
+    static assert(!is(typeof(S11075!().x)));
+    static assert(!is(typeof(S11075!().x)));
+
+    static assert(!is(typeof(C11075!().x)));
+    static assert(!is(typeof(C11075!().x)));
+
+    static assert(!is(typeof(I11075!().x)));
+    static assert(!is(typeof(I11075!().x)));
+}
+
+/***************************************************/
+// 11181
+
+void test11181()
+{
+    auto a = ["a", "b"];
+
+    static assert(!is(typeof([a, "x"])));
+    static assert(!is(typeof(true ? a : "x")));
+
+    static assert(!is(typeof(true ? a[0 .. $] : "x")));
+    static assert(!is(typeof([a[0 .. $], "x"])));
+}
+
+/***************************************************/
+// 11317
+
+void test11317()
+{
+    auto ref uint fun()
+    {
+        return 0;
+    }
+
+    void test(ref uint x) {}
+    static assert(!__traits(compiles, test(fun())));
+
+    assert(fun() == 0);
+}
+
+/***************************************************/
+// 11888
+
+void test11888()
+{
+    static long val;
+
+    static ubyte* foo(size_t* len)
+    {
+        *len = val.sizeof;
+        return cast(ubyte*)&val;
+    }
+
+    size_t size;
+    ubyte[] t = foo(&size)[0..size];
+    assert(t.ptr is cast(void*)&val);
+    assert(t.length == 8);
+
+    // regression test
+    int[3] sa1 = [1,2,3];
+    int[1] sa2 = sa1[1..2]; // convert slice to Tsarray
+    assert(sa2.length == 1);
+    assert(sa2[0] == 2);
+}
+
+/***************************************************/
+// 12036
+
+template T12036(alias a)
+{
+    string value;
+}
+
+struct S12036
+{
+    auto fun() { }
+    mixin T12036!fun;
+}
+
+void test12036()
+{
+    S12036 s;
+    assert(s.value == "");
+}
+
+/***************************************************/
+// 12153
+
+void test12153()
+{
+    int[1] i, j;
+    bool b = true;
+    (b ? i : j)[] = [4];
+    assert(i == [4]);
+
+    // regression test
+    int[1][1] k, l;
+    (b ? k : l)[0..1][0..1] = [4];
+    assert(k == [[4]]);
+}
+
+/***************************************************/
+// 12498
+
+string a12498()
+{
+    string b;
+    while (b) { }
+    for (; b; ) { }
+    return "";
+}
+
+void test12498()
+{
+    enum t = a12498();
+    string x = t;
+}
+
+/***************************************************/
+// 12900
+
+struct A12900
+{
+    char[1] b;
+}
+
+void test12900()
+{
+    A12900 c;
+    if (*c.b.ptr)
+        return;
+}
+
+/***************************************************/
+// 12937
+
+void test12937()
+{
+    void[1] sa2 = cast(void[])[cast(ubyte)1];   // ICE!
+    assert((cast(ubyte[])sa2[])[0] == 1);
+}
+
+/***************************************************/
+// 13154
+
+void test13154()
+{
+    int[3] ints      = [2   , 1   , 0   , 1   ][0..3];
+    float[3] floats0 = [2f  , 1f  , 0f  , 1f  ][0..3];
+    float[3] floats1 = [2.0 , 1.0 , 0.0 , 1.0 ][0..3];  // fails!
+    float[3] floats2 = [2.0f, 1.0f, 0.0f, 1.0f][0..3];
+    assert(ints == [2, 1, 0]);
+    assert(floats0 == [2, 1, 0]);
+    assert(floats1 == [2, 1, 0]); // fail!
+    assert(floats1 != [0, 0, 0]); // fail!
+    assert(floats2 == [2, 1, 0]);
+}
+
+/***************************************************/
+// 13437
+
+ubyte[4] foo13437() { return [1,2,3,4]; }
+
+void test13437()
+{
+    auto n = cast(ubyte[4])foo13437()[];  // OK <- ICE: e2ir.c 4616
+    static assert(is(typeof(n) == ubyte[4]));
+    assert(n == [1,2,3,4]);
+}
+
+/***************************************************/
+// 13472
+
+class A13472
+{
+    int a;
+}
+
+void test13472()
+{
+    A13472[] test;
+    test.length = 4;
+    auto b = test[0..2] ~ null ~ test[2..$];
+    assert(b.length == 5);
+}
+
+/***************************************************/
+// 13476
+
+template ParameterTypeTuple13476(func...)
+{
+    static if (is(typeof(*func[0]) P == function))
+        alias ParameterTypeTuple13476 = P;
+    else
+        static assert(0, "argument has no parameters");
+}
+
+int flag13476;
+
+__gshared extern(C) void function(int) nothrow someFunc13476 = &Stub13476!someFunc13476;
+
+extern(C) auto Stub13476(alias func)(ParameterTypeTuple13476!func args)
+{
+    ++flag13476;
+    extern(C) void function(int) nothrow impl = (i) { };
+    return (func = impl)(args);
+}
+
+__gshared extern(C) void function(int) nothrow  someFunc13476Alt = &Stub13476Alt!someFunc13476AltP;
+__gshared extern(C) void function(int) nothrow* someFunc13476AltP = &someFunc13476Alt;
+
+extern(C) auto Stub13476Alt(alias func)(int args) nothrow
+{
+    ++flag13476;
+    extern(C) void function(int) nothrow impl = (i) {};
+    return (*func = impl)(args);
+}
+
+void test13476()
+{
+    assert(flag13476 == 0);
+
+    someFunc13476(42);
+    assert(flag13476 == 1);
+    someFunc13476(43);
+    assert(flag13476 == 1);
+
+    someFunc13476Alt(42);
+    assert(flag13476 == 2);
+    someFunc13476Alt(43);
+    assert(flag13476 == 2);
+}
+
+/***************************************************/
+// 14038
+
+static immutable ubyte[string] wordsAA14038;
+static this()
+{
+    wordsAA14038["zero"] = 0;
+}
+
+/***************************************************/
+// 14192
+
+void test14192()
+{
+    shared int[int] map;
+    map[1] = 1;
+}
+
+/***************************************************/
+// 13720
+
+struct FracSec13720
+{
+    this(int hnsecs) {}
+}
+
+struct SysTime13720
+{
+    this(TimeOfDay13720 dateTime, FracSec13720 fracSec)
+    {
+    }
+}
+
+struct TimeOfDay13720
+{
+    ~this() { }
+}
+
+void assertThrown13720(T)(lazy T) {}
+
+void test13720()
+{
+    assertThrown13720(SysTime13720(TimeOfDay13720.init, FracSec13720(-1)));
+}
+
+/***************************************************/
+// 13952
+
+struct Reg13952
+{
+    ubyte type;
+    ubyte regNo;
+    ushort size;
+}
+
+struct Imm13952
+{
+    ulong imm;
+}
+
+struct Opnd13952
+{
+    union
+    {
+        Reg13952 reg; // size == 4
+        Imm13952 imm; // size == 8
+    }
+    ubyte tag;
+
+    this(Reg13952 r) { reg = r; }
+}
+
+Opnd13952 opnd13952(Reg13952 reg)
+{
+    return Opnd13952(reg);
+}
+
+void test13952()
+{
+    Reg13952 reg;
+    auto op = opnd13952(reg);
+    auto buf = (cast(ubyte*)&op)[0 .. op.sizeof];
+    //debug
+    //{
+    //    import std.stdio;
+    //    writefln("op.reg = [%(%02x %)]", (cast(ubyte*)&op.reg)[0 .. Reg13952.sizeof]);
+    //    writefln("op.imm = [%(%02x %)]", (cast(ubyte*)&op.imm)[0 .. Imm13952.sizeof]);
+    //}
+    foreach (e; buf) assert(e == 0);
+}
+
+/***************************************************/
+// 14165
+
+class Foo14165
+{
+    @disable this();
+    this(int i) {}
+}
+
+/***************************************************/
+// 13985
+
+interface I13985
+{
+    void m1();
+    void m2();
+    void m3();
+
+    final void mf()
+    {
+        m3();
+    }
+}
+
+class C13985 : I13985
+{
+    void m1() {}
+    void m2() {}
+    void m3() {}
+}
+
+class D13985 : C13985
+{
+    void ml()
+    {
+        super.mf();
+    }
+}
+
+void test13985()
+{
+    auto d = new D13985();
+    d.ml();
+}
+
+/***************************************************/
+// 14211
+
+extern(C++) // all derived classes won't have invariants
+class B14211
+{
+    void func()
+    {
+    }
+}
+
+final class C14211 : B14211
+{
+}
+
+void test14211()
+{
+    auto c = new C14211();
+    *cast(void**)c = null;
+    c.func();   // called without vtbl access
+}
+
+/***************************************************/
+// 14552
+
+template map14552(fun...)
+{
+    template AppliedReturnType(alias f)
+    {
+        alias typeof(f(0)) AppliedReturnType;
+    }
+
+    auto map14552(int[] r)
+    {
+        assert(!is(AppliedReturnType!fun));
+        return MapResult14552!fun();
+    }
+}
+
+struct MapResult14552(alias fun)
+{
+    @property front()
+    {
+        fun(0);
+    }
+}
+
+class Outer14552
+{
+    auto test()
+    {
+        [1].map14552!(j => new Inner);
+    }
+    class Inner {}
+}
+
+/***************************************************/
+// 14853
+
+struct Queue14853(T)
+{
+    struct Node
+    {
+        T mfPayload = T.init;
+        union
+        {
+                   typeof(this)*  mfPrev;
+            shared(typeof(this)*) mfShPrev;
+        }
+        union
+        {
+                   typeof(this)*  mfNext;
+            shared(typeof(this)*) mfShNext;
+        }
+    }
+
+    Node root;
+
+    void pfPut(T v, Node* r = null)
+    {
+        shared n = new Node(v);    // problem!
+    }
+}
+
+void test14853()
+{
+    auto b1 = new Queue14853!uint;
+}
+
+/********************************************************/
+// 15045
+
+void test15045()
+{
+    void testName(T, bool r, string name)()
+    {
+        T t;
+
+        static assert(r ==          is(typeof(mixin("T."~name))));
+        static assert(r ==          is(typeof(mixin("t."~name))));
+        static assert(r == __traits(compiles, mixin("T."~name)));
+        static assert(r == __traits(compiles, mixin("t."~name)));
+        static assert(r == mixin("__traits(compiles, T."~name~")"));
+        static assert(r == mixin("__traits(compiles, t."~name~")"));
+
+        static assert(r ==                       __traits(hasMember, T, name) );
+        static assert(r ==                       __traits(hasMember, t, name) );
+        static assert(r == __traits(compiles,    __traits(getMember, T, name) ));
+        static assert(r == __traits(compiles,    __traits(getMember, t, name) ));
+        static assert(r == __traits(compiles, __traits(getOverloads, T, name) ));
+        static assert(r == __traits(compiles, __traits(getOverloads, t, name) ));
+    }
+    void test(T, bool r)()
+    {
+        testName!(T, r, "__ctor")();
+        testName!(T, r, "__dtor")();
+        testName!(T, r, "__xdtor")();
+        testName!(T, r, "__postblit")();
+        testName!(T, r, "__xpostblit")();
+    }
+
+    static struct X
+    {
+        this(int) {}
+        this(this) {}
+        ~this() {}
+    }
+
+    static struct S1
+    {
+        auto opDispatch(string name, A...)(A args) { }
+    }
+    static struct S2
+    {
+        X get() { return X(); };
+        alias get this;
+    }
+    static struct S3
+    {
+        X opDot() { return X(); };
+    }
+
+    test!(X, true)();
+    test!(S1, false)();
+    test!(S2, false)();
+    test!(S3, false)();
+}
+
+/***************************************************/
+// 15116
+
+alias TypeTuple15116(T...) = T;
+
+template Mix15116()
+{
+    TypeTuple15116!(int, int) tup;
+}
+
+struct S15116
+{
+    mixin Mix15116 mix;
+}
+
+void test15116()
+{
+    S15116 s;
+    auto x1 = s.tup;        // OK
+    auto x2 = s.mix.tup;    // OK <- NG
+}
+
+/***************************************************/
+// 15117
+
+template Mix15117()
+{
+    int y = { typeof(this)* s; return s ? s.mix.y : 0; }();
+}
+
+struct S15117
+{
+    int x = { typeof(this)* s; return s ? s.x : 0; }(); // OK
+
+    mixin Mix15117 mix;     // OK <- NG
+}
+
+/***************************************************/
+// 15126
+
+struct Json15126
+{
+    ubyte[16] m_data;
+    int opDispatch(string prop)() const { return 0; }
+    int opDispatch(string prop)() { return 0; }
+}
+
+template isCustomSerializable15126(T)
+{
+    enum isCustomSerializable15126 = T.init.toRepresentation();
+}
+
+alias bug15126 = isCustomSerializable15126!Json15126;
+
+/***************************************************/
+// 15366
+
+enum E15366 : bool { A, B };
+
+struct S15366
+{
+    void func1(E15366 e) {}
+
+    void func2(E15366 a, E15366 b)
+    {
+        func1(cast(E15366)(a && b));
+        func1(cast(E15366)(a || b));
+
+        auto x1 = cast(E15366)(a && b);
+        auto x2 = cast(E15366)(a || b);
+    }
+}
+
+/***************************************************/
+// 15369
+
+struct MsgTable15369
+{
+    const(char)[] ident;
+    const(char)* name;
+};
+
+MsgTable15369[] msgTable15369 =
+[
+    { "empty", "" },
+];
+
+void test15369()
+{
+    auto id = msgTable15369[0].ident;
+    auto p = msgTable15369[0].name;
+
+    // a string literal "" should be zero-terminated
+    assert(*p == '\0');
+}
+
+/***************************************************/
+// 15961
+
+struct SliceOverIndexed15961(T)
+{
+    enum assignableIndex = T.init;
+}
+
+struct Grapheme15961
+{
+    SliceOverIndexed15961!Grapheme15961 opSlice()
+    {
+        assert(0);
+    }
+
+    struct
+    {
+        ubyte* ptr_;
+    }
+}
+
+/***************************************************/
+// 16022
+
+bool test16022()
+{
+    enum Type { Colon, Comma }
+    Type type;
+    return type == Type.Colon, type == Type.Comma;
+}
+
+/***************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=16233
+
+enum valueConvertible(T1, T2) = blah;
+
+struct Checked(T, Hook)
+{
+    bool opEquals(U)(Checked!(U, Hook) rhs)
+    {
+        alias R = typeof(payload + rhs.payload);
+        static if (valueConvertible!(T, R))
+        {
+        }
+        return false;
+    }
+}
+
+void test16233()
+{
+    Checked!(Checked!(int, void), void) x1;
+}
+
+/***************************************************/
+
+// https://issues.dlang.org/show_bug.cgi?id=16408
+
+char[1] SDL_GetKeyName_buffer;
+
+const(char)[] SDL_GetKeyName(char k)
+{
+    pragma(inline, false);
+    SDL_GetKeyName_buffer[0] = k;
+    return SDL_GetKeyName_buffer[];
+}
+
+void formattedWrite(const(char)[] strW, const(char)[] strA, const(char)[] strC)
+{
+    pragma(inline, false);
+
+    assert(strW == "W");
+    assert(strA == "A");
+    assert(strC == "C");
+}
+
+void test16408()
+{
+    pragma(inline, false);
+    formattedWrite(
+        SDL_GetKeyName('W').idup,
+        SDL_GetKeyName('A').idup,
+        SDL_GetKeyName('C').idup
+    );
+}
+
+/***************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=17349
+
+void test17349()
+{
+    static struct S
+    {
+        int bar(void delegate(ref int*)) { return 1; }
+        int bar(void delegate(ref const int*)) const { return 2; }
+    }
+
+    void dg1(ref int*) { }
+    void dg2(ref const int*) { }
+    S s;
+    int i;
+    i = s.bar(&dg1);
+    assert(i == 1);
+    i = s.bar(&dg2);
+    assert(i == 2);
+}
+
+/***************************************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+    test8();
+    test9();
+    test10();
+    test11();
+    test12();
+    test13();
+    test14();
+    test15();
+    test16();
+    test17();
+    test18();
+    test19();
+    test20();
+    test21();
+    test22();
+    test23();
+    test24();
+    test25();
+    test26();
+    test27();
+    test28();
+    test29();
+    test30();
+    test31();
+    test32();
+    test33();
+    test34();
+    test35();
+    test36();
+    test37();
+    test38();
+    test39();
+    test40();
+    test41();
+    test42();
+    test43();
+    test44();
+    test45();
+    test46();
+    test47();
+    test48();
+    test49();
+    test796();
+    test50();
+    test51();
+    test52();
+    test53();
+    test54();
+    test55();
+    test56();
+    test57();
+    test58();
+
+    test60();
+    test61();
+    test62();
+    test63();
+    test64();
+    test65();
+    test66();
+    test67();
+    test68();
+    test69();
+    test70();
+
+    test5785();
+    test72();
+    test73();
+    test74();
+    test75();
+    test76();
+    test77();
+    test78();
+    test79();
+    test80();
+    test81();
+    test82();
+    test83();
+    test3559();
+    test84();
+    test85();
+    test2006();
+    test8442();
+    test86();
+    test87();
+    test2486();
+    test5554();
+    test88();
+    test7545();
+    test89();
+    test90();
+    test91();
+    test92();
+    test4536();
+    test93();
+    test94();
+    test95();
+    test5403();
+    test96();
+    test97();
+    test98();
+    test99();
+    test100();
+    test101();
+
+    test103();
+    test104();
+    test105();
+    test3927();
+    test107();
+
+    test109();
+
+    test111();
+
+    test113();
+
+    test115();
+    test116();
+    test117();
+    test3822();
+    test6545();
+    test118();
+    test5081();
+
+    test120();
+    test10724();
+    test122();
+    test123();
+    test124();
+    test125();
+    test6763();
+
+    test127();
+    test128();
+    test1891();
+    test129();
+    test130();
+    test1064();
+    test131();
+    test132();
+    test133();
+    test134();
+    test135();
+    test136();
+    test137();
+    test138();
+    test1962();
+    test139();
+    test140();
+    test141();
+    test6317();
+    test142();
+    test143();
+    test144();
+    test145();
+    test146();
+    test147();
+    test6685();
+    test148();
+    test149();
+    test2356();
+    test11238();
+    test2540();
+    test14348();
+    test150();
+    test151();
+    test152();
+    test153();
+    test154();
+    test155();
+    test156();
+    test658();
+    test4258();
+    test4539();
+    test4963();
+    test4031();
+    test5437();
+    test6230();
+    test6264();
+    test6284();
+    test6295();
+    test6293();
+    test5046();
+    test1471();
+    test6335();
+    test1687();
+    test6228();
+    test3733();
+    test4392();
+    test7942();
+    test6220();
+    test5799();
+    test157();
+    test6473();
+    test6630();
+    test6690();
+    test2953();
+    test2997();
+    test4423();
+    test4647();
+    test5696();
+    test6084();
+    test6488();
+    test6565();
+    test6836();
+    test6837();
+    test6927();
+    test6733();
+    test6813();
+    test6859();
+    test3022();
+    test6910();
+    test6902();
+    test6330();
+    test6868();
+    test2856();
+    test3091();
+    test6056();
+    test6356();
+    test7073();
+    test7104();
+    test7150();
+    test7160();
+    test7168();
+    test7170();
+    test7196();
+    test7285();
+    test14737();
+    test7321();
+    test3282();
+    test7534();
+    test7534cov();
+    test7618();
+    test7621();
+    test11417();
+    test7682();
+    test7735();
+    test7823();
+    test7871();
+    test7906();
+    test7907();
+    test12503();
+    test8004();
+    test8064();
+    test8105();
+    test159();
+    test12824();
+    test8283();
+    test13182();
+    test8269();
+    test8395();
+    test13427();
+    test5749();
+    test8396();
+    test160();
+    test8665();
+    test8108();
+    test8360();
+    test9577();
+    test6141();
+    test199();
+    test8526();
+    test161();
+    test7175();
+    test8819();
+    test8917();
+    test8945();
+    test11805();
+    test14192();
+    test163();
+    test9428();
+    test9477();
+    test9538();
+    test9700();
+    test9834();
+    test13947();
+    test9883();
+    test10091();
+    test9130();
+    test10542();
+    test10539();
+    test10634();
+    test7254();
+    test13468();
+    test11075();
+    test11181();
+    test11317();
+    test11888();
+    test12036();
+    test12153();
+    test12937();
+    test13154();
+    test13437();
+    test13472();
+    test13476();
+    test13720();
+    test13952();
+    test13985();
+    test14211();
+    test15369();
+    test16233();
+    test16408();
+    test17349();
+
+    printf("Success\n");
+    return 0;
+}
diff --git a/gcc/testsuite/gdc.test/runnable/xtest55.d b/gcc/testsuite/gdc.test/runnable/xtest55.d
new file mode 100644
index 00000000000..3d41b997808
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/xtest55.d
@@ -0,0 +1,24 @@
+// PERMUTE_ARGS:
+
+import core.memory, std.stdio;
+
+Stuff* stuff1;
+
+struct Stuff {
+    uint num;
+}
+
+int main()
+{
+    stuff1 = new Stuff;
+    stuff1.num = 1;
+    auto bar = new byte[1024 * 1024];
+    auto stuff2 = new Stuff;
+    stuff2.num = 2;
+    writeln(stuff1, "\t", stuff2);  // Same address.
+    assert(stuff1 != stuff2);
+    writeln(stuff1.num, "\t", stuff2.num);  // Both 2.
+    assert(stuff1.num == 1);
+    return 0;
+}
+
diff --git a/gcc/testsuite/gdc.test/runnable/xtestenum.d b/gcc/testsuite/gdc.test/runnable/xtestenum.d
new file mode 100644
index 00000000000..9a1369c0b2b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/xtestenum.d
@@ -0,0 +1,165 @@
+// PERMUTE_ARGS:
+
+extern(C) int printf(const char*, ...);
+
+/***********************************/
+
+enum : float
+{
+    E1a,
+    E1b,
+    E1c
+}
+
+void test1()
+{
+    assert(E1a == 0.0f);
+    assert(E1b == 1.0f);
+    assert(E1c == 2.0f);
+}
+
+/***********************************/
+
+enum : string
+{
+    E2a = "foo",
+    E2b = "bar",
+    E2c = "abc"
+}
+
+void test2()
+{
+    assert(E2a == "foo");
+    assert(E2b == "bar");
+    assert(E2c == "abc");
+}
+
+/***********************************/
+
+enum E3 : string
+{
+    E3a = "foo",
+    E3b = "bar",
+    E3c = "abc"
+}
+
+void test3()
+{
+    printf("%.*s\n", E3.E3a.length, E3.E3a.ptr);
+
+    assert(E3.E3a == "foo");
+    assert(E3.E3b == "bar");
+    assert(E3.E3c == "abc");
+}
+
+/***********************************/
+
+enum E4 : char
+{
+    Tvoid     = 'v',
+    Tbool     = 'b',
+}
+
+void test4()
+{
+    E4 m;
+}
+
+/***********************************/
+
+enum E5 : byte
+{
+    e1,
+    e2
+}
+
+void test5()
+{
+    E5 m;
+}
+
+/***********************************/
+
+enum : ubyte
+{
+    REend,
+    REchar,
+    REichar,
+    REdchar,
+    REidchar,
+    REanychar,
+}
+
+void foo6(ubyte) { }
+void foo6(int) { assert(0); }
+
+void test6()
+{
+    foo6(REchar);
+}
+
+/***********************************/
+
+enum
+{
+    foo7 = 1,
+    long bar7 = 2,
+    abc7,
+}
+
+enum x7 = 3;
+
+void test7()
+{
+    assert(x7 == 3);
+    assert(is(typeof(foo7) == int));
+    assert(is(typeof(bar7) == long));
+    assert(is(typeof(abc7) == long));
+    assert(abc7 == 3L);
+}
+
+/***********************************/
+
+enum E8 : real { a, b }
+
+/***********************************/
+
+struct S7379
+{
+
+    enum ENUM
+    {
+        M1,
+        M2,
+        M3
+    }
+    alias ENUM this;
+}
+
+class C7379
+{
+    this(S7379 test)
+    {
+    }
+
+    this(string test)
+    {
+        this(S7379());
+    }
+}
+
+/***********************************/
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+    test6();
+    test7();
+
+    printf("Success\n");
+    return 0;
+}
