|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-05-24 10:39:30
This program works as expected with the GNU, Metrowerks, and Microsoft
compilers:
#include <iostream>
#include <boost/static_assert.hpp>
template< typename T >
void f( T & t )
{
std::cout << sizeof(T) << "\n";
BOOST_STATIC_ASSERT( sizeof(T) ); // line in question
}
int main()
{
long l;
f(l);
return 0;
}
With the Borland 5.5.1 and Intel 5.0 compilers, the BOOST_STATIC_ASSERT
fails:
Borland:
Error E2450 c:/boost/site/libs/smart_ptr/test.cpp 8: Undefined structure
'boost:
:STATIC_ASSERTION_FAILURE<4>' in function f<long>(long &)
Error E2109 c:/boost/site/libs/smart_ptr/test.cpp 8: Not an allowed type in
func
tion f<long>(long &)
Intel:
c:/boost/site/libs/smart_ptr/test.cpp(8) : error #70: incomplete type is
not allowed
BOOST_STATIC_ASSERT( sizeof(T) );
^
detected during instantiation of "void f(T &) [with T=long]"
Are these compilers wrong, or is there a problem with BOOST_STATIC_ASSERT?
(Both produce the expected output if the line in question is commented
out.)
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk