LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 13364 - unknown type name 'type_info'
Summary: unknown type name 'type_info'
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: C++ (show other bugs)
Version: 3.1
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-15 03:51 PDT by wbrana
Modified: 2013-07-24 16:55 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wbrana 2012-07-15 03:51:44 PDT
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*
Comment 1 Richard Smith 2012-07-15 20:22:08 PDT
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.
Comment 2 Steven R. Loomis 2013-07-24 16:00:36 PDT
(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
Comment 3 Steven R. Loomis 2013-07-24 16:26:46 PDT
(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++?
Comment 4 Richard Smith 2013-07-24 16:55:02 PDT
(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.