<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 3, 2013, at 10:02 , Douglas Gregor <<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On May 3, 2013, at 9:46 AM, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi, Richard, Doug, et al. Somebody internally came up with a C++11 example that generates a strange AST:<div><br></div><div><div></div></div><blockquote type="cite"><div>struct Point {</div><div><span class="Apple-tab-span" style="white-space: pre;">    </span>Point(int x, int y);</div><div>};</div><div><br></div><div>void use(Point);</div><div><br></div><div>void test() {</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>use((Point){1, 2});</div><div>}</div></blockquote><div><br></div><div><div>`-FunctionDecl 0x7fa6410604b0 <line:7:1, line:9:1> test 'void (void)'</div><div>  `-CompoundStmt 0x7fa641060d00 <line:7:13, line:9:1></div><div>    `-CallExpr 0x7fa641060c30 <line:8:2, col:19> 'void'</div><div>      |-ImplicitCastExpr 0x7fa641060c18 <col:2> 'void (*)(struct Point)' <FunctionToPointerDecay></div><div>      | `-DeclRefExpr 0x7fa641060bc8 <col:2> 'void (struct Point)' lvalue Function 0x7fa6410603b0 'use' 'void (struct Point)'</div><div>      `-CXXConstructExpr 0x7fa641060cc8 <col:6> 'struct Point' 'void (struct Point &&) noexcept' elidable</div><div>        `-MaterializeTemporaryExpr 0x7fa641060c60 <col:6, <invalid sloc>> 'struct Point' xvalue</div><div><b>          `-CompoundLiteralExpr 0x7fa641060ba0 <col:6, <invalid sloc>> 'struct Point'</b></div><div><b>            `-CXXTemporaryObjectExpr 0x7fa641060a00 <col:6, <invalid sloc>> 'struct Point' 'void (int, int)'</b></div><div>              |-IntegerLiteral 0x7fa6410605b8 <col:14> 'int' 1</div><div>              `-IntegerLiteral 0x7fa6410605d8 <col:17> 'int' 2</div></div><span></span><div><br></div><div>Notice the CXXTemporaryObjectExpr inside the CompoundLiteralExpr. Normally a CompoundLiteralExpr is used to initialize aggregates, and so its child is an InitListExpr. Here, though, the object is being initialized via a constructor, and so it's not really a compound literal at all, even though it looks like one. I can hack around this in the analyzer, but honestly I don't think we be forming a CompoundLiteralExpr at all. What do you think?</div></div></blockquote><br></div><div>It actually is a compound literal, because this isn't syntax that would be accepted by pure C++11. So, it should be described as a CompoundLiteralExpr in the AST. We could clean up the AST for CompoundLiteralExpr to directly describe constructor calls, but this representation doesn't seem wrong per se.</div></div></blockquote><br></div><div>Well, that's weird. Okay, thanks for the explanation.</div><div>Jordan</div><br></body></html>