<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On May 16, 2013, at 9:43 PM, John McCall <<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On May 16, 2013, at 5:11 PM, jahanian <<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>> wrote:<br><blockquote type="cite">Attached patch fixes a sema crash when gnu’s ?: extension is used for Objective-C++’s dictionary subscripting.<br>This is done by essentially allowing application of unary conversion on the common expression when<br>its type is pseudo-object type. (common expression is ObjCSubscriptRefExpr with the<br>pseudo-object type which is not suitable for the lhs expression of the conditional).<br>Please review. This is for //<span class="Apple-converted-space"> </span><a href="rdar://13749180">rdar://13749180</a><br></blockquote><br>This is the right way to fix this, but (1) go ahead and filter out all the<br>placeholder types instead of just pseudo-objects, and (2) please do<br>that before this check so that we can do the right thing for getters<br>of reference type.<br><br>That is, do this:<br> // Lower out placeholder types first.  This is important so that we don't<br> // try to capture a placeholder, and it also lets us do the right thing in<br> // a few cases in C++.<br> // the placeholder happens<br> if (commonExpr->hasPlaceholderType()) {<br>   ExprResult result = CheckPlaceholderExpr(commonExpr);<br>   if (!result.isUsable()) return ExprError();<br>   commonExpr = result.take();<br> }<br><br>This should make us do the right thing with overloaded function<br>references;  here's a test case for that:<br><br> template <class T, class U = T> T foo(U x) { return x; }<br> ...<br> int (*fn)(int) = (&foo<int> ?: 0);<br><br>(this might not be *useful*, but it should *work*)<br><br>And here's an ObjC++ test case for a reference-valued property:<br> @interface A<br> - (int &) foo;<br> @end<br> ...<br> void test(A *a) {<br>   int x = 0;<br>   int &y = a.foo ?: x;<br> }<br></div></blockquote><div><br></div>Somehow, these two tests were not adequate to show the necessity for more general lowering of placeholder types.</div><div>Regardless, r182120 does this as you suggested. Thanks for the detailed review.</div><div><br></div><div>- Fariborz</div><div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>John.</div></blockquote></div><br></body></html>