Boost logo

Boost :

From: helmut.zeisel_at_[hidden]
Date: 2001-11-02 05:20:50


--- In boost_at_y..., "Fernando Cacciola" <fcacciola_at_g...> wrote:
>
> ----- Original Message -----
> From: <helmut.zeisel_at_a...>

>
> NOTE: I discovered a bug (?) either with gcc2.92.2 or bcc32 5.5.1:
>
> Consider:
>
> template<class T>
> struct A
> {
> static const int v0 = 0 ;
>
> static const int v1 = ::A::v0 ;
> } ;
>
> If my interpretation of [14.6.1] is correct, ::A::v0 is legal since
A is
> equivalent to A<T>.
> Borland agrees with my interpretation.
>
> However, gcc doesn't: it requires you to explicitely qualify A as
in:
> ::A<T>::v0
>
> The problem is that bcc crashes with an internal compiler error if I
add the
> <T>.

I do not now either who is right, but maybe the following
work around could help:

   typedef A<T> self_type;
   static const int v1 = self_type::v0;

Using your new version, I get now the following error message
for the program below (compiled with GCC 3.0.1,
c++ -DNEW_NUMERIC_CAST;
compilation with the old numeric_cast works)

hz.cpp: In function `int main()':
hz.cpp:10: no matching function for call to
`numeric_cast(double&)'

Helmut

----- Code exeample ----
#ifdef NEW_NUMERIC_CAST
#include <boost/numeric_cast.hpp>
#else
#include <boost/cast.hpp>
#endif
#include <iostream>
int main()
{
  double d=5;
  int j = ::boost::numeric_cast<int>(d);
}


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