On Tue, 25 Nov 2025, Alejandro Colomar wrote:

> +  if (!INTEGRAL_TYPE_P (type))
> +    {
> +      error_at (loc, "invalid application of %<_Maxof%> to type %qT", type);
> +      return error_mark_node;
> +    }

GNU C has an extension allowing forward references to enum types (without 
fixed underlying type) that haven't been defined yet, and such types pass 
INTEGRAL_TYPE_P.  So I think this code will accept "_Maxof (enum e)" when 
enum e hasn't been defined, and return the placeholder max value of 
unsigned int that was set when the enum e node was created to avoid 
crashing, but I think it would be better to reject _Maxof and _Minof on 
incomplete enum types instead of returning such a placeholder value.

-- 
Joseph S. Myers
[email protected]

Reply via email to