[LLVMbugs] [Bug 9325] New: virtual methods of template class not instanciated under specific conditions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 25 08:43:33 PST 2011


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

           Summary: virtual methods of template class not instanciated
                    under specific conditions
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: frrrwww at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=6234)
 --> (http://llvm.org/bugs/attachment.cgi?id=6234)
test case as a file for convenience

mawww at bonheur ~/tmp/clang $ cat test.cpp 
template<typename T>
class Target
{
public:
    virtual int Value() const
    {
        return 0;
    }
};

template<typename T>
struct Provider
{
    static Target<T> Instance;
};

template<typename T>
Target<T> Provider<T>::Instance;

int main()
{
    Target<int>* traits = &Provider<int>::Instance;
}
mawww at bonheur ~/tmp/clang $ clang++ test.cpp 
/tmp/cc-QPIfS9.o:(.rodata._ZTV6TargetIiE[_ZTV6TargetIiE]+0x10): undefined
reference to `Target<int>::Value() const'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

-- 
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