<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Incorrect typeinfo symbol visibility when using C++ STL containers"
   href="https://llvm.org/bugs/show_bug.cgi?id=26749">26749</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect typeinfo symbol visibility when using C++ STL containers
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jeffrey.diclemente@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang version used:

clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

Mac OS X version: 10.10.5 (Yosemite)


Reproducible test case:

//test_typeinfo_symbols.cpp
#include <typeinfo>
#include <map>
#include <string>

int main(int, char**)
{
    std::map<std::string, int>::const_iterator ci;
    const std::type_info& t = typeid(std::map<std::string, std::string>);
    (void)t;
    return 0;
}

Reproduction steps:

build test_typeinfo_symbols.cpp using:
clang -fvisibility=hidden -isysroot
/Applications/Xcode6.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
-stdlib=libc++ -c test_typeinfo_symbols.cpp

run nm against the .o:
nm -om test_typeinfo_symobls.o | c++filt

nm should output the following:
test_typeinfo_symbols.o: 00000000000000c8 (__DATA,__datacoal_nt) weak private
external typeinfo for std::__1::map<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > >,
std::__1::allocator<std::__1::pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > > > >
test_typeinfo_symbols.o: 0000000000000050 (__TEXT,__const_coal) weak private
external typeinfo name for std::__1::map<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > >,
std::__1::allocator<std::__1::pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > > > >
test_typeinfo_symbols.o:                  (undefined) external vtable for
__cxxabiv1::__class_type_info
test_typeinfo_symbols.o: 0000000000000000 (__TEXT,__text) private external
_main


Now modify test_typeinfo_symbols.cpp to:
//test_typeinfo_symbols.cpp
#include <typeinfo>
#include <map>
#include <string>

int main(int, char**)
{
    const std::type_info& t = typeid(std::map<std::string, std::string>);
    (void)t;
    std::map<std::string, int>::const_iterator ci;
    return 0;
}

build test_typeinfo_symbols.cpp using:
clang -fvisibility=hidden -isysroot
/Applications/Xcode6.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
-stdlib=libc++ -c test_typeinfo_symbols.cpp

run nm against the .o:
nm -om test_typeinfo_symobls.o | c++filt

nm should output the following:
test_typeinfo_symbols.o: 00000000000000c8 (__DATA,__datacoal_nt) weak external
typeinfo for std::__1::map<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > >,
std::__1::allocator<std::__1::pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > > > >
test_typeinfo_symbols.o: 0000000000000050 (__TEXT,__const_coal) weak external
typeinfo name for std::__1::map<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > >,
std::__1::allocator<std::__1::pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > > > >
test_typeinfo_symbols.o:                  (undefined) external vtable for
__cxxabiv1::__class_type_info
test_typeinfo_symbols.o: 0000000000000000 (__TEXT,__text) private external
_main

now the typeinfo is weak external, instead of weak private external.

Why does the order in which the std::map<std::string, int>::const_iterator
appears in the source file change the typeinfo symbol visibility of a different
type? 
This seems like a bug.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>