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

            Bug ID: 88731
           Summary: Rejects well-formed program using bit-fields in
                    _Generic.
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

Test case (prog.c):

  int main()
  {
    struct S { unsigned x:4; } s;

    _Generic(s.x, unsigned: 0);
  }

Compilation command line:

  gcc prog.c -Wall -Wextra -std=c11 -pedantic-errors

Observed behaviour:

  The following error message is outputed:

    error: '_Generic' selector of type 'unsigned char:4' is not compatible
           with any association

Expected behaviour:

  No error message outputed.

  See http://www.open-std.org/Jtc1/sc22/wg14/www/docs/summary.htm#dr_481:

    "... It was noted that bitfields are of integer type. ..."

Note:

  Clang accepts the program without any error message.

Reply via email to