You can test this on godbolt. Using gcc 12.2 on x86-64 linux There appears to be an unnecessary instruction. I commented the assembly below struct T2 { bool a, b; }; static T2 test(); int myfunc() { auto [a, b] = test(); return ((int)a<<1) + b; } Result myfunc(): sub rsp, 8 call test() <-- Result is b<<8 | a add rsp, 8 movzx edx, al <--- moves a movzx eax, ah <--- extends b into itself movzx eax, al <--- Huh? lea eax, [rax+rdx*2] ret
Dup of bug 108516. *** This bug has been marked as a duplicate of bug 108516 ***