Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#3657 closed Bugs (fixed)

integer.hpp does not compile in MSVS 8.0 with /Za

Reported by: abadura@… Owned by: Daryle Walker
Milestone: Boost 1.43.0 Component: integer
Version: Boost 1.42.0 Severity: Problem
Keywords: Cc:

Description

Compilation of a CPP file containing only an inclusion to <boost/integer.hpp> fails on MS Visual Studio 2008 Standard when /Za option is used (extensions are disabled).

It seems the error should show up on other editions of VS 2008 and on VS 2005 as well.

It seems the error is caused by "config/compiler/visualc.hpp" incorrectly not defining ::boost::long_long_type in case of /Za option.

It seems the error is also caused by "integer_fwd.hpp" checking for ULLONG_MAX preprocessor definition rather then BOOST_HAS_LONG_LONG.

Change History (3)

comment:1 by John Maddock, 13 years ago

Resolution: fixed
Status: newclosed

(In [57843]) Fix preprocessor logic for long long support. Fixes #3657. Fixes #3568.

comment:2 by abadura@…, 13 years ago

Milestone: Boost 1.42.0Boost 1.43.0
Resolution: fixed
Status: closedreopened
Version: Boost 1.41.0Boost 1.42.0

The problem still exists for VS 2005.

It seems there is more then one problem here actually.


Visual C++ configuration is incorrect.

boost/config/compiler/visualc.hpp#128-132

#if (_MSC_VER >= 1310) && (defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1500))
#   define BOOST_HAS_LONG_LONG
#else
#   define BOOST_NO_LONG_LONG
#endif

Visual C++ 2005 (which is _MSC_VER == 1400) also has long long type (regardless whether _MSC_EXTENSIONS is defined or not).


Integer headers are still incorrect.

boost/integer_fwd.hpp#80-86

#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64))
template <  >
    class integer_traits<  ::boost::long_long_type>;

template <  >
    class integer_traits<  ::boost::ulong_long_type >;
#endif

It seems that BOOST_HAS_MS_INT64 in no way influences existence of ::boost::long_long_type thus it should disappear from the condition because it leads to broken compilation.

Or the other way: it should start influence existence of ::boost::long_long_type. To achieve this preprocessor condition in

boost/config/suffix.hpp#467-477

#if defined(BOOST_HAS_LONG_LONG)
namespace boost{
#  ifdef __GNUC__
   __extension__ typedef long long long_long_type;
   __extension__ typedef unsigned long long ulong_long_type;
#  else
   typedef long long long_long_type;
   typedef unsigned long long ulong_long_type;
#  endif
}
#endif

should include BOOST_HAS_MS_INT64.

Which of those two is correct depends on how all Visual C++ compilers behave. I have only access to 2005 and 2008 so someone else should check it on 2003 and earlier.


In Visual Studio 2008 it seems to be fine now.

comment:3 by John Maddock, 13 years ago

Resolution: fixed
Status: reopenedclosed

(In [59468]) Change integer code to still work when BOOST_HAS_MS_INT64 is defined but BOOST_HAS_LONG_LONG is not. Update VC++ config to define BOOST_HAS_LONG_LONG for MSVC-8 in ANSI mode. Fixes #3657.

Note: See TracTickets for help on using tickets.