[cfe-commits] r103208 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGenCXX/template-linkage.cpp

Rafael Espindola espindola at google.com
Fri May 7 08:50:47 PDT 2010


On 6 May 2010 19:13, Douglas Gregor <dgregor at apple.com> wrote:
> Author: dgregor
> Date: Thu May  6 18:13:35 2010
> New Revision: 103208
>
> URL: http://llvm.org/viewvc/llvm-project?rev=103208&view=rev
> Log:
> Do not give implicitly-defined virtual members functions
> available_externally linkage, since they may not have been given a
> strong definition in another translation unit. Without this patch, the
> following test case fails to link with a GCC-compiled libstdc++:
>
>  #include <sstream>
>  int main() { std::basic_stringbuf<char> bs; }

I am able to link this with your patch reverted. What is the link
error you were getting? I also tested a newer gcc with

template<typename T>
struct X0 {
  virtual ~X0() { }
};
template<typename T>
struct X1 : X0<T> {
  virtual void blarg();
};
template<typename T> void X1<T>::blarg() { }
template struct X0<char>;
template struct X1<char>;


and it produces weak definitions for

0000000000000000 W _ZN2X0IcED0Ev
0000000000000000 W _ZN2X0IcED1Ev
0000000000000000 W _ZN2X0IcED2Ev
0000000000000000 W _ZN2X1IcED0Ev
0000000000000000 W _ZN2X1IcED1Ev

Cheers,
-- 
Rafael Ávila de Espíndola




More information about the cfe-commits mailing list