<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; " class=""><br class=""><div><div class="">On Aug 27, 2011, at 8:53 AM, Douglas Gregor wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; " class=""><br class=""><div class=""><div class="">On Aug 27, 2011, at 8:46 AM, Andrew Trick wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; " class="">My revert doesn't help. I'm suspecting this is John's change?<div class=""><br class=""></div><div class=""><span style="font-family: Times; " class="Apple-style-span"><pre class=""><span style="font-family: 'Courier New', courier, monotype; " class="stdout">llvm[3]: Compiling APIntTest.cpp for Release+Asserts build
</span><span style="font-family: 'Courier New', courier, monotype; color: red; " class="stderr">/build/buildbot-llvm/clang-x86_64-linux-selfhost-rel/llvm.src/unittests/VMCore/InstructionsTest.cpp:35:13: error: calling a private constructor of class 'llvm::Use'
  EXPECT_EQ(*b, One);</span></pre></span></div></div></blockquote><div class="">Yeah, it's probably John's r<span style="font-family: Verdana, Cursor; font-size: 10px; font-weight: bold; " class="Apple-style-span"><b style="color: rgb(68, 68, 68); " class=""><a href="http://llvm.org/viewvc/llvm-project/?view=rev&revision=138691" style="color: rgb(68, 68, 68); " class="">138691</a>.</b></span></div></div></div></blockquote><div><br class=""></div>Interesting.  gtest has a metaprogramming hack:</div><div><font class="Apple-style-span" face="'Andale Mono'">  char IsNullLiteralHelper(Secret* p);</font><div><font class="Apple-style-span" face="'Andale Mono'">  char (&IsNullLiteralHelper(...))[2];  // NOLINT</font></div><div>to which we are passing a llvm::Use l-value:</div><div><font class="Apple-style-span" face="'Andale Mono'">  #define EXPECT_EQ(expected, actual) \</font></div><div><font class="Apple-style-span" face="'Andale Mono'">    EXPECT_PRED_FORMAT2(::testing::internal:: \</font></div><div><font class="Apple-style-span" face="'Andale Mono'">                        EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \</font></div><div><font class="Apple-style-span" face="'Andale Mono'">                        expected, actual)</font></div><div class="">...</div><div class=""><div class=""><font class="Apple-style-span" face="'Andale Mono'">  Constant* One = ConstantInt::get(Int1, 1, true);</font></div><div class=""><font class="Apple-style-span" face="'Andale Mono'">  const ReturnInst* r1 = ReturnInst::Create(C, One);</font></div><div class=""><font class="Apple-style-span" face="'Andale Mono'">  EXPECT_EQ(r1->getNumOperands(), 1U);</font></div><div class=""><font class="Apple-style-span" face="'Andale Mono'">  User::const_op_iterator b(r1->op_begin());</font></div><div class=""><font class="Apple-style-span" face="'Andale Mono'">  EXPECT_NE(b, r1->op_end());</font></div><div class=""><font class="Apple-style-span" face="'Andale Mono'">  EXPECT_EQ(*b, One);</font></div><div><br></div></div><div class="">We're expecting an implicit conversion from llvm::Use& to llvm::User*, and that does happen for the actual equality test, but not in this metaprogramming code.</div><div class=""><br></div><div class="">On the one hand, this is actually a source bug on a couple levels:  first, passing something through varargs does generally require copying it, and second, we're passing reversed arguments to EXPECT_EQ.  On the other hand, I'm creeped out by the fact that nobody else seems to diagnose this.  Maybe because it's in an unevaluated context?</div><div class=""><br></div><div class="">I'll fix the test and we can separately decide on a policy for when to diagnose this.</div><div class=""><br></div><div class="">John.</div></div></body></html>