▲ | runevault 20 hours ago | |
Out of curiosity just clang or gcc as well? | ||
▲ | josephg 8 hours ago | parent [-] | |
I just tried it, and the problem is even worse in gcc. Given this C code:
Clang generates clean code for the eq_copy variant, but complex code for the eq_ref variant. Gcc emits pretty complex code in both variants.For example, here's eq_ref from gcc -O2:
Have a play around: https://c.godbolt.org/z/79Eaa3jYf |