Post #2813113
2026-05-11 13:30 UTC
@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.
Replies (1)
-
@thephd@pony.social 2026-05-11 13:42
@simontatham@hachyderm.io It was more of an implementation peculiarity than anything else, really. Internally, we check if what is coming in is a modifiable lvalue and -- if it is -- take a reference to it. Unfortunately the way we were doing it before took a reference to the stripped-down type if certain kinds of pointers got involved, and this wrecked parsing a little bit. But that part's been fixed and the modifiable lvalue bit is only taken later.