Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Integer] On Win32, boost::uint_t<65>::fast has 64 bits?
From: Scott Meyers (NeverRead_at_[hidden])
Date: 2012-05-02 13:36:49


On 5/2/2012 1:32 AM, John Maddock wrote:
> The problem is still there in SVN Trunk as well...

Okay, so apparently not pilot error. Good to know, thanks.

FWIW, the coding error appears to be different in uint_t<N> and
int_t<N>, though I have not looked at the source code. In particular,
int_t<66> won't compile (int_t<65> will), while uint_t<66> will. So
uint_t is accepting some invalid values that int_t is rejecting though,
as I said, both accept the invalid value (for my machine) of 65.

When int_t<66> is rejected, VC11 says this:

> C:\Users\Scott\Libraries\Boost\Current\boost/integer.hpp(125): error C2039: 'least': is not a member of 'boost::detail::int_least_he
> lper<Category>'
> with
> [
> Category=0
> ]
> uinttest.cpp(9): see reference to class template instantiation 'boost::int_t<Bits>' being compiled
> with
> [
> Bits=66
> ]
> C:\Users\Scott\Libraries\Boost\Current\boost/integer.hpp(125): error C2146: syntax error : missing ';' before identifier 'least'
> C:\Users\Scott\Libraries\Boost\Current\boost/integer.hpp(125): error C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
> C:\Users\Scott\Libraries\Boost\Current\boost/integer.hpp(125): error C2602: 'boost::int_t<Bits>::least' is not a member of a base cl
> ass of 'boost::int_t<Bits>'
> with
> [
> Bits=66
> ]
> C:\Users\Scott\Libraries\Boost\Current\boost/integer.hpp(125): see declaration of 'boost::int_t<Bits>::least'
> with
> [
> Bits=66
> ]
> C:\Users\Scott\Libraries\Boost\Current\boost/integer.hpp(125): error C2868: 'boost::int_t<Bits>::least': illegal syntax for using-de
> claration; expected qualified-name
> with
> [
> Bits=66
> ]

gcc 4.7 says:

> C:\Users\Scott\Libraries\Boost\Current/boost/integer.hpp: In instantiation of
> 'boost::int_t<66>':
> uinttest.cpp:9:50: required from here
> C:\Users\Scott\Libraries\Boost\Current/boost/integer.hpp:125:19: error: no type
> named 'least' in 'boost::detail::int_least_helper<0>'
> C:\Users\Scott\Libraries\Boost\Current/boost/integer.hpp:126:49: error: no type
> named 'least' in 'boost::detail::int_least_helper<0>'

Neither message is very helpful. Would it be possible to add use of
static_assert, at least in C++11 code?

Thanks,

Scott


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net