From c0481ce99de08904be2a9e6f9104a31fedb89b2b Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 13 Nov 2018 07:30:04 +0000 Subject: [PATCH] Add Python runtime test for const function pointer --- Examples/test-suite/funcptr_cpp.i | 1 + Examples/test-suite/python/funcptr_cpp_runme.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Examples/test-suite/funcptr_cpp.i b/Examples/test-suite/funcptr_cpp.i index 8e05d308d..d8ec8de4d 100644 --- a/Examples/test-suite/funcptr_cpp.i +++ b/Examples/test-suite/funcptr_cpp.i @@ -17,6 +17,7 @@ int call2(int * (*d)(const int &, int), int a, int b) { return *d(a, b); } int call3(int & (*d)(const int &, int), int a, int b) { return d(a, b); } int call4(int & (*d)(int &, int *), int a, int b) { return d(a, &b); } int call5(int & (*d)(int &, int const * const), int a, int b) { return d(a, &b); } +int callconst1(int (* const d)(const int &, int), int a, int b) { return d(a, b); } %} %constant int (*ADD_BY_VALUE)(const int &, int) = addByValue; diff --git a/Examples/test-suite/python/funcptr_cpp_runme.py b/Examples/test-suite/python/funcptr_cpp_runme.py index eb113d226..22c50b4e9 100644 --- a/Examples/test-suite/python/funcptr_cpp_runme.py +++ b/Examples/test-suite/python/funcptr_cpp_runme.py @@ -8,3 +8,6 @@ if call3(ADD_BY_REFERENCE, 14, 15) != 29: raise RuntimeError if call1(ADD_BY_VALUE_C, 2, 3) != 5: raise RuntimeError + +if callconst1(ADD_BY_VALUE_C, 2, 3) != 5: + raise RuntimeError