#273: make mln::value::int_u32 usable
----------------------+------------------------
Reporter: levill_r | Owner: Olena Team
Type: defect | Status: new
Priority: major | Milestone: Olena 2.1
Component: Milena | Version: 2.0
Keywords: |
----------------------+------------------------
Due to the limitations of the built-in `int` type on GNU/Linux with GCC
(which is a 32-bit signed integer, even on 64-bit hosts),
`mln::value::int_u32` does not compile properly. For instance, here is
the compile error output of the `milena/tests/value/int_u32` test on
Debian GNU/Linux 7.1 amd64 with `g++` 4.7.2 (Debian 4.7.2-5) :
{{{
In file included from ../../../../milena/mln/metal/math/all.hh:54:0,
from ../../../../milena/mln/core/concept/object.hh:54,
from ../../../../milena/mln/core/internal/exact.hh:142,
from ../../../../milena/mln/core/routine/exact.hh:44,
from ../../../../milena/mln/trait/solve_unary.hh:38,
from ../../../../milena/mln/trait/solve.hh:162,
from ../../../../milena/mln/trait/promote.hh:38,
from ../../../../milena/mln/trait/op/plus.hh:63,
from ../../../../milena/mln/trait/op/all.hh:38,
from ../../../../milena/mln/value/ops.hh:34,
from ../../../../milena/mln/value/int_u.hh:35,
from ../../../../milena/mln/value/int_u32.hh:35,
from ../../../../milena/tests/value/int_u32.cc:30:
../../../../milena/mln/metal/math/pow.hh: In instantiation of ‘const int
mln::metal::math::impl::pow_int_<2, 31>::value’:
../../../../milena/mln/metal/math/pow.hh:61:51: required from ‘const int
mln::metal::math::impl::pow_int_<2, 32>::value’
../../../../milena/mln/value/int_u.hh:99:84: required from ‘static const
self_ mln::trait::value_<mln::value::int_u<n> >::max() [with unsigned int
n = 32u; mln::trait::value_<mln::value::int_u<n> >::self_ =
mln::value::int_u<32u>]’
../../../../milena/tests/value/int_u32.cc:35:61: required from here
../../../../milena/mln/metal/math/pow.hh:61:51: warning: integer overflow
in expression [-Woverflow]
../../../../milena/mln/metal/math/pow.hh: In instantiation of ‘const int
mln::metal::math::impl::pow_int_<2, 32>::value’:
../../../../milena/mln/value/int_u.hh:99:84: required from ‘static const
self_ mln::trait::value_<mln::value::int_u<n> >::max() [with unsigned int
n = 32u; mln::trait::value_<mln::value::int_u<n> >::self_ =
mln::value::int_u<32u>]’
../../../../milena/tests/value/int_u32.cc:35:61: required from here
../../../../milena/mln/metal/math/pow.hh:61:51: error: initializer invalid
for static member with constructor
../../../../milena/mln/metal/math/pow.hh:61:51: error: (an out of class
initialization is required)
../../../../milena/mln/metal/math/pow.hh:61:51: error:
‘mln::metal::math::impl::pow_int_<2, 32>::value’ cannot be initialized by
a non-constant expression when being declared
}}}
Maybe we should redefine `mln::metal::math::pow` as well.
--
Ticket URL: <https://trac.lrde.epita.fr/olena/ticket/273>
Olena <http://olena.lrde.epita.fr>
Olena, a software platform dedicated to image processing.