On 2/29/24 15:56, Patrick Palka wrote:
Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look
OK for trunk?

-- >8 --

For local enums defined in a non-template function or a function template
instantiation it seems we neglect to make the function depend on the enum
definition, which ultimately causes streaming to fail due to the enum
definition not being streamed before uses of its enumerators are streamed,
as far as I can tell.

I would think that the function doesn't need to depend on the local enum in order for the local enum to be streamed before the use of the enumerator, which comes after the definition of the enum in the function body?

Why isn't streaming the body of the function outputting the enum definition before the use of the enumerator?

This was nearly enough to make things work, except we now ran into
issues with the local TYPE/CONST_DECL copies when streaming the
constexpr version of a function body.  It occurred to me that we don't
need to make copies of local types when copying a constexpr function
body; only VAR_DECLs etc need to be copied for sake of recursive
constexpr calls.  So this patch adjusts copy_fn accordingly.

Maybe adjust can_be_nonlocal instead? It seems unnecessary in general to remap types and enumerators for inlining.

Jason

Reply via email to