<p dir="ltr">Expressions in C++ never have reference type. You can use getValueKind() to find if the expression is an lvalue or an rvalue. What is the problem you're trying to solve here?</p>
<div class="gmail_quote">On Nov 8, 2015 6:30 AM, "victor via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div dir="ltr">Hi everyone,<br><br>Today I noticed an unusual behavior when using 
Clang. I found that the type of one of the arguments in a 
CXXConstructExpr was different from the type that I expected.<br><br>This is the fragment of code:<br><br>void QDomAttrPrivate::setNodeValue(const QString& v)<br>{<br>    <b>QDomTextPrivate *t = new QDomTextPrivate(0, this, v);</b><br>    ....<br>}<br><br>The invoked constructor is:<br><i>QDomTextPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& val);</i><br><br>and this is the related AST:<br><br><font style="font-size:10pt" size="2">|   |-DeclStmt 0x7f67b329cdb8 <line:4108:5, col:57></font><font style="font-size:10pt" size="2"><br></font><font style="font-size:10pt" size="2">|   | `-VarDecl 0x7f67b329c7f0 <col:5, col:56> t 'class QDomTextPrivate *'</font><font style="font-size:10pt" size="2"><br></font><font style="font-size:10pt" size="2">|   |   `-CXXNewExpr 0x7f67b329cd60 <col:26, col:56> 'class QDomTextPrivate *'</font><font style="font-size:10pt" size="2"><br></font><font style="font-size:10pt" size="2">|  
 |     `-CXXConstructExpr 0x7f67b329cd18 <col:30, col:56> 'class 
QDomTextPrivate' 'void (class QQDomDocumentPrivate *, class 
QDomNodePrivate *, const class QString &)'</font><font style="font-size:10pt" size="2"><br></font><font style="font-size:10pt" size="2">|   |       |-ImplicitCastExpr 0x7f67b329cce0 <col:46> 'class QQDomDocumentPrivate *' <NullToPointer></font><font style="font-size:10pt" size="2"><br></font><font style="font-size:10pt" size="2">|   |       | `-IntegerLiteral 0x7f67b329c848 <col:46> 'int' 0</font><font style="font-size:10pt" size="2"><br></font><font style="font-size:10pt" size="2">|   |       |-ImplicitCastExpr 0x7f67b329ccf8 <col:49> 'class QDomNodePrivate *' <DerivedToBase (QDomNodePrivate)></font><font style="font-size:10pt" size="2"><br></font><font style="font-size:10pt" size="2">|   |       | `-CXXThisExpr 0x7f67b329c868 <col:49> 'class QDomAttrPrivate *' this</font><font style="font-size:10pt" size="2"><br></font><font style="font-size:10pt" size="2">|   |       `-DeclRefExpr 0x7f67b329c880 <col:55> '<b>const class QString</b>' lvalue ParmVar 0x7f67b329c560 'v' '<b>const class QString &</b>'</font><font style="font-size:8pt" size="1"><br></font><font style="font-size:8pt" size="1"><br></font>What<span> I</span><span> find</span><span> strange</span>
 is that the type of the ParmVar 'v' loses the '&'. The problem is 
that, when I compare the "getType()" of the third argument in the 
CXXConstructExpr (1) and the "getType()" of the third parameter of the 
constructor (2), the types do not match:<br><br>(1) const class QString<br>(2) const class QString &<br><br>Why is this happening? And what's more important, how do I sort out this issue? <br><br>Thanks.                                     </div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div>