// Regression: select {} emitted invalid IR. // // A select with no clauses emitted its block without a terminator, so the next // block's label followed with no branch and clang rejected the module // ("expected instruction opcode"). Legacy short-circuits an empty select in // createSelect: the blocking form blocks forever, which the runtime reports as // a deadlock, and the form whose only clause is default does nothing. stage4 // now does the same - the blocking form reaches runtime.deadlock() and the // default form emits nothing. // // The blocking form is never called here: a program that reaches it panics. // Both compilers were checked by hand against it and print the same // "panic: runtime error at 0x...: deadlock", differing only in the address. // What this test holds down is the IR: the module has to compile, and the // default form has to run. package main func neverCalled() (r int32) { select {} } func defaultOnly() { select { default: } } func main() { defaultOnly() println("ok") }