The following code below defines a fn() which is overloaded. One with no parameters, one with char*, and one with an int parameter. Compiling the code renders an error on line 14 “ call of overloaded 'fn()' is ambiguous”. Commenting line 14 produces a successful compile. Any ideas on what is wrong?
=========== C O D E ===========
1 void fn() {
2 Serial.println("no parameters");
3 }
4 void fn( char* msg = " " ) {
5 Serial.println( "char *" );
6 }
7 void fn( int n = 0 ) {
8 Serial.println( "int" );
9 }
10
11 void setup() {
12 fn("hello");
13 fn(199);
14 fn(): // correction fn();
15 }
16
17 void loop() {
18 }
========== C O M P I L E =========
sketch_oct06a.ino:1:6: note: candidate: void fn()
void fn() {
^
sketch_oct06a.ino:4:6: note: candidate: void fn(char*)
void fn( char* msg = " " ) {
^
sketch_oct06a\sketch_oct06a.ino:7:6: note: candidate: void fn(int)
void fn( int n = 0 ) {
^
exit status 1
call of overloaded 'fn()' is ambiguous