[LLVMbugs] [Bug 13485] New: Templates mess up return type covariance analysis

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 30 18:15:22 PDT 2012


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

             Bug #: 13485
           Summary: Templates mess up return type covariance analysis
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: clangbugs.sxeraverx at spamgourmet.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8966
  --> http://llvm.org/bugs/attachment.cgi?id=8966
failing test case

test.cpp:9:15: error: return type of virtual function 'foo' is not covariant
      with the return type of the function it overrides ('C *' is not derived
      from 'A *')
  virtual TC *foo() {return this;};
              ^
test.cpp:12:18: note: in instantiation of template class 'B<C>' requested here
class C : public B<C>
                 ^
test.cpp:4:14: note: overridden virtual function is here
  virtual A* foo()=0;
             ^
1 error generated.


C is derived from A through B<C>

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