Skip to content

Generated function prototypes for const __FlashStringHelper are incorrect. #4202

Closed
@EtherFidelity

Description

@EtherFidelity

Example code:

#include 

void setup() {
  Serial.print(test(true));
}

void loop() {}

const __FlashStringHelper* test(bool temp) {
  if (temp)
    return F("x");
  return F("y");
}

Generated code in sketch_nov22a.ino.cpp:

#include 
#line 1
#line 1 "C:\\Users\\user\\AppData\\Local\\Temp\\arduino_4790fd94ec03044aef00d007e6734c0b\\sketch_nov22a.ino"
#include 

#line 3 "C:\\Users\\user\\AppData\\Local\\Temp\\arduino_4790fd94ec03044aef00d007e6734c0b\\sketch_nov22a.ino"
void setup();
#line 7 "C:\\Users\\user\\AppData\\Local\\Temp\\arduino_4790fd94ec03044aef00d007e6734c0b\\sketch_nov22a.ino"
void loop();
#line 9 "C:\\Users\\user\\AppData\\Local\\Temp\\arduino_4790fd94ec03044aef00d007e6734c0b\\sketch_nov22a.ino"
const__FlashStringHelper* test(bool temp);
#line 3
void setup() {
  Serial.print(test(true));
}

void loop() {}

const __FlashStringHelper* test(bool temp) {
  if (temp)
    return F("x");
  return F("y");
}

Note the function prototype "const__FlashStringHelper* test(bool temp);" is missing the space after "const".

As expected, it fails to compile:

sketch_nov22a:9: error: 'const__FlashStringHelper' does not name a type

 const __FlashStringHelper* test(bool temp) {
 ^

C:\Users\taylorc\AppData\Local\Temp\arduino_4790fd94ec03044aef00d007e6734c0b\sketch_nov22a.ino: In function 'void setup()':

sketch_nov22a:4: error: 'test' was not declared in this scope

   Serial.print(test(true));
                         ^

exit status 1
'const__FlashStringHelper' does not name a type

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DuplicateAnother item already exists for this topic

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions