<div class="gmail_quote">On Thu, Jul 26, 2012 at 3:12 PM, Nikola Smiljanic <span dir="ltr"><<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> Please move this into an "if (FTI.isAmbiguous)" check. We don't want to pay<br>
> for this when building every function type. Also, if you can factor this out<br>
> to a separate function, that would help avoid disrupting the flow of this<br>
> function.<br>
<br>
</div>In that case I could add a function IsPointerDeclarator (probably<br>
should name it differently?) to Declarator and call both it and<br>
IsFunctionDeclarator inside the "if (FTI.isAmbiguous)". The code would<br>
look something like this:<br>
<br>
// avoid other costly checks if possible<br>
if (FTI.isAmbiguous) {<br>
    if (other conditions including IsFunctionDeclarator and IsPointerDeclarator)<br>
<div class="im">}<br></div></blockquote><div><br></div><div>I meant, move all the ambiguous direct init / function declaration checking into a separate function, not just this loop.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
> We should also be checking (RT->isRecordType() || FTI.NumArgs <= 1) here.<br>
<br>
</div>I still don't get this part, but it might be because we don't<br>
understand each other about the "return type a reference" stuff. See<br>
the next part.<br>
<div class="im"><br>
> I don't follow. If the return type is a reference, then it's not a class type.<br>
<br>
</div>I'm not very good at standardese so my terminology might be off. When<br>
I say a reference, I mean something like this:<br>
<br>
int &foo();<br>
MyClass &bar();<br>
<br>
Return type is a reference to some other type that might be a class<br>
type (class MyClass {};) or a built-in type. I just don't see how<br>
return type being a class type changes anything?</blockquote><div><br></div><div>For the cases where the return type is a reference, I completely agree with you -- there must be exactly one argument. </div><div><br></div>
<div>In these cases, the return type isn't a class type, it's a reference type. The class type case looks like this:</div><div><br></div><div>MyClass bar(x, y);</div><div><br></div><div>The point is, if we're not in this case, there can be at most one argument, because you can only have multiple arguments in a direct-initialization if you're calling a constructor.</div>
<div><br></div><div>So the rules are:</div><div> - if the return type is not a class type, there can be at most one parameter</div><div> - if the return type is a reference type, there must be exactly one parameter</div><div>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I hope you understand what it is that I don't understand. Sorry for<br>
being such a pain, and thanks for all the help!<br>
</blockquote></div><br><div>I hope the above helps to clarify.</div>