
--- Boris Gubenko <Boris.Gubenko@hp.com> wrote:
The compiler is correct. Instead of quoting C++ Standard, I'll quote Lippman C++ Primer, 3rd edition, p.113:
An object of an enumeration type can be be initialized and assigned only with another object of the same enumeration type or with one of its set of enumerators. For example, although 3 is a legal value associated with Points, it cannot be explicitly assigned to a Points object: [...] enum Points { point2d = 2, point2w, point3d = 3, point3w }; // error: pt2w initialized with int Points pt2w = 3;
Thanks!
Btw, you'd get the same compilation error with any EDG-based compiler. On Tru64, for example:
Indeed. I have the same compiler. I should have checked before. Obviously I've reduced the problem a bit too much. Boost.Python (with the very same boost version from CVS) compiles fine with the Tru64 cxx compiler, but aCC gives this error (fragment of output): aCC -o boost/libs/python/src/converter/builtin_converters.o -c -AA +W2837 -DBOOST_DISABLE_THREADS -DNDEBUG -O -DBOOST_PYTHON_MAX_BASES=2 -DBOOST_PYTHON_SOURCE -I/home1/tmaier/dist/boost -Ipython/include/python2.4 -I/home1/tmaier/dist/python/include/python2.4 boost/libs/python/src/converter/builtin_converters.cpp ... "boost/boost/mpl/aux_/integral_wrapper.hpp", line 45: error #2144: a value of type "long" cannot be used to initialize an entity of type "const boost::numeric::udt_builtin_mixture_enum" BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, value = N); ^ detected during: instantiation of class "mpl_::integral_c<T, N> [with T=boost::numeric::udt_builtin_mixture_enum, N=0L]" at line 30 of "boost/boost/numeric/conversion/detail/meta.hpp" The full output is here: http://cci.lbl.gov/~rwgk/tmp/hp_ux_aCC_error_2006_03_13_1225 The problem can be reduced like this: #include <boost/numeric/conversion/cast.hpp> unsigned long long foo() { return boost::numeric_cast<unsigned long long, long>(0L); } This compiles with Tru64 cxx: % cxx -std strict_ansi -c -I$dist/boost numeric_cast.cpp cxx: Warning: numeric_cast.cpp, line 3: the type "long long" is nonstandard unsigned long long --------------^ cxx: Warning: numeric_cast.cpp, line 6: the type "long long" is nonstandard return boost::numeric_cast<unsigned long long, long>(0L); -------------------------------------------^ But not with aCC: http://cci.lbl.gov/~rwgk/tmp/hp_ux_aCC_error_2006_03_13_1248 Could this be fixed with a few extra #ifdefs? Cheers, Ralf BTW: Is the aCC compiler somehow related to the Tru64 compiler? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com