[LLVMbugs] [Bug 19222] New: Clang is redefining std::string's _S_construct at -Os

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 21 11:08:08 PDT 2014


            Bug ID: 19222
           Summary: Clang is redefining std::string's _S_construct at -Os
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: heavenandhell171 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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
multiple definition of `char* std::string::_S_construct<char*>(char*, char*,
std::allocator<char> const&, std::forward_iterator_tag)'
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)

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140321/fc3f9014/attachment.html>

More information about the llvm-bugs mailing list