<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, Sep 30, 2016 at 11:42 PM Chandler Carruth <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Fri, Sep 30, 2016 at 11:12 PM Zachary Turner via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There's already an lvalue mutation test (see context above this diff).</blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">Doh, so there is!</div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg"> </div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  Is rvalue mutation useful?  I imagine it already works, I just didn't think to test it because there wasn't an obvious use case<br class="gmail_msg"></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">I think it is useful to ensure we don't get an accidental const in the types or otherwise mess this up when stashing storage somewhere. Even if with the current implementation we'd never write that bug, documenting that r-value ranges should be just as mutable as l-value seems worthwhile in unittests.</div></div></div></blockquote><div><br></div><div>So at least with my current implementation I can't modify the Value when creating an enumerator from an rvalue-reference.  I'll have to dig into this to figure out what the problem is, but it looks like when I declare the class member:</div><div><br></div><div>`R Range;` </div><div><br></div><div>R is of type `const std::vector<int>`.</div></div></div>