Support std::pair constructors natively - #1440
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| // CHECK-NEXT: argByValWrapper *_this = (argByValWrapper *)malloc(sizeof(argByValWrapper)); | ||
| // CHECK-NEXT: new (static_cast<argByVal *>(_this)) argByVal(v); |
There was a problem hiding this comment.
What do we lose if we call argByValWrapper *_this = new argByValWrapper(...)? The memory will be initialized with some values but we will overwrite them. That would not lead to significant performance regression I'd think...
There was a problem hiding this comment.
Well, some constructor calls have side effects and shouldn't be called twice. A real-world example would be move-constructors. If that's better, we can check if the constructor doesn't have any side effects by examining its parameter types or other factors. Also, I think the question is more about the logic in constructor pullbacks in general than about this change in particular.
dfff217 to
c3a3224
Compare
15839d2 to
b4678f0
Compare
dfd51a1 to
4bc52ea
Compare
This PR attempts to add support for std::pair constructors without specifying their custom derivatives. There were 2 challenges: