blob: eb0b418933d2bf54b2be91dd52237d9cdcdb83fb [file] [log] [blame]
// 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
}