Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-06-29 15:40:29


Borland C++ seems to have a bug regarding template argument deduction when
dealing with function pointers. Consider this:

template<typename T> void set(const T& t);
int foo(int, int) {};
// ...
set(&foo);

When calling set(&foo), we should get T = int (*)(int, int). Then the
parameter t has type reference to const pointer to a function taking two int
parameters and returning an int.

However, Borland C++ won't perform this deduction (all other compilers I
tried - GCC, Comeau, and MSVC - seem to do it properly. A workaround is to
use this form of set():

template<typename T> void set(T* t);

Where it deduces T a function taking two int parameters and returning an int.

This appears to be a Borland-specific problem, but should it be part of
config.hpp? Any suggestions on what to name this problem?

        Doug


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