Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-08-22 12:58:12

Hello Gennadiy,
        I'm not sure I quite understand the error message. It appears that the
linker is not finding the constructors for the boost::function objects. My
inclination is to tell you to ignore the testcase failure and not to use
default arguments.
        This is somewhat of a grey area, and I can't tell you with confidence that
defarg_test is standards-conforming. The problem boils down to:

template<typename F>
void foo(F f) { f(1); }

void bar(int i, int j = 5, int k = 7);
void wibble(int i, int j, int k);

  foo(&bar); // #1
  foo(&wibble); // #2

#1 causes foo to be instantiated with F=void (*)(int, int, int), even though
it is called with only one argument. #2 has the same type (default arguments
are not part of the type), so the instantiation of foo for #1 is the same for
#2, even though wibble(1) is not well-formed. I have yet to see a compiler
catch this error. Also note that with every compiler I tried, if wibble gets
default arguments for j and k, the wrong values are used.

        My advice is to not rely on the use of default arguments. They appear to be
unpredictable on many (good) compilers.


On Wednesday 22 August 2001 01:01, you wrote:
> Hi,
> Trying to compile function: defarg_test on Sun with SunWorkshop 6 u.1
> I am sure I was able to compile it week ago. But now I am getting
> this weird error during linking:
> Undefined first referenced
> symbol in file
> boost::function0<int,boost::empty_function_policy,boost::empty_functio
> n_mixin,_STL::allocator<boost::function_base> >::function0<int(*)
> (int,int,int)>#Nvariant 1(const
> __type_4&) ./build_dev/o.sun/defarg_test.o
> boost::function2<int,int,int,boost::empty_function_policy,boost::empty
> _function_mixin,_STL::allocator<boost::function_base> >::function2<int
> (*)(int,int,int)>#Nvariant 1(const
> __type_6&) ./build_dev/o.sun/defarg_test.o
> boost::function1<int,int,boost::empty_function_policy,boost::empty_fun
> ction_mixin,_STL::allocator<boost::function_base> >::function1<int(*)
> (int,int,int)>#Nvariant 1(const
> __type_5&) ./build_dev/o.sun/defarg_test.o
> ld: fatal: Symbol referencing errors. No output written to
> build_dev/d.sun/defarg_test
> I am fighting with it second day.
> Any ideas?
> Thank you,
> Gennadiy.
> Info: Unsubscribe:
> <mailto:boost-unsubscribe_at_[hidden]>
> Your use of Yahoo! Groups is subject to

Boost list run by bdawes at, gregod at, cpdaniel at, john at