<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 --- - Void expression address does not generate an error (C only)"
href="http://llvm.org/bugs/show_bug.cgi?id=21724">21724</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Void expression address does not generate an error (C only)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</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>hamsa.bugs@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This compiles without warnings:
extern void foo; // 1
int main()
{
&foo; // 2
}
(1) The validity of the `foo` declaration is questionable. There is no apparent
direct prohibition in the standard to declare (as opposed to define) void
objects, but as one cannot define a `void` object, it is not clear how such a
declaration could refer to a valid object. Apart from that, the declared
identifier cannot be used in any way.
(2) The expression appears to be outright invalid, because of 6.3.22.1/1 (in
C11):
An lvalue is an expression (with an object type other than void) that
potentially designates an object;
Thus `foo` is not an lvalue, nor it is a function designator, so its address
cannot be taken.
To reiterate, all of this applies to the C front-end only.</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>