If you declare a variable with an initializer within a case, the enclose the statements within that case in brackets to limit the scope of the variable.
This actually fixed it. However, the compiler did not complain.
switch (cmd) {
case 't':
{
sensors.requestTemperatures();
float t = sensors.getTempCByIndex(0);
Serial.print("t:");
Serial.println(t);
}
break;