Skip to content

Commit

Permalink
test for function pointer returns
Browse files Browse the repository at this point in the history
  • Loading branch information
wlav committed Jun 19, 2022
1 parent 84d64cd commit 9b65c97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ master: 2.4.0
* Fix lookup of templates of function with template args
* Correct typing of int8_t/uint8_t enums
* Basic support for hidden enums
* Support function pointer returns and optimize function point variables
* Fix reuse of CPPOverload proxies in vector calls from different threads
* Use -march=native instead of checking the cpu for avx

Expand Down
10 changes: 10 additions & 0 deletions test/test_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,16 @@ def sum_in_python(i1, i2, i3):
with raises(TypeError):
cppyy.gbl.call_sum_of_int(3, 2)

cppyy.cppdef(r"""\
namespace FuncPtrReturn {
typedef std::string (*func_t)(void);
std::string hello() { return "Hello, World!"; }
func_t foo() { return hello; }
}""")

ns = cppyy.gbl.FuncPtrReturn
assert ns.foo()() == "Hello, World!"

def test27_callable_passing(self):
"""Passing callables through function pointers"""

Expand Down

0 comments on commit 9b65c97

Please sign in to comment.