Do not allow callconv
, align
, addrspace
, or linksection
to reference function arguments
#22261
Labels
Milestone
Split out from #11834.
Allowing these things to reference previous parameters requires the compiler implementation to track all of these properties in more places, increasing memory consumption. It also requires the compiler to have a separate representation of these properties for functions vs other declarations.
Another implementation problem with
callconv
in particular, originally mentioned in #11834, is that status quo can lead to us finding out that a function should be inlined (due to havingcallconv(.@"inline")
) after analyzing its arguments, which is too late -- we've already started creating a generic instantiation! (Admittedly, though, this problem still exists -- and likely always will exist -- for the case of a return type turning out to be comptime-only.)There isn't much point in actually allowing this; you'd have to be deep in generic crazy land to be affected by this change, and if you really need it, you can wrap your whole function in a generic type. Therefore, this proposal is to disallow the bodies of
callconv(...)
,align(...)
,addrspace(...)
, andlinksection(...)
on function bodies from referring back to function parameters.The text was updated successfully, but these errors were encountered: