summaryrefslogtreecommitdiff
path: root/tests/test_exception_catch.cc
diff options
context:
space:
mode:
authorMartin Schulze <MHL.Schulze@t-online.de>2003-03-24 10:18:46 +0000
committerMartin Schulze <teebaum@src.gnome.org>2003-03-24 10:18:46 +0000
commitbf560874f2d2adf7f64e174da8c0d54319580418 (patch)
treecfeb158ff832ce50ca895bfaad4116060c17df15 /tests/test_exception_catch.cc
parenta406825a8d24f45c59ad9772bf12d3b278019d0f (diff)
downloadsigc++-bf560874f2d2adf7f64e174da8c0d54319580418.tar.gz
Move detection of function and member method pointers' return types from
2003-03-24 Martin Schulze <MHL.Schulze@t-online.de> * sigc++/Makefile.am, sigc++/functors/functor_trait.h[.m4], sigc++/adaptors/adaptor_trait.h.m4: Move detection of function and member method pointers' return types from adaptor_trait into functor_trait. (We'll use functor_trait rather than adaptor_trait for our lambda stuff.) functor_trait.h needs to be generated from .m4 now. * sigc++/functors/functor_trait.h.m4: Add convenience macros: - SIGC_FUNCTORS_HAVE_RESULT_TYPE indicates that the existance of T_functor::result_type should be assumed for all unknown functors. - SIGC_FUNCTOR_TRAIT(T_functor, T_result) explicitly specifies the result type of a functor. ("typename functor_trait<T_functor>::result_type") is used to determine the return type of our adaptors' operator()() overloads. * sigc++/adaptors/[lambda/]*.h.m4: Various fixes in visit_each() and operator()() overloads to make these operator()() overloads usable. Most of them were just commented out before. Some adaptor types also have void specializations, now. * sigc++/adaptors/lambda/group.h.m4: Change syntax from "[some_functor] % grp([args])" to "group([some_functor], [args])" like we agreed on the ml some time ago. * sigc++/tests/test_[all adaptors].cc: Test stuff that didn't work before.
Diffstat (limited to 'tests/test_exception_catch.cc')
-rw-r--r--tests/test_exception_catch.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/test_exception_catch.cc b/tests/test_exception_catch.cc
index c6e3b37..b692fc0 100644
--- a/tests/test_exception_catch.cc
+++ b/tests/test_exception_catch.cc
@@ -16,14 +16,25 @@ struct f
{cout << "f(int "<<i<<")"<<endl;
throw std::range_error("out of range");}
};
-#if 0
+
struct g
{
int operator()()
{cout << "g()"<<endl;
throw std::range_error("out of range");}
};
-#endif
+
+// 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 my_catch
{
@@ -39,8 +50,9 @@ struct my_catch
}
};
+
int main()
{
- exception_catch(f(), my_catch())(1);
-// exception_catch(g(), my_catch())();
+ cout << exception_catch(f(), my_catch())(1) << endl;
+ cout << exception_catch(g(), my_catch())() << endl;
}