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

            Bug ID: 20521
           Summary: Broken symbol visibility on explicit template
                    instantiation
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Created attachment 12850
  --> http://llvm.org/bugs/attachment.cgi?id=12850&action=edit
failcase

Clang fails to build a binary in attached case with error message below:
>failcase_main.o:failcase_main.cc:function main: error: undefined reference to 
>'Failcase<Bar<int> >::~Failcase()'
>failcase_main.o:failcase_main.cc:function Failcase<Bar<int> >::Failcase(): 
>error: undefined reference to 'vtable for Failcase<Bar<int> >'

GCC successfully build the binary, and it emits ~Failcase() to libfailcase.so
as a WEAK DEFAULT symbol, while clang emits it as a LOCAL HIDDEN symbol
according to readelf -sW.

In addition, attached repro case is very fragile.
If I replace an "unsigned int" with "int", reorder the function definition or
removing no-op function call in the failcase.h,
it no longer reproduces the failure, and clang emits WEAK DEFAULT symbol to
libfailcase.so for ~Failcase().

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to