diff options
author | Murray Cumming <murrayc@murrayc.com> | 2019-10-27 16:49:02 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2019-11-02 21:31:42 +0100 |
commit | 858054b5c9ed84801557488d4007fc297a8b1644 (patch) | |
tree | 79ee5082aabe1b3f800badbf4124cb29d422dcf4 | |
parent | d80622227a1316f0d29517eb7f8a6b93f9b41442 (diff) | |
download | sigc++-858054b5c9ed84801557488d4007fc297a8b1644.tar.gz |
test_ptr_fun: Re-enable tests of overloaded functions
-rw-r--r-- | tests/test_ptr_fun.cc | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/tests/test_ptr_fun.cc b/tests/test_ptr_fun.cc index e1e7ba1..b105389 100644 --- a/tests/test_ptr_fun.cc +++ b/tests/test_ptr_fun.cc @@ -5,9 +5,6 @@ #include "testutilities.h" #include <sigc++/sigc++.h> -// TODO: put something like #ifndef FORTE ... #else ... #endif around: -#define ENABLE_TEST_OF_OVERLOADED_FUNCTIONS 0 - namespace { std::ostringstream result_stream; @@ -28,22 +25,19 @@ foo(int i1) result_stream << "foo(int " << i1 << ")"; } -#if ENABLE_TEST_OF_OVERLOADED_FUNCTIONS void bar(char i1) { result_stream << "bar(char " << (int)i1 << ")"; } -#endif -// TODO: This works with clang++ (when we specify the return type, such as -// int or void, but doesn't work with g++. -/* +// Note: This doesn't work with some older versions of g++, +// even when we specify the return type. +// Hopefully those g++ versions are old enough now. void bar(float i1) { result_stream << "bar(float " << i1 << ")"; } -*/ double bar(int i1, int i2) @@ -77,19 +71,16 @@ main(int argc, char* argv[]) sigc::ptr_fun<void> (&foo)(1); util->check_result(result_stream, "foo(int 1)"); -// Test use of overloaded functions that differ by parameter type: -#if ENABLE_TEST_OF_OVERLOADED_FUNCTIONS + // Test use of overloaded functions that differ by parameter type: sigc::ptr_fun<void, char> (&bar)(2); util->check_result(result_stream, "bar(char 2)"); sigc::ptr_fun<void, float> (&bar)(2.0f); util->check_result(result_stream, "bar(float 2)"); -#else -// TODO: This works with clang++ (when we specify the return type, such as -// int or void, but doesn't work with g++. -// sigc::ptr_fun<void>(&bar)(2.0f); -// util->check_result(result_stream, "bar(float 2)"); -#endif + + // int or void, but doesn't work with g++. + // sigc::ptr_fun<void>(&bar)(2.0f); + // util->check_result(result_stream, "bar(float 2)"); sigc::ptr_fun<double> (&bar)(3, 5); util->check_result(result_stream, "bar(int 3, int 5)"); |