Boost logo

Boost :

From: John Maddock (jm_at_[hidden])
Date: 2002-08-24 06:23:47


> signal_test is going to fail on a lot of compilers for quite a while, as
is
> function_test. Borland (like so many other compilers...) can't parse
function
> types like "int ()" or "float (int x, int y)" (Borland parses the former
as
> "int", causing the error you see).
>
> This is one of those cases where XFAIL tests would be nice :)

No need I have a fix: the trick is to replace your function types with
typedefs:

typedef int zero_arg_function_type(void);
typedef int one_arg_function_type(int);

once you do this everything is fine with Borland. BTW is_function_test.cpp
is using this trick and it does seem to be well supported by current
compilers. You may want to look at function_test as well if that's failing
for the same reason; the full diff is below, let me know if you want me to
check it in.

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm

Index: signal_test.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/signals/test/signal_test.cpp,v
retrieving revision 1.3
diff -r1.3 signal_test.cpp
21a22,31
> //
> // typedef the function types we're going to be testing,
> // this is a workaround for broken compilers that don't
> // recognize a function type when they see one unless it's in
> // a typesdef statement:
> //
> typedef int zero_arg_function_type(void);
> typedef int one_arg_function_type(int);
>
>
69c79
< boost::signal<int (), max_or_default<int> > s0;

---
>     boost::signal<zero_arg_function_type, max_or_default<int> > s0;
104c114
<     boost::signal<int (), max_or_default<int> > s0;
---
>     boost::signal<zero_arg_function_type, max_or_default<int> > s0;
110c120
<     const boost::signal<int (), max_or_default<int> >& cs0 = s0;
---
>     const boost::signal<zero_arg_function_type, max_or_default<int> >& cs0
= s
0;
118c128
<     boost::signal<int (), max_or_default<int> > s0;
---
>     boost::signal<zero_arg_function_type, max_or_default<int> > s0;
130c140
<   boost::signal<int (int value), max_or_default<int> > s1;
---
>   boost::signal<one_arg_function_type, max_or_default<int> > s1;
142c152
<   boost::signal<int (int value), max_or_default<int> > s1;
---
>   boost::signal<one_arg_function_type, max_or_default<int> > s1;
149c159
<     boost::signal<int (int value), max_or_default<int> > s2;
---
>     boost::signal<one_arg_function_type, max_or_default<int> > s2;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk