This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/38563] New: sizeof(void) not diagnosed


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]