[LLVMbugs] [Bug 7410] New: Bad return type causes extra "abstract class" error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 18 10:28:48 PDT 2010


           Summary: Bad return type causes extra "abstract class" error
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: quality-of-implementation
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

$ cat test.cc
struct BaseReturn {};

struct Base {
  virtual BaseReturn Foo() = 0;
struct X {};  // Get a second test case by deleting this line.
struct Derived : Base {
  X Foo();

Derived d;
$ ./clang++ -fsyntax-only test.cc
test.cc:8:5: error: virtual function 'Foo' has a different return type ('X')
than the function it overrides (which has return type 'BaseReturn')
  X Foo();
test.cc:4:22: note: overridden virtual function is here
  virtual BaseReturn Foo() = 0;
test.cc:11:9: error: variable type 'Derived' is an abstract class
Derived d;
test.cc:4:22: note: pure virtual function 'Foo'
  virtual BaseReturn Foo() = 0;
2 errors generated.

Clang knows that we were trying to override the abstract method, so it
shouldn't later complain that it wasn't overridden.  There's a similar problem
if X simply doesn't exist.

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