[LLVMbugs] [Bug 6883] New: diamond in anonymous namespace fails to link

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 20 13:27:18 CDT 2010


http://llvm.org/bugs/show_bug.cgi?id=6883

           Summary: diamond in anonymous namespace fails to link
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu


This program fails to link:

namespace {
class B1 { };
class VD1 : virtual public B1 { };
class VD2 : virtual public B1 { };
class VD3 : public VD1, public VD2 { };
}

int main(void) {
  VD3 vd3;
}

$ g++ a.cc
$ llvm/Debug/bin/clang++ a.cc
/usr/bin/ld: /tmp/cc-5CadNh.o: in function (anonymous
namespace)::VD3::VD3():a.cc(.text+0x3b): error: undefined reference to
'_ZTTN12_GLOBAL__N_13VD3E1'
/usr/bin/ld: /tmp/cc-5CadNh.o: in function (anonymous
namespace)::VD3::VD3():a.cc(.text+0x73): error: undefined reference to
'_ZTTN12_GLOBAL__N_13VD3E2'
collect2: ld returned 1 exit status
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Excluding the usual stuff, here's what 'nm' on a.out from g++ shows:

00000000004005b8 t _ZN33_GLOBAL__N_a.cc_00000000_6EBD49AD2B1C2Ev
00000000004005c2 t _ZN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD1C2Ev
00000000004005e2 t _ZN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD2C2Ev
0000000000400602 t _ZN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD3C1Ev
00000000004007d0 r _ZTCN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD3E0_NS_3VD1E
00000000004007f0 r _ZTCN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD3E8_NS_3VD2E
0000000000400950 V _ZTIN33_GLOBAL__N_a.cc_00000000_6EBD49AD2B1E
0000000000400860 V _ZTIN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD1E
00000000004008a0 V _ZTIN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD2E
0000000000400820 V _ZTIN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD3E
00000000004009a0 V _ZTSN33_GLOBAL__N_a.cc_00000000_6EBD49AD2B1E
0000000000400920 V _ZTSN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD1E
0000000000400960 V _ZTSN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD2E
00000000004008e0 V _ZTSN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD3E
0000000000400780 r _ZTTN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD3E
0000000000401ea0 B _ZTVN10__cxxabiv117__class_type_infoE
0000000000401e40 B _ZTVN10__cxxabiv121__vmi_class_type_infoE
00000000004007a0 r _ZTVN33_GLOBAL__N_a.cc_00000000_6EBD49AD3VD3E

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the LLVMbugs mailing list