[LLVMbugs] [Bug 12714] New: undefined references to class template methods when visibility is used

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 1 07:35:39 PDT 2012


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: unassignedclangbugs at nondot.org
        ReportedBy: s.wezel at web.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.



More information about the llvm-bugs mailing list