This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to use _Generic with bit-fields
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Wink Saville <wink at saville dot com>
- Cc: Martin Sebor <msebor at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Mon, 22 Feb 2016 21:46:56 +0000
- Subject: Re: How to use _Generic with bit-fields
- Authentication-results: sourceware.org; auth=none
- References: <CAKk8iso7KLotY1WGwaO8FBvp27nFORAWdShqVGth=0Hrc+WVbQ at mail dot gmail dot com> <56C78A87 dot 4090601 at gmail dot com> <CAKk8isoF4gT_z9sscYmnetMZOCkaZUO0Gr9_sj7WQB86PEQxZg at mail dot gmail dot com>
I wonder if ISO C really ought to have a new Constraint "The controlling
expression of a generic selection shall not be an expression that
designates a bit-field member." (so requiring a diagnostic), much like
such expressions being disallowed in sizeof, to reflect the special nature
of bit-fields and their types in C. Or, more weakly, to allow the cbrt
example, "If the controlling expression of a generic selection is an
expression that designates a bit-field member, it is unspecified whether
the type of that expression is considered compatible with any integer
types named in its generic association list.".
--
Joseph S. Myers
joseph@codesourcery.com