[llvm-bugs] [Bug 26297] New: Clang incorrectly rejects pointers-to-incomplete-classes as covariant return types when dropping cv-qualifiers
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jan 25 14:19:39 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26297
Bug ID: 26297
Summary: Clang incorrectly rejects
pointers-to-incomplete-classes as covariant return
types when dropping cv-qualifiers
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: sfinae at hotmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 15709
--> https://llvm.org/bugs/attachment.cgi?id=15709&action=edit
Minimal self-contained repro
struct Incomplete;
struct Base {
virtual const Incomplete * meow() = 0;
};
struct Derived : Base {
virtual Incomplete * meow() override { return nullptr; }
};
int main() { }
/*** N4567 10.3 [class.virtual]/8:
"If the class type in the covariant return type of D::f differs from that of
B::f,
the class type in the return type of D::f shall be complete at the point of
declaration of D::f
or shall be the class type D." ***/
Accepted by GCC 5.2.0, VS 2015, and EDG 4.10.1.
Rejected by Clang 3.7.0 (and trunk on http://melpon.org/wandbox/ ) with:
prog.cc:8:26: error: return type of virtual function 'meow' is not covariant
with the return type of the function it overrides ('Incomplete' is incomplete)
virtual Incomplete * meow() override { return nullptr; }
^
prog.cc:1:8: note: forward declaration of 'Incomplete'
struct Incomplete;
^
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160125/9eb027ce/attachment.html>
More information about the llvm-bugs
mailing list