Skip to content

Auto prototype generation with function as argument to class instantiation #50

Closed
@per1234

Description

@per1234

Using Arduino IDE 1.6.7 2015/11/07 12:42 with Windows 7 64 bit

I apologize if my terminology is off on the issue title, this is what I'm referring to:

#include "CallbackBug.h"
Task t1(&t1Callback);
void t1Callback() {}
void setup() {}
void loop() {}

CallbackBug.h:

#include <Arduino.h>
class Task {
  public:
    Task(void (*aCallback)()) {};
};

Compiling gives the error:

CallbackBug:3: error: 't1Callback' was not declared in this scope
 Task t1(&t1Callback);

If I declare the function prototype for t1Callback() it compiles fine.
The code compiles fine with Arduino IDE 1.6.5r5
Example of a library where this breaks the examples: https://github.com/arkhipenko/TaskScheduler
Originally reported at: http://forum.arduino.cc/index.php?topic=357312.msg2468586#msg2468586

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions