[Bug c/70753] New: missing diagnostic in C11 mode: sizeof, _Alignof of function type

fw at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 21 14:22:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70753

            Bug ID: 70753
           Summary: missing diagnostic in C11 mode: sizeof, _Alignof of
                    function type
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fw at gcc dot gnu.org
  Target Milestone: ---

GCC accepts this code, but sizeof of a function type is invalid in C11 (and
likely earlier).  It is a documented extension for GNU mode, but it is also
accepted with -std=c11.

#include <stdio.h>

int
f (int a, int b)
{
  return a + b;
}

int
main (void)
{
  printf ("%zu\n", sizeof (*f));
  printf ("%zu\n", _Alignof (*f));
  return 0;
}

The pedantic warning should be an error in C11 mode.


More information about the Gcc-bugs mailing list