arduino/Arduino — pull request #1982 by majenkotech (2014-04-01 13:04:26+00:00)
Title: Fixed string constructor overloading bug

Given the following code:

void setup() {
int v = 4385;
String s(v, HEX);
}

void loop() { }

the current overloading of the String constructor causes the error:

sketch_apr01a:3: error: call of overloaded ‘String(int&, int)’ is ambiguous
/home/matt/git/Arduino/build/linux/work/hardware/arduino/cores/arduino/WString.h:72: note: candidates are: String::String(double, int)
/home/matt/git/Arduino/build/linux/work/hardware/arduino/cores/arduino/WString.h:71: note: String::String(float, int)
/home/matt/git/Arduino/build/linux/work/hardware/arduino/cores/arduino/WString.h:70: note: String::String(long unsigned int, unsigned char)
/home/matt/git/Arduino/build/linux/work/hardware/arduino/cores/arduino/WString.h:69: note: String::String(long int, unsigned char)
/home/matt/git/Arduino/build/linux/work/hardware/arduino/cores/arduino/WString.h:68: note: String::String(unsigned int, unsigned char)
/home/matt/git/Arduino/build/linux/work/hardware/arduino/cores/arduino/WString.h:67: note: String::String(int, unsigned char)
/home/matt/git/Arduino/build/linux/work/hardware/arduino/cores/arduino/WString.h:66: note: String::String(unsigned char, unsigned char)

Switching the float/double decimal places parameter to an unsigned char like the rest of the constructors resolves the issue.