String can't be assigned (undefined reference to `String::operator=(String&&)'

I’ve got two global variables, defined before the setup()/loop():

bool loopState = true;
String loopParam = "KR,010,05,01,330000";

void setup() {
    Spark.function("route", route);

Then I’ve got a route-function:

int route(String command){
    String prefix = command.substring(0,2);
    String params = command.substring(3);

    if(prefix == "LO"){ //LOOP STATUS
       loopState = (command.substring(3,4)=="0")?false:true; // This DOES work
       loopParam = command.substring(5); // This DOES NOT work (Line 50)
       loopParam = "KR,010,05,01,FF00FF"; // This DOES work
    }else if(prefix == "KR"){

THe problem I have, is that when I try to assign something to the variable loopParam.
When I assign it maually (see the line that works), everything works, and the global variable has the new string.

However, when I want to use the command.substring(5) method, I get an error:

neopixel-notification.o: In function `route(String)':
/spark/compile_server/shared/workspace/3_compile-server2/core-firmware/build/neopixel-notification.cpp:50: undefined reference to `String::operator=(String&&)'
collect2: error: ld returned 1 exit status
make: *** [ff8a3c9844850d1cea5b32d0486d42a57ce6b45aa3d870fe4c05f7598afc.elf] Error 1

Does anyone know a workaround to this?

There are some known quirks in the implementation of String - this is one of them.
It’s on the backlog.

For now try this

  loopParam = "" + command.substring(5);
  // or
  loopParam = command.substring(5).c_str();

@fabio, did @ScruffR’s suggestion solve your problem? I’d like to mark this as “solved” so others can find it!

Yes, it did work, thanks

I had the same strange compile error and the workaround worked for me too.

Sorry to resurrect this; I just wanted to say that this is a particularly annoying quirk.