Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-08-02 13:28:05


From: "David Abrahams" <dave_at_[hidden]>
> Hi All,
>
> Joel and I are working on a library problem, and he tried something
neither
> of us ever expected to work. Surprise! It works with most of our
> more-capable compilers (including recent Comeau). However, we can't find
> any justification for it in the standard. If we're not just exploiting a
> compiler bug here, it could have major implications for Boost.Function,
> Boost.Lambda, et. al. Can anyone point us at standard text which explains
> this? The main issue here is that it looks as though the existence of
> default arguments is getting passed along with a function pointer(!) used
> as a function argument.

Compiler bug/extension; there are compilers that diagnose it. To see that
it's a bug, add this:

> int
> foo(int a = 1, int b = 2)
> { return a + b; }

int foo2(int a = -1, int b = -2) { return a + b; }

> ///////////////////////////////////////
> int
> main()
> {
> typedef f_stubs<int(int a, int b)> f_stubs;
>
> cout << f_stubs::f0(foo) () << endl;
      cout << f_stubs::f0(foo2) () << endl;
> }


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