Boost logo

Boost :

From: Alexey Nikitin (reductor_at_[hidden])
Date: 2004-01-12 04:49:53


I have investigated problem with compilation with VC7.1 and have found the
next code is not compiled

--------------- test.cpp ------------------------
template< int N >
struct int_
{
   static const int value = N;
};

enum C { V }; // analogue level_type

struct A // analogue implementation_level
{
  typedef int_<V> type;
  static const C value = static_cast<C>(type::value); // problem line
};

int_<A::value> tmp;
-----------------------------------------------------

with error
test.cpp(15) : error C2975: 'N' : invalid template argument for 'int_',
compile-time evaluatable constant expression expected
        test.cpp(1) : see declaration of 'N'

If problem line (analogue line 81 in level.hpp in which defined
implemetation_level struct) replace by
static const int value = type::value;
example is compiled ok.

Is it possible apply any workaround for this issue?

Regards,
Alexey.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk