<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Clang incorrectly rejects pointers-to-incomplete-classes as covariant return types when dropping cv-qualifiers"
href="https://llvm.org/bugs/show_bug.cgi?id=26297">26297</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang incorrectly rejects pointers-to-incomplete-classes as covariant return types when dropping cv-qualifiers
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sfinae@hotmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=15709" name="attach_15709" title="Minimal self-contained repro">attachment 15709</a> <a href="attachment.cgi?id=15709&action=edit" title="Minimal self-contained repro">[details]</a></span>
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 <a href="http://melpon.org/wandbox/">http://melpon.org/wandbox/</a> ) 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;
^</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>