<div dir="ltr">Are we sure this is correct? In the motivating example, what if 'f' gets inlined? Then 'g' will have the code of 'f' embedded into it, but it will not be part of the comdat that statically initializes the guard variable.<div><br></div><div><div><div>struct S {</div><div>  static const int x;</div><div>};</div><div>// const int S::x = 42;</div><div>inline const int *f() {</div><div>  static const int y = S::x;</div><div>  return &y;</div><div>}</div><div>const int *g() { return f(); }</div></div><div><br></div></div><div>I spent a coffee break a few weeks ago worrying about this, and we came to the conclusion that we can't do this if we want to support inlining from a comdat. Maybe it's illegal for LLVM to inline f from a comdat, but that's pretty sad.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 16, 2014 at 1:02 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 1 November 2014 at 14:29, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>
> Thanks, that sounds ideal.<br>
<br>
Finally fixed by r224369. Sorry for the delay.<br>
<div class="HOEnZb"><div class="h5"><br>
Cheers,<br>
Rafael<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div></div>