On Wed, Dec 10, 2008 at 12:44 PM, Douglas Gregor <[EMAIL PROTECTED]> wrote:
>>> +/// getDependentSizedArrayType - Returns a non-unique reference to
>>> +/// the type for a dependently-sized array of the specified element
>>> +/// type. FIXME: We will need these to be uniqued, or at least
>>> +/// comparable, at some point.
>>>
>> Do VLAs have the same FIXME? Why do we need this?
>
> VLAs do have the same FIXME, although I don't think we actually need
> VLAs to be uniqued.

I'm pretty sure you're right: VLA types contain expressions that are
tied to the location of their declaration, so we don't want to unique
them.  In "int x=1;int a[x++];int b[x++];", for example, the sizes are
the same expression, but they're certainly not the same type.

> With dependently-sized array types, we need them
> to be unique so that we can determine that the types of the arrays
> match in the parameter types of the functions "f" below:
>
>        template<int I, int J> void f(int (&array)[I+J]);
>        template<int X, int Y> void f(int (&array)[X+Y]) { ... }
>
> If we don't realize that those canonical types match, we'll think that
> the definition is actually an overload rather than a redeclaration.
> Not good!

Ouch, seems like a pain to implement.

-Eli
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to