<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 --- - Warn about overload resolution with forward-declared types?"
href="https://llvm.org/bugs/show_bug.cgi?id=25350">25350</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Warn about overload resolution with forward-declared types?
</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>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>hans@chromium.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, nicolasweber@gmx.de
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Consider the following:
s.h:
struct S {};
struct T : S {};
a.cc:
#if X
// Forward declarations, for speed:
struct S;
struct T;
#else
// Just include it, for clarity:
#include "s.h"
#endif
void f(void*);
void f(S*);
void surprise(T *t) { f(t); } // Which f gets called?
Depending on the value of X, i.e. whether we're including s.h or forward
declaring S and T, the call in surprise() will be bound to a different
function.
Could we warn that overload resolution for the call to f is based on an
incomplete type?
(Inspired by an example from:
<a href="http://google.github.io/styleguide/cppguide.html#Forward_Declarations">http://google.github.io/styleguide/cppguide.html#Forward_Declarations</a>)</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>