<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 9 Jun 2019 at 02:02, Tim Northover <<a href="mailto:t.p.northover@gmail.com">t.p.northover@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Adrian,<br>
<br>
This question would probably be better in cfe-dev since it's about<br>
Clang and the C++ AST rather than anything LLVM, but I'll do my<br>
best...<br>
<br>
On Sun, 9 Jun 2019 at 03:47, Adrian Tong via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> I am using clang-6 to compile this C++ code and I see a strange temporary variable allocated at expression address 0x7ff1131536e8.<br>
<br>
There are several temporaries in that code, and that address<br>
represents none of them (or all, if you prefer).<br>
<br>
The easiest one to explain is from the most deeply nested at<br>
0x7ff113153200. It's because the conditional operator is an<br>
expression, which means it has to produce a value with a single,<br>
well-specified type. In this case the LHS (read call) wants to be a<br>
bool and the RHS wants to be a cv::VideoCapture.<br>
<br>
According to C++ rules that bool can be implicitly converted to a<br>
cv::VideoCapture via one of its constructors (which takes an int). So<br>
cv::VideoCapture is chosen as the final type and Clang materializes<br>
temporaries to produce a value with that type. That's probably not<br>
what you want.<br>
<br>
I'm afraid I don't know about the outer temporaries. Definitely one for cfe-dev.<br>
<br>
Cheers.<br>
<br>
Tim.<br></blockquote><div><br></div><div>Got it. Thank you Tim. This is what I need. I will send future questions like this to cfe-dev. </div></div></div>