Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2005-06-15 07:12:32


Hello,

unfortunately boost.python is unusable on that platform because most of the
tests fail at runtime with a stack overflow. The reason is illustrated in
the following code sample:

---%<---
void foo(int);
template <class T> void foo(T) { foo(0); }

int main()
{
   foo(0);
}
--->%---

When compiling this with CXX 6.5, the code compiles and links cleanly,
despite the fact that the overload for foo() is not defined. Instead the
compiler instantiates foo<int>(int) and then uses the instantiation for the
call to foo() which of course leads to a stack overflow.

I had a look at the standard what should happen in this case, but after
reading [temp.over] I'm not really sure if we don't indeed end up with two
candidate functions for the overload resolution of foo(), one being the
overload itself and the other the specialization of the function template
for int. Could anyone please clarify this?

As for a possible workaround, replacing the overload with a specialization
of the function template would work, AFAICT. Would such a patch be accepted?

Markus


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