[Bug middle-end/100394] wrong-code with EH and pure/const functions
matz at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon May 3 14:23:27 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100394
Michael Matz <matz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|3.4.6, 4.3.5 |
CC| |matz at gcc dot gnu.org
--- Comment #3 from Michael Matz <matz at gcc dot gnu.org> ---
That's simply invalid C++. A rethrow (which is what a 'throw' without value
is)
can only be done from within a catch. You need to throw a value:
...
int __attribute__((pure,noinline)) foo () { if (x) throw 42; return y; }
...
More information about the Gcc-bugs
mailing list