diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index aa569bdea..8415197f4 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -412,7 +412,8 @@ CPP0X_TEST_CASES = \ cpp0x_variadic_templates \ cpp0x_alternate_function_syntax \ cpp0x_userdefined_literals \ - cpp0x_decltype + cpp0x_decltype \ + cpp0x_result_of # cpp0x_template_typedefs # not supported by any compiler yet # cpp0x_hash_types # not fully implemented yet # cpp0x_constructors # not supported by any compiler yet diff --git a/Examples/test-suite/cpp0x_result_of.i b/Examples/test-suite/cpp0x_result_of.i new file mode 100644 index 000000000..fb8586ba7 --- /dev/null +++ b/Examples/test-suite/cpp0x_result_of.i @@ -0,0 +1,19 @@ +/* This testcase checks whether Swig correctly uses the new result_of class + and its templating capabilities introduced in C++0x. */ +%module cpp0x_result_of + +%inline %{ +#include +#include + +double square(double x) { + return (x * x); +} + +template +typename std::result_of::type test_result_impl(Fun fun, Arg arg) { + return fun(arg); +} +%} + +%template(test_result) test_result_impl; diff --git a/Examples/test-suite/python/cpp0x_result_of_runme.py b/Examples/test-suite/python/cpp0x_result_of_runme.py new file mode 100644 index 000000000..5411cd1ce --- /dev/null +++ b/Examples/test-suite/python/cpp0x_result_of_runme.py @@ -0,0 +1,3 @@ +import cpp0x_result_of +if cpp0x_result_of.test_result(cpp0x_result_of.square, 3.0) != 9.0: + raise RuntimeError, "test_result(square, 3.0) is not 9.0."