summaryrefslogtreecommitdiff
path: root/tests/test_exception_catch.cc
diff options
context:
space:
mode:
authorMartin Schulze <teebaum@cvs.gnome.org>2003-08-23 23:12:28 +0000
committerMartin Schulze <teebaum@src.gnome.org>2003-08-23 23:12:28 +0000
commit1cbddabbf67309fbb33719ccf8a9ffee944e4636 (patch)
treef689089845b3c03d75f6f937bc51026b37dd9b6b /tests/test_exception_catch.cc
parent7a00468c240875e0e215f8bd8451d4eb0d02d187 (diff)
downloadsigc++-1cbddabbf67309fbb33719ccf8a9ffee944e4636.tar.gz
- Remove unnecessary void specializations. In fact, only the one for
2003-08-24 Martin Schulze <teebaum@cvs.gnome.org> * sigc++/adaptors[/lambda]/*.h.m4: - Remove unnecessary void specializations. In fact, only the one for sigc::functor::exception_catch<> is needed and I don't really understand why. For the lambda stuff the void specializatoins are just commented out at the moment. - Make typeof() optional. Surprisingly, I got the lambda stuff working without typeof()! The test suite doesn't catch all cases yet, so maybe some thing are still not working. TODO: Implement configure check. * tests/test_bind.cc, tests/test_compose.cc tests/test_exception_catch.cc, tests/test_hide.cc, tests/test_lambda.cc: Only test multiple functor return types if typeof() is supported.
Diffstat (limited to 'tests/test_exception_catch.cc')
-rw-r--r--tests/test_exception_catch.cc31
1 files changed, 19 insertions, 12 deletions
diff --git a/tests/test_exception_catch.cc b/tests/test_exception_catch.cc
index b692fc0..1da6029 100644
--- a/tests/test_exception_catch.cc
+++ b/tests/test_exception_catch.cc
@@ -10,30 +10,36 @@
using namespace std;
using namespace sigc::functor;
-struct f
+#ifndef SIGC_CXX_TYPEOF
+struct f : public sigc::functor::functor_base
{
+ typedef int result_type;
+#else
+struct f
+{
+#endif
int operator()(int i)
{cout << "f(int "<<i<<")"<<endl;
throw std::range_error("out of range");}
};
-struct g
+struct g : public sigc::functor::functor_base
{
+ // also necessary if the compiler supports typeof() because the return type of
+ // g's operator() overload with no arguments cannot be auto-detected in C++:
+ typedef int result_type;
int operator()()
{cout << "g()"<<endl;
throw std::range_error("out of range");}
};
-// explicitly specify the return type of foo's operator() overload with no arguments
-// (cannot be auto-detected):
-
-namespace sigc {
-namespace functor {
-
-SIGC_FUNCTOR_TRAIT(g,int)
-
-} /* namespace functor */
-} /* namespace sigc */
+struct g_void : public sigc::functor::functor_base
+{
+ typedef void result_type;
+ void operator()()
+ {cout << "g_void()"<<endl;
+ throw std::range_error("out of range");}
+};
struct my_catch
@@ -55,4 +61,5 @@ int main()
{
cout << exception_catch(f(), my_catch())(1) << endl;
cout << exception_catch(g(), my_catch())() << endl;
+ exception_catch(g_void(), my_catch())(); // void test
}