Boost logo

Boost :

From: Paul A. Bristow (boost_at_[hidden])
Date: 2003-03-06 17:37:41


Sadly, example1.cpp fails with MSVC 7.0 - sigh :-(

with language extension allowed:

------ Build started: Project: Units, Configuration: Debug Win32 ------

Compiling...
example1.cpp
j:\Cpp\Units\fraction_ct.hpp(44) : fatal error C1001: INTERNAL COMPILER ERROR
        (compiler file 'msc1.cpp', line 2844)
         Please choose the Technical Support command on the Visual C++
         Help menu, or open the Technical Support help file for more information

Build log was saved at "file://j:\Cpp\Units\Debug\BuildLog.htm"
Units - 1 error(s), 0 warning(s)

with disable language extensions

------ Build started: Project: Units, Configuration: Debug Win32 ------

Compiling...
example1.cpp
j:\Cpp\Units\fraction_ct.hpp(42) : warning C4253:
'ebf::fraction_ct::FracConcept<T>::constraints' : forming a pointer-to-member
requires explicit use of the address-of operator ('&') and a qualified name
        j:\Cpp\Units\fraction_ct.hpp(51) : see reference to class template
instantiation 'ebf::fraction_ct::reduce_frac<A>' being compiled
j:\Cpp\Units\fraction_ct.hpp(43) : error C2970: 'boost::math::static_gcd' :
template argument 'Value1' : invalid use of non-integral-constant static
variable 'num' as non-type argument
        I:\boost_1_29_0\boost\math\common_factor_ct.hpp(170) : see declaration
of 'boost::math::static_gcd'
j:\Cpp\Units\fraction_ct.hpp(43) : error C2970: 'boost::math::static_gcd' :
template argument 'Value2' : invalid use of non-integral-constant static
variable 'den' as non-type argument
        I:\boost_1_29_0\boost\math\common_factor_ct.hpp(170) : see declaration
of 'boost::math::static_gcd'
j:\Cpp\Units\fraction_ct.hpp(44) : fatal error C1903: unable to recover from
previous error(s); stopping compilation

Build log was saved at "file://j:\Cpp\Units\Debug\BuildLog.htm"
Units - 3 error(s), 1 warning(s)

Info on the error is:
'class' : template argument 'parameter' : invalid use of non-integral-constant
static variable 'var' as non-type argument

You cannot use the name or address of a static variable as a template argument.
For example, the following code shows how this error would be generated:

// C2970.cpp
static int si; // C2970 cannot use static variable in templates
template <int i> class X {};
template <int *pi> class Y{};
X<si> anX;
Y<&si> aY;
int main()
{
}

Can you see a way around this?

Can anyone try with 7.1?

Paul
Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK
+44 1539 561830 Mobile +44 7714 33 02 04
Mobile mailto:pabristow_at_[hidden]
mailto:pbristow_at_[hidden]


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