On 04/25/2018 03:04 PM, Jonathan Wakely wrote: > On 25/04/18 14:59 +0100, Andrew Haley wrote: >> On 04/25/2018 02:56 PM, Jason Merrill wrote: >>> The warning by default seems sufficient to me. >> >> Yes. We've been bitten by this a few times, with mysterious crashes. >> I'm not sure it even makes sense only to be a warning, but I guess >> that's up to the C++ TC. > > It's not always possible for the compiler to prove that flowing off > the end never happens, even if the program state ensures that it can't > (e.g. by all callers enforcing the function's preconditions > correctly). So making it ill-formed is deemed too draconian whenever > this gets discussed.
Sure. Having said that, the cases that bit me were those where control always flowed off the end, i.e. the function contained no return statement. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. <https://www.redhat.com> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671