<p dir="ltr">Reduced from the Linux kernel. </p>
<div class="gmail_quote">On Mar 10, 2015 9:49 PM, "Richard Smith" <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 10, 2015 at 6:20 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>On Tue, Mar 10, 2015 at 6:02 PM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>> On Mar 9, 2015, at 3:05 PM, Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>> wrote:<br>
> If I remember correctly, clang's strategy for handling language linkage in C is to pretend that C has language linkage and say that everything has C language linkage.<br>
><br>
> If that is the case, the attached patch is probably the correct fix.<br>
<br>
</span>Hmm.  This is probably a crash/miscompile waiting to happen in a lot of different places.  You can produce it in potentially-evaluated code in C++, too, in an in-class initializer.<br>
<br>
We should probably push a local DeclContext when we enter a statement-expression outside of a local context.<br></blockquote><div><br></div></div></div><div>+1, my first reaction to the reduced test case was, "why are we in a record declcontext when declaring variables in statement expressions?" Finding a way to get out of that state seems like a better fix.</div></div></div></div>
</blockquote></div><br></div><div class="gmail_extra">GCC is generally more aggressive at rejecting statement expressions not at block scope than we are; I'm surprised it accepts this case. Did this come up in some important code somewhere, or can we just reject this?</div></div>
</blockquote></div>