[PATCH] D34405: [Testing/Support] Remove the const_cast in TakeExpected

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 20 10:20:51 PDT 2017


zturner added a comment.

In https://reviews.llvm.org/D34405#785598, @labath wrote:

> In https://reviews.llvm.org/D34405#785558, @zturner wrote:
>
> > Right, but we have the `ASSERT_THAT_EXPECTED` macro, which can be re-written as `ASSERT_THAT(llvm::detail::Expected(std::move(Err), Matcher))`
>
>
> Ah, that would work, I haven't thought of that.
>
> I am not entirely thrilled by that, as that adds more bloat to the error  message ("llvm::detail::TakeExpected(std::move(original_assert_expression)) failed"), but I could go with that.


I think we can fix that by using a full blown class based implementation of `MatcherImpl` instead of the `MATCHER_P` macro.  But it was a bit tricky so I didn't attempt it yet.


https://reviews.llvm.org/D34405





More information about the llvm-commits mailing list