This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: missing return statement
James Dennett <james.dennett@gmail.com> writes:
> This appears to be a difference between C and C++. Unfortunate.
> 6.6.3 [stmt.return]/2 of N2800 says "Flowing off the end of a function
> is equivalent to a return with no value; this results in undefined
> behavior in a value-returning function."
Since it's merely undefined behavior the compiler cannot reject it,
because if the function is never called the undefined behavior does not
happen.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."