This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Request for a C++ warning for undefined behaviour
- From: Michael Matz <matz at suse dot de>
- To: skaller <skaller at ozemail dot com dot au>
- Cc: gcc at gcc dot gnu dot org, Mark Mitchell <mark at codesourcery dot com>
- Date: Wed, 13 Aug 2003 14:40:06 +0200 (CEST)
- Subject: Re: Request for a C++ warning for undefined behaviour
Hi,
On 13 Aug 2003, skaller wrote:
> The code exhibited appears quite perverted to me ..
It's a constructed example. Hence it is natural that it of course shows
the error quite clearly. Everything else wouldn't be a good testcase.
Like I said, here it is indeed obvious. It was not in the original case.
> > See above. That's not enough. One would have to go for instance through
> > a normal file-static function.
>
> No, you can use a pointer, even this. Then the call is dispatched.
Sure. There are multiple methods of hiding this error. I just said, that
wrapping by a non-virtual member is not enough, as that already invokes
undefined behaviour.
> If I have to calculate something to initialise a base (which cannot be
> assigned in a ctor body) I *definitely* have a design fault.
Okay, so with your all-singing-all-dancing design you'll never see the
hypothetical error message. Good. What are you arguing then exactly?
Ciao,
Michael.