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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to