local-extern redeclaration; type refinements, default arguments,
etc. must all be locally scoped.
rdar://
13535367
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179430
91177308-0d34-0410-b5e6-
96231b3b80d8
"Decl is not a locally-scoped decl!");
// Note that we have a locally-scoped external with this name.
LocallyScopedExternCDecls[ND->getDeclName()] = ND;
-
- if (!Previous.isSingleResult())
- return;
-
- NamedDecl *PrevDecl = Previous.getFoundDecl();
-
- // If there was a previous declaration of this entity, it may be in
- // our identifier chain. Update the identifier chain with the new
- // declaration.
- if (S && IdResolver.ReplaceDecl(PrevDecl, ND)) {
- // The previous declaration was found on the identifer resolver
- // chain, so remove it from its scope.
-
- if (S->isDeclScope(PrevDecl)) {
- // Special case for redeclarations in the SAME scope.
- // Because this declaration is going to be added to the identifier chain
- // later, we should temporarily take it OFF the chain.
- IdResolver.RemoveDecl(ND);
-
- } else {
- // Find the scope for the original declaration.
- while (S && !S->isDeclScope(PrevDecl))
- S = S->getParent();
- }
-
- if (S)
- S->RemoveDecl(PrevDecl);
- }
}
llvm::DenseMap<DeclarationName, NamedDecl *>::iterator
extern int test3_array[];
int x = sizeof(test3_array); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int []'}}
}
+
+void test4() {
+ extern int test4_array[];
+ {
+ extern int test4_array[100];
+ int x = sizeof(test4_array); // fine
+ }
+ int x = sizeof(test4_array); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int []'}}
+}
// <rdar://problem/6127293>
int outer1(int); // expected-note{{previous declaration is here}}
struct outer3 { };
-int outer4(int);
+int outer4(int); // expected-note{{previous declaration is here}}
int outer5; // expected-note{{previous definition is here}}
int *outer7(int);
int outer1(float); // expected-error{{conflicting types for 'outer1'}}
int outer2(int); // expected-note{{previous declaration is here}}
int outer3(int); // expected-note{{previous declaration is here}}
- int outer4(int); // expected-note{{previous declaration is here}}
+ int outer4(int);
int outer5(int); // expected-error{{redefinition of 'outer5' as different kind of symbol}}
int* outer6(int); // expected-note{{previous declaration is here}}
int *outer7(int);
extern int outer2; // expected-note{{previous definition is here}}
int outer4;
int outer4; // expected-note{{previous definition is here}}
-int outer5;
+int outer5; // expected-note{{previous definition is here}}
int outer6(float); // expected-note{{previous definition is here}}
int outer7(float);
extern float outer2; // expected-error{{redefinition of 'outer2' with a different type}}
extern float outer3; // expected-note{{previous definition is here}}
double outer4;
- extern int outer5; // expected-note{{previous definition is here}}
+ extern int outer5;
extern int outer6; // expected-error{{redefinition of 'outer6' as different kind of symbol}}
int outer7;
extern int outer8; // expected-note{{previous definition is here}}