[PATCH] D117391: [AST] Ignore implicit nodes in CastExpr::getConversionFunction

David Rector via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 2 12:15:19 PST 2022


davrec added inline comments.


================
Comment at: clang/lib/AST/Expr.cpp:1949-1950
 
     if (E->getCastKind() == CK_ConstructorConversion)
       return cast<CXXConstructExpr>(SubExpr)->getConstructor();
 
----------------
I think the errors prove we should fall back to the most conservative possible fix: remove all the other changes and just change these 2 lines to:
```
if (E->getCastKind() == CK_ConstructorConversion) {
  if (auto *CE = dyn_cast<ConstantExpr>(SubExpr)
    SubExpr = CE->getSubExpr();
  return cast<CXXConstructExpr>(SubExpr)->getConstructor();
}
```
I'm can't quite remember but I believe that would solve the bug as narrowly as possible.  @kimgr can you give it a try if and see if it avoids the errors?
(If it doesn't, I'm stumped...)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117391/new/

https://reviews.llvm.org/D117391



More information about the cfe-commits mailing list