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: [email protected]
Reporter: [email protected]
CC: [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs