adrian
Well-known member
Hello
I have this strange error when compiling the following:
I get
There are other permissive complaints about "after previous specification".
The thing is, I thought that a default argument for parameter 1 was exactly what I was doing, and rather than 'permit' its correct c++ code per se.
If I remove the declaration / prototype of rule0() ...which you think would work fine .... I get a bad call thrown...as if the std::function is not capturing the target lambda.
What is gong on? Is it safe to ignore the permissive error? I guess it is something I can diable in the compiler :settings"?
I have this strange error when compiling the following:
Code:
#undef max
#undef min
#include <functional>
bool rule0 (std::function<bool()> application = []() -> bool {return true;});
bool rule0 (std::function<bool()> application = []() -> bool {return true;}) {
if (application()) {return true;}
else {return false;}
}
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
rule0();
}
I get
Code:
exit status 1
default argument given for parameter 1 of 'bool rule0(std::function<bool()>)' [-fpermissive]
There are other permissive complaints about "after previous specification".
The thing is, I thought that a default argument for parameter 1 was exactly what I was doing, and rather than 'permit' its correct c++ code per se.
If I remove the declaration / prototype of rule0() ...which you think would work fine .... I get a bad call thrown...as if the std::function is not capturing the target lambda.
What is gong on? Is it safe to ignore the permissive error? I guess it is something I can diable in the compiler :settings"?