<html>
<head>
<base href="http://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 --- - The sizeof operator shall not be applied directly to a function"
href="http://llvm.org/bugs/show_bug.cgi?id=16872">16872</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>The sizeof operator shall not be applied directly to a function
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ruslan_baratov@yahoo.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>C++ 2003 standard forbid sizeof operator to function, 5.3.3, [expr.sizeof]:
<span class="quote">> 3. The sizeof operator can be applied to a pointer to a function, but shall not be applied directly to a function.
> 4. The lvalue-to-rvalue (4.1), array-to-pointer (4.2), and function-to-pointer (4.3) standard conversions are not applied to the operand of sizeof.</span >
This simple example:
void func() {
}
int main() {
return sizeof(func);
}
produce error C2070: 'void (void)': illegal sizeof operand with MSVC 2012
compiler,
g++ (4.7.3) give error: ISO C++ forbids applying 'sizeof' to an expression of
function type
but no error from clang</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>