Post #2813112
2026-05-11 13:26 UTC
Replies (1)
-
@simontatham@hachyderm.io 2026-05-11 13:30
@thephd@pony.social so it is – my own godbolt link also works now, I guess because the compiler version updated under its feet. (Although that was confusing, because I re-checked my link this morning and it still failed, even though the "i" button for the compiler reported git commit 916de97c3dea18a469628e498a83162fa85e41ee, which is the same one it reports now and looked in your git repo as if it contained the fix. Presumably the compiler info and the actual results didn't update in sync.) Now I've looked more carefully at N3888, I see that existing _Generic is expected to return an lvalue if it can, which I'd never thought to try. I guess that's where the references came in? Your implementation converted the type to a reference internally so that it could be an lvalue if it escaped the _Generic? And somehow, when the type was a pointer, it accidentally became a pointer-to-ref instead of a ref-to-pointer.