public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem with 'static asserts' in gcc-3.3.1 --- error messages have less detail.
@ 2003-08-27 16:09 Warren_Baird
  2003-08-28 17:23 ` Andrea 'fwyzard' Bocci
  0 siblings, 1 reply; 2+ messages in thread
From: Warren_Baird @ 2003-08-27 16:09 UTC (permalink / raw)
  To: gcc-help




Hi all,

Recently I borrowed a trick from the Boost toolkit's static_assert.hpp to force
developers to not use certain functions -  I defined bodyless structs who's name
contains the message I want to give, and then take the sizeof that struct.
Something like:

struct ERROR___Please_use_bar_instead_of_foo;
#define foo(x) sizeof(ERROR___Please_use_bar_instead_of_foo)

With MSCV 6 and 7, and gcc 3.2 and earlier, you get a message like:
testErrors.cpp:14: `sizeof' applied to incomplete type `
   ERROR___Please_use_bar_instead_of_foo'

which is perhaps not perfect, but it gets the message across.   Unfortunately
with gcc-3.3.1 the C compiler does the right thing, but the C++ compiler just
says:

testErrors.cpp:14: error: invalid application of `sizeof' to an incomplete type

Which isn't particularly useful...

Does anyone have any idea why this was changed, or if there is any way to
restore the old error messages?  I was half-way tempted to report this as a
bug...

Failing that - does any one have any other suggestions of ways to do this?

Thanks,

Warren.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problem with 'static asserts' in gcc-3.3.1 --- error messages have less detail.
  2003-08-27 16:09 Problem with 'static asserts' in gcc-3.3.1 --- error messages have less detail Warren_Baird
@ 2003-08-28 17:23 ` Andrea 'fwyzard' Bocci
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea 'fwyzard' Bocci @ 2003-08-28 17:23 UTC (permalink / raw)
  To: Warren_Baird, gcc-help

At 11:55 27/08/2003 -0400, Warren_Baird@cimmetry.com wrote:

>[...]
>
>Does anyone have any idea why this was changed, or if there is any way to
>restore the old error messages?  I was half-way tempted to report this as a
>bug...

I think this happens because C++ now uses a new preprocessor, so it's not a 
bug. Maybe a feature...
But, you can post a bug report asking for the old functionality back.

.fwyzard. 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-08-28 17:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-27 16:09 Problem with 'static asserts' in gcc-3.3.1 --- error messages have less detail Warren_Baird
2003-08-28 17:23 ` Andrea 'fwyzard' Bocci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).