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

             Bug #: 12714
           Summary: undefined references to class template methods when
                    visibility is used
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


Created attachment 8480
  --> http://llvm.org/bugs/attachment.cgi?id=8480
sample project for the bug

I don't know if this is really a bug in clang or not.
But the attached samples compiles fine with gcc (4.6.1)

I have a class template "Manager" from which the class "IntManager" inherits.
this class is compiled into a lib named lib1.

// class template 
template <class AType> class Manager {
    public:
    virtual bool Init();
    virtual bool DeInit();
    protected:
    Manager();
    virtual ~Manager();

    protected:
    AType *m_pElement;
};

// inherited class which gets compiled int lib1
class IntManager : public Manager<int> {
    public:
    LIB1_API_EXPORT IntManager();

    LIB1_API_EXPORT virtual ~IntManager();
};


Another class "AdvIntManager" (compiled into another shared lib called lib2)
inherits from "IntManager"

class AdvIntManager : public IntManager {
    public:
    LIB2_API_EXPORT AdvIntManager();

    LIB2_API_EXPORT virtual ~AdvIntManager();
};

whenn lib2 gets compiled with following additional LDFLAG: -Wl,--no-undefined
the linker generates following error:

AdvIntManager.o:(.data.rel.ro+0x10): undefined reference to
`Manager<int>::Init()'
AdvIntManager.o:(.data.rel.ro+0x18): undefined reference to
`Manager<int>::DeInit()'

As i already sad i don't know if this is a bug in clang in conjunction with the
visibility feature or an non standard usage.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to