d: Merge upstream dmd 568496d5b, druntime 178c44ff, phobos 574bf883b.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / test14747.d
blobeb0b418933d2bf54b2be91dd52237d9cdcdb83fb
1 // REQUIRED_ARGS: -o-
2 // PERMUTE_ARGS: -w
4 int foo(Args...)()
6 int x;
8 foreach (arg; Args)
10 static if(is(arg == int))
12 return 0;
14 static if(is(arg == long))
16 // fallthrough
17 ++x; // this statement might be unreachable, but
18 // UnrollStatement does not warn that.
21 // no return
24 void main()
26 auto r1 = foo!(int)(); // return
27 auto r2 = foo!(int, long)(); // return -> fallthrough (it's unreachable)
28 auto r3 = foo!(long, int)(); // fallthough -> return
29 static assert(!__traits(compiles, foo!(long)())); // fallthough
30 static assert(!__traits(compiles, foo!(long, long)())); // fallthough -> fallthough