[LLVMbugs] [Bug 21724] New: Void expression address does not generate an error (C only)
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Dec 3 01:32:09 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=21724
Bug ID: 21724
Summary: Void expression address does not generate an error (C
only)
Product: clang
Version: 3.4
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: hamsa.bugs at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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.
--
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/20141203/6f0f4d0c/attachment.html>
More information about the llvm-bugs
mailing list