gcc error message and Boost.static_assert

Jim Wilson wilson@specifixinc.com
Wed Apr 28 08:00:00 GMT 2004


Vladimir Prus wrote:
> ghost@zigzag:/tmp$ g++-3.2 -I ~/Work/boost static_assert.cpp
> static_assert.cpp: In function `int main()':
> static_assert.cpp:6: `sizeof' applied to incomplete type `
>    boost::STATIC_ASSERTION_FAILURE<false>'
> 
> ghost@zigzag:/tmp$ g++-3.3 -I ~/Work/boost static_assert.cpp
> static_assert.cpp: In function `int main()':
> static_assert.cpp:6: error: invalid application of `sizeof' to an incomplete
>    type

What happened is that we used to have different sizeof code for the C 
and C++ front ends, each of which had a different set of bugs.  The code 
was commonized, which improved the situation a bit.
   http://gcc.gnu.org/ml/gcc-patches/2002-07/msg01110.html
The resulting common code uses the error message that was emitted by the 
C front end, which did not include the type.  Thus the C++ front end no 
longer included the type in the error message.

Since C++ code can be obscure at times, especially when templates are 
used, it might be reasonable to readd the type info.  I am not a C++ 
expert, and I know nothing of boost, so I don't know how much sense this 
makes.

You might want to submit a bug report into our bugzilla bug database. 
We do not track problems reported by mail.  Putting it in bugzilla will 
ensure that you get an answer of some sort.  See
   http://gcc.gnu.org/bugs.html
for info on reporting bugs.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list