Subject: Re: bug#76573: 30.1; native compilation fails for record inside function

From: Lin Jian <[email-masked]>
Date: Wed, 23 Apr 2025 20:10:11 +0800

Sorry for the late reply.

Andrea Corallo <[email-masked]> writes:

> the compiler is complaining because while the code is trying to create
> an object of type 'foo-r', this was actually never defined.
>
> Typically those user defined objects are defined using higher level
> constructs like 'cl-defstruct' which takes care of registering the
> definition into the global state (and defining the creator
> 'make-foo-r').
>
> Why is this code trying to create never defined kind of objects?  Isn't
> the case that the code in the file being compiled is missing some
> require to the definition?

I have no idea why some elisp packages use `record' directly instead of
some higher level functions like `cl-defstruct' since I am not the
author of those packages.

If using `record' directly is a user error, I would suggest:
1. mentioning it in the manual
2. and maybe also making the behavior consistent across different
`native-comp-speed' values.