On Saturday, 12 December 2020 at 01:02:56 UTC, SealabJaster wrote:
Please see this shortened snippet: https://godbolt.org/z/j8f3x5

I've ran into annoyances before when using aliases to member fields, but something subtle like this was rather annoying to figure out.

Why does the compiler feel the need to embed a context pointer anytime you provide an to alias a member?

In my case the function was also writing seemingly garbage values into the .ptr and .length fields for the ref'd string, but it doesn't seem to happen in the godbolt snippet.

Bonus, a pet peeve of mine: https://godbolt.org/z/bnK91f

I don't have an answer, but aliasing non-static fields outside the struct isn't something one does often. This is probably a bug.

Reply via email to