5
5
#include " testutilities.h"
6
6
#include < sigc++/sigc++.h>
7
7
8
- // TODO: put something like #ifndef FORTE ... #else ... #endif around:
9
- #define ENABLE_TEST_OF_OVERLOADED_FUNCTIONS 0
10
-
11
8
namespace
12
9
{
13
10
std::ostringstream result_stream;
@@ -28,22 +25,19 @@ foo(int i1)
28
25
result_stream << " foo(int " << i1 << " )" ;
29
26
}
30
27
31
- #if ENABLE_TEST_OF_OVERLOADED_FUNCTIONS
32
28
void
33
29
bar (char i1)
34
30
{
35
31
result_stream << " bar(char " << (int )i1 << " )" ;
36
32
}
37
- #endif
38
33
39
- // TODO : This works with clang++ (when we specify the return type, such as
40
- // int or void, but doesn't work with g++ .
41
- /*
34
+ // Note : This doesn't work with some older versions of g++,
35
+ // even when we specify the return type .
36
+ // Hopefully those g++ versions are old enough now.
42
37
void bar (float i1)
43
38
{
44
39
result_stream << " bar(float " << i1 << " )" ;
45
40
}
46
- */
47
41
48
42
double
49
43
bar (int i1, int i2)
@@ -77,19 +71,16 @@ main(int argc, char* argv[])
77
71
sigc::ptr_fun<void > (&foo)(1 );
78
72
util->check_result (result_stream, " foo(int 1)" );
79
73
80
- // Test use of overloaded functions that differ by parameter type:
81
- #if ENABLE_TEST_OF_OVERLOADED_FUNCTIONS
74
+ // Test use of overloaded functions that differ by parameter type:
82
75
sigc::ptr_fun<void , char > (&bar)(2 );
83
76
util->check_result (result_stream, " bar(char 2)" );
84
77
85
78
sigc::ptr_fun<void , float > (&bar)(2 .0f );
86
79
util->check_result (result_stream, " bar(float 2)" );
87
- #else
88
- // TODO: This works with clang++ (when we specify the return type, such as
89
- // int or void, but doesn't work with g++.
90
- // sigc::ptr_fun<void>(&bar)(2.0f);
91
- // util->check_result(result_stream, "bar(float 2)");
92
- #endif
80
+
81
+ // int or void, but doesn't work with g++.
82
+ // sigc::ptr_fun<void>(&bar)(2.0f);
83
+ // util->check_result(result_stream, "bar(float 2)");
93
84
94
85
sigc::ptr_fun<double > (&bar)(3 , 5 );
95
86
util->check_result (result_stream, " bar(int 3, int 5)" );
0 commit comments