[cfe-dev] typeinfo visibility for pointer to incomplete type

Douwe Gelling via cfe-dev cfe-dev at lists.llvm.org
Fri Jan 20 05:15:54 PST 2017


Hi all,

When taking the typeinfo of a pointer to incomplete type, clang++ emits
type info for the pointer in the resulting binary, but makes that typeinfo
non-external (on osx at least). Is this intended? I'd have expected it to
be weak external so that when the type is defined in other compilation
units, the typeinfo isn't defined multiple times.

sample code:

#include <typeinfo>
#include <iostream>
class SomeClass;

int main()
{
  std::cout << typeid(SomeClass*).name() << std::endl;
}

when running nm -m on the resulting binary, it contains:

0000000000000414 (__TEXT,__const) non-external __ZTSP9SomeClass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170120/c4435539/attachment.html>


More information about the cfe-dev mailing list