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

           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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


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

Reply via email to