The following:
#include <stddef.h>
void test(void)
{
size_t s1 = sizeof(test);
size_t s2 = sizeof(void (void));
}
should not compile with -std=c99. According to the C99 standard section
6.5.3.4.1 "The sizeof operator shall not be applied to an expression that has
function type or an incomplete type, to the parenthesized name of such a type,
or to an expression that designates a bit-field member."
I would expect gcc to produce an error in this case. sizeof actually
returns 1 and no error.
--
Summary: front end does not reject sizeof on function types
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bje at gcc dot gnu dot org
GCC host triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39134