Boost logo

Boost :

From: Martin Wille (mw8329_at_[hidden])
Date: 2004-06-30 15:35:04


Doug Gregor wrote:
> The new handling of min/max seems to break under GCC 2.95.3 with STLport. I'm
> not quite sure _why_ it doesn't work (I don't have the compiler around), but
> you can see the failure here:
>
> http://tinyurl.com/ytdlf
>
> Perhaps someone with that compiler/lib combination could get preprocessed
> output for the problem area so we could see what's happening?

Maybe this experiment sheds some light on the problem:
I tried this code with gcc-2.95.3 and STLport:

#include <boost/minmax.hpp>

int foo()
{
     BOOST_USING_STD_MIN();
     return min BOOST_PREVENT_MACRO_SUBSTITUTION(3, 4);
}

namespace notboost
{
     template <typename T>
     T const &
     proxy_min(T const &p, T const &q)
     {
         BOOST_USING_STD_MIN();
         return min BOOST_PREVENT_MACRO_SUBSTITUTION(p, q); // line 16
     }
}

int bar()
{
     return notboost::proxy_min(3, 4); // line 22
}

namespace test
{
     int baz()
     {
         BOOST_USING_STD_MIN();
         return min BOOST_PREVENT_MACRO_SUBSTITUTION(3, 4);
     }
}

int main() { foo(); bar(); test::baz(); }

The compiler emits these error messages:
min.cpp: In function `const int & notboost::proxy_min<int>(const int &,
const int &)':
min.cpp:22: instantiated from here
min.cpp:16: `min' undeclared (first use this function)
min.cpp:16: (Each undeclared identifier is reported only once
min.cpp:16: for each function it appears in.)

So it looks like gcc 2.95.3 doesn't handle the using declaration
inside template functions properly.

HTH,
m


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