Hi Joseph,

On Tue, Nov 25, 2025 at 08:17:05PM +0000, Joseph Myers wrote:
> 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.

Thanks!  Agree; I've added code rejecting !COMPLETE_TYPE_P(type).
I'll test and send v8.


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).

Attachment: signature.asc
Description: PGP signature

Reply via email to