With "-flto -g", the following source will bail out with an internal compiler error:
void bug() { struct Class { Class(int a) {} virtual void f() {} }; Class a(0); } Command line: g++-4.5 -g -flto bug.cxx Error message: bug.cxx: In member function 'bug()::Class::f()': bug.cxx:4:23: internal compiler error: tree check: expected class 'type', have 'declaration' (function_decl) in gen_type_die_with_usage, at dwarf2out.c:18962 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions. Compiler version: gcc version 4.5.1 20100419 (prerelease) (Debian 4.5.0-2) -- Summary: -flto -g: "tree check: expected class 'type', have 'declaration'" Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: max at duempel dot org GCC build triplet: x86_64-linux-gnu GCC host triplet: x86_64-linux-gnu GCC target triplet: x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43898