<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jun 8, 2013 at 2:05 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">I don't think this approach is working very well.<div><br></div><div>The problem is that I'm trying to keep the un-decayed array types in TSI, and these get propagated into many places they shouldn't.  My patch breaks tests like:</div>


<div><br></div><div><div>void t22(void (*take_array(int array[1]))) {</div><div>  int arr[1];</div><div>  take_array(arr); // error: array initializer must be an initializer list</div><div>}</div><div><br></div><div>
The problem is that GetFullTypeForDeclarator() returns a TypeSourceInfo, so all I have to do is nest the un-decayed type deep inside that TSI.  Then it becomes hard to find and adjust parameter types without doing a full traversal.</div>


<div><br></div></div><div>The full traversal seems silly.  Maybe I should be changing the consumers of the function types to handle array types instead?<br><br></div></div></blockquote><div><br></div><div>I think it makes sense for non-canonical FunctionTypes to keep around undecayed array types as parameters.  Anything that queries a FunctionTypeLoc for a should be prepared to run into undecayed array types in parameters.  (It doesn't make sense to build a TypeSourceInfo for a pointer which was never actually written in the code.)  It might make sense for the default iterators/accessors for FunctionTypes to automatically decay the parameter types, with an alternate version for anything that really wants the undecayed type (e.g. the TypeLoc code).<br>
<br></div></div></div><div class="gmail_extra">-Eli<br></div></div>