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

            Bug ID: 107348
           Summary: documentation: __builtin_classify_type() undocumented
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: colomar.6.4.3 at gmail dot com
  Target Milestone: ---

I can't find any documentation about `__builtin_classify_type()`.

Moreover, it behaves weird with arrays.

$ grepc type_class
./gcc/typeclass.h:30:
enum type_class
{
  no_type_class = -1,
  void_type_class, integer_type_class, char_type_class,
  enumeral_type_class, boolean_type_class,
  pointer_type_class, reference_type_class, offset_type_class,
  real_type_class, complex_type_class,
  function_type_class, method_type_class,
  record_type_class, union_type_class,
  array_type_class, string_type_class,
  lang_type_class, opaque_type_class
};


One would expect that for arrays, it would return `array_type_class`, i.e.,
`14`, but it returns `5`, i.e., `pointer_type_class`.

alx@debian:~/tmp$ cat ptr.c 
#include <stdio.h>

int
main(void)
{
        int a[5];

        printf("%d\n", __builtin_classify_type(a));
}
alx@debian:~/tmp$ cc -Wall -Wextra ptr.c 
alx@debian:~/tmp$ ./a.out 
5

Please document the builtin (and also fix the handling of arrays).

Reply via email to