Oh I just meant improving the error message.  Chandlerc has ideas on the constness issue (probably involving const_cast)<br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 21, 2017 at 3:35 AM Pavel Labath via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">labath added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D34405#785627" rel="noreferrer" target="_blank">https://reviews.llvm.org/D34405#785627</a>, @zturner wrote:<br>
<br>
> In <a href="https://reviews.llvm.org/D34405#785598" rel="noreferrer" target="_blank">https://reviews.llvm.org/D34405#785598</a>, @labath wrote:<br>
><br>
> > 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.<br>
><br>
><br>
> 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.<br>
<br>
<br>
This idea intrigued me, so I tried playing around with it. Unfortunately, I have to report back that I think this is not possible. The first thing that the EXPECT_THAT macro does is pass the value through the `testing::internal::PredicateFormatterFromMatcher` class, which takes the value as `const T &`. From this point on, nothing we do can help as the value is already unmodifyable.<br>
<br>
I was able to get this working by specializing this class and adding the overloads for other value categories, but this is a pretty big hack, and I think we don't want that. In light of that, I propose to stick to the current implementation. I think we should optimize for error message length, and having an extra TakeExpected overload is a small price to pay for that.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D34405" rel="noreferrer" target="_blank">https://reviews.llvm.org/D34405</a><br>
<br>
<br>
<br>
</blockquote></div>