-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify how scoped enums interact with varargs #86
Comments
Is there a reason to treat them differently from an unscoped |
Unscoped Does anyone still use have a macro implementation of |
You're right that you'd have to pass the scoped enum type to I guess what I'm saying is that I'm surprised that people think that this hasn't been supported behavior for the last 10+ years. Was there a bug report or something? |
Well, consider
That macro fails for If on the other hand we had So we have at least a choice between treating scoped and unscoped enums the same (and requiring the promoted underlying type to be used in the |
Well, psABIs definitely specify how to pass e.g. a one-byte struct, and if that struct is trivially copyable it's allowed with varargs, so it's not strictly true that psABIs don't specify how to pass anything smaller, even if it's not obvious that that would be the right rule to use for scoped enums. That definition of Anyway, I agree that we need to specify some sort of default rule for psABIs that are written purely in terms of C/Fortran/whatever. Note that that means specifying a rule for these types in general, not just a rule for variadic arguments. Since we have to lower them to concepts known to be handled by the psABI, I think we have two options: handle them as the underlying type or handle them as a struct containing a single field of the underlying type. The former seems like the more obvious choice. I would suggest:
I don't think we've actually specified this lowering as this level of detail for any of the existing C++-specific types. For example, we give layout rules for member pointers, but not CC rules; and I'm not sure we ever specify that references have the same representation as pointers. |
Discussion of scoped enums and varargs in CWG led to them being declared conditionally-supported with implementation-defined behavior. So we should agree on semantics here.
The text was updated successfully, but these errors were encountered: