Skip to content

Commit c169085

Browse files
disable alternate Php::Function constructor on compilers that do not support it (fix for issue CopernicaMarketingSoftware#164)
1 parent 2c86787 commit c169085

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

include/function.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,24 @@ class Function : public Value
3939
* @param function The C++ function to be wrapped
4040
*/
4141
Function(const std::function<Value(Parameters&)> &function);
42-
42+
4343
/**
4444
* Constructor to wrap a function that does not accept parameters
45+
*
46+
* Old C++ compilers do not see a difference between std::function
47+
* objects based on the function signature, so these old compilers
48+
* do not see this method.
49+
*
4550
* @param function The C++ function to be wrapped
4651
*/
52+
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7) || __clang__
4753
Function(const std::function<Value()> &function) : Function([function](Parameters &params) -> Value {
4854

4955
// call original function, forget about the parameters
5056
return function();
5157

5258
}) {}
59+
#endif
5360

5461
/**
5562
* Destructor

0 commit comments

Comments
 (0)