[llvm-bugs] [Bug 30820] New: Linker error: undefined reference to `std::vector<...>::~vector()

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 28 06:42:26 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30820

            Bug ID: 30820
           Summary: Linker error: undefined reference to
                    `std::vector<...>::~vector()
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: serguei.kolos at cern.ch
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Hi

I have recently encountered the problem of compiling some code which uses
std::vector class. Here is the minimal example which reproduces the problem:

#include <vector>

template <typename I>
void f(I i, const std::vector<int> & v = { 1, 2, 3}) {
}

int main(int , char**) {
  f(1);
}

Here is the compiler output:

:> clang++ -std=c++14 t.cc
/tmp/kolos/ttt-460d3b.o: In function `main':
ttt.cc:(.text+0x61): undefined reference to `std::vector<int,
std::allocator<int> >::~vector()'
ttt.cc:(.text+0x92): undefined reference to `std::vector<int,
std::allocator<int> >::~vector()'
clang-3.9: error: linker command failed with exit code 1 (use -v to see
invocation)

Here are the system and compiler details

:> clang++ -v
clang version 3.9.0 (tags/RELEASE_390/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /external/llvm/3.9/x86_64-slc6/bin
Found candidate GCC installation:
/contrib/gcc/4.9/x86_64-slc6/lib/gcc/x86_64-unknown-linux-gnu/4.9.3
Selected GCC installation:
/contrib/gcc/4.9/x86_64-slc6/lib/gcc/x86_64-unknown-linux-gnu/4.9.3
Candidate multilib: .;@m64
Selected multilib: .;@m64


:> uname -a
Linux 2.6.32-642.6.1.el6.x86_64 #1 SMP Wed Oct 5 16:49:07 CEST 2016 x86_64
x86_64 x86_64 GNU/Linux

-- 
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/20161028/57576828/attachment.html>


More information about the llvm-bugs mailing list