diff options
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 45df133ad57..c3e41658c29 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -133,7 +133,11 @@ namespace { E = E->IgnoreParens(); // If we're doing a variable assignment from e.g. malloc(N), there will - // probably be a cast of some kind. Ignore it. + // probably be a cast of some kind. In exotic cases, we might also see a + // top-level ExprWithCleanups. Ignore them either way. + if (const auto *EC = dyn_cast<ExprWithCleanups>(E)) + E = EC->getSubExpr()->IgnoreParens(); + if (const auto *Cast = dyn_cast<CastExpr>(E)) E = Cast->getSubExpr()->IgnoreParens(); |

