This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/38563] New: sizeof(void) not diagnosed
- From: "derek at knosof dot co dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Dec 2008 01:07:35 -0000
- Subject: [Bug c/38563] New: sizeof(void) not diagnosed
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
void f(void)
{
void *p;
sizeof(*p);
sizeof(void);
}
The above code contains a constraint violation. gcc does not currently flag
this as a constraint. Using the -pedantic option causes a warning to be
generated.
"The sizeof operator shall not be applied to an expression that has function
type or an incomplete type"
sentence 1118: c0x.coding-guidelines.com/6.5.3.4.html
"void ... it is an incomplete type that cannot be completed..."
sentence 524: c0x.coding-guidelines.com/6.2.5.html
--
Summary: sizeof(void) not diagnosed
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: derek at knosof dot co dot uk
GCC host triplet: Linux 2.6.22.5
GCC target triplet: Linux 2.6.22.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38563