<html>
    <head>
      <base href="http://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 --- - Clang is redefining std::string's _S_construct at -Os"
   href="http://llvm.org/bugs/show_bug.cgi?id=19222">19222</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang is redefining std::string's _S_construct at -Os
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>heavenandhell171@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm having problems with wxWidgets (static library) built with Clang (trunk +
Mingw-w64 4.8.2). The build of wxWidgets went fine, the problem is when i try
to link against it.

The wxWidgets -Os build doesn't work with static libstdc++. I get a "multiple
definition of `char* std::string::_S_construct<char*>(char*, char*,
std::allocator<char> const&, std::forward_iterator_tag)'" error.

The -O2/-O3 build works fine.

Here's a litle test case:

$ cat > Test.cpp
#include <string>
#include <sstream>

// This is a stripped version of the wxWidgets method.
std::string FromCDouble(double val, int precision) {
  std::ostringstream os;
  os << val;
  return os.str();
}

int main() {
  return 0;
}

$ clang++ -Os Test.cpp -std=c++11 -static
c:/dev/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../lib\libstdc++.a(string-inst.o):(.text$_ZNSs12_S_constructIPcEES0_T_S1_RKSaIcESt20forward_iterator_tag[__ZNSs12_S_constructIPcEES0_T_S1_RKSaIcESt20forward_iterator_tag]+0x0):
multiple definition of `char* std::string::_S_construct<char*>(char*, char*,
std::allocator<char> const&, std::forward_iterator_tag)'
C:\Dev\MSys2\tmp\Test2-525d5d.o:(.text[__ZNSs12_S_constructIPcEES0_T_S1_RKSaIcESt20forward_iterator_tag]+0x0):
first defined here
collect2.exe: error: ld returned 1 exit status
clang++.exe: error: linker (via gcc) command failed with exit code 1 (use -v to
see invocation)</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>