[C/C++ PATCH] Handle enum bit-fields for -Wswitch (PR c/61405, PR c/53874)

Jason Merrill jason@redhat.com
Fri Sep 19 15:19:00 GMT 2014


On 09/19/2014 09:29 AM, Marek Polacek wrote:
> -      orig_type = TREE_TYPE (cond);
> +      /* Handle enum bit-fields.  */
> +      tree field;
> +      if (TREE_CODE (cond) == COMPONENT_REF
> +	  && (field = TREE_OPERAND (cond, 1))
> +	  && DECL_BIT_FIELD_TYPE (field)
> +	  && TREE_CODE (DECL_BIT_FIELD_TYPE (field)) == ENUMERAL_TYPE)
> +	orig_type = DECL_BIT_FIELD_TYPE (field);
> +      else
> +	orig_type = TREE_TYPE (cond);

You want unlowered_expr_type here.

Jason



More information about the Gcc-patches mailing list