|
Boost Users : |
From: Randy Bowen (rbowen_at_[hidden])
Date: 2003-01-07 19:21:08
Some further follow-up on this. I've created a minimal program that
exhibits the new problem behavior:
/******************************************/
#include <boost/type_traits.hpp>
#include <boost/static_assert.hpp>
template < typename ValueType >
struct A
{
BOOST_STATIC_ASSERT(boost::is_integral<ValueType>::value);
};
extern "C" int main(int argc, char* argv[])
{
return 0;
}
/******************************************/
The fact that this assertion fails is counter-intuitive to me, since
there is no instantiation to compile. Note that this behavior seems
limited to the use of "is_integral" as the type predicate. Constructing
a similar program using "is_POD" behaves as expected:
/******************************************/
#include <boost/type_traits.hpp>
#include <boost/static_assert.hpp>
template < typename ValueType >
struct B
{
BOOST_STATIC_ASSERT(boost::is_POD<ValueType>::value);
};
struct C {};
extern "C" int main(int argc, char* argv[])
{
// B<int> Bint; /* OK to add */
// B<C> BC; /* causes error */
return 0;
}
/******************************************/
Here, no error occurs until there is an attempt to instantiate B<C>.
Randy Bowen
-----Original Message-----
From: Randy Bowen
Sent: Tuesday, January 07, 2003 1:40 PM
To: Boost-Users_at_[hidden]
Subject: [Boost-Users] Problem with BOOST_STATIC_ASSERT
I'm in the process of updating some applications from use of Boost
1.28.0 to 1.29.0, using MSVC7. I've noticed that a number of static
assertions that used to compile now generate errors. The assertions all
use is_integral to perform a type validation - e.g.:
BOOST_STATIC_ASSERT(::boost::is_integral<value_type>::value);
This produces an error of the form:
c:\Perforce\Development\Web\cppinclude\domestic\Application
Framework\State Machine Engine\StringSerializer.h(145) : error C2027:
use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>'
with
[
x=false
]
c:\Perforce\Development\Web\cppinclude\domestic\Application
Framework\State Machine Engine\StringSerializer.h(143) : see reference
to class template instantiation
'sme::StringSerializer<_StringType,>::StringWriter<<template
parameter>>' being compiled
c:\Perforce\Development\Web\cppinclude\domestic\Application
Framework\State Machine Engine\StringSerializer.h(169) : see reference
to class template instantiation 'sme::StringSerializer<_StringType,>'
being compiled
I believe that the data type is integral, and is complete at compile
time. Any known reason why this would happen?
Randy Bowen
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net