================ @@ -132,18 +139,18 @@ unsigned __tree_sub_invariant(_NodePtr __x) { if (__x->__left_ == __x->__right_ && __x->__left_ != nullptr) return 0; // If this is red, neither child can be red - if (!__x->__is_black_) { - if (__x->__left_ && !__x->__left_->__is_black_) + if (__x->__color_ == __red) { + if (__x->__left_ && __x->__left_->__color_ == __red) return 0; - if (__x->__right_ && !__x->__right_->__is_black_) + if (__x->__right_ && __x->__right_->__color_ == __red) return 0; } unsigned __h = std::__tree_sub_invariant(__x->__left_); if (__h == 0) return 0; // invalid left subtree if (__h != std::__tree_sub_invariant(__x->__right_)) return 0; // invalid or different height right subtree - return __h + __x->__is_black_; // return black height of this node + return __h + (__x->__color_ == __black ? 1 : 0); // return black height of this node ---------------- ldionne wrote:
I think you should be using the accessor for getting the color here too. https://github.com/llvm/llvm-project/pull/147679 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits