<div class="gmail_quote">On Mon, Feb 13, 2012 at 3:09 PM, jahanian <span dir="ltr"><<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am not sure which of the recent patches related to recent c++11 initializer work caused this.<br>
In this trivial test case, clang now generates a guard variable. It need not. This breaks several<br>
of our projects which do not need (must not have) guard variable.<br>
<br>
<br>
class IOService;<br>
<br>
struct IOSurfaceSendRight { void foo(); };<br>
<br>
typedef int (IOService::*IOMethod)();<br>
<br>
void a() {<br>
static IOMethod x = (IOMethod)&IOSurfaceSendRight::foo;<br>
}</blockquote><div> </div></div><div><div>We lost this in a 'cleanup' change quite a while back, which removed the clang::Expr -> llvm::Constant emission of member pointers, under the theory that the clang::APValue -> llvm::Constant emission covered all use cases. It appears that reinterpret_casts of pointers to members were covered by the old code but not the new code :-(</div>
<div><br></div></div><div>It should hopefully be straightforward to extend the constant expression evaluator to deal with such reinterpret_casts.</div><div><br></div><div>- Richard</div>