[cfe-commits] r81309 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/static-array-member.cpp

Eli Friedman eli.friedman at gmail.com
Tue Sep 8 18:50:49 PDT 2009


On Tue, Sep 8, 2009 at 6:45 PM, Douglas Gregor<dgregor at apple.com> wrote:
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Sep  8 20:45:28 2009
> @@ -980,6 +980,13 @@
>   if (getLangOptions().CPlusPlus) {
>     if (Context.hasSameType(New->getType(), Old->getType()))
>       MergedT = New->getType();
> +    // C++ [basic.types]p7:
> +    //   [...] The declared type of an array object might be an array of
> +    //   unknown size and therefore be incomplete at one point in a
> +    //   translation unit and complete later on; [...]
> +    else if (Old->getType()->isIncompleteArrayType() &&
> +             New->getType()->isArrayType())
> +      MergedT = New->getType();
>   } else {
>     MergedT = Context.mergeTypes(New->getType(), Old->getType());
>   }

Do you need to check that the element types are the same?

-Eli




More information about the cfe-commits mailing list