diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-30 20:45:12 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-30 20:45:12 +0000 |
commit | a481b01e958b19c2eb6564ab8930eae9058967f8 (patch) | |
tree | 28a023709f019a84982f199585e8cd9c590b59e3 /clang/lib | |
parent | a4e3b50e2651510d2d93a0f3128d4bcceb3ea3d3 (diff) | |
download | bcm5719-llvm-a481b01e958b19c2eb6564ab8930eae9058967f8.tar.gz bcm5719-llvm-a481b01e958b19c2eb6564ab8930eae9058967f8.zip |
[c++2a] Fix assertion failure if we would walk over more than one level
of derived-to-base conversion path when implicitly starting union
subobject lifetimes in constant evaluation.
llvm-svn: 362147
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index ac21b63cc79..df9b3067b8d 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -5031,7 +5031,8 @@ static bool HandleUnionActiveMemberChange(EvalInfo &Info, const Expr *LHSExpr, if (ICE->getCastKind() != CK_DerivedToBase && ICE->getCastKind() != CK_UncheckedDerivedToBase) break; - for (const CXXBaseSpecifier *Elt : ICE->path()) { + // Walk path backwards as we walk up from the base to the derived class. + for (const CXXBaseSpecifier *Elt : llvm::reverse(ICE->path())) { --PathLength; (void)Elt; assert(declaresSameEntity(Elt->getType()->getAsCXXRecordDecl(), |