<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Thank you for your answer Richard. The goal is to know if there is another method (apart from the constructor) that could accept the same arguments provided in the calling. To that end, I was comparing the arguments in the calling with the parameters of other methods.<br><br>Is this the only case where the type obtained from the expression do not match with the type of the parameter? Maybe I should take the constructor declaration invoked instead of the constructor expression and compare the parameters of other methods directly with the constructor, but I can't remember if I opted for using the construction expression for any reason.<br><br><div><hr id="stopSpelling">Date: Sun, 8 Nov 2015 12:24:09 -0800<br>Subject: Re: [cfe-dev] Strange type of an argument in CXXConstructExpr<br>From: richard@metafoo.co.uk<br>To: pedretti_86@hotmail.com<br>CC: cfe-dev@lists.llvm.org<br><br><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="ecxgmail_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><blockquote class="ecxgmail_quote" style="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></div>                                     </div></body>
</html>