of derived-to-base conversion path when implicitly starting union
subobject lifetimes in constant evaluation.
llvm-svn: 362147
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(),
u1 = u2;
return true;
}();
+
+ struct S1 {
+ int n;
+ };
+ struct S2 : S1 {};
+ struct S3 : S2 {};
+ void f() {
+ S3 s;
+ s.n = 0;
+ }
}