On Sat, Jun 8, 2013 at 2:05 PM, Reid Kleckner <[email protected]> wrote:
> I don't think this approach is working very well.
>
> 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:
>
> void t22(void (*take_array(int array[1]))) {
> int arr[1];
> take_array(arr); // error: array initializer must be an initializer list
> }
>
> 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.
>
> The full traversal seems silly. Maybe I should be changing the consumers
> of the function types to handle array types instead?
>
>
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).
-Eli
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits