-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
Add __traits(initSymbol, <aggregate type>) #3774
Conversation
Please do submit this upstream |
I have 0 interest to tackle the DMD glue stuff but it's all prepared for simple upstreaming (that's why it's not in |
Noted, added upstream PR to reduce frontend diff |
Nice, much better than the pragma hack indeed. |
A clean way of directly accessing struct and class init symbols. It yields a `const(void[])` slice; the length reflecting the struct/class instance size, and the pointer either pointing to the init symbol or being null for zero-initialized structs. Paves the way for resolving ldc-developers#3773 in druntime as well as accessing class init symbols without `TypeInfo_Class.initializer()` indirection, and so with -betterC as well.
Reverted from |
`__traits(initSymbol, S)` was introduced in ldc-developers/ldc#3774 and provides access to the initializer symbol of `S` in a way that does not rely on `TypeInfo` or other hacks. This commit contains some small adjustments to the initial patch which improve the user experience: - generated `VarExp` points to the `TraitsExp` instead of the symbol LoC - CTFE issues a specific error message - more extensive tests Co-authored-by: Nicholas Wilson <iamthewilsonator@hotmail.com>
`__traits(initSymbol, S)` was introduced in ldc-developers/ldc#3774 and provides access to the initializer symbol of `S` in a way that does not rely on `TypeInfo` or other hacks. This commit contains some small adjustments to the initial patch which improve the user experience: - generated `VarExp` points to the `TraitsExp` instead of the symbol LoC - CTFE issues a specific error message - rejects interfaces because they don't have an initializer symbol and hence cause linker failures - more extensive tests Co-authored-by: Nicholas Wilson <iamthewilsonator@hotmail.com>
`__traits(initSymbol, S)` was introduced in ldc-developers/ldc#3774 and provides access to the initializer symbol of `S` in a way that does not rely on `TypeInfo` or other hacks. This commit contains some small adjustments to the initial patch which improve the user experience: - generated `VarExp` points to the `TraitsExp` instead of the symbol LoC - CTFE issues a specific error message - rejects interfaces because they don't have an initializer symbol and hence cause linker failures - more extensive tests Co-authored-by: Nicholas Wilson <iamthewilsonator@hotmail.com>
`__traits(initSymbol, S)` was introduced in ldc-developers/ldc#3774 and provides access to the initializer symbol of `S` in a way that does not rely on `TypeInfo` or other hacks. This commit contains some small adjustments to the initial patch which improve the user experience: - generated `VarExp` points to the `TraitsExp` instead of the symbol LoC - CTFE issues a specific error message - rejects interfaces because they don't have an initializer symbol and hence cause linker failures - more extensive tests Co-authored-by: Nicholas Wilson <iamthewilsonator@hotmail.com>
`__traits(initSymbol, S)` was introduced in ldc-developers/ldc#3774 and provides access to the initializer symbol of `S` in a way that does not rely on `TypeInfo` or other hacks. This commit contains some small adjustments to the initial patch which improve the user experience: - generated `VarExp` points to the `TraitsExp` instead of the symbol LoC - CTFE issues a specific error message - rejects interfaces because they don't have an initializer symbol and hence cause linker failures - more extensive tests Co-authored-by: Nicholas Wilson <iamthewilsonator@hotmail.com>
`__traits(initSymbol, S)` was introduced in ldc-developers/ldc#3774 and provides access to the initializer symbol of `S` in a way that does not rely on `TypeInfo` or other hacks. This commit contains some small adjustments to the initial patch which improve the user experience: - generated `VarExp` points to the `TraitsExp` instead of the symbol LoC - CTFE issues a specific error message - rejects interfaces because they don't have an initializer symbol and hence cause linker failures - more extensive tests Co-authored-by: Nicholas Wilson <iamthewilsonator@hotmail.com>
`__traits(initSymbol, S)` was introduced in ldc-developers/ldc#3774 and provides access to the initializer symbol of `S` in a way that does not rely on `TypeInfo` or other hacks. This commit contains some small adjustments to the initial patch which improve the user experience: - generated `VarExp` points to the `TraitsExp` instead of the symbol LoC - CTFE issues a specific error message - rejects interfaces because they don't have an initializer symbol and hence cause linker failures - more extensive tests Co-authored-by: Nicholas Wilson <iamthewilsonator@hotmail.com>
`__traits(initSymbol, S)` was introduced in ldc-developers/ldc#3774 and provides access to the initializer symbol of `S` in a way that does not rely on `TypeInfo` or other hacks. This commit contains some small adjustments to the initial patch which improve the user experience: - generated `VarExp` points to the `TraitsExp` instead of the symbol LoC - CTFE issues a specific error message - rejects interfaces because they don't have an initializer symbol and hence cause linker failures - more extensive tests Co-authored-by: Nicholas Wilson <iamthewilsonator@hotmail.com>
A clean way of directly accessing struct and class init symbols. It yields a
const(void[])
slice; the length reflecting the struct/class instance size, and the pointer either pointing to the init symbol or being null for zero-initialized structs.Paves the way for resolving #3773 in druntime as well as accessing class init symbols without
TypeInfo_Class.initializer()
indirection, and so with-betterC
as well.