Request for a C++ warning for undefined behaviour
Michael Matz
matz@suse.de
Wed Aug 13 13:13:00 GMT 2003
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.
More information about the Gcc
mailing list