<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 --- - GCC and Clang disagree on symbol mangling"
   href="https://llvm.org/bugs/show_bug.cgi?id=24794">24794</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>GCC and Clang disagree on symbol mangling
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>steven@uplinklabs.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14871" name="attach_14871" title="test case">attachment 14871</a> <a href="attachment.cgi?id=14871&action=edit" title="test case">[details]</a></span>
test case

Running Clang 3.6.2.

I have some C++ code that fails to link because Clang and GCC are coming up
with different symbol mangling for some specific symbols in some of the
dependent libraries. I managed to come up with a small test case that
illustrates the issue (it's probably not fully reduced). I've attached it to
this bug report.

$ g++ -c test.cpp; nm -C test.o; nm test.o
+ g++ -c test.cpp
+ nm -C test.o
0000000000000000 T bar(foo::V&, int&, int*)
                 U baz::enable_if<!baz::is_enum<int>::value, void>::type
baz::Conv<int>(int&, int*)
                 U baz::enable_if<!baz::is_enum<foo::V>::value, void>::type
baz::Conv<foo::V>(foo::V&, int*)
+ nm test.o
0000000000000000 T _Z3barRN3foo1VERiPi
                 U
_ZN3baz4ConvIiEENS_9enable_ifIXntsrNS_7is_enumIT_EE5valueEvE4typeERS3_Pi
                 U
_ZN3baz4ConvIN3foo1VEEENS_9enable_ifIXntsrNS_7is_enumIT_EE5valueEvE4typeERS5_Pi


$ clang++ -c test.cpp; nm -C test.o; nm test.o
+ clang++ -c test.cpp
test.cpp:65:1: warning: control reaches end of non-void function
[-Wreturn-type]
}
^
1 warning generated.
+ nm -C test.o
0000000000000000 T bar(foo::V&, int&, int*)
                 U
_ZN3baz4ConvIiEENS_9enable_ifIXntsr7is_enumIT_EE5valueEvE4typeERS2_Pi
                 U
_ZN3baz4ConvIN3foo1VEEENS_9enable_ifIXntsr7is_enumIT_EE5valueEvE4typeERS4_Pi
+ nm test.o
0000000000000000 T _Z3barRN3foo1VERiPi
                 U
_ZN3baz4ConvIiEENS_9enable_ifIXntsr7is_enumIT_EE5valueEvE4typeERS2_Pi
                 U
_ZN3baz4ConvIN3foo1VEEENS_9enable_ifIXntsr7is_enumIT_EE5valueEvE4typeERS4_Pi


Note that the Clang-mangled symbol cannot be demangled by c++filt or nm.

Any ideas?</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>