vinayakdsci wrote:

@cor3ntin gentle ping. How exactly should I proceed? copy elision was made 
mandatory in C++17, so wouldn't a warning for C++ < 17 be allowable?

I am very happy to implement any suggestions you have for this PR, but I am 
unable to get the code to work for C++ < 17 because the constructors are not 
marked elidable in the code for these standards.

Specifically in the case where the class object is initialized by an '=' sign 
instead of an explicit argument being passed. As the RHS of the '=' is 
different from a `CXXRecordDecl`, `isTemporaryObject()` returns false and thus 
sets the constructor as non-elidable. This is where I am not sure on how to 
proceed, as changing this behavior breaks a number of assertions in the code 
path followed while compiling the source program. Either I could check if the 
RHS of the assignment is an rvalue, and then add an OR condition to set 
Elidable for the constructor to true. However, _whenever_ the constructor is 
elidable, the codegen emits _directly_, and expects an aggregate type to passed 
in, which is not true for a scalar such as an `int`.

Also, this would involve a conversion process in the code?

I would really appreciate pointers on how to solve this problem, and how to 
improve this PR too.

Thanks!

https://github.com/llvm/llvm-project/pull/81127
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to