|
Boost : |
From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2007-10-09 04:10:42
JoaquÃn Mª López Muñoz <joaquin <at> tid.es> writes:
> OK, I think I've got it: MSVC++ 6.5 behaves funny with static constants
> inside templates, as it does not see their correct value during template
> parsing. For instance, the following:
>
> #include <boost/config.hpp>
> #include <boost/static_assert.hpp>
>
> template<typename T>
> struct foo
> {
> BOOST_STATIC_CONSTANT(int,x=2);
> BOOST_STATIC_ASSERT(x==2);
> };
>
> int main()
> {
> return 0;
> }
>
> fails at the static assertion line (x is seen as 1, btw). After
> instantiation, however, the static constant holds the correct value,
> this phenomenon only happens at the parsing stage.
Does this change
BOOST_STATIC_ASSERT(foo<T>::x==2); // qualified name
help?
> Is it OK to commit?
I'd rather disabled compile-time calculation.
-- Alexander
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk