This (invalid) code gives a nice error message with gcc 3.3.3, but fails with an ICE on 3.4.3. Using the correct ex.what() syntax fixes the problem.
#include <iostream> #include <exception> template<class T> void f() { try { } catch(std::exception& ex) { std::cout << ex.what << std::endl; } } int main() { f<int>(); } t.cc: In function `void f()': t.cc:10: internal compiler error: in resolve_overloaded_unification, at cp/pt.c:9331 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. -- Summary: ice during overload resolution in template instantiation Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jens dot maurer at gmx dot net CC: gcc-bugs at gcc dot gnu dot org,niemayer at isg dot de GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18445