Fix initialization of const references
Reference lifetime extension only applies in this case const T& R = T(...); or const T& R = f(...); // where f returns T This means the temporary bound to R will be destroyed at the end of the block so R can be safely used until then. However it does not apply in this case const T& R = T(...).modifier(...); not even if T::modifier returns 'const T&'. It doesn't matter: the temporary T() will be destroyed at the ';" MachineInstrBuilder has a particularly annoying error-prone API that leads to these kind of errors. Let's not use 'const MachineInstrBuilder &' ever. Not even when it could work: just in case later we decide to extend the instruction being built calling a 'modifier'.
Loading
Please sign in to comment