http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49027
Summary: g++ ignores -fno-exceptions in uninstantiated template Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: i...@airs.com This file compiles without error when using -fno-exceptions: extern int f2(); template<typename T> void f1() { try { f2(); } catch (...) { } } Compiling this very similar file: extern int f2(); template<typename T> void f1() { try { f2(); } catch (...) { } } template f1<int>(); gives these errors: foo.cc: In function ‘void f1() [with T = int]’: foo.cc:6: instantiated from here foo.cc:4: error: exception handling disabled, use -fexceptions to enable I think it would be more consistent for g++ to reject uses of try/catch when compiling with -fno-exceptions even in uninstantiated templates. Otherwise you can get surprising results when code changes: you can find problems in very different pieces of code.