[PATCH] D26123: Fix SegFault in Expected

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 2 08:03:15 PDT 2016


vsk added a comment.

(I'm just trying to wrap my head around this.)

It looks like getErrorStorage() provides a pointer to an error_type (std::unique_ptr<ErrorInfoBase>), but we're storing an Error (funky pointer-int pair) into it. Since this started causing problems after r285426, I'm wondering what the reproducer looks like / why we haven't seen this issue already. Would you need to look into an unchecked Error?, e.g:

  auto E = Expected<int>(make_error<MyErrorInfo>(...));
  ASSERT_DEATH(*E);

If there's a way to add a unit test to unittests/Support/ErrorTest without introducing a death test, that would be great.


https://reviews.llvm.org/D26123





More information about the llvm-commits mailing list