[cfe-commits] r71946 - in /cfe/trunk/lib/Sema: SemaDecl.cpp SemaExpr.cpp
Eli Friedman
eli.friedman at gmail.com
Mon May 18 14:43:36 PDT 2009
On Mon, May 18, 2009 at 11:29 AM, Douglas Gregor <dgregor at apple.com> wrote:
>> @@ -916,7 +916,13 @@
>> MergeAttributes(New, Old, Context);
>>
>> // Merge the types
>> - QualType MergedT = Context.mergeTypes(New->getType(), Old->getType());
>> + QualType MergedT;
>> + if (getLangOptions().CPlusPlus) {
>> + if (Context.hasSameType(New->getType(), Old->getType()))
>> + MergedT = New->getType();
>> + } else {
>> + MergedT = Context.mergeTypes(New->getType(), Old->getType());
>> + }
>> if (MergedT.isNull()) {
>> Diag(New->getLocation(), diag::err_redefinition_different_type)
>> << New->getDeclName();
>
> This is slightly too strict in C++, because it's okay to redeclare a
> variable that has an incomplete type with a complete type (and vice versa).
> Here's a test case that used to work in C++ but doesn't now:
>
> extern int array[10];
> extern int array[];
> extern int array[10];
Okay. I can fix it if you want; can you give me a citation for the rules?
-Eli
More information about the cfe-commits
mailing list