[PATCH] D109800: [clang] don't mark as Elidable CXXConstruct expressions used in NRVO
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 15 17:28:29 PDT 2021
rsmith added a comment.
There might be some tooling out there that cares about `CXXConstructExpr`s that might be elided due to NRVO being marked as elidable. But it's probably OK to lose that marking if nothing in-tree is relying on it, and use `isElidable` only for copy elision from rvalues and not for NRVO.
I would have expected that we'd also assert for a case like this (in C++14 and earlier):
struct b {};
struct a : b {
a();
a(a &);
a(const b &);
};
a c() {
if (0) { return a(); }
return a();
}
... and that this patch wouldn't help there. But it looks like we don't mark the `a(const b&)` constructor call here as elidable, which seems like a bug, but might not be one worth fixing?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109800/new/
https://reviews.llvm.org/D109800
More information about the cfe-commits
mailing list