------- Comment #57 from mark at codesourcery dot com 2008-09-24 13:03 ------- Subject: Re: exception_defines.h #defines try/catch
jason at gcc dot gnu dot org wrote: > ------- Comment #55 from jason at gcc dot gnu dot org 2008-09-23 20:43 > ------- > It seems reasonable to me for try { X } catch... to mean X when > -fno-exceptions. We don't need to error except on throw. We have to be careful, in some cases. For example: extern int f(); template <typename T> struct S { static int i; }; template <typename T> int S<T>::i = f(); int main() { try { return 0; } catch (...) { return S<int>::i; } } This program, IIRC, is guaranteed to call "f", as a side-effect of the presence of the catch-clause? Of course, the C++ FE could still process the "catch" clause; my only point is that we cannot literally just throw away the catch clause. I don't objection to -fno-exceptions silently discarding catch clauses, as long as we avoid the kind of problem above. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25191