clang++ -o main.o -c -O3 -DQT_NO_DEBUG -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-exceptions -fno-stack-protector --param max-inline-insns-single=32 --param max-inline-insns-auto=32 -w -funroll-loops --param max-unrolled-insns=32 -march=native -std=c++0x -DQT_SHARED -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtSql main.cpp In file included from main.cpp:1: In file included from ./a.h:4: In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/include/g++-v4/typeinfo:35: In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/include/g++-v4/exception:150: /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/include/g++-v4/exception_ptr.h:132:13: error: unknown type name 'type_info' const type_info*
Yeah, this is a bug in (at least) libstdc++ 4.4 and 4.5 in C++11 mode. You can work around it by adding this before you include any standard library header: namespace std { struct type_info; } This is arguably common enough that it'd be worth adding a hack to clang to implicitly declare type_info if it's used from a system header and hasn't been declared yet.
(In reply to comment #1) > Yeah, this is a bug in (at least) libstdc++ 4.4 and 4.5 in C++11 mode. You > can work around it by adding this before you include any standard library > header: > > namespace std { struct type_info; } > > This is arguably common enough that it'd be worth adding a hack to clang to > implicitly declare type_info if it's used from a system header and hasn't > been declared yet. I found that namespace std { class type_info; } worked arond it. clang trunk, RHEL 6.4, gcc/libstdc++ 4.4.7
(In reply to comment #2) > clang trunk, RHEL 6.4, gcc/libstdc++ 4.4.7 trunk meaning r185900 This affected ICU, filed a downstream ticket.. http://bugs.icu-project.org/trac/ticket/10272 Should there be an upstream ticket against libstdc++?
(In reply to comment #3) > Should there be an upstream ticket against libstdc++? This is already fixed in libstdc++4.6. I'm not sure if the GCC folks are still doing patch releases for 4.5 and earlier. Note that http://clang.llvm.org/cxx_status.html has links to patches to fix bugs in libstdc++ that are discovered by Clang.